Ejemplo n.º 1
0
 public static SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         ((rand1 is Argument) ? PrimitiveVector8BRefSA.Make(rator, rand0, (Argument)rand1) :
          (rand1 is StaticVariable) ? new PrimitiveVector8BRefSS(rator, rand0, (StaticVariable)rand1) :
          new PrimitiveVector8BRefS(rator, rand0, rand1));
 }
Ejemplo n.º 2
0
 public static new SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         ((rand1 is Argument) ? PrimitiveVectorRefSA.Make(rator, rand0, (Argument)rand1) :
          (rand1 is Quotation) ? PrimitiveVectorRefSQ.Make(rator, rand0, (Quotation)rand1) :
          new PrimitiveVectorRefS(rator, rand0, rand1));
 }
Ejemplo n.º 3
0
 public static PrimitiveRecordSetSQ Make(StaticVariable arg0, Quotation arg1, SCode arg2)
 {
     return
         ((arg2 is Quotation) ? new PrimitiveRecordSetSQQ(arg0, arg1, (Quotation)arg2) :
          (arg2 is StaticVariable) ? new PrimitiveRecordSetSQS(arg0, arg1, (StaticVariable)arg2) :
          new PrimitiveRecordSetSQ(arg0, arg1, arg2));
 }
Ejemplo n.º 4
0
        public void CountOfListAsCondition()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("if count of shipRoute[] > 0 wait");

            Assert.IsTrue(command is ConditionalCommand);
            ConditionalCommand conditionalCommand = (ConditionalCommand)command;

            Assert.IsTrue(conditionalCommand.Condition is ComparisonVariable);
            ComparisonVariable comparison = (ComparisonVariable)conditionalCommand.Condition;

            Assert.IsTrue(comparison.a is ListAggregateVariable);
            ListAggregateVariable listAggregate = (ListAggregateVariable)comparison.a;

            Assert.AreEqual(PropertyAggregate.COUNT, listAggregate.aggregation);
            Assert.IsTrue(listAggregate.expectedList is ListIndexVariable);
            ListIndexVariable listIndex = (ListIndexVariable)listAggregate.expectedList;

            Assert.IsTrue(listIndex.expectedList is InMemoryVariable);
            InMemoryVariable listVariable = (InMemoryVariable)listIndex.expectedList;

            Assert.AreEqual("shipRoute", listVariable.variableName);
            Assert.IsTrue(comparison.b is StaticVariable);
            StaticVariable comparisonVariable = (StaticVariable)comparison.b;

            Assert.AreEqual(0f, comparisonVariable.GetValue().GetValue());
        }
Ejemplo n.º 5
0
 public static SCode Make(StaticVariable predicate, SCode alternative)
 {
     return
         ((alternative is Argument) ? DisjunctionSA.Make(predicate, (Argument)alternative) :
          (alternative is Quotation) ? DisjunctionSQ.Make(predicate, (Quotation)alternative) :
          (alternative is StaticVariable) ? DisjunctionSS.Make(predicate, (StaticVariable)alternative) :
          new DisjunctionS(predicate, alternative));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     Log.Warning("ServiceDispose", "SoraWebsocketServer正在停止...");
     _disposed = true;
     StaticVariable.DisposeService(_serverId);
     Server.Dispose();
     ConnManager.Dispose();
     GC.SuppressFinalize(this);
 }
Ejemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        StaticVariable a = new StaticVariable();
        StaticVariable b = new StaticVariable();
        StaticVariable c = new StaticVariable();
        StaticVariable d = new StaticVariable();

        Debug.Log("StaticVariable " + StaticVariable.ref_counter);
        //Debug.Log("d " + d.ref_counter);  //Wrong;
    }
Ejemplo n.º 8
0
        public void SimpleBooleanCondition()
        {
            var command = ParseCommand("if true set the \"rotors\" height to 5");

            Assert.IsTrue(command is ConditionalCommand);
            ConditionalCommand conditionalCommand = (ConditionalCommand)command;

            Assert.IsTrue(conditionalCommand.Condition is StaticVariable);
            StaticVariable variable = (StaticVariable)conditionalCommand.Condition;

            Assert.IsTrue(variable.GetValue() is BooleanPrimitive);
            BooleanPrimitive boolean = (BooleanPrimitive)variable.GetValue();

            Assert.IsTrue(boolean.GetBooleanValue());
        }
