Ejemplo n.º 1
0
        public string ToChainString()
        {
            ChainImpl root   = (ChainImpl)Root;
            string    output = "Chain=" + root.Name;

            for (ChainImpl current = root.next; !current.isRoot; current = current.next)
            {
                output += "," + current.Name;
            }
            return(output);
        }
Ejemplo n.º 2
0
        public Chain GetAt(int index)
        {
            int       i    = 0;
            ChainImpl link = (ChainImpl)Root;

            do
            {
                if (i == index)
                {
                    return(link);
                }
                i++;
                link = link.next;
            }while (!link.isRoot);
            throw new ApplicationException("Not found at " + index);
        }
Ejemplo n.º 3
0
        public Chain InsertAfter(Chain chain)
        {
            if (trace)
            {
                log.Trace(GetType().Name + " InsertAfter() " + chain.ToChainString() + " after " + this);
            }
            ChainImpl root = (ChainImpl)chain.Root;
            ChainImpl tail = (ChainImpl)chain.Tail;

            root.isRoot   = false;
            root.previous = this;
            tail.next     = next;
            next.previous = tail;
            next          = root;
            return(root);
        }
Ejemplo n.º 4
0
        public Chain InsertBefore(Chain chain)
        {
            if (trace)
            {
                log.Trace(GetType().Name + " InsertBefore() " + chain.ToChainString() + " before " + this);
            }
            ChainImpl root = (ChainImpl)chain.Root;
            ChainImpl tail = (ChainImpl)chain.Tail;

            root.isRoot   = isRoot;
            isRoot        = false;
            tail.next     = this;
            root.previous = previous;
            previous.next = root;
            previous      = tail;
            return(root);
        }
Ejemplo n.º 5
0
        public Chain Replace(Chain chain)
        {
            if (trace)
            {
                log.Trace(GetType().Name + " Replace() " + this + " with " + chain.ToChainString());
            }
            ChainImpl root = (ChainImpl)chain.Root;
            ChainImpl tail = (ChainImpl)chain.Tail;

            root.isRoot   = isRoot;
            isRoot        = false;
            tail.next     = next;
            root.previous = previous;
            previous.next = root;
            next.previous = tail;
            return(root);
        }
Ejemplo n.º 6
0
 public ChainImpl(ModelInterface formula)
 {
     if (trace)
     {
         log.Trace("new ");
     }
     if (trace)
     {
         log.Indent();
     }
     LinkFormula(formula);
     previous = this;
     next     = this;
     if (trace)
     {
         log.Outdent();
     }
 }
Ejemplo n.º 7
0
 private ChainImpl()
 {
     previous = this;
     next     = this;
 }