Java Doc for ContentModel.java in  » Apache-Harmony-Java-SE » javax-package » javax » swing » text » html » parser » 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 » Apache Harmony Java SE » javax package » javax.swing.text.html.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.swing.text.html.parser.ContentModel

ContentModel
final public class ContentModel implements Serializable(Code)
Element s content representation. That's unary or binary expression. Operands can be null (matched with null object), instance of Element , instance of ContentModel .

Valid operations can be unary operations (types):

  1. '+' - (e+) - e must occur one or more times;
  2. '*' - (e*) - e must occur zero or more times;
  3. '?' - (e?) - e must occur zero or one time;
  4. (0) - (e) - e must occur one time only

and binary operations (types):

  1. '|' - (e1|e2) means either e1 or e2 must occur, but not both;
  2. ',' - (e1,e2) means both A and B must occur, in that order;
  3. '&' - (e1 & e2) means both e1 and e2 must occur, in any order;
(Operation interpretation corresponds to HTML 4.01 Specification (3.3.3))

As content model is using for dtd presentation here is some ambiguity what null object can be matched with. So null shouldn't be passed to constructor.

No recursion is allowed.

Content, next, type fields has the following limitation:

  1. if type is one from {'+', '*', '?'} content hasn't to be null and next can be not null, if a binary operation is applyed to them;
  2. if type is one from {'|', ',', '&'} content hasn't to be null and next must be null;
  3. content can be null, instance of Element or instance of ContentModel;
  4. type can be one from the following '*', '+', '?', '|', '&', ','.

The structure of a ContentModel is represented by a relation through its ContentModel.content and ContentModel.next fields. Using these fields and the information stored in the ContentModel.type field a ContentModel can be represented as a binary tree.

From now on, in the examples that will follow, we will consider the left branch and the one belonging to the ContentModel.content field and the right branch the ContentModel.next field.

Depending on the ContentModel.type of a ContentModel , the following cases may arise:

CASE 1: A binary relation over some ContentModel s:

 B
 / \ 
 C1  NULL
 /  \
 C2
 /  \
 ...
 /  \
 Cn
 /  \
 NULL
 
Where the binary operation B is applyed to all the ContentModel s C1, C2, ..., Cn (that is a sequence of ContentModel related by the ContentModel.next field, finishing in a null value). This means that this ContentModel represents the content model:
 (C1 B C2 B ... B Cn)
 
Here, obviously the B operator can be one of:
  • |
  • &
  • ,
CASE 2: A unary relation applied to one ContentModel
 U
 / \
 C1  NULL   
 
Where the unary operator U is only applyed to the ContentModel C1. This means that this ContentModel represents the content model:
 C1 U
 
Here, obviously the U operator can be one of:
  • +
  • *
  • ?
  • 0
CASE 3: An element
 ELEM
 
Where this is only an instance of a Element class and obviosly denotes a Element of the ContentModel . An important fact to remark is that a ContentModel may not be just an Element , it must be applyed to at least one unary operator, usually the 0 operator.

This means that if we want to represent the body ContentModel , the ContentModel will be denoted by:

 0
 +-----+-----+
 |           |              
 BODY         NULL
 
CASE 4: A null value
 NULL
 
The empty or null ContentModel is denoted by this value. It is also used to denote the end of a sequence of ContentModel (as seen in the CASE 1).

As an example, if we want to represent the content model denoted by the expression:

 ((E1? , E2)* & E3)+
 
The ContentModel will be denoted by:
 '+'
 +---------+---------+
 |                   |
 '&'                 NULL
 +---------+---------+
 |                   |
 '*'                 NULL
 +---------+---------+
 |                   |
 '|'                 '0'
 +------+------+     +------+------+
 |             |     |             |
 '?'           NULL   E4           NULL
 +---------+---------+
 |                   |
 '0'                 '0'
 +------+------+     +------+------+
 |             |     |             |
 E1           NULL   E2           '+'
 +------+------+
 |             |
 '0'           NULL
 +-----+-----+
 |           |
 E3         NULL
 


Field Summary
public  Objectcontent
     The content of the ContentModel.
public  ContentModelnext
     The next ContentModel in the ContentModel structure.
final static  longserialVersionUID
     The serialization UID value.
public  inttype
     The type of the content model.

Constructor Summary
public  ContentModel(int type, Object content, ContentModel next)
     Returns a new ContentModel .
public  ContentModel(int type, ContentModel content)
     Returns a new ContentModel .
public  ContentModel(Element content)
     That content model will be mathed with exactly one element.
public  ContentModel()
     Returns a ContentModel with its ContentModel.type field set to 0 and its ContentModel.content and ContentModel.next fields set to null.

Method Summary
public  booleanempty()
     Checks if the ContentModel can match an empty expression.
public  Elementfirst()
     Returns the Element that must be first in the ContentModel .
public  booleanfirst(Object token)
    
