net.sourceforge.jeval.function.string
Class Equals

java.lang.Object
  extended by net.sourceforge.jeval.function.string.Equals
All Implemented Interfaces:
Function

public class Equals
extends java.lang.Object
implements Function

This class is a function that executes within Evaluator. The function tests one string equals another. See the String.equals(String) method in the JDK for a complete description of how this function works.


Constructor Summary
Equals()
           
 
Method Summary
 java.lang.String execute(Evaluator evaluator, java.lang.String arguments)
          Executes the function for the specified argument.
 java.lang.String getName()
          Returns the name of the function - "equals".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Equals

public Equals()
Method Detail

getName

public java.lang.String getName()
Returns the name of the function - "equals".

Specified by:
getName in interface Function
Returns:
The name of this function class.

execute

public java.lang.String execute(Evaluator evaluator,
                                java.lang.String arguments)
                         throws FunctionException
Executes the function for the specified argument. This method is called internally by Evaluator.

Specified by:
execute in interface Function
Parameters:
evaluator - An instance of Evaluator.
arguments - A string argument that will be converted into two string arguments. The first argument is a string that will be compared to the second argument / string. The string argument(s) HAS to be enclosed in quotes. White space that is not enclosed within quotes will be trimmed. Quote characters in the first and last positions of any string argument (after being trimmed) will be removed also. The quote characters used must be the same as the quote characters used by the current instance of Evaluator. If there are multiple arguments, they must be separated by a comma (",").
Returns:
Returns "1.0" (true) if the string ends with the suffix, otherwise it returns "0.0" (false). The return value respresents a Boolean value that is compatible with the Boolean operators used by Evaluator.
Throws:
FunctionException - Thrown if the argument(s) are not valid for this function.


Copyright (C) 2002-2007 Robert Breidecker.