Changed visibility of classes
This commit is contained in:
parent
ff54e19845
commit
d7b66238ed
1 changed files with 121 additions and 120 deletions
|
|
@ -138,15 +138,14 @@ public class MathParser {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
abstract class Math{
|
static abstract class Math{
|
||||||
public abstract double exec();
|
public abstract double exec();
|
||||||
|
|
||||||
public abstract String toString();
|
public abstract String toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathNode extends Math{
|
static class MathNode extends Math{
|
||||||
Math math;
|
Math math;
|
||||||
|
|
||||||
public double exec() {
|
public double exec() {
|
||||||
|
|
@ -156,9 +155,9 @@ class MathNode extends Math{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "( "+math.toString()+" )";
|
return "( "+math.toString()+" )";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathNumber extends Math{
|
static class MathNumber extends Math{
|
||||||
double num;
|
double num;
|
||||||
|
|
||||||
public double exec() {
|
public double exec() {
|
||||||
|
|
@ -168,16 +167,16 @@ class MathNumber extends Math{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return ""+num;
|
return ""+num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class MathOperation extends Math{
|
static abstract class MathOperation extends Math{
|
||||||
Math math1;
|
Math math1;
|
||||||
Math math2;
|
Math math2;
|
||||||
|
|
||||||
public abstract double exec();
|
public abstract double exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathAddition extends MathOperation{
|
static class MathAddition extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec() + math2.exec();
|
return math1.exec() + math2.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -185,9 +184,9 @@ class MathAddition extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+" + "+math2.toString();
|
return math1.toString()+" + "+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathSubtraction extends MathOperation{
|
static class MathSubtraction extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec() - math2.exec();
|
return math1.exec() - math2.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -195,9 +194,9 @@ class MathSubtraction extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+" - "+math2.toString();
|
return math1.toString()+" - "+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathMultiplication extends MathOperation{
|
static class MathMultiplication extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec() * math2.exec();
|
return math1.exec() * math2.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -205,9 +204,9 @@ class MathMultiplication extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+" * "+math2.toString();
|
return math1.toString()+" * "+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathDivision extends MathOperation{
|
static class MathDivision extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec() / math2.exec();
|
return math1.exec() / math2.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -215,9 +214,9 @@ class MathDivision extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+" / "+math2.toString();
|
return math1.toString()+" / "+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathModulus extends MathOperation{
|
static class MathModulus extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec() % math2.exec();
|
return math1.exec() % math2.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -225,9 +224,9 @@ class MathModulus extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+" % "+math2.toString();
|
return math1.toString()+" % "+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathPow extends MathOperation{
|
static class MathPow extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
double ret = 1;
|
double ret = 1;
|
||||||
double tmp1 = math1.exec();
|
double tmp1 = math1.exec();
|
||||||
|
|
@ -241,9 +240,9 @@ class MathPow extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString()+"^"+math2.toString();
|
return math1.toString()+"^"+math2.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class EmptyMath extends MathOperation{
|
static class EmptyMath extends MathOperation{
|
||||||
public double exec() {
|
public double exec() {
|
||||||
return math1.exec();
|
return math1.exec();
|
||||||
}
|
}
|
||||||
|
|
@ -251,4 +250,6 @@ class EmptyMath extends MathOperation{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return math1.toString();
|
return math1.toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue