org.deri.iris.builtins.string
Class StringStartsWithBuiltin

java.lang.Object
  extended by org.deri.iris.builtins.AbstractBuiltin
      extended by org.deri.iris.builtins.BooleanBuiltin
          extended by org.deri.iris.builtins.string.StringStartsWithBuiltin
All Implemented Interfaces:
Comparable<IAtom>, IAtom, IBuiltinAtom

public class StringStartsWithBuiltin
extends BooleanBuiltin

Represents the RIF built-in func:starts-with as described in http://www.w3.org/TR/xpath-functions/#func-starts-with. At the moment only Unicode code point collation (http://www.w3.org/2005/xpath-functions/collation/codepoint) is supported.


Field Summary
 
Fields inherited from class org.deri.iris.builtins.AbstractBuiltin
EMPTY_TERM
 
Constructor Summary
StringStartsWithBuiltin(ITerm... terms)
          Constructor.
 
Method Summary
protected  boolean computeResult(ITerm[] terms)
          Compute the result of the comparison.
static boolean startsWith(String haystack, String needle, String collation)
           
 
Methods inherited from class org.deri.iris.builtins.BooleanBuiltin
evaluateTerms
 
Methods inherited from class org.deri.iris.builtins.AbstractBuiltin
compareTo, equals, evaluate, getPredicate, getTuple, hashCode, isBuiltin, isGround, maxUnknownVariables, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringStartsWithBuiltin

public StringStartsWithBuiltin(ITerm... terms)
Constructor.

Parameters:
terms - The terms, where the term at the first position is the haystack, the term at the second position is the needle and the term at the third position is the collation to be used. The haystack is the string being searched for the occurrence of the needle. The needle is the string to be searched for in the haystack.
Throws:
IllegalArgumentException - if one of the terms is null
Method Detail

computeResult

protected boolean computeResult(ITerm[] terms)
Description copied from class: BooleanBuiltin
Compute the result of the comparison.

Specified by:
computeResult in class BooleanBuiltin
Parameters:
terms - The terms
Returns:
The result of the comparison.

startsWith

public static boolean startsWith(String haystack,
                                 String needle,
                                 String collation)