/** * DOCUMENT ME! * * @param copy */ public ChoiceAttributeType(ChoiceAttributeType copy) { super( copy.getType(), copy.getName(), copy.getMinOccurs(), copy.getMaxOccurs(), copy.isNillable(), copy.getDefaultValue() ); this.children = copyChildren(copy.getAttributeTypes()); }
/** * Gets the attributeType at this xPath, if the specified attributeType * does not exist then null is returned. * * @param xPath XPath pointer to attribute type. * * @return True if attribute exists. */ public AttributeType getAttributeType(String xPath) { AttributeType attType = null; int idx = find(xPath); if (idx >= 0) { attType = children[idx]; } return attType; }
/** * This is only used twice in the whole geotools code base, and one of * those is for a test, so we're removing it from the interface. If * getAttributeType does not have the AttributeType it will just return * null. Gets the number of occurrences of this attribute. * * @param xPath XPath pointer to attribute type. * * @return Number of occurrences. */ public boolean hasAttributeType(String xPath) { return getAttributeType(xPath) != null; }
public ChoiceAttributeType(String name, int min, int max, AttributeType[] children, Filter restriction) { nill = calculateNillable(children); this.min = min; this.max = max; this.name = name; //ensure immutable. this.children = copyChildren(children); this.restriction = restriction; }
/** * DOCUMENT ME! * * @param copy */ public ChoiceAttributeType(ChoiceAttributeType copy) { nill = copy.isNillable(); min = copy.getMinOccurs(); max = copy.getMaxOccurs(); name = copy.getName(); this.children = copyChildren(copy.getAttributeTypes()); restriction = copy.getRestriction(); }
/** * Gets a representation of this object as a string. * * @return A representation of this object as a string */ public String toString() { String details = "name=" + name; details += ((" , nillable=" + isNillable()) + ", min=" + getMinOccurs() + ", max=" + getMaxOccurs()); details += (", choices: " + Arrays.asList(children)); return "ChoiceAttributeType [" + details + "]"; }
public boolean equals(Object other) { if (other == null) { return false; } if (!(other instanceof ChoiceAttributeType)) { return false; } ChoiceAttributeType att = (ChoiceAttributeType) other; if (name == null) { if (att.getName() != null) { return false; } } else if (!name.equals(att.getName())) { return false; } //hmmm... This makes the assumption that the order of the choices //matters - not sure if that's true. Though the order does matter a //a bit for our parse method, so this is probably right, since two //with different orders could have diff. behaviors for that method. if (!Arrays.equals(children, att.getAttributeTypes())) { return false; } return true; }
public ChoiceAttributeType(String name, int min, int max, AttributeType[] children, Filter restriction) { super(DefaultAttributeType.createAttributeType(name, Object.class, restriction), new NameImpl(name),min,max,calculateNillableStatic(children),null); //ensure immutable. this.children = copyChildren(children); }
public boolean equals(Object other) { if (other == null) { return false; } if (!(other instanceof ChoiceAttributeType)) { return false; } ChoiceAttributeType att = (ChoiceAttributeType) other; if (!super.equals(att)) { return false; } //hmmm... This makes the assumption that the order of the choices //matters - not sure if that's true. Though the order does matter a //a bit for our parse method, so this is probably right, since two //with different orders could have diff. behaviors for that method. if (!Arrays.equals(children, att.getAttributeTypes())) { return false; } return true; }
public boolean calculateNillable(AttributeType[] children) { return calculateNillableStatic(children); }
/** * Gets the attributeType at this xPath, if the specified attributeType * does not exist then null is returned. * * @param xPath XPath pointer to attribute type. * * @return True if attribute exists. */ public AttributeType getAttributeType(String xPath) { AttributeType attType = null; int idx = find(xPath); if (idx >= 0) { attType = children[idx]; } return attType; }
/** * This is only used twice in the whole geotools code base, and one of * those is for a test, so we're removing it from the interface. If * getAttributeType does not have the AttributeType it will just return * null. Gets the number of occurrences of this attribute. * * @param xPath XPath pointer to attribute type. * * @return Number of occurrences. */ public boolean hasAttributeType(String xPath) { return getAttributeType(xPath) != null; }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) { return -1; } int idx = find(type.getName()); if ((idx < 0) || !children[idx].equals(type)) { idx = -1; } return idx; }
/** * Find the position of a given AttributeType. * * @param type The type to search for. * * @return -1 if not found, a zero-based index if found. */ public int find(AttributeType type) { if (type == null) { return -1; } int idx = find(type.getLocalName()); if ((idx < 0) || !children[idx].equals(type)) { idx = -1; } return idx; }