public class State
extends java.lang.Object
Arc objects in an ArrayList
allowing additions/deletions| Modifier and Type | Field and Description |
|---|---|
protected int |
id |
protected int |
initialNumArcs |
| Modifier | Constructor and Description |
|---|---|
protected |
State()
Default Constructor
|
|
State(float fnlWeight)
Constructor specifying the state's final weight
|
|
State(int initialNumArcs)
Constructor specifying the initial capacity of the arc's ArrayList (this
is an optimization used in various operations)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addArc(Arc arc)
Add an outgoing arc to the state
|
void |
arcSort(java.util.Comparator<Arc> cmp)
Shorts the arc's ArrayList based on the provided Comparator
|
Arc |
deleteArc(int index)
Delete an arc based on its index
|
boolean |
equals(java.lang.Object obj) |
Arc |
getArc(int index)
Get an arc based on it's index the arcs ArrayList
|
float |
getFinalWeight()
Get the state's final Weight
|
int |
getId()
Get the state's id
|
int |
getNumArcs()
Get the number of outgoing arcs
|
int |
hashCode() |
void |
setArc(int index,
Arc arc)
Set an arc at the specified position in the arcs' ArrayList.
|
void |
setArcs(java.util.ArrayList<Arc> arcs)
Set the state's arcs ArrayList
|
void |
setFinalWeight(float fnlfloat)
Set the state's final weight
|
java.lang.String |
toString() |
protected State()
public State(float fnlWeight)
fnlWeight - final weightpublic State(int initialNumArcs)
initialNumArcs - number of arcspublic void arcSort(java.util.Comparator<Arc> cmp)
cmp - comparatorpublic float getFinalWeight()
public void setArcs(java.util.ArrayList<Arc> arcs)
arcs - the arcs ArrayList to setpublic void setFinalWeight(float fnlfloat)
fnlfloat - the final weight to setpublic int getId()
public int getNumArcs()
public void addArc(Arc arc)
arc - the arc to addpublic Arc getArc(int index)
index - the arc's indexpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic Arc deleteArc(int index)
index - the arc's indexpublic int hashCode()
hashCode in class java.lang.Objectpublic void setArc(int index,
Arc arc)
index - the position to the arcs' arrayarc - the arc value to set