org.jtool.jxplatform.graph
Class GraphElementList

java.lang.Object
  extended byorg.jtool.jxplatform.graph.GraphElementList

public class GraphElementList
extends java.lang.Object

A list of GraphElement.

Author:
Katsuhsa Maruyama

Constructor Summary
GraphElementList()
          Creates a new, empty list.
GraphElementList(GraphElementList list)
          Creates a new list from a list of GraphElement elements.
 
Method Summary
 boolean add(GraphElement elem)
          Appends a graph element to the end of this list.
 void add(int index, GraphElement elem)
          Inserts a graph element at a position in this list.
 void addAll(GraphElement list)
          Appends all graph elements in a list to the end of this list.
 void addFirst(GraphElement elem)
          Inserts a graph element at the beginning of this list.
 void addLast(GraphElement elem)
          Appends a graph element to the end of this list.
 void clear()
          Removes all graph elements from this list.
 boolean contains(GraphElement elem)
          Tests if this list contains a graph element.
 boolean containsAll(GraphElement list)
          Tests if this list contains all graph elements of a list.
 boolean equals(GraphElementList list)
          Tests if this list is equals to a given list.
 GraphElement get(int index)
          Returns a graph element at the position in this list.
 GraphElement getFirst()
          Returns the first graph element in this list.
 GraphElement getLast()
          Returns the last graph element in this list.
 boolean isEmpty()
          Tests if this list contains no graph element.
 java.util.Iterator iterator()
          Returns an iterator of this list in proper sequence.
protected  void print()
          Displays information about this list.
 boolean remove(GraphElement elem)
          Removes a graph element from this list.
 GraphElement remove(int index)
          Removes a graph element at a position in this list.
 void removeAll(GraphElementList list)
          Removes all graph elements in a list from this list.
 GraphElement removeFirst()
          Removes the first graph element from this list.
 GraphElement removeLast()
          Removes the last graph element from this list.
 boolean retainAll(GraphElementList list)
          Retains only graph elements in this list that are contained in a list.
 int size()
          Returns the number of graph elements in this list.
 GraphElement[] toArray()
          Returns an array containing all graph elements in this list in proper sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphElementList

public GraphElementList()
Creates a new, empty list.


GraphElementList

public GraphElementList(GraphElementList list)
Creates a new list from a list of GraphElement elements.

Parameters:
list - A list of graph elements.
Method Detail

clear

public void clear()
Removes all graph elements from this list.


add

public boolean add(GraphElement elem)
Appends a graph element to the end of this list.

Parameters:
elem - A graph element to be appended.
Returns:
true if this list changed as a result of the call.

add

public void add(int index,
                GraphElement elem)
Inserts a graph element at a position in this list.

Parameters:
index - A position where a graph element is inserted.
elem - A graph element to be inserted.

addAll

public void addAll(GraphElement list)
Appends all graph elements in a list to the end of this list.

Parameters:
list - A list of graph elements to be appended.

remove

public boolean remove(GraphElement elem)
Removes a graph element from this list.

Parameters:
elem - A graph element to be removed.
Returns:
true if this list changed as a result of the call.

removeAll

public void removeAll(GraphElementList list)
Removes all graph elements in a list from this list.

Parameters:
list - A list of graph elements to be removed.

remove

public GraphElement remove(int index)
Removes a graph element at a position in this list.

Parameters:
index - A position where a wrapper to be removed.
Returns:
The removed graph element, null if there is no removed element.

retainAll

public boolean retainAll(GraphElementList list)
Retains only graph elements in this list that are contained in a list.

Parameters:
list - A list of graph elements to be retained.
Returns:
true if this list changed as a result of the call.

contains

public boolean contains(GraphElement elem)
Tests if this list contains a graph element.

Parameters:
elem - A graph element to be tested.
Returns:
true if the graph element is present, otherwise false.

containsAll

public boolean containsAll(GraphElement list)
Tests if this list contains all graph elements of a list.

Parameters:
list - A list of graph elements to be tested.
Returns:
true if this list contains all of the graph elements of the list, otherwise false.

get

public GraphElement get(int index)
Returns a graph element at the position in this list.

Parameters:
index - The position where a graph element is obtained.
Returns:
The graph element at the position, or null if there is no graph element found.

getFirst

public GraphElement getFirst()
Returns the first graph element in this list.

Returns:
The first graph element, or null if there is no graph element in this list.

getLast

public GraphElement getLast()
Returns the last graph element in this list.

Returns:
The last graph element, or null if there is no graph element in this list.

addFirst

public void addFirst(GraphElement elem)
Inserts a graph element at the beginning of this list.

Parameters:
elem - A graph element to be inserted.

addLast

public void addLast(GraphElement elem)
Appends a graph element to the end of this list.

Returns:
A graph element to be append.

removeFirst

public GraphElement removeFirst()
Removes the first graph element from this list.

Returns:
The removed graph element, null if no element was removed.

removeLast

public GraphElement removeLast()
Removes the last graph element from this list.

Returns:
The removed graph element, null if no element was removed.

isEmpty

public boolean isEmpty()
Tests if this list contains no graph element.

Returns:
true if this list contains no graph element, otherwise false.

size

public int size()
Returns the number of graph elements in this list.

Returns:
The number of graph elements.

iterator

public java.util.Iterator iterator()
Returns an iterator of this list in proper sequence.

Returns:
An iterator of this list.

equals

public boolean equals(GraphElementList list)
Tests if this list is equals to a given list.

Parameters:
list - A list to be tested.
Returns:
true if both the lists are equal, otherwise false.

toArray

public GraphElement[] toArray()
Returns an array containing all graph elements in this list in proper sequence.

Returns:
An array of graph elements.

print

protected void print()
Displays information about this list.