public EtcsBrakingData()
 {
     Input = new InputData();
     Middle = new MiddleData();
     Output = new OutputData();
     Params = new ConstantData();
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string line;
            System.IO.StreamReader file =
               new System.IO.StreamReader(@"D:\input\input1.txt");
            List<InputData> aInputList = new List<InputData>();
            ShiftManager aManager = new ShiftManager();
            while ((line = file.ReadLine()) != null)
            {
                InputData aData = new InputData();
                string[] input = line.Split(' ');
                aData.BSC = input[0];
                aData.BCF = input[1];
                aData.BTS = input[2];
                aData.TRX = input[3];
                aData.PCM = input[4];
                aData.PCMTsl = input[5];
                aData.LAPDName = input[6];
                aData.LAPDTSL = input[7];
                aData.LAPDSSL = input[8];

                aInputList.Add(aData);
            }

            aManager.TRXshifter(aInputList);
        }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        // 종료 처리
        if (Input.GetKey(KeyCode.Escape)
            || Input.GetKey(KeyCode.Home)
            || Input.GetKey(KeyCode.Menu))
        {
            //Application.Quit();
            SendMessage("ApplicationQuit");
        }

        // 터치
        if (Input.GetMouseButtonDown(0))
        {
            InputData kInputData = new InputData();
            kInputData.nTouchCount = Input.touchCount;
            kInputData.tmTouchPosition.Add(0, Input.mousePosition);
            SendMessage("InputTouch", kInputData, SendMessageOptions.RequireReceiver);
        }

        if (Input.GetKeyDown(KeyCode.X))
        {
            SendMessage("KeyDownDefend");
        }
    }
		public ThermalСalculationPage()
		{
			InitializeComponent();
			_inputData = MainWindow.DrawInputData(InputDataGrid, ReportKind.Thermal);
			App.CurrentEngineType = EngineType.Petrol;
			MainWindow.UpdateInputData(InputDataGrid, App.CurrentEngineType, _inputData);
		}
        public void PushesInput()
        {
            TimeSpan loopDuration = TimeSpan.FromMilliseconds(IterationMilliseconds);

            var c = new SimulationDAQController(loopDuration) { Clock = new FakeClock() };

            IOutputData expectedOutput;
            DAQOutputStream outStream;
            DAQInputStream inStream;
            SetupInputPipeline(c, out expectedOutput, out outStream, out inStream);

            c.SimulationRunner = (IDictionary<IDAQOutputStream, IOutputData> output, TimeSpan timeStep) =>
            {
                var inputData = new Dictionary<IDAQInputStream, IInputData>(1);
                expectedOutput = output[outStream];
                inputData[inStream] = new InputData(expectedOutput.Data, expectedOutput.SampleRate, DateTimeOffset.Now);

                return inputData;
            };

            c.ProcessIteration += (controller, evtArgs) => ((IDAQController)controller).Stop();
            bool stopped = false;
            c.Stopped += (controller, evtArgs) =>
                             {
                                 stopped = true;
                             };
            c.Start(false);
            Thread.Sleep(500);

            var actualInput = ((TestDevice)outStream.Device).InputData.ContainsKey(inStream) ? ((TestDevice)outStream.Device).InputData[inStream].First() : null;

            Assert.That(actualInput, Is.Not.Null);
            Assert.That(actualInput.Data, Is.EqualTo(expectedOutput.Data));
        }
Ejemplo n.º 6
0
        public void ShouldBitShiftAndMaskPushedInputData()
        {
            Converters.Clear();

            var controller = new NIDAQController();
            var s = new NIDigitalDAQInputStream("IN", controller);
            controller.SampleRate = new Measurement(10000, 1, "Hz");

            TimeSpan duration = TimeSpan.FromSeconds(0.5);

            var devices = new List<TestDevice>();

            for (ushort bitPosition = 1; bitPosition < 32; bitPosition += 2)
            {
                TestDevice dev = new TestDevice();
                dev.BindStream(s);
                s.BitPositions[dev] = bitPosition;

                devices.Add(dev);
            }

            var data = new InputData(Enumerable.Range(0, 10000).Select(i => new Measurement((short)(i % 2 * 0xaaaa), Measurement.UNITLESS)).ToList(),
                s.SampleRate, DateTime.Now);

            s.PushInputData(data);
            s.PushInputData(data);

            var expected = Enumerable.Range(0, 10000).Select(i => new Measurement(i % 2, Measurement.UNITLESS)).ToList();
            foreach (var ed in devices)
            {
                Assert.AreEqual(expected, ed.InputData[s].ElementAt(0).Data);
                Assert.AreEqual(expected, ed.InputData[s].ElementAt(1).Data);
            }
        }
		public ReporterWindow(InputData data, ReportKind reportKind)
		{
			InitializeComponent();
			_inputData = data;
			_currentRepot = CurrentDataReport.OutputDataReport;
			_reportKind = reportKind;
		}
Ejemplo n.º 8
0
	public bool Serialize(InputData data)
	{
		// 기존 데이터를 클리어합니다.
		Clear();
		
		// 각 요소를 차례로 시리얼라이즈합니다.
		bool ret = true;
		ret &= Serialize(data.count);	
		ret &= Serialize(data.flag);

		MouseSerializer mouse = new MouseSerializer();
		
		for (int i = 0; i < data.datum.Length; ++i) {
			mouse.Clear();
			bool ans = mouse.Serialize(data.datum[i]);
			if (ans == false) {
				return false;
			}
			
			byte[] buffer = mouse.GetSerializedData();
			ret &= Serialize(buffer, buffer.Length);
		}
		
		return ret;
	}
Ejemplo n.º 9
0
        FSharpOption<MatchResult> MatchSingleQuoteString(InputData data) {
			if(data.Head.Value == "'") {
				var sourceLocation = data.Head.Source;
				var sb = new StringBuilder();
				data = data.Tail;


				while(true) {
					if(data.IsEmpty) {
                        throw new UnexpectedEndOfFileException();
                    }

					if(data.Head.Value == "'") {
						var next = data.Tail;
						if(next.IsCons && next.Head.Value == "'") {
							sb.Append("'");
							data = next.Tail;
						}
						else {
							var token = new Token.StringValue(sourceLocation, new Token.StringValue.StringPart(sb.ToString()));
							return MatchToken(token, data.Tail);
						}
					}
					else {
						sb.Append(data.Head.Value);
						data = data.Tail;
					}
				}
			}
			else {
				return FSharpOption<MatchResult>.None;
			}
		}
 void Start()
 {
     if (Application.loadedLevel == SceneName.Title.ToInt()){
         act	=	transform.root.GetComponent<SceneLoadManager>().NextScene;
     }
     SoundManager.obj.PlayBGM(2,true);
     decIcons	=	0;
     length		=	transform.childCount;
     childObj	=	new GameObject[length];
     for(int i=0;i<length;i++){
         childObj[i]			=	transform.GetChild(i).gameObject;
         if(childObj[i]	==	null)					continue;
         if(iconCount == null)		iconCount	=	childObj[i].GetComponent<IconCount>();
         if(childObj[i].tag	!=	decTexture)	continue;
         decImage			=	childObj[i].GetComponent<Image>();
         decTrans			=	decImage.rectTransform;
         decTrans.localScale	=	Vector2.zero;
     }
     playMax		=	0;
     PlayerNum	=	4;
     input			=	new InputData[PlayerNum];
     for(int i = 0;i<PlayerNum;i++){
         input[i]		=	new InputData();
         InputPad.InputData(ref input[i], i+1);
     }
 }
Ejemplo n.º 11
0
    void Start()
    {
        touchManager = GetComponent<TouchManager>();

        for (int i = 0; i < input.Length; i++) {
            input[i] = new InputData();
        }
    }
