1 package rero.client.data; 2 3 import sleep.interfaces.*; 4 import sleep.engine.*; 5 import sleep.runtime.*; 6 7 import rero.client.*; 8 import rero.util.*; 9 10 import java.util.*; 11 12 import rero.ircfw.*; 13 import rero.ircfw.data.*; 14 import rero.net.*; 15 import rero.script.*; 16 17 import rero.client.notify.*; 18 19 public class DataStructureBridge extends Feature implements Variable 20 { 21 protected InternalDataList data = null; 22 23 public boolean scalarExists(String key) 24 { 25 if ("$time".equals(key)) { return true; } 26 27 if (data == null) { return false; } 28 if ("$me".equals(key)) { return true; } 29 if ("$lag".equals(key)) { return true; } 30 if ("$active".equals(key)) { return true; } 31 if ("$mymode".equals(key)) { return true; } 34 35 return false; 36 } 37 38 public Scalar putScalar(String key, Scalar data) { return null; } 39 public void removeScalar(String key) { } 40 public Variable createLocalVariableContainer() { return null; } 41 public Variable createInternalVariableContainer() { return null; } 42 43 public Scalar getScalar(String key) 44 { 45 if ("$me".equals(key)) { return SleepUtils.getScalar(data.getMyNick()); } 46 if ("$time".equals(key)) { return SleepUtils.getScalar(ClientUtils.TimeStamp()); } 47 if ("$lag".equals(key) && getCapabilities().getDataStructure("lag") != null) { return SleepUtils.getScalar(((Lag)getCapabilities().getDataStructure("lag")).getLag()); } 48 if ("$active".equals(key)) { return SleepUtils.getScalar(getCapabilities().getUserInterface().getQuery()); } 49 if ("$mymode".equals(key)) { return SleepUtils.getScalar(data.getMyUserInformation().getMode().toString()); } 52 return SleepUtils.getEmptyScalar(); 53 } 54 55 public void init() 56 { 57 data = (InternalDataList)getCapabilities().getDataStructure("clientInformation"); 58 59 GlobalVariables temp = (GlobalVariables)getCapabilities().getDataStructure("globalVariables"); 60 temp.setOtherVariables(this); 61 } 62 } 63 | Popular Tags |