1 6 7 package rero.script; 8 9 import sleep.interfaces.*; 10 import sleep.runtime.*; 11 12 import rero.ircfw.*; 13 14 import java.util.*; 15 16 public class GlobalVariables implements Variable 17 { 18 protected HashMap data = new HashMap(); 19 protected Variable alternateVariables = null; 20 21 22 public void setOtherVariables(Variable _alternateVariables) 23 { 24 alternateVariables = _alternateVariables; 25 } 26 27 public boolean scalarExists(String key) 28 { 29 if (alternateVariables != null && alternateVariables.scalarExists(key)) 30 { 31 return true; 32 } 33 34 return data.containsKey(key); 35 } 36 37 public Scalar getScalar(String key) 38 { 39 if (alternateVariables != null && alternateVariables.scalarExists(key)) 40 { 41 return alternateVariables.getScalar(key); 42 } 43 44 return (Scalar)data.get(key); 45 } 46 47 public Scalar putScalar(String key, Scalar value) 48 { 49 return (Scalar)data.put(key, value); 50 } 51 52 public void removeScalar(String key) 53 { 54 data.remove(key); 55 } 56 57 public Variable createLocalVariableContainer() { return new LocalVariables(); } 61 62 public Variable createInternalVariableContainer() 63 { 64 return new GlobalVariables(); 65 } 66 } 67 | Popular Tags |