com.rapidminer.example
Class AbstractAttributes

java.lang.Object
  extended by com.rapidminer.example.AbstractAttributes
All Implemented Interfaces:
Attributes, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Attribute>
Direct Known Subclasses:
DelegateAttributes, SimpleAttributes

public abstract class AbstractAttributes
extends java.lang.Object
implements Attributes

This is the abstract superclass for all attribute set implementations. It is sufficient for subclasses to overwrite the method Attributes.allAttributeRoles() and the corresponding add and remove methods.

Author:
Ingo Mierswa
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.rapidminer.example.Attributes
ALL, ATTRIBUTE_NAME, BASE_VALUE, BATCH_NAME, CLASSIFICATION_COST, CLUSTER_NAME, CONFIDENCE_NAME, ID_NAME, KNOWN_ATTRIBUTE_TYPES, LABEL_NAME, OUTLIER_NAME, PREDICTION_NAME, REGULAR, SPECIAL, TYPE_ATTRIBUTE, TYPE_BASE_VALUE, TYPE_BATCH, TYPE_CLUSTER, TYPE_COST, TYPE_ID, TYPE_LABEL, TYPE_OUTLIER, TYPE_PREDICTION, TYPE_WEIGHT, WEIGHT_NAME
 
Constructor Summary
AbstractAttributes()
           
 
Method Summary
 void addRegular(Attribute attribute)
          Adds the given attribute as regular attribute.
 java.util.Iterator<Attribute> allAttributes()
          Returns an iterator over all attributes, including the special attributes.
 int allSize()
          Returns the number of all attributes, i.e. of the regular and the special attributes.
 void clearRegular()
          Removes all regular attributes.
 void clearSpecial()
          Removes all special attributes.
abstract  java.lang.Object clone()
          Returns a clone of this attribute set.
 boolean contains(Attribute attribute)
          Returns true if this attribute set contains the given attribute.
 Attribute[] createRegularAttributeArray()
          This method creates an attribute array from all regular attributes.
 Attribute get(java.lang.String name)
          Returns the attribute for the given name.
 Attribute getCluster()
          Returns the cluster attribute or null if no label attribute is defined.
 Attribute getCost()
          Returns the cost attribute or null if no label attribute is defined.
 Attribute getId()
          Returns the id attribute or null if no label attribute is defined.
 Attribute getLabel()
          Returns the label attribute or null if no label attribute is defined.
 Attribute getOutlier()
          Returns the outlier attribute or null if no label attribute is defined.
 Attribute getPredictedLabel()
          Returns the predicted label attribute or null if no label attribute is defined.
 Attribute getRegular(java.lang.String name)
          Returns the regular attribute for the given name.
 AttributeRole getRole(Attribute attribute)
          Returns the attribute role for the given attribute.
 AttributeRole getRole(java.lang.String name)
          Returns the attribute role for the given name.
 Attribute getSpecial(java.lang.String name)
          Returns the special attribute for the given special name.
 Attribute getWeight()
          Returns the weight attribute or null if no label attribute is defined.
 java.util.Iterator<Attribute> iterator()
          Iterates over all regular attributes.
 java.util.Iterator<AttributeRole> regularAttributes()
          Returns an iterator over the attribute roles of the special attributes.
 boolean remove(Attribute attribute)
          Removes the given attribute.
 Attribute replace(Attribute first, Attribute second)
          Replaces the first attribute by the second.
 void setCluster(Attribute cluster)
          Sets the cluster attribute.
 void setCost(Attribute cost)
          Sets the cost attribute.
 void setId(Attribute id)
          Sets the id attribute.
 void setLabel(Attribute label)
          Sets the label attribute.
 void setOutlier(Attribute outlier)
          Sets the outlier attribute.
 void setPredictedLabel(Attribute predictedLabel)
          Sets the predicted label attribute.
 void setSpecialAttribute(Attribute attribute, java.lang.String specialName)
          Sets the special attribute for the given name.
 void setWeight(Attribute weight)
          Sets the weight attribute.
 int size()
          Returns the number of regular attributes.
 java.util.Iterator<AttributeRole> specialAttributes()
          Returns an iterator over the attribute roles of the special attributes.
 int specialSize()
          Returns the number of special attributes.
 java.lang.String toString()
          Returns a string representation of this attribute set.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.example.Attributes
add, allAttributeRoles, equals, findRoleByName, findRoleBySpecialName, hashCode, remove, rename, rename
 

Constructor Detail

AbstractAttributes

public AbstractAttributes()
Method Detail

clone

public abstract java.lang.Object clone()
Description copied from interface: Attributes
Returns a clone of this attribute set.

Specified by:
clone in interface Attributes
Overrides:
clone in class java.lang.Object

iterator

public java.util.Iterator<Attribute> iterator()
Description copied from interface: Attributes
Iterates over all regular attributes.

Specified by:
iterator in interface Attributes
Specified by:
iterator in interface java.lang.Iterable<Attribute>

allAttributes

public java.util.Iterator<Attribute> allAttributes()
Description copied from interface: Attributes
Returns an iterator over all attributes, including the special attributes.

Specified by:
allAttributes in interface Attributes

specialAttributes

public java.util.Iterator<AttributeRole> specialAttributes()
Description copied from interface: Attributes
Returns an iterator over the attribute roles of the special attributes.

Specified by:
specialAttributes in interface Attributes

regularAttributes

public java.util.Iterator<AttributeRole> regularAttributes()
Description copied from interface: Attributes
Returns an iterator over the attribute roles of the special attributes.

Specified by:
regularAttributes in interface Attributes

contains

public boolean contains(Attribute attribute)
Description copied from interface: Attributes
Returns true if this attribute set contains the given attribute.

Specified by:
contains in interface Attributes

allSize

public int allSize()
Description copied from interface: Attributes
Returns the number of all attributes, i.e. of the regular and the special attributes.

Specified by:
allSize in interface Attributes

size

public int size()
Description copied from interface: Attributes
Returns the number of regular attributes.

Specified by:
size in interface Attributes

specialSize

public int specialSize()
Description copied from interface: Attributes
Returns the number of special attributes.

Specified by:
specialSize in interface Attributes

addRegular

public void addRegular(Attribute attribute)
Description copied from interface: Attributes
Adds the given attribute as regular attribute.

Specified by:
addRegular in interface Attributes

remove

public boolean remove(Attribute attribute)
Description copied from interface: Attributes
Removes the given attribute.

Specified by:
remove in interface Attributes

clearRegular

public void clearRegular()
Description copied from interface: Attributes
Removes all regular attributes.

Specified by:
clearRegular in interface Attributes

clearSpecial

public void clearSpecial()
Description copied from interface: Attributes
Removes all special attributes.

Specified by:
clearSpecial in interface Attributes

replace

public Attribute replace(Attribute first,
                         Attribute second)
Description copied from interface: Attributes
Replaces the first attribute by the second. Returns the second attribute.

Specified by:
replace in interface Attributes

get

public Attribute get(java.lang.String name)
Description copied from interface: Attributes
Returns the attribute for the given name.

Specified by:
get in interface Attributes

getRegular

public Attribute getRegular(java.lang.String name)
Description copied from interface: Attributes
Returns the regular attribute for the given name.

Specified by:
getRegular in interface Attributes

getSpecial

public Attribute getSpecial(java.lang.String name)
Description copied from interface: Attributes
Returns the special attribute for the given special name.

Specified by:
getSpecial in interface Attributes

getRole

public AttributeRole getRole(Attribute attribute)
Description copied from interface: Attributes
Returns the attribute role for the given attribute.

Specified by:
getRole in interface Attributes

getRole

public AttributeRole getRole(java.lang.String name)
Description copied from interface: Attributes
Returns the attribute role for the given name.

Specified by:
getRole in interface Attributes

getLabel

public Attribute getLabel()
Description copied from interface: Attributes
Returns the label attribute or null if no label attribute is defined.

Specified by:
getLabel in interface Attributes

setLabel

public void setLabel(Attribute label)
Description copied from interface: Attributes
Sets the label attribute. If the given attribute is null, no label attribute will be used.

Specified by:
setLabel in interface Attributes

getPredictedLabel

public Attribute getPredictedLabel()
Description copied from interface: Attributes
Returns the predicted label attribute or null if no label attribute is defined.

Specified by:
getPredictedLabel in interface Attributes

setPredictedLabel

public void setPredictedLabel(Attribute predictedLabel)
Description copied from interface: Attributes
Sets the predicted label attribute. If the given attribute is null, no predicted label attribute will be used.

Specified by:
setPredictedLabel in interface Attributes

getId

public Attribute getId()
Description copied from interface: Attributes
Returns the id attribute or null if no label attribute is defined.

Specified by:
getId in interface Attributes

setId

public void setId(Attribute id)
Description copied from interface: Attributes
Sets the id attribute. If the given attribute is null, no id attribute will be used.

Specified by:
setId in interface Attributes

getWeight

public Attribute getWeight()
Description copied from interface: Attributes
Returns the weight attribute or null if no label attribute is defined.

Specified by:
getWeight in interface Attributes

setWeight

public void setWeight(Attribute weight)
Description copied from interface: Attributes
Sets the weight attribute. If the given attribute is null, no weight attribute will be used.

Specified by:
setWeight in interface Attributes

getCluster

public Attribute getCluster()
Description copied from interface: Attributes
Returns the cluster attribute or null if no label attribute is defined.

Specified by:
getCluster in interface Attributes

setCluster

public void setCluster(Attribute cluster)
Description copied from interface: Attributes
Sets the cluster attribute. If the given attribute is null, no cluster attribute will be used.

Specified by:
setCluster in interface Attributes

getOutlier

public Attribute getOutlier()
Description copied from interface: Attributes
Returns the outlier attribute or null if no label attribute is defined.

Specified by:
getOutlier in interface Attributes

setOutlier

public void setOutlier(Attribute outlier)
Description copied from interface: Attributes
Sets the outlier attribute. If the given attribute is null, no outlier attribute will be used.

Specified by:
setOutlier in interface Attributes

getCost

public Attribute getCost()
Description copied from interface: Attributes
Returns the cost attribute or null if no label attribute is defined.

Specified by:
getCost in interface Attributes

setCost

public void setCost(Attribute cost)
Description copied from interface: Attributes
Sets the cost attribute. If the given attribute is null, no cost attribute will be used.

Specified by:
setCost in interface Attributes

setSpecialAttribute

public void setSpecialAttribute(Attribute attribute,
                                java.lang.String specialName)
Description copied from interface: Attributes
Sets the special attribute for the given name. If the given attribute is null, no special attribute with this name will be used.

Specified by:
setSpecialAttribute in interface Attributes

createRegularAttributeArray

public Attribute[] createRegularAttributeArray()
Description copied from interface: Attributes
This method creates an attribute array from all regular attributes. ATTENTION: This method should only be used if it is ensured that the attribute roles and number of attributes cannot be changed, otherwise the delivered array will not be synchronized with the attribute roles object. Therefore, the iterator methods of this class should be preferred.

Specified by:
createRegularAttributeArray in interface Attributes

toString

public java.lang.String toString()
Returns a string representation of this attribute set.

Specified by:
toString in interface Attributes
Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 by Rapid-I