public final class AttributeGroup<T extends BaseAttribute>
extends java.lang.Object
implements java.lang.Iterable<T>
Constructor and Description |
---|
AttributeGroup()
Creates an empty instance.
|
AttributeGroup(java.util.Collection<T> source)
Produce an instance sourced from a collection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(T attribute)
Check to see whether this instance possesses the provided attribute by performing the
Object.equals(Object) operation. |
boolean |
containsAll(AttributeGroup<T> other)
Check to see whether this instance possesses all of the elements of the given group.
|
boolean |
containsAllIds(AttributeGroup<T> other)
Check to see whether this instance possesses all of the ids of attributes of the given group.
|
boolean |
containsId(java.lang.String attributeId)
Determine whether this instance contains an attribute matching the id provided.
|
boolean |
containsId(T attribute)
Determine whether this instance contains an attribute with an id matching given attribute.
|
boolean |
equalIds(AttributeGroup<T> other)
Determine whether this instance's elements are possessed by an alternative
AttributeGroup instance, even if their values differ.
|
boolean |
equals(java.lang.Object o)
Determine whether this instance's elements are possessed by and equal an alternative
AttributeGroup instance.
|
T |
get(java.lang.String id)
Retrieve the attribute that matches the given id.
|
int |
hashCode()
Produces a hashCode to represent this instance in accordance with item#9 of Effective Java
2nd Edition.
|
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator()
Retrieve the iterator to iterate through the elements in this group.
|
int |
size() |
java.lang.Object[] |
toArray()
Returns a new array containing all elements contained in this
AttributeGroup . |
T[] |
toArray(T[] contents)
Returns an array containing all elements contained in this
AttributeGroup . |
java.lang.String |
toString()
Render the contents of this AttributeGroup into a string.
|
java.lang.String |
toString(java.lang.String indentation)
Render the contents of this AttributeGroup into a string.
|
public AttributeGroup()
public AttributeGroup(java.util.Collection<T> source)
source
- Iterable or null. When null, an empty instance will be created.public int size()
public boolean contains(T attribute)
Object.equals(Object)
operation.attribute
- an attribute this instance may hold.public boolean containsAll(AttributeGroup<T> other)
Object.equals(Object)
operation of each Attribute in
each group.other
- AttributeGroup instance.public boolean containsAllIds(AttributeGroup<T> other)
other
- AttributeGroup instance.public boolean containsId(java.lang.String attributeId)
attributeId
- desired id to locatepublic boolean containsId(T attribute)
attribute
- desired attribute to locatepublic T get(java.lang.String id)
id
- the desired attribute's id matching BaseAttribute.getId()
public boolean isEmpty()
public java.util.Iterator<T> iterator()
Iterator.remove()
is not supported, and throws an
UnsupportedOperationException when called. When Iterator.hasNext()
returns
false, calling the Iterator.next()
will throw a NoSuchElementException.iterator
in interface java.lang.Iterable<T extends BaseAttribute>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- public boolean equalIds(AttributeGroup<T> other)
other
- public T[] toArray(T[] contents)
AttributeGroup
. If the specified array is large enough to hold the
elements, the specified array is used, otherwise an array of the same
type is created. If the specified array is used and is larger than this
AttributeGroup
, the array element following the collection elements
is set to null.contents
- the array.AttributeGroup
.java.lang.ArrayStoreException
- when the type of an element in this AttributeGroup
cannot
be stored in the type of the specified array.public java.lang.Object[] toArray()
AttributeGroup
.AttributeGroup
public java.lang.String toString(java.lang.String indentation)
indentation
- the desired indentation of the String, such as "\t" or " ". If null or
an empty string is provided, returned string will be a single line.public java.lang.String toString()
toString(String)
with a null indentation.toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object