Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (!(obj is SwitchMatrix))
            {
                return(false);
            }

            SwitchMatrix other = (SwitchMatrix)obj;

            // compare all ports
            if (other.m_allPortsFrom.Count != m_allPortsFrom.Count)
            {
                return(false);
            }
            if (other.m_allPortsTo.Count != m_allPortsTo.Count)
            {
                return(false);
            }

            foreach (Port otherPort in other.Ports)
            {
                if (!Contains(otherPort))
                {
                    return(false);
                }
            }
            return(true);

            //return this.ToString().Equals(obj.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Restore m_location2TileKey, m_tiles and m_matrices
        /// </summary>
        public void DoPostSerializationTasks()
        {
            m_location2TileKey.Clear();
            m_tiles.Clear();
            m_maxTileKeyX = 0;
            MaxX          = 0;
            MaxY          = 0;

            while (m_rawTiles.Count > 0)
            {
                RawTile rawTile = m_rawTiles.Dequeue();
                Tile    tile    = new Tile(rawTile);

                foreach (RawSlice rawSlice in rawTile.RawSlices)
                {
                    Slice slice = Slice.GetSliceFromRawSlice(tile, rawSlice);
                    tile.Slices.Add(slice);
                }

                Add(tile);
            }

            m_matrices.Clear();
            while (m_rawMatrices.Count > 0)
            {
                RawSwitchMatrix rawSM = m_rawMatrices.Dequeue();
                SwitchMatrix    sm    = new SwitchMatrix(rawSM);
                Add(sm.HashCode, sm);
            }

            m_rawTiles.Clear();
            m_rawMatrices.Clear();

            // Time Model
            if (TimeModelAttributes != null)
            {
                Tile.TimeModelAttributeIndices = new Dictionary <Tile.TimeAttributes, int>();
                int c = 0;
                for (int i = 0; i < 4; i++)
                {
                    if (TimeModelAttributes[i])
                    {
                        Tile.TimeModelAttributeIndices.Add((Tile.TimeAttributes)i, c);
                        c++;
                    }
                }
            }

            Commands.Debug.PrintGoAheadInternals.ObjectsToPrint.Add(this);
        }
Ejemplo n.º 3
0
        public RawSwitchMatrix(SwitchMatrix switchMatrix)
        {
            foreach (Port driver in switchMatrix.GetAllDrivers())
            {
                InPorts.Add(driver.Name);
                List <string> drivenPorts = new List <string>();
                foreach (Port drivenPort in switchMatrix.GetDrivenPorts(driver))
                {
                    drivenPorts.Add(drivenPort.Name);
                }
                OutPorts.Add(drivenPorts);
            }

            HashCode = switchMatrix.HashCode;
        }
Ejemplo n.º 4
0
 public bool Contains(SwitchMatrix matrix)
 {
     return(m_matrices.ContainsKey(matrix.HashCode));
 }
Ejemplo n.º 5
0
 public void Add(int hashcode, SwitchMatrix matrix)
 {
     m_matrices.Add(hashcode, matrix);
 }