Ejemplo n.º 12
0
 private static float Sine(InputData d)
 {
     return 0.50f +
     //				0.25f * Mathf.Sin(4 * Mathf.PI * p.x + 4 * t) * Mathf.Sin(2 * Mathf.PI * p.z + t) +
     //				0.10f * Mathf.Cos(3 * Mathf.PI * p.x + 5 * t) * Mathf.Cos(5 * Mathf.PI * p.z + 3 *t) +
     //				0.15f * Mathf.Sin(Mathf.PI * p.x + 0.6f * t);
         Mathf.Sin(d.p.x*10 +d.t*5) *.1f + Mathf.Sin(d.p.z*10+d.t*5) *.1f;
 }
Ejemplo n.º 13
0
 // Update is called once per frame
 void Update()
 {
     foreach( AbstractInputDevice device in myInputDevices)
     {
         device.HandleInput();
         // TODO: Sort through all of the input controllers and determine what the state of input should be...
         myCurrentInputData = device.Data;
     }
 }
Ejemplo n.º 14
0
 void Start()
 {
     GameDataObj = GameObject.Find ("GameDataObject") as GameObject;
     scorenum = GameDataObj.GetComponent<GameData> ().score;
     difficulty = GameDataObj.GetComponent<GameData> ().difficulty;
     GameDataObj.GetComponent<GameData> ().AlignScore (scorenum,difficulty);
     score.text = "Score:" + scorenum.ToString();
     indata = GameObject.Find ("Indata") as GameObject;
     indatacomp = indata.GetComponent<InputData> ();
 }
 private void DrawListElement(Rect rect, InputData data)
 {
     EditorGUI.BeginChangeCheck();
     GUI.Toggle(rect, data.m_Selected, EditorGUIUtility.TempContent(data.m_Name), s_Styles.menuItem);
     if (EditorGUI.EndChangeCheck())
     {
         this.m_Callback(data);
         base.Close();
     }
 }
Ejemplo n.º 16
0
 //[SerializeField]
 //GameObject Background;
 // Use this for initialization
 void Start()
 {
     GameDataObj = GameObject.Find ("GameDataObject") as GameObject;
     dotscale = GameDataObj.GetComponent<GameData> ().dotscale;
     transform.localScale = new Vector3(dotscale, dotscale, dotscale);
     MainSpriteRenderer = gameObject.GetComponent<SpriteRenderer>();
     tmpInfected = false;
     Infected = false;
     indata = GameObject.Find ("Indata") as GameObject;
     indatacomp = indata.GetComponent<InputData> ();
 }
Ejemplo n.º 17
0
        public OutputData GetOutputData(InputData inputData)
        {
            var result = new OutputData
            {
                Servers = inputData.Servers
            };

            // TODO: add some logic here

            return result;
        }
        private static string _currentlyOpenedFile = "Untitled.mml";                             // Открытый в данный момент файл

        /// <summary>
        /// Функция SaveFile(InputData inpDObj)
        /// 
        /// Сохраняет объект в файл. Введенные пользователем данные, сформированные в объект
        /// сохраняются в JSON формате
        /// </summary>
        /// <param name="inpDObj"></param>
        public async static Task SaveFile(InputData inpDObj)
        {
            if (inpDObj == null) return;                                                        // Если поступил null объект, выходим из функции
            if (_currentlyOpenedFile != "Untitled.mml")                                         // Если был открыт файл, перезаписываем в него
            {
                await OutputObjectToFile(inpDObj, _currentlyOpenedFile);                        // Выводим объект в этот файл
            }
            else                                                                                // Если нет, то
            {
                await SaveAsFile(inpDObj);                                                      // Действуем по аналогии с SaveAs
            }
        }
Ejemplo n.º 19
0
 void Start()
 {
     if (Application.loadedLevel == SceneName.Title.ToInt()){
         act	=	transform.root.GetComponent<SceneLoadManager>().NextScene;
     }
     PlayerNum	=	4;
     SoundManager.obj.PlayBGM(3,true);
     for(int i=0;i<PlayerNum;i++){
         input[i]	=	new InputData();
         InputPad.InputData(ref input[i], i+1);
     }
 }
