home *** CD-ROM | disk | FTP | other *** search
- package com.ibm.xml.parser;
-
- import java.util.BitSet;
-
- public class CM2op extends CMNode {
- static final long serialVersionUID = 3303486725862458161L;
- int type;
- CMNode leftNode;
- CMNode rightNode;
-
- public CM2op(int var1, CMNode var2, CMNode var3) {
- this.type = var1;
- this.leftNode = var2;
- this.rightNode = var3;
- }
-
- public int getType() {
- return this.type;
- }
-
- public CMNode getLeft() {
- return this.leftNode;
- }
-
- public void setLeft(CMNode var1) {
- this.leftNode = var1;
- }
-
- public CMNode getRight() {
- return this.rightNode;
- }
-
- public void setRight(CMNode var1) {
- this.rightNode = var1;
- }
-
- public String toString() {
- return this.leftNode instanceof CM2op && ((CM2op)this.leftNode).type == this.type ? "(" + ((CM2op)this.leftNode).toStringWithoutParen() + (char)this.type + this.rightNode.toString() + ")" : "(" + this.leftNode.toString() + (char)this.type + this.rightNode.toString() + ")";
- }
-
- String toStringWithoutParen() {
- return this.leftNode instanceof CM2op && ((CM2op)this.leftNode).type == this.type ? ((CM2op)this.leftNode).toStringWithoutParen() + (char)this.type + this.rightNode.toString() : this.leftNode.toString() + (char)this.type + this.rightNode.toString();
- }
-
- CMNode cloneNode() {
- return new CM2op(this.type, this.leftNode.cloneNode(), this.rightNode.cloneNode());
- }
-
- boolean nullable() {
- if (super.nullable == null) {
- switch (this.type) {
- case 44:
- super.nullable = new Boolean(this.leftNode.nullable() && this.rightNode.nullable());
- break;
- case 124:
- super.nullable = new Boolean(this.leftNode.nullable() || this.rightNode.nullable());
- }
- }
-
- return super.nullable;
- }
-
- BitSet firstpos() {
- if (super.firstPos == null) {
- if (this.type == 124) {
- super.firstPos = (BitSet)this.leftNode.firstpos().clone();
- super.firstPos.or(this.rightNode.firstpos());
- } else if (this.leftNode.nullable()) {
- super.firstPos = (BitSet)this.leftNode.firstpos().clone();
- super.firstPos.or(this.rightNode.firstpos());
- } else {
- super.firstPos = this.leftNode.firstpos();
- }
- }
-
- return super.firstPos;
- }
-
- BitSet lastpos() {
- if (super.lastPos == null) {
- if (this.type == 124) {
- super.lastPos = (BitSet)this.leftNode.lastpos().clone();
- super.lastPos.or(this.rightNode.lastpos());
- } else if (this.rightNode.nullable()) {
- super.lastPos = (BitSet)this.leftNode.lastpos().clone();
- super.lastPos.or(this.rightNode.lastpos());
- } else {
- super.lastPos = this.rightNode.lastpos();
- }
- }
-
- return super.lastPos;
- }
-
- void prepare(int var1) {
- this.leftNode.prepare(var1);
- this.rightNode.prepare(var1);
- }
-
- void setFollowpos(BitSet[] var1) {
- this.leftNode.setFollowpos(var1);
- this.rightNode.setFollowpos(var1);
- if (this.type != 124 && this.type == 44) {
- for(int var2 = 0; var2 < var1.length; ++var2) {
- if (this.leftNode.lastpos().get(var2)) {
- var1[var2].or(this.rightNode.firstpos());
- }
- }
- }
-
- }
-
- public boolean equals(Object var1) {
- if (!(var1 instanceof CM2op)) {
- return false;
- } else {
- CM2op var2 = (CM2op)var1;
- if (var2.getType() != this.getType()) {
- return false;
- } else {
- return var2.getLeft().equals(this.getLeft()) && var2.getRight().equals(this.getRight());
- }
- }
- }
-
- public int hashCode() {
- return this.getLeft().hashCode() + this.getRight().hashCode();
- }
- }
-