Ejemplo n.º 9
0
        public void SimpleBooleanCondition()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("if true set the \"rotors\" height to 5");

            Assert.IsTrue(command is ConditionalCommand);
            ConditionalCommand conditionalCommand = (ConditionalCommand)command;

            Assert.IsTrue(conditionalCommand.Condition is StaticVariable);
            StaticVariable variable = (StaticVariable)conditionalCommand.Condition;

            Assert.IsTrue(variable.GetValue() is BooleanPrimitive);
            BooleanPrimitive boolean = (BooleanPrimitive)variable.GetValue();

            Assert.IsTrue(boolean.GetTypedValue());
        }
Ejemplo n.º 10
0
        public void ParseVectorFromGPSCoordinate()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("assign a to \"GPS:surface:53573.9750085028:-26601.8512032533:12058.8229348438:#FF75C9F1:\"");

            Assert.IsTrue(command is VariableAssignmentCommand);
            VariableAssignmentCommand assignCommand = (VariableAssignmentCommand)command;

            Assert.IsTrue(assignCommand.variable is StaticVariable);
            StaticVariable variable = (StaticVariable)assignCommand.variable;

            Assert.IsTrue(variable.GetValue() is VectorPrimitive);
            Vector3D vector = CastVector(variable.GetValue()).GetTypedValue();

            Assert.AreEqual(53573.9750085028, vector.X);
            Assert.AreEqual(-26601.8512032533, vector.Y);
            Assert.AreEqual(12058.8229348438, vector.Z);
        }
Ejemplo n.º 11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            Console.OutputEncoding = Encoding.GetEncoding("GB2312");
            Console.InputEncoding  = Encoding.GetEncoding("GB2312");

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();

            StaticVariable.InitVariable(Configuration);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}"
                    );
            });
        }
 public static new SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         ((rand1 is Quotation) ? new PrimitiveLessThanFixnumSQ(rator, rand0, (Quotation)rand1) :
          new PrimitiveLessThanFixnumS(rator, rand0, rand1));
 }
Ejemplo n.º 13
0
 public static SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         (rand1 is Argument) ? PrimitiveIsEqSA.Make (rator, rand0, (Argument) rand1) :
         (rand1 is StaticVariable) ? new PrimitiveIsEqSS (rator, rand0, (StaticVariable) rand1) :
         (rand1 is Quotation) ? PrimitiveIsEqSQ.Make (rator, rand0, (Quotation) rand1) :
         new PrimitiveIsEqS (rator, rand0, rand1);
 }
Ejemplo n.º 14
0
 public static SCode Make(Primitive2 rator, SCode rand0, StaticVariable rand1)
 {
     return
         (new PrimitiveVector8BRefXS(rator, rand0, rand1));
 }
Ejemplo n.º 15
0
 public static SCode Make(SimpleLambda rator, StaticVariable arg0)
 {
     //if (arg0 is Argument0) Debugger.Break ();
     return
         (new SimpleLet1S(rator, arg0));
 }
