public final class QID extends Object implements Iterable<String>, Serializable, Comparable<QID>
Modifier and Type | Field and Description |
---|---|
static String |
SEPARATOR
The separator string.
|
Modifier and Type | Method and Description |
---|---|
QID |
appendFirst(String segment)
Appends a segment to the start of this qualified identifier.
|
QID |
appendLast(String segment)
Appends a segment to the end of this qualified identifier.
|
int |
compareTo(QID other) |
static QID |
create(Collection<String> segments)
Creates a qualified identifier from the given segments.
|
static QID |
create(String... segments)
Creates a qualified identifier from the given segments.
|
static QID |
create(String id)
Creates a qualified identifier with the given identifier, the module name
is not set.
|
static QID |
create(String module,
String id)
Creates a qualified identifier with the given module name and the
identifier.
|
boolean |
equals(Object obj) |
String |
get(int index)
Returns the i-th segment of this qualified identifier.
|
String |
getFullName()
Returns the full name of this qualified identifier (encoded segments
separated with
SEPARATOR . |
static String |
getFullName(String... segments)
Returns a full name of a qualified identifier from the given segments.
|
String |
getId()
Returns the id (the last segment).
|
String |
getModule()
Returns the module name (the first segment if there are at least two
segments).
|
List<String> |
getSegments()
Returns an unmodifiable list of the segments of this qualified
identifier.
|
int |
hashCode() |
boolean |
isSimple()
Returns true if the identifier contains only one segment.
|
Iterator<String> |
iterator() |
static QID |
parse(String source)
Parses a qualified identifier from a string.
|
static QID |
parse(org.antlr.runtime.tree.Tree tree)
Parses a qualified identifier from the given ANTLR tree.
|
QID |
removeFirst()
Removes the first segment of this qualified identifier.
|
QID |
removeLast()
Removes the last segment of this qualified identifier.
|
QID |
replaceFirst(String segment)
Replaces the first segment of this qualified identifier.
|
QID |
replaceLast(String segment)
Replaces the last segment of this qualified identifier.
|
int |
size()
Returns the size of this qualified identifier.
|
String |
toString()
Returns the full name of this qualified identifier.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String SEPARATOR
public static QID create(String id)
id
- IllegalArgumentException
- if the id
is nullpublic static QID create(String module, String id)
module
- id
- IllegalArgumentException
- if the module
or the id
is nullpublic static QID create(String... segments)
segments
- IllegalArgumentException
- if any of the segments
is null or if the
segments
contain 0 elementspublic static QID create(Collection<String> segments)
segments
- IllegalArgumentException
- if any of the segments
is null or if the
segments
contain 0 elementspublic static String getFullName(String... segments)
segments
- public static QID parse(String source) throws ValidationException
source
- ValidationException
- if the string
is not a valid qualified identifierNullPointerException
- if the string
is nullpublic static QID parse(org.antlr.runtime.tree.Tree tree)
tree
- NullPointerException
- if the tree
is nullpublic String getModule()
public String getId()
public String getFullName()
SEPARATOR
.public boolean isSimple()
public int size()
public String get(int index)
index
- ArrayIndexOutOfBoundsException
- if the index
is out of boundspublic List<String> getSegments()
public QID appendFirst(String segment)
segment
- NullPointerException
- ifpublic QID appendLast(String segment)
segment
- public QID replaceFirst(String segment)
segment
- public QID replaceLast(String segment)
segment
- public QID removeFirst()
public QID removeLast()
public String toString()
public int compareTo(QID other)
compareTo
in interface Comparable<QID>
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.