org.basex.query.value.item
Class QNm

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.value.Value
              extended by org.basex.query.value.item.Item
                  extended by org.basex.query.value.item.QNm
All Implemented Interfaces:
java.lang.Iterable<Item>

public final class QNm
extends Item

QName item (xs:QName).

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
 
Fields inherited from class org.basex.query.value.item.Item
score, UNDEF
 
Fields inherited from class org.basex.query.value.Value
type
 
Constructor Summary
QNm()
          Empty constructor.
QNm(byte[] n)
          Constructor.
QNm(byte[] n, byte[] u)
          Constructor.
QNm(byte[] n, QueryContext ctx)
          Constructor, binding a statically known namespace.
QNm(javax.xml.namespace.QName qn)
          Constructor for converting a Java QName.
QNm(java.lang.String n)
          Constructor.
QNm(java.lang.String n, byte[] u)
          Constructor.
QNm(java.lang.String n, java.lang.String u)
          Constructor.
 
Method Summary
 int diff(Item it, Collation coll, InputInfo ii)
          Returns the difference between the current and the specified item.
 boolean eq(Item it, Collation coll, InputInfo ii)
          Checks the items for equality.
 boolean eq(QNm n)
          Compares the specified item.
 boolean equals(java.lang.Object obj)
           
static QNm get(byte[] local)
          Returns a cached QName with the specified local name.
static QNm get(byte[] local, byte[] uri)
          Returns a cached QName with the specified local name and uri.
static QNm get(byte[] prefix, byte[] local, byte[] uri)
          Returns a cached QName with the specified prefix, local name and uri.
static QNm get(java.lang.String local)
          Returns a cached QName with the specified local name.
static QNm get(java.lang.String local, byte[] uri)
          Returns a cached QName with the specified local name and uri.
static QNm get(java.lang.String prefix, java.lang.String local, byte[] uri)
          Returns a cached QName with the specified prefix, local name and uri.
static QNm get(java.lang.String prefix, java.lang.String local, java.lang.String uri)
          Returns a cached QName with the specified prefix, local name and uri.
 int hash(InputInfo ii)
          Returns a hash code for this value.
 int hashCode()
           
 boolean hasPrefix()
          Checks if the name contains a prefix.
 boolean hasURI()
          Checks if the URI of this QName has been explicitly set.
 byte[] id()
          Returns a unique representation of the QName: if a URI exists, the EQName notation is used. otherwise, if a prefix exists, the prefix and local name is returned. otherwise, the local name is returned.
static byte[] internal(byte[] prefix, byte[] local, byte[] uri)
          Constructs an internal string representation for the components of a QName.
 byte[] local()
          Returns the local name.
 byte[] prefix()
          Returns the prefix.
 void set(byte[] n, byte[] u)
          Updates the values of this QName.
 byte[] string()
          Returns the string value.
 byte[] string(InputInfo ii)
          Returns a string representation of the value.
 javax.xml.namespace.QName toJava()
          Returns a Java representation of the value.
 java.lang.String toString()
           
 byte[] uri()
          Returns the URI of this QName.
 void uri(byte[] u)
          Sets the URI of this QName.
 byte[] xdmInfo()
          Returns data model info.
 
Methods inherited from class org.basex.query.value.item.Item
bool, castErr, comparable, dbl, dec, description, ebv, equiv, flt, homogeneous, input, isItem, item, itemAt, iter, iterable, itr, materialize, plan, score, score, size, test, type, typeId, writeTo
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, copy, count, data, exprSize, has, inline, isValue, iter, iterator, removable, serialize, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isVacuous, markTailCalls, optimize, sameAs, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QNm

public QNm()
Empty constructor.


QNm

public QNm(byte[] n)
Constructor.

Parameters:
n - name

QNm

public QNm(java.lang.String n)
Constructor.

Parameters:
n - name

QNm

public QNm(byte[] n,
           byte[] u)
Constructor.

Parameters:
n - name
u - namespace URI

QNm

public QNm(java.lang.String n,
           byte[] u)
Constructor.

Parameters:
n - name
u - namespace URI

QNm

public QNm(java.lang.String n,
           java.lang.String u)
Constructor.

Parameters:
n - name
u - namespace URI

QNm

public QNm(byte[] n,
           QueryContext ctx)
Constructor, binding a statically known namespace. If no namespace is found, the namespace uri is set to null.