Ejemplo n.º 20
0
    public void CreateAction()
    {
        var test = CSScript.CreateAction(@"using Tests;
                                           void Test(InputData data)
                                           {
                                               data.Index = 7;
                                           }");

        var data = new InputData();
        test(data);
        Assert.Equal(7, data.Index);
    }
Ejemplo n.º 21
0
 // Use this for initialization
 void Start()
 {
     E = GameObject.Find ("EASY") as GameObject;
     N = GameObject.Find ("NORMAL") as GameObject;
     H = GameObject.Find ("HARD") as GameObject;
     D = GameObject.Find ("GameDataObject") as GameObject;
     R = GameObject.Find ("RSELECT") as GameObject;
     L = GameObject.Find ("LSELECT") as GameObject;
     D.GetComponent<GameData> ().SetDifficulty (1);
     indata = GameObject.Find ("Indata") as GameObject;
     indatacomp = indata.GetComponent<InputData> ();
 }
Ejemplo n.º 22
0
 void setRemoteInput(InputData input)
 {
     if (input.Accelerate!=null)
         character.Accelerate((float)input.Accelerate);
     if (input.Strafe!=null)
         character.Strafe((float)input.Strafe);
     if (input.Rotate!=null)
         character.Rotate((float)input.Rotate);
     if (input.Jump!=null)
         character.Jump((bool)input.Jump);
     if (input.Position!=null)
         character.gameObject.transform.position = (Vector3)input.Position;
 }
Ejemplo n.º 23
0
    public void LoadMethodStatic()
    {
        var Test = CSScript.LoadMethod(@"using Tests;
                                         static void Test(InputData data)
                                         {
                                             data.Index = 7;
                                         }")
                           .GetStaticMethodWithArgs("*.Test", typeof(InputData));

        var data = new InputData();
        Test(data);
        Assert.Equal(7, data.Index);
    }
 /// <summary>
 /// Функция SaveFile(InputData inpDObj)
 /// 
 /// Сохраняет объект в файл, предложив окно сохранения. Введенные пользователем данные, сформированные в объект
 /// сохраняются в JSON формате
 /// </summary>
 /// <param name="inpDObj"></param>
 public async static Task SaveAsFile(InputData inpDObj)
 {
     var sdg = new Microsoft.Win32.SaveFileDialog                                    // Создаем диалоговое окно сохранения 
     {
         FileName = "Document",                                                      // Имя файла по умолчанию
         DefaultExt = ".mml",                                                        // Расширение файла по умолчанию
         Filter = "MM Data (.mml)|*.mml"                                             // Фильтр расширений файла
     };
     var result = sdg.ShowDialog();                                                  // Открывает диалоговое окно сохранения
     if (result != true) return;                                                     // Обрабатываем результат выполнения диалогового окна сохранения
     var filename = sdg.FileName;                                                    // Получаем имя файла, введенное пользователем
     await OutputObjectToFile(inpDObj, filename);                                    // Записываем объект в файл
     _currentlyOpenedFile = filename;                                                // Сохраняем имя файла
 }
Ejemplo n.º 25
0
	public static bool ParAndValidations2(InputData data,
	                                  Validation[] validators) {
		IAsyncResult[] ars = new IAsyncResult[validators.Length];

		for (int i = 0; i < validators.Length; ++i) {
			ars[i] = validators[i].BeginInvoke(data, null, null);
		}

		bool result = true;
		for (int i = 0; i < validators.Length; ++i) {
			result &= validators[i].EndInvoke(ars[i]);
		}
		
		return result;
	}
Ejemplo n.º 26
0
    public void CompileMethodStatic()
    {
        CSScript.EvaluatorConfig.Engine = EvaluatorEngine.Roslyn;

        var script = CSScript.RoslynEvaluator
                             .CompileMethod(@"using Tests;
                                                  static void Test(InputData data)
                                                  {
                                                      data.Index = 7;
                                                  }");
        InputData data = new InputData();
        var Test = script.GetStaticMethod("*.Test", data);

        Test(data);
        Assert.Equal(7, data.Index);
    }
Ejemplo n.º 27
0
		public static void UpdateInputData(Grid grid, EngineType engine, InputData data)
		{
			foreach (var child in grid.Children)
				if (child is TextBox)
					foreach (var key in data.Data.Keys)
						if (key == (child as TextBox).Name)
							if (data.Data[key].Engine.FindIndex(type => type == engine) < 0)
							{
								(child as TextBox).IsEnabled = false;
								(child as TextBox).Background = Brushes.Gray;
							}
							else
							{
								(child as TextBox).IsEnabled = true;
								(child as TextBox).Background = Brushes.White;
							}
		}
Ejemplo n.º 28
0
	public bool Deserialize(byte[] data, ref InputData serialized)
	{
		// 디시리얼라이즈할 데이터를 설정합니다.
		bool ret = SetDeserializedData(data);
		if (ret == false) {
			return false;
		}
		
		// 데이터 요소별로 디시리얼라이즈합니다.
		ret &= Deserialize(ref serialized.count);
		ret &= Deserialize(ref serialized.flag);

		// 디시리얼라이즈 후의 버퍼 크기를 구합니다.
		MouseSerializer mouse = new MouseSerializer();
		MouseData md = new MouseData();
		mouse.Serialize(md);
		byte[] buf= mouse.GetSerializedData();
		int size = buf.Length;
		
		serialized.datum = new MouseData[serialized.count];
		for (int i = 0; i < serialized.count; ++i) {
			serialized.datum[i] = new MouseData();
		}
		
		for (int i = 0; i < serialized.count; ++i) {
			byte[] buffer = new byte[size];
			
			// mouseData의11프레임분의 데이터를 추출합니다.
			bool ans = Deserialize(ref buffer, size);
			if (ans == false) {
				return false;
			}

			ret &= mouse.Deserialize(buffer, ref md);
			if (ret == false) {
				return false;
			}
			
			serialized.datum[i] = md;
		}
		
		return ret;
	}
Ejemplo n.º 29
0
	public static bool ParAndValidations1(InputData data, Validation[] validators) {
		ManualResetEvent done = new ManualResetEvent(false);
		int count = 0;
		bool finalResult = true;
		foreach (Validation v in validators) {
			Validation validator = v;
			ThreadPool.QueueUserWorkItem((_) => {
				bool res = validator(data);
				
				if (!res)
					finalResult = false;
				
				if (Interlocked.Increment(ref count) == validators.Length)
					done.Set(); 
			});
		}
		done.WaitOne();
		return finalResult;
	}
Ejemplo n.º 30
0
        private void ReadFunc()
        {
            string input = "";
            InputData sendData;

            while (true)
            {
                if (_output != null)
                {
                    input = _output.ReadLine();
                }

                if (input != "")
                {
                    sendData = new InputData();
                    sendData.Data = input;

                    outPut(this, sendData);
                }
            }
        }
Ejemplo n.º 31
0
        private static Texture2D CreateIconWithMipLevels(InputData inputData, string baseName, List <string> assetPathsOfAllIcons, Dictionary <int, Texture2D> mipTextures)
        {
            List <string>    allMipPaths = assetPathsOfAllIcons.FindAll(o => o.IndexOf('/' + baseName + inputData.mipIdentifier, StringComparison.Ordinal) >= 0);
            List <Texture2D> allMips     = new List <Texture2D>();

            foreach (string path in allMipPaths)
            {
                int mipLevel = MipLevelForAssetPath(path, inputData.mipIdentifier);

                Texture2D mip;
                if (mipTextures != null && mipTextures.ContainsKey(mipLevel))
                {
                    mip = mipTextures[mipLevel];
                }
                else
                {
                    mip = GetTexture2D(path);
                }

                if (mip != null)
                {
                    allMips.Add(mip);
                }
                else
                {
                    Debug.LogError("Mip not found " + path);
                }
            }

            // Sort the mips by size (largest mip first)
            allMips.Sort(delegate(Texture2D first, Texture2D second)
            {
                if (first.width == second.width)
                {
                    return(0);
                }
                else if (first.width < second.width)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            });

            int minResolution = 99999;
            int maxResolution = 0;

            foreach (Texture2D mip in allMips)
            {
                int width = mip.width;
                if (width > maxResolution)
                {
                    maxResolution = width;
                }
                if (width < minResolution)
                {
                    minResolution = width;
                }
            }

            if (maxResolution == 0)
            {
                return(null);
            }

            // Create our icon
            Texture2D iconWithMips = new Texture2D(maxResolution, maxResolution, TextureFormat.RGBA32, true, false);

            // Add max mip
            if (BlitMip(iconWithMips, allMips, 0))
            {
                iconWithMips.Apply(true);
            }
            else
            {
                return(iconWithMips); // ERROR
            }
            // Keep for debugging
            //Debug.Log ("Processing max mip file: " + inputData.GetMipFileName (baseName, maxResolution) );

            // Now add the rest
            int resolution = maxResolution;

            for (int i = 1; i < iconWithMips.mipmapCount; i++)
            {
                resolution /= 2;
                if (resolution < minResolution)
                {
                    break;
                }

                BlitMip(iconWithMips, allMips, i);
            }
            iconWithMips.Apply(false, true);


            return(iconWithMips);
        }
Ejemplo n.º 32
0
    // 수신.
    public void ReceiveInputData()
    {
        byte[] data = new byte[1400];

        // 데이터를 송신합니다.
        int recvSize = m_transport.Receive(ref data, data.Length);

        if (recvSize < 0)
        {
            // 입력정보를 수신하지 않았으므로 다음 프레임을 처리할 수 없습니다.
            return;
        }

        string str = System.Text.Encoding.UTF8.GetString(data);

        if (requestData.CompareTo(str.Trim('\0')) == 0)
        {
            // 접속 요청 패킷 .
            return;
        }

        // byte 배열을 구조체로 변환합니다.
        InputData       inputData  = new InputData();
        InputSerializer serializer = new InputSerializer();

        serializer.Deserialize(data, ref inputData);

        // 수신한 입력 정보를 설정합니다.
        PlayerInfo info     = PlayerInfo.GetInstance();
        int        playerId = info.GetPlayerId();
        int        opponent = (playerId == 0)? 1 : 0;

        for (int i = 0; i < inputData.count; ++i)
        {
            int frame = inputData.datum[i].frame;
            //Debug.Log("Set inputdata"+i+"[" + recvFrame + "][" + frame + "]:" + (recvFrame + 1 == frame));
            if (recvFrame + 1 == frame)
            {
                inputBuffer[opponent].Add(inputData.datum[i]);
                ++recvFrame;
            }
        }
        //Debug.Log("recvFrame:" + recvFrame);

        // 접속 종료 플래그를 감시.  bit1:접속 종료 응답, bit0: 접속 종료 요구.
        if ((inputData.flag & 0x03) == 0x03)
        {
            // 접속 종료 플래그 수신.
            suspendSync = 0x03;
            Debug.Log("Receive SuspendSync.");
        }

        if ((inputData.flag & 1) > 0 && (suspendSync & 1) > 0)
        {
            suspendSync |= 0x02;
            Debug.Log("Receive SuspendSync." + inputData.flag);
        }

        if (isConnected && suspendSync == 0x03)
        {
            // 서로 접속 종료 상태가 되었으므로 상대에게의 접속 종료 플래그를 보내기위한.
            // 유예기간을 두고 조금 후에 접속종료합니다.
            ++disconnectCount;
            if (disconnectCount > 10)
            {
                m_transport.Disconnect();
                Debug.Log("Disconnect because of suspendSync.");
            }
        }


        // 상태 갱신.
        if (syncState == SyncState.NotStarted)
        {
            syncState = SyncState.WaitSynchronize;
        }

        //loopCounter = 0;
    }
Ejemplo n.º 33
0
 public ImageDescriptionViewModel(InputData data, byte[] image)
 {
     _data     = data;
     ByteArray = image;
 }
 public override string ToString()
 {
     return(InputData.ToString());
 }
        static void Start(string[] args)
        {
            InputData  inputData = IoHandler.GetParameters(args);
            IParser    parser    = new Parser(inputData);
            GaSettings settings  = parser.ParseSettings();
            Ga         algorithm;

            switch (settings.Type)
            {
            case AlgorithmType.Generation:
                algorithm = new GenerationGa(parser);
                break;

            case AlgorithmType.Elimination:
                algorithm = new EliminationGa(parser);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Genome bestSolution = algorithm.Start();

            Console.WriteLine("\n____________Proces is finished____________\n");
            if (bestSolution != null)
            {
                Console.Write("Best result is: " + bestSolution.Fitness + ", with parameters: ");
                PrintParameters(bestSolution.Genes);
            }
            Console.WriteLine("\n____________Classification____________\n");
            algorithm.Test(out double[][] givenClasses, out double[][] expectedOutput);
            bool[] correct = new bool[expectedOutput.Length];
            for (int i = 0; i < expectedOutput.Length; i++)
            {
                correct[i] = true;
                Console.Write("Expected classes: ");
                for (int j = 0; j < expectedOutput[i].Length; j++)
                {
                    Console.Write(expectedOutput[i][j].ToString("G0") + " ");
                }
                Console.Write("\tGiven classes: ");
                for (int j = 0; j < givenClasses[i].Length; j++)
                {
                    Console.Write(givenClasses[i][j].ToString("G0") + " ");
                    if (!(Math.Abs(expectedOutput[i][j] - givenClasses[i][j]) < double.Epsilon))
                    {
                        correct[i] = false;
                    }
                }
                Console.WriteLine(correct[i] ? "\tCorrect classification." : "\tIncorrect classification.");
            }
            int correctlyClassified   = 0;
            int incorrectlyClassified = 0;

            for (int i = 0; i < correct.Length; i++)
            {
                if (correct[i])
                {
                    correctlyClassified++;
                }
                else
                {
                    incorrectlyClassified++;
                }
            }
            Console.WriteLine("Correctly classified samples: " + correctlyClassified + ", incorrectly classified: " + incorrectlyClassified);
        }
Ejemplo n.º 36
0
        public List <ChargePoint> Process(CoreReferenceData coreRefData)
        {
            this.ImportRefData = new CommonImportRefData(coreRefData);

            //whole file cleanup (broken newline in text)
            InputData = InputData.Replace("\n\";", "\";");

            var results   = InputData.Split('\n');
            var keyLookup = results[0].Replace("\r", "").Split(';').ToList();
            List <ChargePoint> outputList = new List <ChargePoint>();
            int rowIndex = 0;

            foreach (var row in results)
            {
                //skip first row or empty rows
                if (rowIndex > 0 && !String.IsNullOrEmpty(row))
                {
                    if (!(String.IsNullOrEmpty(row.Replace(";", "").Trim())))
                    {
                        var cols = row.Replace("\r", "").Replace(";", " ;").Split(';');
                        var poi  = new ChargePoint();

                        var title          = cols[keyLookup.FindIndex(a => a == "DESIGNACIÓ-DESCRIPTIVA")];
                        var usageType      = cols[keyLookup.FindIndex(a => a == "ACCES")];
                        var operatorName   = cols[keyLookup.FindIndex(a => a == "PROMOTOR-GESTOR")];
                        var speed          = cols[keyLookup.FindIndex(a => a == "TIPUS VELOCITAT")];
                        var connectionType = cols[keyLookup.FindIndex(a => a == "TIPUS CONNEXIÓ")];
                        var latitude       = cols[keyLookup.FindIndex(a => a == "LATITUD")];
                        var longitude      = cols[keyLookup.FindIndex(a => a == "LONGITUD")];

                        var reference      = cols[keyLookup.FindIndex(a => a == "IDE PDR")];
                        var address        = cols[keyLookup.FindIndex(a => a == "ADREÇA")];
                        var province       = cols[keyLookup.FindIndex(a => a == "PROVINCIA")];
                        var city           = cols[keyLookup.FindIndex(a => a == "MUNICIPI")];
                        var numStations    = cols[keyLookup.FindIndex(a => a == "NPLACES ESTACIÓ")];
                        var vehicleTypes   = cols[keyLookup.FindIndex(a => a == "TIPUS VEHICLE")];
                        var telephone      = cols[keyLookup.FindIndex(a => a == "TELEFON")];
                        var hours          = cols[keyLookup.FindIndex(a => a == "HORARI")];
                        var additionalInfo = cols[keyLookup.FindIndex(a => a == "INFORMACIÓ ADICIONAL")];

                        poi.DataProviderID         = DataProviderID;
                        poi.DataProvidersReference = reference;
                        poi.AddressInfo            = new AddressInfo();

                        poi.AddressInfo.Title        = title;
                        poi.AddressInfo.AddressLine1 = address.Trim();
                        poi.AddressInfo.Town         = city;
                        if (city != province)
                        {
                            poi.AddressInfo.StateOrProvince = province;
                        }
                        poi.AddressInfo.Latitude          = double.Parse(latitude);
                        poi.AddressInfo.Longitude         = double.Parse(longitude);
                        poi.AddressInfo.ContactTelephone1 = telephone;
                        poi.AddressInfo.AccessComments    = hours;
                        poi.GeneralComments = additionalInfo;

                        //TODO: Operator and Operators Reference

                        if (usageType.StartsWith("VIA PUBLICA"))
                        {
                            usageType = "VIA PUBLICA";
                        }
                        //resolve usage type
                        switch (usageType.Trim())
                        {
                        case "APARCAMENT PUBLIC":
                        case "VIA PUBLICA":
                        case "VIA PUBLICA -VORERA":
                            poi.UsageType = ImportRefData.UsageType_Public;
                            break;

                        case "APARCAMENT CC":
                            poi.UsageType = ImportRefData.UsageType_PublicPayAtLocation;
                            break;

                        default:
                            Log("Unknown Usage Type: " + usageType);
                            break;
                        }

                        //parse equipment info
                        var stations = numStations.Split('+');
                        if (String.IsNullOrWhiteSpace(numStations))
                        {
                            stations = new string[] { "1" }
                        }
                        ;                                                                            //blank, default to 1
                        var connectionTypes = connectionType.Split('+');

                        foreach (var c in connectionTypes)
                        {
                            if (poi.Connections == null)
                            {
                                poi.Connections = new List <ConnectionInfo>();
                            }

                            var connection = new ConnectionInfo();

                            //connection.Quantity = int.Parse(ns.Trim());

                            switch (c.ToLower().Trim())
                            {
                            case "chademo":
                                connection.ConnectionTypeID = (int)StandardConnectionTypes.CHAdeMO;
                                break;

                            case "mennekes":
                            case "mennekes.m":
                                connection.ConnectionTypeID = (int)StandardConnectionTypes.MennekesType2;
                                break;

                            case "schuko":
                            case "mennekes.f":
                                connection.ConnectionTypeID = (int)StandardConnectionTypes.Schuko;
                                break;

                            case "ccs combo2":
                                connection.ConnectionTypeID = (int)StandardConnectionTypes.CCSComboType2;
                                break;

                            case "j1772":
                                connection.ConnectionTypeID = (int)StandardConnectionTypes.J1772;
                                break;

                            default:
                                Log("Unknown Connection Type: " + c);
                                break;
                            }

                            poi.StatusTypeID = (int)StandardStatusTypes.Operational;
                            //level/status
                            switch (speed.Trim())
                            {
                            case "NORMAL":
                            case "semiRAPID i NORMAL":     //low quality description, default to lowest spec
                            case "semiRAPID":
                                connection.LevelID       = 2;
                                connection.Voltage       = 220;
                                connection.Amps          = 32;
                                connection.PowerKW       = (connection.Voltage * connection.Amps) / 1000;
                                connection.CurrentTypeID = (int)StandardCurrentTypes.SinglePhaseAC;
                                connection.StatusTypeID  = (int)StandardStatusTypes.Operational;
                                break;

                            case "RAPID":
                            case "superRAPID":
                                connection.LevelID       = 3;
                                connection.Voltage       = 400;
                                connection.Amps          = 100;
                                connection.PowerKW       = (connection.Voltage * connection.Amps) / 1000;
                                connection.CurrentTypeID = (int)StandardCurrentTypes.DC;
                                connection.StatusTypeID  = (int)StandardStatusTypes.Operational;
                                break;

                            case "FORA DE SERVEI":
                                connection.StatusTypeID = (int)StandardStatusTypes.NotOperational;
                                poi.StatusTypeID        = (int)StandardStatusTypes.NotOperational;
                                break;

                            case "DESMANTELLADA":
                                connection.StatusTypeID = (int)StandardStatusTypes.RemovedDecomissioned;
                                poi.StatusTypeID        = (int)StandardStatusTypes.RemovedDecomissioned;
                                break;

                            default:
                                Log("Unknown Speed Type: " + speed);
                                break;
                            }
                            poi.Connections.Add(connection);
                        }

                        //vehicle type metadata:
                        poi.MetadataValues = new List <MetadataValue>();

                        if (vehicleTypes.Contains("cotxe"))
                        {
                            poi.MetadataValues.Add(new MetadataValue {
                                MetadataFieldID = (int)StandardMetadataFields.VehicleType, MetadataFieldOptionID = (int)StandardMetadataFieldOptions.Car
                            });
                        }

                        if (vehicleTypes.Contains("moto"))
                        {
                            poi.MetadataValues.Add(new MetadataValue {
                                MetadataFieldID = (int)StandardMetadataFields.VehicleType, MetadataFieldOptionID = (int)StandardMetadataFieldOptions.Motorbike
                            });
                        }

                        if (vehicleTypes.Contains("mercaderies"))
                        {
                            poi.MetadataValues.Add(new MetadataValue {
                                MetadataFieldID = (int)StandardMetadataFields.VehicleType, MetadataFieldOptionID = (int)StandardMetadataFieldOptions.DeliveryVehicle
                            });
                        }

                        //TODO: get status of first equipment item and use that as status for overall poi

                        if (poi.DataQualityLevel == null)
                        {
                            poi.DataQualityLevel = 2;
                        }

                        poi.SubmissionStatus = ImportRefData.SubmissionStatus_Imported;

                        outputList.Add(poi);
                    }
                }
                rowIndex++;
            }
            return(outputList);
        }
    }
Ejemplo n.º 37
0
 internal TheoristFunction(InputData inSampleData, DateTime startTime, EstimationFunctionType estFunctionType, Account acc, StratergyParameterRange range)
     : base(inSampleData, startTime, estFunctionType, acc, range)
 {
 }
Ejemplo n.º 38
0
 void Awake()
 {
     im   = GetComponent <InputManager>();
     data = new InputData(im.axisCount, im.buttonCount);
 }
Ejemplo n.º 39
0
 public static bool IsTypeValid(InputData _input, OutputData _output)
 {
     return((_input != null && _output != null) && (_input.Type == _output.Type || (_input.Type == ANY && _output.Type != GENERIC) || (_input.Type != GENERIC && _output.Type == ANY) || (_input.Type != ANY && _output.Type == GENERIC) || (_input.Type == GENERIC && _output.Type != ANY)));
 }
Ejemplo n.º 40
0
 public abstract void ReadInput(InputData data);
Ejemplo n.º 41
0
 //入力
 public void AddInput(InputData input)
 {
     //_inputNumber = input.number;
     AddBullet(input);
 }
Ejemplo n.º 42
0
 void Awake()
 {
     Data = new InputData();
 }
Ejemplo n.º 43
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            var seq = 0;

            builder.OpenElement(seq, "figure");
            builder.AddAttribute(++seq, "class", "line-chart");
            builder.OpenElement(++seq, "div");
            builder.AddAttribute(++seq, "class", "main");


            System.Diagnostics.Debug.WriteLine("ID" + InputData);

            string[] inputDataArrX  = InputData.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
            string[] inputLabelsArr = InputLabels.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            int numLines = 0;

            System.Diagnostics.Debug.WriteLine("Start");
            foreach (string inputLine in inputDataArrX)
            {
                if (inputLine.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) >= 0)
                {
                    numLines++;
                }
            }
            System.Diagnostics.Debug.WriteLine("End");
            string[] inputDataArr = new string[numLines];
            int      lineCounter  = 0;

            foreach (string inputLine in inputDataArrX)
            {
                if (inputLine.IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) >= 0)
                {
                    inputDataArr[lineCounter++] = inputLine;
                    System.Diagnostics.Debug.WriteLine("IL:" + inputLine);
                }
            }

            string[] colors = { "#ce4b99", "#27A844", "#377bbc" };
            string[] labels = { "App Store", "Website", "Partners" };

            double boundHeight = 150.0;
            double boundWidth  = 150.0;

            SVG svg = new SVG()
            {
                { "width", "100%" }, { "height", "100%" }, { "viewBox", "0 0 150 150" }
            };
            //Rectangle rect = new Rectangle() { { "class", "background-rect" }, { "width", "100%" }, { "height", "100%" }, { "fill", "white" }, { "stroke", "gray" }, {"stroke-width", "0.5" } };
            //Rectangle rect = new Rectangle() { { "width", "100%" }, { "height", "100%" }, { "fill", "cyan" }};
            Rectangle rect = new Rectangle()
            {
                { "class", "background-rect" }
            };

            svg.AddItems(rect);


            int    numHorizontalLines   = 10;
            int    numVerticalLines     = 10;
            double verticalStartSpace   = 25.0;
            double horizontalStartSpace = 25.0;
            double verticalEndSpace     = 25.0;
            double horizontalEndSpace   = 25.0;
            double gridYUnits           = 10;
            double gridXUnits           = 10;
            //bool skipLastVerticalLine = true;
            //bool skipLastHorizontalLine = true;

            double verticalSpace   = (boundHeight - verticalStartSpace - verticalEndSpace) / (numHorizontalLines);
            double horizontalSpace = (boundWidth - horizontalStartSpace - horizontalEndSpace) / (numVerticalLines);

            double totalGridWidth  = ((double)(numVerticalLines - 1)) * horizontalSpace;
            double totalGridHeight = ((double)(numHorizontalLines - 1)) * verticalSpace;

            System.Diagnostics.Debug.WriteLine("TotalGridHeight:" + totalGridHeight + ":" + verticalSpace);

            //Horizontal Lines
            double y          = verticalStartSpace;
            double startGridY = 0;

            for (int counter = 0; counter <= numHorizontalLines; counter++)
            {
                //if (counter == numHorizontalLines - 1 && skipLastHorizontalLine)
                //    continue;

                Path path = new Path()
                {
                    { "class", "horizontal-grid-lines" }, { "d", "M " + horizontalStartSpace.ToString() + " " + (boundHeight - y).ToString() + " L " + (boundWidth - horizontalEndSpace).ToString() + " " + (boundHeight - y).ToString() }
                };
                Text label = new Text()
                {
                    { "class", "y-axis-labels" }, { "x", (horizontalStartSpace - 2).ToString() }, { "y", (boundHeight - y).ToString() }, { "content", (startGridY).ToString() }
                };
                svg.AddItems(path, label);
                System.Diagnostics.Debug.WriteLine("Y:" + y);

                y          = y + verticalSpace;
                startGridY = startGridY + gridYUnits;
            }

            //Chart Line
            double gridx = 0, gridy = 0;

            gridx = horizontalStartSpace;
            gridy = boundHeight - verticalStartSpace;
            int colorcounter = 0;

            foreach (string iData in inputDataArr)
            {
                string chartLine  = "";
                double gridValueX = 0;
                double gridValueY = 0;
                bool   firstTime  = true;

                string[] inputLineArr = iData.Split(',');
                int[]    intAry       = new int[inputLineArr.Length];
                for (int i = 0; i < inputLineArr.Length; i++)
                {
                    intAry[i] = int.Parse(inputLineArr[i]);
                }

                foreach (int i in intAry)
                {
                    if (firstTime)
                    {
                        chartLine  = chartLine + "M ";
                        firstTime  = false;
                        gridValueX = horizontalStartSpace;
                        gridValueY = verticalStartSpace;
                        double gridValue = ((double)i) * verticalSpace / gridYUnits;
                        gridValueY = boundHeight - (gridValueY + gridValue);
                        chartLine  = chartLine + gridValueX.ToString() + " " + gridValueY.ToString();
                    }
                    else
                    {
                        chartLine  = chartLine + " L ";
                        gridValueX = gridValueX + horizontalSpace;
                        gridValueY = verticalStartSpace;
                        double gridValue = ((double)i) * verticalSpace / gridYUnits;
                        gridValueY = boundHeight - (gridValueY + gridValue);
                        chartLine  = chartLine + gridValueX.ToString() + " " + gridValueY.ToString();
                    }
                }
                //System.Diagnostics.Debug.WriteLine("CL:" + chartLine);
                // Path linepath = new Path() { { "fill", "none" }, { "stroke", colors[colorcounter++] }, { "stroke-width", "1.0" }, { "d", chartLine } };
                Path linepath = new Path()
                {
                    { "class", "line-" + (colorcounter + 1).ToString() }, { "d", chartLine }
                };
                colorcounter++;
                svg.AddItems(linepath);
            }

            //Vertical Lines
            double x          = horizontalStartSpace;
            double startGridX = 0;

            for (int counter = 0; counter <= numVerticalLines; counter++)
            {
                //if (counter == numVerticalLines - 1 && skipLastVerticalLine)
                //    continue;

                Path path = new Path()
                {
                    { "class", "vertical-grid-lines" }, { "d", "M " + x.ToString() + " " + (boundHeight - verticalStartSpace).ToString() + " L " + x.ToString() + " " + (verticalEndSpace).ToString() }
                };
                Text label = new Text()
                {
                    { "class", "x-axis-labels" }, { "x", x.ToString() }, { "y", (boundHeight - verticalStartSpace + 5).ToString() }, { "content", (startGridX).ToString() }
                };
                startGridX = startGridX + gridXUnits;

                svg.AddItems(path, label);
                x = x + horizontalSpace;
            }

            BlazorRenderer blazorRenderer = new BlazorRenderer();

            blazorRenderer.Draw(seq, builder, svg);

            builder.OpenElement(++seq, "figcaption");
            builder.AddAttribute(++seq, "class", "key");
            builder.OpenElement(++seq, "ul");
            builder.AddAttribute(++seq, "class", "key-list");
            //builder.AddAttribute(++seq, "aria-hidden", "true");
            //builder.AddAttribute(++seq, "style", "list-style-type: none;");

            colorcounter = 0;
            foreach (string iData in inputDataArr)
            {
                //int data = int.Parse(dataStr);
                builder.OpenElement(++seq, "li");
                builder.OpenElement(++seq, "span");
                builder.AddAttribute(++seq, "class", "legend-" + (colorcounter + 1).ToString());
                //builder.AddAttribute(++seq, "style", "background-color:" + colors[colorcounter]);

                builder.CloseElement();

                string label = "";
                if (colorcounter < inputLabelsArr.Length)
                {
                    label = inputLabelsArr[colorcounter];
                }

                builder.AddContent(++seq, label);
                builder.CloseElement();
                colorcounter++;
            }

            builder.CloseElement();
            builder.CloseElement();


            builder.CloseElement();
            builder.CloseElement();
        }
