Class IntNode


  • public class IntNode
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      IntNode()
      default constructor
      IntNode​(int _data, IntNode _node)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addNodeAfterThis​(int newdata)
      adds a new IntNode after the node it's called from
      void addRangeAfterThis​(int start, int end)
      add a range of ints to a List
      int getData()  
      IntNode getLink()  
      static int listLength​(IntNode head)
      gets the number of nodes after the one it's called from.
      void printData()
      prints out the toString value of the Node.
      void removeNodeAfterThis()
      removes the IntNode after the one it's called from
      void removeXNodesAfterThis​(int count)
      removes an X number of nodes starting from the node it's called from
      static boolean search​(IntNode head, int _data)
      searches for a data input and returns whether or not it exists in the List
      void setData​(int data)  
      void setLink​(IntNode link)  
      java.lang.String toString()
      Builds a string from all the nodes in the list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IntNode

        public IntNode()
        default constructor
      • IntNode

        public IntNode​(int _data,
                       IntNode _node)
        Parameters:
        _data - The new data value to assign
        _node - The next IntNode in the list
    • Method Detail

      • removeXNodesAfterThis

        public void removeXNodesAfterThis​(int count)
        removes an X number of nodes starting from the node it's called from
        Parameters:
        count - the number of nodes you want to remove
      • addRangeAfterThis

        public void addRangeAfterThis​(int start,
                                      int end)
        add a range of ints to a List
        Parameters:
        start - the start of the range
        end - the end of the range
      • getData

        public int getData()
      • setData

        public void setData​(int data)
      • getLink

        public IntNode getLink()
      • setLink

        public void setLink​(IntNode link)
      • addNodeAfterThis

        public void addNodeAfterThis​(int newdata)
        adds a new IntNode after the node it's called from
        Parameters:
        newdata - the data you want to add (int)
      • removeNodeAfterThis

        public void removeNodeAfterThis()
        removes the IntNode after the one it's called from
      • listLength

        public static int listLength​(IntNode head)
        gets the number of nodes after the one it's called from.
        Parameters:
        head - the head node you want to start from
        Returns:
        the number of items in the List
      • search

        public static boolean search​(IntNode head,
                                     int _data)
        searches for a data input and returns whether or not it exists in the List
        Parameters:
        head - the head node to start from in the search loop
        _data - the data you want to search for
        Returns:
        true or false depending on what it finds
      • toString

        public java.lang.String toString()
        Builds a string from all the nodes in the list.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string of the data separated by arrows.
      • printData

        public void printData()
        prints out the toString value of the Node.