JaCoP.constraints.regular
Class RegStateInt

java.lang.Object
  extended by JaCoP.constraints.regular.RegState
      extended by JaCoP.constraints.regular.RegStateInt

public class RegStateInt
extends RegState

It is an implementation of the Regular state which uses a separate successor for each value. Different values using different entries in the successor array can lead to the same successor.

Version:
3.1
Author:
Polina Makeeva and Radoslaw Szymanek

Field Summary
 
Fields inherited from class JaCoP.constraints.regular.RegState
id, inDegree, level, outDegree, pos, successors
 
Constructor Summary
RegStateInt(int level, int id, int sucNumber, int posInArray)
          It constructs an integer based representation of the state.
 
Method Summary
 void add(IntDomain varDom, int successorNo)
          It adds to domain values which are accepted by a given edge.
 void addTransition(RegState suc, java.lang.Integer val)
          It specifies that for a given value an automata will move from the current state to the successor state.
 void addTransitions(RegState suc, IntervalDomain val)
          It specifies that for a given values from an interval an automata will move from the current state to the successor state.
 boolean intersects(IntDomain dom, int successorNo)
          It checks if the accepting values associated with an edge intersect.
 boolean isActive(TimeStamp<java.lang.Integer>[] activeLevels)
          The function return if the state is still active.
 void removeTransition(int pos)
          It informs the state that the edge on the given position is no longer active.
 void setSupports(java.util.HashMap<java.lang.Integer,RegEdge> hashMap, int i)
           
 java.lang.String sucDomToString(int successorNo)
           
 java.lang.String toString()
           
 boolean updateSupport(RegEdge edge, int v)
          It updates a support if given state supports given value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegStateInt

public RegStateInt(int level,
                   int id,
                   int sucNumber,
                   int posInArray)
It constructs an integer based representation of the state.

Parameters:
level - level of the state (position of the associated variable).
id - id of the state.
sucNumber - the number of successors.
posInArray - the position within the array of states.
Method Detail

addTransitions

public void addTransitions(RegState suc,
                           IntervalDomain val)
Description copied from class: RegState
It specifies that for a given values from an interval an automata will move from the current state to the successor state.

Specified by:
addTransitions in class RegState
Parameters:
suc - successor state
val - interval of accepting values.

addTransition

public void addTransition(RegState suc,
                          java.lang.Integer val)
Description copied from class: RegState
It specifies that for a given value an automata will move from the current state to the successor state.

Specified by:
addTransition in class RegState
Parameters:
suc - successor state
val - an accepting value

isActive

public boolean isActive(TimeStamp<java.lang.Integer>[] activeLevels)
Description copied from class: RegState
The function return if the state is still active. It depends on how many active levels remains for state level and the position of the state.

Specified by:
isActive in class RegState
Parameters:
activeLevels - -
Returns:
true is the state is still active.

removeTransition

public void removeTransition(int pos)
Description copied from class: RegState
It informs the state that the edge on the given position is no longer active.

Specified by:
removeTransition in class RegState
Parameters:
pos - position of the edge.

intersects

public boolean intersects(IntDomain dom,
                          int successorNo)
Description copied from class: RegState
It checks if the accepting values associated with an edge intersect.

Specified by:
intersects in class RegState
Parameters:
dom - domain against which interesection is performed.
successorNo - a position of the edge.
Returns:
true if at least one value associated with an edge intersects with domain.

setSupports

public void setSupports(java.util.HashMap<java.lang.Integer,RegEdge> hashMap,
                        int i)
Specified by:
setSupports in class RegState
Parameters:
hashMap - It contains supports for all values of a given variable.
i - it specifies the edge position.

updateSupport

public boolean updateSupport(RegEdge edge,
                             int v)
Description copied from class: RegState
It updates a support if given state supports given value.

Specified by:
updateSupport in class RegState
Parameters:
edge - information about support is stored here.
v - value for which support is looked for.
Returns:
It returns true if state has an edge which supports given value.

add

public void add(IntDomain varDom,
                int successorNo)
Description copied from class: RegState
It adds to domain values which are accepted by a given edge.

Specified by:
add in class RegState
Parameters:
varDom - - domain collecting suported values.
successorNo - - position of an edge from which values are collected.

sucDomToString

public java.lang.String sucDomToString(int successorNo)
Specified by:
sucDomToString in class RegState
Parameters:
successorNo - - edge position.
Returns:
It return the string representation of the values accepted by specified edge.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object