helix.graph.model.impl
Class RVertexList

java.lang.Object
  extended by helix.graph.model.impl.RVertexList
All Implemented Interfaces:
RegistryValue, Iterable<Vertex>

public class RVertexList
extends Object
implements RegistryValue, Iterable<Vertex>

a memory implementation of RegistryValue for lists of Vertices

Author:
viari

Constructor Summary
RVertexList()
           
RVertexList(Collection<Vertex> c)
           
RVertexList(int size)
           
RVertexList(Vertex v)
           
 
Method Summary
 void addVertex(Vertex v)
           
 void clear()
           
 boolean equals(Object o)
           
 Vertex getVertex(int index)
           
static RVertexList getVertexList(Registry r, String key)
          Lookup the RVertexList associated to key in registry and create an empty RVertexList if it does not exist.
 int hashCode()
           
 Iterator<Vertex> iterator()
           
 RegistryValue klone()
          Potentially clone this instance.
 Vertex lastVertex()
           
 Vertex removeVertex(int index)
           
 String serialize()
          get a String representation of this instance.
 Vertex setVertex(int index, Vertex v)
           
 int size()
           
 boolean toBoolean()
           
 float toFloat()
           
 int toInt()
           
 String toString()
          a human readable version of toString()
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RVertexList

public RVertexList(int size)

RVertexList

public RVertexList()

RVertexList

public RVertexList(Vertex v)

RVertexList

public RVertexList(Collection<Vertex> c)
Method Detail

klone

public RegistryValue klone()
Description copied from interface: RegistryValue
Potentially clone this instance.

Specified by:
klone in interface RegistryValue
Returns:
a clone (deep copy) of this instance. Note that it may be the instance itself (for immutable objects).

serialize

public String serialize()
Description copied from interface: RegistryValue
get a String representation of this instance. this representation can further be used as a constructor argument to reconstruct this instance.

Specified by:
serialize in interface RegistryValue
Returns:
string representation of this instance

toBoolean

public boolean toBoolean()
                  throws IllegalValueException
Specified by:
toBoolean in interface RegistryValue
Returns:
boolean representation of this instance value
Throws:
IllegalValueException

toFloat

public float toFloat()
              throws IllegalValueException
Specified by:
toFloat in interface RegistryValue
Returns:
float representation of this instance value
Throws:
IllegalValueException

toInt

public int toInt()
          throws IllegalValueException
Specified by:
toInt in interface RegistryValue
Returns:
int representation of this instance value
Throws:
IllegalValueException

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

iterator

public Iterator<Vertex> iterator()
Specified by:
iterator in interface Iterable<Vertex>

addVertex

public void addVertex(Vertex v)

getVertex

public Vertex getVertex(int index)
                 throws IndexOutOfBoundsException
Throws:
IndexOutOfBoundsException

lastVertex

public Vertex lastVertex()
                  throws IndexOutOfBoundsException
Throws:
IndexOutOfBoundsException

setVertex

public Vertex setVertex(int index,
                        Vertex v)
                 throws IndexOutOfBoundsException
Throws:
IndexOutOfBoundsException

removeVertex

public Vertex removeVertex(int index)
                    throws IndexOutOfBoundsException
Throws:
IndexOutOfBoundsException

clear

public void clear()

size

public int size()

toString

public String toString()
a human readable version of toString()

Specified by:
toString in interface RegistryValue
Overrides:
toString in class Object
Returns:
String representation of this instance value

getVertexList

public static final RVertexList getVertexList(Registry r,
                                              String key)
Lookup the RVertexList associated to key in registry and create an empty RVertexList if it does not exist. This helper function is equivalent to : if (r.has(key))
return (RVertexList) r.get(key);
else
return (RVertexList) r.set(key, new RVertexList());