public void setStatesOfUDB(ProbabilisticNetwork rede, EDBUnit sNode){
EDBUnit states = sNode.get("STATES");
EDBUnit cpt = sNode.get("CPT");
EDBUnit eq = sNode.get("EQUATION");
String type = sNode.get("INFO.TYPE").getData();
Node uNode = rede.getNode(sNode.getName());
if( type.equalsIgnoreCase("Discrete") ){
ArrayMap<Object, Integer> stateIndexMap = new ArrayMap<Object, Integer>();
for( int i = 0; i < uNode.getStatesSize(); i++ ){
stateIndexMap.put(uNode.getStateAt(i), i);
}
/////////////////////////////////////////////////////////////////////////////////////
//3. fill zero on table
ITabledVariable aux = null;
PotentialTable auxTab = null;
if (uNode instanceof ITabledVariable) {
aux = (ITabledVariable) uNode;
auxTab = aux.getPotentialTable() ;
}
int curStateSize = uNode.getStatesSize();
for( INode parent : uNode.getParentNodes() )
curStateSize *= parent.getStatesSize();
for( int i = 0; i < curStateSize; i++ )
auxTab.addValueAt(i, 0);
auxTab.setTableSize(curStateSize);
/////////////////////////////////////////////////////////////////////////////////////
//4. add new values in the states of BN
// EX]
// CPT[Isa]parent1.state1{parent1.Name}[Isa]parent2.state1{parent2.Name}[Next]cur.state1[Next]cur.state2
// ...
int coord[] = new int[uNode.getParentNodes().size()+1];
AddNewStatesValueToBNNode( cpt, coord, stateIndexMap, auxTab ) ;
//5. add new scripts of BN
// CPS.getInstance().setScript(cNode, eq.getData());