Java Doc for Consumer.java in  » Parser » runcc » fri » patterns » interpreter » parsergenerator » lexer » 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 » Parser » runcc » fri.patterns.interpreter.parsergenerator.lexer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   fri.patterns.interpreter.parsergenerator.lexer.Consumer

All known Subclasses:   fri.patterns.interpreter.parsergenerator.lexer.ConsumerAlternatives,
Consumer
class Consumer implements Comparable,Serializable(Code)
Consuming characters (or bytes) means reading from an input stream as long as the read characters match the pattern the consumer was built for. A consumer can be built with a fixed string, a character set, other character consumers, or a mixed sequence of those. It can be a list of alternating (parallel) consumers. It can be set repeatable and nullable. A character consumer succeeds when he could apply all consumers or patterns/sets stored in its sequence when reading input. It fails and unreads all characters when one non-nullable consumer in its sequence fails.
author:
   (c) 2002, Fritz Ritzberger

Inner Class :public static class Reference

Field Summary
protected  intfixedLengthstartLengthvariance
    
protected  Rulerule
    

Constructor Summary
 Consumer(Rule rule)
     Empty consumer knowing its rule.
 Consumer(String charOrString)
     Consumer with some start character or fixed string, without rule.
protected  Consumer()
     Internal constructor needed in LexerBuilder.

Method Summary
public  voidappend(String charOrString)
     Append a String or character to sequence.
public  voidappend(Reference subConsumer)
     Add a character consumer reference.
public  voidappend(Consumer subConsumer)
     Add a character consumer.
public  voidappendSet(String high)
     Add a character set by its high character.
public  intcompareTo(Object o)
     Implements Comparable: Sort alternatives by precedence: - getStartVariance(), + getStartLength(), + getFixedLength().
public  ResultTreeconsume(InputText input)
     Reads from input.
protected  ResultTreeconsumeInternal(InputText input)
     Consumes characters from Input and stores it into returned result tree.
public  ListgetAlternatives()
     Always returns null as this consumer holds no alternatives.
public  intgetFixedLength()
     The fixed length ends before the first found character set (like "0..9") or repeatable or nullable consumer.
protected  intgetSomeLength(boolean exploreStartLength, List breakIndicator)
    
public  CharactergetStartCharacter()
     Returns the first character of this consumer, or null if starting with a set.
public  intgetStartLength()
     The start length ends before the first found repeatable or nullable consumer (like "chars*"), but not before a character set.
public  intgetStartVariance()
     Returns the count of possible start characters.
public  booleanisNullable()
    
public  booleanisRepeatable()
    
protected  voidlistToString(List list, StringBuffer sb, String separator, boolean separatorAtFirst)
     Converts a list into String, for toString() method.
 booleanmatchesRepeatableRule(Rule rule)
     Returns true if the rule of this consumer matches the passed left recursive rule. E.g.
 Consumeroptimize()
     Return contained consumer when having only one and no constraints.
public  booleanoverlaps(Consumer cc)
     Returns true if the passed consumer could be concurrent with this.
public  voidresolveConsumerReferences(Map charConsumers, Map doneList)
     Resolve all references to real consumers after build.
public  voidsetNullable()
    
public  voidsetRepeatable()
    
public  voidsetStrategyFactoryMethod(StrategyFactoryMethod strategyFactoryMethod)
     Passes the factory for Strategy objects to all contained ConsumerAlternatives.
public  voidsubtract(Consumer constraint)
     Passed Consumer will constrain every character of this consumer.
public  voidsubtract(Reference constraint)
     Passed reference will constrain every character of this consumer.
public  StringtoString()
     String representation of consumer: hashcode, sequence and constraints.
protected  StringtoStringBase()
     Returns the base string for toString() method.

Field Detail
fixedLengthstartLengthvariance
protected int fixedLengthstartLengthvariance(Code)



rule
protected Rule rule(Code)




Constructor Detail
Consumer
Consumer(Rule rule)(Code)
Empty consumer knowing its rule. This could become a Lexer toplevel consumer.



Consumer
Consumer(String charOrString)(Code)
Consumer with some start character or fixed string, without rule.



Consumer
protected Consumer()(Code)
Internal constructor needed in LexerBuilder.




Method Detail
append
public void append(String charOrString)(Code)
Append a String or character to sequence.



append
public void append(Reference subConsumer)(Code)
Add a character consumer reference.



append
public void append(Consumer subConsumer)(Code)
Add a character consumer.



appendSet
public void appendSet(String high) throws LexerException(Code)
Add a character set by its high character. Low character is previously appended one.



compareTo
public int compareTo(Object o)(Code)
Implements Comparable: Sort alternatives by precedence: - getStartVariance(), + getStartLength(), + getFixedLength().



consume
public ResultTree consume(InputText input) throws IOException(Code)
Reads from input. Returns null if input did not match, else a result tree containing the text. Ensures that a nullable consumer never returns null and a repeatable consumer repeats.
Parameters:
  input - Input object where to read from. null if no match, else scanned input as a result tree.



consumeInternal
protected ResultTree consumeInternal(InputText input) throws IOException(Code)
Consumes characters from Input and stores it into returned result tree. Returns null if nothing has been consumed.



getAlternatives
public List getAlternatives()(Code)
Always returns null as this consumer holds no alternatives.



getFixedLength
public int getFixedLength()(Code)
The fixed length ends before the first found character set (like "0..9") or repeatable or nullable consumer.



getSomeLength
protected int getSomeLength(boolean exploreStartLength, List breakIndicator)(Code)



getStartCharacter
public Character getStartCharacter()(Code)
Returns the first character of this consumer, or null if starting with a set.



getStartLength
public int getStartLength()(Code)
The start length ends before the first found repeatable or nullable consumer (like "chars*"), but not before a character set.



getStartVariance
public int getStartVariance()(Code)
Returns the count of possible start characters. For fixed start character this is 1.



isNullable
public boolean isNullable()(Code)



isRepeatable
public boolean isRepeatable()(Code)



listToString
protected void listToString(List list, StringBuffer sb, String separator, boolean separatorAtFirst)(Code)
Converts a list into String, for toString() method.



matchesRepeatableRule
boolean matchesRepeatableRule(Rule rule)(Code)
Returns true if the rule of this consumer matches the passed left recursive rule. E.g. passing "nonterm ::= nonterm something" would match "nonterm ::= something".



optimize
Consumer optimize()(Code)
Return contained consumer when having only one and no constraints. This is called immediately after construction.



overlaps
public boolean overlaps(Consumer cc)(Code)
Returns true if the passed consumer could be concurrent with this. This method does not consider constraints, as these could be complex.



resolveConsumerReferences
public void resolveConsumerReferences(Map charConsumers, Map doneList) throws LexerException(Code)
Resolve all references to real consumers after build.



setNullable
public void setNullable()(Code)



setRepeatable
public void setRepeatable()(Code)



setStrategyFactoryMethod
public void setStrategyFactoryMethod(StrategyFactoryMethod strategyFactoryMethod)(Code)
Passes the factory for Strategy objects to all contained ConsumerAlternatives.



subtract
public void subtract(Consumer constraint)(Code)
Passed Consumer will constrain every character of this consumer.



subtract
public void subtract(Reference constraint)(Code)
Passed reference will constrain every character of this consumer.



toString
public String toString()(Code)
String representation of consumer: hashcode, sequence and constraints.



toStringBase
protected String toStringBase()(Code)
Returns the base string for toString() method.



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.