public void PopulateFilterIndex(Type type, IDictionary <string, IList <QueryFilterCondition> > index)
        {
            if (Operator != and)
            {
                return;
            }

            if (Argument1 != null)
            {
                Argument1.PopulateFilterIndex(type, index);
            }
            else if (Child1 != null)
            {
                Child1.PopulateFilterIndex(type, index);
            }

            if (Argument2 != null)
            {
                Argument2.PopulateFilterIndex(type, index);
            }
            else if (Child2 != null)
            {
                Child2.PopulateFilterIndex(type, index);
            }
        }
示例#2
0
            public int CompareTo(object obj)
            {
                if (obj == null)
                {
                    return(1);
                }
                var second = obj as AvailableExpression;

                if (second != null)
                {
                    var arg1Res = Argument1.CompareTo(second.Argument1);
                    if (arg1Res == 0)
                    {
                        var arg2Res = Argument2.CompareTo(second.Argument2);
                        if (arg2Res == 0)
                        {
                            return(Operation.CompareTo(second.Operation));
                        }
                        else
                        {
                            return(arg2Res);
                        }
                    }
                    else
                    {
                        return(arg1Res);
                    }
                }
                else
                {
                    return(1);
                }
            }
 public static SCode Make(Primitive2 rator, Argument1 rand0, SCode rand1)
 {
     return
         ((rand1 is LexicalVariable) ? Unimplemented() //PrimitiveGeneralCarCdrA0L.Make (rator, rand0, (LexicalVariable) rand1)
         : (rand1 is Quotation) ? PrimitiveGeneralCarCdrA1Q.Make(rator, rand0, (Quotation)rand1)
         : new PrimitiveGeneralCarCdrA1(rator, rand0, rand1));
 }
 /// <summary>
 /// Accept method for the input data visitor.
 /// </summary>
 /// <param name="visitor">Visitor.</param>
 public override void Accept(IVisitor visitor)
 {
     visitor.Visit(this);
     Argument1.Accept(visitor);
     Argument2.Accept(visitor);
     visitor.PostVisit(this);
 }
示例#5
0
        protected override INotifyExpression <TResult> ApplyParametersCore(IDictionary <string, object> parameters, IDictionary <INotifiable, INotifiable> trace)
        {
            var newArgument1 = Argument1.ApplyParameters(parameters, trace);

            if (newArgument1 == Argument1)
            {
                return(this);
            }
            return(new ObservableStaticLensMethodCall <T1, TResult>(Function, LensPut.ApplyNewTarget(newArgument1 as INotifyReversableValue <T1>), newArgument1));
        }
示例#6
0
        public override int GetHashCode()
        {
            int hash = 0;

            hash += Operation.GetHashCode();
            hash += Argument1.GetHashCode();
            hash += Argument2.GetHashCode();
            hash += Result.GetHashCode();
            hash += Label.GetHashCode();
            return(hash);
        }
        public override void Execute
        (
            PftContext context
        )
        {
            Argument1.Execute(context);
            int mfn = (int)Argument1.Value;

            if (mfn > 0)
            {
                string format = context.Evaluate(Argument2);
                string text   = context.Client.FormatRecord(format, mfn);
                context.Write(text);
            }
        }
示例#8
0
        /// <summary>
        /// Translates the instruction and sets the Code property.
        /// If an error is detected, Error property is set instead.
        /// </summary>
        /// <returns>A value indicating if the translation was successful</returns>
        public override bool Translate()
        {
            Error = null;
            if (!CheckArgument1())
            {
                return(false);
            }
            Code    = new ushort[2];
            Code[0] = 0xD << 12;             // The first word is always the same (only an OPCode).
            int value;

            Argument1.LookUpValue(Assembler, out value);
            Code[1] = (ushort)value;             // The second word is the address of the subroutine.
            return(true);
        }