public  voidgetElements(Vector<Element> elemVec)
     Adds all elements of this contentModel to elemVec ignoring operations between elements.
 List<Pair<Element, Boolean>>implication(Element e, List<Element> parsed, boolean many, int depth, LinkedList<Pair<Element, Boolean>> path)
     Determines the sequence of Element needed to be implied to insert an Element .
Parameters:
  e - the Element found in the document are for which theimplication is needed.
Parameters:
  parsed - the ArrayList of Elements found previosly tothe Element e.
Parameters:
  many - a value specifyng whether the given Element may appearmore than once in the ContentModel
Parameters:
  depth - the depth level been searched in the ContentModel
Parameters:
  path - a possible path of implied Elements that may leed tothe Element e.
public  StringtoString()
     Returns a representation of the ContentModel converted to a string.

Field Detail
content
public Object content(Code)
The content of the ContentModel.



next
public ContentModel next(Code)
The next ContentModel in the ContentModel structure.



serialVersionUID
final static long serialVersionUID(Code)
The serialization UID value.



type
public int type(Code)
The type of the content model. It should be '*', '+', '?', '|', '&', ',' or 0.




Constructor Detail
ContentModel
public ContentModel(int type, Object content, ContentModel next)(Code)
Returns a new ContentModel . The ContentModel.type , ContentModel.content and ContentModel.next fields are filled with the information given as argument.



ContentModel
public ContentModel(int type, ContentModel content)(Code)
Returns a new ContentModel . The ContentModel.type and {ContentModel#content} fields are filled with the information given throough the arguments. The ContentModel.next field is set to null.



ContentModel
public ContentModel(Element content)(Code)
That content model will be mathed with exactly one element. Type will be 0. Element can be equals to null. In such case ContentModel will be matched with an empty input stream.



ContentModel
public ContentModel()(Code)
Returns a ContentModel with its ContentModel.type field set to 0 and its ContentModel.content and ContentModel.next fields set to null.




Method Detail
empty
public boolean empty()(Code)
Checks if the ContentModel can match an empty expression. true if and only if some of the conditions is true:
  • type equals to '*' or '?';
  • type equals to '|' and one of the ContentModelsrelated by the binary operator can be empty.
  • type equals to '&' or ',' and all the ContentModelsrelated by the binary operation can be empty.

If the type equals '+', then it returns true if theContentModel applied to this operator can be empty;

If the type equals '0' then it returns false.




first
public Element first()(Code)
Returns the Element that must be first in the ContentModel . The first element that may appear in the ContentModel.Null if there is more than one possible Element.



first
public boolean first(Object token)(Code)
Returns if a given token can occur as first elements in a ContentModel
Parameters:
  token - the element we are interested in determining whether it canoccur as the first element of a ContentModel
  • if type equals to 0, returns true if and only if token equals tocontent.
  • if type is one from the unary types returns true if and only if oneof the following conditions is true:
    1. content is instance of Element, token is instance ofElement and token equals to content
    2. content is instance of ContentModel, token is instance ofElement and content.first(token) returns true;
  • if type is one from binary types then:
    1. if content instance of Element and content equals to tokenreturns true;
    2. if content instance of ContentModel and content.first(token)equals to true, then returns true;
    3. if type equals to ',' returns true if and only if content isinstance of ContentModel and:
      • for at least one of the ContentModel related by the ',',first(token) is true and,
      • for all the ContentModels that preceded it, empty() istrue.
    4. if type equals to '| or '&', it returns true if and only if at leastone of ContentModels related by the '|' or '&' operatorsatisfies that first(token) is true.



getElements
public void getElements(Vector<Element> elemVec)(Code)
Adds all elements of this contentModel to elemVec ignoring operations between elements. For instance, for ((a+)| ((b*),(c?))) elements a,b,c will be added to the elemVec. The argument elemVec should not be null. If content is null, nothing will be added to elemVec.
Parameters:
  elemVec - the vector where the Elements of theContentModel will be added to.



implication
List<Pair<Element, Boolean>> implication(Element e, List<Element> parsed, boolean many, int depth, LinkedList<Pair<Element, Boolean>> path)(Code)
Determines the sequence of Element needed to be implied to insert an Element .
Parameters:
  e - the Element found in the document are for which theimplication is needed.
Parameters:
  parsed - the ArrayList of Elements found previosly tothe Element e.
Parameters:
  many - a value specifyng whether the given Element may appearmore than once in the ContentModel
Parameters:
  depth - the depth level been searched in the ContentModel
Parameters:
  path - a possible path of implied Elements that may leed tothe Element e.
  1. null, if an implication path to the element e could not be found.
  2. an empty List if the element may be insertedin the actual position, with no implication of other elements needed.
  3. a non empty List if some Elements need to be implied.In such case, the List is formed by a pair. The firstcomponent defines the Element needed to be implied. Thesecond component defines if the Element must be opened andclosed (if true) or just opened (false).



toString
public String toString()(Code)
Returns a representation of the ContentModel converted to a string. a String representing the ContentModel



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.