ContentModel (Java Platform SE 8 )
Keywords: javax.swing.text.html.parser.ContentModel class
Date: 2018-03-02

javax.swing.text.html.parser

## Class ContentModel

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

- All Implemented Interfaces:
    Serializable

      public final class ContentModel
      extends Object
      implements Serializable

  A representation of a content model. A content model is basically a restricted BNF expression. It is restricted in the sense that it must be deterministic. This means that you don't have to represent it as a finite state automaton.

  See Annex H on page 556 of the SGML handbook for more information.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Object` | `content` The content.
    `ContentModel` | `next` The next content model (in a ',', '|' or '&' expression).
    `int` | `type` Type.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentModel()`
    `ContentModel(Element content)` Create a content model for an element.
    `ContentModel(int type, ContentModel content)` Create a content model of a particular type.
    `ContentModel(int type, Object content, ContentModel next)` Create a content model of a particular type.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `empty()` Return true if the content model could match an empty input stream.
    `Element` | `first()` Return the element that must be next.
    `boolean` | `first(Object token)` Return true if the token could potentially be the first token in the input stream.
    `void` | `getElements(Vector<Element> elemVec)` Update elemVec with the list of elements that are part of the this contentModel.
    `String` | `toString()` Convert to a string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### type

          public int type

      Type. Either '*', '?', '+', ',', '|', '&'.

    - #### content

          public Object content

      The content. Either an Element or a ContentModel.

    - #### next

          public ContentModel next

      The next content model (in a ',', '|' or '&' expression).

  - ### Constructor Detail

    - #### ContentModel

          public ContentModel()

    - #### ContentModel

          public ContentModel(Element content)

      Create a content model for an element.

    - #### ContentModel

          public ContentModel(int type,
                              ContentModel content)

      Create a content model of a particular type.

    - #### ContentModel

          public ContentModel(int type,
                              Object content,
                              ContentModel next)

      Create a content model of a particular type.

  - ### Method Detail

    - #### empty

          public boolean empty()

      Return true if the content model could match an empty input stream.

    - #### getElements

          public void getElements(Vector<Element> elemVec)

      Update elemVec with the list of elements that are part of the this contentModel.

    - #### first

          public boolean first(Object token)

      Return true if the token could potentially be the first token in the input stream.

    - #### first

          public Element first()

      Return the element that must be next.

    - #### toString

          public String toString()

      Convert to a string.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of the object.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.