示例#9
0
            public override bool Equals(object obj)
            {
                if (obj == null)
                {
                    return(false);
                }
                var second = obj as AvailableExpression;

                if (second == null)
                {
                    return(false);
                }
                return(Argument1.Equals(second.Argument1) &&
                       Argument2.Equals(second.Argument2) &&
                       Operation.Equals(second.Operation));
            }
示例#10
0
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Type", true, out subEle);
            subEle.Value = Type.ToString();

            ele.TryPathTo(Arg1Label, true, out subEle);
            if (Arg1Type == null)
            {
                subEle.Value = ((byte[])Argument1).ToHex();
            }
            else if (Arg1Type == typeof(FormID))
            {
                Argument1.WriteXML(subEle, master);
            }
            else if (Arg1Type.IsEnum)
            {
                subEle.Value = Argument1.ToString();
            }
            else
            {
                throw new ArgumentException(Arg1Type.ToString() + " is not handled.");
            }

            ele.TryPathTo(Arg2Label, true, out subEle);
            if (Arg2Type == null)
            {
                subEle.Value = ((byte[])Argument2).ToHex();
            }
            else if (Arg2Type == typeof(FormID))
            {
                Argument2.WriteXML(subEle, master);
            }
            else if (Arg2Type.IsEnum)
            {
                subEle.Value = Argument2.ToString();
            }
            else if (Arg2Type == typeof(uint))
            {
                subEle.Value = Argument2.ToString();
            }
            else
            {
                throw new ArgumentException(Arg2Type.ToString() + " is not handled.");
            }
        }
示例#11
0
        public override void Execute
        (
            PftContext context
        )
        {
            Argument1.Execute(context);

            int minLength = 1;

            if (Argument2 == null)
            {
                if (Argument3 == null)
                {
                    minLength = 16;
                }
            }
            else
            {
                Argument2.Execute(context);
                minLength = (int)Argument2.Value;
            }

            bool useE          = true;
            int  decimalPoints = 0;

            if (Argument3 != null)
            {
                useE = false;
                Argument3.Execute(context);
                decimalPoints = (int)Argument3.Value;
            }

            string format = useE
                ? string.Format("E{0}", minLength)
                : string.Format("F{0}", decimalPoints);

            context.Write
            (
                Argument1.Value.ToString
                (
                    format,
                    CultureInfo.InvariantCulture
                )
            );
        }
示例#12
0
        /// <summary>
        /// Translates the first argument to the machine code.
        /// The resulting value contains the argument encoding in the right
        /// position within the word, and zeroes in locations intended for the
        /// OPCode (mnemonic) and the other argument.
        /// </summary>
        /// <returns>A value containing the translation of the argument</returns>
        protected ushort TranslateArgument1()
        {
            int value;

            Argument1.LookUpValue(Assembler, out value);

            // Write address to the lowest 3 bits
            ushort result = (ushort)value;

            if (Argument1.Type == ArgumentType.Indirect)
            {
                // Indirect addressing is indicated by setting the 4th lowest bit.
                result |= 0x8;
            }
            // Move the argument to the right position : 0000aaaa00000000
            result <<= 8;
            return(result);
        }
示例#13
0
        /// <summary>
        /// Formats the instruction as string.
        /// <example>
        /// ADD (x), x, 2
        /// </example>
        /// </summary>
        /// <returns>A string representing the instruction</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Mnemonic);
            sb.Append(' ');
            sb.Append(Argument1.ToString());
            if (Argument2.Type != ArgumentType.None)
            {
                sb.Append(", ");
                sb.Append(Argument2.ToString());
            }
            if (Argument3.Type != ArgumentType.None)
            {
                sb.Append(", ");
                sb.Append(Argument3.ToString());
            }
            return(sb.ToString());
        }
