Skip to content

Commit 1b2f5a2

Browse files
committed
Added an independent method to check for trigonometric operators
1 parent 0bdd212 commit 1b2f5a2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

jcalc/src/main/java/cu/lt/joe/jcalc/algorithms/AlgorithmImplementation.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ protected static boolean isMathConstant(char possibleConstant)
8383
return possibleConstant == 'e' || possibleConstant == 'π';
8484
}
8585

86-
protected static boolean isFunctionalOperator(String possibleFunctionalOperator)
86+
protected static boolean isTrigonometricOperator(String possibleTrigonometricOperator)
8787
{
88-
switch (possibleFunctionalOperator)
88+
switch (possibleTrigonometricOperator)
8989
{
9090
case "sin":
9191
case "cos":
@@ -99,14 +99,23 @@ protected static boolean isFunctionalOperator(String possibleFunctionalOperator)
9999
case "csc":
100100
case "sec":
101101
case "cot":
102+
return true;
103+
}
104+
return false;
105+
}
106+
107+
protected static boolean isFunctionalOperator(String possibleFunctionalOperator)
108+
{
109+
switch (possibleFunctionalOperator)
110+
{
102111
case "ln":
103112
case "log":
104113
case "log2":
105114
case "sqrt":
106115
case "cbrt":
107116
return true;
108117
}
109-
return false;
118+
return isTrigonometricOperator(possibleFunctionalOperator);
110119
}
111120

112121
/**

0 commit comments

Comments
 (0)