org.basex.query.value.type
Class MapType

java.lang.Object
  extended by org.basex.query.value.type.FuncType
      extended by org.basex.query.value.type.MapType
All Implemented Interfaces:
Type

public final class MapType
extends FuncType

Type for maps.

Author:
BaseX Team 2005-12, BSD License, Leo Woerteler

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.basex.query.value.type.Type
Type.ID
 
Field Summary
 AtomType keyType
          Key type of the map.
 
Fields inherited from class org.basex.query.value.type.FuncType
ann, ANY_FUN, args, type
 
Method Summary
 Map cast(Item it, QueryContext ctx, InputInfo ii)
          Casts the specified item to the XQuery data type.
 boolean eq(Type t)
          Checks if this type is equal to the given one.
static MapType get(AtomType key, SeqType val)
          Creates a new map type.
 boolean instanceOf(Type t)
          Checks if the current type is an instance of the specified type.
 MapType intersect(Type t)
          Computes the intersection between this type and the given one, i.e.
 byte[] string()
          Returns the string representation of this type.
 java.lang.String toString()
           
 Type union(Type t)
          Computes the union between this type and the given one, i.e.
 
Methods inherited from class org.basex.query.value.type.FuncType
args, arity, cast, castString, find, get, get, get, id, isNode, isNumber, isNumberOrUntyped, isStringOrUntyped, isUntyped, nsSensitive, seqType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

keyType

public final AtomType keyType
Key type of the map.

Method Detail

string

public byte[] string()
Description copied from interface: Type
Returns the string representation of this type.

Specified by:
string in interface Type
Overrides:
string in class FuncType
Returns:
name

cast

public Map cast(Item it,
                QueryContext ctx,
                InputInfo ii)
         throws QueryException
Description copied from interface: Type
Casts the specified item to the XQuery data type.

Specified by:
cast in interface Type
Overrides:
cast in class FuncType
Parameters:
it - item to be converted
ctx - query context
ii - input info
Returns:
new item
Throws:
QueryException - query exception

eq

public boolean eq(Type t)
Description copied from interface: Type
Checks if this type is equal to the given one.

Specified by:
eq in interface Type
Overrides:
eq in class FuncType
Parameters:
t - other type
Returns:
true if both types are equal, false otherwise

instanceOf

public boolean instanceOf(Type t)
Description copied from interface: Type
Checks if the current type is an instance of the specified type.

Specified by:
instanceOf in interface Type
Overrides:
instanceOf in class FuncType
Parameters:
t - type to be checked
Returns:
result of check

union

public Type union(Type t)
Description copied from interface: Type
Computes the union between this type and the given one, i.e. the least common ancestor of both types in the type hierarchy.

Specified by:
union in interface Type
Overrides:
union in class FuncType
Parameters:
t - other type
Returns:
union type

intersect

public MapType intersect(Type t)
Description copied from interface: Type
Computes the intersection between this type and the given one, i.e. the least specific type that is sub-type of both types. If no such type exists, null is returned.

Specified by:
intersect in interface Type
Overrides:
intersect in class FuncType
Parameters:
t - other type
Returns:
intersection type or null

get

public static MapType get(AtomType key,
                          SeqType val)
Creates a new map type.

Parameters:
key - key type
val - value type
Returns:
map type

toString

public java.lang.String toString()
Specified by:
toString in interface Type
Overrides:
toString in class FuncType