public void TestTLFunctionPublicMaterializer1()
        {
            var funcName = "";
            var func     = Decomposer.Decompose(funcName, true) as TLFunction;

            Assert.IsNotNull(func, "func");
        }
        public void TestStructMeta()
        {
            var func = "_$s17unitHelpFrawework7AStructVN";
            var def  = Decomposer.Decompose(func, true) as TLDefinition;

            Assert.IsNotNull(def, "def");
        }
        public void TestTLFunctionUsingClass()
        {
            var funcName = "_$s17unitHelpFrawework13xamarin_MontyC3valyyAA0E0CF";
            var func     = Decomposer.Decompose(funcName, true) as TLFunction;

            Assert.IsNotNull(func, "func");
        }
        public void DecomposeProtocolConformanceDescriptor()
        {
            var func = "_$sSayxG5Macaw12InterpolableABMc";
            var tlf  = Decomposer.Decompose(func, false) as TLProtocolConformanceDescriptor;

            Assert.IsNotNull(tlf);
        }
예제 #5
0
        public bool CalculatePQ(MaterialStream stream, double enthalpy)
        {
            var copy = new MaterialStream("copy", stream.System);

            copy.CopyFrom(stream);

            PrecalculateTP(copy);

            var problem2 = new EquationSystem()
            {
                Name = "PQ-Flash"
            };

            copy.GetVariable("p").IsFixed  = true;
            copy.GetVariable("T").IsFixed  = false;
            copy.GetVariable("VF").IsFixed = false;
            copy.Init("VF", stream.Vfmolar.ValueInSI);
            foreach (var comp in stream.System.Components)
            {
                copy.GetVariable("n[" + comp.ID + "]").IsFixed = true;
            }
            problem2.AddConstraints((copy.Mixed.SpecificEnthalpy * copy.Mixed.TotalMolarflow).IsEqualTo(enthalpy));
            copy.FillEquationSystem(problem2);

            var solver = new Decomposer();

            solver.Solve(problem2);

            performMassBalance(copy, copy.KValues);
            performDensityUpdate(copy);
            performEnthalpyUpdate(copy);

            stream.CopyFrom(copy);
            return(true);
        }
        public void DecomposeUnsafeRawPointer()
        {
            var func = "_$s17unitHelpFrawework3FooSVyF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
        }
        public void DecomposeUnsafeMutableAddressor3()
        {
            var func = "_$s17unitHelpFrawework10AKMetalBarV12pregainRangeSNySdGvau";
            var tlf  = Decomposer.Decompose(func, false) as TLUnsafeMutableAddressor;

            Assert.IsNotNull(tlf, "tlf");
        }
        public void DecomposeUnsafeMutableAddressor1()
        {
            var func = "_$s17unitHelpFrawework10AKDurationV16secondsPerMinuteSivau";
            var tlf  = Decomposer.Decompose(func, false) as TLUnsafeMutableAddressor;

            Assert.IsNotNull(tlf, "tlf");
        }
