Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

org.evolvica.engine
Interface IDatatype

All Known Implementing Classes:
GenotypeID, IDatatype.UniversalDatatype

public interface IDatatype

An identifier for datatypes. Identifiers are used to recognize the type of a data. Validity checks in operators rely on these type identifiers.

Since:
0.4.0
Version:
$Revision: 1.6 $ $Date: 2004/05/26 11:58:24 $
Author:
Andreas Rummler

Nested Class Summary
static class IDatatype.UniversalDatatype
          A universal datatype.
 
Field Summary
static IDatatype UNIVERSAL
          A universal datatype.
 
Method Summary
 java.lang.String getName()
          Return the name of this identifier.
 java.lang.Class getReferencedClass()
          Returns the class of the referenced datatype.
 boolean isCompatibleTo(IDatatype otherID)
          Checks if this datatype is compatible to another datatype.
 boolean isEqualTo(IDatatype otherType)
          Checks if this ID equals the given (other) ID.
 

Field Detail

UNIVERSAL

public static final IDatatype UNIVERSAL
A universal datatype. Use this datatype to indicate that an operator works on all kinds of datatypes.

Method Detail

getName

public java.lang.String getName()
Return the name of this identifier.

Returns:
name of this identifier

getReferencedClass

public java.lang.Class getReferencedClass()
Returns the class of the referenced datatype.

Returns:
class of the referenced datatype

isEqualTo

public boolean isEqualTo(IDatatype otherType)
Checks if this ID equals the given (other) ID.

Parameters:
otherType - data type to check
Returns:
true if both IDs equal, false instead

isCompatibleTo

public boolean isCompatibleTo(IDatatype otherID)
Checks if this datatype is compatible to another datatype. This datatype is compatible if the referenced class is a subclass of the referenced class of the other datatype. Example: Given are the two classes:
 public class DefaultInteger { ... }
 public class ExtendedInteger extends DefaultInteger { ... }
 
Calls to the isCompatibleTo()-methods:
 DefaultInteger integer = new DefaultInteger();
 ExtendedInteger extInteger = new ExtendedInteger();
 System.out.println( integer.getType().isCompatibleTo( extInteger.getType() ) );
 System.out.println( extInteger.getType().isCompatibleTo( integer.getType() ) );
 
return the following results:
 false
 true
 
That means an ExtendedInteger can be used as a DefaultInteger but the opposite case (using a DefaultInteger as an ExtendedInteger) is not possible.

Parameters:
otherID - data type to check
Returns:
true if this datatype is compatible to the other datatype, false instead

Evolvica Core API Version 0.6.2
Last Modified: June 29 2004

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