Gephi Toolkit Javadoc

org.gephi.data.attributes.type
Class AbstractList<T>

java.lang.Object
  extended by org.gephi.data.attributes.type.AbstractList<T>
Type Parameters:
T - type parameter defining final List type
Direct Known Subclasses:
BooleanList, CharacterList, NumberList, StringList

public abstract class AbstractList<T>
extends java.lang.Object

Complex type that defines list of any type of items. Can be created from an array or from single string using either given or default separators. Internal representation of data is array of generic type. This means that every primitive type must be first converted into wrapper type. The exact conversion process from String value into given type is done by TypeConvertor class.

Design guidelines

This is a basic abstract class that every other 'List' class should extend. In order to not misuse the API, every extending type should be one of the following:

Flexibility

The flexibility of this API is done in 2 ways:

Extensibility

This API can be simply extended. New 'List' type should extend base or any helper 'List' type. We can create final 'List' implementations as well as helper 'list' implementations with appropriate modifiers (see Design Guidelines). We can define as many constructors responsible for conversions from other types and as many additional methods as we want.
To fully integrate new 'List' type into the whole codebase we have to update following types:
  1. AttributeType:
    1. add appropriate enum constants
    2. update parse(String) method
  2. DataIndex:
    1. add appropriate type represented by Class object into SUPPORTED_TYPES array
This class defines method for recognizing size of the list and method for getting item by index.

Author:
Martin Ć kurla
See Also:
TypeConvertor

Field Summary
static java.lang.String DEFAULT_SEPARATOR
           
protected  T[] list
           
 
Constructor Summary
AbstractList(java.lang.String input, java.lang.Class<T> finalType)
           
AbstractList(java.lang.String input, java.lang.String separator, java.lang.Class<T> finalType)
           
AbstractList(T[] array)
           
 
Method Summary
 boolean contains(T value)
           
 boolean equals(java.lang.Object obj)
           
 T getItem(int index)
           
 int hashCode()
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final java.lang.String DEFAULT_SEPARATOR
See Also:
Constant Field Values

list

protected final T[] list
Constructor Detail

AbstractList

public AbstractList(java.lang.String input,
                    java.lang.Class<T> finalType)

AbstractList

public AbstractList(java.lang.String input,
                    java.lang.String separator,
                    java.lang.Class<T> finalType)

AbstractList

public AbstractList(T[] array)
Method Detail

size

public int size()

getItem

public T getItem(int index)

contains

public boolean contains(T value)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Gephi Toolkit Javadoc