浏览代码

RESOLVED - issue with variables with same name

Andreas Mülder 14 年之前
父节点
当前提交
0e1c5ec11a

+ 9 - 9
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/sgraph/RTStatechart.java

@@ -60,11 +60,11 @@ public class RTStatechart extends AbstractStatechart implements ExecutionScope,
 		timingService = ts;
 	}
 
-	public void removeExecutionListener(ISGraphExecutionListener listener) {
+	public synchronized void removeExecutionListener(ISGraphExecutionListener listener) {
 		listeners.remove(listener);
 	}
 
-	public void addExecutionListener(ISGraphExecutionListener listener) {
+	public synchronized void addExecutionListener(ISGraphExecutionListener listener) {
 		listeners.add(listener);
 	}
 
@@ -118,38 +118,38 @@ public class RTStatechart extends AbstractStatechart implements ExecutionScope,
 		return Collections.unmodifiableSet(variables);
 	}
 
-	protected void stateLeft(RTState state) {
+	protected synchronized void stateLeft(RTState state) {
 		currentStateConfigurartion.remove(state);
 		for (ISGraphExecutionListener listener : listeners) {
 			listener.stateLeft((Vertex) elementToAliasMap.get(state));
 		}
 	}
 
-	protected void stateEntered(RTState state) {
+	protected synchronized void stateEntered(RTState state) {
 		currentStateConfigurartion.add(state);
 		for (ISGraphExecutionListener listener : listeners) {
 			listener.stateEntered((Vertex) elementToAliasMap.get(state));
 		}
 	}
 
-	protected void transitionFired(RTReaction trans) {
+	protected synchronized void transitionFired(RTReaction trans) {
 		for (ISGraphExecutionListener listener : listeners) {
 			listener.transitionFired((Transition) elementToAliasMap.get(trans));
 		}
 	}
 
-	public void setVariableValue(RTVariable variable, Object value) {
+	public synchronized void setVariableValue(RTVariable variable, Object value) {
 		variable.setValue(value);
 		for (ISGraphExecutionListener listener : listeners) {
 			listener.variableValueChanged(variable.getName(), value);
 		}
 	}
 
-	public Set<RTState> getCurrentStateConfiguration() {
+	public synchronized Set<RTState> getCurrentStateConfiguration() {
 		return Collections.unmodifiableSet(currentStateConfigurartion);
 	}
 
-	public void raise(String signal, Object object) {
+	public synchronized void raise(String signal, Object object) {
 		RTSignalEvent event = eventMap.get(signal);
 		event.setValue(object);
 		setEvent(event);
@@ -159,7 +159,7 @@ public class RTStatechart extends AbstractStatechart implements ExecutionScope,
 
 	}
 
-	public void reset(String signal) {
+	public synchronized void reset(String signal) {
 		RTSignalEvent event = eventMap.get(signal);
 		event.setValue(null);
 		raisedEvents.remove(event);

+ 0 - 25
plugins/org.yakindu.sct.simulation.runtime/src/org/yakindu/sct/simulation/runtime/stext/RTVariable.java

@@ -67,29 +67,4 @@ public class RTVariable {
 		this.value = value;
 	}
 
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((name == null) ? 0 : name.hashCode());
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		RTVariable other = (RTVariable) obj;
-		if (name == null) {
-			if (other.name != null)
-				return false;
-		} else if (!name.equals(other.name))
-			return false;
-		return true;
-	}
-
 }