home *** CD-ROM | disk | FTP | other *** search
- package com.ms.xml.parser;
-
- import com.ms.xml.om.Element;
- import com.ms.xml.om.ElementImpl;
- import com.ms.xml.util.Atom;
- import com.ms.xml.util.Name;
- import com.ms.xml.util.XMLOutputStream;
- import java.io.IOException;
- import java.util.BitSet;
-
- class Choice extends Node {
- Node left;
- Node right;
-
- Choice(Node var1, Node var2) {
- this.left = var1;
- this.right = var2;
- }
-
- BitSet firstpos(int var1) {
- if (super.first == null) {
- super.first = (BitSet)this.left.firstpos(var1).clone();
- super.first.or(this.right.firstpos(var1));
- }
-
- return super.first;
- }
-
- BitSet lastpos(int var1) {
- if (super.last == null) {
- super.last = (BitSet)this.left.lastpos(var1).clone();
- super.last.or(this.right.lastpos(var1));
- }
-
- return super.last;
- }
-
- Element toSchema(int var1, int var2, Element var3) {
- if (var1 == 124) {
- var3 = this.left.toSchema(124, var2, var3);
- this.right.toSchema(124, var2, var3);
- } else {
- Element var4 = new ElementImpl(Name.create("GROUP", "XML"), 0);
- var4.setAttribute(Name.create("GROUPTYPE", "XML"), "OR");
- if (var1 == 63) {
- var4.setAttribute(Name.create("OCCURS", "XML"), "OPTIONAL");
- } else if (var1 == 42) {
- var4.setAttribute(Name.create("OCCURS", "XML"), "STAR");
- } else if (var1 == 43) {
- var4.setAttribute(Name.create("OCCURS", "XML"), "PLUS");
- }
-
- var4 = this.left.toSchema(124, var2, var4);
- this.right.toSchema(124, var2, var4);
- var3.addChild(var4, (Element)null);
- }
-
- --var2;
- return var3;
- }
-
- void save(XMLOutputStream var1, int var2, int var3, Atom var4) throws IOException {
- ++var3;
- if (var2 == 124) {
- this.left.save(var1, 124, var3, var4);
- var1.write(124);
- this.right.save(var1, 124, var3, var4);
- } else {
- var1.write(40);
- this.left.save(var1, 124, var3, var4);
- var1.write(124);
- this.right.save(var1, 124, var3, var4);
- var1.write(41);
- }
-
- --var3;
- }
-
- Node clone(ContentModel var1) {
- return new Choice(this.left.clone(var1), this.right.clone(var1));
- }
-
- void calcfollowpos(BitSet[] var1) {
- this.left.calcfollowpos(var1);
- this.right.calcfollowpos(var1);
- }
-
- boolean nullable() {
- return this.left.nullable() || this.right.nullable();
- }
- }
-