Parameters:
n - name
ctx - query context

QNm

public QNm(javax.xml.namespace.QName qn)
Constructor for converting a Java QName.

Parameters:
qn - qname
Method Detail

uri

public void uri(byte[] u)
Sets the URI of this QName.

Parameters:
u - the uri to be set

uri

public byte[] uri()
Returns the URI of this QName.

Returns:
uri

hasURI

public boolean hasURI()
Checks if the URI of this QName has been explicitly set.

Returns:
result of check

string

public byte[] string(InputInfo ii)
Description copied from class: Item
Returns a string representation of the value.

Specified by:
string in class Item
Parameters:
ii - input info, use null if none is available
Returns:
string value

string

public byte[] string()
Returns the string value.

Returns:
string value

eq

public boolean eq(Item it,
                  Collation coll,
                  InputInfo ii)
           throws QueryException
Description copied from class: Item
Checks the items for equality.

Specified by:
eq in class Item
Parameters:
it - item to be compared
coll - collation
ii - input info
Returns:
result of check
Throws:
QueryException - query exception

eq

public boolean eq(QNm n)
Compares the specified item.

Parameters:
n - name to be compared
Returns:
result of check

diff

public int diff(Item it,
                Collation coll,
                InputInfo ii)
         throws QueryException
Description copied from class: Item
Returns the difference between the current and the specified item.

Overrides:
diff in class Item
Parameters:
it - item to be compared
coll - query context
ii - input info
Returns:
difference
Throws:
QueryException - query exception

hasPrefix

public boolean hasPrefix()
Checks if the name contains a prefix.

Returns:
result of check

prefix

public byte[] prefix()
Returns the prefix.

Returns:
prefix

local

public byte[] local()
Returns the local name.

Returns:
local name

set

public void set(byte[] n,
                byte[] u)
Updates the values of this QName. This method is only called to speed up internal operations.

Parameters:
n - name
u - URI

id

public byte[] id()
Returns a unique representation of the QName:

Returns:
unique representation

toJava

public javax.xml.namespace.QName toJava()
Description copied from class: Value
Returns a Java representation of the value.

Specified by:
toJava in class Value
Returns:
Java object

hash

public int hash(InputInfo ii)
         throws QueryException
Description copied from class: Value
Returns a hash code for this value.

Overrides:
hash in class Item
Parameters:
ii - input info
Returns:
hash code
Throws:
QueryException - if atomization can't be applied (e.g. function item)

xdmInfo

public byte[] xdmInfo()
Description copied from class: Item
Returns data model info.

Overrides:
xdmInfo in class Item
Returns:
type string

toString

public java.lang.String toString()
Specified by:
toString in class ExprInfo

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

get

public static QNm get(java.lang.String local)
Returns a cached QName with the specified local name.

Parameters:
local - local name
Returns:
instance

get

public static QNm get(byte[] local)
Returns a cached QName with the specified local name.

Parameters:
local - local name
Returns:
instance

get

public static QNm get(java.lang.String local,
                      byte[] uri)
Returns a cached QName with the specified local name and uri.

Parameters:
local - local name
uri - namespace uri
Returns:
instance

get

public static QNm get(byte[] local,
                      byte[] uri)
Returns a cached QName with the specified local name and uri.

Parameters:
local - local name
uri - namespace uri
Returns:
instance

get

public static QNm get(java.lang.String prefix,
                      java.lang.String local,
                      byte[] uri)
Returns a cached QName with the specified prefix, local name and uri.

Parameters:
prefix - prefix
local - local name
uri - namespace uri
Returns:
instance

get

public static QNm get(java.lang.String prefix,
                      java.lang.String local,
                      java.lang.String uri)
Returns a cached QName with the specified prefix, local name and uri.

Parameters:
prefix - prefix
local - local name
uri - namespace uri
Returns:
instance

get

public static QNm get(byte[] prefix,
                      byte[] local,
                      byte[] uri)
Returns a cached QName with the specified prefix, local name and uri.

Parameters:
prefix - prefix
local - local name
uri - namespace uri
Returns:
instance

internal

public static byte[] internal(byte[] prefix,
                              byte[] local,
                              byte[] uri)
Constructs an internal string representation for the components of a QName.

Parameters:
prefix - prefix
local - name
uri - uri
Returns:
EQName representation