Ejemplo n.º 16
0
 protected PrimitiveIsEqSA(Primitive2 rator, StaticVariable rand0, Argument rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 17
0
 internal PrimitiveVector8BRefSS(Primitive2 rator, StaticVariable rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name   = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 18
0
 public static SCode Make(StaticVariable predicate, StaticVariable alternative)
 {
     return
         (new DisjunctionSS(predicate, alternative));
 }
Ejemplo n.º 19
0
 public static new SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         (new PrimitiveGreaterThanFixnumS(rator, rand0, rand1));
 }
Ejemplo n.º 20
0
 protected PrimitiveIsEqSQ(Primitive2 rator, StaticVariable rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = rand1.Quoted;
 }
Ejemplo n.º 21
0
 protected DisjunctionSS(StaticVariable predicate, StaticVariable alternative)
     : base(predicate, alternative)
 {
     this.alternativeName   = alternative.Name;
     this.alternativeOffset = alternative.Offset;
 }
Ejemplo n.º 22
0
 public static SCode Make(Primitive2 rator, Argument rand0, StaticVariable rand1)
 {
     return
         new PrimitiveIsEqAS (rator, rand0, rand1);
 }
Ejemplo n.º 23
0
 protected PrimitiveIsEqAS(Primitive2 rator, Argument rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 24
0
 public static SCode Make(Primitive2 rator, Quotation rand0, StaticVariable rand1)
 {
     return
         new PrimitiveIsIntEqQS (rator, rand0, rand1);
 }
 protected PrimitiveGreaterThanFixnumS(Primitive2 rator, StaticVariable rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Name = rand0.Name;
     this.rand0Offset = rand0.Offset;
 }
Ejemplo n.º 26
0
 protected Combination3S(StaticVariable rator, SCode rand0, SCode rand1, SCode rand2)
     : base(rator, rand0, rand1, rand2)
 {
     this.ratorName   = rator.Name;
     this.ratorOffset = rator.Offset;
 }
Ejemplo n.º 27
0
 PrimitiveGreaterThanFixnumA0S(Primitive2 rator, Argument0 rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name   = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 28
0
 public static SCode Make(StaticVariable rator, SCode rand0, SCode rand1, SCode rand2)
 {
     return
         (new Combination3S(rator, rand0, rand1, rand2));
 }
Ejemplo n.º 29
0
 protected PrimitiveIsIntEqQS(Primitive2 rator, Quotation rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 30
0
 protected PCond1XXS(PrimitiveCombination1 predicate, SCode consequent, StaticVariable alternative)
     : base(predicate, consequent, alternative)
 {
     this.alternativeName = alternative.Name;
     this.alternativeOffset = alternative.Offset;
 }
Ejemplo n.º 31
0
 internal PrimitiveVector8BRefSA0(Primitive2 rator, StaticVariable rand0, Argument0 rand1)
     : base(rator, rand0, rand1)
 {
 }
Ejemplo n.º 32
0
 protected PCond1A0S(PrimitiveCombination1 predicate, StaticVariable consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.consequentName = consequent.Name;
     this.consequentOffset = consequent.Offset;
 }
Ejemplo n.º 33
0
 protected PrimitiveVector8BRefXS(Primitive2 rator, SCode rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
 }
Ejemplo n.º 34
0
 public static new SCode Make(PrimitiveCombination1 predicate, SCode consequent, StaticVariable alternative)
 {
     return
         new PCond1A0XS (predicate, consequent, alternative);
 }
Ejemplo n.º 35
0
 protected SimpleLet1S(SimpleLambda rator, StaticVariable rand)
     : base(rator, rand)
 {
     this.randName   = rand.Name;
     this.randOffset = rand.Offset;
 }
Ejemplo n.º 36
0
 protected PrimitiveIsEqSA0(Primitive2 rator, StaticVariable rand0, Argument0 rand1)
     : base(rator, rand0, rand1)
 {
 }
 public static new SCode Make(Primitive2 rator, Argument0 rand0, StaticVariable rand1)
 {
     return
         (new PrimitiveLessThanFixnumA0S(rator, rand0, rand1));
 }
Ejemplo n.º 38
0
 public static SCode Make(Primitive2 rator, StaticVariable rand0, Argument rand1)
 {
     return
         (rand1 is Argument0) ? PrimitiveIsEqSA0.Make (rator, rand0, (Argument0) rand1) :
          new PrimitiveIsEqSA (rator, rand0, rand1);
 }
 internal PrimitiveLessThanFixnumSQ(Primitive2 rator, StaticVariable rand0, Quotation rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Value = (int)rand1.Quoted;
 }
Ejemplo n.º 40
0
 internal PrimitiveRecordSetSQQ(StaticVariable arg0, Quotation arg1, Quotation arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand2Value = arg2.Quoted;
 }
 PrimitiveGreaterThanFixnumA0S(Primitive2 rator, Argument0 rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 42
0
 protected PrimitiveStringSetS(StaticVariable arg0, SCode arg1, SCode arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand0Name = arg0.Name;
     this.rand0Offset = arg0.Offset;
 }
 public static new SCode Make(Primitive2 rator, StaticVariable rand0, SCode rand1)
 {
     return
         new PrimitiveGreaterThanFixnumS (rator, rand0, rand1);
 }
Ejemplo n.º 44
0
 public static PrimitiveRecordSetS Make(StaticVariable arg0, SCode arg1, SCode arg2)
 {
     return
         (arg1 is Quotation) ? PrimitiveRecordSetSQ.Make (arg0, (Quotation) arg1, arg2) :
         new PrimitiveRecordSetS (arg0, arg1, arg2);
 }
Ejemplo n.º 45
0
 protected PrimitiveGreaterThanFixnumS(Primitive2 rator, StaticVariable rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Name   = rand0.Name;
     this.rand0Offset = rand0.Offset;
 }
Ejemplo n.º 46
0
 internal PrimitiveIsEqSS(Primitive2 rator, StaticVariable rand0, StaticVariable rand1)
     : base(rator, rand0, rand1)
 {
     #if DEBUG
     if (rand0.Offset == rand1.Offset) Debugger.Break ();
     #endif
     this.rand1Name = rand1.Name;
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 47
0
 public static PrimitiveStringSetSQ Make(StaticVariable arg0, Quotation arg1, SCode arg2)
 {
     return
         (arg2 is Quotation) ? PrimitiveStringSetSQQ.Make (arg0, arg1, (Quotation) arg2) :
         new PrimitiveStringSetSQ (arg0, arg1, arg2);
 }
Ejemplo n.º 48
0
 public static SCode Make(Primitive2 rator, SCode rand0, StaticVariable rand1)
 {
     return
         //(rand0 is Argument0) ? PrimitiveIsEqA0.Make (rator, (Argument0) rand0, rand1) :
         //(rand0 is Argument1) ? PrimitiveIsEqA1.Make (rator, (Argument1) rand0, rand1) :
         //(rand1 is Quotation) ? PrimitiveIsEqAQ.Make (rator, rand0, (Quotation) rand1) :
         new PrimitiveIsEqXS (rator, rand0, rand1);
 }
Ejemplo n.º 49
0
 public static PrimitiveRecordSetSQ Make(StaticVariable arg0, Quotation arg1, SCode arg2)
 {
     return
         (arg2 is Quotation) ? new PrimitiveRecordSetSQQ (arg0, arg1, (Quotation) arg2) :
         (arg2 is StaticVariable) ? new PrimitiveRecordSetSQS (arg0, arg1, (StaticVariable) arg2) :
         new PrimitiveRecordSetSQ (arg0, arg1, arg2);
 }
Ejemplo n.º 50
0
 public static SCode Make(Primitive2 rator, StaticVariable rand0, Quotation rand1)
 {
     return
                        (rand1.Quoted == null &&
         Configuration.EnableCodeRewriting &&
         Configuration.EnableEqNullRewrite) ? RewriteEqNull (rator, rand0, rand1) :
         (rand1.Quoted is bool &&
         ((bool) rand1.Quoted) == false &&
         Configuration.EnableCodeRewriting &&
         Configuration.EnableEqFalseRewrite) ? RewriteEqFalse (rator, rand0, rand1) :
         new PrimitiveIsEqSQ (rator, rand0, rand1);
 }
Ejemplo n.º 51
0
 internal PrimitiveRecordSetSQS(StaticVariable arg0, Quotation arg1, StaticVariable arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand2Name = arg2.Name;
     this.rand2Offset = arg2.Offset;
 }
Ejemplo n.º 52
0
 protected PrimitiveVector8BRefS(Primitive2 rator, StaticVariable rand0, SCode rand1)
     : base(rator, rand0, rand1)
 {
     this.rand0Name   = rand0.Name;
     this.rand0Offset = rand0.Offset;
 }
Ejemplo n.º 53
0
 protected PrimitiveStringSetSQ(StaticVariable arg0, Quotation arg1, SCode arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand1Value = (int) arg1.Quoted;
 }
Ejemplo n.º 54
0
 public static PrimitiveStringSetSQQ Make(StaticVariable arg0, Quotation arg1, Quotation arg2)
 {
     return
         new PrimitiveStringSetSQQ (arg0, arg1, arg2);
 }
Ejemplo n.º 55
0
 protected PrimitiveStringSetSQQ(StaticVariable arg0, Quotation arg1, Quotation arg2)
     : base(arg0, arg1, arg2)
 {
     this.rand2Value = arg2.Quoted;
 }
Ejemplo n.º 56
0
 protected PCondIsNullAS(PrimitiveIsNullA predicate, StaticVariable consequent, SCode alternative)
     : base(predicate, consequent, alternative)
 {
     this.consequentName = consequent.Name;
     this.consequentOffset = consequent.Offset;
 }
Ejemplo n.º 57
0
 protected PCondIsNullA0XS(PrimitiveIsNullA0 predicate, SCode consequent, StaticVariable alternative)
     : base(predicate, consequent, alternative)
 {
     this.alternativeName = alternative.Name;
     this.alternativeOffset = alternative.Offset;
 }
Ejemplo n.º 58
0
 protected PrimitiveVector8BRefSA(Primitive2 rator, StaticVariable rand0, Argument rand1)
     : base(rator, rand0, rand1)
 {
     this.rand1Offset = rand1.Offset;
 }
Ejemplo n.º 59
0
 public static SCode Make(PrimitiveIsNullA predicate, StaticVariable consequent, SCode alternative)
 {
     return
         new PCondIsNullAS (predicate, consequent, alternative);
 }
Ejemplo n.º 60
0
 public static SCode Make(Primitive2 rator, StaticVariable rand0, Argument rand1)
 {
     return
         ((rand1 is Argument0) ? new PrimitiveVector8BRefSA0(rator, rand0, (Argument0)rand1) :
          new PrimitiveVector8BRefSA(rator, rand0, rand1));
 }