Operator Creation

Before starting to write your own operators it is strongly recommended to take a look at the sources of the examples. Especially the trivial example is very well documented and you wil find a faster access to Evolvica when studying these sources.

Constructors

Information about an operator is attached to the descriptor of the operator. As of version 0.5.0 this is done through a separate XML file. See the appropriate section in the GUI manual for information about how to create such descriptor files.
Descriptors are named <classname>.descriptor. They should be located in the same directory like the src-/classfile of the operator.
Evolvica creates instances of operators dynamically so there MUST be a constructor that is public and does not take any parameters. If no such constructor exists the operator will not be shown in the operator palette in the GUI.

Accessible Properties

Of course properties should be made accessible in the GUI. For doing that first define a property in your operator:

protected int integerProperty;
Properties are accessed via get- and set-methods. These methods must be named get/set followed be the property name with the first character in upper case and must be public. The get/set methods for the integerProperty must look like this:
public int getIntegerProperty() {
	return integerProperty;
}

public void setIntegerProperty( int i ) {
	integerProperty = i;
}
The GUI supports setting of typed properties (int, float and so on) as well as complex properties (objects of arbitrary type). Properties can be made read-only by omitting the set-method.
Properties may also veto a change. A set-method vetoing values smaller 0 looks like this:
public void setIntegerProperty( int i ) throws PropertyVetoException {
	if ( i > 0 ) {
		integerProperty = i;
	} else {
		throw new PropertyVetoException( "value must be > 0",
			new PropertyChangeEvent(
				this,
				"integerProperty",
				new Integer( integerProperty ),
				new Integer( i )
			)
		);
	}
}