choco.kernel.model.constraints.automaton
Class LayeredDFA

java.lang.Object
  extended by choco.kernel.model.constraints.automaton.LayeredDFA

public class LayeredDFA
extends Object

A layered automaton that offers the possibility to dynamically add or remove tuples incrementally. This structure is used for constructing the automaton corresponding to a n-ary constraint defined by its allowed or forbidden tuples. Once the automaton is build, it is replaced by a LightLayeredDFA which uses less memory but can not be dynamically modified anymore.

Version:
0.1 Nov 19, 2005.
Author:
Cambazard Hadrien, Richaud Guillaume

Field Summary
protected  int[] domSizes
           
protected  State initState
           
protected  State lastState
           
protected  ArrayList<State>[] levelStates
           
protected  int nbLevel
           
protected  int nbState
           
protected  int[] offsets
           
 
Constructor Summary
LayeredDFA(int[] domSizes, int nblevel)
          construct an initial automaton with different domain sizes per layer The automaton initially accepts all words
LayeredDFA(int domSize, int nblevel)
          construct an initial automaton.
 
Method Summary
 State addState(int level)
           
 void addTransition(State st1, State st2, int transition)
           
 void automatAll()
           
 void buildAnEmptyAutomaton()
           
 void clearAutomate()
           
 State cloneState(State origin)
           
 State cloneState(State origin, Hashtable<State,State> clonedStates, ArrayList<State> newStates)
           
 int getAutomateSize()
           
 int getDomSize(int i)
           
 State getInitState()
           
 State getLastState()
           
 Iterator getLevelIterator(int level)
           
 int getNbLevel()
           
 int getNextIdx()
           
 int getOffset(int i)
           
 boolean isEmpty()
           
 void loadDotty(String fileName)
           
 State makeState(LayeredDFA auto, int level)
           
 State makeState(State origin)
           
 void mergeStates(State st1, State st_supp)
           
 void minimize(ArrayList<State> newStates)
           
 int nbTransitions()
           
 void removeGarbageNodes()
           
 void removeNonTerminalsNodes()
           
 void removeOffset(int[] tuple)
           
 void removeState(State st)
           
 void removeUnreachablesNodes()
          ************************************************************************
 void setDomSize(int layer, int domSize)
           
 void setInitState(State init)
           
 void setLastState(State last)
           
 void setOffset(int layer, int domSize)
           
 void substract(BitSet[] gnogood)
          Remove a SET of words from the automaton.
 void substract(int[] tuple)
          Remove a word from the automaton.
 void toDotty(String f)
           
 void union(int[] tuple)
          Add a word to the automaton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

domSizes

protected int[] domSizes

offsets

protected int[] offsets

initState

protected State initState

lastState

protected State lastState

nbState

protected int nbState

levelStates

protected ArrayList<State>[] levelStates

nbLevel

protected int nbLevel
Constructor Detail

LayeredDFA

public LayeredDFA(int domSize,
                  int nblevel)
construct an initial automaton. The automaton initially accepts all words

Parameters:
domSize - : same size for all domains
nblevel - : number of layers

LayeredDFA

public LayeredDFA(int[] domSizes,
                  int nblevel)
construct an initial automaton with different domain sizes per layer The automaton initially accepts all words

Parameters:
domSizes - : size of each layers
nblevel - : number of layers
Method Detail

automatAll

public void automatAll()

clearAutomate

public void clearAutomate()

buildAnEmptyAutomaton

public void buildAnEmptyAutomaton()

getAutomateSize

public int getAutomateSize()

nbTransitions

public int nbTransitions()

makeState

public State makeState(LayeredDFA auto,
                       int level)

makeState

public State makeState(State origin)

getNbLevel

public int getNbLevel()

getDomSize

public int getDomSize(int i)

setDomSize

public void setDomSize(int layer,
                       int domSize)

getOffset

public int getOffset(int i)

setOffset

public void setOffset(int layer,
                      int domSize)

getNextIdx

public int getNextIdx()

getLevelIterator

public Iterator getLevelIterator(int level)

setInitState

public void setInitState(State init)

setLastState

public void setLastState(State last)

getInitState

public State getInitState()

getLastState

public State getLastState()

isEmpty

public boolean isEmpty()

addState

public State addState(int level)

removeState

public void removeState(State st)

addTransition

public void addTransition(State st1,
                          State st2,
                          int transition)

loadDotty

public void loadDotty(String fileName)

toDotty

public void toDotty(String f)

cloneState

public State cloneState(State origin)

cloneState

public State cloneState(State origin,
                        Hashtable<State,State> clonedStates,
                        ArrayList<State> newStates)

removeOffset

public void removeOffset(int[] tuple)

union

public void union(int[] tuple)
Add a word to the automaton. A word is a table int[] of int among [0 .. domsize[i]] (denoting the letters) for each layer i except that Integer.MAX_VALUE stands for *


substract

public void substract(int[] tuple)
Remove a word from the automaton. A word is a table int[] of int among [0 .. domsize[i]] (denoting the letters) for each layer i except that Integer.MAX_VALUE stands for *


substract

public void substract(BitSet[] gnogood)
Remove a SET of words from the automaton. A BitSet per layer gives the letters considered per layer and the words are given as the cartesian product of the set bits of each BitSet. Each BitSet, gnogood[i] is therefore assumed to be of size domSizes[i]


removeUnreachablesNodes

public void removeUnreachablesNodes()
************************************************************************


removeGarbageNodes

public void removeGarbageNodes()

removeNonTerminalsNodes

public void removeNonTerminalsNodes()

minimize

public void minimize(ArrayList<State> newStates)

mergeStates

public void mergeStates(State st1,
                        State st_supp)


Copyright © 2012. All Rights Reserved.