Package parser

Class LISTS


  • public class LISTS
    extends java.lang.Object
    Author:
    GBENRO this class contain utility methods that define various operations on storage structures such as lists and arrays.
    • Constructor Summary

      Constructors 
      Constructor Description
      LISTS()  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String createStringFrom​(java.util.List<java.lang.String> list, int start, int end)  
      static java.util.List cutPortionOfList​(java.util.List list, int start, int end)  
      static int firstoccurrenceOfStatsOrLogOrAntilogBehind​(int start, java.util.List<java.lang.String> list)  
      static int firstoccurrenceOfStatsOrLogOrAntilogBeyond​(int start, java.util.List<java.lang.String> list)  
      static void main​(java.lang.String[] args)  
      static int nextIndexOf​(java.util.List list, int start, java.lang.Object sought)  
      static int nextIndexOfComma​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Comma String object from the point where the search commences.
      static int nextIndexOfInBetweenOperatorOrComma​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of an In Between Operator from the point where the search commences.
      static int nextIndexOfListReturningStatsOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a ListTypeStats Operator from the point where the search commences.
      static int nextIndexOfLogicOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Logic Operator from the point where the search commences.
      static int nextIndexOfLogOrAntiLogToAnyBase​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a LogOrAntiLogToAnyBase Operator from the point where the search commences.
      static int nextIndexOfMulOrDivOrRem​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a * or / or % operator from the point where the search commences.
      static int nextIndexOfNumberReturningStatsOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Number Type Stats Operator from the point where the search commences.
      static int nextIndexOfOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Operator from the point where the search commences.
      static int nextIndexOfPermOrCombOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a permutation or combination operator from the point where the search commences.
      static int nextIndexOfPostNumberOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Post Number Operator from the point where the search commences.
      static int nextIndexOfPowerOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a power operator from the point where the search commences.
      static int nextIndexOfPreNumberOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Pre Number Operator from the point where the search commences.
      static int nextIndexOfVariable​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects forwards for the first occurrence of a Variable String from the point where the search commences.
      static int prevIndexOf​(java.util.List list, int start, java.lang.Object sought)  
      static int prevIndexOfComma​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Comma String Object from the point where the search commences.
      static int prevIndexOfInBetweenOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of an In Between Operator from the point where the search commences.
      static int prevIndexOfListReturningStatsOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a ListReturningStatsOperator from the point where the search commences.
      static int prevIndexOfLogicOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Logic Operator from the point where the search commences.
      static int prevIndexOfLogOrAntiLogToAnyBase​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a LogOrAntiLogToAnyBase Operator from the point where the search commences.
      static int prevIndexOfMulOrDivOrRem​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a * or / or % operator from the point where the search commences.
      static int prevIndexOfNumberReturningStatsOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a NumberReturningStatsOperator from the point where the search commences.
      static int prevIndexOfOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Operator from the point where the search commences.
      static int prevIndexOfPermOrCombOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a permutation or combination operator from the point where the search commences.
      static int prevIndexOfPostNumberOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Post Number Operator from the point where the search commences.
      static int prevIndexOfPowerOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a power operator from the point where the search commences.
      static int prevIndexOfPreNumberOperator​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Pre-Number Operator from the point where the search commences.
      static int prevIndexOfVariable​(java.util.List<java.lang.String> list, int start)
      Searches a List of String objects backwards for the first occurrence of a Variable String from the point where the search commences.
      • Methods inherited from class java.lang.Object

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

      • LISTS

        public LISTS()
    • Method Detail

      • firstoccurrenceOfStatsOrLogOrAntilogBehind

        public static int firstoccurrenceOfStatsOrLogOrAntilogBehind​(int start,
                                                                     java.util.List<java.lang.String> list)
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search backwards for the first occurrence of a string that represents a statistical operator( e.g sum(,sort(,med(,st_err( e.t.c ) or a logtoanybase operator e.g log(a,b) where a and b are numbers or an antilogtoanybaseoperator that index itself been not included
        Returns:
        the index of the first occurrence of the object behind index start or -1 if the object is not found.
      • firstoccurrenceOfStatsOrLogOrAntilogBeyond

        public static int firstoccurrenceOfStatsOrLogOrAntilogBeyond​(int start,
                                                                     java.util.List<java.lang.String> list)
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the first occurrence of a string that represents a statistical operator( e.g sum(,sort(,med(,st_err( e.t.c ) or a logtoanybase operator e.g log(a,b) where a and b are numbers or an antilogtoanybaseoperator that index itself been not included
        Returns:
        the index of the first occurrence of the object beyond index start or -1 if the object is not found.
      • prevIndexOf

        public static int prevIndexOf​(java.util.List list,
                                      int start,
                                      java.lang.Object sought)
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search backwards for the object that index itself been not included
        sought - the object that we seek
        Returns:
        the index of the first occurrence of the object behind index start or -1 if the object is not found.
      • nextIndexOf

        public static int nextIndexOf​(java.util.List list,
                                      int start,
                                      java.lang.Object sought)
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index included. So if the search item is found at the start, the search returns instantly.
        sought - the object that we seek
        Returns:
        the index of the first occurrence of the object after start or -1 if the object is not found.
      • nextIndexOfMulOrDivOrRem

        public static int nextIndexOfMulOrDivOrRem​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects forwards for the first occurrence of a * or / or % operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfMulOrDivOrRem

        public static int prevIndexOfMulOrDivOrRem​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects backwards for the first occurrence of a * or / or % operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfPowerOperator

        public static int nextIndexOfPowerOperator​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects forwards for the first occurrence of a power operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfPowerOperator

        public static int prevIndexOfPowerOperator​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects backwards for the first occurrence of a power operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfVariable

        public static int nextIndexOfVariable​(java.util.List<java.lang.String> list,
                                              int start)
        Searches a List of String objects forwards for the first occurrence of a Variable String from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfVariable

        public static int prevIndexOfVariable​(java.util.List<java.lang.String> list,
                                              int start)
        Searches a List of String objects backwards for the first occurrence of a Variable String from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfPermOrCombOperator

        public static int nextIndexOfPermOrCombOperator​(java.util.List<java.lang.String> list,
                                                        int start)
        Searches a List of String objects forwards for the first occurrence of a permutation or combination operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfPermOrCombOperator

        public static int prevIndexOfPermOrCombOperator​(java.util.List<java.lang.String> list,
                                                        int start)
        Searches a List of String objects backwards for the first occurrence of a permutation or combination operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfInBetweenOperatorOrComma

        public static int nextIndexOfInBetweenOperatorOrComma​(java.util.List<java.lang.String> list,
                                                              int start)
        Searches a List of String objects forwards for the first occurrence of an In Between Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfInBetweenOperator

        public static int prevIndexOfInBetweenOperator​(java.util.List<java.lang.String> list,
                                                       int start)
        Searches a List of String objects backwards for the first occurrence of an In Between Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfPreNumberOperator

        public static int nextIndexOfPreNumberOperator​(java.util.List<java.lang.String> list,
                                                       int start)
        Searches a List of String objects forwards for the first occurrence of a Pre Number Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfPreNumberOperator

        public static int prevIndexOfPreNumberOperator​(java.util.List<java.lang.String> list,
                                                       int start)
        Searches a List of String objects backwards for the first occurrence of a Pre-Number Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfPostNumberOperator

        public static int nextIndexOfPostNumberOperator​(java.util.List<java.lang.String> list,
                                                        int start)
        Searches a List of String objects forwards for the first occurrence of a Post Number Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfPostNumberOperator

        public static int prevIndexOfPostNumberOperator​(java.util.List<java.lang.String> list,
                                                        int start)
        Searches a List of String objects backwards for the first occurrence of a Post Number Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfNumberReturningStatsOperator

        public static int nextIndexOfNumberReturningStatsOperator​(java.util.List<java.lang.String> list,
                                                                  int start)
        Searches a List of String objects forwards for the first occurrence of a Number Type Stats Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfNumberReturningStatsOperator

        public static int prevIndexOfNumberReturningStatsOperator​(java.util.List<java.lang.String> list,
                                                                  int start)
        Searches a List of String objects backwards for the first occurrence of a NumberReturningStatsOperator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfListReturningStatsOperator

        public static int nextIndexOfListReturningStatsOperator​(java.util.List<java.lang.String> list,
                                                                int start)
        Searches a List of String objects forwards for the first occurrence of a ListTypeStats Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfListReturningStatsOperator

        public static int prevIndexOfListReturningStatsOperator​(java.util.List<java.lang.String> list,
                                                                int start)
        Searches a List of String objects backwards for the first occurrence of a ListReturningStatsOperator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfLogOrAntiLogToAnyBase

        public static int nextIndexOfLogOrAntiLogToAnyBase​(java.util.List<java.lang.String> list,
                                                           int start)
        Searches a List of String objects forwards for the first occurrence of a LogOrAntiLogToAnyBase Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfLogOrAntiLogToAnyBase

        public static int prevIndexOfLogOrAntiLogToAnyBase​(java.util.List<java.lang.String> list,
                                                           int start)
        Searches a List of String objects backwards for the first occurrence of a LogOrAntiLogToAnyBase Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfLogicOperator

        public static int nextIndexOfLogicOperator​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects forwards for the first occurrence of a Logic Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfLogicOperator

        public static int prevIndexOfLogicOperator​(java.util.List<java.lang.String> list,
                                                   int start)
        Searches a List of String objects backwards for the first occurrence of a Logic Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfComma

        public static int nextIndexOfComma​(java.util.List<java.lang.String> list,
                                           int start)
        Searches a List of String objects forwards for the first occurrence of a Comma String object from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • prevIndexOfComma

        public static int prevIndexOfComma​(java.util.List<java.lang.String> list,
                                           int start)
        Searches a List of String objects backwards for the first occurrence of a Comma String Object from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • nextIndexOfOperator

        public static int nextIndexOfOperator​(java.util.List<java.lang.String> list,
                                              int start)
        Searches a List of String objects forwards for the first occurrence of a Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • createStringFrom

        public static java.lang.String createStringFrom​(java.util.List<java.lang.String> list,
                                                        int start,
                                                        int end)
        Parameters:
        list - The List from which the copy is to be done
        start - The index to start the copy from
        end - The index where the copy is to end(excluded).
        Returns:
        a String that contains the concatenation of all items between index start and index end(excluded.) of the List.
      • prevIndexOfOperator

        public static int prevIndexOfOperator​(java.util.List<java.lang.String> list,
                                              int start)
        Searches a List of String objects backwards for the first occurrence of a Operator from the point where the search commences.
        Parameters:
        list - the collection of objects that the search is to be carried out on
        start - the starting index of the search from where we search forwards for the object that index itself been not included
        Returns:
        the index of the first occurrence of the String object after start or -1 if the object is not found.
      • cutPortionOfList

        public static java.util.List cutPortionOfList​(java.util.List list,
                                                      int start,
                                                      int end)
        Parameters:
        list - the collection of objects that we wish to modify
        start - the index at which we start removing items from the list(start inclusive)
        end - the index at which we stop removing items (end exclusive)
        Returns:
        the list without all elements between start(start inclusive) and end(not inclusive) e.g for list L=[0,1,2,3,4,5,6,7,8,9],cutPortionOfList( L,6,8) = [0,1,2,3,4,5,8,9]
      • main

        public static void main​(java.lang.String[] args)