jmdp.basic
Class StateArray

java.lang.Object
  extended by jmdp.basic.State
      extended by jmdp.basic.StateArray
All Implemented Interfaces:
java.lang.Comparable<State>

public abstract class StateArray
extends State

This class is an easy way to use a state that is represented by an array of ints. The internal array can be accessed by the implementing classes.

Author:
Andres Sarmiento, German Riano - Universidad de Los Andes

Field Summary
protected  int[] status
          The internal array used to represent the state
 
Constructor Summary
StateArray(int size)
          This creates an StateArray with the internal array of ceros of the given size.
StateArray(int[] status)
          This creates an StateArray with the given array.
 
Method Summary
 int compareTo(State s)
           
 int compareTo(StateArray s1)
          Compares the properties in order.
 int getProperty(int i)
          Returns the value of the i-th property.
 int hashCode()
           
 java.lang.String label()
          The default label is in the form (s1,s2,...
 
Methods inherited from class jmdp.basic.State
equals, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

status

protected int[] status
The internal array used to represent the state

Constructor Detail

StateArray

public StateArray(int[] status)
This creates an StateArray with the given array. WARNNING: the array is NOT internally copied, so it is assumed then NO changes are made to this array after it is given to the constructor.

Parameters:
status -

StateArray

public StateArray(int size)
This creates an StateArray with the internal array of ceros of the given size.

Parameters:
size - The size of the array.
Method Detail

label

public java.lang.String label()
The default label is in the form (s1,s2,...,sn)

Specified by:
label in class State
Returns:
short description of the state.
See Also:
State.label()

compareTo

public final int compareTo(StateArray s1)
Compares the properties in order.

Parameters:
s1 - array to compare with
Returns:
+1, 0 or -1, according to whether this states dominates s1.

compareTo

public final int compareTo(State s)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getProperty

public int getProperty(int i)
Returns the value of the i-th property.

Parameters:
i - index of the property
Returns:
the value of the i-th property.