}\r
\r
public static Mode getMode(ReadGraph graph, Resource flag) throws DatabaseException {\r
- int joinCount = graph.getObjects(flag, DiagramResource.getInstance(graph).FlagIsJoinedBy).size();\r
+ DiagramResource DIA = DiagramResource.getInstance(graph);\r
+ int joinCount = graph.getObjects(flag, DIA.FlagIsJoinedBy).size();\r
if(joinCount == 0)\r
return FlagClass.Mode.Internal;\r
else if(joinCount == 1) {\r
- Resource otherFlag = FlagUtil.getPossibleCounterpart(graph, flag);\r
- if(otherFlag == null /* FIXME just to get around npe */ || \r
- DiagramGraphUtil.onSameDiagram(graph, flag, otherFlag))\r
- return FlagClass.Mode.Internal;\r
- else\r
- return FlagClass.Mode.External;\r
+ for (Resource connectionJoin : graph.getObjects(flag, DIA.FlagIsJoinedBy))\r
+ for (Resource otherFlag : graph.getObjects(connectionJoin, DIA.JoinsFlag))\r
+ if (!flag.equals(otherFlag)\r
+ && !DiagramGraphUtil.onSameDiagram(graph, flag, otherFlag))\r
+ return FlagClass.Mode.External;\r
+ return FlagClass.Mode.Internal;\r
}\r
else\r
return new FlagClass.External(joinCount);\r