|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaggregate.AbstractCollection<E>
jaggregate.AbstractExtensibleCollection<Pair<K,V>>
jaggregate.AbstractDictionaryImpl<K,V>
jaggregate.IdentityDictionary<K,V>
K - a restriction on the types of the keys that may be contained in the
dictionaryV - a restriction on the types of the values that may be contained in the
dictionarypublic class IdentityDictionary<K,V>
Represents an unordered collection whose elements can be accessed using an
explicitly assigned external key. Key equivalence is defined by
==.
| Constructor Summary | |
|---|---|
IdentityDictionary()
Creates an empty dictionary. |
|
IdentityDictionary(AbstractDictionary<? extends K,? extends V> associations)
Creates a dictionary that contains the given associations. |
|
IdentityDictionary(Pair<? extends K,? extends V>... associations)
Creates a dictionary that contains the given associations. |
|
| Method Summary | ||
|---|---|---|
|
collect(UnaryFunctor<? super Pair<K,V>,? extends R> transformer)
Evaluates the given transformer for each element of this collection, with the element as the parameter, and answers a new collection containing the results of these evaluations. The elements are traversed in the order specified by forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. |
|
|
collectValues(UnaryFunctor<? super V,? extends R> transformer)
Answers a new dictionary whose keys are this dictionary's keys, and whose corresponding elements are the results of evaluating the given transformer with each corresponding element of this dictionary. For each of this dictionary's keys, a new element is obtained by evaluating transformer with the
corresponding element of this dictionary as a parameter.
The elements are traversed in the order specified by forEachDo for this dictionary. |
|
static
|
emptyIdentityDictionary()
Creates an empty dictionary. |
|
static
|
identityDictionaryFrom(AbstractDictionary<? extends T,? extends U> associations)
Creates a dictionary that contains the given associations. |
|
static
|
identityDictionaryFrom(Pair<? extends T,? extends U>[] associations)
Creates a dictionary that contains the given associations. |
|
static
|
identityDictionaryWith(Pair<? extends T,? extends U> firstAssociation,
Pair<? extends T,? extends U>... restOfAssociations)
Creates a dictionary that contains the given associations. |
|
IdentityDictionary<K,V> |
reject(UnaryCondition<? super Pair<K,V>> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer false.
For each element of this collection, discriminator is evaluated with the
element as the parameter. Each element which causes discriminator to
answer false is included in the new collection.
The elements are traversed in the order specified by forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection. |
|
IdentityDictionary<K,V> |
rejectValues(UnaryCondition<? super V> discriminator)
Answers a new dictionary which excludes the elements in this dictionary that cause the given discriminator to answer true.
For each of this dictionary's keys, discriminator is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer false, the key is added to the answer with the element as its
corresponding value. |
|
boolean |
retainAll(Collection<? extends Pair<K,V>> keepers)
Removes each element of this collection that is not contained in the given collection. Note that if the given collection is empty, this method has the effect of "clearing" this collection. |
|
IdentityDictionary<K,V> |
select(UnaryCondition<? super Pair<K,V>> discriminator)
Answers a new collection which contains only the elements in this collection which cause the given discriminator to answer true.
For each element of this collection, discriminator is evaluated with the
element as the parameter. Each element which causes discriminator to
answer true is included in the new collection.
The elements are traversed in order specified by forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection. |
|
IdentityDictionary<K,V> |
selectValues(UnaryCondition<? super V> discriminator)
Answers a new dictionary which contains the elements in this dictionary whose keys cause the given discriminator to answer true.
For each of this dictionary's keys, discriminator is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer true, the key is added to the answer with the element as
its corresponding value. |
|
| Methods inherited from class jaggregate.AbstractDictionaryImpl |
|---|
add, at, equals, forEachDo, hashCode, includes, includesKey, keyAt, keys, keysAndValuesDo, keysDo, occurrencesOf, putAll, putAt, rehash, remove, removeAllKeys, removeAllKeys, removeAllKeys, removeAllKeys, removeIfKey, removeIfValue, removeKey, retainAllKeys, retainAllKeys, retainAllKeys, retainAllKeys, retainIfKey, retainIfValue, size, toString, values |
| Methods inherited from class jaggregate.AbstractExtensibleCollection |
|---|
addAll, addAll, addAll, addAll, removeAll, removeAll, removeAll, removeAll, removeIf, retainAll, retainAll, retainAll, retainIf |
| Methods inherited from class jaggregate.AbstractCollection |
|---|
allSatisfy, anySatisfy, detect, inject, isEmpty, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jaggregate.ExtensibleCollection |
|---|
addAll, addAll, addAll, addAll, removeAll, removeAll, removeAll, removeAll, removeIf, retainAll, retainAll, retainAll, retainIf |
| Methods inherited from interface jaggregate.Collection |
|---|
allSatisfy, anySatisfy, detect, inject, isEmpty, toArray, toArray, toBag, toIdentityBag, toIdentitySet, toOrderedCollection, toSet, toSortedCollection, toSortedCollection |
| Constructor Detail |
|---|
public IdentityDictionary()
public IdentityDictionary(AbstractDictionary<? extends K,? extends V> associations)
associations - the associations to add to the new dictionary
NullPointerException - if associations is nullpublic IdentityDictionary(Pair<? extends K,? extends V>... associations)
associations - the associations to add to the new dictionary
NullPointerException - if associations is null, or if
any of the elements of associations is null| Method Detail |
|---|
public static <T,U> IdentityDictionary<T,U> emptyIdentityDictionary()
T - the type of keys allowed in the new dictionaryU - the type of values allowed in the new dictionary
public static <T,U> IdentityDictionary<T,U> identityDictionaryFrom(AbstractDictionary<? extends T,? extends U> associations)
T - the type of keys allowed in the new dictionaryU - the type of values allowed in the new dictionaryassociations - the associations to add to the new dictionary
NullPointerException - if associations is nullpublic static <T,U> IdentityDictionary<T,U> identityDictionaryFrom(Pair<? extends T,? extends U>[] associations)
T - the type of keys allowed in the new dictionaryU - the type of values allowed in the new dictionaryassociations - the associations to add to the new dictionary
NullPointerException - if associations is null, or if
any of the elements of associations is null
public static <T,U> IdentityDictionary<T,U> identityDictionaryWith(Pair<? extends T,? extends U> firstAssociation,
Pair<? extends T,? extends U>... restOfAssociations)
T - the type of keys allowed in the new dictionaryU - the type of values allowed in the new dictionaryfirstAssociation - an association to add to the new dictionaryrestOfAssociations - other associations to add to the new dictionary
NullPointerException - if firstAssociation is null,
associations is null, or if any of the elements of
associations is nullpublic <R> IdentityBag<R> collect(UnaryFunctor<? super Pair<K,V>,? extends R> transformer)
forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection.
collect in interface AbstractDictionary<K,V>collect in interface Collection<Pair<K,V>>collect in interface ExtensibleCollection<Pair<K,V>>collect in class AbstractDictionaryImpl<K,V>R - return type of the transformertransformer - the transformer to evaluate
public <R> IdentityDictionary<K,R> collectValues(UnaryFunctor<? super V,? extends R> transformer)
transformer with the
corresponding element of this dictionary as a parameter.
The elements are traversed in the order specified by forEachDo for this dictionary.
collectValues in interface AbstractDictionary<K,V>collectValues in class AbstractDictionaryImpl<K,V>R - return type of the transformertransformer - the transformer to evaluate
transformer with the elements of this
dictionarypublic IdentityDictionary<K,V> reject(UnaryCondition<? super Pair<K,V>> discriminator)
false.
For each element of this collection, discriminator is evaluated with the
element as the parameter. Each element which causes discriminator to
answer false is included in the new collection.
The elements are traversed in the order specified by forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection.
reject in interface AbstractDictionary<K,V>reject in interface Collection<Pair<K,V>>reject in interface ExtensibleCollection<Pair<K,V>>reject in class AbstractDictionaryImpl<K,V>discriminator - the discriminator to evaluate
public IdentityDictionary<K,V> rejectValues(UnaryCondition<? super V> discriminator)
true.
For each of this dictionary's keys, discriminator is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer false, the key is added to the answer with the element as its
corresponding value.
rejectValues in interface AbstractDictionary<K,V>rejectValues in class AbstractDictionaryImpl<K,V>discriminator - the discriminator to evaluate
public IdentityDictionary<K,V> select(UnaryCondition<? super Pair<K,V>> discriminator)
true.
For each element of this collection, discriminator is evaluated with the
element as the parameter. Each element which causes discriminator to
answer true is included in the new collection.
The elements are traversed in order specified by forEachDo for this collection.
Unless specifically refined, this message is defined to answer an object
conforming to the same protocol as this collection. If both this collection
and the result maintain an ordering of their elements, the elements of the
result will be in the same relative order as the elements of this collection.
select in interface AbstractDictionary<K,V>select in interface Collection<Pair<K,V>>select in interface ExtensibleCollection<Pair<K,V>>select in class AbstractDictionaryImpl<K,V>discriminator - the discriminator to evaluate
public IdentityDictionary<K,V> selectValues(UnaryCondition<? super V> discriminator)
true.
For each of this dictionary's keys, discriminator is evaluated with the
corresponding element as the argument. If the element causes discriminator
to answer true, the key is added to the answer with the element as
its corresponding value.
selectValues in interface AbstractDictionary<K,V>selectValues in class AbstractDictionaryImpl<K,V>discriminator - the discriminator to evaluate
public boolean retainAll(Collection<? extends Pair<K,V>> keepers)
retainAll in interface ExtensibleCollection<Pair<K,V>>retainAll in class AbstractExtensibleCollection<Pair<K,V>>keepers - the elements to retain
true if any removal occurred
UnsupportedOperationException - since it makes no sense -- identities of
pairs?
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||