import java.util.*; import java.io.*; import edu.neu.ccs.demeter.*; class AttrValue_List implements java.util.Enumeration, Cloneable { protected Nonempty_AttrValue_List first; public Nonempty_AttrValue_List get_first() { return first; } public void set_first(Nonempty_AttrValue_List new_first) { first = new_first; } public AttrValue_List() { super(); } public AttrValue_List(Nonempty_AttrValue_List first) { super(); set_first(first); } public static AttrValue_List parse(java.io.Reader in) throws ParseException { return new Parser(in)._AttrValue_List(); } public static AttrValue_List parse(java.io.InputStream in) throws ParseException { return new Parser(in)._AttrValue_List(); } public static AttrValue_List parse(String s) { try { return parse(new java.io.StringReader(s)); } catch (ParseException e) { throw new RuntimeException(e.toString()); } } public String getAttributePrefix(String nsPrefix, String name) { return getAttributeRecord(nsPrefix, name)[0]; } public String getAttributeName(String nsPrefix, String name) { return getAttributeRecord(nsPrefix, name)[1]; } public String getAttributeValue(String nsPrefix, String name) { return getAttributeRecord(nsPrefix, name)[2]; } public String[] getAllAttributeNames(String nsPrefix, String name) { String allAttrs[][] = getAllAttributeRecords(nsPrefix, name); String allValues[] = new String[allAttrs.length]; for (int i = 0; i < allAttrs.length; i++) allValues[i] = allAttrs[i][1]; return allValues; } private String[] getAttributeRecord(String nsPrefix, String name) { String attrRecord[] = new String[] {"", "", ""}; for (Enumeration attrValues = elements(); attrValues.hasMoreElements(); ) { AttrValue attr = (AttrValue) attrValues.nextElement(); String attrPrefix = (attr.prefix==null) ? "" : (attr.prefix.namespace.toString()); String attrName = attr.attrName.toString(); String attrValue = attr.attrValue; if (((nsPrefix == null) || (attrPrefix.equals(nsPrefix))) && ((name == null) || (attrName.equals(name)))) { attrRecord[0] = attrPrefix; attrRecord[1] = attrName; attrRecord[2] = attrValue; break; } } return attrRecord; } private String[][] getAllAttributeRecords(String nsPrefix, String name) { Vector allMatchingAttributes = new Vector(); String attrRecord[] = new String[] {"", "", ""}; for (Enumeration attrValues = elements(); attrValues.hasMoreElements(); ) { AttrValue attr = (AttrValue) attrValues.nextElement(); String attrPrefix = (attr.prefix==null) ? "" : (attr.prefix.namespace.toString()); String attrName = attr.attrName.toString(); String attrValue = attr.attrValue; if (((nsPrefix == null) || (attrPrefix.equals(nsPrefix))) && ((name == null) || (attrName.equals(name)))) { attrRecord[0] = attrPrefix; attrRecord[1] = attrName; attrRecord[2] = attrValue; allMatchingAttributes.addElement(attrRecord); } } String returnValue[][] = new String[allMatchingAttributes.size()][]; allMatchingAttributes.copyInto(returnValue); return returnValue; } void universal_trv0_bef(UniversalVisitor _v_) { ((UniversalVisitor) _v_).before(this); } void universal_trv0_aft(UniversalVisitor _v_) { ((UniversalVisitor) _v_).after(this); } void universal_trv0(UniversalVisitor _v_) { universal_trv0_bef(_v_); if (first != null) { ((UniversalVisitor) _v_).before_first(this, first); first.universal_trv0(_v_); ((UniversalVisitor) _v_).after_first(this, first); } universal_trv0_aft(_v_); } void processDefinition_Schema_trv_bef(SchemaVisitor __v0) { ((UniversalVisitor) __v0).before(this); } void processDefinition_Schema_trv_aft(SchemaVisitor __v0) { ((UniversalVisitor) __v0).after(this); } void processDefinition_Schema_trv(SchemaVisitor __v0) { processDefinition_Schema_trv_bef(__v0); if (first != null) { ((UniversalVisitor) __v0).before_first(this, first); first.processDefinition_Schema_trv(__v0); ((UniversalVisitor) __v0).after_first(this, first); } processDefinition_Schema_trv_aft(__v0); } void __trav_print_Schema_trv_bef(DisplayVisitor __v0) { ((DisplayVisitor) __v0).before(this); } void __trav_print_Schema_trv_aft(DisplayVisitor __v0) { ((DisplayVisitor) __v0).after(this); } void __trav_print_Schema_trv(DisplayVisitor __v0) { __trav_print_Schema_trv_bef(__v0); if (first != null) { ((DisplayVisitor) __v0).before_first(this, first); first.__trav_print_Schema_trv(__v0); ((UniversalVisitor) __v0).after_first(this, first); } __trav_print_Schema_trv_aft(__v0); } private Nonempty_AttrValue_List tail; public void addElement(AttrValue e) { checktail(); if (tail == null) { first = new Nonempty_AttrValue_List(e,null); tail = first; } else { tail.set_next(new Nonempty_AttrValue_List(e,null)); tail = tail.get_next(); } } public void push(AttrValue e) { first = new Nonempty_AttrValue_List(e,first); } public java.util.Enumeration elements() { return new AttrValue_List(first); } public int size() { int i= 0; for (java.util.Enumeration e=elements(); e.hasMoreElements(); i++) e.nextElement(); return i; } public boolean isEmpty() { return (first == null); } public boolean hasMoreElements() { return (first != null); } public Object nextElement() { AttrValue car = first.get_it(); first = first.get_next(); return (Object) car; } private void checktail() { if (tail == null && first != null) { tail = first; while (tail.get_next() != null) tail = tail.get_next(); } } public boolean contains(AttrValue e) { java.util.Enumeration en = this.elements(); while (en.hasMoreElements()) if (e.equals((AttrValue) en.nextElement())) return true; return false; } }