diff --git a/com.epistimis.uddl.ui/src/com/epistimis/uddl/ui/contentassist/UddlProposalProvider.java b/com.epistimis.uddl.ui/src/com/epistimis/uddl/ui/contentassist/UddlProposalProvider.java index 82c0100..7946223 100644 --- a/com.epistimis.uddl.ui/src/com/epistimis/uddl/ui/contentassist/UddlProposalProvider.java +++ b/com.epistimis.uddl.ui/src/com/epistimis/uddl/ui/contentassist/UddlProposalProvider.java @@ -30,14 +30,18 @@ import com.epistimis.uddl.PlatformEntityProcessor; import com.epistimis.uddl.UddlQNP; import com.epistimis.uddl.util.IndexUtilities; +import com.epistimis.uddl.uddl.LogicalAssociation; import com.epistimis.uddl.uddl.LogicalComposition; import com.epistimis.uddl.uddl.LogicalEntity; import com.epistimis.uddl.uddl.LogicalMeasurement; import com.epistimis.uddl.uddl.LogicalMeasurementAttribute; import com.epistimis.uddl.uddl.LogicalMeasurementAxis; +import com.epistimis.uddl.uddl.LogicalParticipant; +import com.epistimis.uddl.uddl.PlatformAssociation; import com.epistimis.uddl.uddl.PlatformComposableElement; import com.epistimis.uddl.uddl.PlatformComposition; import com.epistimis.uddl.uddl.PlatformEntity; +import com.epistimis.uddl.uddl.PlatformParticipant; import com.epistimis.uddl.uddl.PlatformStruct; import com.epistimis.uddl.uddl.UddlElement; import com.epistimis.uddl.uddl.UddlPackage; @@ -58,7 +62,7 @@ public class UddlProposalProvider extends AbstractUddlProposalProvider { final static String INDENT = "\t"; final static String MEMBER_DISPLAY_FMT = "{0}" ; final static String REALIZE_ALL = "<>"; - final static String STRUCT_REALIZATION_ERR = "PlatformStruct {0} must realize a LogicalMeasurement with 2+ axes / attributes. {1} only has {2}"; + final static String STRUCT_REALIZATION_ERR = "PlatformStruct {0} must realize a LogicalMeasurement with 2+ axes / attributes. {1} has {2}"; final static String STRUCT_AXIS_FMT = "{0} {1} ( {2} ) ;" ; final static String STRUCT_ATTRIBUTE_FMT = "{0} {1} ( {2} ) -> {3} ;" ; final static String GENERIC_REF_DISPLAY_FMT = "{0} - {1}"; @@ -186,12 +190,32 @@ public void complete_LogicalComposition(EObject obj, RuleCall ruleCall, ContentA clrpproc.complete_Composition(this,clrproc, ent, ruleCall, context, acceptor); } + @Override + public void complete_LogicalParticipant(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + LogicalAssociation assoc = null; + if (model instanceof LogicalAssociation) { assoc = (LogicalAssociation)model; } + else if (model instanceof LogicalParticipant) { assoc = (LogicalAssociation)model.eContainer(); } + else { + throw new RuntimeException("Can't cast to LogicalAssociation:" + model.eClass().toString()); + } + clrpproc.complete_Participant(this,clrproc, assoc, ruleCall, context, acceptor); + + } // @Override -// public void completeLogicalComposition_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { -//// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); -// clrpproc.completeComposition_Type(this, (LogicalEntity)model, assignment, context, acceptor); -// +// public void completeLogicalEntity_Composition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); +// } +// @Override +// public void completeLogicalAssociation_Composition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); // } + + @Override + public void completeLogicalComposition_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); + clrpproc.completeComposition_Type(this, (LogicalEntity)model, assignment, context, acceptor); + + } /** * The only way to force calling a super class method is by calling from the derived class. So we create this callback to * be used by clrpproc to force the call to the super class method @@ -216,6 +240,13 @@ public void completeLogicalComposition_Realizes(EObject obj, Assignment assignme clrpproc.completeComposition_Realizes(this, clrproc, (LogicalEntity)obj.eContainer(), assignment, context, acceptor); } + @Override + public void completeLogicalParticipant_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); + clrpproc.completeParticipant_Type(this, (LogicalAssociation)model, assignment, context, acceptor); + + } + @Override public void completeLogicalMeasurement_Realizes(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { // Do I need to call super? Don't think so @@ -227,6 +258,7 @@ public void completeLogicalMeasurement_Realizes(EObject model, Assignment assign /** Platform -> Logical */ + /** Rule methods */ /** * The only way to force calling a super class method is by calling from the derived class. So we create this callback to * be used by clrpproc to force the call to the super class method @@ -252,12 +284,36 @@ public void complete_PlatformComposition(EObject obj, RuleCall ruleCall, Content } + @Override + public void complete_PlatformParticipant(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { + PlatformAssociation assoc = null; + if (model instanceof PlatformAssociation) { assoc = (PlatformAssociation)model; } + else if (model instanceof PlatformParticipant) { assoc = (PlatformAssociation)model.eContainer(); } + else { + throw new RuntimeException("Can't cast to PlatformAssociation:" + model.eClass().toString()); + } + lprpproc.complete_Participant(this,lprproc, assoc, ruleCall, context, acceptor); + + } + + /** Feature Methods */ + // @Override -// public void completePlatformComposition_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { -//// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); -// lprpproc.completeComposition_Type(this, (PlatformEntity)model, assignment, context, acceptor); -// +// public void completePlatformEntity_Composition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); // } + +// @Override +// public void completePlatformAssociation_Composition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor); +// } + + @Override + public void completePlatformComposition_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); + lprpproc.completeComposition_Type(this, (PlatformEntity)model, assignment, context, acceptor); + + } /** * The only way to force calling a super class method is by calling from the derived class. So we create this callback to * be used by clrpproc to force the call to the super class method @@ -284,6 +340,12 @@ public void completePlatformComposition_Realizes(EObject obj, Assignment assignm } + @Override + public void completePlatformParticipant_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { +// lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor); + lprpproc.completeParticipant_Type(this, (PlatformAssociation)model, assignment, context, acceptor); + + } @Override public void completePlatformStruct_Member(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { diff --git a/com.epistimis.uddl/src/com/epistimis/uddl/Uddl.xtext b/com.epistimis.uddl/src/com/epistimis/uddl/Uddl.xtext index 570f348..c39ec84 100644 --- a/com.epistimis.uddl/src/com/epistimis/uddl/Uddl.xtext +++ b/com.epistimis.uddl/src/com/epistimis/uddl/Uddl.xtext @@ -522,7 +522,8 @@ LogicalCharacteristic: LogicalParticipant ; -/** A logical Entity “realizes” a conceptual Entity in terms of Measurements and other logical Entities. Since a logical Entity is built from +/** + * A logical Entity “realizes” a conceptual Entity in terms of Measurements and other logical Entities. Since a logical Entity is built from * logical Measurements, it is independent of any specific platform data representation. A logical Entity's composition hierarchy is consistent * with the composition hierarchy of the conceptual Entity that it realizes. The logical Entity’s composed Entities realize one to one the conceptual * Entity’s composed Entities; the logical Entity’s composed Measurements realize many to one the conceptual Entity’s composed Observables. diff --git a/com.epistimis.uddl/src/com/epistimis/uddl/unrolled/UnrolledEntity.java b/com.epistimis.uddl/src/com/epistimis/uddl/unrolled/UnrolledEntity.java index 2393150..1845388 100644 --- a/com.epistimis.uddl/src/com/epistimis/uddl/unrolled/UnrolledEntity.java +++ b/com.epistimis.uddl/src/com/epistimis/uddl/unrolled/UnrolledEntity.java @@ -1,6 +1,7 @@ package com.epistimis.uddl.unrolled; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import org.eclipse.emf.common.util.EList; @@ -83,7 +84,7 @@ protected Map processSpecializationForCompositions(Entity if (specializedEntity != null) { compositionSoFar = processSpecializationForCompositions(specializedEntity); } else { - compositionSoFar = new HashMap(); + compositionSoFar = new LinkedHashMap(); } setDescription(pe); return processLocalCompositions(pe,compositionSoFar); @@ -97,8 +98,10 @@ protected Map processLocalCompositions(Entity pe, Map results = new HashMap<>(); + Map results = new LinkedHashMap<>(); for (Composition pc: getComposition(pe)) { UComposition rc = null; @SuppressWarnings("unchecked") // OCL invariants say that compositions can only specialize compositions