📄 datafield.java
字号:
* Gets the Value object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public Value getValue(int index)
{
return (Value)_objValue.get(index);
}
/**
* Replaces an existing Value object at the specified index with
* a new Value object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setValue(int index, Value obj)
{
if( obj == null )
removeValue(index);
else
{
_objValue.set(index, obj);
obj._setParent(this);
}
clearIntervalList();
}
/**
* Returns the number of Value objects in the list.
*/
public int getValueCount()
{
return _objValue.size();
}
/**
* Returns <code>true</code> if there is no Value object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoValue()
{
return _objValue.size() == 0;
}
/**
* Returns a read-only list of Value objects.
*/
public List getValueList()
{
return Collections.unmodifiableList(_objValue);
}
/**
* Adds a new Value object at the end of the list.
* @return <code>true</code> if the new object is added to the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean addValue(Value obj)
{
if( obj==null )
return false;
clearIntervalList();
obj._setParent(this);
return _objValue.add(obj);
}
/**
* Adds a list of new Value objects at the end of the list.
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addValue(Collection coValue)
{
if( coValue==null )
return false;
clearIntervalList();
java.util.Iterator it = coValue.iterator();
while( it.hasNext() )
{
Object obj = it.next();
if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
}
return _objValue.addAll(coValue);
}
/**
* Removes an existing Value object at the specified index.
* @return The removed object.
*/
public Value removeValue(int index)
{
return (Value)_objValue.remove(index);
}
/**
* Removes the specified Value object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeValue(Value obj)
{
return _objValue.remove(obj);
}
/**
* Clears all Value objects from the list.
*/
public void clearValueList()
{
_objValue.clear();
}
/**
* Returns an array of Taxonomy objects. The length of the returned
* array is zero if the list of Taxonomy object is empty.
*/
public Taxonomy[] getTaxonomy()
{
return (Taxonomy[])_objTaxonomy.toArray(new Taxonomy[0]);
}
/**
* Replaces all existing Taxonomy objects with a new array of
* Taxonomy objects.
* @param objArray an array of Taxonomy objects.
*/
public void setTaxonomy(Taxonomy[] objArray)
{
if( objArray == null || objArray.length == 0 )
this._objTaxonomy.clear();
else
{
this._objTaxonomy = new ArrayList(Arrays.asList(objArray));
for( int i=0; i<objArray.length; i++ )
{
if( objArray[i] != null )
objArray[i]._setParent(this);
}
}
}
/**
* Gets the Taxonomy object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public Taxonomy getTaxonomy(int index)
{
return (Taxonomy)_objTaxonomy.get(index);
}
/**
* Replaces an existing Taxonomy object at the specified index with
* a new Taxonomy object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setTaxonomy(int index, Taxonomy obj)
{
if( obj == null )
removeTaxonomy(index);
else
{
_objTaxonomy.set(index, obj);
obj._setParent(this);
}
}
/**
* Returns the number of Taxonomy objects in the list.
*/
public int getTaxonomyCount()
{
return _objTaxonomy.size();
}
/**
* Returns <code>true</code> if there is no Taxonomy object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoTaxonomy()
{
return _objTaxonomy.size() == 0;
}
/**
* Returns a read-only list of Taxonomy objects.
*/
public List getTaxonomyList()
{
return Collections.unmodifiableList(_objTaxonomy);
}
/**
* Adds a new Taxonomy object at the end of the list.
* @return <code>true</code> if the new object is added to the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean addTaxonomy(Taxonomy obj)
{
if( obj==null )
return false;
obj._setParent(this);
return _objTaxonomy.add(obj);
}
/**
* Adds a list of new Taxonomy objects at the end of the list.
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addTaxonomy(Collection coTaxonomy)
{
if( coTaxonomy==null )
return false;
java.util.Iterator it = coTaxonomy.iterator();
while( it.hasNext() )
{
Object obj = it.next();
if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
}
return _objTaxonomy.addAll(coTaxonomy);
}
/**
* Removes an existing Taxonomy object at the specified index.
* @return The removed object.
*/
public Taxonomy removeTaxonomy(int index)
{
return (Taxonomy)_objTaxonomy.remove(index);
}
/**
* Removes the specified Taxonomy object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeTaxonomy(Taxonomy obj)
{
return _objTaxonomy.remove(obj);
}
/**
* Clears all Taxonomy objects from the list.
*/
public void clearTaxonomyList()
{
_objTaxonomy.clear();
}
/**
* Marshals this object to an element.
*/
public com.borland.xml.toolkit.Element marshal()
{
com.borland.xml.toolkit.Element elem = new com.borland.xml.toolkit.Element(get_TagName());
/** Marshals "taxonomy" attribute */
elem.addAttribute(taxonomy.marshal());
/** Marshals "displayName" attribute */
elem.addAttribute(displayName.marshal());
/** Marshals "dataType" attribute */
elem.addAttribute(dataType.marshal());
/** Marshals "name" attribute */
elem.addAttribute(name.marshal());
/** Marshals "isCyclic" attribute */
elem.addAttribute(isCyclic.marshal());
/** Marshals "optype" attribute */
elem.addAttribute(optype.marshal());
/** Marshals a list of Extension objects to elements */
Iterator it1 = _objExtension.iterator();
while( it1.hasNext() )
{
Extension obj = (Extension)it1.next();
if( obj != null )
elem.addContent(obj.marshal());
}
/** Marshals a list of Interval objects to elements */
Iterator it2 = _objInterval.iterator();
while( it2.hasNext() )
{
Interval obj = (Interval)it2.next();
if( obj != null )
elem.addContent(obj.marshal());
}
/** Marshals a list of Value objects to elements */
Iterator it3 = _objValue.iterator();
while( it3.hasNext() )
{
Value obj = (Value)it3.next();
if( obj != null )
elem.addContent(obj.marshal());
}
/** Marshals a list of Taxonomy objects to elements */
Iterator it4 = _objTaxonomy.iterator();
while( it4.hasNext() )
{
Taxonomy obj = (Taxonomy)it4.next();
if( obj != null )
elem.addContent(obj.marshal());
}
return elem;
}
/**
* Unmarshals the specified "DataField" element back to a DataField object.
*/
public static DataField unmarshal(com.borland.xml.toolkit.Element elem)
{
if( elem == null )
return null;
DataField __objDataField = new DataField();
if( __objDataField != null ) //found the element?
{
/** Unmarshals "taxonomy" attribute */
__objDataField.taxonomy.setValue(elem.getAttribute("taxonomy"));
/** Unmarshals "displayName" attribute */
__objDataField.displayName.setValue(elem.getAttribute("displayName"));
/** Unmarshals "dataType" attribute */
__objDataField.dataType.setValue(elem.getAttribute("dataType"));
/** Unmarshals "name" attribute */
__objDataField.name.setValue(elem.getAttribute("name"));
/** Unmarshals "isCyclic" attribute */
__objDataField.isCyclic.setValue(elem.getAttribute("isCyclic"));
/** Unmarshals "optype" attribute */
__objDataField.optype.setValue(elem.getAttribute("optype"));
}
/** Unmarshals a list of "<<_tagName_>>" elements back to Extension objects. */
Iterator it1 = elem.getChildren(Extension._tagName).iterator();
while( it1.hasNext() )
__objDataField.addExtension(Extension.unmarshal((com.borland.xml.toolkit.Element)it1.next()));
/** Unmarshals a list of "<<_tagName_>>" elements back to Interval objects. */
Iterator it2 = elem.getChildren(Interval._tagName).iterator();
while( it2.hasNext() )
__objDataField.addInterval(Interval.unmarshal((com.borland.xml.toolkit.Element)it2.next()));
/** Unmarshals a list of "<<_tagName_>>" elements back to Value objects. */
Iterator it3 = elem.getChildren(Value._tagName).iterator();
while( it3.hasNext() )
__objDataField.addValue(Value.unmarshal((com.borland.xml.toolkit.Element)it3.next()));
/** Unmarshals a list of "<<_tagName_>>" elements back to Taxonomy objects. */
Iterator it4 = elem.getChildren(Taxonomy._tagName).iterator();
while( it4.hasNext() )
__objDataField.addTaxonomy(Taxonomy.unmarshal((com.borland.xml.toolkit.Element)it4.next()));
return __objDataField;
}
/**
* Validates this object. If you pass <code>true</code> to this method, it
* checks for the first error and stops. On the other hand, if you pass
* <code>false</code> to this method, it collects all the errors by
* visiting every available elements.
* @param firstError <code>true</code> to exit this method when the first error
* is found; <code>false</code> to collect all errors.
* @return com.borland.xml.toolkit.ErrorList A list that contains one or more errors.
* @see com.borland.xml.toolkit.XmlObject#validate()
* @see com.borland.xml.toolkit.XmlObject#isValid()
* @see com.borland.xml.toolkit.ErrorList
*/
public com.borland.xml.toolkit.ErrorList validate(boolean firstError)
{
com.borland.xml.toolkit.ErrorList errors = new com.borland.xml.toolkit.ErrorList();
/** Extension is zero or more */
Iterator it1 = _objExtension.iterator();
while( it1.hasNext() )
{
Extension obj = (Extension)it1.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
/** "or" block */
if( _objInterval.size() > 0 )
{
/** Interval is zero or more */
Iterator it2 = _objInterval.iterator();
while( it2.hasNext() )
{
Interval obj = (Interval)it2.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
}
if( _objValue.size() > 0 )
{
/** Value is zero or more */
Iterator it3 = _objValue.iterator();
while( it3.hasNext() )
{
Value obj = (Value)it3.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
}
if( !(_objInterval.size() > 0) && !(_objValue.size() > 0) ) /** missing one or more elements? */
{
com.borland.xml.toolkit.OrErrorList errors1 = new com.borland.xml.toolkit.OrErrorList();
errors1.add(new com.borland.xml.toolkit.ElementError(this, Interval.class));
errors1.add(new com.borland.xml.toolkit.ElementError(this, Value.class));
errors.add(errors1);
if( firstError && errors.size() > 0 )
return errors;
}
/** Taxonomy is zero or more */
Iterator it4 = _objTaxonomy.iterator();
while( it4.hasNext() )
{
Taxonomy obj = (Taxonomy)it4.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
return errors.size()==0 ? null : errors;
}
/**
* Returns a list containing all child elements. Each element in the list is a subclass
* of XmlObject.
*/
public java.util.List _getChildren()
{
java.util.List children = new java.util.ArrayList();
/** adds _objExtension */
if( _objExtension != null && _objExtension.size() > 0 )
children.add(_objExtension);
/** adds _objInterval */
if( _objInterval != null && _objInterval.size() > 0 )
children.add(_objInterval);
/** adds _objValue */
if( _objValue != null && _objValue.size() > 0 )
children.add(_objValue);
/** adds _objTaxonomy */
if( _objTaxonomy != null && _objTaxonomy.size() > 0 )
children.add(_objTaxonomy);
return children;
}
/**
* Gets the tag name of this element.
*/
public String get_TagName()
{
return _tagName;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -