public class UCDWord
extends java.lang.Object
See http://www.ivoa.net/documents/REC/UCD/UCD-20050812.html for more details.
Modifier and Type | Field and Description |
---|---|
UCDWord[] |
closest
This attribute is set by
UCDParser.parse(String) when a UCD word
can not be recognised. |
java.lang.String |
description
Human description of this UCD word.
|
protected static java.lang.String |
IVOA_NAMESPACE
Default namespace:
ivoa . |
java.lang.String |
namespace
The namespace of this UCD, as extracted from
rawWord . |
protected static java.lang.String |
NAMESPACE_SEP
Character used to separate the namespace prefix from a UCD word.
|
java.lang.String |
rawWord
The UCD word as provided (may have a namespace prefix).
|
boolean |
recognised
A UCD word is recognised if among a list of well-known UCD words
(not necessarily the ones provided by the IVOA).
|
boolean |
recommended
A UCD word is recommended if allowed by the IVOA, according to
IVOA Recommendation 2018-05-27 for the UCD1+ controlled vocabulary v1.3:
http://www.ivoa.net/documents/UCD1+/20180527/index.html
|
static java.lang.String |
REGEXP_UCD_ATOM
Regular Expression for a valid UCD's atom, according to the BNF provided
in the IVOA Recommendation 2005-08-12 for UCD v1.1:
http://www.ivoa.net/documents/REC/UCD/UCD-20050812.html
|
static java.lang.String |
REGEXP_UCD_WORD
Regular Expression for a valid UCD, according to the BNF provided in the
IVOA Recommendation 2005-08-12 for UCD v1.1:
http://www.ivoa.net/documents/REC/UCD/UCD-20050812.html
|
UCD |
suggestedReplacement
If this UCD word is deprecated, this property will be not
null . |
UCDSyntax |
syntaxCode
Rule about the syntax of the usage of this UCD word.
|
boolean |
valid
A UCD is valid if its syntax is correct.
|
java.lang.String |
word
The UCD word (without namespace prefix), as extracted from
rawWord . |
Modifier | Constructor and Description |
---|---|
|
UCDWord(java.lang.String word)
Create a NON
recommended and NON
recognised UCD word. |
protected |
UCDWord(java.lang.String word,
UCD suggestedReplacement,
UCDSyntax syntax,
java.lang.String description)
Create a deprecated UCD word.
|
protected |
UCDWord(java.lang.String word,
UCDWord[] closestMatches)
Create a NON
recommended and NON
recognised UCD word. |
|
UCDWord(UCDSyntax syntax,
java.lang.String word,
java.lang.String description,
boolean recommended)
Create a
recognised (under conditions, see below) UCD
word. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isDeprecated()
Tell whether this UCD word is deprecated.
|
java.lang.String |
toString() |
public final UCDWord[] closest
UCDParser.parse(String)
when a UCD word
can not be recognised. Then the parse function tries to find the closest
UCD words of its list of recognised words. If it finds any, it set this
attribute with them using UCDWord(String, UCDWord[])
.
Important note:
If this UCDWord
is recognised, this attribute is
null
. If set, this array WILL always contain at least one
item. Besides, if it is set the closest words specified here SHOULD
always be recognised ; it is the responsibility of the provider of this
array to ensure the "recognised" status of all given words.
public final java.lang.String description
May be null
.
protected static final java.lang.String IVOA_NAMESPACE
ivoa
.
When no namespace is specified, this is the one implied.
However, it MUST be used only for words recommended by the IVOA.public final java.lang.String namespace
protected static final java.lang.String NAMESPACE_SEP
public final java.lang.String rawWord
Can NOT be null
.
public final boolean recognised
Important:
A recognised UCD word MUST be valid
AND its
syntaxCode
MUST be set.
public final boolean recommended
Important 1:
A recommended UCD MUST be recognised
AND MUST
have either no namespace or have the namespace "ivoa".
Important 2: This test must have been performed case INsensitively.
public static final java.lang.String REGEXP_UCD_ATOM
Textually, this regular expression says that a UCD atom can contain ONLY (lower or upper case) letters, digits, hyphens and underscores, AND must NOT start with an hyphen or an underscore.
public static final java.lang.String REGEXP_UCD_WORD
Textually, this regular expression says that a UCD is a composition of a possible namespace and of at least one atom. All atoms MUST be separated by a period (.). The namespace syntax must be the same as an atom.
public final UCD suggestedReplacement
null
. Then, it will contain the suggested UCD to replace
this deprecated UCD word by.
May be null
.
isDeprecated()
public final UCDSyntax syntaxCode
UCDSyntax
for more details)
May be null
. If so, this UCD word can NOT be
recommended.
public final boolean valid
In other words:
All these rules are expressed by a regular expression:
REGEXP_UCD_WORD
. So, this attribute will be true
if it matches this regular expression.
Note: This test is performed case INsensitively.
public final java.lang.String word
rawWord
.
This attribute is the resulting part of rawWord
when its
namespace prefix has been extracted (namespace
). If
rawWord
is not valid or if no namespace is specified, this
attribute will have exactly the same value as rawWord
.
Can NOT be null
.
public UCDWord(java.lang.String word) throws java.lang.NullPointerException
recommended
and NON
recognised
UCD word.
However, it may be flagged as valid
if its structure is
correct.
word
- A UCD word.java.lang.NullPointerException
- If the given word is null
or an
empty string.protected UCDWord(java.lang.String word, UCD suggestedReplacement, UCDSyntax syntax, java.lang.String description) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
It may be flagged as valid
if its structure is correct
but never as recognised
or recommended
.
word
- The deprecated UCD word, itself.
MANDATORYsuggestedReplacement
- The suggested UCD to replace the deprecated
UCD word by.
MANDATORYsyntax
- Rule about the syntax when using this UCD
word. (see UCDSyntax
for more
details)
OPTIONALdescription
- Human description of this UCD word.
OPTIONALjava.lang.NullPointerException
- If the given word is null
or an empty string.java.lang.IllegalArgumentException
- If the given suggested UCD is not fully
valid
and
recognised
.protected UCDWord(java.lang.String word, UCDWord[] closestMatches) throws java.lang.NullPointerException
recommended
and NON
recognised
UCD word.
However, it may be flagged as valid
if its structure is
correct.
IMPORTANT:
The UCDWord
provided in the given array - closestMatches -
SHOULD contain ONLY recognised words. This fact won't be tested by this
constructor.
word
- A UCD word.closestMatches
- Closest recognised matches found in the list of
recognised words by the UCDParser
.java.lang.NullPointerException
- If the given word is null
or an
empty string.public UCDWord(UCDSyntax syntax, java.lang.String word, java.lang.String description, boolean recommended) throws java.lang.NullPointerException
recognised
(under conditions, see below) UCD
word.
Conditions:
valid
: the syntax of this UCD word MUST be
correct. See valid
for more details.recognised
: it MUST be valid
AND the syntax code MUST be
correct. See UCDSyntax
for more details.recommended
: it MUST be recognised
AND the parameter
recommended
MUST be set to true
AND the namespace MUST be
null
or
"ivoa".syntax
- Rule about the syntax when using this UCD word.
(see UCDSyntax
for more details)word
- The UCD word, itself.description
- Human description of this UCD word.recommended
- true
to consider this UCD word as
recommended
by the IVOA,
false
otherwise.java.lang.NullPointerException
- If the given word is null
.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final boolean isDeprecated()
If deprecated, the property suggestedReplacement
will provide
the UCD suggested by the IVOA to replace this deprecated UCD word by.
true
if deprecated,
false
otherwise.public java.lang.String toString()
toString
in class java.lang.Object