Exemplo n.º 1
0
        // TODO trim method on raw size.
        /// <summary>
        /// Method that return a soft copy of given SGLArrayList
        /// Where the new list will share the references of old values with
        /// given lists copys.
        /// </summary>
        /// <returns></returns>
        public SGLArrayList <T> SoftCopy()
        {
            SGLArrayList <T> newCopy = new SGLArrayList <T>();

            for (int index = 0; index < this.Length(); index++)
            {
                newCopy.Add(this.Get(index));
            }
            return(newCopy);
        }
Exemplo n.º 2
0
        private string StringForm(string data)
        {
            SGLArrayList <SGLNode <T> > SGLNodes = new SGLArrayList <SGLNode <T> >();
            SGLNode <T> temp  = Front;
            int         index = 0;

            while (temp != null)
            {
                SGLNodes.Add(temp);
                temp = temp.GetNext();
                data = data + SGLNodes.Get(index).ToString() + (temp == null ? "" : ", ");
                index++;
            }
            Front = SGLNodes.Get(0);
            return(data);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds an SGLNode to the list of associated SGLNodes.
        /// </summary>
        /// <param name="SGLNode"></param>
        public void AddNode(SGLNode <T> SGLNode)
        {
            SGLEdge <T> edge = new SGLEdge <T>(this, SGLNode);

            AdjacencyList.Add(edge);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Adds a vertex to the list of vertices associated with this graph.
 /// </summary>
 /// <param name="data"></param>
 public void AddVertex(T data)
 {
     Vertices.Add(new SGLNode <T>(data));
 }
Exemplo n.º 5
0
 public SGLGraph(SGLNode <T> SGLNode, bool directed)
 {
     Directed = directed;
     Vertices = new SGLArrayList <SGLNode <T> >();
     Vertices.Add(SGLNode);
 }
Exemplo n.º 6
0
 public SGLGraph(SGLNode <T> SGLNode)
 {
     Directed = false;
     Vertices = new SGLArrayList <SGLNode <T> >();
     Vertices.Add(SGLNode);
 }