BUG-5410: bring the imported source code to Java 7 world
[yangtools.git] / third-party / xsd-regex / src / main / java / org / opendaylight / yangtools / xsd / regex / Op.java
index db834f51793f883c5e71b2549317d4a48f4ff715..47885abd43ae2e39141f6f6fa1180b236e413750 100644 (file)
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,7 +21,7 @@ import java.util.Vector;
 
 /**
  * @xerces.internal
- * 
+ *
  * @version $Id: Op.java 572108 2007-09-02 18:48:31Z mrglavas $
  */
 class Op {
@@ -30,7 +30,7 @@ class Op {
     static final int RANGE = 3;                 // [a-zA-Z]
     static final int NRANGE = 4;                // [^a-zA-Z]
     static final int ANCHOR = 5;                // ^ $ ...
-    static final int STRING = 6;                // literal String 
+    static final int STRING = 6;                // literal String
     static final int CLOSURE = 7;               // X*
     static final int NONGREEDYCLOSURE = 8;      // X*?
     static final int QUESTION = 9;              // X?
@@ -50,75 +50,105 @@ class Op {
     static final boolean COUNT = false;
 
     static Op createDot() {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new Op(Op.DOT);
     }
     static CharOp createChar(int data) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new CharOp(Op.CHAR, data);
     }
     static CharOp createAnchor(int data) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new CharOp(Op.ANCHOR, data);
     }
     static CharOp createCapture(int number, Op next) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         CharOp op = new CharOp(Op.CAPTURE, number);
         op.next = next;
         return op;
     }
     static UnionOp createUnion(int size) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         //System.err.println("Creates UnionOp");
         return new UnionOp(Op.UNION, size);
     }
     static ChildOp createClosure(int id) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new ModifierOp(Op.CLOSURE, id, -1);
     }
     static ChildOp createNonGreedyClosure() {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new ChildOp(Op.NONGREEDYCLOSURE);
     }
     static ChildOp createQuestion(boolean nongreedy) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new ChildOp(nongreedy ? Op.NONGREEDYQUESTION : Op.QUESTION);
     }
     static RangeOp createRange(Token tok) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new RangeOp(Op.RANGE, tok);
     }
     static ChildOp createLook(int type, Op next, Op branch) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         ChildOp op = new ChildOp(type);
         op.setChild(branch);
         op.next = next;
         return op;
     }
     static CharOp createBackReference(int refno) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new CharOp(Op.BACKREFERENCE, refno);
     }
     static StringOp createString(String literal) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         return new StringOp(Op.STRING, literal);
     }
     static ChildOp createIndependent(Op next, Op branch) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         ChildOp op = new ChildOp(Op.INDEPENDENT);
         op.setChild(branch);
         op.next = next;
         return op;
     }
     static ModifierOp createModifier(Op next, Op branch, int add, int mask) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         ModifierOp op = new ModifierOp(Op.MODIFIER, add, mask);
         op.setChild(branch);
         op.next = next;
         return op;
     }
     static ConditionOp createCondition(Op next, int ref, Op conditionflow, Op yesflow, Op noflow) {
-        if (Op.COUNT)  Op.nofinstances ++;
+        if (Op.COUNT) {
+            Op.nofinstances ++;
+        }
         ConditionOp op = new ConditionOp(Op.CONDITION, ref, conditionflow, yesflow, noflow);
         op.next = next;
         return op;
@@ -141,7 +171,7 @@ class Op {
         throw new RuntimeException("Internal Error: type="+this.type);
     }
                                                 // ModifierOp
-    int getData() {                             // CharOp  for CHAR, BACKREFERENCE, CAPTURE, ANCHOR, 
+    int getData() {                             // CharOp  for CHAR, BACKREFERENCE, CAPTURE, ANCHOR,
         throw new RuntimeException("Internal Error: type="+this.type);
     }
     int getData2() {                            // ModifierOp
@@ -161,6 +191,7 @@ class Op {
             super(type);
             this.charData = data;
         }
+        @Override
         int getData() {
             return this.charData;
         }
@@ -168,19 +199,21 @@ class Op {
 
     // ================================================================
     static class UnionOp extends Op {
-        final Vector branches;
+        final Vector<Op> branches;
         UnionOp(int type, int size) {
             super(type);
-            this.branches = new Vector(size);
+            this.branches = new Vector<>(size);
         }
         void addElement(Op op) {
             this.branches.addElement(op);
         }
+        @Override
         int size() {
             return this.branches.size();
         }
+        @Override
         Op elementAt(int index) {
-            return (Op)this.branches.elementAt(index);
+            return this.branches.elementAt(index);
         }
     }
 
@@ -193,6 +226,7 @@ class Op {
         void setChild(Op child) {
             this.child = child;
         }
+        @Override
         Op getChild() {
             return this.child;
         }
@@ -206,9 +240,11 @@ class Op {
             this.v1 = v1;
             this.v2 = v2;
         }
+        @Override
         int getData() {
             return this.v1;
         }
+        @Override
         int getData2() {
             return this.v2;
         }
@@ -220,6 +256,7 @@ class Op {
             super(type);
             this.tok = tok;
         }
+        @Override
         RangeToken getToken() {
             return (RangeToken)this.tok;
         }
@@ -231,6 +268,7 @@ class Op {
             super(type);
             this.string = literal;
         }
+        @Override
         String getString() {
             return this.string;
         }