[isidorus-cvs] r1007 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Tue Oct 18 14:39:39 UTC 2011
Author: lgiessmann
Date: Tue Oct 18 07:39:38 2011
New Revision: 1007
Log:
gdl-frontend: Widgets: implemented the tmcl:scope-constraint semantics for retrieving data
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 05:10:29 2011 (r1006)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 07:39:38 2011 (r1007)
@@ -1963,7 +1963,26 @@
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
// TODO: implement: variant-name-constraint
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
- // TODO: implement: scope-constraint
+ // TODO: implement
+ Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+
+ JsArray<Topic> scope = null;
+ if(this.receivedData instanceof Topic){
+ JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
+ if(names.length() != 0) scope = names.get(0).getScope();
+ if(scope != null){
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
+ if(occs.length() != 0) scope = occs.get(0).getScope();
+ }
+ } else if(this.receivedData instanceof Association){
+ if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+ } else {
+ throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+ }
+
+ if(scope != null){
+ for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
if(!(receivedData instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + receivedData.getClass());
if(this.getRootConstraint() == null || !TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but ist bound to the root topic: " + (this.getRootConstraint() == null ? "null" : TmHelper.getAnyIdOfTopic(this.getRootConstraint())));
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 18 05:10:29 2011 (r1006)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 18 07:39:38 2011 (r1007)
@@ -20,9 +20,7 @@
import us.isidor.gdl.anaToMia.Widgets.view.GdlTopicView;
import us.isidor.gdl.anaToMia.Widgets.view.GdlAssociationView.AssociationItem;
import us.isidor.gdl.anaToMia.Widgets.view.GdlView;
-
import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.Window;
public class TmHelper {
@@ -181,7 +179,6 @@
JsArray<Role> validRoles = top.getRolesPlayed(subtype, supertypeSubtype);
for(int i = 0; i != validRoles.length(); ++i){
Association parent = validRoles.get(i).getParent();
- Window.alert(">> " + parent.getRoles().length() + " >> " + parent.getRoles(supertype).length());
if(parent.getRoles().length() == 2 && parent.getRoles(supertype).length() == 1)result.add(parent.getRoles(supertype).get(0).getPlayer());
}
return result;
More information about the Isidorus-cvs
mailing list