internal virtual void Set(string name, TotemValue value) { if (parent == null || values.ContainsKey(name)) values[name] = value; else parent.Set(name, value); }
public virtual void SetProp(string name, TotemValue value) { if (!Type.SetTypeProp(this, name, value)) { properties[name] = value; } }
public override TotemValue GreaterThanOrEqual(TotemValue other) { if (other is TotemNumber) { return(new TotemBool(ToDouble(this) >= ToDouble((TotemNumber)other))); } return(base.LessThan(other)); }
public override TotemValue DivideBy(TotemValue other) { if (other is TotemNumber) { return(new TotemNumber(ToDouble(this) / ToDouble((TotemNumber)other))); } return(base.DivideBy(other)); }
public void Add(string name, TotemValue value) { args.Add(new TotemArgument { Name = name, Value = value }); }
public override TotemValue LessThan(TotemValue other) { if (other is TotemNumber) { return(new TotemBool(ToDouble(this) < ToDouble((TotemNumber)other))); } return(base.LessThan(other)); }
internal virtual void Set(string name, TotemValue value) { if (parent == null || values.ContainsKey(name)) { values[name] = value; } else { parent.Set(name, value); } }
public virtual TotemValue this[TotemValue key] { get { return TotemValue.Undefined; } set { throw new InvalidOperationException("Can't set lookup-items on a " + GetType().Name); } }
public virtual TotemValue this[TotemValue key] { get { return(TotemValue.Undefined); } set { throw new InvalidOperationException("Can't set lookup-items on a " + GetType().Name); } }
public override TotemValue this[TotemValue key] { get { TotemValue ret; return(value.TryGetValue(key, out ret) ? ret : TotemValue.Undefined); } set { this.value[key] = value; } }
public override TotemValue this[TotemValue key] { get { TotemValue ret; return value.TryGetValue(key, out ret) ? ret : TotemValue.Undefined; } set { this.value[key] = value; } }
public override TotemValue this[TotemValue key] { get { if (key.GetType() == typeof(TotemNumber)) return value[(int)((TotemNumber)key).IntValue]; throw new InvalidOperationException("Invalid array key."); } set { if (key.GetType() == typeof(TotemNumber)) this.value[(int)((TotemNumber)key).IntValue] = value; throw new InvalidOperationException("Invalid array key."); } }
public override TotemValue Add(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return new TotemNumber(Convert.ToDouble(Value) + Convert.ToDouble(n.Value)); } else { return new TotemNumber(lValue + n.lValue); } } return base.Add(other); }
public override TotemValue MultiplyWith(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return(new TotemNumber(ToDouble(this) * ToDouble(n))); } else { return(new TotemNumber(lValue * n.lValue)); } } return(base.MultiplyWith(other)); }
public override TotemValue Subtract(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return(new TotemNumber(ToDouble(this) - ToDouble(n))); } else { return(new TotemNumber(lValue - n.lValue)); } } return(base.Subtract(other)); }
public override TotemValue Add(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return(new TotemNumber(Convert.ToDouble(Value) + Convert.ToDouble(n.Value))); } else { return(new TotemNumber(lValue + n.lValue)); } } return(base.Add(other)); }
public virtual TotemValue GetTypeProp(TotemValue @this, string propName) { TotemProperty prop; if (!properties.TryGetValue(propName, out prop)) { return(Object.ReferenceEquals(Parent, null) ? TotemValue.Undefined : Parent.GetTypeProp(@this, propName)); } if (prop.Type == TotemPropertyType.Property) { return(prop.Getter(@this)); } else { return(prop.Value); } }
public override TotemValue this[TotemValue key] { get { if (key.GetType() == typeof(TotemNumber)) { return(value[(int)((TotemNumber)key).IntValue]); } throw new InvalidOperationException("Invalid array key."); } set { if (key.GetType() == typeof(TotemNumber)) { this.value[(int)((TotemNumber)key).IntValue] = value; } throw new InvalidOperationException("Invalid array key."); } }
public virtual bool SetTypeProp(TotemValue @this, string propName, TotemValue value) { TotemProperty prop; if (!properties.TryGetValue(propName, out prop)) { return(!Object.ReferenceEquals(Parent, null) && Parent.SetTypeProp(@this, propName, value)); } if (prop.Type == TotemPropertyType.Property) { prop.Setter(@this, value); } else { return(false); } return(true); }
public virtual TotemValue Subtract(TotemValue other) { throw new InvalidOperationException("Can't subtract a " + other.GetType().Name + " to a " + GetType().Name); }
public virtual TotemValue DivideBy(TotemValue other) { throw new InvalidOperationException("Can't divide a " + GetType().Name + " with a " + other.GetType().Name); }
public virtual TotemValue MultiplyWith(TotemValue other) { throw new InvalidOperationException("Can't multiply a " + other.GetType().Name + " with a " + GetType().Name); }
public void AddItem(TotemValue key, TotemValue value) { this.value.Add(key, value); }
public virtual TotemValue GreaterThanOrEqual(TotemValue other) { throw new InvalidOperationException("Can't compare a " + other.GetType().Name + " to a " + GetType().Name); }
public override TotemValue MultiplyWith(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return new TotemNumber(ToDouble(this) * ToDouble(n)); } else { return new TotemNumber(lValue * n.lValue); } } return base.MultiplyWith(other); }
internal override void Set(string name, TotemValue value) { throw new InvalidOperationException("Can't change global value " + name + "."); }
protected void LocalDec(string name, TotemValue value) { Scope.Declare(name); Scope.Set(name, value); }
protected void LocalSet(string name, TotemValue value) { Scope.Set(name, value); }
public void AddItem(TotemValue value) { this.value.Add(value); }
public virtual TotemValue Add(TotemValue other) { throw new InvalidOperationException("Can't add a " + other.GetType().Name + " to a " + GetType().Name); }
public override TotemValue GreaterThan(TotemValue other) { if (other is TotemNumber) { return new TotemBool(ToDouble(this) > ToDouble((TotemNumber)other)); } return base.LessThan(other); }
public override TotemValue LessThanOrEqual(TotemValue other) { if (other is TotemNumber) { return new TotemBool(ToDouble(this) <= ToDouble((TotemNumber)other)); } return base.LessThan(other); }
public override TotemValue Subtract(TotemValue other) { if (other is TotemNumber) { var n = (TotemNumber)other; if (n.isFloatingPoint || isFloatingPoint) { return new TotemNumber(ToDouble(this) - ToDouble(n)); } else { return new TotemNumber(lValue - n.lValue); } } return base.Subtract(other); }
public virtual TotemValue LessThanOrEqual(TotemValue other) { throw new InvalidOperationException("Can't compare a " + other.GetType().Name + " to a " + GetType().Name); }
public override TotemValue DivideBy(TotemValue other) { if (other is TotemNumber) { return new TotemNumber(ToDouble(this) / ToDouble((TotemNumber)other)); } return base.DivideBy(other); }