com.icl.saxon.expr
Class StringValue

java.lang.Object
  |
  +--com.icl.saxon.expr.Expression
        |
        +--com.icl.saxon.expr.Value
              |
              +--com.icl.saxon.expr.StringValue

public final class StringValue
extends Value

A string value


Fields inherited from class com.icl.saxon.expr.Value
ANY, BOOLEAN, NODESET, NUMBER, OBJECT, STRING
 
Fields inherited from class com.icl.saxon.expr.Expression
staticContext
 
Constructor Summary
StringValue(java.lang.String value)
          Constructor
 
Method Summary
 boolean asBoolean()
          Convert the string value to a boolean
 double asNumber()
          Convert the string value to a number
 java.lang.String asString()
          Get the string value as a String
 boolean equals(StringValue other)
          Determine if two StringValues are equal
static int[] expand(java.lang.String s)
          Expand a string containing surrogate pairs into an array of 32-bit characters
 int getDataType()
          Return the type of the expression (if known)
 int getLength()
          Get the length of this string, as defined in XPath.
static int getLength(java.lang.String s)
          Get the length of a string, as defined in XPath.
 java.lang.String toString()
          Get a diagnostic string representation of the value (a string literal in quotes)
 
Methods inherited from class com.icl.saxon.expr.Value
compare, equals, evaluate, getDependencies, inverse, notEquals, numericCompare, reduce, simplify, stringToNumber
 
Methods inherited from class com.icl.saxon.expr.Expression
containsReferences, enumerate, evaluateAsBoolean, evaluateAsNodeSet, evaluateAsNumber, evaluateAsString, getStaticContext, make, outputStringValue, setStaticContext, usesCurrent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringValue

public StringValue(java.lang.String value)
Constructor
Parameters:
value - the String value. Null is taken as equivalent to "".
Method Detail

asString

public java.lang.String asString()
Get the string value as a String
Overrides:
asString in class Value
Following copied from class: com.icl.saxon.expr.Value
Returns:
the value converted to a String

asNumber

public double asNumber()
Convert the string value to a number
Overrides:
asNumber in class Value
Following copied from class: com.icl.saxon.expr.Value
Returns:
the value converted to a String

asBoolean

public boolean asBoolean()
Convert the string value to a boolean
Overrides:
asBoolean in class Value
Returns:
false if the string value is zero-length, true otherwise

getDataType

public int getDataType()
Return the type of the expression (if known)
Overrides:
getDataType in class Expression
Returns:
Value.STRING (always)

getLength

public int getLength()
Get the length of this string, as defined in XPath. This is not the same as the Java length, as a Unicode surrogate pair counts as a single character

getLength

public static int getLength(java.lang.String s)
Get the length of a string, as defined in XPath. This is not the same as the Java length, as a Unicode surrogate pair counts as a single character.
Parameters:
s - The string whose length is required

expand

public static int[] expand(java.lang.String s)
Expand a string containing surrogate pairs into an array of 32-bit characters

equals

public boolean equals(StringValue other)
Determine if two StringValues are equal

toString

public java.lang.String toString()
Get a diagnostic string representation of the value (a string literal in quotes)
Overrides:
toString in class java.lang.Object