org.deri.iris.builtins.datatype
Class ToDoubleBuiltin

java.lang.Object
  extended by org.deri.iris.builtins.AbstractBuiltin
      extended by org.deri.iris.builtins.FunctionalBuiltin
          extended by org.deri.iris.builtins.datatype.ConversionBuiltin
              extended by org.deri.iris.builtins.datatype.ToDoubleBuiltin
All Implemented Interfaces:
Comparable<IAtom>, IAtom, IBuiltinAtom

public class ToDoubleBuiltin
extends ConversionBuiltin

Represents a data type conversion function, which converts supported data type instances to Double instances. The following data types are supported:


Field Summary
 
Fields inherited from class org.deri.iris.builtins.AbstractBuiltin
EMPTY_TERM
 
Constructor Summary
ToDoubleBuiltin(ITerm... terms)
          Creates a new instance of this builtin.
 
Method Summary
protected  ITerm convert(ITerm term)
          Converts the given supported data type instance to the specific data type
static IDoubleTerm toDouble(IBooleanTerm term)
          Converts a Boolean term to a Double term.
static IDoubleTerm toDouble(IFloatTerm term)
          Converts a Float term to a Double term.
static IDoubleTerm toDouble(INumericTerm term)
          Converts a Numeric term to a Double term.
static IDoubleTerm toDouble(IStringTerm term)
          Converts a String term to a Double term.
 
Methods inherited from class org.deri.iris.builtins.datatype.ConversionBuiltin
computeResult
 
Methods inherited from class org.deri.iris.builtins.FunctionalBuiltin
evaluateTerms, maxUnknownVariables, testForEquality
 
Methods inherited from class org.deri.iris.builtins.AbstractBuiltin
compareTo, equals, evaluate, getPredicate, getTuple, hashCode, isBuiltin, isGround, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToDoubleBuiltin

public ToDoubleBuiltin(ITerm... terms)
Creates a new instance of this builtin.

Parameters:
terms - The term representing the data type instance to be converted.
Method Detail

convert

protected ITerm convert(ITerm term)
Description copied from class: ConversionBuiltin
Converts the given supported data type instance to the specific data type

Specified by:
convert in class ConversionBuiltin
Returns:
The result of the conversion or null if the specified data type is not compatible.

toDouble

public static IDoubleTerm toDouble(IBooleanTerm term)
Converts a Boolean term to a Double term. A Boolean term representing the value "True" is converted to a Double term representing "1.0". A Boolean term representing the value "False" is converted to a Double term representing "0.0".

Parameters:
term - The Boolean term to be converted.
Returns:
A new Double term representing the result of the conversion.

toDouble

public static IDoubleTerm toDouble(IFloatTerm term)
Converts a Float term to a Double term.

Parameters:
term - The Float term to be converted.
Returns:
A new Double term representing the result of the conversion.

toDouble

public static IDoubleTerm toDouble(INumericTerm term)
Converts a Numeric term to a Double term.

Parameters:
term - The Numeric term to be converted.
Returns:
A new Double term representing the result of the conversion.

toDouble

public static IDoubleTerm toDouble(IStringTerm term)
Converts a String term to a Double term.

Parameters:
term - The String term to be converted.
Returns:
A new Double term representing the result of the conversion.