org.hawk.module.script
Class AbstractScript

java.lang.Object
  extended by org.hawk.module.script.AbstractScript
All Implemented Interfaces:
IScript
Direct Known Subclasses:
MultiLineScript, SingleLineScript

public abstract class AbstractScript
extends java.lang.Object
implements IScript

Abstract class for IScript. This provides default implementation for IScript.pushLocalVars() and IScript.popLocalVars()


Field Summary
protected  MultiLineScript outerMultiLineScript
           
 
Constructor Summary
AbstractScript()
           
 
Method Summary
 IScript add(IScript dataType)
           
 IScript and(IScript dataType)
           
 IScript arrayBracket(IScript otherScript)
           
 IScript assign(IScript dataType)
           
 IScript divide(IScript dataType)
           
 IScript equalTo(IScript dataType)
           
 IScript evaluateGlobalVariable(java.lang.String expression)
           
 boolean evaluateLocalBoolean(java.lang.String expression)
           
 IScript evaluateLocalVariable(java.lang.String expression)
           
abstract  Variable execute()
          This executes the contents of a script.
protected abstract  MultiLineScript findNearestOuterMLScript()
           
 int getLineNumber()
           
 MultiLineScript getOuterMultiLineScript()
           
 IScript greaterThan(IScript dataType)
           
 IScript greaterThanEqualTo(IScript dataType)
           
 boolean isLastScript()
           
abstract  boolean isVariable()
           
 IScript lessThan(IScript dataType)
           
 IScript lessThanEqualTo(IScript dataType)
           
 java.lang.String mangle()
           
 IScript modulus(IScript dataType)
           
 IScript multiply(IScript dataType)
           
 IScript or(IScript dataType)
           
 java.util.Map<java.lang.String,IDataType> popLocalVars()
          Default implementation for IScript.popLocalVars()
 void pushLocalVars()
          Default implementation for IScript.pushLocalVars()
 IScript refer(IScript dataType)
           
 void setLastScript(boolean lastScript)
           
 void setLineNumber(int lineNumber)
           
 void setOuterMultiLineScript(MultiLineScript outerMultiLineScript)
           
 IScript subtract(IScript dataType)
           
 java.lang.Object toJava()
          This converts the hawk object into java object
 java.util.Map<java.lang.Object,java.lang.Object> toJavaMap()
          This converts the hawk object into java map..
abstract  java.lang.String toUI()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hawk.module.script.IScript
copy, getVariable, getVariableValue, setVariable, setVariableValue
 

Field Detail

outerMultiLineScript

protected MultiLineScript outerMultiLineScript
Constructor Detail

AbstractScript

public AbstractScript()
Method Detail

isLastScript

public boolean isLastScript()

setLastScript

public void setLastScript(boolean lastScript)

getOuterMultiLineScript

public MultiLineScript getOuterMultiLineScript()

setOuterMultiLineScript

public void setOuterMultiLineScript(MultiLineScript outerMultiLineScript)

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface IScript

setLineNumber

public void setLineNumber(int lineNumber)

execute

public abstract Variable execute()
                          throws HawkException
Description copied from interface: IScript
This executes the contents of a script. This returns either a boolean or double depending upon how a method is invoked.

Specified by:
execute in interface IScript
Returns:
the returned data is being used to test whether a function returns or not. Currently Hawk support two types return Double and Boolean.The implementation should look at the return type and script type to determine what action to be taken.
Throws:
HawkException

pushLocalVars

public void pushLocalVars()
Default implementation for IScript.pushLocalVars()

Specified by:
pushLocalVars in interface IScript

popLocalVars

public java.util.Map<java.lang.String,IDataType> popLocalVars()
Default implementation for IScript.popLocalVars()

Specified by:
popLocalVars in interface IScript
Returns:
a map containing local var and its value.

isVariable

public abstract boolean isVariable()
Specified by:
isVariable in interface IScript
Returns:

mangle

public java.lang.String mangle()
Specified by:
mangle in interface IScript

findNearestOuterMLScript

protected abstract MultiLineScript findNearestOuterMLScript()

evaluateLocalBoolean

public boolean evaluateLocalBoolean(java.lang.String expression)
                             throws HawkException
Throws:
HawkException

evaluateGlobalVariable

public IScript evaluateGlobalVariable(java.lang.String expression)
                               throws HawkException
Throws:
HawkException

evaluateLocalVariable

public IScript evaluateLocalVariable(java.lang.String expression)
                              throws HawkException
Throws:
HawkException

add

public IScript add(IScript dataType)
            throws HawkException
Specified by:
add in interface IScript
Throws:
HawkException

and

public IScript and(IScript dataType)
            throws HawkException
Specified by:
and in interface IScript
Throws:
HawkException

divide

public IScript divide(IScript dataType)
               throws HawkException
Specified by:
divide in interface IScript
Throws:
HawkException

greaterThan

public IScript greaterThan(IScript dataType)
                    throws HawkException
Specified by:
greaterThan in interface IScript
Throws:
HawkException

greaterThanEqualTo

public IScript greaterThanEqualTo(IScript dataType)
                           throws HawkException
Specified by:
greaterThanEqualTo in interface IScript
Throws:
HawkException

lessThan

public IScript lessThan(IScript dataType)
                 throws HawkException
Specified by:
lessThan in interface IScript
Throws:
HawkException

lessThanEqualTo

public IScript lessThanEqualTo(IScript dataType)
                        throws HawkException
Specified by:
lessThanEqualTo in interface IScript
Throws:
HawkException

modulus

public IScript modulus(IScript dataType)
                throws HawkException
Specified by:
modulus in interface IScript
Throws:
HawkException

multiply

public IScript multiply(IScript dataType)
                 throws HawkException
Specified by:
multiply in interface IScript
Throws:
HawkException

or

public IScript or(IScript dataType)
           throws HawkException
Specified by:
or in interface IScript
Throws:
HawkException

equalTo

public IScript equalTo(IScript dataType)
                throws HawkException
Specified by:
equalTo in interface IScript
Throws:
HawkException

subtract

public IScript subtract(IScript dataType)
                 throws HawkException
Specified by:
subtract in interface IScript
Throws:
HawkException

refer

public IScript refer(IScript dataType)
              throws HawkException
Specified by:
refer in interface IScript
Throws:
HawkException

assign

public IScript assign(IScript dataType)
               throws HawkException
Specified by:
assign in interface IScript
Throws:
HawkException

arrayBracket

public IScript arrayBracket(IScript otherScript)
                     throws HawkException
Specified by:
arrayBracket in interface IScript
Throws:
HawkException

toUI

public abstract java.lang.String toUI()
Specified by:
toUI in interface IScript

toJavaMap

public java.util.Map<java.lang.Object,java.lang.Object> toJavaMap()
                                                           throws HawkException
Description copied from interface: IScript
This converts the hawk object into java map..

Specified by:
toJavaMap in interface IScript
Returns:
Throws:
HawkException

toJava

public java.lang.Object toJava()
                        throws HawkException
Description copied from interface: IScript
This converts the hawk object into java object

Specified by:
toJava in interface IScript
Returns:
Throws:
HawkException