Skip to content

Commit

Permalink
Merge branch 'newgen' into newgen-iliasg
Browse files Browse the repository at this point in the history
  • Loading branch information
iliasger committed Nov 7, 2013
2 parents 6bd6d63 + b2917b7 commit 2e89cc8
Show file tree
Hide file tree
Showing 15 changed files with 1,228 additions and 294 deletions.
2 changes: 1 addition & 1 deletion jdeeco-core/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgeChangeTrigger;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.KnowledgeChangeTriggerImpl;

/**
* @author Tomas Bures <bures@d3s.mff.cuni.cz>
*
*/
public class KnowledgeChangeTriggerExt extends KnowledgeChangeTriggerImpl {

public KnowledgeChangeTriggerExt() {
super();
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object that) {
if (that != null && that instanceof KnowledgeChangeTrigger) {
return getKnowledgePath().equals(((KnowledgeChangeTrigger)that).getKnowledgePath());
}
return false;
}

@Override
public int hashCode() {
return getKnowledgePath().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
*/
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import org.eclipse.emf.ecore.util.EcoreUtil;
import java.util.LinkedList;
import java.util.List;

import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgePath;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.KnowledgePathImpl;

/**
Expand All @@ -27,9 +29,19 @@ public KnowledgePathExt() {
@Override
public boolean equals(Object that) {
if (that instanceof KnowledgePath) {
return EcoreUtil.equals(this, (KnowledgePath)that);
List<PathNode> thatNodes = new LinkedList<>(((KnowledgePath) that).getNodes());
List<PathNode> thisNodes = new LinkedList<>(nodes);
return thisNodes.equals(thatNodes);
}

return false;
}

@Override
public int hashCode() {
int code = 0;
for (PathNode node : getNodes()) {
code ^= node.hashCode();
}
return code;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.PathNodeCoordinatorImpl;

/**
* @author Tomas Bures <bures@d3s.mff.cuni.cz>
*
*/
public class PathNodeCoordinatorExt extends PathNodeCoordinatorImpl {

public PathNodeCoordinatorExt() {
super();
}

@Override
public boolean equals(Object that) {
return that != null && that instanceof PathNodeCoordinator;
}

@Override
public int hashCode() {
return 3872467;
}

@Override
public String toString() {
return "<COORDINATOR>";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.PathNodeFieldImpl;

/**
* @author Michal Kit <kit@d3s.mff.cuni.cz>
*
*/
public class PathNodeFieldExt extends PathNodeFieldImpl {

public PathNodeFieldExt() {
super();
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object that) {
if (that != null && that instanceof PathNodeField) {
return ((PathNodeField) that).getName().equals(getName());
}
return false;
}

@Override
public int hashCode() {
return getName().hashCode();
}

@Override
public String toString() {
return getName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMember;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.PathNodeMemberImpl;

/**
* @author Tomas Bures <bures@d3s.mff.cuni.cz>
*
*/
public class PathNodeMemberExt extends PathNodeMemberImpl {

public PathNodeMemberExt() {
super();
}

@Override
public boolean equals(Object that) {
return that != null && that instanceof PathNodeMember;
}

@Override
public int hashCode() {
return 1847356;
}

@Override
public String toString() {
return "<MEMBER>";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.PeriodicTrigger;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.PeriodicTriggerImpl;

/**
* @author Tomas Bures <bures@d3s.mff.cuni.cz>
*
*/
public class PeriodicTriggerExt extends PeriodicTriggerImpl {

public PeriodicTriggerExt() {
super();
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object that) {
if (that != null && that instanceof PeriodicTrigger) {
return getPeriod() == ((PeriodicTrigger)that).getPeriod();
}
return false;
}

@Override
public int hashCode() {
return (int)getPeriod();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
*/
package cz.cuni.mff.d3s.deeco.model.runtime.custom;

import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgeChangeTrigger;
import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgePath;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMember;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PeriodicTrigger;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.RuntimeMetadataFactoryImpl;

/**
Expand All @@ -24,6 +29,22 @@ public RuntimeMetadataFactoryExt() {
super();
}

/* (non-Javadoc)
* @see cz.cuni.mff.d3s.deeco.model.runtime.impl.RuntimeMetadataFactoryImpl#createPeriodicTrigger()
*/
@Override
public PeriodicTrigger createPeriodicTrigger() {
return new PeriodicTriggerExt();
}

/* (non-Javadoc)
* @see cz.cuni.mff.d3s.deeco.model.runtime.impl.RuntimeMetadataFactoryImpl#createKnowledgeChangeTrigger()
*/
@Override
public KnowledgeChangeTrigger createKnowledgeChangeTrigger() {
return new KnowledgeChangeTriggerExt();
}

/* (non-Javadoc)
* @see cz.cuni.mff.d3s.deeco.model.runtime.impl.RuntimeMetadataFactoryImpl#createKnowledgePath()
*/
Expand All @@ -32,5 +53,21 @@ public KnowledgePath createKnowledgePath() {
return new KnowledgePathExt();
}

@Override
public PathNodeField createPathNodeField() {
return new PathNodeFieldExt();
}

@Override
public PathNodeCoordinator createPathNodeCoordinator() {
return new PathNodeCoordinatorExt();
}

@Override
public PathNodeMember createPathNodeMember() {
return new PathNodeMemberExt();
}


// TODO: We might have also toString() method implemented for the KnowledgePath
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void stopTask(final Task task) {
TaskInfo ti = tasks.get(task);

if( ti != null && ti.state != States.RUNNING ){
task.setTriggerListener(null);
task.unsetTriggerListener();


ti.timer.cancel();
Expand Down
46 changes: 23 additions & 23 deletions jdeeco-core/src/cz/cuni/mff/d3s/deeco/scheduler/Scheduler.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package cz.cuni.mff.d3s.deeco.scheduler;

import cz.cuni.mff.d3s.deeco.executor.ExecutionListener;
import cz.cuni.mff.d3s.deeco.executor.Executor;
import cz.cuni.mff.d3s.deeco.task.Task;


/**
* Interface Scheduler for LocalTimeScheduler(and others if needed)
*
* @author Andranik Muradyan <muradian@d3s.mff.cuni.cz>
*
*/
public interface Scheduler extends ExecutionListener {
public void start();
public void stop();
public void addTask( Task task );
public void removeTask( Task task );

public void executionFailed(Task task, Exception e);
public void executionCompleted( Task task );
public void setExecutor(Executor executor);

package cz.cuni.mff.d3s.deeco.scheduler;

import cz.cuni.mff.d3s.deeco.executor.ExecutionListener;
import cz.cuni.mff.d3s.deeco.executor.Executor;
import cz.cuni.mff.d3s.deeco.task.Task;


/**
* Interface Scheduler for LocalTimeScheduler(and others if needed)
*
* @author Andranik Muradyan <muradian@d3s.mff.cuni.cz>
*
*/
public interface Scheduler extends ExecutionListener {
public void start();
public void stop();
public void addTask( Task task );
public void removeTask( Task task );

public void executionFailed(Task task, Exception e);
public void executionCompleted( Task task );
public void setExecutor(Executor executor);

}
Loading

0 comments on commit 2e89cc8

Please sign in to comment.