|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartisynth.core.util.AliasTable
public class AliasTable
A hash-table that keeps track of names and aliases.
Constructor Summary | |
---|---|
AliasTable()
Creates a new AliasTable with no entries. |
|
AliasTable(java.io.File file)
Creates a new AliasTable and reads it's initial entries from a file. |
|
AliasTable(java.net.URL url)
Creates a new AliasTable and reads it's initial entries from a resource. |
Method Summary | |
---|---|
void |
addEntry(java.lang.String alias,
java.lang.String name)
Adds an alias and it's corresponding name to this AliasTable. |
void |
clear()
Clears all entries from the AliasTable |
boolean |
containsAlias(java.lang.String alias)
Returns true if this table contains the specified alias. |
boolean |
containsName(java.lang.String name)
Returns true if this table contains the specified name. |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entrySet()
Returns a Set view of the entries for this table. |
java.lang.String |
getAlias(java.lang.String name)
Gets the first alias found that references a given name, or null if no such alias is found. |
java.lang.String[] |
getAliases()
Returns a list of all the aliases in this table. |
java.lang.String |
getName(java.lang.String alias)
Gets the name referenced by a given alias, or null if the alias has no entry. |
java.lang.String[] |
getNames()
Returns a list of all the names in this table. |
void |
read(java.io.InputStream s)
Reads the contents of an input stream and adds every successive pair of strings into this table as an alias/name pair. |
void |
removeEntry(java.lang.String alias)
Removes an alias from this AliasTable. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AliasTable()
public AliasTable(java.io.File file) throws java.io.IOException
file
- File from which to read table entries
java.io.IOException
- if there was an error reading the filepublic AliasTable(java.net.URL url) throws java.io.IOException
url
- Resource from which to read table entries
java.io.IOException
- if there was an error reading the resourceMethod Detail |
---|
public void read(java.io.InputStream s) throws java.io.IOException
"
or by whitespace.
Whitespace-delineated strings may contain alphanumeric characters, plus
the characters $./_-
, but must not start with a digit.
Quoted strings may contain any character and support the usual escape
sequences. This function returns a list of all the aliases read.
s
- Stream from which to read table entries
java.io.IOException
- if there was an error reading the streampublic void addEntry(java.lang.String alias, java.lang.String name)
alias
- alias which references the namename
- name which is referenced by the aliaspublic void removeEntry(java.lang.String alias)
alias
- alias which references the namepublic void clear()
public java.lang.String getName(java.lang.String alias)
alias
- alias which references the name
public java.lang.String getAlias(java.lang.String name)
name
- name which is referenced
public java.lang.String[] getAliases()
public java.lang.String[] getNames()
public boolean containsName(java.lang.String name)
name
- to check for
public boolean containsAlias(java.lang.String alias)
alias
- to check for
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |