Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class stateNode
- {
- public int stateNumber; //q0, q1, whatever
- public ArrayList paths;
- public boolean isFinal;
- int pathCount;
- public void stateNode(int statecount){
- stateNumber = statecount;
- neighbors = new ArrayList();
- isFinal = false;
- pathCount = 0;
- }
- public void addPath(autoPath inputPath){
- neighbors.add(inputPath);
- pathCount += 1;
- }
- public void addPath(stateNode* destState){
- autoPath(this*, destState);
- public void delPath( ){
- }
- public boolean EndCheck(){
- return isFinal;
- }
- public stateNode* Traverse(char input){
- for(int i = 0; i < paths.size(); i++){
- if (paths[i].checkInput(input)){
- return paths[i].destination;
- }
- }
- return paths[0].source; //I dunno if this works. I want it to return the original stateNode* it was at.
- }
- }
- //Class for a path.
- public class autoPath
- {
- public stateNode* source;
- public stateNode* destination;
- public ArrayList inputs;
- public void autoPath(stateNode* src, stateNode* dst){
- source = src;
- destination = dst;
- }
- public void setChars(ArrayList inputChars){
- inputs = inputChars;
- }
- public boolean checkInput(char input){
- for(int i = 0; i < inputs.size(); i++){
- if(inputs[i] == input){
- return true;
- }
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment