Search in sources :

Example 81 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class AbstractEntity method notifyChanged.

protected final void notifyChanged(double oldValue, double newValue) {
    if (newValue == oldValue)
        return;
    FeatureDescriptor fd = CommonsFeatureDescriptorEnum.data_value;
    wGetEntityChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
    wGetCompoundChangeEventHandler().notifyChanged(this, fd, oldValue, newValue);
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 82 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class CloneOperationOld method updateAdjacencyGraph.

protected void updateAdjacencyGraph() {
    for (Map.Entry<IEntity, IEntity> entry : entityCloneMap.entrySet()) {
        IEntity entity = entry.getKey();
        IEntity entityClone = entry.getValue();
        for (int i = entity.wSize(), size = i + entity.wAdjacentSize(); i < size; i++) {
            IEntity adjacentEntity = entity.wGet(i);
            IEntity adjacentClone = entityCloneMap.get(adjacentEntity);
            if (adjacentClone != null)
                entityClone.wSet(i, adjacentClone);
            else
                // TODO enforce shallow copy removal semantics
                entityClone.wRemove(i);
        }
        for (FeatureDescriptor fd : entity.wGetAspectualFeatureDescriptors()) if (fd.isReference()) {
            IEntity adjacentEntity = entity.wGet(fd);
            IEntity adjacentClone = entityCloneMap.get(adjacentEntity);
            if (adjacentClone != null)
                entityClone.wSet(fd, adjacentClone);
            else
                // TODO enforce shallow copy removal semantics
                entityClone.wRemove(fd);
        }
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) InternalIEntity(org.whole.lang.model.InternalIEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) Map(java.util.Map) HashMap(java.util.HashMap)

Example 83 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class CloneOperationOld method cloneDescendantTree.

protected IEntity cloneDescendantTree(IEntity entity) {
    IEntity entityClone = entityCloneMap.get(entity);
    if (entityClone == null) {
        entityClone = ((InternalIEntity) entity).wShallowClone();
        entityCloneMap.put(entity, entityClone);
        for (// TODO test was int i=entityClone.wSize()-1; i>=0; i--)
        int i = 0; // TODO test was int i=entityClone.wSize()-1; i>=0; i--)
        i < entityClone.wSize(); // TODO test was int i=entityClone.wSize()-1; i>=0; i--)
        i++) cloneAndUpdate(entityClone, i);
        for (FeatureDescriptor fd : entity.wGetAspectualFeatureDescriptors()) if (!fd.isReference())
            cloneAndUpdate(entityClone, fd);
    }
    return entityClone;
}
Also used : IEntity(org.whole.lang.model.IEntity) InternalIEntity(org.whole.lang.model.InternalIEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Example 84 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class CloneOperation method updateAdjacencyGraph.

protected void updateAdjacencyGraph() {
    for (Map.Entry<IEntity, IEntity> entry : entityCloneMap.entrySet()) {
        IEntity entity = entry.getKey();
        IEntity entityClone = entry.getValue();
        for (int i = entity.wSize(), size = i + entity.wAdjacentSize(); i < size; i++) {
            IEntity adjacentEntity = entity.wGet(i);
            IEntity adjacentClone = entityCloneMap.get(adjacentEntity);
            if (adjacentClone != null)
                entityClone.wSet(i, adjacentClone);
            else
                // TODO enforce shallow copy removal semantics
                entityClone.wRemove(i);
        }
        for (FeatureDescriptor fd : entity.wGetAspectualFeatureDescriptors()) if (fd.isReference()) {
            IEntity adjacentEntity = entity.wGet(fd);
            IEntity adjacentClone = entityCloneMap.get(adjacentEntity);
            if (adjacentClone != null)
                entityClone.wSet(fd, adjacentClone);
            else
                // TODO enforce shallow copy removal semantics
                entityClone.wRemove(fd);
        }
    }
}
Also used : IEntity(org.whole.lang.model.IEntity) InternalIEntity(org.whole.lang.model.InternalIEntity) FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor) Map(java.util.Map) HashMap(java.util.HashMap)

Example 85 with FeatureDescriptor

use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.

the class SimpleEntityImpl method wSet.

public void wSet(int index, IEntity value) {
    if (index >= wSize())
        throw new IllegalArgumentException();
    EntityDescriptor<?> ed = wGetEntityDescriptor();
    FeatureDescriptor fd = ed.getEntityFeatureDescriptor(index);
    notifyChanged(fd, features[index], features[index] = value.wGetAdapter(fd.getEntityDescriptor()), !fd.isReference());
}
Also used : FeatureDescriptor(org.whole.lang.reflect.FeatureDescriptor)

Aggregations

FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)100 IEntity (org.whole.lang.model.IEntity)43 InternalIEntity (org.whole.lang.model.InternalIEntity)6 ILanguageKit (org.whole.lang.reflect.ILanguageKit)6 HashSet (java.util.HashSet)5 IContributionItem (org.eclipse.jface.action.IContributionItem)5 ActionsVisibleWhen (org.whole.lang.e4.ui.expressions.ActionsVisibleWhen)5 VisibilityExpression (org.whole.lang.e4.ui.expressions.VisibilityExpression)5 ActionsCompositeContributionItem (org.whole.lang.e4.ui.menu.ActionsCompositeContributionItem)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 HashMap (java.util.HashMap)3 IBindingManager (org.whole.lang.bindings.IBindingManager)3 ITransactionScope (org.whole.lang.bindings.ITransactionScope)3 IdentityRequestEventHandler (org.whole.lang.events.IdentityRequestEventHandler)3 IMappingStrategy (org.whole.lang.xsd.codebase.IMappingStrategy)3 IEntityFactory (org.whole.lang.factories.IEntityFactory)2 ArrayType (org.whole.lang.pojo.model.ArrayType)2 CollectionType (org.whole.lang.pojo.model.CollectionType)2 MapType (org.whole.lang.pojo.model.MapType)2