Interface Neighborhood
-
- All Implemented Interfaces:
-
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable
public interface Neighborhood<T> implements Serializable, Cloneable, Iterable<T>
The type which describes the concentration of a molecule Interface for a neighborhood. When implementing it in a real class, please remember to correctly implement also the equals method inherited from Object.
-
-
Method Summary
Modifier and Type Method Description abstract Neighborhood<T>
add(Node<T> node)
abstract boolean
contains(Node<T> n)
Verifies if a node is contained inside a neighborhood. abstract Node<T>
getCenter()
Allows to access the central node. abstract ListSet<out Node<T>>
getNeighbors()
Allows to directly access every node in the neighborhood. abstract boolean
isEmpty()
abstract Neighborhood<T>
remove(Node<T> node)
abstract int
size()
-
-
Method Detail
-
add
abstract Neighborhood<T> add(Node<T> node)
- Parameters:
node
- the Node to add- Returns:
a new Neighborhood with the same center and the new node among its neighbors
-
contains
abstract boolean contains(Node<T> n)
Verifies if a node is contained inside a neighborhood.
- Parameters:
n
- the node to be searched- Returns:
true if n belongs to this neighborhood
-
getCenter
abstract Node<T> getCenter()
Allows to access the central node.
- Returns:
the central node, namely the node whose neighbors are represented by this structure.
-
getNeighbors
abstract ListSet<out Node<T>> getNeighbors()
Allows to directly access every node in the neighborhood. A change of this List will be reflected in the neighborhood.
- Returns:
the list of the neighbors
-
isEmpty
abstract boolean isEmpty()
- Returns:
true if this neighborhood has no neighbors
-
remove
abstract Neighborhood<T> remove(Node<T> node)
- Parameters:
node
- the Node to remove- Returns:
a new Neighborhood with the same center without the provided Node
-
size
abstract int size()
- Returns:
the number of neighbors.
-
-
-
-