public class RecombSingleNodes
extends java.lang.Object
Class RecombSingleNodes stores ordered node pairs and
associated values.
Instances of class RecombSingleNodes are not thread safe.
| Constructor and Description |
|---|
RecombSingleNodes(int nNodes)
Creates a new instance of
RecombSingleNodes 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 |
nNodes()
Returns the number of nodes.
|
int |
size()
Returns the number of node pairs with non-zero value.
|
float |
sumNode1Value(int node1)
Returns the sum of the values of the node pairs that have the specified
first node
|
float |
sumNode2Value(int node2)
Returns the sum of the values of the node pairs that have the specified
second node.
|
void |
sumUpdate(int node1,
int node2,
float value)
Adds the specified positive value to the stored value of the specified
node pair.
|
float |
sumValue()
Returns the sum of the values of all node pairs.
|
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 RecombSingleNodes(int nNodes)
RecombSingleNodes that has an
initial value of 0 for each ordered node pair. The first node
has index 0.nNodes - the maximum number of distinct nodes
which will be paired to form ordered node pairsjava.lang.IllegalArgumentException - if nNodes < 1public void sumUpdate(int node1,
int node2,
float value)
node1 - the first nodenode2 - the second nodevalue - the valuejava.lang.IndexOutOfBoundsException - if
node1 < 0 || node1 >= this.nNodes()java.lang.IndexOutOfBoundsException - if
node2 < 0 || node2 >= this.nNodes()java.lang.IllegalArgumentException - if
value <= 0 || (Double.isFinite(value) == false)public int size()
public int nNodes()
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 float sumNode1Value(int node1)
node1 - a nodejava.lang.IndexOutOfBoundsException - if
node1 < 0 || node1 >= this.nNodes()public float sumNode2Value(int node2)
node2 - a nodejava.lang.IndexOutOfBoundsException - if
node2 < 0 || node2 >= this.nNodes()public float sumValue()
public 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