예제 #9
0
        static void Main(string[] args)
        {
            double a, b, c;

            Console.WriteLine("Enter a");
            while (!Double.TryParse(Console.ReadLine(), out a))
            {
                Console.WriteLine("Input is not valid");
                Console.WriteLine("Enter a");
            }
            Console.WriteLine("Enter B");
            while (!Double.TryParse(Console.ReadLine(), out b))
            {
                Console.WriteLine("Input is not valid");
                Console.WriteLine("Enter b");
            }
            Console.WriteLine("Enter c");
            while (!Double.TryParse(Console.ReadLine(), out c))
            {
                Console.WriteLine("Input is not valid");
                Console.WriteLine("Enter c");
            }

            Console.WriteLine();

            Decomposer decomposer = new Decomposer(a, b, c);

            decomposer.Resolve();

            Console.ReadLine();
        }
        public void DecomposeUnsafeMutableAddressor()
        {
            var func = "_$s17unitHelpFrawework10AKBalancerC20ComponentDescriptionSSvau";
            var tlf  = Decomposer.Decompose(func, false) as TLUnsafeMutableAddressor;

            Assert.IsNotNull(tlf, "tlf");
        }
        public void DecomposeGlobalVariable()
        {
            var func = "_$s17unitHelpFrawework7aGlobalSbvp";
            var vari = Decomposer.Decompose(func, false) as TLVariable;

            Assert.IsNotNull(vari, "vari");
        }
        public void DemcomposeCConventionCall()
        {
            var func = "_$s17unitHelpFrawework12callSomeFuncyyyyXCF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.IsTrue(tlf.Signature.Parameters is SwiftCFunctionPointerType, "not a c function pointer type");
        }
        public void DecomposeThrowingFunction()
        {
            var func = "_$s17unitHelpFrawework7throwIt7doThrowSiSb_tKF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.IsTrue(tlf.Signature.CanThrow, "CanThrow");
        }
        public void DecomposeMetadataPattern()
        {
            var func = "_$s17unitHelpFrawework3FooCMP";
            var gmp  = Decomposer.Decompose(func, false) as TLGenericMetadataPattern;

            Assert.IsNotNull(gmp, "gmp");
            Assert.AreEqual("unitHelpFrawework.Foo", gmp.Class.ClassName.ToFullyQualifiedName(true), "classname");
        }
        public void DemcomposeReturnsInt64()
        {
            var func = "_$s17unitHelpFrawework5MontyC3vals5Int64VyF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.IsTrue(tlf.Signature.ReturnType is SwiftClassType, "is swift class type");
        }
        public void DecomposeGlobalAddressor()
        {
            var func = "_$s17unitHelpFrawework7aGlobalSbvau";
            var tlf  = Decomposer.Decompose(func, false) as TLUnsafeMutableAddressor;

            Assert.IsNotNull(tlf, "tlf");
            Assert.IsNotNull(tlf.OfType, "OfType");
        }
        public void DecomposeStructConstructor()
        {
            var func = "_$s17unitHelpFrawework7AStructVACycfC";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.IsTrue(tlf.Signature is SwiftConstructorType, "is constructor");
        }
        public void DecomposeFieldOffset()
        {
            var func = "_$s17unitHelpFrawework24AKVariableDelayAudioUnitC12rampDurationSdvpWvd";
            var tlf  = Decomposer.Decompose(func, false) as TLFieldOffset;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual("rampDuration", tlf.Identifier.Name, "name");
        }
        public void DecomposeModuleDescriptor()
        {
            var func = "_$s8itsAFiveMXM";
            var tlf  = Decomposer.Decompose(func, false) as TLModuleDescriptor;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual("itsAFive", tlf.Module.Name);
        }
        public void DecomposeVariable1()
        {
            var func = "_$s17unitHelpFrawework12callbackUgenSo8NSObjectCvp";
            var tlf  = Decomposer.Decompose(func, false) as TLVariable;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual("callbackUgen", tlf.Name.Name, "name match");
        }
        public void DecomposeCurryThunk()
        {
            var func = "_$s17unitHelpFrawework13AKAudioPlayerV25internalCompletionHandler33_3D85A716E8AC30D62D97E78DB643A23DLLyyFTc";
            var tlf  = Decomposer.Decompose(func, false) as TLThunk;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual(ThunkType.Curry, tlf.Thunk, "curry thunk");
        }
        public void DecomposeMetaclass()
        {
            var func = "_$s8AudioKit11AKOperationCMm";
            var mc   = Decomposer.Decompose(func, false) as TLMetaclass;

            Assert.IsNotNull(mc, "mc");
            Assert.AreEqual("AudioKit.AKOperation", mc.Class.ClassName.ToFullyQualifiedName(true));
        }
        public void DecomposeGenericWithConstraints()
        {
            var func = "_$s17unitHelpFrawework03ChaD0V6reseed4withyx_tSTRzs6UInt32V7ElementRtzlF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "Failed to decompose function");
            Assert.AreEqual(1, tlf.Signature.GenericArguments.Count, "Expected 1 generic argument");
            Assert.AreEqual(2, tlf.Signature.GenericArguments [0].Constraints.Count, "Expected 2 generic constraints");
        }
        public void DecomposeMultiProtoConstraints()
        {
            var func = "_$s17unitHelpFrawework16xamarin_FooDuppy3foo1ayAA0E0CyxG_xtAA6DownerRzAA5UpperRzlF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual(1, tlf.Signature.GenericArguments.Count, "genric argument count");
            Assert.AreEqual(2, tlf.Signature.GenericArguments [0].Constraints.Count, "constraints count");
        }
        public void DecomposeFuncArgInitializer()
        {
            var func = "_$s17unitHelpFrawework10AKMIDINodeC10enableMIDI4port4nameys6UInt32V_SStFfA_";
            var init = Decomposer.Decompose(func, false) as TLDefaultArgumentInitializer;

            Assert.IsNotNull(init, "init");
            Assert.AreEqual(0, init.ArgumentIndex, "argument index");
            Assert.IsTrue(init.Signature is SwiftUncurriedFunctionType, "uncurried function");
        }
        public void DecomposeFuncArgInitializer1()
        {
            var func = "_$s17unitHelpFrawework10AKMIDINodeC11createError33_3D85A716E8AC30D62D97E78DB643A23DLL7message4codeSo7NSErrorCSS_SitFfA0_";
            var init = Decomposer.Decompose(func, false) as TLDefaultArgumentInitializer;

            Assert.IsNotNull(init, "init");
            Assert.AreEqual(1, init.ArgumentIndex, "argument index");
            Assert.IsTrue(init.Signature is SwiftUncurriedFunctionType, "uncurried function");
        }
        public void DecomposeMultiGeneric()
        {
            var func = "_$s17unitHelpFrawework3foo1a1b1c1dyx_q_q0_q1_tr2_lF";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual(4, tlf.Signature.ParameterCount, "parameter count");
            Assert.IsTrue(tlf.Signature.ContainsGenericParameters, "contains generic parameters");
            Assert.AreEqual(4, tlf.Signature.GenericArguments.Count(), "generic argument count");
        }
        public void DecomposeStaticProp()
        {
            var func = "_$s17unitHelpFrawework11aFinalClassC11aStaticPropSbvpZ";

            var tlv = Decomposer.Decompose(func, false) as TLVariable;

            Assert.IsNotNull(tlv, "tlv");
            Assert.IsTrue(tlv.IsStatic, "IsStatic");
            Assert.IsNotNull(tlv.Class, "Class");
        }
        public void DecomposeStaticVariable()
        {
            var func = "_$s8AudioKit10AKBalancerC20ComponentDescriptionSSvpZ";
            var tlf  = Decomposer.Decompose(func, false) as TLVariable;

            Assert.IsNotNull(tlf, "tlf");
            Assert.AreEqual("AudioKit.AKBalancer", tlf.Class.ClassName.ToFullyQualifiedName(true));
            Assert.AreEqual("ComponentDescription", tlf.Name.Name);
            Assert.IsTrue(tlf.IsStatic);
        }
        public void DecomposePrivateNameProp()
        {
            var func = "_$s17unitHelpFrawework11AKPinkNoiseC10internalAU33_3D85A716E8AC30D62D97E78DB643A23DLLSivg";
            var tlf  = Decomposer.Decompose(func, false) as TLFunction;

            Assert.IsNotNull(tlf, "tlf");
            var prop = tlf.Signature as SwiftPropertyType;

            Assert.IsNotNull(prop.PrivateName, "PrivateName");
        }
    // Use this for initialization
    void Awake()
    {
        this.draw = false;
        this.navMesh = NavigationManager.Instance.NavMeshGraphs[0];
        this.character = new DynamicCharacter(this.characterAvatar)
        {
            Drag = DRAG,
            MaxSpeed = MAX_SPEED

        };
        this.bots = GameObject.FindGameObjectsWithTag("Bot");

        this.decomposer = new Decomposer(new NodeArrayAStarPathFinding(this.navMesh, new EuclideanDistanceHeuristic()));
        this.decomposer.searchAlgorithm.NodesPerSearch = 100;
    }
    // Use this for initialization
    private void Awake()
    {
        this.draw = true;
        NavMeshPathGraph navMesh = NavigationManager.Instance.NavMeshGraphs[0];

        this.character = new DynamicCharacter(this.characterAvatar);
        this.Pedestrians = new List<GameObject>(GameObject.FindGameObjectsWithTag("Pedestrian")).ConvertAll(p => new Pedestrian(p));

        // Targeter
        TargeterComponent = new Targeter(this);

        // Decomposer
        DecomposerComponent = new Decomposer(this, navMesh, this.character);

        // TargetCollisionConstraint
        PathConstraints = new List<IConstraint>();
        PathConstraints.Add(new PedestrianAvoidanceConstraint(this, character, this.Pedestrians));
        PathConstraints.Add(new PathValidityCheckConstraint(this.character));

        // Movement Constraints
        MovementConstraints = new List<IConstraint>();
        StaticObstacleConstraint obsConstraint = new StaticObstacleConstraint(character)
        {
            AvoidMargin = 10f
        };

        MovementConstraints.Add(obsConstraint);

        if (CharacterInUse.Equals(CharacterType.Car))
        {
            Actuator = new CarActuator(this.character);
        }
        else if (CharacterInUse.Equals(CharacterType.Human))
        {
            Actuator = new HumanActuator(this.character);
        }
    }