Java Doc for SAutomaton.java in  » Net » Terracotta » com » tc » jrexx » set » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Terracotta » com.tc.jrexx.set 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.tc.jrexx.set.SAutomaton

All known Subclasses:   com.tc.jrexx.regex.PAutomaton,
SAutomaton
public class SAutomaton (Code)
This class represents a (non-)deterministic final automaton (NFA/DFA). Use this class to create an automaton manually by adding states to the automaton and transitions to other states or to browse through the automaton's states and implement your own matching strategies.
to create an automaton manually try
import com.karneim.util.collection.set.*;
public class Test {
public static void main(String[] args) {
SAutomaton automaton = new SAutomaton();
IStatePro s1 = automaton.addState(false);
IStatePro s2 = automaton.addState(true);
s1.addTransition(new CharSet ("0123456789"),s2);
s2.addTransition(new CharSet("0123456789"),s2);
automaton.setStartState(s1);
}
}

to browse through the automaton's states try
final IStatePro startState = automaton.getStartState();
final StateProSet states = new StateProSet(startState);
final StateProSet.Iterator it = states.iterator();
for (IStatePro state=it.next(); state!=null; state=it.next()) {
IStatePro.ITransition[] transitions = state.getTransitions();
for (int i=0; i transitions.length; ++i) {
states.add(transitions[i].getToState());
System.out.println(
"from " + transitions[i].getFromState()
+ " through " + transitions[i].getCharSet()
+ " to " + transitions[i].getToState()
);
}
}

to implement own matching strategies try
/**
* returns true if input is an existing path through automaton's states
* otherwise false.
*
public static boolean incompleteMatch(SAutomaton automaton,String input) {
IState current = automaton.getStartState().visit();
for (int i=0; i input.length(); ++i) {
current = current.next(input.charAt(i));
if (current == null) return false;
}
return true;
}

author:
   Ralf Meyer
version:
   1.0

Inner Class :final class SAutomatonChangeListener implements Automaton.IChangedListener
Inner Class :public interface IChangeListener
Inner Class :protected class State implements IState
Inner Class :protected class Transition implements IStatePro.ITransition
Inner Class :protected class StatePro implements IStatePro

Field Summary
protected transient  AutomatonSet_Stringautomaton
    
protected transient  Automaton.IChangedListenerautomatonChangedListener
    
protected transient  LinkedListlisteners
    
protected transient  HashMapstate2wrapper
    
protected transient  HashMaptransition2wrapper
    

Constructor Summary
public  SAutomaton()
    
public  SAutomaton(FSAData data)
    
public  SAutomaton(InputStream automatonDataStream)
    
protected  SAutomaton(AutomatonSet_String automaton)
    

Method Summary
public  voidaddAll(SAutomaton automaton)
    
public  voidaddChangeListener(SAutomaton.IChangeListener listener)
     Adds the specified listener to receive change events from this automaton.
public  IStateProaddState()
     Adds a new non final state to this automaton.
public  IStateProaddState(boolean isFinal)
     Adds a new final or non final state to this automaton.
public  voidclear()
     Removes all states of this automaton.
public  voidcomplement()
    
protected  Automaton.IChangedListenergetAutomatonChangedListener()
    
public  IStateProgetStartState()
     Returns the current start state of the automaton.
public  StateProSetgetStates()
     Returns all states of this automaton whatever they are reachable through the current start state or not.
protected  voidinit(FSAData a)
    
public  booleanisDeterministic()
    
public  voidminimize()
     Minimizes this automaton as much as possible.
public  voidremoveAll(SAutomaton automaton)
    
public  booleanremoveChangeListener(SAutomaton.IChangeListener listener)
     Removes the specified listener so that it no longer receives change events from this automaton.
public  booleanremoveState(IStatePro state)
     Removes the specified state from this automaton.
public  voidretainAll(SAutomaton automaton)
    
public  voidsetStartState(IStatePro state)
     Sets the automaton's start state to the specified state.
public  FSADatatoData()
    
public  voidtoData(OutputStream automatonDataStream)
    
protected static  FSADatatoFSAData(Object obj)
    
public  StringtoString()
    

Field Detail
automaton
protected transient AutomatonSet_String automaton(Code)



automatonChangedListener
protected transient Automaton.IChangedListener automatonChangedListener(Code)



listeners
protected transient LinkedList listeners(Code)



state2wrapper
protected transient HashMap state2wrapper(Code)



transition2wrapper
protected transient HashMap transition2wrapper(Code)




Constructor Detail
SAutomaton
public SAutomaton()(Code)
Creates a new empty automaton



SAutomaton
public SAutomaton(FSAData data)(Code)



SAutomaton
public SAutomaton(InputStream automatonDataStream) throws IOException, ClassNotFoundException(Code)



SAutomaton
protected SAutomaton(AutomatonSet_String automaton)(Code)




Method Detail
addAll
public void addAll(SAutomaton automaton)(Code)



addChangeListener
public void addChangeListener(SAutomaton.IChangeListener listener)(Code)
Adds the specified listener to receive change events from this automaton. The listener will be registered as listener in any case, even if it has been registered yet. If a listener instance is added two times, it will receive events twice. important: don't forget to remove the listener, if you don't need it any longer but still have the automaton in use. Otherwise your listener won't be carbage collected (because it is registered with this automaton) and still will receive events.



addState
public IStatePro addState()(Code)
Adds a new non final state to this automaton. a new state



addState
public IStatePro addState(boolean isFinal)(Code)
Adds a new final or non final state to this automaton. a new state



clear
public void clear()(Code)
Removes all states of this automaton.



complement
public void complement()(Code)



getAutomatonChangedListener
protected Automaton.IChangedListener getAutomatonChangedListener()(Code)



getStartState
public IStatePro getStartState()(Code)
Returns the current start state of the automaton. important: The result is null, if and only if the current start state is null the current start state of the automaton



getStates
public StateProSet getStates()(Code)
Returns all states of this automaton whatever they are reachable through the current start state or not.



init
protected void init(FSAData a)(Code)



isDeterministic
public boolean isDeterministic()(Code)



minimize
public void minimize()(Code)
Minimizes this automaton as much as possible. The resulting automaton has as less states as possible.
important: the current implementation removes all properties from all transitions



removeAll
public void removeAll(SAutomaton automaton)(Code)



removeChangeListener
public boolean removeChangeListener(SAutomaton.IChangeListener listener)(Code)
Removes the specified listener so that it no longer receives change events from this automaton. If the listener instance is registered more than ones, only one instance will be removed.
Parameters:
  listener - true if the listener was registered else false



removeState
public boolean removeState(IStatePro state)(Code)
Removes the specified state from this automaton.
First all transitions pointing to state are removed and then the state itself.
If state is this automaton's start state then first of all this automaton's start state is set to null.
important: the specified state must have been created via the addState method of this automaton otherwise an IllegalArgumentException is thrown.
Parameters:
  state - true if this automaton owns the specified state else false



retainAll
public void retainAll(SAutomaton automaton)(Code)



setStartState
public void setStartState(IStatePro state)(Code)
Sets the automaton's start state to the specified state. If the automaton should have no start state pass null.
important: the specified state must be a state of this automaton which means
a) the state must have been created via the addState() method of this automaton
b) the state must not have been removed from this automaton via the removeState method
Parameters:
  state -



toData
public FSAData toData()(Code)



toData
public void toData(OutputStream automatonDataStream) throws IOException(Code)



toFSAData
protected static FSAData toFSAData(Object obj)(Code)



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.