public bool InsertAfter(Variable variable, Variable after) { int index=_children.IndexOf(after); if (index!=-1) { return Insert(index, variable); } return false; }
public bool Remove(Variable variable) { if (_children.Remove(variable)) { variable.Parent=null; return true; } return false; }
public bool Add(Variable variable) { if (variable!=null) { _children.Add(variable); variable.Parent=this; return true; } return false; }
public bool Insert(int index, Variable variable) { try { _children.Insert(index, variable); variable.Parent=this; return true; } catch (ArgumentOutOfRangeException) { } return false; }
public static int VariableToBool(Variable source) { if (source!=null) { if (source.Type==VariableType.BOOL) { return ((BoolVariable)source).Value ? 1 : 0; } else if (source.Type==VariableType.STRING) { string str=((StringVariable)source).Value; if (String.Compare(str, "true", true)==0 || str.CompareTo("1")==0) { return 1; } else if (String.Compare(str, "false", true)==0 || str.CompareTo("0")==0) { return 0; } } else if (source.Type==VariableType.INTEGER) { int val=((IntVariable)source).Value; if (val==1) return 1; else if (val==0) return 0; } } return -1; }
public _IndexVariablePair(int index, Variable v) { i=index; variable=v; }
bool __matchvariable(int mc, VariableType[] layout, VariableType infinitism, Variable variable) { if (layout!=null && (mc<layout.Length)) return (layout[mc]&variable.Type)!=0; else if (infinitism!=VariableType.NONE) return (infinitism&variable.Type)!=0; return false; }
bool _checkVariable(VariableType type, Variable variable) { if (variable!=null && type!=VariableType.NONE) return (type&variable.Type)!=0; return false; }
void AddVariableAndReset(CollectionVariable collection, Variable variable, bool iden, bool val) { collection.Add(variable); Reset(iden, val); }