📄 clusteringmodel.java
字号:
* @return <code>true</code> if the list was changed; otherwise, the method
* returns <code>false</code>.
*/
public boolean addClusteringField(Collection coClusteringField)
{
if( coClusteringField==null )
return false;
java.util.Iterator it = coClusteringField.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 _objClusteringField.addAll(coClusteringField);
}
/**
* Removes an existing ClusteringField object at the specified index.
* @return The removed object.
*/
public ClusteringField removeClusteringField(int index)
{
return (ClusteringField)_objClusteringField.remove(index);
}
/**
* Removes the specified ClusteringField object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeClusteringField(ClusteringField obj)
{
return _objClusteringField.remove(obj);
}
/**
* Clears all ClusteringField objects from the list.
*/
public void clearClusteringFieldList()
{
_objClusteringField.clear();
}
/**
* Gets CenterFields object.
*/
public CenterFields getCenterFields()
{
return _objCenterFields;
}
/**
* Replaces the existing CenterFields object with a new object.
* If you pass in a null value to this method, the CenterFields object is
* cleared and will not be marshaled.
* @param obj A new object.
*/
public void setCenterFields(CenterFields obj)
{
this._objCenterFields = obj;
if( obj == null )
return;
obj._setParent(this);
}
/**
* Returns an array of Cluster objects. The length of the returned
* array is zero if the list of Cluster object is empty.
*/
public Cluster[] getCluster()
{
return (Cluster[])_objCluster.toArray(new Cluster[0]);
}
/**
* Replaces all existing Cluster objects with a new array of
* Cluster objects.
* @param objArray an array of Cluster objects.
*/
public void setCluster(Cluster[] objArray)
{
if( objArray == null || objArray.length == 0 )
this._objCluster.clear();
else
{
this._objCluster = new ArrayList(Arrays.asList(objArray));
for( int i=0; i<objArray.length; i++ )
{
if( objArray[i] != null )
objArray[i]._setParent(this);
}
}
}
/**
* Gets the Cluster object at the specified index.
* @param index index of the returned object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public Cluster getCluster(int index)
{
return (Cluster)_objCluster.get(index);
}
/**
* Replaces an existing Cluster object at the specified index with
* a new Cluster object.
* @param index index of replaced object.
* @throws IndexOutOfBoundsException if index is out of range.
*/
public void setCluster(int index, Cluster obj)
{
if( obj == null )
removeCluster(index);
else
{
_objCluster.set(index, obj);
obj._setParent(this);
}
}
/**
* Returns the number of Cluster objects in the list.
*/
public int getClusterCount()
{
return _objCluster.size();
}
/**
* Returns <code>true</code> if there is no Cluster object in the list; otherwise,
* the method returns <code>false</code>.
*/
public boolean isNoCluster()
{
return _objCluster.size() == 0;
}
/**
* Returns a read-only list of Cluster objects.
*/
public List getClusterList()
{
return Collections.unmodifiableList(_objCluster);
}
/**
* Adds a new Cluster 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 addCluster(Cluster obj)
{
if( obj==null )
return false;
obj._setParent(this);
return _objCluster.add(obj);
}
/**
* Adds a list of new Cluster 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 addCluster(Collection coCluster)
{
if( coCluster==null )
return false;
java.util.Iterator it = coCluster.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 _objCluster.addAll(coCluster);
}
/**
* Removes an existing Cluster object at the specified index.
* @return The removed object.
*/
public Cluster removeCluster(int index)
{
return (Cluster)_objCluster.remove(index);
}
/**
* Removes the specified Cluster object.
* @return <code>true</code> if this list contains the object; otherwise,
* the method returns <code>false</code>.
*/
public boolean removeCluster(Cluster obj)
{
return _objCluster.remove(obj);
}
/**
* Clears all Cluster objects from the list.
*/
public void clearClusterList()
{
_objCluster.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 "modelName" attribute */
elem.addAttribute(modelName.marshal());
/** Marshals "modelClass" attribute */
elem.addAttribute(modelClass.marshal());
/** Marshals "algorithmName" attribute */
elem.addAttribute(algorithmName.marshal());
/** Marshals "functionName" attribute */
elem.addAttribute(functionName.marshal());
/** Marshals "numberOfClusters" attribute */
elem.addAttribute(numberOfClusters.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 MiningSchema object to an element */
if( _objMiningSchema != null )
elem.addContent(_objMiningSchema.marshal());
/** Marshals a ModelStats object to an element */
if( _objModelStats != null )
elem.addContent(_objModelStats.marshal());
/** Marshals a ComparisonMeasure object to an element */
if( _objComparisonMeasure != null )
elem.addContent(_objComparisonMeasure.marshal());
/** Marshals a list of ClusteringField objects to elements */
Iterator it2 = _objClusteringField.iterator();
while( it2.hasNext() )
{
ClusteringField obj = (ClusteringField)it2.next();
if( obj != null )
elem.addContent(obj.marshal());
}
/** Marshals a CenterFields object to an element */
if( _objCenterFields != null )
elem.addContent(_objCenterFields.marshal());
/** Marshals a list of Cluster objects to elements */
Iterator it3 = _objCluster.iterator();
while( it3.hasNext() )
{
Cluster obj = (Cluster)it3.next();
if( obj != null )
elem.addContent(obj.marshal());
}
return elem;
}
/**
* Unmarshals the specified "ClusteringModel" element back to a ClusteringModel object.
*/
public static ClusteringModel unmarshal(com.borland.xml.toolkit.Element elem)
{
if( elem == null )
return null;
ClusteringModel __objClusteringModel = new ClusteringModel();
if( __objClusteringModel != null ) //found the element?
{
/** Unmarshals "modelName" attribute */
__objClusteringModel.modelName.setValue(elem.getAttribute("modelName"));
/** Unmarshals "modelClass" attribute */
__objClusteringModel.modelClass.setValue(elem.getAttribute("modelClass"));
/** Unmarshals "algorithmName" attribute */
__objClusteringModel.algorithmName.setValue(elem.getAttribute("algorithmName"));
/** Unmarshals "functionName" attribute */
__objClusteringModel.functionName.setValue(elem.getAttribute("functionName"));
/** Unmarshals "numberOfClusters" attribute */
__objClusteringModel.numberOfClusters.setValue(elem.getAttribute("numberOfClusters"));
}
/** Unmarshals a list of "<<_tagName_>>" elements back to Extension objects. */
Iterator it1 = elem.getChildren(Extension._tagName).iterator();
while( it1.hasNext() )
__objClusteringModel.addExtension(Extension.unmarshal((com.borland.xml.toolkit.Element)it1.next()));
/** Unmarshals an element back to a MiningSchema object */
__objClusteringModel.setMiningSchema(MiningSchema.unmarshal(elem.getChild(MiningSchema._tagName)));
/** Unmarshals an element back to a ModelStats object */
__objClusteringModel.setModelStats(ModelStats.unmarshal(elem.getChild(ModelStats._tagName)));
/** Unmarshals an element back to a ComparisonMeasure object */
__objClusteringModel.setComparisonMeasure(ComparisonMeasure.unmarshal(elem.getChild(ComparisonMeasure._tagName)));
/** Unmarshals a list of "<<_tagName_>>" elements back to ClusteringField objects. */
Iterator it2 = elem.getChildren(ClusteringField._tagName).iterator();
while( it2.hasNext() )
__objClusteringModel.addClusteringField(ClusteringField.unmarshal((com.borland.xml.toolkit.Element)it2.next()));
/** Unmarshals an element back to a CenterFields object */
__objClusteringModel.setCenterFields(CenterFields.unmarshal(elem.getChild(CenterFields._tagName)));
/** Unmarshals a list of "<<_tagName_>>" elements back to Cluster objects. */
Iterator it3 = elem.getChildren(Cluster._tagName).iterator();
while( it3.hasNext() )
__objClusteringModel.addCluster(Cluster.unmarshal((com.borland.xml.toolkit.Element)it3.next()));
return __objClusteringModel;
}
/**
* 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;
}
}
/** MiningSchema is mandatory */
if( _objMiningSchema != null )
errors.add(_objMiningSchema.validate(firstError));
else
errors.add(new com.borland.xml.toolkit.ElementError(this, MiningSchema.class));
if( firstError && errors.size() > 0 )
return errors;
/** ModelStats is optional */
if( _objModelStats != null )
{
errors.add(_objModelStats.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
/** ComparisonMeasure is mandatory */
if( _objComparisonMeasure != null )
errors.add(_objComparisonMeasure.validate(firstError));
else
errors.add(new com.borland.xml.toolkit.ElementError(this, ComparisonMeasure.class));
if( firstError && errors.size() > 0 )
return errors;
/** ClusteringField is zero or more */
Iterator it2 = _objClusteringField.iterator();
while( it2.hasNext() )
{
ClusteringField obj = (ClusteringField)it2.next();
if( obj != null )
{
errors.add(obj.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
}
/** CenterFields is optional */
if( _objCenterFields != null )
{
errors.add(_objCenterFields.validate(firstError));
if( firstError && errors.size() > 0 )
return errors;
}
/** Cluster is one or more */
if( _objCluster.size() == 0 )
{
errors.add(new com.borland.xml.toolkit.ElementError(this, Cluster.class));
if( firstError )
return errors;
}
else
{
Iterator it3 = _objCluster.iterator();
while( it3.hasNext() )
{
Cluster obj = (Cluster)it3.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 _objMiningSchema */
if( _objMiningSchema != null )
children.add(_objMiningSchema);
/** adds _objModelStats */
if( _objModelStats != null )
children.add(_objModelStats);
/** adds _objComparisonMeasure */
if( _objComparisonMeasure != null )
children.add(_objComparisonMeasure);
/** adds _objClusteringField */
if( _objClusteringField != null && _objClusteringField.size() > 0 )
children.add(_objClusteringField);
/** adds _objCenterFields */
if( _objCenterFields != null )
children.add(_objCenterFields);
/** adds _objCluster */
if( _objCluster != null && _objCluster.size() > 0 )
children.add(_objCluster);
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 + -