Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv1985/src/org/tm4j/topicmap/tmdm/tm4j1
Modified Files:
MemberImpl.java TopicMapImpl.java
Log Message:
Implement MergedImpl.addPlayer(Topic player) legacy method.
Index: MemberImpl.java
===================================================================
RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/MemberImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MemberImpl.java 22 Jan 2008 21:38:35 -0000 1.4
--- MemberImpl.java 22 Jan 2008 21:46:04 -0000 1.5
***************
*** 98,102 ****
*/
public void addPlayer(Topic player) throws PropertyVetoException {
! throw new UnsupportedOperationException();
}
--- 98,106 ----
*/
public void addPlayer(Topic player) throws PropertyVetoException {
! if (getContainer().isInternalUnspecifiedTopic(getRepresentedObject().getPlayer())) {
! getRepresentedObject().setPlayer(getContainer().externalToUnmerged(player));
! } else {
! throw new UnsupportedOperationException("We do not support association roles having more than one player. Also, no workaround (like creating a separate association role in this case) has been implemented so far.");
! }
}
Index: TopicMapImpl.java
===================================================================
RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/TopicMapImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TopicMapImpl.java 22 Jan 2008 21:36:05 -0000 1.12
--- TopicMapImpl.java 22 Jan 2008 21:46:04 -0000 1.13
***************
*** 138,142 ****
protected org.tm4j.topicmap.tmdm.Topic getInternalUnspecifiedTopic() {
if (unspecifiedTopic==null) {
! unspecifiedTopic = getRepresentedObject().createTopic(); // this topic does not have properties, but this should be fine for now.
}
--- 138,146 ----
protected org.tm4j.topicmap.tmdm.Topic getInternalUnspecifiedTopic() {
if (unspecifiedTopic==null) {
! /*
! this topic does not have properties, but this should be fine for now.
! However, when having multiple merged topic maps, maybe the instances of the internal unspecified topic should merge, too?
! */
! unspecifiedTopic = getRepresentedObject().createTopic();
}
***************
*** 144,147 ****
--- 148,159 ----
}
+ /**
+ Having this method is good, as this method may evaluate faster than getInternalUnspecifiedTopic()==t, because:
+ If we never created the internal unspecified topic, then the test should always return false, because, in this case, what is supplied cannot be the internal unspecified topic.
+ */
+ protected boolean isInternalUnspecifiedTopic(org.tm4j.topicmap.tmdm.ReadableTopic t) {
+ return unspecifiedTopic==t;
+ }
+
protected MergedTopicMap getMergedObject() {
return getMergedTopicMapView().getMergedTopicMap();
|