Class Method
java.lang.Object
com.github.gbenroscience.parser.methods.Method
Models the methods that perform calculations in the parser.
- Author:
- JIBOYE OLUWAGBEMIRO OLAOLUWA
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanarrayContains(String[] array, String str) booleanstatic String[]intgetDRG()getName()String[]static booleanhasStatsMethod(String expr) Scans the given expression for statistical operatorsstatic booleanstatic booleanisDefinedMethod(String methodName) booleanisDeterminant(String op) booleanstatic booleanisExpMethod(String op) static booleanisFunctionOperatingMethod(String methodName) static booleanisInBuiltMethod(String methodName) static booleanbooleanisLinearSys(String op) static booleanstatic booleanstatic booleanisLogToAnyBase(String op) static booleanisMatrixAdd(String op) booleanbooleanstatic booleanisMatrixDiv(String op) static booleanisMatrixEdit(String op) booleanbooleanbooleanisMatrixInvert(String op) static booleanisMatrixMethod(String op) static booleanisMatrixMul(String op) static booleanisMatrixPow(String op) static booleanisMatrixSub(String op) static booleanisMethodName(String name) static booleanstatic booleanisMethodNameBeginnerChar(char c) static booleanstatic booleanisMethodNameBuilderChar(char c) ///////////////////////////////////////////////////////////////////static booleanisNaturalLog(String op) static booleanbooleanstatic booleanstatic booleanisStatsMethod(String op) static booleanisTranspose(String op) booleanstatic booleanisUnaryPreOperatorORDefinedMethod(String methodName) static booleanstatic voidfinal voidparseExpression(String expression) voidsetDRG(int DRG) voidvoidsetParameters(String[] parameters) toString()////////////////////////////////////////////////////////////////////
-
Constructor Details
-
Method
-
Method
- Parameters:
expression- Initializes the attributes of objects of this class by parsing the expression parameter. The format of expression is: methodname(args_1,args_2,....args_N)
-
-
Method Details
-
isFunctionOperatingMethod
- Parameters:
methodName- The name of the method.- Returns:
- true if the method name represents one that can operate on Function objects or anonymous Functions.
-
getAllFunctions
- Returns:
- An array containing the names of all functions defined by the user and inbuilt into the software.
-
parseExpression
- Parameters:
expression- The expression to parse. The format of expression is: methodname(args_1,args_2,....args_N)
-
setName
-
getName
-
setParameters
-
getParameters
-
setDRG
public void setDRG(int DRG) -
getDRG
public int getDRG() -
isListReturningStatsMethod
- Parameters:
op- the String to check- Returns:
- true if the operator is a statistical operator that returns items in a list e.g sort(
-
isNumberReturningStatsMethod
- Parameters:
op- the String to check- Returns:
- true if the operator is a statistical operator that operates on a data set and returns a single value: e.g sum(4,3,2,2...)
-
isRandom
- Parameters:
op- the String to check- Returns:
- true if the operator is the random(rnd) operator
-
isLogToAnyBase
- Parameters:
op- the String to check- Returns:
- true if the operator is the log operator the form is log(num,base)
-
isAntiLogToAnyBase
- Parameters:
op- the String to check- Returns:
- true if the operator is the log operator the form is log-¹(num,base)
-
isNaturalLog
- Parameters:
op- the String to check- Returns:
- true if the operator is the natural log operator the form is log-¹(num,base)
-
isInverseNaturalLog
- Parameters:
op- the String to check- Returns:
- true if the operator is the inverse natural log operator the form is log-¹(num,base)
-
isExpMethod
- Parameters:
op- the String to check- Returns:
- true if the operator is the inverse natural log operator the form is log-¹(num,base)
-
isLogOrAntiLogToAnyBase
- Parameters:
op- the String to check- Returns:
- true if the operator is the log operator or the log-¹ operator
-
isDeterminant
-
isMatrixInvert
-
isLinearSys
-
isTriMat
-
isEchelon
-
isMatrixCofactors
-
isMatrixAdjoint
-
isMatrixEigenVec
-
isMatrixEigenPoly
-
isPrint
-
isStatsMethod
- Parameters:
op- the String to check- Returns:
- true if the operator is a statistical operator..basically any
system function that takes more than 1 argument. So by definition even
the
logandalog(and its log-¹ variant) are included here. e.g sum,prod,min,max,avg,var,rms,cov,s_d,st_err,rng,mrng,med,mode,rnd
-
isMatrixMethod
- Parameters:
op- The method name- Returns:
- true if the method is capable of acting on one or more matrix functions
-
isMatrixMul
- Parameters:
op- The method name- Returns:
- true if the method is the matrix multiplication method name
-
isMatrixDiv
- Parameters:
op- The method name- Returns:
- true if the method is the matrix division method name
-
isMatrixAdd
- Parameters:
op- The method name- Returns:
- true if the method is the matrix addition method name
-
isMatrixSub
- Parameters:
op- The method name- Returns:
- true if the method is the matrix subtraction method name
-
isMatrixPow
- Parameters:
op- The method name- Returns:
- true if the method is the matrix power method name
-
isTranspose
- Parameters:
op- The method name- Returns:
- true if the method is the transpose method name
-
isMatrixEdit
- Parameters:
op- The method name- Returns:
- true if the method is the matrix edit method name
-
isUserDefinedFunction
- Returns:
- true if the Function name has been defined by the user in the user's workspace.
-
run
- Parameters:
list- A list containing a portion of a scanned function that has information about a method and its parameters..e.g. [sin,(,3.14,)] , or [matrix_edit,(,M,3,4,-90,)] may be grabbed from a scanner output and sent to this method to evaluate.DRG- The trigonometric mode in which to run the method.- Returns:
- a
Listobject which is the output of the method's operation.
-
isUnaryPreOperatorORDefinedMethod
- Parameters:
methodName- The name of the method- Returns:
- true if the method has been defined by the user or is defined by the parser.
-
isDefinedMethod
- Parameters:
methodName- The name of the method- Returns:
- true if the method has been defined by the user or is defined by the parser.
-
isInBuiltMethod
- Parameters:
methodName- The name of the method- Returns:
- true if the method is defined by the parser as a core inbuilt function.
-
arrayContains
-
isMethodName
- Parameters:
name- The string to check if or not it represents a valid method name.
The method may or may not have been defined. But once it represents a valid method name, this method will return true. In contrast, the 'isDefinedMethod' checks whether or not the method has been afore-defined.- Returns:
- true if the string represents a valid method name.
-
isMethodNameBuilderChar
public static boolean isMethodNameBuilderChar(char c) /////////////////////////////////////////////////////////////////// -
isMethodNameBuilder
- Parameters:
s- The string to check.- Returns:
- true if the string is part of the valid characters that can be used to build a method name.
-
isMethodNameBeginnerChar
public static boolean isMethodNameBeginnerChar(char c) -
isMethodNameBeginner
-
toString
-
equals
-
hasStatsMethod
Scans the given expression for statistical operators- Parameters:
expr- The input expression- Returns:
- true if it finds statistical operators in the expression.
-
main
-