|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.cilib.type.types.container.AbstractList<E>
E - The type element.public abstract class AbstractList<E extends Type>
The basic definition for all Type objects that are based on a list.
| Constructor Summary | |
|---|---|
AbstractList()
|
|
| Method Summary | ||
|---|---|---|
abstract boolean |
append(AbstractList<E> list)
Add the provided AbstractList to the end of the current list. |
|
static
|
append(AbstractList<T> lhs,
AbstractList<T> rhs)
Create a new (cloned) Vector consisting of rhs that has been appended to lhs. |
|
void |
append(E value)
Add the provided Type to the end of the current list. |
|
abstract boolean |
equals(Object o)
Compare the specified object with this type for equality. |
|
abstract E |
get(int index)
Get the Type at the given index. |
|
abstract AbstractList<E> |
getClone()
Create a cloned copy of the current object and return it. |
|
String |
getRepresentation()
Get the representation of this Vector object in the form expressed by the domain notation. |
|
abstract int |
hashCode()
Returns the hash code value for this list. |
|
abstract void |
insert(int index,
E value)
Insert the provided Type at the specified index. |
|
abstract boolean |
prepend(AbstractList<E> list)
Add the provided AbstractList to the start of the current list. |
|
static AbstractList |
prepend(AbstractList lhs,
AbstractList rhs)
Create a new (cloned) Vector consisting of rhs that has been prepended to lhs. |
|
void |
prepend(E value)
Prepend the provided Type to the from of this list. |
|
abstract void |
set(int index,
E value)
Set the Type at the index index. |
|
abstract AbstractList<E> |
subList(int fromIndex,
int toIndex)
Create a sub vector from the current Vector. |
|
abstract Object[] |
toArray()
Create an Object [] from this Vector. |
|
String |
toString()
|
|
String |
toString(char delimiter)
Get the String representation, using the provided delimiter. |
|
String |
toString(char first,
char last,
char delimiter)
Generate a String representation of this Vector using the provided first, last and delimiter characters. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sourceforge.cilib.type.types.container.StructuredType |
|---|
accept, add, addAll, clear, contains, isEmpty, iterator, remove, remove, removeAll, size |
| Methods inherited from interface net.sourceforge.cilib.type.types.Randomizable |
|---|
randomize |
| Constructor Detail |
|---|
public AbstractList()
| Method Detail |
|---|
public abstract AbstractList<E> getClone()
getClone in interface StructuredType<E extends Type>getClone in interface TypegetClone in interface CloneableObject.clone()public abstract boolean equals(Object o)
true if and only if the specified object is also an instance
of the same type.
equals in interface Typeequals in class Objecto - The object to compare.
true if equality exists, false otherwise.Object.equals(Object)public abstract int hashCode()
int hashCode = 7;
Iterator<E> i = list.iterator();
while (i.hasNext()) {
E obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that type1.equals(type2) implies that
type1.hashCode()==type2.hashCode() for any two types,
type1 and type2, as required by the general
contract of Object.hashCode().
hashCode in interface TypehashCode in class ObjectObject.equals(Object),
Type.equals(Object)public abstract E get(int index)
index - The index to inspect to return.
index.
public abstract void set(int index,
E value)
index.
index - The index to set.value - The value to set.
public abstract void insert(int index,
E value)
index.
index - The index where to insert the Type.value - The value to set.public void append(E value)
value - The Type to add.public abstract boolean append(AbstractList<E> list)
list - The object to add.
true if the operation was successful, false otherwise.public void prepend(E value)
value - The Type to prepend.public abstract boolean prepend(AbstractList<E> list)
list - The object to add.
true if the operation was successful, false otherwise.public abstract Object[] toArray()
Object [] from this Vector.
Object [] representing the Vectorpublic String getRepresentation()
getRepresentation method for each element in the Vector.
This method is also a bit clever in the sense that it will try to detect elements with the same
representation that follow on each other, i.e. to return a representation as
String representing the Type in domain notation.
public abstract AbstractList<E> subList(int fromIndex,
int toIndex)
fromIndex - The index to start the sub-list from.toIndex - The last index to end the sub-list at.
public static <T extends Type> AbstractList<T> append(AbstractList<T> lhs,
AbstractList<T> rhs)
T - The type element.lhs - The Vector that will form the front part of the new (cloned)
Vector.rhs - The Vector that will form the back part of the new (cloned)
Vector.
public static AbstractList prepend(AbstractList lhs,
AbstractList rhs)
lhs - The Vector that will form the back part of the new (cloned)
Vector.rhs - The Vector that will form the front part of the new (cloned)
Vector.
public String toString(char first,
char last,
char delimiter)
Example Input: Assume first = '[', last =
']', delimiter = ',' and elements of the
Vector = {1,2,3,4,5}
Example Output: [1,2,3,4,5]
In the case where first and last characters are not desired, call the function as follows:
toString((char)0, (char)0, ','); The delimiter character may be any character
including a tab '\t' or a newline '\n'.
first - The character that indicates the start of the Vector
Stringlast - The character that indicates the end of the Vector
Stringdelimiter - The character used to delimit the elements of the Vector
public String toString()
toString in class Objectpublic String toString(char delimiter)
String representation, using the provided delimiter. Also see
delimiter - The delimiter to use.
Object.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||