示例#1
0
        public void add(Element elem)
        {
            if (elem == null)
            {
                throw new ArgumentNullException("elem");
            }

            if (elem.circuitId == 0)
            {
                elem.circuitId = ++this.genericID;
            }
            else if (contents.ContainsKey(elem.circuitId))
            {
                throw new ArgumentException("An element with this circuit ID has already been added", "elem");
            }

            if (elem.nodeId != null)
            {
                ElemKey key = new ElemKey(elem);
                if (uniqueElem.ContainsKey(key))
                {
                    throw new ArgumentException("A different element with this same unique ID is already in the schema", "elem");
                }
                uniqueElem.Add(key, elem);
            }

            contents.Add(elem.circuitId, elem);
        }
示例#2
0
        public List <Element> Find(ElemKey key)
        {
            List <Element> results = new List <Element>();

            foreach (KeyValuePair <int, Element> entry in radio)
            {
                if (entry.Value.descr.Equals(key))
                {
                    results.Add(entry.Value);
                }
            }
            return(results);
        }
示例#3
0
 public Element(ElemKey d, int c, signals.ICircuitElement o)
 {
     descr     = d;
     circuitId = c;
     obj       = o;
 }