[isidorus-cvs] r695 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Sun Jul 31 14:33:55 UTC 2011


Author: lgiessmann
Date: Sun Jul 31 07:33:54 2011
New Revision: 695

Log:
gdl-frontend: Widgets: implemented the method TmHelper.getTmValuesForReifierConstraint()

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java	Sun Jul 31 07:05:43 2011	(r694)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java	Sun Jul 31 07:33:54 2011	(r695)
@@ -34,6 +34,9 @@
 		public final static String tmclTopicOccurrenceConstraint = tmcl + "topic-occurrence-constraint";
 		public final static String tmclTopicRoleConstraint = tmcl + "topic-role-constraint";
 		public final static String tmclAssociationRoleConstraint = tmcl + "association-role-constraint";
+		public final static String tmclAllows = tmcl + "allows";
+		public final static String tmclAllowed = tmcl + "allowed";
+		public final static String tmclAllowedReifier = tmcl + "allowed-reifier";
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Sun Jul 31 07:05:43 2011	(r694)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Sun Jul 31 07:33:54 2011	(r695)
@@ -758,22 +758,30 @@
 	
 	
 	// returns the topic that can be used to satisfy the passed role-player-constraint.
-	public static ArrayList<Topic> getTmValuesForReifierConstraint(Topic reifierConstraint){
+	public static ArrayList<Topic> getTmValuesForReifierConstraint(Topic reifierConstraint) throws InvalidGdlSchemaException{
 		ArrayList<Topic> result = new ArrayList<Topic>();
 		if(reifierConstraint == null) return result;
-		// TODO: implement
-		
+
+		TopicMap tm = reifierConstraint.getTopicMap();
+		Topic allowsRoleType = getTopicByPsi(GdlPsis.TMCL.tmclAllows, tm);
+		Topic allowedRoleType = getTopicByPsi(GdlPsis.TMCL.tmclAllowed, tm);
+		Topic allowedReifierAssocType = getTopicByPsi(GdlPsis.TMCL.tmclAllowedReifier, tm);
+		Topic topicType = getTopicByPsi(GdlPsis.TMCL.tmclTopictype, tm);
+		ArrayList<Topic> reifierTypes = getOtherPlayerOfBinaryAssociation(reifierConstraint, allowsRoleType, allowedReifierAssocType, null, topicType, allowedRoleType);
+		
+		if(reifierTypes.size() != 1){
+			throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(reifierConstraint) + " must be bound to exaclty one topic type that is used as reifier, but is: " + reifierTypes.size());
+		} else {
+			JsArray<Topic> allTopics = tm.getTopics();
+			for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), reifierTypes.get(0))) result.add(allTopics.get(i));
+		}
 		return result;
 	}
 	
 	
 	// returns the topic that can be used to satisfy the passed role-player-constraint.
-	public static ArrayList<Topic> getTmValuesForRolePlayerConstraint(Topic rolePlayerConstraint){
-		ArrayList<Topic> result = new ArrayList<Topic>();
-		if(rolePlayerConstraint == null) return result;
-		// TODO: implement
-		
-		return result;
+	public static ArrayList<Topic> getTmValuesForRolePlayerConstraint(Topic rolePlayerConstraint) throws ExecutionException{
+		throw new ExecutionException("this method is currently not implemented");
 	}
 	
 	
@@ -814,22 +822,14 @@
 	
 	
 	// returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
-	public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint){
-		ArrayList<Topic> result = new ArrayList<Topic>();
-		if(variantNameReifierConstraint == null) return result;
-		// TODO: implement
-		
-		return result;
+	public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException {
+		throw new ExecutionException("this mehtod is currently not implemented");
 	}
 	
 	
 	// returns the topic that can be used to satisfy the passed variant-name-scope-constraint.
-	public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint){
-		ArrayList<Topic> result = new ArrayList<Topic>();
-		if(variantNameScopeConstraint == null) return result;
-		// TODO: implement
-		
-		return result;
+	public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException{
+		throw new ExecutionException("this method is currently not implemented");
 	}
 	
 	




More information about the Isidorus-cvs mailing list