public void PlaceBits() { List <int> rowsToCheck = new List <int>(), colsToCheck = new List <int>(); foreach (Bit b in PlacingBits) { b.Position = b.PlacedPosition; Bit newBit = new Bit(b.Color, b.LocalCoordinates, this) { Placed = true, Position = b.Position }; Bits.Add(newBit); FinalizingBits.Add(newBit); if (!rowsToCheck.Contains(b.Coordinates.X)) { rowsToCheck.Add(b.Coordinates.X); } if (!colsToCheck.Contains(b.Coordinates.Y)) { colsToCheck.Add(b.Coordinates.Y); } } Placing = false; CheckForClears(rowsToCheck, colsToCheck); }
public void AppendByte(byte source) { for (int i = 0; i < 8; i++) { Bits.Add(((source >> i) & 1) != 0); } }
public void AddBit(DrillBit bit) { Bits.Add(bit); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Bits))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Display))); }
public PlcWordModel(string memArea, int wordAddress) { MemoryArea = memArea.ToUpper(); WordAddress = wordAddress; for (int i = 0; i < OmronFINsClass.Width_Word; i++) { Bits.Add(0); plcBits.Add(new PlcBitModel(memArea, wordAddress, i)); } }
public PlcWordModel(string memArea, int wordAddress, string valueStrHex) { MemoryArea = memArea.ToUpper(); WordAddress = wordAddress; for (int i = 0; i < OmronFINsClass.Width_Word; i++) { Bits.Add(0); plcBits.Add(new PlcBitModel(memArea, wordAddress, i)); } SetValue(valueStrHex); SetAllBitsValue(); }
public PlcWordModel() { for (int i = 0; i < OmronFINsClass.Width_Word; i++) { Bits.Add(0); plcBits.Add(new PlcBitModel("", -1, i)); } //this.MemArea = MemoryArea; //this.WAddress = Wcounter++; //if (Wcounter == OmronFINsClass.Size_WR) // throw new InvalidOperationException("Max number of Word address is reached!!"); //PlcWordAddress.WordAddress = Wcounter++; }
static public void BitTest() { int fullMask = 0; for (int i = 0; i < Bits.Length; ++i) { Bits.Add(ref fullMask, i); Debug.LogFormat("base10: {0}; base2: {1}", fullMask, Convert.ToString(fullMask, 2).PadLeft(32, '0')); } Assert.AreEqual(fullMask, Bits.All32); for (int i = 0; i < 32; ++i) { bool bMatch = Bits.Contains(fullMask, i); Assert.True(bMatch); } }
public PlcWordModel(PlcMemArea memArea, int wordAddress, string valueStrHex) { switch (memArea) { case PlcMemArea.CIO: MemoryArea = "C"; break; case PlcMemArea.WR: MemoryArea = "W"; break; case PlcMemArea.HR: MemoryArea = "H"; break; case PlcMemArea.AR: MemoryArea = "A"; break; case PlcMemArea.DM: MemoryArea = "D"; break; default: break; } WordAddress = wordAddress; for (int i = 0; i < OmronFINsClass.Width_Word; i++) { Bits.Add(0); plcBits.Add(new PlcBitModel(MemoryArea, wordAddress, i)); } SetValue(valueStrHex); SetAllBitsValue(); }