Package de.uni_trier.wi2.procake.data.object

Provides interfaces of all data objects.

Each data class of the data model de.uni_trier.wi2.procake.data.model, except UnionClass, can be instantiated as a CAKE Data Object. Consequently, each data object has exact one corresponding data class that defines the possible value(s) of the object, see DataObject.getDataClass().

Object Creation

DataObjects cannot be created directly because each data object must know its corresponding data class. To ensure this, the data objects can only be created using DataClass.newObject() or with one of the "newXYZ()" methods of the specialised classes, e.g. DataClass.newObject()

HashCode and Equal Behaviour

Since version 0.6 the behaviour of the method Object.hashCode() and Object.equals(Object) has changed which has some serious consequences for the usage.

Before version 0.6 the behaviour of these methods where different for DataObjects and for AtomicObjects. All data objects except the atomic ones uses the methods from Object but the atomic objects uses the methods of their native objects. This had some seriuous and very confusing consequences for the usage in collections. For example, if a set is used with none atomic objects, the set was a multiset that can contain an object several times. But if the same set was used with atomic objects it was not a multiset because the hashcode and equal method of the native objects where used. This confusing behaviour is removed since version 0.6.

Since version 0.6 ALL data objects using the Object.hashCode() and Object.equals(Object) methods of Object. With this unique behaviour all sets are MultiSets because the hashCode is different for different objects with the same content. Additionally, the equal method in AtomicObjects is only be true if the object pointers are equal. In order to compare the content it is now necessary to use the method DataObject.hasSameValueAsIn(DataObject) like in any other data object.

In order to realise the old behaviour a Wrapper must be used like this one:

private class Wrapper {
  private AtomicObject atomicObject;
  private Object nativeObject;

  public Wrapper(AtomicObject ao) {
    this.atomicObject = ao;
    this.nativeObject = ao.getNativeObject();
  }

  public AtomicObject getAtomicObject() {
    return atomicObject;
  }
  public Object getNativeObject() {
    return nativeObject;
  }
  public int hashCode() {
    return nativeObject.hashCode();
  }
  public String toString() {
    return atomicObject.toString();
  }
}
                

Properties

In addition to the "main value" of a data object, each data object can store properties to store additional information about the object. For example, maintenance information like how often the object was retrieved is stored in such a way.

Object Identification

To access a data object in a data object pool (see de.uni_trier.wi2.procake.data.objectpool), each data object has to be identified. But a data object can be an element of several pools why a simple identification number is not sufficient because it should be unique in all pools. This would require an identification number synchronisation between all pools which is very difficult, especially by the fact that each InformationAgent can contain a pool and such agents can be hot plugged into and from the system. Therefore, a data object can have several identifications, the objectId

Inheritance Structure

The data objects are organized in a object oriented tree. Except for UnionClass the object hierarchy is the same as for the data model, see de.uni_trier.wi2.procake.data.model.

The object package contains further the following components: