Skip to content
Snippets Groups Projects
Commit b823f4d9 authored by Alberto Debiasi's avatar Alberto Debiasi
Browse files

Update methods on events.

Change-Id: I3255e1286a59ea3414ae8b231a8b0cbf3f93fd40
parent bfb0fb16
Branches 4-async-constraints-1-3
No related tags found
No related merge requests found
......@@ -4669,33 +4669,13 @@ public class EntityUtil {
return events;
}
public String[] getTimeEventsPeriods(Element component) {
if (isComponentInstance(component)) {
component = getUmlType((Property) component);
}
EList<String> periods = new BasicEList<String>();
EList<TimeEvent> events = getTimeEvents(component);
for (TimeEvent event : events) {
public String getPeriod(TimeEvent event) {
ValueSpecification expr = event.getWhen().getExpr();
periods.add(getValueSpecificationValue(expr, "OCRA"));
}
return toArray(periods);
return getValueSpecificationValue(expr, "OCRA");
}
public String[] getChangeEventsExpressions(Element component) {
if (isComponentInstance(component)) {
component = getUmlType((Property) component);
}
EList<String> periods = new BasicEList<String>();
EList<ChangeEvent> events = getChangeEvents(component);
for (ChangeEvent event : events) {
public String getChangeExpression(ChangeEvent event) {
ValueSpecification expr = event.getChangeExpression();
periods.add(getValueSpecificationValue(expr, "OCRA"));
}
return toArray(periods);
return getValueSpecificationValue(expr, "OCRA");
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.sysml.portandflows.FlowDirection;
import org.eclipse.uml2.uml.CallEvent;
import org.eclipse.uml2.uml.ChangeEvent;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.ConnectorEnd;
......@@ -27,6 +28,7 @@ import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.TimeEvent;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.Package;
......@@ -1139,13 +1141,25 @@ return EntityUtil.getInstance().isCallEventByOperationName(idName,currBlock);
}
@Override
public String[] getTimeEventsPeriods(Object component) throws Exception {
return EntityUtil.getInstance().getTimeEventsPeriods((Element)component);
public EList<?> getTimeEvents(Object component) throws Exception {
return EntityUtil.getInstance().getTimeEvents((Element) component);
}
@Override
public String[] getChangeEventsExpressions(Object component) throws Exception {
return EntityUtil.getInstance().getChangeEventsExpressions((Element)component);
public EList<?> getChangeEvents(Object component) throws Exception {
return EntityUtil.getInstance().getChangeEvents((Element) component);
}
@Override
public String getTimeEventPeriod(Object timeEvent) throws Exception {
return EntityUtil.getInstance().getPeriod((TimeEvent) timeEvent);
}
@Override
public String getChangeEventExpression(Object changeEvent) throws Exception {
return EntityUtil.getInstance().getChangeExpression((ChangeEvent) changeEvent);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment