Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

org.evolvica.engine
Class OperatorDescriptor

java.lang.Object
  extended byorg.evolvica.engine.AbstractDescriptor
      extended byorg.evolvica.engine.OperatorDescriptor
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

public class OperatorDescriptor
extends AbstractDescriptor

Descriptor for an algorithmic operator.

Since:
0.4.0
Version:
$Revision: 1.16 $ $Date: 2004/05/26 11:58:26 $
Author:
Andreas Rummler
See Also:
Serialized Form

Constructor Summary
OperatorDescriptor(java.beans.BeanDescriptor descriptor)
          Constructor.
OperatorDescriptor(java.lang.Class beanClass)
          Constructor.
OperatorDescriptor(java.lang.Class beanClass, IDatatype datatype)
          Constructor.
OperatorDescriptor(java.lang.String beanClassName, java.net.URI classLocation, java.net.URI sourceLocation)
          Constructor.
OperatorDescriptor(java.lang.String beanClassName, java.net.URI classLocation, java.net.URI sourceLocation, java.lang.String datatypeName)
          Constructor.
 
Method Summary
 void addAttribute(AttributeDescriptor ad)
          Adds an attribute descriptor to this operator descriptor.
 int compareTo(java.lang.Object o)
           
 AttributeDescriptor getAttribute(java.lang.String property)
          Returns the property descriptor with the given name.
 java.lang.Class getBeanClass()
          Returns the operator class.
 java.lang.String getBeanClassName()
          Returns the operator class name.
 java.lang.String getCategory()
          Returns the category.
 IDatatype getDatatype()
          Returns the datatype.
 java.lang.String getDatatypeName()
          Returns the datatype name.
 int getInputSize()
          Returns the input size.
 java.net.URI getLocation()
          Returns the class location
 int getOutputSize()
          Returns the output size
 AttributeDescriptor getPropertyDescriptor(java.lang.String property)
          Deprecated. use getAttribute( String )
 OperatorDescriptor getResolved(java.net.URI[] classpath)
          Deprecated. use DescriptorResolver for copying
 java.net.URI getSourceLocation()
          Returns the source location.
 java.lang.String getVendor()
          Returns the vendor.
 void info()
          Prints some information to the console.
 boolean isResolved()
          Checks if this descriptor has been resolved.
 boolean isValid()
          Deprecated. use DescriptorResolver to check for validity
 java.util.Iterator iterateProperties()
          Iterate all properties descriptors.
 long lastModified()
          Checks for the modification time of the resource this descriptor points to.
 void load()
          Deprecated. use DescriptorBuilder to read descriptors
 void resolve(java.net.URI[] classpath)
          Deprecated. use DescriptorResolver to perform the resolution
 void save()
          Deprecated. use DescriptorWriter and DescriptorResolver to store descriptors to disk
 void setCategory(java.lang.String string)
          Sets the category.
 void setDatatype(IDatatype type)
          Sets the datatype.
 void setDatatypeName(java.lang.String name)
          Sets the datatype name.
 void setInputSize(int i)
          Sets the input size.
 void setInterface(int inputs, int outputs)
          Sets the interface (input- and output size).
 void setLocation(java.net.URI classLocation, java.net.URI sourceLocation)
          Sets the class and source location of the operator.
 void setOutputSize(int i)
          Sets the output size.
 void setVendor(java.lang.String string)
          Sets the vendor
 java.lang.String toString()
          Returns a string representation.
 
Methods inherited from class org.evolvica.engine.AbstractDescriptor
getDisplayName, getName, getShortDescription, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OperatorDescriptor

public OperatorDescriptor(java.lang.String beanClassName,
                          java.net.URI classLocation,
                          java.net.URI sourceLocation)
Constructor. Creates an operator descriptor describing the given operator class. The class must be located at the given location. The source location is optional.

Parameters:
beanClassName - operator class name
classLocation - class location
sourceLocation - source location (optional)

OperatorDescriptor

public OperatorDescriptor(java.lang.String beanClassName,
                          java.net.URI classLocation,
                          java.net.URI sourceLocation,
                          java.lang.String datatypeName)
Constructor. Creates an operator descriptor describing the given operator class. The class must be located at the given location. The source location is optional.

Parameters:
beanClassName - operator class name
classLocation - class location
sourceLocation - source location (optional)
datatypeName - datatype class name

OperatorDescriptor

public OperatorDescriptor(java.lang.Class beanClass)
Constructor. Creates an operator descriptor which describes the given class. Note that no check is performed if the class is really an evolutionary operator.

Parameters:
beanClass - operator bean class

OperatorDescriptor

public OperatorDescriptor(java.lang.Class beanClass,
                          IDatatype datatype)
Constructor. Creates an operator descriptor which describes the given class. Note that no check is performed if the class is really an evolutionary operator.

Parameters:
beanClass - operator bean class
datatype - datatype for this operator

OperatorDescriptor

public OperatorDescriptor(java.beans.BeanDescriptor descriptor)
Constructor. Creates an operator descriptor as a copy of a bean descriptor.

Parameters:
descriptor - bean descriptor
Method Detail

addAttribute

public void addAttribute(AttributeDescriptor ad)
Adds an attribute descriptor to this operator descriptor.

Parameters:
ad - attribute descriptor

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
Specified by:
compareTo in class AbstractDescriptor
See Also:
Comparable.compareTo(java.lang.Object)

getBeanClass

