incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1160693 - /incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/
Date Tue, 23 Aug 2011 13:55:05 GMT
Author: kwright
Date: Tue Aug 23 13:55:05 2011
New Revision: 1160693

URL: http://svn.apache.org/viewvc?rev=1160693&view=rev
Log:
Add ability to set/clear attributes and values; also allow variables to be set to null (and
used that way).

Modified:
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ContextVariableReference.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NullVariableReference.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
    incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ContextVariableReference.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ContextVariableReference.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ContextVariableReference.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ContextVariableReference.java
Tue Aug 23 13:55:05 2011
@@ -40,8 +40,6 @@ public class ContextVariableReference im
   public Variable resolve()
     throws ScriptException
   {
-    if (variable == null)
-      throw new ScriptException("Attempt to dereference null variable pointer");
     return variable;
   }
 

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NullVariableReference.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NullVariableReference.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NullVariableReference.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/NullVariableReference.java
Tue Aug 23 13:55:05 2011
@@ -38,7 +38,7 @@ public class NullVariableReference imple
   public Variable resolve()
     throws ScriptException
   {
-    throw new ScriptException("Attempt to dereference null variable pointer");
+    return null;
   }
 
   /** Check if this reference is null */

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/ScriptParser.java
Tue Aug 23 13:55:05 2011
@@ -193,7 +193,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_1(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '||'");
-        vr = vr.resolve().doublePipe(v.resolve());
+        vr = resolveMustExist(vr).doublePipe(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("|"))
       {
@@ -201,7 +201,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_1(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '|'");
-        vr = vr.resolve().pipe(v.resolve());
+        vr = resolveMustExist(vr).pipe(v.resolve());
       }
       else
         break;
@@ -256,7 +256,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_2(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '&&'");
-        vr = vr.resolve().doubleAmpersand(v.resolve());
+        vr = resolveMustExist(vr).doubleAmpersand(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("&"))
       {
@@ -264,7 +264,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_2(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '&'");
-        vr = vr.resolve().ampersand(v.resolve());
+        vr = resolveMustExist(vr).ampersand(v.resolve());
       }
       else
         break;
@@ -310,7 +310,7 @@ public class ScriptParser
       VariableReference v = evaluateExpression_2(currentStream);
       if (v == null)
         syntaxError(currentStream,"Missing expression after '!'");
-      return v.resolve().unaryExclamation();
+      return resolveMustExist(v).unaryExclamation();
     }
     return evaluateExpression_3(currentStream);
   }
@@ -346,7 +346,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '=='");
-        vr = vr.resolve().doubleEquals(v.resolve());
+        vr = resolveMustExist(vr).doubleEquals(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("!="))
       {
@@ -354,7 +354,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '!='");
-        vr = vr.resolve().exclamationEquals(v.resolve());
+        vr = resolveMustExist(vr).exclamationEquals(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<"))
       {
@@ -362,7 +362,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '<'");
-        vr = vr.resolve().lesserAngle(v.resolve());
+        vr = resolveMustExist(vr).lesserAngle(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">"))
       {
@@ -370,7 +370,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '>'");
-        vr = vr.resolve().greaterAngle(v.resolve());
+        vr = resolveMustExist(vr).greaterAngle(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("<="))
       {
@@ -378,7 +378,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '<='");
-        vr = vr.resolve().lesserAngleEquals(v.resolve());
+        vr = resolveMustExist(vr).lesserAngleEquals(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals(">="))
       {
@@ -386,7 +386,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_4(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '>='");
-        vr = vr.resolve().greaterAngleEquals(v.resolve());
+        vr = resolveMustExist(vr).greaterAngleEquals(v.resolve());
       }
       else
         break;
@@ -461,7 +461,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_5(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '+'");
-        vr = vr.resolve().plus(v.resolve());
+        vr = resolveMustExist(vr).plus(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("-"))
       {
@@ -469,7 +469,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_5(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '-'");
-        vr = vr.resolve().minus(v.resolve());
+        vr = resolveMustExist(vr).minus(v.resolve());
       }
       else
         break;
@@ -520,7 +520,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_6(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '*'");
-        vr = vr.resolve().asterisk(v.resolve());
+        vr = resolveMustExist(vr).asterisk(v.resolve());
       }
       else if (t != null && t.getPunctuation() != null && t.getPunctuation().equals("/"))
       {
@@ -528,7 +528,7 @@ public class ScriptParser
         VariableReference v = evaluateExpression_6(currentStream);
         if (v == null)
           syntaxError(currentStream,"Missing expression after '/'");
-        vr = vr.resolve().slash(v.resolve());
+        vr = resolveMustExist(vr).slash(v.resolve());
       }
       else
         break;
@@ -574,7 +574,7 @@ public class ScriptParser
       VariableReference v = evaluateExpression_6(currentStream);
       if (v == null)
         syntaxError(currentStream,"Missing expression after '-'");
-      return v.resolve().unaryMinus();
+      return resolveMustExist(v).unaryMinus();
     }
     return parseVariableReference(currentStream);
   }
@@ -648,8 +648,8 @@ public class ScriptParser
 	VariableReference expression = evaluateExpression(currentStream);
 	if (expression == null)
 	  syntaxError(currentStream,"Missing expression after '['");
-	int indexValue = expression.resolve().getIntValue();
-	vr = vr.resolve().getIndexed(indexValue);
+	int indexValue = resolveMustExist(expression).getIntValue();
+	vr = resolveMustExist(vr).getIndexed(indexValue);
 	t = currentStream.peek();
 	if (t == null || t.getPunctuation() == null || !t.getPunctuation().equals("]"))
 	  syntaxError(currentStream,"Missing ']'");
@@ -661,7 +661,7 @@ public class ScriptParser
 	t = currentStream.peek();
 	if (t == null || t.getToken() == null)
 	  syntaxError(currentStream,"Need attribute name");
-	vr = vr.resolve().getAttribute(t.getToken());
+	vr = resolveMustExist(vr).getAttribute(t.getToken());
 	currentStream.skip();
       }
       else
@@ -702,6 +702,8 @@ public class ScriptParser
         return new VariableBoolean(true);
       else if (variableName.equals("false"))
         return new VariableBoolean(false);
+      else if (variableName.equals("null"))
+        return new NullVariableReference();
       else
       {
         // Look up variable reference in current context
@@ -812,7 +814,7 @@ public class ScriptParser
     return false;
   }
   
-  protected void syntaxError(TokenStream currentStream, String message)
+  public static void syntaxError(TokenStream currentStream, String message)
     throws ScriptException
   {
     Token t = currentStream.peek();
@@ -822,6 +824,15 @@ public class ScriptParser
       t.throwException("Syntax error: "+message+": "+t);
   }
   
+  public static Variable resolveMustExist(VariableReference vr)
+    throws ScriptException
+  {
+    Variable v = vr.resolve();
+    if (v == null)
+      throw new ScriptException("Expression cannot be null");
+    return v;
+  }
+  
   public static void main(String[] argv)
   {
     if (argv.length > 1)

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableBoolean.java
Tue Aug 23 13:55:05 2011
@@ -49,12 +49,16 @@ public class VariableBoolean extends Var
   public VariableReference doubleAmpersand(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("&& operand cannot be null");
     return new VariableBoolean(value && v.getBooleanValue());
   }
     
   public VariableReference doublePipe(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("|| operand cannot be null");
     return new VariableBoolean(value || v.getBooleanValue());
   }
 

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableConfigurationNode.java
Tue Aug 23 13:55:05 2011
@@ -57,17 +57,10 @@ public class VariableConfigurationNode e
     // And the __value__ attribute
     if (attributeName.equals(ATTRIBUTE_VALUE))
     {
-      String x = configurationNode.getValue();
-      if (x == null)
-        return new NullVariableReference();
-      return new VariableString(x);
-    }
-    // Look for named attribute
-    String attributeValue = configurationNode.getAttributeValue(attributeName);
-    // MHL to allow attribute to be modified
-    if (attributeValue != null)
-      return new VariableString(attributeValue);
-    return super.getAttribute(attributeName);
+      return new ValueReference();
+    }
+    // All others are presumed to be attributes of the configuration node, which can be set
or cleared.
+    return new AttributeReference(attributeName);
   }
   
   /** Get an indexed property of the variable */
@@ -84,6 +77,78 @@ public class VariableConfigurationNode e
     return configurationNode;
   }
   
+  /** Implement VariableReference to allow values to be set or cleared */
+  protected class ValueReference implements VariableReference
+  {
+    public ValueReference()
+    {
+    }
+    
+    public void setReference(Variable v)
+      throws ScriptException
+    {
+      if (v == null)
+        configurationNode.setValue(null);
+      else
+      {
+        String value = v.getStringValue();
+        configurationNode.setValue(value);
+      }
+    }
+    
+    public Variable resolve()
+      throws ScriptException
+    {
+      String value = configurationNode.getValue();
+      if (value == null)
+        throw new ScriptException("ConfigurationNode value is null");
+      else
+        return new VariableString(value);
+    }
+    
+    public boolean isNull()
+    {
+      return configurationNode.getValue() == null;
+    }
+  }
+  
+  /** Implement VariableReference to allow attributes to be set or cleared */
+  protected class AttributeReference implements VariableReference
+  {
+    protected String attributeName;
+    
+    public AttributeReference(String attributeName)
+    {
+      this.attributeName = attributeName;
+    }
+    
+    public void setReference(Variable v)
+      throws ScriptException
+    {
+      if (v == null)
+        configurationNode.setAttribute(attributeName,null);
+      else
+      {
+        String value = v.getStringValue();
+        configurationNode.setAttribute(attributeName,value);
+      }
+    }
+
+    public Variable resolve()
+      throws ScriptException
+    {
+      String attrValue = configurationNode.getAttributeValue(attributeName);
+      if (attrValue == null)
+        throw new ScriptException("ConfigurationNode has no attribute named '"+attributeName+"'");
+      return new VariableString(attrValue);
+    }
+
+    public boolean isNull()
+    {
+      return (configurationNode.getAttributeValue(attributeName) == null);
+    }
+  }
+  
   /** Extend VariableReference class so we capture attempts to set the reference, and actually
overwrite the child when that is done */
   protected class NodeReference implements VariableReference
   {

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableFloat.java
Tue Aug 23 13:55:05 2011
@@ -51,4 +51,90 @@ public class VariableFloat extends Varia
     return value;
   }
 
+  public VariableReference plus(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("+ operand cannot be null");
+    return new VariableFloat(value + v.getDoubleValue());
+  }
+    
+  public VariableReference minus(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("- operand cannot be null");
+    return new VariableFloat(value - v.getDoubleValue());
+  }
+    
+  public VariableReference asterisk(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("* operand cannot be null");
+    return new VariableFloat(value * v.getDoubleValue());
+  }
+    
+  public VariableReference slash(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("/ operand cannot be null");
+    return new VariableFloat(value / v.getDoubleValue());
+  }
+    
+  public VariableReference unaryMinus()
+    throws ScriptException
+  {
+    return new VariableFloat(-value);
+  }
+  
+  public VariableReference greaterAngle(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("> operand cannot be null");
+    return new VariableBoolean(value > v.getDoubleValue());
+  }
+  
+  public VariableReference lesserAngle(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("< operand cannot be null");
+    return new VariableBoolean(value < v.getDoubleValue());
+  }
+    
+  public VariableReference doubleEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("== operand cannot be null");
+    return new VariableBoolean(value == v.getDoubleValue());
+  }
+    
+  public VariableReference greaterAngleEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException(">= operand cannot be null");
+    return new VariableBoolean(value >= v.getDoubleValue());
+  }
+    
+  public VariableReference lesserAngleEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("<= operand cannot be null");
+    return new VariableBoolean(value <= v.getDoubleValue());
+  }
+  
+  public VariableReference exclamationEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("!= operand cannot be null");
+    return new VariableBoolean(value != v.getDoubleValue());
+  }
+
 }

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableInt.java
Tue Aug 23 13:55:05 2011
@@ -54,24 +54,32 @@ public class VariableInt extends Variabl
   public VariableReference plus(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("+ operand cannot be null");
     return new VariableInt(value + v.getIntValue());
   }
     
   public VariableReference minus(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("- operand cannot be null");
     return new VariableInt(value - v.getIntValue());
   }
     
   public VariableReference asterisk(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("* operand cannot be null");
     return new VariableInt(value * v.getIntValue());
   }
     
   public VariableReference slash(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("/ operand cannot be null");
     return new VariableInt(value / v.getIntValue());
   }
     
