public static Message FromOSC(Stream stream) { var ms = new MemoryStream(); stream.CopyTo(ms); var bytes = ms.ToArray(); var start = 0; var bundle = OSCBundle.Unpack(bytes, ref start, (int)stream.Length); var message = new Message(); foreach (OSCMessage m in bundle.Values) { var binList = new BinList(); binList.AssignFrom(m.Values); // does not clone implicitly var address = m.Address.Split('/'); var name = address[address.Length - 1]; address[address.Length - 1] = ""; var messageAddress = ""; foreach (var part in address) { if (part.Trim() != "") { messageAddress += "." + part; } } message.Address = messageAddress.Substring(1); message[name] = binList; } return(message); }
public EndLoadUnloadEvent(double timeIn, BinList binsToUnloadIn, SimulationManager managerIn, Transporter transporterIn, BinMagazine binMagazineIn) : base(timeIn, managerIn) { this.transporter = transporterIn; this.binMagazine = binMagazineIn; this.binsToUnload = binsToUnloadIn; }
public void UpdateBinList() { BinList.Clear(); foreach (Bin bin in _currentUser.BinList) { BinList.Add(bin); } }
public void Execute(BinList binListIn) { this.PreOperation(); if (binListIn.Count != 0) { this.CreateNewTasks(binListIn); } this.PostOperation(); }
public static void Main() { BinList binList = new BinList(); MainForm mainForm = new MainForm(ref binList); mainForm.RefreshPanel(); Application.EnableVisualStyles(); Application.Run(mainForm); }
public MainForm(ref BinList newBinList) { InitializeComponent(); this.binList = newBinList; this.sizeSelect.SelectedIndex = (int)SizeSelection.SIZE_SELECT_MEDIUM; SetLogVisible(false); this.log.DataSource = Log.Instance; Log.Instance.ListChanged += LogListChanged; }
private Transporter transporter; // bypass için şimdilik bir tane uncapacitated transporter yaratıldı. IE486 public Layout() { this.bufferCells = new BufferCellList(); this.inputStations = new StationList(); this.nodes = new NodeList(); this.operations = new OperationList(); this.outputStations = new StationList(); this.stations = new StationList(); this.bins = new BinList(); this.componentTypes = new ComponentTypeList(); this.unitloadsonMover = new UnitloadList(); this.transporter = new Transporter(); }
protected override void CreateNewTasks(BinList binListIn) { TransferTaskList newTransferTask = new TransferTaskList(); foreach (Bin bin in binListIn) { newTransferTask.Add(bin); } readyBinCount.UpdateWeighted(this.Manager.Time, binListIn.Count); //StatisticsUpdate transferTaskCount.UpdateWeighted(this.Manager.Time, newTransferTask.Count); //StatisticsUpdate delete binListIn; }
public void Find_BinListTest() { IssuerInformation info = BinList.Find("431940"); Assert.AreEqual("visa", info.Scheme); Assert.AreEqual("IE", info.Country.Alpha2); Assert.AreEqual("Ireland", info.Country.Name); Assert.AreEqual("BANK OF IRELAND", info.Bank.Name); Assert.AreEqual("debit", info.CardType); Assert.AreEqual("53", info.Country.Latitude); Assert.AreEqual("-8", info.Country.Longitude); Assert.AreEqual("Traditional", info.Brand); Assert.AreEqual(false, info.Prepaid); }
public Layout(string nameIn, FLOWObject parentIn) : base(nameIn, parentIn) { this.bufferCells = new BufferCellList(); this.inputStations = new StationList(); this.nodes = new NodeList(); this.operations = new OperationList(); this.outputStations = new StationList(); this.stations = new StationList(); this.bins = new BinList(); this.componentTypes = new ComponentTypeList(); this.unitloadsonMover = new UnitloadList(); this.transporter = new Transporter(); this.onHandWriter = new TextOutput(((SimulationManager)parentIn.Parent).path); }
public void Find_BinList_LuhnIsNull_Test() { IssuerInformation info = BinList.Find("429650"); Assert.Equal("visa", info.Scheme); Assert.Equal("US", info.Country.Alpha2); Assert.Equal("United States of America", info.Country.Name); Assert.Equal("TWINSTAR C.U.", info.Bank.Name); Assert.Equal("credit", info.CardType); Assert.Equal("38", info.Country.Latitude); Assert.Equal("-97", info.Country.Longitude); Assert.Equal("Traditional", info.Brand); Assert.Equal(16, info.Number.Length); Assert.Null(info.Number.Luhn); }
public async void Find_BinList_Async_Test() { IssuerInformation info = await BinList.FindAsync("431940"); Assert.Equal("visa", info.Scheme); Assert.Equal("IE", info.Country.Alpha2); Assert.Equal("Ireland", info.Country.Name); Assert.Equal("BANK OF IRELAND", info.Bank.Name); Assert.Equal("debit", info.CardType); Assert.Equal("53", info.Country.Latitude); Assert.Equal("-8", info.Country.Longitude); Assert.Equal("Traditional", info.Brand); Assert.Equal(16, info.Number.Length); Assert.True(info.Number.Luhn); Assert.False(info.Prepaid); }
public static void Sort(ref BinList binList, Rectangle panelRectangle, out int unresolved) { Node startNode = new Node(); startNode.Rectangle = panelRectangle; unresolved = 0; int currentX = 0; int currentY = panelRectangle.Height; int currentHeight = 0; foreach (Bin bin in binList) { Node node = startNode.Insert(bin.Rectangle); if (node == null) { // since we cannot place the rectangle in a sorted position, place it // below the panel's view loosely fitted with the other unresolved // rectangles if (bin.Rectangle.Width + currentX > panelRectangle.Width) { currentX = 0; currentY += currentHeight; currentHeight = 0; } bin.Rectangle.X = currentX; currentX += bin.Rectangle.Width; bin.Rectangle.Y = currentY; if (bin.Rectangle.Height > currentHeight) { currentHeight = bin.Rectangle.Height; } unresolved++; continue; } bin.Rectangle = node.Rectangle; } }
public static void Sort(ref BinList binList, int panelWidth) { int binListCount = binList.Count; randomBinding = new Dictionary<Bin, int>(binListCount); foreach (Bin bin in binList) { randomBinding[bin] = randomGenerator.Next(); } binList.Sort(CompareBins); int currentHeight = 0; int currentX = 0; int currentY = 0; foreach (Bin bin in binList) { if (currentX + bin.Rectangle.Width > panelWidth) { currentX = 0; currentY += currentHeight; currentHeight = 0; } if (bin.Rectangle.Height > currentHeight) { currentHeight = bin.Rectangle.Height; } bin.Rectangle.X = currentX; bin.Rectangle.Y = currentY; currentX += bin.Rectangle.Width; } }
public PlayerEngine () { Console.WriteLine ("Gst# PlayerEngine ctor - completely experimental, still a WIP"); Gst.Application.Init (); //Making early-bound elements pipeline = new Pipeline (); playbin = new PlayBin2 (); audiobin = new MyBinType ("audiobin"); filterbin = new BinList<Element> ("filterbin"); //Making late-bound elements (not currently bound by gst-sharp) audiosink = ElementFactory.Make ("gconfaudiosink", "thesink"); if (audiosink == null) audiosink = ElementFactory.Make ("autoaudiosink", "thesink"); queue = ElementFactory.Make ("queue", "audioqueue"); //Adding, linking, and padding filterbin.Add (queue); audiobin.Add (filterbin.GetBin (), audiosink); filterbin.GetSourceGhostPad ().Link (audiosink.GetStaticPad ("sink")); audiobinsink.SetTarget (filterbin.GetSinkGhostPad ()); audiobin.AddPadHack (audiobinsink); playbin.AudioSink = audiobin; pipeline.Add (playbin); pipeline.Bus.AddWatch (OnBusMessage); Banshee.ServiceStack.Application.RunTimeout (200, delegate { OnEventChanged (PlayerEvent.Iterate); return true; }); OnStateChanged (PlayerState.Ready); }
/// <summary> /// Initializes a new instance of the <see cref="LogarithmicBinning"/> class. /// </summary> public LogarithmicBinning() { _binListProxy = new BinList(this); }
protected override void Operation() { this.Transporter.onRoad = false; if (this.transporter.Route[0].Content.Count < this.transporter.Route[0].Capacity) { transporter.Route[0].Receive(this.Time, transporter); transporter.BecomeFree(this.Time); } else { transporter.Route[0].TransporterQueue.add(transporter) transporter.BecomeBlocked(this.Time); return; } if (transporter.Location = transporter.ParkNode) { if (transporter.assignedStorage != null) { this.Manager.EventCalendar.ScheduleSeizeNodeEvent(this.Time + transporter.TravelTime.GenerateValue(), transporter); transporter.Route[0].Release(this.Time, transporter); transporter.onRoad = true; return; } } if (transporter.Route.Count == 0) { if (transporter.Content.Count > 0) { this.Manager.EventCalendar.ScheduleEndLoadUnloadEvent(this.Time + transporter.TransferTime.GenerateValue(), transporter); transporter.InTransfer = true; foreach (Bin bin in transporter.Content) { bin.InTransfer = true; } return; } else { this.Manager.TriggerSupermarketControllerAlgorithm(this.transporter.assignedStorage); return; } } if (transporter.Route.Count > 0) { BinList binsToUnload = transporter.Route[0].GetBinsToUnload((Storage)transporter.Location); BinList binsToCollect = this.Manager.BinCollectorAlgorithm.Execute(binsToUnload, (Storage)transporter.Location); //ScheduleEndLoadUnloadEvent icine binsToCollect almiyor ona gore duzenlememiz gerekiyor. Bunun disinda icine neden binmagazine aldigina bakip guncellememiz gerekiyr. this.Manager.EventCalendar.ScheduleEndLoadUnloadEvent(this.Time + transporter.TravelTime.GenerateValue(), binsToUnload, transporter, binsToCollect); foreach (Bin bin in binsToUnload) { bin.InTransfer = true; } foreach (Bin bin in binsToCollect) { bin.InTransfer = true; } return; } }
public void ScheduleEndLoadUnloadEvent(double timeIn, BinList binsToUnloadIn, Transporter transporterIn, BinMagazine binMagazineIn) // 486update 25.12.2018 { EndLoadUnloadEvent endLoadUnloadEvent = new EndLoadUnloadEvent(timeIn, binsToUnloadIn, this.manager, transporterIn, binMagazineIn); this.ScheduleEvent(endLoadUnloadEvent); }
public async void ArgumentException_BinList_Empty_Async_Test() { await Assert.ThrowsAsync <ArgumentException>(() => BinList.FindAsync("")); }
public async void ArgumentNullException_BinList_Async_Test() { await Assert.ThrowsAsync <ArgumentNullException>(() => BinList.FindAsync(null)); }
public void ArgumentException_BinList_Empty_Test() { Assert.Throws <ArgumentException>(() => BinList.Find("")); }
public void ArgumentNullException_BinList_Test() { Assert.Throws <ArgumentNullException>(() => BinList.Find(null)); }
protected abstract void CreateNewTasks(BinList binListIn); //creating new tasks for different implementations
//Transporter number is assumed to be 1 for ie486f18 public Transporter() { content = new BinList(); this.CreateStatistics(); }
public void ArgumentException_BinListTest() { var info = BinList.Find("333g12"); }
public Layouter(int x, int y, int w, int h) : base(x, y, w, h, Main.BackgroundColor) { newStatusText = usageText; formatButtons = new List <Button>(); formatButtons.Add(new Button(80, 26, "HEX", Main.HexColor, formatButtonClicked, Bin.Formats.Hex)); formatButtons.Add(new Button(80, 26, "BIN", Main.BinColor, formatButtonClicked, Bin.Formats.Binary)); formatButtons.Add(new Button(80, 26, "DEC", Main.DecColor, formatButtonClicked, Bin.Formats.Decimal)); formatButtons.Add(new Button(80, 26, "NIB", Main.NibDecColor, formatButtonClicked, Bin.Formats.NibblesDecimal)); formatButtons.Add(new Button(80, 26, "ASCII", Main.AsciiColor, formatButtonClicked, Bin.Formats.Ascii)); foreach (Button btn in formatButtons) { AddChild(btn); } smallButton = new Button(26, 26, "S", Color.White, sizeButtonClicked, 0); AddChild(smallButton); largeButton = new Button(26, 26, "L", Color.White, sizeButtonClicked, 1); AddChild(largeButton); writeButton = new Button(80, 26, "WRITE", Color.White, writeButtonClicked); AddChild(writeButton); saveButton = new Button(80, 26, "SAVE", Color.White, saveButtonClicked); AddChild(saveButton); // value inputs valueInput = new TextInput(10, 10, 56, 14); valueInput.TextColor = Main.DecColor; valueInput.OnChangeCallback = valueChanged; valueInput.Visible = false; AddChild(valueInput); valueInputTypeButton = new Button(15, 14, "D", Main.DecColor, inputTypeSwitchClicked, valueInput); valueInputTypeButton.Font = Main.FontS; valueInputTypeButton.Transform.X = 57; valueInput.AddChild(valueInputTypeButton); // search inputs searchInput = new TextInput(10, 10, 56, 14); searchInput.TextColor = Main.HexColor; searchInput.OnChangeCallback = searchChanged; searchInput.OnSubmitCallback = searchCommitted; searchInput.Visible = false; AddChild(searchInput); searchInputTypeButton = new Button(15, 14, "H", Main.HexColor, inputTypeSwitchClicked, searchInput); searchInputTypeButton.Font = Main.FontS; searchInputTypeButton.Transform.X = 57; searchInput.AddChild(searchInputTypeButton); // goto inputs gotoInput = new TextInput(10, 10, 56, 14); gotoInput.TextColor = Main.DecColor; gotoInput.OnChangeCallback = gotoInputChanged; gotoInput.OnSubmitCallback = gotoCommitted; gotoInput.Visible = false; AddChild(gotoInput); gotoInputTypeButton = new Button(15, 14, "D", Main.DecColor, inputTypeSwitchClicked, gotoInput); gotoInputTypeButton.Font = Main.FontS; gotoInputTypeButton.Transform.X = 57; gotoInput.AddChild(gotoInputTypeButton); list = new BinList(10, 10, 100, 100, itemSelected, showStatus); list.ItemSpace = itemSpace; AddChild(list); Resize(w, h); setItemFontSize(1); }
public override void Evaluate(int SpreadMax) { SpreadMax = (FSelect[0] != SelectEnum.First)? FInput.SliceCount : 1; if (!FInput.IsChanged) { // FLogger.Log(LogType.Debug, "skip split"); return; } bool empty = FInput.SliceCount == 0 || FInput[0] == null; foreach (string pinName in Pins.Keys) { if (empty) { ToISpread(Pins[pinName]).SliceCount = 0; FTimeStamp.SliceCount = 0; FAddress.SliceCount = 0; } else { if (FSelect[0] == SelectEnum.All) { ToISpread(Pins[pinName]).SliceCount = SpreadMax; FTimeStamp.SliceCount = SpreadMax; FAddress.SliceCount = SpreadMax; } else { ToISpread(Pins[pinName]).SliceCount = 1; FTimeStamp.SliceCount = 1; FAddress.SliceCount = 1; } } } if (empty) { return; } for (int i = (FSelect[0] == SelectEnum.Last)?SpreadMax - 1:0; i < SpreadMax; i++) { Message message = FInput[i]; FAddress[i] = message.Address; FTimeStamp[i] = message.TimeStamp.ToString(); foreach (string name in Pins.Keys) { var bin = GetISpreadData(Pins[name], i); try { // FLogger.Log(LogType.Debug, message.ToString()); BinList attrib = message[name]; int count = attrib.Count; bin.SliceCount = count; for (int j = 0; j < count; j++) { bin[j] = attrib[j]; } } catch (Exception err) { err.ToString(); // no warning bin.SliceCount = 0; if (FVerbose[0]) { Logger.Log(LogType.Debug, "\"" + Types[name] + " " + name + "\" is not defined in Message."); } } } } FAddress.Flush(); FTimeStamp.Flush(); foreach (string name in Pins.Keys) { ToISpread(Pins[name]).Flush(); } }
/// <summary> /// Receive the ensemble and decode it to output the data. /// </summary> /// <param name="ens">Ensemble.</param> /// <param name="origDataFormat">Original Data Format.</param> public void ReceiveEnsemble(DataSet.Ensemble ens, AdcpCodec.CodecEnum origDataFormat) { // Set the buffer size to display data // To much data will make the system run slower int dataOutputMax = 5000; // Set the maximum bin for bin list if (ens.IsEnsembleAvail) { // If it different from what is now if (BinList.Count != ens.EnsembleData.NumBins) { // Subtract 1 because 0 based NumBins = ens.EnsembleData.NumBins - 1; // Clear and repopulate BinList.Clear(); for (int x = 0; x < ens.EnsembleData.NumBins; x++) { BinList.Add(x); } } } // If the HeadingOffset is set or // If they want to retransform the data or // They are replacing the heading with GPS heading, // The data needs to be retransformed to use the new heading. // Retransform the data with the new heading // Apply HDT heading if requried and available // This will also apply the heading offset if (_options.IsRetransformData || _options.IsUseGpsHeading || _options.HeadingOffset != 0) { // Retransform the Profile datas Transform.ProfileTransform(ref ens, origDataFormat, 0.25f, _options.SelectedHeadingSource, _options.HeadingOffset); // Retransform the Bottom Track data // This will also create the ship data Transform.BottomTrackTransform(ref ens, origDataFormat, 0.90f, 10.0f, _options.SelectedHeadingSource, _options.HeadingOffset); // WaterMass transform data // This will also create the ship data if (ens.IsInstrumentWaterMassAvail) { Transform.WaterMassTransform(ref ens, origDataFormat, 0.90f, 10.0f, _options.SelectedHeadingSource, _options.HeadingOffset, _options.ShipXdcrOffset); } } // Remove the Ship speed from the data RemoveShipSpeed(ref ens); // Water Track if (_options.IsCalculateWaterTrack) { _manualWT.Calculate(ref ens, _options.WtMinBin, _options.WtMaxBin); } if (_options.SelectedFormat == DataOutputViewOptions.ENCODING_VMDAS) { VmDasAsciiCodec.VmDasAsciiOutput output = _codecVmDas.Encode(ens, _options.VmDasMinBin, _options.VmDasMaxBin); // Display data DataOutput = output.Ascii; // Max size of data output buffer dataOutputMax = 5000; // Send data to serial port SendDataToSerial(output.Ascii); // Write data to file if turned on WriteData(output.Ascii); // Update the Min and Max Bin selection if (_options.VmDasMinBin != output.BinSelected.MinBin) { MinBin = output.BinSelected.MinBin; } if (_options.VmDasMaxBin != output.BinSelected.MaxBin) { MaxBin = output.BinSelected.MaxBin; } } else if (_options.SelectedFormat == DataOutputViewOptions.ENCODING_PD6_PD13) { // PD6 or PD13 EnsToPd6_13Codec.Pd6_13Data output = _codecPd6_13.Encode(ens); // Output all the strings foreach (var line in output.Data) { // Output to display DataOutput += line; // Output to the serial port // Trim it because the serial port adds a carrage return SendDataToSerial(line, false); // Write data to file if turned on WriteData(line.Trim()); } // Max size of data output buffer dataOutputMax = 1000; } else if (_options.SelectedFormat == DataOutputViewOptions.ENCODING_Binary_ENS) { // Convert to binary array byte[] rawEns = ens.Encode(); // Output to display DataOutput += ens.ToString(); // Output data to the serial port _serialPort.SendData(rawEns, 0, rawEns.Length); // Write data to file if turned on WriteData(rawEns); // Max size of data output buffer dataOutputMax = 10000; } else if (_options.SelectedFormat == DataOutputViewOptions.ENCODING_PD0) { byte[] pd0 = null; switch (_options.SelectedCoordTransform) { case PD0.CoordinateTransforms.Coord_Beam: pd0 = ens.EncodePd0Ensemble(PD0.CoordinateTransforms.Coord_Beam); break; case PD0.CoordinateTransforms.Coord_Instrument: pd0 = ens.EncodePd0Ensemble(PD0.CoordinateTransforms.Coord_Instrument); break; case PD0.CoordinateTransforms.Coord_Ship: pd0 = ens.EncodePd0Ensemble(PD0.CoordinateTransforms.Coord_Ship); break; case PD0.CoordinateTransforms.Coord_Earth: pd0 = ens.EncodePd0Ensemble(PD0.CoordinateTransforms.Coord_Earth); break; } // Output to display DataOutput += System.Text.ASCIIEncoding.ASCII.GetString(pd0); // Output data to serial port _serialPort.SendData(pd0, 0, pd0.Length); // Write data to file if turned on WriteData(pd0); // Max output buffer size dataOutputMax = 10000; } else if (_options.SelectedFormat == DataOutputViewOptions.ENCODING_RETRANSFORM_PD6) { } // Keep the Buffer to a set limit if (DataOutput.Length > dataOutputMax) { DataOutput = DataOutput.Substring(DataOutput.Length - dataOutputMax); } }
public void ArgumentNullException_BinListTest() { var info = BinList.Find(null); }
/// <summary> /// Initializes a new instance of the <see cref="LinearBinning"/> class. /// </summary> public LinearBinning() { _binListProxy = new BinList(this); }