public class ASDGrammar
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DUMMYWORD
The string used in dummy nodes in an ASD grammar.
|
| Constructor and Description |
|---|
ASDGrammar()
Creates a new empty ASDGrammar.
|
ASDGrammar(java.lang.String fileName,
boolean includeCoords)
Creates a new ASDGrammar from the character representation
stored in a given file.
|
ASDGrammar(java.lang.String fileName,
boolean includeCoords,
boolean markIncoming)
Creates a new ASDGrammar from the character representation
stored in a given file.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.HashMap<java.lang.String,asd.ASDWordEntry> |
lexicon() |
ASDGrammarNode |
lookupInstance(ASDGrammarSuccessor successor)
Looks up a word instance in the grammar specified by a given
ASDGrammarSuccessor.
|
java.util.ArrayList<ASDGrammarNode> |
lookupWord(java.lang.String word)
Looks up a given string in the grammar and returns a list
of instances for the word.
|
void |
markNodesWithIncomingEdges()
Marks all ASDGrammarNodes in the grammar that have incoming edges.
|
boolean |
nodesWithIncomingEdgesMarked()
Indicates whether all ASDGrammarNodes in the grammar that have
incoming edges have already been marked.
|
java.util.HashSet<java.lang.String> |
phraseTypes() |
static void |
setDUMMYWORD(java.lang.String newValue)
Allows a client to reset the string which is used to represent
a "dummy" word in the grammar -- used in the labels on dummy nodes.
|
void |
setNodesWithIncomingEdgesNotMarked()
Allows a client to reset to false the flag which indicates whether
nodes in the grammar with incoming edges have been marked.
|
boolean |
uniqueInstance(java.lang.String word)
Indicates whether or not a specified word has exactly
one instance in the lexicon/grammar.
|
public static java.lang.String DUMMYWORD
public ASDGrammar()
public ASDGrammar(java.lang.String fileName,
boolean includeCoords)
throws java.io.IOException,
ASDInputException,
java.net.MalformedURLException
fileName - the name of the file to be usedincludeCoords - indicates whether or not to include
pixel coordinates in the grammar loaded, if they are
present. They are needed by ASDEditor but not by ASDParser.java.io.IOExceptionASDInputExceptionjava.net.MalformedURLExceptionpublic ASDGrammar(java.lang.String fileName,
boolean includeCoords,
boolean markIncoming)
throws java.io.IOException,
ASDInputException,
java.net.MalformedURLException
fileName - the name of the file to be usedincludeCoords - indicates whether or not to include
pixel coordinates in the grammar loaded, if they are
present. They are needed by ASDEditor but not by ASDParser.markIncoming - indicates whether or not to mark grammar
nodes that have incoming edges, for use by the ASDparserjava.io.IOExceptionASDInputExceptionjava.net.MalformedURLExceptionpublic java.util.HashMap<java.lang.String,asd.ASDWordEntry> lexicon()
public ASDGrammarNode lookupInstance(ASDGrammarSuccessor successor)
successor - an ASDGrammarSuccessor specifying the word instancepublic java.util.ArrayList<ASDGrammarNode> lookupWord(java.lang.String word)
word - the "word" string to be looked uppublic final void markNodesWithIncomingEdges()
public boolean nodesWithIncomingEdgesMarked()
public java.util.HashSet<java.lang.String> phraseTypes()
public static void setDUMMYWORD(java.lang.String newValue)
newValue - is the new string to represent a "dummy" wordpublic void setNodesWithIncomingEdgesNotMarked()
public boolean uniqueInstance(java.lang.String word)
word - the "word" string to be looked up