//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.07.27 at 04:06:37 PM EDT
//
package org.isotc211._2005.gco;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.CopyStrategy2;
import org.jvnet.jaxb2_commons.lang.CopyTo2;
import org.jvnet.jaxb2_commons.lang.Equals2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.HashCode2;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy2;
import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBMergeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.MergeFrom2;
import org.jvnet.jaxb2_commons.lang.MergeStrategy2;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* Use to represent the possible cardinality of a relation. Represented by a set of simple multiplicity ranges.
*
* <p>Java class for Multiplicity_Type complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Multiplicity_Type">
* <complexContent>
* <extension base="{http://www.isotc211.org/2005/gco}AbstractObject_Type">
* <sequence>
* <element name="range" type="{http://www.isotc211.org/2005/gco}MultiplicityRange_PropertyType" maxOccurs="unbounded"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Multiplicity_Type", propOrder = {
"range"
})
public class MultiplicityType
extends AbstractObjectType
implements Serializable, Cloneable, CopyTo2, Equals2, HashCode2, MergeFrom2, ToString2
{
private final static long serialVersionUID = 1L;
@XmlElement(required = true)
@NotNull(message = "MultiplicityType.range {javax.validation.constraints.NotNull.message}")
@Size(min = 1)
@Valid
protected List<MultiplicityRangePropertyType> range;
/**
* Gets the value of the range property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the range property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRange().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link MultiplicityRangePropertyType }
*
*
*/
public List<MultiplicityRangePropertyType> getRange() {
if (range == null) {
range = new ArrayList<MultiplicityRangePropertyType>();
}
return this.range;
}
public boolean isSetRange() {
return ((this.range!= null)&&(!this.range.isEmpty()));
}
public void unsetRange() {
this.range = null;
}
public String toString() {
final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
super.appendFields(locator, buffer, strategy);
{
List<MultiplicityRangePropertyType> theRange;
theRange = (this.isSetRange()?this.getRange():null);
strategy.appendField(locator, this, "range", buffer, theRange, this.isSetRange());
}
return buffer;
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final MultiplicityType that = ((MultiplicityType) object);
{
List<MultiplicityRangePropertyType> lhsRange;
lhsRange = (this.isSetRange()?this.getRange():null);
List<MultiplicityRangePropertyType> rhsRange;
rhsRange = (that.isSetRange()?that.getRange():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "range", lhsRange), LocatorUtils.property(thatLocator, "range", rhsRange), lhsRange, rhsRange, this.isSetRange(), that.isSetRange())) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
List<MultiplicityRangePropertyType> theRange;
theRange = (this.isSetRange()?this.getRange():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "range", theRange), currentHashCode, theRange, this.isSetRange());
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy2 strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public Object clone() {
return copyTo(createNewInstance());
}
public Object copyTo(Object target) {
final CopyStrategy2 strategy = JAXBCopyStrategy.INSTANCE;
return copyTo(null, target, strategy);
}
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
super.copyTo(locator, draftCopy, strategy);
if (draftCopy instanceof MultiplicityType) {
final MultiplicityType copy = ((MultiplicityType) draftCopy);
{
Boolean rangeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, this.isSetRange());
if (rangeShouldBeCopiedAndSet == Boolean.TRUE) {
List<MultiplicityRangePropertyType> sourceRange;
sourceRange = (this.isSetRange()?this.getRange():null);
@SuppressWarnings("unchecked")
List<MultiplicityRangePropertyType> copyRange = ((List<MultiplicityRangePropertyType> ) strategy.copy(LocatorUtils.property(locator, "range", sourceRange), sourceRange, this.isSetRange()));
copy.unsetRange();
if (copyRange!= null) {
List<MultiplicityRangePropertyType> uniqueRangel = copy.getRange();
uniqueRangel.addAll(copyRange);
}
} else {
if (rangeShouldBeCopiedAndSet == Boolean.FALSE) {
copy.unsetRange();
}
}
}
}
return draftCopy;
}
public Object createNewInstance() {
return new MultiplicityType();
}
public void mergeFrom(Object left, Object right) {
final MergeStrategy2 strategy = JAXBMergeStrategy.INSTANCE;
mergeFrom(null, null, left, right, strategy);
}
public void mergeFrom(ObjectLocator leftLocator, ObjectLocator rightLocator, Object left, Object right, MergeStrategy2 strategy) {
super.mergeFrom(leftLocator, rightLocator, left, right, strategy);
if (right instanceof MultiplicityType) {
final MultiplicityType target = this;
final MultiplicityType leftObject = ((MultiplicityType) left);
final MultiplicityType rightObject = ((MultiplicityType) right);
{
Boolean rangeShouldBeMergedAndSet = strategy.shouldBeMergedAndSet(leftLocator, rightLocator, leftObject.isSetRange(), rightObject.isSetRange());
if (rangeShouldBeMergedAndSet == Boolean.TRUE) {
List<MultiplicityRangePropertyType> lhsRange;
lhsRange = (leftObject.isSetRange()?leftObject.getRange():null);
List<MultiplicityRangePropertyType> rhsRange;
rhsRange = (rightObject.isSetRange()?rightObject.getRange():null);
List<MultiplicityRangePropertyType> mergedRange = ((List<MultiplicityRangePropertyType> ) strategy.merge(LocatorUtils.property(leftLocator, "range", lhsRange), LocatorUtils.property(rightLocator, "range", rhsRange), lhsRange, rhsRange, leftObject.isSetRange(), rightObject.isSetRange()));
target.unsetRange();
if (mergedRange!= null) {
List<MultiplicityRangePropertyType> uniqueRangel = target.getRange();
uniqueRangel.addAll(mergedRange);
}
} else {
if (rangeShouldBeMergedAndSet == Boolean.FALSE) {
target.unsetRange();
}
}
}
}
}
public void setRange(List<MultiplicityRangePropertyType> value) {
this.range = null;
if (value!= null) {
List<MultiplicityRangePropertyType> draftl = this.getRange();
draftl.addAll(value);
}
}
}