public class Definitions
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Definitions.LineTagMap |
static class |
Definitions.Tag
Class that represents a single tag.
|
Constructor and Description |
---|
Definitions() |
Modifier and Type | Method and Description |
---|---|
void |
addTag(int line,
java.lang.String symbol,
java.lang.String type,
java.lang.String text) |
static Definitions |
deserialize(byte[] bytes)
Deserialize a binary representation of a
Definitions object. |
java.util.Set<java.lang.String> |
getSymbols()
Get all symbols used in definitions.
|
java.util.List<Definitions.Tag> |
getTags()
Get a list of all tags.
|
boolean |
hasDefinitionAt(java.lang.String symbol,
int lineNumber,
java.lang.String[] strs)
Check whether the specified symbol is defined on the given line.
|
boolean |
hasSymbol(java.lang.String symbol)
Check if there is a tag for a symbol.
|
int |
numberOfSymbols()
Return the number of distinct symbols.
|
int |
occurrences(java.lang.String symbol)
Return the number of occurrences of definitions with the specified
symbol.
|
byte[] |
serialize()
Create a binary representation of this object.
|
public java.util.Set<java.lang.String> getSymbols()
public boolean hasSymbol(java.lang.String symbol)
symbol
- the symbol to checktrue
iff there is a tag for symbol
public boolean hasDefinitionAt(java.lang.String symbol, int lineNumber, java.lang.String[] strs)
symbol
- the symbol to look forlineNumber
- the line to checkstrs
- type of definition(to be passed back to caller)true
iff symbol
is defined on the specified linepublic int occurrences(java.lang.String symbol)
symbol
- the symbol to count the occurrences ofpublic int numberOfSymbols()
public java.util.List<Definitions.Tag> getTags()
public void addTag(int line, java.lang.String symbol, java.lang.String type, java.lang.String text)
public byte[] serialize() throws java.io.IOException
java.io.IOException
- if an error happens when writing to the arraypublic static Definitions deserialize(byte[] bytes) throws java.io.IOException, java.lang.ClassNotFoundException
Definitions
object.bytes
- a byte array containing the Definitions
objectDefinitions
objectjava.io.IOException
- if an I/O error happens when reading the arrayjava.lang.ClassNotFoundException
- if the class definition for an object
stored in the byte array cannot be foundjava.lang.ClassCastException
- if the array contains an object of another
type than Definitions