aboutsummaryrefslogtreecommitdiff
path: root/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java')
-rw-r--r--src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java
index dbf812ea..9961432e 100644
--- a/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java
+++ b/src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java
@@ -24,6 +24,7 @@ import jdk.nashorn.internal.runtime.regexp.joni.Config;
import jdk.nashorn.internal.runtime.regexp.joni.WarnCallback;
import jdk.nashorn.internal.runtime.regexp.joni.constants.NodeType;
+@SuppressWarnings("javadoc")
public abstract class Node implements NodeType {
public Node parent;
@@ -33,8 +34,12 @@ public abstract class Node implements NodeType {
return 1 << getType();
}
- protected void setChild(final Node tgt){} // default definition
- protected Node getChild(){return null;} // default definition
+ protected void setChild(final Node tgt) {
+ //empty, default definition
+ }
+ protected Node getChild() {
+ return null; // default definition
+ }
public void swap(final Node with) {
Node tmp;
@@ -46,9 +51,13 @@ public abstract class Node implements NodeType {
//setChild(with.getChild());
//with.setChild(tmp);
- if (parent != null) parent.setChild(with);
+ if (parent != null) {
+ parent.setChild(with);
+ }
- if (with.parent != null) with.parent.setChild(this);
+ if (with.parent != null) {
+ with.parent.setChild(this);
+ }
tmp = parent;
parent = with.parent;
@@ -81,16 +90,22 @@ public abstract class Node implements NodeType {
}
protected static String pad(final Object value, final int level) {
- if (value == null) return "NULL";
+ if (value == null) {
+ return "NULL";
+ }
final StringBuilder pad = new StringBuilder(" ");
- for (int i=0; i<level; i++) pad.append(pad);
+ for (int i=0; i<level; i++) {
+ pad.append(pad);
+ }
return value.toString().replace("\n", "\n" + pad);
}
public final boolean isInvalidQuantifier() {
- if (!Config.VANILLA) return false;
+ if (!Config.VANILLA) {
+ return false;
+ }
ConsAltNode node;
@@ -107,14 +122,18 @@ public abstract class Node implements NodeType {
case LIST:
node = (ConsAltNode)this;
do {
- if (!node.car.isInvalidQuantifier()) return false;
+ if (!node.car.isInvalidQuantifier()) {
+ return false;
+ }
} while ((node = node.cdr) != null);
return false;
case ALT:
node = (ConsAltNode)this;
do {
- if (node.car.isInvalidQuantifier()) return true;
+ if (node.car.isInvalidQuantifier()) {
+ return true;
+ }
} while ((node = node.cdr) != null);
break;