Class NestableNameList

java.lang.Object
overit.geocall.util.NestableNameList

public class NestableNameList extends Object
Utility class used to manage a nestable list of names (i.e. {toni,subbo{pollo,orpo},gigi})
  • Field Details

  • Constructor Details

    • NestableNameList

      public NestableNameList()
      Empty constructor
    • NestableNameList

      public NestableNameList(String s) throws ParseException
      Creates an instance of NestableNameList
      Parameters:
      s - String representing a NestableNameList (i.e. {toni,subbo{pollo,orpo},gigi})
      Throws:
      ParseException - if an error occurs during the parsing
  • Method Details

    • add

      public void add(String name)
      Adds a string inside the NestableNameList
      Parameters:
      name - The string to add
    • add

      public void add(String name, NestableNameList nnl)
      Adds a string and another NestableNameList inside a NestableNameList
      Parameters:
      name - The string to add
      nnl - The NestableNameList to add
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if the NestableNameList is empty, false otherwise
    • remove

      public void remove(String name)
      Remove a string from the NestableNameList
      Parameters:
      name - The string to remove
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int maxlength)
      Returns a string representation of the object as long as dosnt exceed maxlength
      Parameters:
      maxlength - Maximum lenght of the string
      Returns:
      A string representation of the object as long as dosnt exceed maxlength
    • getSubList

      public NestableNameList getSubList(String name)
      Returns a sub NestableNameList
      Parameters:
      name - The string to get
      Returns:
      A sub NestableNameList
    • contains

      public boolean contains(String name)
      Tells if the string is contained inside the list
      Parameters:
      name - The string to search
      Returns:
      true if the string is contained inside the list, false otherwise
    • iterator

      public Iterator iterator()
      Iterator of the list
      Returns:
      The iterator of the list
    • main

      public static void main(String[] ss) throws Exception
      Throws:
      Exception