Skip to content

Commit 953710d

Browse files
committed
minor refactoring
1 parent b0390eb commit 953710d

File tree

4 files changed

+10
-33
lines changed

4 files changed

+10
-33
lines changed

jbbp-plugins/jbbp-gradle/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pluginBundle {
5757
plugins {
5858
JBBPPlugin {
5959
id = 'com.igormaznitsa.gradle.jbbp'
60-
displayName = 'Translator of JBBP scripts into executable sources'
60+
displayName = 'JBBP Sources Generator plugin'
6161
}
6262
}
6363
}

jbbp-plugins/jbbp-maven/jbbp-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<packaging>maven-plugin</packaging>
1414

1515
<name>JBBP Maven plugin</name>
16-
<description>Tool to generate static Java classes (1.6+) from JBBP scripts</description>
16+
<description>Generator of sources from JBBP scripts</description>
1717

1818
<profiles>
1919
<profile>

jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/conversion/ExpressionEvaluatorVisitor.java

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -91,37 +91,14 @@ enum Operator {
9191
UNARY_PLUS("+", 1, 500),
9292
UNARY_MINUS("-", 1, 500);
9393

94-
private final int priority;
95-
private final int args;
96-
private final String text;
94+
public final int priority;
95+
public final int argsNumber;
96+
public final String text;
9797

98-
Operator(final String text, final int args, final int priority) {
99-
this.args = args;
98+
Operator(final String text, final int argsNumber, final int priority) {
99+
this.argsNumber = argsNumber;
100100
this.priority = priority;
101101
this.text = text;
102102
}
103-
104-
public static Operator findForText(final String text) {
105-
Operator result = null;
106-
for (final Operator p : values()) {
107-
if (p.getText().equals(text)) {
108-
result = p;
109-
break;
110-
}
111-
}
112-
return result;
113-
}
114-
115-
public int getArgsNumber() {
116-
return this.args;
117-
}
118-
119-
public String getText() {
120-
return this.text;
121-
}
122-
123-
public int getPriority() {
124-
return this.priority;
125-
}
126103
}
127104
}

jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/conversion/JBBPToJava6Converter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ public ExpressionEvaluatorVisitor visitEnd() {
649649
final Operator op = (Operator) this.stack.remove(i);
650650
i--;
651651
ExprTreeItem newItem = new ExprTreeItem(op);
652-
for (int j = 0; j < op.getArgsNumber(); j++) {
652+
for (int j = 0; j < op.argsNumber; j++) {
653653
final Object val = this.stack.remove(i);
654654
i--;
655655
if (newItem.right == null) {
@@ -693,7 +693,7 @@ boolean doesNeedBrackets(Object obj) {
693693
}
694694
final ExprTreeItem that = (ExprTreeItem) obj;
695695

696-
return that.op.getPriority() <= this.op.getPriority() || ((that.op == Operator.LSHIFT || that.op == Operator.RSHIFT || that.op == Operator.URSHIFT) && (this.op == Operator.LSHIFT || this.op == Operator.RSHIFT || this.op == Operator.URSHIFT));
696+
return that.op.priority <= this.op.priority || ((that.op == Operator.LSHIFT || that.op == Operator.RSHIFT || that.op == Operator.URSHIFT) && (this.op == Operator.LSHIFT || this.op == Operator.RSHIFT || this.op == Operator.URSHIFT));
697697
}
698698

699699
@Override
@@ -706,7 +706,7 @@ public String toString() {
706706
if (doesNeedBrackets(this.right)) {
707707
rightStr = '(' + rightStr + ')';
708708
}
709-
return (leftStr == null ? "" : leftStr) + this.op.getText() + (rightStr == null ? "" : rightStr);
709+
return (leftStr == null ? "" : leftStr) + this.op.text + (rightStr == null ? "" : rightStr);
710710
}
711711
}
712712
};

0 commit comments

Comments
 (0)