Ejemplo n.º 44
0
 ///////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// receives InputData when a gamepad/keyboard/mouse input is pressed
 /// </summary>
 ///////////////////////////////////////////////////////////////////////////////////////////////
 void Pressed(InputData _data)
 {
     //your code here
 }
    public void Detect()
    {
        double[] input  = null;
        double   scale  = 0;
        double   tuning = 0;

        if (InputData.GetType().Name == "Double[]")
        {
            input = (double[])InputData;
        }
        if (InputArgs.ContainsKey("SCALE"))
        {
            if (InputArgs["SCALE"].GetType().Name == "Double")
            {
                scale = (double)InputArgs["SCALE"];
            }
        }
        if (InputArgs.ContainsKey("TUNING"))
        {
            if (InputArgs["TUNING"].GetType().Name == "Double")
            {
                tuning = (double)InputArgs["TUNING"];
            }
        }
        if (input == null || scale == 0)
        {
            return;
        }

        Dictionary <double, double> output = new Dictionary <double, double>();
        double spectAvg       = input.Average();
        double spectMax       = input.Max();
        int    notesPerOctave = 12;
        double minFreq        = double.Parse(Settings["MIN_FREQ"][0]) + (tuning * double.Parse(Settings["MIN_FREQ"][0]) / 100);

        double[] noteFreqs = new double[notesPerOctave * int.Parse(Settings["OCTAVES"][0])];
        for (int i = 0; i < noteFreqs.Length; i++)
        {
            noteFreqs[i] = minFreq * Math.Pow(2, (double)i / notesPerOctave);
        }

        double prevMag  = 0;
        double prevFreq = 0;

        for (int i = 0; i < noteFreqs.Length; i++)
        {
            int inputIndex  = (int)Math.Round(noteFreqs[i] * scale) - 1;
            int clusterSize = 0;
            while (clusterSize / scale <= noteFreqs[i] / 100 * double.Parse(Settings["FREQ_TOLERANCE"][0]))
            {
                clusterSize++;
            }

            if (inputIndex + clusterSize > input.Length)
            {
                break;
            }

            double avgMag = 0;
            double maxVal = 0, maxIndex = 0;
            for (int j = -clusterSize; j < clusterSize; j++)
            {
                avgMag += input[inputIndex + j];
                if (input[inputIndex + j] > maxVal)
                {
                    maxVal   = input[inputIndex + j];
                    maxIndex = inputIndex + j;
                }
            }
            avgMag /= 2 * clusterSize + 1;
            double maxFreq = maxIndex / scale;

            if (Math.Abs(prevMag - maxVal) > Math.Max(prevMag, maxVal) / 4 && noteFreqs[i] < 200)
            {
                if (prevMag - maxVal < 0)
                {
                    output.Remove(prevFreq);
                }
                else
                {
                    prevMag  = maxVal;
                    prevFreq = maxFreq;
                    continue;
                }
            }

            if (avgMag > spectAvg + ((spectMax - spectAvg) * double.Parse(Settings["MAG_THRESHOLD"][0])))
            {
                output[maxFreq] = maxVal;
            }
            prevMag  = maxVal;
            prevFreq = maxFreq;
            //Console.WriteLine("Note Freq: " + noteFreqs[i] + " Cluster Size: " + clusterSize + " Max Freq: " + (maxIndex / scale) + " Max Mag: " + maxVal);
        }
        output = output.OrderByDescending(x => x.Value).ToDictionary(x => x.Key, x => x.Value);
        Output = output.Take(int.Parse(Settings["MAX_VALS"][0])).ToDictionary(pair => pair.Key, pair => pair.Value);
    }
