Skip to content

Commit

Permalink
Schedule->SchedulingSpecification
Browse files Browse the repository at this point in the history
  • Loading branch information
keznikl committed Oct 24, 2013
1 parent 2677c43 commit a73d73f
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 87 deletions.
2 changes: 1 addition & 1 deletion jdeeco-core/model/RuntimeModel.ecore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="runtime" nsURI="http://runtimemodel/1.0" nsPrefix="cz.cuni.mff.d3s.deeco.model.runtime">
<eClassifiers xsi:type="ecore:EClass" name="Schedule">
<eClassifiers xsi:type="ecore:EClass" name="SchedulingSpecification">
<eStructuralFeatures xsi:type="ecore:EReference" name="triggers" upperBound="-1"
eType="#//Trigger" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="period" lowerBound="1"
Expand Down
6 changes: 3 additions & 3 deletions jdeeco-core/model/RuntimeModel.ecorediag
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<children xmi:type="notation:Node" xmi:id="_n6RFYzyaEeOBILfoZuXX_w" type="4001"/>
<children xmi:type="notation:Node" xmi:id="_n6RFZDyaEeOBILfoZuXX_w" type="5001">
<children xmi:type="notation:Node" xmi:id="_n6RscDyaEeOBILfoZuXX_w" type="2001">
<element xmi:type="ecore:EAttribute" href="RuntimeModel.ecore#//Schedule/period"/>
<element xmi:type="ecore:EAttribute" href="RuntimeModel.ecore#//SchedulingSpecification/period"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_n6RscTyaEeOBILfoZuXX_w"/>
</children>
<styles xmi:type="notation:DrawerStyle" xmi:id="_n6RFZTyaEeOBILfoZuXX_w"/>
Expand All @@ -17,7 +17,7 @@
<styles xmi:type="notation:FilteringStyle" xmi:id="_n6RFazyaEeOBILfoZuXX_w"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_n6RFYTyaEeOBILfoZuXX_w" fontColor="4210752" fontName="Segoe UI" fontHeight="10" fillColor="13761016" lineColor="8421504"/>
<element xmi:type="ecore:EClass" href="RuntimeModel.ecore#//Schedule"/>
<element xmi:type="ecore:EClass" href="RuntimeModel.ecore#//SchedulingSpecification"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_n6RFYjyaEeOBILfoZuXX_w" x="12" y="336"/>
</children>
<children xmi:type="notation:Node" xmi:id="_n6XzGTyaEeOBILfoZuXX_w" type="1001">
Expand Down Expand Up @@ -138,7 +138,7 @@
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_n6nDpTyaEeOBILfoZuXX_w" lineColor="4210752"/>
<styles xmi:type="notation:FontStyle" xmi:id="_n6nDpjyaEeOBILfoZuXX_w" fontColor="4210752" fontName="Segoe UI" fontHeight="10"/>
<element xmi:type="ecore:EReference" href="RuntimeModel.ecore#//Schedule/triggers"/>
<element xmi:type="ecore:EReference" href="RuntimeModel.ecore#//SchedulingSpecification/triggers"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_n6nDpzyaEeOBILfoZuXX_w" points="[0, 0, 0, 68]$[0, -68, 0, 0]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_n9Pg4zyaEeOBILfoZuXX_w" id="(0.49572649572649574,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_n9Pg5DyaEeOBILfoZuXX_w" id="(0.5,1.0)"/>
Expand Down
23 changes: 18 additions & 5 deletions jdeeco-core/src/cz/cuni/mff/d3s/deeco/knowledge/KnowledgeSet.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
package cz.cuni.mff.d3s.deeco.knowledge;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;

class KnowledgeSet {
enum KnowledgeValue { EMPTY }

private Map<KnowledgeReference, Object> values;
private Map<KnowledgeReference, Object> values = new HashMap<>();

public Collection<KnowledgeReference> getEmptyReferences() {
return null;
Collection<KnowledgeReference> ret = new HashSet<>();
for (Entry<KnowledgeReference, Object> e: values.entrySet()) {
if (e.getValue() == KnowledgeValue.EMPTY)
ret.add(e.getKey());
}
return ret;
}

public Collection<KnowledgeReference> getNonEmptyReferences() {
return null;
Collection<KnowledgeReference> ret = new HashSet<>();
for (Entry<KnowledgeReference, Object> e: values.entrySet()) {
if (e.getValue() != KnowledgeValue.EMPTY)
ret.add(e.getKey());
}
return ret;
}



public void setValue(KnowledgeReference reference, Object value) {

values.put(reference, value);
}

public Object getValue(KnowledgeReference reference) {
return null;
return values.get(reference);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Schedule</b></em>'.
* A representation of the model object '<em><b>Scheduling Specification</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.Schedule#getTriggers <em>Triggers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.Schedule#getPeriod <em>Period</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.SchedulingSpecification#getTriggers <em>Triggers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.api.SchedulingSpecification#getPeriod <em>Period</em>}</li>
* </ul>
* </p>
*
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedule()
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedulingSpecification()
* @model
* @generated
*/
public interface Schedule extends EObject {
public interface SchedulingSpecification extends EObject {
/**
* Returns the value of the '<em><b>Triggers</b></em>' containment reference list.
* The list contents are of type {@link cz.cuni.mff.d3s.deeco.model.runtime.api.Trigger}.
Expand All @@ -34,7 +34,7 @@ public interface Schedule extends EObject {
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Triggers</em>' containment reference list.
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedule_Triggers()
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedulingSpecification_Triggers()
* @model containment="true"
* @generated
*/
Expand All @@ -50,14 +50,14 @@ public interface Schedule extends EObject {
* <!-- end-user-doc -->
* @return the value of the '<em>Period</em>' attribute.
* @see #setPeriod(long)
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedule_Period()
* @see cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage#getSchedulingSpecification_Period()
* @model required="true"
* @generated
*/
long getPeriod();

/**
* Sets the value of the '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.Schedule#getPeriod <em>Period</em>}' attribute.
* Sets the value of the '{@link cz.cuni.mff.d3s.deeco.model.runtime.api.SchedulingSpecification#getPeriod <em>Period</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Period</em>' attribute.
Expand All @@ -66,4 +66,4 @@ public interface Schedule extends EObject {
*/
void setPeriod(long value);

} // Schedule
} // SchedulingSpecification
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*/
package cz.cuni.mff.d3s.deeco.model.runtime.impl;

import cz.cuni.mff.d3s.deeco.model.runtime.api.Schedule;
import cz.cuni.mff.d3s.deeco.model.runtime.api.SchedulingSpecification;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Trigger;

import cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimePackage;
Expand All @@ -25,19 +25,19 @@

/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Schedule</b></em>'.
* An implementation of the model object '<em><b>Scheduling Specification</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ScheduleImpl#getTriggers <em>Triggers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.ScheduleImpl#getPeriod <em>Period</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.SchedulingSpecificationImpl#getTriggers <em>Triggers</em>}</li>
* <li>{@link cz.cuni.mff.d3s.deeco.model.runtime.impl.SchedulingSpecificationImpl#getPeriod <em>Period</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ScheduleImpl extends MinimalEObjectImpl.Container implements Schedule {
public class SchedulingSpecificationImpl extends MinimalEObjectImpl.Container implements SchedulingSpecification {
/**
* The cached value of the '{@link #getTriggers() <em>Triggers</em>}' containment reference list.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -73,7 +73,7 @@ public class ScheduleImpl extends MinimalEObjectImpl.Container implements Schedu
* <!-- end-user-doc -->
* @generated
*/
protected ScheduleImpl() {
protected SchedulingSpecificationImpl() {
super();
}

Expand All @@ -84,7 +84,7 @@ protected ScheduleImpl() {
*/
@Override
protected EClass eStaticClass() {
return runtimePackage.Literals.SCHEDULE;
return runtimePackage.Literals.SCHEDULING_SPECIFICATION;
}

/**
Expand All @@ -94,7 +94,7 @@ protected EClass eStaticClass() {
*/
public EList<Trigger> getTriggers() {
if (triggers == null) {
triggers = new EObjectContainmentEList<Trigger>(Trigger.class, this, runtimePackage.SCHEDULE__TRIGGERS);
triggers = new EObjectContainmentEList<Trigger>(Trigger.class, this, runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS);
}
return triggers;
}
Expand All @@ -117,7 +117,7 @@ public void setPeriod(long newPeriod) {
long oldPeriod = period;
period = newPeriod;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, runtimePackage.SCHEDULE__PERIOD, oldPeriod, period));
eNotify(new ENotificationImpl(this, Notification.SET, runtimePackage.SCHEDULING_SPECIFICATION__PERIOD, oldPeriod, period));
}

/**
Expand All @@ -128,7 +128,7 @@ public void setPeriod(long newPeriod) {
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case runtimePackage.SCHEDULE__TRIGGERS:
case runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS:
return ((InternalEList<?>)getTriggers()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
Expand All @@ -142,9 +142,9 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID,
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case runtimePackage.SCHEDULE__TRIGGERS:
case runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS:
return getTriggers();
case runtimePackage.SCHEDULE__PERIOD:
case runtimePackage.SCHEDULING_SPECIFICATION__PERIOD:
return getPeriod();
}
return super.eGet(featureID, resolve, coreType);
Expand All @@ -159,11 +159,11 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) {
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case runtimePackage.SCHEDULE__TRIGGERS:
case runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS:
getTriggers().clear();
getTriggers().addAll((Collection<? extends Trigger>)newValue);
return;
case runtimePackage.SCHEDULE__PERIOD:
case runtimePackage.SCHEDULING_SPECIFICATION__PERIOD:
setPeriod((Long)newValue);
return;
}
Expand All @@ -178,10 +178,10 @@ public void eSet(int featureID, Object newValue) {
@Override
public void eUnset(int featureID) {
switch (featureID) {
case runtimePackage.SCHEDULE__TRIGGERS:
case runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS:
getTriggers().clear();
return;
case runtimePackage.SCHEDULE__PERIOD:
case runtimePackage.SCHEDULING_SPECIFICATION__PERIOD:
setPeriod(PERIOD_EDEFAULT);
return;
}
Expand All @@ -196,9 +196,9 @@ public void eUnset(int featureID) {
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case runtimePackage.SCHEDULE__TRIGGERS:
case runtimePackage.SCHEDULING_SPECIFICATION__TRIGGERS:
return triggers != null && !triggers.isEmpty();
case runtimePackage.SCHEDULE__PERIOD:
case runtimePackage.SCHEDULING_SPECIFICATION__PERIOD:
return period != PERIOD_EDEFAULT;
}
return super.eIsSet(featureID);
Expand All @@ -220,4 +220,4 @@ public String toString() {
return result.toString();
}

} //ScheduleImpl
} //SchedulingSpecificationImpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public runtimeFactoryImpl() {
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case runtimePackage.SCHEDULE: return createSchedule();
case runtimePackage.SCHEDULING_SPECIFICATION: return createSchedulingSpecification();
case runtimePackage.KNOWLEDGE_CHANGE_TRIGGER: return createKnowledgeChangeTrigger();
case runtimePackage.KNOWLEDGE_PATH: return createKnowledgePath();
case runtimePackage.PATH_NODE_FIELD: return createPathNodeField();
Expand Down Expand Up @@ -107,9 +107,9 @@ public String convertToString(EDataType eDataType, Object instanceValue) {
* <!-- end-user-doc -->
* @generated
*/
public Schedule createSchedule() {
ScheduleImpl schedule = new ScheduleImpl();
return schedule;
public SchedulingSpecification createSchedulingSpecification() {
SchedulingSpecificationImpl schedulingSpecification = new SchedulingSpecificationImpl();
return schedulingSpecification;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMapKey;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Schedule;
import cz.cuni.mff.d3s.deeco.model.runtime.api.SchedulingSpecification;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Trigger;

import cz.cuni.mff.d3s.deeco.model.runtime.meta.runtimeFactory;
Expand Down Expand Up @@ -35,7 +35,7 @@ public class runtimePackageImpl extends EPackageImpl implements runtimePackage {
* <!-- end-user-doc -->
* @generated
*/
private EClass scheduleEClass = null;
private EClass schedulingSpecificationEClass = null;

/**
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -152,26 +152,26 @@ public static runtimePackage init() {
* <!-- end-user-doc -->
* @generated
*/
public EClass getSchedule() {
return scheduleEClass;
public EClass getSchedulingSpecification() {
return schedulingSpecificationEClass;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSchedule_Triggers() {
return (EReference)scheduleEClass.getEStructuralFeatures().get(0);
public EReference getSchedulingSpecification_Triggers() {
return (EReference)schedulingSpecificationEClass.getEStructuralFeatures().get(0);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getSchedule_Period() {
return (EAttribute)scheduleEClass.getEStructuralFeatures().get(1);
public EAttribute getSchedulingSpecification_Period() {
return (EAttribute)schedulingSpecificationEClass.getEStructuralFeatures().get(1);
}

/**
Expand Down Expand Up @@ -301,9 +301,9 @@ public void createPackageContents() {
isCreated = true;

// Create classes and their features
scheduleEClass = createEClass(SCHEDULE);
createEReference(scheduleEClass, SCHEDULE__TRIGGERS);
createEAttribute(scheduleEClass, SCHEDULE__PERIOD);
schedulingSpecificationEClass = createEClass(SCHEDULING_SPECIFICATION);
createEReference(schedulingSpecificationEClass, SCHEDULING_SPECIFICATION__TRIGGERS);
createEAttribute(schedulingSpecificationEClass, SCHEDULING_SPECIFICATION__PERIOD);

triggerEClass = createEClass(TRIGGER);

Expand Down Expand Up @@ -358,9 +358,9 @@ public void initializePackageContents() {
pathNodeMapKeyEClass.getESuperTypes().add(this.getPathNode());

// Initialize classes, features, and operations; add parameters
initEClass(scheduleEClass, Schedule.class, "Schedule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getSchedule_Triggers(), this.getTrigger(), null, "triggers", null, 0, -1, Schedule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getSchedule_Period(), ecorePackage.getELong(), "period", null, 1, 1, Schedule.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(schedulingSpecificationEClass, SchedulingSpecification.class, "SchedulingSpecification", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getSchedulingSpecification_Triggers(), this.getTrigger(), null, "triggers", null, 0, -1, SchedulingSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getSchedulingSpecification_Period(), ecorePackage.getELong(), "period", null, 1, 1, SchedulingSpecification.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

initEClass(triggerEClass, Trigger.class, "Trigger", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

Expand Down
Loading

0 comments on commit a73d73f

Please sign in to comment.