public class SingleNodes
extends java.lang.Object
Class SingleNodes stores ordered node pairs and associated values.
Instances of class SingleNodes are not thread safe.
| Constructor and Description |
|---|
SingleNodes()
Creates a new instance of
SingleNodes that has an
initial value of 0 for each ordered node pair. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Sets the value of each ordered node pair to 0.
|
int |
enumNode1(int index)
Returns the first node of the specified node pair in the list of
node pairs with non-zero value.
|
int |
enumNode2(int index)
Returns the second node of the specified node pair in a list of
node pairs with non-zero value.
|
float |
enumValue(int index)
Returns the value of the specified node pair in a list of
node pairs with non-zero value.
|
int |
size()
Returns the number of node pairs with non-zero value.
|
void |
sumUpdate(int node1,
int node2,
float value)
Adds the specified positive value to the stored value of the specified
node pair.
|
java.lang.String |
toString()
Returns a string representation of
this. |
float |
value(int node1,
int node2)
Returns the value of the specified node pair.
|
public SingleNodes()
SingleNodes that has an
initial value of 0 for each ordered node pair. The first node
has index 0.public void sumUpdate(int node1,
int node2,
float value)
node1 - the first nodenode2 - the second nodevalue - the valuejava.lang.IllegalArgumentException - if node1 < 0 || node2 < 0java.lang.IllegalArgumentException - if
value <= 0 || (Double.isFinite(value) == false)public int size()
public int enumNode1(int index)
(index >= 0 && index < this.size()), then the following
expression will always evaluate to true:(this.value(this.enumNode1(index),
this.enumNode2(index)) == this.enumValue(index)).index - an index in a list of node pairs with non-zero
valuejava.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public int enumNode2(int index)
(index >= 0 && index < this.size()), then the following
expression will always evaluate to true:(this.value(this.enumNode1(index),
this.enumNode2(index)) == this.enumValue(index)).index - an index in a list of node pairs with non-zero valuejava.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public float enumValue(int index)
(index >= 0 && index < this.size()), then the following
expression will always evaluate to true:(this.value(this.enumNode1(index),
this.enumNode2(index)) == this.enumValue(index)).index - an index in a list of node pairs with non-zero valuejava.lang.IndexOutOfBoundsException - if
index < 0 || index >= this.size()public float value(int node1,
int node2)
node1 - the first nodenode2 - the second nodejava.lang.IllegalArgumentException - if node1 < 0 || node2 < 0public void clear()
public java.lang.String toString()
this. The exact
details of the representation are unspecified and subject to change.toString in class java.lang.Objectthis