| java.lang.Object de.susebox.jtopas.TokenizerProperty
TokenizerProperty | public class TokenizerProperty (Code) | |
This class is mainly used by
TokenizerProperties implementations to
return
java.util.Iterator objects of their various properties (keywords,
special sequences etc.). Moreover, it can be used whereever information about
a lexical element description is needed, for instance when firing a
TokenizerPropertyEvent .
This class replaces the older
de.susebox.java.util.TokenizerProperty class which is deprecated.
See Also: TokenizerProperties author: Heiko Blau |
Constructor Summary | |
public | TokenizerProperty() Default constructor. | public | TokenizerProperty(int type) Constructs a TokenizerProperty where only the type is known so
far. | public | TokenizerProperty(int type, String[] images) Constructs a TokenizerProperty with type and image(s). | public | TokenizerProperty(int type, String[] images, Object companion) Constructs a TokenProperty object with a set of type, image(s)
and companion. | public | TokenizerProperty(int type, String[] images, Object companion, int flags) Constructs a TokenProperty object with a set of type, image(s),
companion object and flags. | public | TokenizerProperty(int type, String[] images, Object companion, int flags, int flagMask) Constructs a TokenProperty object with a set of type, image(s),
companion object and flags with an associated flag mask (
See Also: #setFlags(int, int)
for details). |
Method Summary | |
public boolean | containsFlag(int flag) Checks wether a given flag is in the current flag mask. | public boolean | equals(Object that) Redefinition of the well-known
java.lang.Object.equals method. | public Object | getCompanion() Obtaining the associated information of the token. | public int | getFlagMask() Retrieving the current flag mask containing the bits that are valid in the
return value of
TokenizerProperty.getFlags . | public int | getFlags() Retrieving the flags of this property. | public String[] | getImages() Retrieving the one or more images a lexical element description has. | public int | getType() Retrieving the type of this property. | public boolean | isFlagSet(int flag, boolean defVal) Checks wether a given flag is set or cleared for this property. | public void | setCompanion(Object companion) Some token may have associated informations for the user of the Token . | public void | setFlags(int flags) Setting flags. | public void | setFlags(int flags, int flagMask) Setting the values for the flags contained in the flag mask. | public void | setImages(String[] images) Images of lexical elements are quite different. | public void | setType(int type) Setting the type of the TokenizerProperty . | public String | toString() Redefinition of the well-known
java.lang.Object.toString method. |
PARSE_FLAG_MASK | final public static byte PARSE_FLAG_MASK(Code) | | The property describes a parse flag mask. This type is nessecary for the
"parse flag changed" event fired by
TokenizerProperties
implementations.
|
_flagMask | protected int _flagMask(Code) | | |
_flags | protected int _flags(Code) | | |
_type | protected int _type(Code) | | |
TokenizerProperty | public TokenizerProperty()(Code) | | Default constructor. Initializes a property with type
Token.UNKNOWN and no images or flags.
|
TokenizerProperty | public TokenizerProperty(int type)(Code) | | Constructs a TokenizerProperty where only the type is known so
far. For the type, one of the constants defined in
Token must be
used.
Parameters: type - the property type |
TokenizerProperty | public TokenizerProperty(int type, String[] images)(Code) | | Constructs a TokenizerProperty with type and image(s). For the
type, one of the constants defined in
Token must be used.
Parameters: type - the property type Parameters: images - the characterising images of a lexical element |
TokenizerProperty | public TokenizerProperty(int type, String[] images, Object companion)(Code) | | Constructs a TokenProperty object with a set of type, image(s)
and companion.
Parameters: type - the property type Parameters: images - the characterising images of a lexical element Parameters: companion - the associated information for the lexical element |
TokenizerProperty | public TokenizerProperty(int type, String[] images, Object companion, int flags)(Code) | | Constructs a TokenProperty object with a set of type, image(s),
companion object and flags.
Parameters: type - the property type Parameters: images - the characterising images of a lexical element Parameters: companion - the associated information for the lexical element Parameters: flags - the specific parse flags for this lexical element |
TokenizerProperty | public TokenizerProperty(int type, String[] images, Object companion, int flags, int flagMask)(Code) | | Constructs a TokenProperty object with a set of type, image(s),
companion object and flags with an associated flag mask (
See Also: #setFlags(int, int)
for details).
Parameters: type - the property type Parameters: images - the characterising images of a lexical element Parameters: companion - the associated information for the lexical element Parameters: flags - the specific parse flags for this lexical element Parameters: flagMask - which bits of the parse flags are actually valid |
containsFlag | public boolean containsFlag(int flag)(Code) | | Checks wether a given flag is in the current flag mask. That means that the
property contains its own explicit value for the flag.
The method can be used in combination with
TokenizerProperty.isFlagSet to determine
wether the return value of isFlagSet is actually the default
value given to that method, or the flag value of the property itself.
The method returns true only if the all bits in the given flag
are in the current flag mask.
Parameters: flag - the flag to check Parameters: defVal - the default value if the flag is not contained in the current flag mask true if the given flag is explicitely set or the defaultvalue is true , false if the given flag isexplicitely cleared or the default value is false . |
equals | public boolean equals(Object that)(Code) | | Redefinition of the well-known
java.lang.Object.equals method.
Parameters: that - compare this instance with that object true if the two object describe the same property,false otherwise |
getImages | public String[] getImages()(Code) | | Retrieving the one or more images a lexical element description has.
the array with images like string start and end sequences etc. See Also: TokenizerProperty.setImages |
getType | public int getType()(Code) | | Retrieving the type of this property. Usually, one of the constants defined
in
Token is returned, for instance
Token.NORMAL ,
Token.KEYWORD
or
Token.WHITESPACE . However, implementations and subclasses of the
interfaces and classes in the package
de.susebox.jtopas may define,
set and return their own type constants.
type of the property See Also: TokenizerProperty.setType |
isFlagSet | public boolean isFlagSet(int flag, boolean defVal)(Code) | | Checks wether a given flag is set or cleared for this property. The default
value is returned if the current flag mask (see
TokenizerProperty.getFlagMask ) does
not contain the given flag. This is the case if
TokenizerProperty.containsFlag would
return false for the given flag.
If containsFlag returns true for the given flag,
isFlagSet returns true only if the all bits in the
given flag are in the current flags.
Parameters: flag - the flag to check Parameters: defVal - the default value if the flag is not contained in the current flag mask true if the given flag is explicitely set or the defaultvalue is true , false if the given flag isexplicitely cleared or the default value is false . |
setCompanion | public void setCompanion(Object companion)(Code) | | Some token may have associated informations for the user of the Token .
A popular thing would be the association of an integer constant to a special
sequence or keyword to be used in fast switch statetents.
Parameters: companion - the associated information for the lexical element |
setFlags | public void setFlags(int flags, int flagMask)(Code) | | Setting the values for the flags contained in the flag mask. The flags
are not specified here. Usually, a combination of
TokenizerProperties
F_... constants is used here.
The flag mask contains the set flags that are valid for this
TokenizerProperty . Flags that are not contained in the flag mask,
have an "unknown" value in this instance.
A flag mask value of -1 means that all flags should are valid. flag = 0
and flagMask = TokenizerProperties.F_CASE means that the property
is case-insensitive, but there are no other characteristics explicitely set
for this property.
Parameters: flags - a bitmask of flags to be set or clear Parameters: flagMask - a bitmask containing the flags that are valid in flags See Also: TokenizerProperty.getFlags |
setImages | public void setImages(String[] images) throws IllegalArgumentException(Code) | | Images of lexical elements are quite different. Starting sequences of line
comments, keywords and special sequences are strings representing only
themselfes. Whitespaces and separators are represented as string consisting
of the single whitespace and separator characters and / or character ranges.
A block comment is represented an array of two strings. The first is the
starting sequence, the second the finishing sequence. The same is true for
string elements. However, string elements usually have an escape sequence.
Parameters: images - the characterising images of a lexical element |
setType | public void setType(int type)(Code) | | Setting the type of the TokenizerProperty . Usually, one of the
constants defined in
Token is passed to this method, for instance
Token.NORMAL ,
Token.KEYWORD or
Token.WHITESPACE .
However, implementations and subclasses of the interfaces and classes in the
package
de.susebox.jtopas may define, set and return their own type
constants.
Parameters: type - type of the tokenizer property (one of the Token constants) See Also: Token See Also: TokenizerProperty.getType |
|
|