@@ -84,48 +92,64 @@ public class VariableInt extends Variabl
   public VariableReference greaterAngle(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("> operand cannot be null");
     return new VariableBoolean(value > v.getIntValue());
   }
   
   public VariableReference lesserAngle(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("< operand cannot be null");
     return new VariableBoolean(value < v.getIntValue());
   }
     
   public VariableReference doubleEquals(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("== operand cannot be null");
     return new VariableBoolean(value == v.getIntValue());
   }
     
   public VariableReference greaterAngleEquals(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException(">= operand cannot be null");
     return new VariableBoolean(value >= v.getIntValue());
   }
     
   public VariableReference lesserAngleEquals(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("<= operand cannot be null");
     return new VariableBoolean(value <= v.getIntValue());
   }
   
   public VariableReference exclamationEquals(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("!= operand cannot be null");
     return new VariableBoolean(value != v.getIntValue());
   }
   
   public VariableReference ampersand(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("& operand cannot be null");
     return new VariableInt(value & v.getIntValue());
   }
     
   public VariableReference pipe(Variable v)
     throws ScriptException
   {
+    if (v == null)
+      throw new ScriptException("| operand cannot be null");
     return new VariableInt(value | v.getIntValue());
   }
 

Modified: incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java?rev=1160693&r1=1160692&r2=1160693&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
(original)
+++ incubator/lcf/trunk/framework/script-engine/src/main/java/org/apache/manifoldcf/scriptengine/VariableString.java
Tue Aug 23 13:55:05 2011
@@ -58,4 +58,28 @@ public class VariableString extends Vari
     return new Double(value).doubleValue();
   }
 
+  public VariableReference plus(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("+ operand cannot be null");
+    return new VariableString(value + v.getStringValue());
+  }
+  
+  public VariableReference doubleEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("== operand cannot be null");
+    return new VariableBoolean(value.equals(v.getStringValue()));
+  }
+
+  public VariableReference exclamationEquals(Variable v)
+    throws ScriptException
+  {
+    if (v == null)
+      throw new ScriptException("!= operand cannot be null");
+    return new VariableBoolean(!value.equals(v.getStringValue()));
+  }
+
 }



Mime
View raw message