public class StatesSet extends Object
A wrapper of OMDDNode that adds the essentials methods to store states.
Each path terminating with a value > 0 indicates the state is present in the set.
The value is used to indicates several status.
The value of the size attribute, that is the number of state inside the set, could be inconsistent.
When adding a state (or a merge several Omdds), there is no efficient way to know if the state is added or if it was already present.
In this class, the size is always incremented when we try to add a new state. Therefore the value of the size could be inconsistent, more
precisely be an overapproximation of the real value
To cope with this problem, there is several methods to work with the size :
Modifier and Type | Field and Description |
---|---|
static int |
INCONSISTENT_SIZE |
Constructor and Description |
---|
StatesSet(org.colomoto.mddlib.MDDManager ddmanager,
byte[] childsCount)
Initialize a new set of states
|
StatesSet(org.colomoto.mddlib.MDDManager ddmanager,
int mdd,
byte[] childsCount)
Initialize a new set of states
|
Modifier and Type | Method and Description |
---|---|
void |
addState(byte[] state,
int newStatus)
Add state to the set with status
If the state was already there, the old status remains. NB: use updateStatus to change the status. |
void |
addState(String state,
int newStatus)
Add state to the set with status
If the state was already there, the old status remains. NB: use updateStatus to change the status. |
void |
addStates(List<byte[]> states)
Add states to the set with status 1
If the states were already there, their old status remains. NB: use updateStatus to change the status. |
StatesSet |
clone() |
boolean |
contains(byte[] state)
Test if the set contains state that is, if its status is not 0
|
StringBuffer |
firstStatesToString()
Return a String representation of a state in the set (the first in the pile or the first reach in the omdd)
|
byte[] |
getChildsCount()
Return An array indicating such that childsCount[i] indicates the maxValue of the i-th gene
|
int |
getSize()
Gives the count of states in the diagram or INCONSISTENT_SIZE if the size is in inconsistent state.
|
int |
getSizeOrOverApproximation()
Gives the count of states in the diagram or its overapproximation if the size is in inconsistent state.
|
int |
getSizeOrUpdate()
Gives the count of states in the diagram.
If the size is in inconsistent state, then call updateSize() before. |
boolean |
isSizeConsistent()
Indicates if the size is in a consistent state, that is if it really reflect the number of state in the set, or only an overapproximation.
|
void |
merge(StatesSet slaveNodeStateSet)
Merge this set with the stateSet of the slaveNode.
|
void |
parse(String parse) |
int |
stateFromArray(byte[] state)
Generate a new omdd corresponding to the state and with the status 1
|
int |
stateFromArray(byte[] state,
int status)
Generate a new omdd corresponding to the state and with the status status
|
int |
stateFromString(String state)
Generate a new omdd corresponding to the state and with the status 1
|
int |
stateFromString(String str_state,
int status)
Generate a new omdd corresponding to the state and with the status 1>
|
List<byte[]> |
statesToFullList() |
void |
statesToFullList(List<byte[]> v)
Fill a list with all the states in the omdd
Each item of the returned list is a string representation using wildcard * (-1).
|
List<byte[]> |
statesToSchemaList()
Initialize and fill a list with all the states in the omdd
Each item of the returned list is a string representation using wildcard * (-1).
|
void |
statesToSchemaList(List<byte[]> v)
Fill a list with all the states in the omdd
Each item of the returned list is a string representation using wildcard * (-1).
|
StringBuffer |
statesToString(boolean addValue)
Return a String representation of the omdd
|
int[] |
updateSize()
Count the number of states in the Omdd and update the size accordingly
|
boolean |
updateStatus(byte[] state,
int newStatus)
Change the status associated of state in the set to newStatus
|
String |
write()
Return a parenthesis based representation of the MDD
|
public static final int INCONSISTENT_SIZE
public StatesSet(org.colomoto.mddlib.MDDManager ddmanager, byte[] childsCount)
public StatesSet(org.colomoto.mddlib.MDDManager ddmanager, int mdd, byte[] childsCount)
public void addState(byte[] state, int newStatus)
state
- newStatus
- public void addState(String state, int newStatus)
state
- newStatus
- public void addStates(List<byte[]> states)
states,
- a List<byte[]> of states to addpublic void merge(StatesSet slaveNodeStateSet)
slaveNodeStateSet
- public int[] updateSize()
public boolean isSizeConsistent()
public int getSize()
public int getSizeOrOverApproximation()
public int getSizeOrUpdate()
Gives the count of states in the diagram.
If the size is in inconsistent state, then call updateSize() before.
Note that by calling this function, you will not be able to retrieve the count of state per status.
public boolean contains(byte[] state)
state
- public boolean updateStatus(byte[] state, int newStatus)
state
- newStatus
- public int stateFromArray(byte[] state)
state
- the state to generatepublic int stateFromArray(byte[] state, int status)
state
- the state to generatestatus
- the value to append at the leaf.public int stateFromString(String state)
state
- the state to generatepublic int stateFromString(String str_state, int status)
str_state
- the state to generatepublic byte[] getChildsCount()
Return An array indicating such that childsCount[i] indicates the maxValue of the i-th gene
Use :
int countChilds = childsCount[level]; for (int i = 0; i < countChilds; i++) { ....omdd.next[i]....
public List<byte[]> statesToSchemaList()
public void statesToSchemaList(List<byte[]> v)
public List<byte[]> statesToFullList()
public void statesToFullList(List<byte[]> v)
public String write()
public StringBuffer statesToString(boolean addValue)
public StringBuffer firstStatesToString()
public void parse(String parse) throws SAXException
SAXException
Copyright © 2005–2020. All rights reserved.