Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

State.java

00001 package gov.nasa.arc.ase.ltl;
00002 
00003 // Written by Dimitra Giannakopoulou, 29 Jan 2001
00004 import java.util.*;
00005 import gov.nasa.arc.ase.util.graph.*;
00006 
00007 class State implements Comparable
00008 {
00009   private int representativeId = -1;
00010   private LinkedList transitions;
00011   private BitSet accepting;
00012   private boolean safety_acceptance;
00013 
00014   public State()
00015   {
00016     transitions = new LinkedList();
00017     accepting = null;
00018     safety_acceptance = false;
00019   }  
00020   public State(int equivId)
00021   {
00022     transitions = new LinkedList();
00023     accepting = null;
00024     safety_acceptance = false;
00025     representativeId = equivId;
00026   }  
00027   public State(BitSet acc)
00028   {
00029     transitions = new LinkedList();
00030     accepting = acc;
00031     safety_acceptance = false;
00032   }  
00033   public State(BitSet acc, int equivId)
00034   {
00035     transitions = new LinkedList();
00036     accepting = acc;
00037     safety_acceptance = false;
00038     representativeId = equivId;
00039   }  
00040   public boolean accepts(int i)
00041   {
00042     return (! (accepting.get(i)));
00043     // because in my accepting array 0 corresponds to accepting
00044   }  
00045   public void add(Transition trans)
00046   {
00047     transitions.add(trans);
00048 
00049   }  
00050   public int compareTo(Object f)
00051   {
00052     if (this == f) return(0);
00053     else return(1);
00054   }  
00055   /*    public boolean isAccepting()
00056     {
00057     return accepting;
00058     }
00059    */
00060 
00061   public void FSPoutput()
00062   {
00063     ListIterator iter = transitions.listIterator(0);
00064     Transition nextTrans;
00065     boolean first_trans = true;
00066 
00067     while (iter.hasNext())
00068     {
00069       nextTrans = (Transition) iter.next();
00070       if (first_trans)
00071       {
00072     System.out.print("(");
00073     first_trans = false;
00074       }
00075       else
00076     System.out.print("|");
00077       nextTrans.FSPoutput();
00078 
00079     }
00080   }  
00081   public int get_representativeId()
00082   {
00083     return (representativeId);
00084   }  
00085   public boolean is_safe ()
00086   {
00087     return safety_acceptance;
00088   }  
00089   public void set_representativeId(int id)
00090   {
00091     representativeId = id;
00092   }  
00093   public void SMoutput(gov.nasa.arc.ase.util.graph.Node[] nodes, gov.nasa.arc.ase.util.graph.Node node) {
00094     ListIterator iter = transitions.listIterator(0);
00095     Transition nextTrans;
00096     boolean first_trans = true;
00097 
00098     while (iter.hasNext()) {
00099       nextTrans = (Transition)iter.next();
00100       nextTrans.SMoutput(nodes, node);
00101     }
00102   }  
00103   public void step (Hashtable ProgramState, TreeSet newStates, State[] automaton)
00104   {
00105     ListIterator iter = transitions.listIterator(0);
00106     Transition nextTrans;
00107 
00108     while (iter.hasNext())
00109     {
00110       nextTrans = (Transition) iter.next();
00111       if (nextTrans.enabled(ProgramState))
00112     newStates.add(automaton[nextTrans.goesTo()]);
00113     }
00114   }  
00115   public void update_acc(BitSet acc)
00116   {
00117     accepting = acc;
00118   }  
00119   public void update_acc(BitSet acc, int equivId)
00120   {
00121     accepting = acc;
00122     representativeId = equivId;
00123   }  
00124   public void update_safety_acc (boolean val)
00125   {
00126     safety_acceptance = val;
00127   }  
00128 }

Generated at Thu Feb 7 06:55:49 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001