Package Torello.CSS
Class Punct
- java.lang.Object
-
- Torello.CSS.CSSToken
-
- Torello.CSS.Punct
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.CharSequence
,java.lang.Comparable<java.lang.CharSequence>
public final class Punct extends CSSToken implements java.lang.CharSequence, java.io.Serializable, java.lang.Comparable<java.lang.CharSequence>
This is a Token Data-Class. It is a descendant of the root CSSToken-Class:CSSToken
. Instances of the class are usually are produced by theCSSTokenizer
class. Many (but not all) of these subclasses maintain astatic
-method for building instances of this class named'build'
. AnyCSSToken
-subclass that is neither a singleton-instance, nor an "Error-Subtype" should have such a builder. Singeton instances do not need builders, and the two Error-Subtype Classes can only be generated by the tokenizer.
AllCSSToken
subclasses have aCSSToken.str
field which contains the exact character data that was extracted and used to construct instances of this class. All sub-casses also have several "Loop Optimization" methods. These are methods that may or may not be useful in light of some of the newer additions to JDK 17 & 21 including the'instanceof varName'
conditional-expression variable-naming features.
The algorithms used to write this tokenizer were generated based solely on the CSS Working-Group's Syntax-Documentation. This document may be viewed here:CSS Working-Group CSS-Syntax
. There is an external site that maintain all thing CSS located atdrafts.csswg.org
A class for saving one of nine different Punctuation-Token classes. The nine-available singleton-instances include:':', ';', ',', '[', ']', '(', ')', '{', '}'
- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/CSS/Punct.java
- Open New Browser-Tab: Torello/CSS/Punct.java
File Size: 4,221 Bytes Line Count: 110 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field protected static long
serialVersionUID
This Data-Class' Instance-Fields Modifier and Type Field char
c
-
Method Summary
Retrieve Singleton-Instance Modifier and Type Method static Punct
get(char c)
Loop-Optimization Methods: 'is' & 'if' Modifier and Type Method Punct
ifPunct()
boolean
isPunct()
-
Methods inherited from class Torello.CSS.CSSToken
asAtKeyword, asBadStr, asBadURL, asCDC, asCDO, asComment, asDelimiter, asDimension, asFunc, asHash, asIdentifier, asNum, asPercentage, asPunct, asStr, asUnicodeRange, asURL, asWhitespace, charAt, compareTo, equals, ifAtKeyword, ifBadStr, ifBadURL, ifCDC, ifCDO, ifComment, ifDelimiter, ifDelimiter, ifDimension, ifFunc, ifHash, ifIdentifier, ifNum, ifPercentage, ifPunct, ifStr, ifUnicodeRange, ifURL, ifWhitespace, isAtKeyword, isBadStr, isBadURL, isCDC, isCDO, isComment, isDelimiter, isDelimiter, isDimension, isFunc, isHash, isIdentifier, isNum, isPercentage, isPunct, isStr, isUnicodeRange, isURL, isWhitespace, length, subSequence, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
c
public final char c
The actual character that comprises this Punxtuation-Mark Token. Because ClassPunct
only allows singleton instances, therefore there is a limited number of characters to which this field may be assigned.
The nine singleton instances of ClassPunct
are built for the following nine punctuation characters:':' ';' ',' '[' ']' '(' ')' '{' '}'
-
-
Method Detail
-
isPunct
-
ifPunct
-
get
public static final Punct get(char c)
Retrieve the singleton instance of a particular CSS Character.- Parameters:
c
- Any Java'char'
primitive, but only the following characters will generate a non-null result from this method:':', ';', ',', '[', ']', '(', ')', '{', '}'
.- Returns:
- The singleton instance of
Punct
corresponding to'c'
. If'c'
doesn't have any correspondingPunct
Singleton-Instance, then null is returned.
-
-