示例#14
0
        public void WriteBinary(ESPWriter writer)
        {
            writer.Write((uint)Type);

            if (Arg1Type == null)
            {
                writer.Write(Argument1);
            }
            else if (Arg1Type == typeof(FormID))
            {
                Argument1.WriteBinary(writer);
            }
            else if (Arg1Type.IsEnum)
            {
                writer.Write((int)Argument1);
            }
            else
            {
                throw new ArgumentException(Arg1Type.ToString() + " is not handled.");
            }

            if (Arg2Type == null)
            {
                writer.Write(Argument2);
            }
            else if (Arg2Type == typeof(FormID))
            {
                writer.Write((FormID)Argument2);
            }
            else if (Arg2Type.IsEnum)
            {
                writer.Write((int)Argument2);
            }
            else if (Arg2Type == typeof(uint))
            {
                writer.Write(Argument2);
            }
            else
            {
                throw new ArgumentException(Arg2Type.ToString() + " is not handled.");
            }
        }
示例#15
0
        /// <summary>
        /// Checks if the first argument is valid.
        /// </summary>
        /// <remarks>
        /// The first argument of an I/O instruction must be a symbol
        /// present in the symbol table and its value must be between [0..7].
        /// </remarks>
        /// <returns>A value indicating if Argument1 is valid</returns>
        protected bool CheckArgument1()
        {
            int value;

            if (!Argument1.LookUpValue(Assembler, out value))
            {
                return(false);
            }

            if (value < 0 || value > 7)
            {
                Error             = new Error();
                Error.ID          = 3;
                Error.Description = string.Format(Messages.E0003, Argument1.Text, 0, 7);
                Error.Line        = Line;
                Error.Column      = Argument1.Column;
                return(false);
            }
            return(true);
        }
 PrimitivePlusFixnumA1A0(Primitive2 rator, Argument1 rand0, Argument0 rand1)
     : base(rator, rand0, rand1)
 {
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, LexicalVariable rand1)
 {
     return
         (rand1 is Argument) ? PrimitivePlusFixnumA1A.Make (rator, rand0, (Argument) rand1)
         : (rand1 is LexicalVariable1) ? Unimplemented ()
         : new PrimitivePlusFixnumA1L (rator, rand0, rand1);
 }
 public static SCode Make(Primitive2 rator, LexicalVariable rand0, Argument1 rand1)
 {
     return
          new PrimitivePlusFixnumLA1 (rator, rand0, rand1);
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, SCode rand1)
 {
     return
         (rand1 is LexicalVariable) ? PrimitivePlusFixnumA1L.Make (rator, rand0, (LexicalVariable) rand1)
         : (rand1 is Quotation) ? PrimitivePlusFixnumA1Q.Make (rator, rand0, (Quotation) rand1)
         : new PrimitivePlusFixnumA1 (rator, rand0, rand1);
 }