public java.lang.Class getBeanClass()
Returns the operator class.

Returns:
operator class

getBeanClassName

public java.lang.String getBeanClassName()
Returns the operator class name.

Returns:
operator class name

getCategory

public java.lang.String getCategory()
Returns the category.

Returns:
category

getDatatype

public IDatatype getDatatype()
Returns the datatype.

Returns:
datatype

getDatatypeName

public java.lang.String getDatatypeName()
Returns the datatype name.

Returns:
datatype name

getInputSize

public int getInputSize()
Returns the input size.

Returns:
input size

getLocation

public java.net.URI getLocation()
Returns the class location

Returns:
class location or null if location is unknown

getOutputSize

public int getOutputSize()
Returns the output size

Returns:
output size

getAttribute

public AttributeDescriptor getAttribute(java.lang.String property)
Returns the property descriptor with the given name.

Parameters:
property - property name
Returns:
property descriptor with the given name or null

getPropertyDescriptor

public AttributeDescriptor getPropertyDescriptor(java.lang.String property)
Deprecated. use getAttribute( String )

Returns the property descriptor with the given name.

Parameters:
property - property name
Returns:
property descriptor with the given name or null

getSourceLocation

public java.net.URI getSourceLocation()
Returns the source location.

Returns:
source location or null if location is unknown

getVendor

public java.lang.String getVendor()
Returns the vendor.

Returns:
vendor

info

public void info()
Prints some information to the console.


isResolved

public boolean isResolved()
Checks if this descriptor has been resolved. Resolved means the classes for beanClass and the datatype properties have been retrieved and are not null.

Returns:
true if this descriptor has already been resolved

isValid

public boolean isValid()
Deprecated. use DescriptorResolver to check for validity

Checks if this descriptor points to a valid class file.

Returns:
true if this descriptor is valid

iterateProperties

public java.util.Iterator iterateProperties()
Iterate all properties descriptors.

Returns:
iterator

lastModified

public long lastModified()
Checks for the modification time of the resource this descriptor points to.

Returns:
modification time stamp

load

public void load()
          throws java.io.IOException,
                 javax.xml.parsers.ParserConfigurationException,
                 org.xml.sax.SAXException
Deprecated. use DescriptorBuilder to read descriptors

Loads the descriptor. Loading means loading necessary information from a descriptor file. This method searches the source location/class location for a file named <classname>.descriptor and attempts to load it.

Throws:
java.io.IOException - thrown if reading the descriptor file fails
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

resolve

public void resolve(java.net.URI[] classpath)
             throws org.apache.commons.beanutils.ConversionException,
                    java.net.MalformedURLException
Deprecated. use DescriptorResolver to perform the resolution

Attempts to resolve this descriptor. This method tries to retrieve the classes for beanClass and datatype from the beanClassName and datatypeName properties by use of the given classpath.

Parameters:
classpath - classpath to use
Throws:
org.apache.commons.beanutils.ConversionException - thrown if the internal type names couldn't be converted
java.net.MalformedURLException - thrown if the classpath contains an invalid URI

getResolved

public OperatorDescriptor getResolved(java.net.URI[] classpath)
                               throws org.apache.commons.beanutils.ConversionException,
                                      java.net.MalformedURLException
Deprecated. use DescriptorResolver for copying

Tries to resolve this descriptor and returns a copy of it.

Parameters:
classpath - classpath to use
Returns:
copy of the resolved descriptor
Throws:
org.apache.commons.beanutils.ConversionException - thrown if the internal type names couldn't be converted
java.net.MalformedURLException - thrown if the classpath contains an invalid URI

save

public void save()
          throws javax.xml.parsers.ParserConfigurationException,
                 javax.xml.transform.TransformerException,
                 java.net.URISyntaxException
Deprecated. use DescriptorWriter and DescriptorResolver to store descriptors to disk

Saves this descriptor. This method tries to save the descriptor information into an XML file at the source location of the operator class. If the source location does not exist it attempts to write the XML file to the class location.

Throws:
javax.xml.parsers.ParserConfigurationException - thrown if the XML parser couldn't be configured
javax.xml.transform.TransformerException - thrown if the internal XML file couldn't be transformed into a XML file
java.net.URISyntaxException - thrown in case the source and/or class location URI is invalid

setCategory

public void setCategory(java.lang.String string)
Sets the category.

Parameters:
string - category

setDatatype

public void setDatatype(IDatatype type)
Sets the datatype.

Parameters:
type - datatype

setDatatypeName

public void setDatatypeName(java.lang.String name)
Sets the datatype name.

Parameters:
name - datatype name

setInputSize

public void setInputSize(int i)
Sets the input size.

Parameters:
i - input size

setInterface

public void setInterface(int inputs,
                         int outputs)
Sets the interface (input- and output size).

Parameters:
inputs - number of inputs
outputs - number of outputs

setLocation

public void setLocation(java.net.URI classLocation,
                        java.net.URI sourceLocation)
Sets the class and source location of the operator.

Parameters:
classLocation - class location
sourceLocation - source location

setOutputSize

public void setOutputSize(int i)
Sets the output size.

Parameters:
i - output size

setVendor

public void setVendor(java.lang.String string)
Sets the vendor

Parameters:
string - new vendor string

toString

public java.lang.String toString()
Returns a string representation.

Returns:
string representation

Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

Copyright © 2000-2004 Technical University of Ilmenau, Department Electronic Circuits and Systems