Ejemplo n.º 46
0
 ///////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// receives InputData when a gamepad/keyboard/mouse input is held
 /// </summary>
 ///////////////////////////////////////////////////////////////////////////////////////////////
 void Held(InputData _data)
 {
     //your code here
     timeHeld += Time.deltaTime;
     Debug.Log("Player 1 is charging up their fireball! (" + timeHeld + ")");
 }
Ejemplo n.º 47
0
Archivo: Key.cs Proyecto: idafi/heng
        /// <inheritdoc />
        public bool GetValue(InputData data)
        {
            Assert.Ref(data);

            return(data.GetKeyDown(code));
        }
Ejemplo n.º 48
0
    void Start()
    {
        _pInputData = PlayerInput.Instance.Data;

        _styleFont = Resources.Load <Font> (@"Fonts/CASCADIA");
    }
Ejemplo n.º 49
0
    private static SpecificState GetNextState(SpecificState currentState, InputData currentInput, PhysicalData currentPhysicals, float deadzone = float.Epsilon)
    {
        var nextState = currentState;

        switch (currentState)
        {
        case SpecificState.IdleLeft:
            if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.IdleRight;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.RunLeft;
            }
            else if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.buttonA)
            {
                nextState = SpecificState.JumpFaceLeft;
            }
            break;

        case SpecificState.IdleRight:
            if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.RunRight;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.IdleLeft;
            }
            else if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.buttonA)
            {
                nextState = SpecificState.JumpFaceRight;
            }
            break;

        case SpecificState.RunLeft:
            if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.IdleLeft;
            }
            else if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentInput.buttonA)
            {
                nextState = SpecificState.JumpMoveLeft;
            }
            else if (currentPhysicals.leftWall)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            break;

        case SpecificState.RunRight:
            if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.IdleRight;
            }
            else if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentInput.buttonA)
            {
                nextState = SpecificState.JumpMoveRight;
            }
            else if (currentPhysicals.rightWall)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            break;

        case SpecificState.JumpFaceLeft:
            if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.JumpMoveLeft;
            }
            else if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.JumpFaceRight;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.IdleLeft;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopIdleLeft;
            }
            break;

        case SpecificState.JumpFaceRight:
            if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.JumpMoveRight;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.JumpFaceLeft;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.IdleRight;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopIdleRight;
            }
            break;

        case SpecificState.JumpMoveLeft:
            if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.JumpFaceLeft;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.RunLeft;
            }
            else if (currentPhysicals.leftWall)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopMoveLeft;
            }
            break;

        case SpecificState.JumpMoveRight:
            if (currentPhysicals.velocity.y < -deadzone)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.JumpFaceRight;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.RunRight;
            }
            else if (currentPhysicals.rightWall)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopMoveRight;
            }
            break;

        case SpecificState.FallFaceLeft:
            if (currentPhysicals.botWall)
            {
                nextState = SpecificState.IdleLeft;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            break;

        case SpecificState.FallFaceRight:
            if (currentPhysicals.botWall)
            {
                nextState = SpecificState.IdleRight;
            }
            else if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            break;

        case SpecificState.FallMoveLeft:
            if (currentPhysicals.botWall)
            {
                nextState = SpecificState.RunLeft;
            }
            else if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentPhysicals.leftWall)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            break;

        case SpecificState.FallMoveRight:
            if (currentPhysicals.botWall)
            {
                nextState = SpecificState.RunRight;
            }
            else if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentPhysicals.rightWall)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            break;

        case SpecificState.ClimbLeftIdle:
            if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbLeftUp;
            }
            else if (currentInput.vertical < -deadzone && !currentPhysicals.botWall)
            {
                nextState = SpecificState.ClimbLeftDown;
            }
            break;

        case SpecificState.ClimbRightIdle:
            if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbRightUp;
            }
            else if (currentInput.vertical < -deadzone && !currentPhysicals.botWall)
            {
                nextState = SpecificState.ClimbRightDown;
            }
            break;

        case SpecificState.ClimbLeftUp:
            if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            else if (!currentPhysicals.leftWall)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopIdleLeft;
            }
            break;

        case SpecificState.ClimbRightUp:
            if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            else if (!currentPhysicals.rightWall)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentPhysicals.topWall && currentInput.vertical > deadzone)
            {
                nextState = SpecificState.ClimbTopIdleRight;
            }
            break;

        case SpecificState.ClimbLeftDown:
            if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.vertical > -deadzone)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            else if (!currentPhysicals.leftWall)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.ClimbLeftIdle;
            }
            break;

        case SpecificState.ClimbRightDown:
            if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentInput.vertical > -deadzone)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            else if (!currentPhysicals.rightWall)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentPhysicals.botWall)
            {
                nextState = SpecificState.ClimbRightIdle;
            }
            break;

        case SpecificState.ClimbTopIdleLeft:
            if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.FallFaceLeft;
            }
            else if (currentInput.horizontal < -deadzone && !currentPhysicals.leftWall)
            {
                nextState = SpecificState.ClimbTopMoveLeft;
            }
            else if (currentInput.horizontal > deadzone)
            {
                nextState = SpecificState.ClimbTopIdleRight;
            }
            break;

        case SpecificState.ClimbTopIdleRight:
            if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.FallFaceRight;
            }
            else if (currentInput.horizontal > deadzone && !currentPhysicals.rightWall)
            {
                nextState = SpecificState.ClimbTopMoveRight;
            }
            else if (currentInput.horizontal < -deadzone)
            {
                nextState = SpecificState.ClimbTopIdleLeft;
            }
            break;

        case SpecificState.ClimbTopMoveLeft:
            if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentInput.horizontal > -deadzone)
            {
                nextState = SpecificState.ClimbTopIdleLeft;
            }
            else if (!currentPhysicals.topWall)
            {
                nextState = SpecificState.FallMoveLeft;
            }
            else if (currentPhysicals.leftWall)
            {
                nextState = SpecificState.ClimbTopIdleLeft;
            }
            break;

        case SpecificState.ClimbTopMoveRight:
            if (currentInput.vertical < deadzone)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentInput.horizontal < deadzone)
            {
                nextState = SpecificState.ClimbTopIdleRight;
            }
            else if (!currentPhysicals.topWall)
            {
                nextState = SpecificState.FallMoveRight;
            }
            else if (currentPhysicals.rightWall)
            {
                nextState = SpecificState.ClimbTopIdleRight;
            }
            break;
        }
        return(nextState);
    }