示例#20
0
 PCond2A0A0A1Q(PrimitiveCombination2A0A0 predicate, Argument1 consequent, Quotation alternative)
     : base(predicate, consequent, alternative)
 {
     this.alternativeValue = alternative.Quoted;
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, Quotation rand1)
 {
     return
         new PrimitiveIsCharEqA1Q (rator, rand0, rand1);
 }
 PrimitiveIsObjectEqQA1(Primitive2 rator, Quotation rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
示例#23
0
 public static SCode Make(PrimitiveIsObjectEqQA1 predicate, SCode consequent, Argument1 alternative)
 {
     return
         new PCondIsObjectEqQA1SA1 (predicate, consequent, alternative);
 }
 public static SCode Make(Primitive2 rator, Quotation rand0, Argument1 rand1)
 {
     return
         (new PrimitiveIsObjectEqQA1(rator, rand0, rand1));
 }
示例#25
0
 public bool UseVariable(string variable)
 {
     return(Argument1.Equals(variable) || Argument2.Equals(variable));
 }
示例#26
0
 public static SCode Make(PrimitiveCombination2A0L1 predicate, LexicalVariable1 consequent, Argument1 alternative)
 {
     return
         new PCond2A0L1L1A1 (predicate, consequent, alternative);
 }
示例#27
0
 // (a0 l1 l1 a1)
 PCond2A0L1L1A1(PrimitiveCombination2A0L1 predicate, LexicalVariable1 consequent, Argument1 alternative)
     : base(predicate, consequent, alternative)
 {
 }
示例#28
0
 public static SCode Make(PrimitiveCombination2A0A0 predicate, Argument1 consequent, Quotation alternative)
 {
     return
         new PCond2A0A0A1Q (predicate, consequent, alternative);
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, Quotation rand1)
 {
     return
         new PrimitivePlusFixnumA1Q (rator, rand0, (Quotation) rand1);
 }
 protected PrimitiveIsObjectEqA1Q(Primitive2 rator, Argument1 rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = rand1.Quoted;
 }
 public static SCode Make(Primitive2 rator, Argument rand0, Argument1 rand1)
 {
     return new PrimitivePlusFixnumAA1 (rator, rand0, rand1);
 }
 public static SCode Make(Primitive2 rator, Quotation rand0, Argument1 rand1)
 {
     return
          new PrimitiveIsFixnumEqualQA1 (rator, rand0, rand1);
 }
示例#33
0
        public void ReadXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Type", false, out subEle))
            {
                Type = subEle.ToEnum <FunctionType>();
            }

            TypeStringArgData data;

            if (Metadata.TryGetValue(Type, out data))
            {
                Arg1Label = data.Arg1Label;
                Arg2Label = data.Arg2Label;
                Arg1Type  = data.Arg1Type;
                Arg2Type  = data.Arg2Type;

                if (ele.TryPathTo(Arg1Label, false, out subEle))
                {
                    if (Arg1Type == null)
                    {
                        Argument1 = subEle.ToBytes();
                    }
                    else if (Arg1Type == typeof(FormID))
                    {
                        Argument1 = new FormID();
                        Argument1.ReadXML(subEle, master);
                    }
                    else if (Arg1Type == typeof(VATSValue))
                    {
                        Argument1 = subEle.ToEnum <VATSValue>();

                        TypeStringArgData tempData;

                        if (VATSMetadata.TryGetValue(Argument1, out tempData))
                        {
                            Arg2Type  = tempData.Arg1Type;
                            Arg2Label = tempData.Arg1Label;
                        }
                        else
                        {
                            throw new ArgumentException("VATSValue " + Argument1.ToString() + " is not handled.");
                        }
                    }
                    else if (Arg1Type.IsEnum)
                    {
                        Argument1 = Enum.Parse(Arg1Type, subEle.Value);
                    }
                    else
                    {
                        throw new ArgumentException(Arg1Type.ToString() + " is not handled.");
                    }
                }

                if (ele.TryPathTo(Arg2Label, false, out subEle))
                {
                    if (Arg2Type == null)
                    {
                        Argument2 = subEle.ToBytes();
                    }
                    else if (Arg2Type == typeof(FormID))
                    {
                        Argument2 = new FormID();
                        Argument2.ReadXML(subEle, master);
                    }
                    else if (Arg2Type.IsEnum)
                    {
                        Argument2 = Enum.Parse(Arg2Type, subEle.Value);
                    }
                    else if (Arg2Type == typeof(uint))
                    {
                        Argument2 = subEle.ToUInt32();
                    }
                    else
                    {
                        throw new ArgumentException(Arg2Type.ToString() + " is not handled.");
                    }
                }
            }
            else
            {
                throw new Exception(Type.ToString() + " was not in the dictionary.");
            }
        }
 public static SCode Make(Primitive2 rator, Argument1 rand0, Argument0 rand1)
 {
     return
          new PrimitiveIsFixnumEqualA1A0 (rator, rand0, rand1);
 }
 protected PrimitiveIsCharEqA1Q(Primitive2 rator, Argument1 rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = (char) rand1.Quoted;
 }
 public static SCode Make(Primitive2 rator, Argument0 rand0, Argument1 rand1)
 {
     throw new NotImplementedException ();
     //new PrimitiveIsFixnumEqualA1A1 (rator, rand0, rand1);
 }
 protected PrimitivePlusFixnumLA1(Primitive2 rator, LexicalVariable rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
 PrimitiveGeneralCarCdrA0A1(Primitive2 rator, Argument0 rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
 protected PrimitivePlusFixnumQA1(Primitive2 rator, Quotation rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
 protected PrimitiveGeneralCarCdrA1(Primitive2 rator, Argument1 rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, Argument rand1)
 {
     return
         (rand1 is Argument0) ? PrimitivePlusFixnumA1A0.Make (rator, rand0, (Argument0) rand1) :
         (rand1 is Argument1) ? Unimplemented() :
         new PrimitivePlusFixnumA1A (rator, rand0, rand1);
 }
 protected PrimitiveGeneralCarCdrA1Q(Primitive2 rator, Argument1 rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = (int)rand1.Quoted;
 }
 protected PrimitivePlusFixnumA1L(Primitive2 rator, Argument1 rand0, LexicalVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Depth = rand1.Depth;
     this.rand1Offset = rand1.Offset;
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, SCode rand1)
 {
     return
         ((rand1 is Quotation) ? PrimitiveIsObjectEqA1Q.Make(rator, rand0, (Quotation)rand1)
         : Unimplemented());
 }
 protected PrimitivePlusFixnumA1Q(Primitive2 rator, Argument1 rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = (int) rand1.Quoted;
 }
示例#46
0
 internal static SCode Make(PrimitiveIsComplexA1 predicate, SCode consequent, Argument1 alternative)
 {
     return
         new PCondIsComplexA1SA1 (predicate, consequent, alternative);
 }
 protected PrimitivePlusFixnumAA1(Primitive2 rator, Argument rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
 protected PrimitiveIsObjectEqA1(Primitive2 rator, Argument1 rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
 }
示例#49
0
 PCondIsObjectEqQA1SA1(PrimitiveIsObjectEqQA1 predicate, SCode consequent, Argument1 alternative)
     : base(predicate, consequent, alternative)
 {
 }
 protected PrimitiveIsCharEqA1(Primitive2 rator, Argument1 rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
 }
 public override double Compute(IReadOnlyDictionary <string, double> variableValues)
 => Argument1.Compute(variableValues) / Argument2.Compute(variableValues);
 public static SCode Make(Primitive2 rator, Argument1 rand0, SCode rand1)
 {
     return
         (rand1 is Quotation) ? PrimitiveIsCharEqA1Q.Make (rator, rand0, (Quotation) rand1)
         : Unimplemented ();
 }
 protected PrimitiveIsFixnumEqualA1L1(Primitive2 rator, Argument1 rand0, LexicalVariable1 rand1)
     : base(rator, rand0, rand1)
 {
 }
        public override INotifyExpression <TResult> ApplyParameters(IDictionary <string, object> parameters)
        {
            var newArgument1 = Argument1.ApplyParameters(parameters);

            return(new ObservableStaticLensProxyCall <T1, TResult>(ProxyFunction, newArgument1, LensPut.ApplyNewTarget(newArgument1 as INotifyReversableValue <T1>)));
        }
 public static SCode Make(Primitive2 rator, Argument0 rand0, Argument1 rand1)
 {
     return
         (new PrimitiveGeneralCarCdrA0A1(rator, rand0, rand1));
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, LexicalVariable1 rand1)
 {
     return
         new PrimitiveIsFixnumEqualA1L1 (rator, rand0, rand1);
 }
 protected PrimitiveIsFixnumEqualAA1(Primitive2 rator, Argument rand0, Argument1 rand1)
     : base(rator, rand0, rand1)
 {
 }
示例#58
0
 PCondIsComplexA1SA1(PrimitiveIsComplexA1 predicate, SCode consequent, Argument1 alternative)
     : base(predicate, consequent, alternative)
 {
 }
 public static SCode Make(Primitive2 rator, Argument1 rand0, Quotation rand1)
 {
     return
         (new PrimitiveGeneralCarCdrA1Q(rator, rand0, (Quotation)rand1));
 }
示例#60
0
 public static SCode Make(Primitive2 rator, Argument1 rand0, Quotation rand1)
 {
     return
         (new PrimitiveIsIntEqA1Q(rator, rand0, rand1));
 }