Update of /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv21771/src/org/tm4j/topicmap/tmdm/merged Modified Files: MergedAssociationRoleKey.java MergedOccurenceKey.java MergedScopeableKey.java MergedTopicMapView.java MergedTopicNameKey.java Log Message: Bugfix: AssocationRole is actually not Scopeable: Fix the follow-up bugs triggered by type incompatibilities. Also found some more bugs regarding scope. Index: MergedAssociationRoleKey.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedAssociationRoleKey.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MergedAssociationRoleKey.java 21 Jan 2008 11:13:45 -0000 1.1 --- MergedAssociationRoleKey.java 21 Jan 2008 19:43:57 -0000 1.2 *************** *** 18,22 **** @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class MergedAssociationRoleKey extends MergedScopeableKey { protected MergedTopic type; --- 18,22 ---- @author <a href="mailto:xua...@pu...">Xuân Baldauf</a> */ ! public class MergedAssociationRoleKey { protected MergedTopic type; *************** *** 24,29 **** protected MergedTopic player; ! protected MergedAssociationRoleKey(MergedTopic type,MergedTopic player,MergedScopeKey scope) { ! super(scope); this.type = type; this.player = player; --- 24,28 ---- protected MergedTopic player; ! protected MergedAssociationRoleKey(MergedTopic type,MergedTopic player) { this.type = type; this.player = player; *************** *** 31,43 **** protected MergedAssociationRoleKey changeType(MergedTopic newType) { ! return new MergedAssociationRoleKey(newType,player,scope); } protected MergedAssociationRoleKey changePlayer(MergedTopic newPlayer) { ! return new MergedAssociationRoleKey(type,newPlayer,scope); ! } ! ! protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { ! return new MergedAssociationRoleKey(type,player,newScope); } --- 30,38 ---- protected MergedAssociationRoleKey changeType(MergedTopic newType) { ! return new MergedAssociationRoleKey(newType,player); } protected MergedAssociationRoleKey changePlayer(MergedTopic newPlayer) { ! return new MergedAssociationRoleKey(type,newPlayer); } *************** *** 55,67 **** public boolean equals(MergedAssociationRoleKey o) { ! return type.equals(o.type)&&player.equals(o.player)&&super.equals(o); } public int hashCode() { ! return type.hashCode()^player.hashCode()^super.hashCode(); } public String toString() { ! return "MergedAssociationRoleKey[type="+type+",player="+player+",scope="+getScope()+"]"; } } --- 50,62 ---- public boolean equals(MergedAssociationRoleKey o) { ! return type.equals(o.type)&&player.equals(o.player); } public int hashCode() { ! return type.hashCode()^player.hashCode(); } public String toString() { ! return "MergedAssociationRoleKey[type="+type+",player="+player+"]"; } } Index: MergedTopicNameKey.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedTopicNameKey.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MergedTopicNameKey.java 21 Jan 2008 11:13:45 -0000 1.1 --- MergedTopicNameKey.java 21 Jan 2008 19:43:57 -0000 1.2 *************** *** 39,44 **** } ! protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { ! return new MergedAssociationRoleKey(parent,type,newScope); } --- 39,44 ---- } ! protected MergedTopicNameKey changeScope(MergedScopeKey newScope) { ! return new MergedTopicNameKey(parent,type,value,newScope); } *************** *** 52,60 **** public boolean equals(MergedTopicNameKey o) { ! return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value); } public int hashCode() { ! return parent.hashCode()^type.hashCode()^value.hashCode(); } --- 52,60 ---- public boolean equals(MergedTopicNameKey o) { ! return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value)&&super.equals(o); } public int hashCode() { ! return parent.hashCode()^type.hashCode()^value.hashCode()^super.hashCode(); } Index: MergedTopicMapView.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedTopicMapView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MergedTopicMapView.java 21 Jan 2008 19:21:15 -0000 1.2 --- MergedTopicMapView.java 21 Jan 2008 19:43:57 -0000 1.3 *************** *** 1115,1119 **** protected MergedAssociationRoleKey createAssociationRoleKey(ReadableAssociationRole source) { ! return new MergedAssociationRoleKey(getMergedTopic(source.getType()),getMergedTopic(source.getPlayer()),createScopeKey(source.getScope())); } --- 1115,1119 ---- protected MergedAssociationRoleKey createAssociationRoleKey(ReadableAssociationRole source) { ! return new MergedAssociationRoleKey(getMergedTopic(source.getType()),getMergedTopic(source.getPlayer())); } Index: MergedScopeableKey.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedScopeableKey.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MergedScopeableKey.java 21 Jan 2008 11:13:45 -0000 1.1 --- MergedScopeableKey.java 21 Jan 2008 19:43:57 -0000 1.2 *************** *** 45,48 **** --- 45,49 ---- public int hashCode() { + // This should yield a NullPointerException, as scope can be null, shouldn't it? return scope.hashCode(); } Index: MergedOccurenceKey.java =================================================================== RCS file: /cvsroot/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/merged/MergedOccurenceKey.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MergedOccurenceKey.java 21 Jan 2008 11:13:45 -0000 1.1 --- MergedOccurenceKey.java 21 Jan 2008 19:43:57 -0000 1.2 *************** *** 39,43 **** } ! protected MergedAssociationRoleKey changeScope(MergedScopeKey newScope) { throw new UnsupportedOperationException(); } --- 39,43 ---- } ! protected MergedOccurenceKey changeScope(MergedScopeKey newScope) { throw new UnsupportedOperationException(); } *************** *** 52,60 **** public boolean equals(MergedOccurenceKey o) { ! return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value); } public int hashCode() { ! return parent.hashCode()^type.hashCode()^value.hashCode(); } --- 52,60 ---- public boolean equals(MergedOccurenceKey o) { ! return parent.equals(o.parent)&&type.equals(o.type)&&value.equals(o.value)&&super.equals(o); } public int hashCode() { ! return parent.hashCode()^type.hashCode()^value.hashCode()^super.hashCode(); } |