Ejemplo n.º 50
0
 /// <summary>
 /// This method adds the data for the right input to the database by calling the AddInput method.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public HttpStatusCode AddRightInput(string id, InputData data)
 {
     _differServiceMethods = new DifferServiceMethods();
     return(_differServiceMethods.AddInput(id, data, false));
 }
Ejemplo n.º 51
0
#pragma warning restore 414 // Restore it

    void Start()
    {
        inputData = GetComponent <InputData>();
    }
Ejemplo n.º 52
0
 public SampleViewModel6(InputData data)
 {
     _data = data;
 }
Ejemplo n.º 53
0
        public void ParseNotEnoughParametersTest()
        {
            var sampleFolder = Directory.GetCurrentDirectory();

            _ = InputData.Parse(sampleFolder);
        }
Ejemplo n.º 54
0
 public OutputData SmartlyTranslate(InputData inputData)
 {
     return(_SmartTranslationStrategy.RetrieveSmartTranslation(inputData));
 }
Ejemplo n.º 55
0
    //down if button pressed this frame, held if button is held, up if button let go off this frame
    //button is the input name.
    public void InputButton(IInputGenerator inputGenerator, string button, bool held, bool down, bool up)
    {
        InputData id = new InputData(1.0f, held, down, up);

        buffer[inputGenerator.Id][button] = UpdateList(buffer[inputGenerator.Id][button], id);
    }
 public void PassInput(InputData data)
 {
     // Debug.Log("Movement: " + data.axes[0] + " , " + data.axes[1]);
     _controller.ReadInput(data);
 }
