|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartisynth.core.modelbase.ScanWriteUtils
public class ScanWriteUtils
Constructor Summary | |
---|---|
ScanWriteUtils()
|
Method Summary | ||
---|---|---|
static boolean |
getTokenPrinting()
Returns true if token printing is enabled in the
scanfull() method. |
|
static boolean |
postscanAttributeName(java.util.Deque<ScanToken> tokens,
java.lang.String name)
Checks if the next token in the queue is a StringToken containing the specified name. |
|
static boolean |
postscanComponent(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Checks if the next token on the queue is an ObjectToken holding a component reference. |
|
static boolean |
postscanComponent(java.util.Deque<ScanToken> tokens,
java.lang.String name,
CompositeComponent ancestor)
Checks if the next token on the queue is a StringToken matching a specific attribute name. |
|
static void |
postscanComponentBegin(java.util.Deque<ScanToken> tokens,
ModelComponent comp)
Checks if the next token in the queue is a BEGIN token for a component, and if so, consumes it. |
|
static ScanToken |
postscanComponentToken(java.util.Deque<ScanToken> tokens)
Checks if the next token on the queue is an ObjectToken holding a component reference. |
|
static java.util.ArrayList<Property> |
postscanProperties(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Checks that the next set of tokens in the stream consist of a BEGIN token, a set of property paths, and an END token. |
|
static Property |
postscanProperty(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Removes the next token from the queue, checks that it is a StringToken containing a property path relative to ancestor , and locates
and returns the property. |
|
static boolean |
postscanPropertyValues(java.util.Deque<ScanToken> tokens,
HasProperties host,
java.lang.String[] propNames)
Checks if the next token in the queue is a StringToken containing one of a specified set of property names. |
|
static
|
postscanReference(java.util.Deque<ScanToken> tokens,
java.lang.Class<C> clazz,
CompositeComponent ancestor)
Removes the next token from the queue, checks that it is a StringToken containing a reference path relative to ancestor , locates
the referenced component, verifies that it is an instance of
clazz , and returns it. |
|
static
|
postscanReferences(java.util.Deque<ScanToken> tokens,
java.lang.Class<C> clazz,
CompositeComponent ancestor)
Checks that the next set of tokens in the stream consist of a BEGIN token, a set of reference path names, and an END token. |
|
static
|
postscanReferences(java.util.Deque<ScanToken> tokens,
java.util.Collection<C> refs,
java.lang.Class<C> clazz,
CompositeComponent ancestor)
Checks that the next set of tokens in the stream consist of a BEGIN token, a set of reference path names, and an END token. |
|
static void |
printTokens(java.util.Deque<ScanToken> tokens)
Diagnostic method to print a token queue to the standard output stream. |
|
static void |
printTokens(java.io.PrintWriter pw,
java.util.Deque<ScanToken> tokens)
Diagnostic method to print a token queue to a print writer. |
|
static void |
scanAndStorePropertyPath(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens)
If the next input token is a quoted string or word, then assume that it corresponds to property path, store its value in the token queue as a StringToken , and return
true . |
|
static boolean |
scanAndStorePropertyPath(ReaderTokenizer rtok,
java.lang.String name,
java.util.Deque<ScanToken> tokens)
Attempts to scan a property path associated with a given attribute name. |
|
static int |
scanAndStorePropertyPaths(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens)
Assumes that the next set of input tokens are a set of property paths enclosed between square brackets. |
|
static int |
scanAndStorePropertyPaths(ReaderTokenizer rtok,
java.lang.String name,
java.util.Deque<ScanToken> tokens)
Attempts to scan a set of property paths associated with a given attribute name. |
|
static boolean |
scanAndStorePropertyValues(ReaderTokenizer rtok,
HasProperties host,
java.lang.String[] propNames,
java.util.Deque<ScanToken> tokens)
Attempts to scan and store a specific set of property values for a specified host. |
|
static boolean |
scanAndStoreReference(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens)
If the next input token is a quoted string or word, then assume that it corresponds to component reference path, store its value in the token queue as a StringToken , and return
true . |
|
static boolean |
scanAndStoreReference(ReaderTokenizer rtok,
java.lang.String name,
java.util.Deque<ScanToken> tokens)
Attempts to scan a reference path associated with a given attribute name. |
|
static int |
scanAndStoreReferences(ReaderTokenizer rtok,
java.util.Deque<ScanToken> tokens)
Assumes that the next set of input tokens are a set of component reference paths enclosed between square brackets. |
|
static int |
scanAndStoreReferences(ReaderTokenizer rtok,
java.lang.String name,
java.util.Deque<ScanToken> tokens)
Attempts to scan a set of reference paths associated with a given attribute name. |
|
static void |
scanfull(ReaderTokenizer rtok,
ModelComponent comp,
CompositeComponent ancestor)
Performs both a scan and a postscan for a specific component. |
|
static boolean |
scanProperty(ReaderTokenizer rtok,
HasProperties host)
Attempts to scan and set a property value for a specified host. |
|
static java.lang.Object |
scanPropertyValue(ReaderTokenizer rtok,
HasProperties host,
java.lang.String propName)
Scans a specific property value for a host, assuming that the property name has already been scanned and matched. |
|
static void |
setTokenPrinting(boolean enable)
Debugging hook to enable printing of the token queue produced in the scanfull() method, before postscan()
is called. |
|
static void |
writeBracketedReferences(java.io.PrintWriter pw,
java.util.Collection<? extends ModelComponent> comps,
CompositeComponent ancestor)
Writes the reference paths for a set of components to a print writer, enclosed by square brackets. |
|
static void |
writeReferences(java.io.PrintWriter pw,
java.lang.Iterable<ModelComponent> comps,
CompositeComponent ancestor)
Writes the reference paths for a set of components to a print writer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScanWriteUtils()
Method Detail |
---|
public static void setTokenPrinting(boolean enable)
scanfull()
method, before postscan()
is called.
enable
- if true
, enables token printing.public static boolean getTokenPrinting()
true
if token printing is enabled in the
scanfull()
method.
true
if token printing is enabled in
scan()
public static boolean scanAndStoreReference(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
StringToken
, and return
true
.
rtok
- input token streamtokens
- token queue for postscan
true
if reference path is scanned and stored
in the queue as a StringToken
java.io.IOException
public static int scanAndStoreReferences(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
StringTokens
, and return the number
of reference paths found.
rtok
- input token streamtokens
- token storage queue for postscan
java.io.IOException
public static void scanAndStorePropertyPath(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
StringToken
, and return
true
.
rtok
- input token streamtokens
- token storage queue for postscan
java.io.IOException
public static int scanAndStorePropertyPaths(ReaderTokenizer rtok, java.util.Deque<ScanToken> tokens) throws java.io.IOException
StringTokens
, and return the number
of paths found.
rtok
- input token streamtokens
- token storage queue for postscan
java.io.IOException
public static boolean scanAndStoreReference(ReaderTokenizer rtok, java.lang.String name, java.util.Deque<ScanToken> tokens) throws java.io.IOException
true
.
Otherwise, return false
.
rtok
- input token streamname
- attribute nametokens
- token storage queue for postscan
java.io.IOException
public static int scanAndStoreReferences(ReaderTokenizer rtok, java.lang.String name, java.util.Deque<ScanToken> tokens) throws java.io.IOException
rtok
- input token streamname
- attribute nametokens
- token storage queue for postscan
java.io.IOException
public static boolean scanAndStorePropertyPath(ReaderTokenizer rtok, java.lang.String name, java.util.Deque<ScanToken> tokens) throws java.io.IOException
true
.
Otherwise, return false
.
rtok
- input token streamname
- attribute nametokens
- token storage queue for postscan
java.io.IOException
public static int scanAndStorePropertyPaths(ReaderTokenizer rtok, java.lang.String name, java.util.Deque<ScanToken> tokens) throws java.io.IOException
true
.
Otherwise, return false
.
rtok
- input token streamname
- attribute nametokens
- token storage queue for postscan
java.io.IOException
public static boolean postscanAttributeName(java.util.Deque<ScanToken> tokens, java.lang.String name)
true
. Otherwise, returns false
.
tokens
- queue of stored tokensname
- name to check on the token queue
true
if the next token is a StringToken containing
name
.public static void postscanComponentBegin(java.util.Deque<ScanToken> tokens, ModelComponent comp) throws java.io.IOException
tokens
- queue of stored tokenscomp
- component associated with the BEGIN
java.io.IOException
public static boolean postscanComponent(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
true
.
Otherwise, returns false
.
tokens
- queue of stored tokensancestor
- ancestor for evaluating reference paths
java.io.IOException
- if unexpected token input was encounteredpublic static boolean postscanComponent(java.util.Deque<ScanToken> tokens, java.lang.String name, CompositeComponent ancestor) throws java.io.IOException
tokens
- queue of stored tokensname
- attribute nameancestor
- ancestor for evaluating reference paths
java.io.IOException
- if unexpected token input was encounteredpublic static ScanToken postscanComponentToken(java.util.Deque<ScanToken> tokens) throws java.io.IOException
null
.
tokens
- queue of stored tokens
null
.
java.io.IOException
- if unexpected token input was encounteredpublic static <C> C postscanReference(java.util.Deque<ScanToken> tokens, java.lang.Class<C> clazz, CompositeComponent ancestor) throws java.io.IOException
ancestor
, locates
the referenced component, verifies that it is an instance of
clazz
, and returns it.
tokens
- queue of stored tokensclazz
- class that the referenced component must be an instance ofancestor
- ancestor for the reference path
java.io.IOException
- if the next token is not a StringToken or
if the reference cannot be foundpublic static <C> C[] postscanReferences(java.util.Deque<ScanToken> tokens, java.lang.Class<C> clazz, CompositeComponent ancestor) throws java.io.IOException
ancestor
, type checked to ensure that they are
instances of clazz
, and then returned as an array.
tokens
- queue of stored tokensclazz
- class that each referenced component must be an instance ofancestor
- ancestor for the reference path
java.io.IOException
- if the token structure is incorrect or if
the referenced components cannot be found.public static <C> void postscanReferences(java.util.Deque<ScanToken> tokens, java.util.Collection<C> refs, java.lang.Class<C> clazz, CompositeComponent ancestor) throws java.io.IOException
ancestor
, type checked to ensure that they are
instances of clazz
, and then returned in
the collection refs
.
tokens
- queue of stored tokensrefs
- returns the component referencesclazz
- class that each referenced component must be an instance ofancestor
- ancestor for the reference path
java.io.IOException
- if the token structure is incorrect or if
the referenced components cannot be found.public static Property postscanProperty(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
ancestor
, and locates
and returns the property.
tokens
- queue of stored tokensancestor
- ancestor for the property path
java.io.IOException
- if the next token is not a StringToken or
if the property cannot be foundpublic static java.util.ArrayList<Property> postscanProperties(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
ancestor
and returned in an ArrayList.
tokens
- queue of stored tokensancestor
- ancestor for the reference path
java.io.IOException
- if the token structure is incorrect or if
the properties cannot be foundpublic static void scanfull(ReaderTokenizer rtok, ModelComponent comp, CompositeComponent ancestor) throws java.io.IOException
rtok
- input token streamcomp
- component to scanancestor
- ancestor component for resolving references
java.io.IOException
public static void printTokens(java.util.Deque<ScanToken> tokens)
tokens
- token queue to be printedpublic static void printTokens(java.io.PrintWriter pw, java.util.Deque<ScanToken> tokens)
pw
- print writer for printing the token queuetokens
- token queue to be printedpublic static boolean scanProperty(ReaderTokenizer rtok, HasProperties host) throws java.io.IOException
true
.
Otherwise, return false
.
rtok
- input token streamhost
- host containing the property
true
if a property was matched and scanned
java.io.IOException
public static java.lang.Object scanPropertyValue(ReaderTokenizer rtok, HasProperties host, java.lang.String propName) throws java.io.IOException
rtok
- input token streamhost
- host containing the propertypropName
- property to try and scan
java.io.IOException
public static boolean scanAndStorePropertyValues(ReaderTokenizer rtok, HasProperties host, java.lang.String[] propNames, java.util.Deque<ScanToken> tokens) throws java.io.IOException
StrinToken
and an ObjectToken
,
and return true
.
Otherwise, return false
.
This method is intended for handling property values which must be set in the post-scan stage after references have been set.
rtok
- input token streamhost
- host containing the propertiespropNames
- names of properties to matchtokens
- token queue for postscan
java.io.IOException
public static boolean postscanPropertyValues(java.util.Deque<ScanToken> tokens, HasProperties host, java.lang.String[] propNames) throws java.io.IOException
true
. Otherwise,
returns false
.
tokens
- queue of stored tokenshost
- host containing the propertiespropNames
- names of the properties to match
true
if a property was matched and set
java.io.IOException
public static void writeBracketedReferences(java.io.PrintWriter pw, java.util.Collection<? extends ModelComponent> comps, CompositeComponent ancestor) throws java.io.IOException
pw
- PrintWriter to write the references tocomps
- components providing the reference pathsancestor
- ancestor component with respect to which reference
paths should be generated
java.io.IOException
public static void writeReferences(java.io.PrintWriter pw, java.lang.Iterable<ModelComponent> comps, CompositeComponent ancestor) throws java.io.IOException
writeBracketedReferences()
, the paths are not enclosed
within square brackets.
pw
- PrintWriter to write the references tocomps
- components providing the reference pathsancestor
- ancestor component with respect to which reference
paths should be generated
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |