Beispiel #1
0
        /// <summary>
        /// Compares the value of this variant with another
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Compare(StratusVariant other)
        {
            if (this.type != other.type)
            {
                throw new Exception("Mismatching variants are being compared!");
            }

            switch (other.type)
            {
            case VariantType.Boolean:
                return(this.booleanValue == other.booleanValue);

            case VariantType.Integer:
                return(this.integerValue == other.integerValue);

            case VariantType.Float:
                return(this.floatValue == other.floatValue);

            case VariantType.String:
                return(this.stringValue == other.stringValue);

            case VariantType.Vector3:
                return(this.vector3Value == other.vector3Value);
            }

            throw new Exception("Wrong type?");
        }
 //--------------------------------------------------------------------/
 // Methods
 //--------------------------------------------------------------------/
 /// <summary>
 /// Constructs a symbol with the given key and value
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public static StratusSymbol Construct <T>(string key, T value)
 {
     return(new StratusSymbol(key, StratusVariant.Make(value)));
 }
 public StratusSymbol(string key, StratusVariant value) : base(key, value)
 {
 }
Beispiel #4
0
 public StratusKeyVariantPair(StratusKeyVariantPair <KeyType> other)
 {
     key = other.key; value = new StratusVariant(other.value);
 }
Beispiel #5
0
 public StratusKeyVariantPair(KeyType key, StratusVariant value)
 {
     this.key = key; this.value = new StratusVariant(value);
 }
Beispiel #6
0
 public StratusVariant(StratusVariant variant) : this()
 {
     type = variant.type;
     this.Set(variant.Get());
 }