Ejemplo n.º 57
0
 private List <Pet> GetPetsByOwnerGender(InputData data, Gender ownerGender)
 {
     return(data?.ownerAndTheirPets?.Where(x => x.gender == ownerGender && x.pets != null)
            ?.SelectMany(x => x.pets)
            .ToList());
 }
Ejemplo n.º 58
0
 private void button2_Click(object sender, EventArgs e)
 {
     InputData input = new InputData("c:/test.xml");
 }
Ejemplo n.º 59
0
        } // end of ParentDepartmentControl

        #endregion

        //--------------------------------------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------------------------------------

        #region TriggerStartEvent

        /// <summary>
        /// State changes of the activities start event. Most state changes are standardized and configurable via input.
        /// </summary>
        /// <param name="time"> Time of activity start</param>
        /// <param name="simEngine"> SimEngine the handles the activity triggering</param>
        override public void StateChangeStartEvent(DateTime time, ISimulationEngine simEngine)
        {
            //--------------------------------------------------------------------------------------------------
            // Some activities define the start of corresponding doctor, nurses for future reference
            //--------------------------------------------------------------------------------------------------

            #region CorrespondingStaff

            if (ActionType.DefinesCorrespondingDocStart)
            {
                Patient.CorrespondingDoctor = ResourceSet.MainDoctor;
                ResourceSet.MainDoctor.AddPatient(Patient);
            } // end if

            if (ActionType.DefinesCorrespondingNurseStart)
            {
                Patient.CorrespondingNurse = ResourceSet.MainNurse;
                ResourceSet.MainNurse.AddPatient(Patient);
            } // end if

            #endregion

            //--------------------------------------------------------------------------------------------------
            // If treatment has doctor(s), busyFactors are assigned
            //--------------------------------------------------------------------------------------------------

            #region AssignBusyFactorsDoctors

            if (ResourceSet.MainDoctor != null)
            {
                ResourceSet.MainDoctor.BusyFactor += ActionType.BusyFactorDoctor;
            }

            if (ResourceSet.AssistingDoctors != null)
            {
                if (ResourceSet.AssistingDoctors.Length != ActionType.BusyFactorAssistingDoctors.Length)
                {
                    throw new InvalidOperationException();
                }

                for (int i = 0; i < ResourceSet.AssistingDoctors.Length; i++)
                {
                    ResourceSet.AssistingDoctors[i].BusyFactor += ActionType.BusyFactorAssistingDoctors[i];
                } // end for
            }     // end if

            #endregion

            //--------------------------------------------------------------------------------------------------
            // If treatment has nurse(s), busyFactors are assigned
            //--------------------------------------------------------------------------------------------------

            #region AssignBusyFactorsNurses

            if (ResourceSet.MainNurse != null)
            {
                ResourceSet.MainNurse.BusyFactor += ActionType.BusyFactorNurse;
            }

            if (ResourceSet.AssistingNurses != null)
            {
                if (ResourceSet.AssistingNurses.Length != ActionType.BusyFactorAssistingNurses.Length)
                {
                    throw new InvalidOperationException();
                }

                for (int i = 0; i < ResourceSet.AssistingNurses.Length; i++)
                {
                    ResourceSet.AssistingNurses[i].BusyFactor += ActionType.BusyFactorAssistingNurses[i];
                } // end for
            }     // end if

            #endregion

            //--------------------------------------------------------------------------------------------------
            // Preemption
            //--------------------------------------------------------------------------------------------------

            #region Preemption

            // in case the activity was preempted only the remaining duration is considered for scheduling
            // the end event
            if (DegreeOfCompletion > 0)
            {
                DateTime endTime = time + Helpers <double> .MultiplyTimeSpan(Duration, (1 - DegreeOfCompletion));

                simEngine.AddScheduledEvent(this.EndEvent, endTime);
                return;
            } // end if

            #endregion

            //--------------------------------------------------------------------------------------------------
            // Occupation
            //--------------------------------------------------------------------------------------------------

            #region Occupation

            // in case of a multiple patient treatment facility the patient
            // is added to the holdeld entities
            if (ResourceSet.TreatmentFacility is EntityMultiplePatientTreatmentFacility)
            {
                ((EntityMultiplePatientTreatmentFacility)ResourceSet.TreatmentFacility).HoldedEntities.Add(Patient);
            }
            else
            {
                //--------------------------------------------------------------------------------------------------
                // Set treatmentBooth to occupied
                //--------------------------------------------------------------------------------------------------
                ResourceSet.TreatmentFacility.Occupied = true;

                //--------------------------------------------------------------------------------------------------
                // in case patient is blocking the facility required actions are taken
                //--------------------------------------------------------------------------------------------------
                if (ActionType.DefinesFacilitiyOccupationStart)
                {
                    // facility is blocked for patient
                    ResourceSet.TreatmentFacility.PatientBlocking = Patient;

                    // facility is assigned to patient
                    Patient.OccupiedFacility = ResourceSet.TreatmentFacility;
                } // end if
            }     // end if
            #endregion

            //--------------------------------------------------------------------------------------------------
            // Updating of next Acion and possible skipping of latter
            //--------------------------------------------------------------------------------------------------

            #region UpdateNextAction

            PatientPath.UpdateNextAction();

            T nextActionType = PatientPath.GetCurrentActionType();

            #endregion

            #region PossibleSkipOfNextAction

            //--------------------------------------------------------------------------------------------------
            // A treatment may be skipped, e.g. in case that the current doctor is qualified enough
            // This is defined via the input
            //--------------------------------------------------------------------------------------------------
            while (ParentDepartmentControl.SkipNextAction(Patient, ResourceSet.MainDoctor, ActionType, PatientPath.GetCurrentActionType()))
            {
                PatientPath.UpdateNextAction();
                nextActionType = PatientPath.GetCurrentActionType();
            } // end if

            #endregion

            //--------------------------------------------------------------------------------------------------
            // In case a holding Activity follows no end event is scheduled
            //--------------------------------------------------------------------------------------------------

            #region HoldingOfPatient

            if (ActionType.IsHold)
            {
                // Staff on hold flag is set to true
                foreach (EntityStaff staff in AffectedEntities.Where(p => p is EntityStaff))
                {
                    staff.OnHold = true;
                } // end foreach

                HoldingRequired = true;
                // in case of holding the next action on the path is taken
                if (PatientPath.TakeNextAction(simEngine, StartEvent, time, ParentControlUnit))
                {
                    // either waiting or waiting in the treatment facility is launched
                    if (Patient.OccupiedFacility == null || Patient.OccupiedFacility.ParentDepartmentControl != ParentDepartmentControl)
                    {
                        EndEvent.SequentialEvents.Add(Patient.StartWaitingActivity(ParentDepartmentControl.WaitingAreaPatientForNextActionType(nextActionType)));
                    }
                    else
                    {
                        ActivityWaitInFacility waitInFacility = new ActivityWaitInFacility(ParentControlUnit, Patient, Patient.OccupiedFacility);
                        EndEvent.SequentialEvents.Add(waitInFacility.StartEvent);
                    } // end if
                }     // end if
            }
            else
            {
                // if the activity is not hold the end event is scheduled
                Duration = InputData.PatientActionTime(Patient,
                                                       ResourceSet,
                                                       ActionType);

                DateTime endTime = time + Duration;
                simEngine.AddScheduledEvent(this.EndEvent, endTime);
            } // end if

            #endregion
        } // end of TriggerStartEvent
Ejemplo n.º 60
0
 private InputData GetInputOnPosition(InputPosition position, InputData input, InputData opposingInput)
 {
     return(input.Position == position ? input : opposingInput);
 }