Package parser
Class LISTS
java.lang.Object
parser.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.StringcreateStringFrom(java.util.List<java.lang.String> list, int start, int end)static java.util.ListcutPortionOfList(java.util.List list, int start, int end)static intfirstoccurrenceOfStatsOrLogOrAntilogBehind(int start, java.util.List<java.lang.String> list)static intfirstoccurrenceOfStatsOrLogOrAntilogBeyond(int start, java.util.List<java.lang.String> list)static voidmain(java.lang.String[] args)static intnextIndexOf(java.util.List list, int start, java.lang.Object sought)static intnextIndexOfComma(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 intnextIndexOfInBetweenOperatorOrComma(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 intnextIndexOfListReturningStatsOperator(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 intnextIndexOfLogicOperator(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 intnextIndexOfLogOrAntiLogToAnyBase(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 intnextIndexOfMulOrDivOrRem(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 intnextIndexOfNumberReturningStatsOperator(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 intnextIndexOfOperator(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 intnextIndexOfPermOrCombOperator(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 intnextIndexOfPostNumberOperator(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 intnextIndexOfPowerOperator(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 intnextIndexOfPreNumberOperator(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 intnextIndexOfVariable(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 intprevIndexOf(java.util.List list, int start, java.lang.Object sought)static intprevIndexOfComma(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 intprevIndexOfInBetweenOperator(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 intprevIndexOfListReturningStatsOperator(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 intprevIndexOfLogicOperator(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 intprevIndexOfLogOrAntiLogToAnyBase(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 intprevIndexOfMulOrDivOrRem(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 intprevIndexOfNumberReturningStatsOperator(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 intprevIndexOfOperator(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 intprevIndexOfPermOrCombOperator(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 intprevIndexOfPostNumberOperator(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 intprevIndexOfPowerOperator(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 intprevIndexOfPreNumberOperator(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 intprevIndexOfVariable(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.
-
Constructor Details
-
LISTS
public LISTS()
-
-
Method Details
-
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 onstart- 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 onstart- 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 onstart- the starting index of the search from where we search backwards for the object that index itself been not includedsought- 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 onstart- 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 thestart, 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 onstart- 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 donestart- The index to start the copy fromend- 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 onstart- 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 modifystart- 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)
-