jmarkov.basic
Class PropertiesAction

java.lang.Object
  extended by jmarkov.basic.Action
      extended by jmarkov.basic.PropertiesAction
All Implemented Interfaces:
java.lang.Comparable<Action>, JMarkovElement, PropertiesElement

public class PropertiesAction
extends Action
implements PropertiesElement

This class is an easy way to use a Action that is represented by an integer valued array.

Author:
Andres Sarmiento, Germán Riaño - Universidad de Los Andes

Constructor Summary
PropertiesAction(int size)
          Creates an Action Object wit an array of the given size.
PropertiesAction(int[] properties)
          Builds an object with the given array.
 
Method Summary
 PropertiesAction clone()
           
 int compareTo(Action a)
           
 int compareTo(PropertiesAction a)
           
 int getNumProps()
          Returns the number of properties in the array that characterize this element.
 int[] getProperties()
          Gets thae array of properties.
 int getProperty(int index)
          Gets the value of this property.
 java.lang.String label()
          The user MUST override this method to give a (hopefully short) label for the Action.
protected  void setProperty(int index, int value)
          Sets the value of the property at the given index
 
Methods inherited from class jmarkov.basic.Action
description, equals, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmarkov.basic.JMarkovElement
description, equals, toString
 

Constructor Detail

PropertiesAction

public PropertiesAction(int[] properties)
Builds an object with the given array.

Parameters:
properties -

PropertiesAction

public PropertiesAction(int size)
Creates an Action Object wit an array of the given size.

Parameters:
size -
Method Detail

label

public java.lang.String label()
Description copied from class: Action
The user MUST override this method to give a (hopefully short) label for the Action.

Specified by:
label in interface JMarkovElement
Specified by:
label in class Action
Returns:
short description of the Action.
See Also:
JMarkovElement.description()

compareTo

public final int compareTo(PropertiesAction a)
Parameters:
a - The action array to compare to
Returns:
+1, -1 or 0.
See Also:
Comparable.compareTo(T)

compareTo

public final int compareTo(Action a)
Specified by:
compareTo in interface java.lang.Comparable<Action>

getProperties

public final int[] getProperties()
Gets thae array of properties.

Specified by:
getProperties in interface PropertiesElement
Returns:
Returns the properties array.

getProperty

public int getProperty(int index)
Gets the value of this property.

Specified by:
getProperty in interface PropertiesElement
Parameters:
index -
Returns:
the property at the given index

setProperty

protected void setProperty(int index,
                           int value)
Sets the value of the property at the given index

Parameters:
index -
value -

getNumProps

public int getNumProps()
Returns the number of properties in the array that characterize this element.

Specified by:
getNumProps in interface PropertiesElement
Returns:
The number of properties.

clone

public PropertiesAction clone()
Specified by:
clone in interface PropertiesElement
Overrides:
clone in class java.lang.Object