cz.cuni.amis.pogamut.sposh.elements
Class Result

Package class diagram package Result
java.lang.Object
  extended by cz.cuni.amis.pogamut.sposh.elements.Result

public class Result
extends Object

Class representing value and its properties in posh plan. Value in plan can be e.g boolean or string and they have some properties. Methods of this class take an object and perform some test on it (e.g. if you pass Double with value 0.0 to isFalse(java.lang.Object), it will return true). Most important part of this class are methods compare(java.lang.Object, java.lang.Object) and equal(java.lang.Object, java.lang.Object).

Author:
Honza

Field Summary
static String variableNameRegexp
          Regexp for parameter name be same as PoshParser
 
Constructor Summary
Result()
           
 
Method Summary
static int compare(Object operand1, Object operand2)
          What is the comparison of operand1 and operand2?
static boolean equal(Object operand1, Object operand2)
          Are two operands equal? Comparison is based on rules outlines in http://docs.python.org/reference/expressions.html#notin
static boolean getBoolean(Object value)
          Get boolean value from Boolean class.
static Number getNumber(Object value)
           
static double getNumerical(Object value)
          Get numerical representation for object derived from class Number and from Boolean (true = 1, false = 0)
static boolean isBoolean(Object value)
          Is value instance of Boolean class?
static boolean isFalse(Object value)
          Is the value false? null is false Boolean false is false Number 0 is false Arrays of size 0 is false, otherwise value is true
static boolean isNumber(Object value)
           
static boolean isNumerical(Object value)
          Is value numerical(either number or boolean)?
static boolean isTrue(Object value)
          Is value true? Basically negate isFalse(java.lang.Object).
static boolean isVariableName(String possibleVariableName)
          Check if passed string is variable name.
static Object parseValue(String valueString)
          Parse string from posh plan and convert it to object.
static String toLap(Object value)
          Get string representation of the value that can be used in the lap plan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

variableNameRegexp

public static final String variableNameRegexp
Regexp for parameter name be same as PoshParser

See Also:
Constant Field Values
Constructor Detail

Result

public Result()
Method Detail

isFalse

public static boolean isFalse(Object value)
Is the value false? null is false Boolean false is false Number 0 is false Arrays of size 0 is false, otherwise value is true

Returns:
true if value is null, value convertable to number and 0
See Also:
http://docs.python.org/library/stdtypes.html#truth-value-testing

isTrue

public static boolean isTrue(Object value)
Is value true? Basically negate isFalse(java.lang.Object).

Parameters:
value - value for which we want the information.

isNumber

public static boolean isNumber(Object value)

getNumber

public static Number getNumber(Object value)

isBoolean

public static boolean isBoolean(Object value)
Is value instance of Boolean class?

Parameters:
value - value to be tested
Returns:
true if it is instance of Boolean

getBoolean

public static boolean getBoolean(Object value)
Get boolean value from Boolean class.

Parameters:
value - (value must be instance of {@link Boolean) class.
Returns:
value of boolean.

parseValue

public static Object parseValue(String valueString)
                         throws ParseException
Parse string from posh plan and convert it to object. Rules of parsing: "nil" - null "true"/"false" - boolean int number - integer double number - double otherwise string

Parameters:
valueString - string that will be parsed to object NOT NULL.
Returns:
created object
Throws:
ParseException

getNumerical

public static double getNumerical(Object value)
Get numerical representation for object derived from class Number and from Boolean (true = 1, false = 0)

Parameters:
value -
Returns:
numerical value of value.

isNumerical

public static boolean isNumerical(Object value)
Is value numerical(either number or boolean)?

Parameters:
value - value to check if it is numerical

equal

public static boolean equal(Object operand1,
                            Object operand2)
Are two operands equal? Comparison is based on rules outlines in http://docs.python.org/reference/expressions.html#notin

Parameters:
operand1 -
operand2 -
Returns:

compare

public static int compare(Object operand1,
                          Object operand2)
What is the comparison of operand1 and operand2?

Parameters:
operand1 -
operand2 -
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

toLap

public static String toLap(Object value)
Get string representation of the value that can be used in the lap plan. Basically opposite of parseValue(java.lang.String).

Parameters:
value - value to convret
Returns:
string representation that can be used in the plan

isVariableName

public static boolean isVariableName(String possibleVariableName)
Check if passed string is variable name. Variable names start with $ and are followed by characters. Should be same as parser VARIABLE terminal.

Parameters:
possibleVariableName - Tested string.
Returns:
true if passed string is varaible name. False otherwise.


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.