From 0ed2c1124cf1b9e49a2ec1fa0126a8df09f9e758 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 7 Oct 2014 09:18:11 +0200 Subject: Repackage to org.cristalise --- .../com/c2kernel/graph/event/ClearedEvent.java | 26 - .../com/c2kernel/graph/event/EdgeRemovedEvent.java | 26 - .../c2kernel/graph/event/EdgesChangedEvent.java | 26 - .../graph/event/EntireModelChangedEvent.java | 26 - .../c2kernel/graph/event/ForcedNotifyEvent.java | 26 - .../com/c2kernel/graph/event/GraphModelEvent.java | 26 - .../graph/event/GraphModelResizedEvent.java | 26 - .../graph/event/NewEdgeEndPointChangedEvent.java | 26 - .../graph/event/StartVertexIdChangedEvent.java | 26 - .../com/c2kernel/graph/event/VertexAddedEvent.java | 26 - .../c2kernel/graph/event/VertexCreatedEvent.java | 26 - .../com/c2kernel/graph/event/VertexMovedEvent.java | 26 - .../c2kernel/graph/event/VertexRemovedEvent.java | 26 - .../c2kernel/graph/event/VerticesChangedEvent.java | 26 - .../graph/layout/DefaultGraphLayoutGenerator.java | 138 ------ .../com/c2kernel/graph/model/DirectedEdge.java | 118 ----- .../java/com/c2kernel/graph/model/EdgeFactory.java | 34 -- .../java/com/c2kernel/graph/model/GraphModel.java | 543 --------------------- .../c2kernel/graph/model/GraphModelCastorData.java | 50 -- .../c2kernel/graph/model/GraphModelManager.java | 156 ------ .../java/com/c2kernel/graph/model/GraphPoint.java | 37 -- .../java/com/c2kernel/graph/model/Graphable.java | 75 --- .../com/c2kernel/graph/model/GraphableEdge.java | 91 ---- .../com/c2kernel/graph/model/GraphableVertex.java | 283 ----------- .../graph/model/TypeNameAndConstructionInfo.java | 43 -- src/main/java/com/c2kernel/graph/model/Vertex.java | 327 ------------- .../com/c2kernel/graph/model/VertexFactory.java | 33 -- .../c2kernel/graph/model/VertexOutlineCreator.java | 30 -- src/main/java/com/c2kernel/graph/package-info.java | 29 -- .../c2kernel/graph/traversal/GraphTraversal.java | 105 ---- 30 files changed, 2456 deletions(-) delete mode 100644 src/main/java/com/c2kernel/graph/event/ClearedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/EdgeRemovedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/EdgesChangedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/EntireModelChangedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/ForcedNotifyEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/GraphModelEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/GraphModelResizedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/NewEdgeEndPointChangedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/StartVertexIdChangedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/VertexAddedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/VertexCreatedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/VertexMovedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/VertexRemovedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/event/VerticesChangedEvent.java delete mode 100644 src/main/java/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java delete mode 100644 src/main/java/com/c2kernel/graph/model/DirectedEdge.java delete mode 100644 src/main/java/com/c2kernel/graph/model/EdgeFactory.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphModel.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphModelCastorData.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphModelManager.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphPoint.java delete mode 100644 src/main/java/com/c2kernel/graph/model/Graphable.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphableEdge.java delete mode 100644 src/main/java/com/c2kernel/graph/model/GraphableVertex.java delete mode 100644 src/main/java/com/c2kernel/graph/model/TypeNameAndConstructionInfo.java delete mode 100644 src/main/java/com/c2kernel/graph/model/Vertex.java delete mode 100644 src/main/java/com/c2kernel/graph/model/VertexFactory.java delete mode 100644 src/main/java/com/c2kernel/graph/model/VertexOutlineCreator.java delete mode 100644 src/main/java/com/c2kernel/graph/package-info.java delete mode 100644 src/main/java/com/c2kernel/graph/traversal/GraphTraversal.java (limited to 'src/main/java/com/c2kernel/graph') diff --git a/src/main/java/com/c2kernel/graph/event/ClearedEvent.java b/src/main/java/com/c2kernel/graph/event/ClearedEvent.java deleted file mode 100644 index 691b806..0000000 --- a/src/main/java/com/c2kernel/graph/event/ClearedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class ClearedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/EdgeRemovedEvent.java b/src/main/java/com/c2kernel/graph/event/EdgeRemovedEvent.java deleted file mode 100644 index 49fab29..0000000 --- a/src/main/java/com/c2kernel/graph/event/EdgeRemovedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class EdgeRemovedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/EdgesChangedEvent.java b/src/main/java/com/c2kernel/graph/event/EdgesChangedEvent.java deleted file mode 100644 index 3ed311b..0000000 --- a/src/main/java/com/c2kernel/graph/event/EdgesChangedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class EdgesChangedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/EntireModelChangedEvent.java b/src/main/java/com/c2kernel/graph/event/EntireModelChangedEvent.java deleted file mode 100644 index 2a47ee7..0000000 --- a/src/main/java/com/c2kernel/graph/event/EntireModelChangedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class EntireModelChangedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/ForcedNotifyEvent.java b/src/main/java/com/c2kernel/graph/event/ForcedNotifyEvent.java deleted file mode 100644 index 1f988e3..0000000 --- a/src/main/java/com/c2kernel/graph/event/ForcedNotifyEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class ForcedNotifyEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/GraphModelEvent.java b/src/main/java/com/c2kernel/graph/event/GraphModelEvent.java deleted file mode 100644 index ce54e14..0000000 --- a/src/main/java/com/c2kernel/graph/event/GraphModelEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public abstract class GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/GraphModelResizedEvent.java b/src/main/java/com/c2kernel/graph/event/GraphModelResizedEvent.java deleted file mode 100644 index 6886905..0000000 --- a/src/main/java/com/c2kernel/graph/event/GraphModelResizedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class GraphModelResizedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/NewEdgeEndPointChangedEvent.java b/src/main/java/com/c2kernel/graph/event/NewEdgeEndPointChangedEvent.java deleted file mode 100644 index c1e9e3d..0000000 --- a/src/main/java/com/c2kernel/graph/event/NewEdgeEndPointChangedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class NewEdgeEndPointChangedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/StartVertexIdChangedEvent.java b/src/main/java/com/c2kernel/graph/event/StartVertexIdChangedEvent.java deleted file mode 100644 index 9ea5828..0000000 --- a/src/main/java/com/c2kernel/graph/event/StartVertexIdChangedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class StartVertexIdChangedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/VertexAddedEvent.java b/src/main/java/com/c2kernel/graph/event/VertexAddedEvent.java deleted file mode 100644 index d76cd23..0000000 --- a/src/main/java/com/c2kernel/graph/event/VertexAddedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class VertexAddedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/VertexCreatedEvent.java b/src/main/java/com/c2kernel/graph/event/VertexCreatedEvent.java deleted file mode 100644 index f74c689..0000000 --- a/src/main/java/com/c2kernel/graph/event/VertexCreatedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class VertexCreatedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/VertexMovedEvent.java b/src/main/java/com/c2kernel/graph/event/VertexMovedEvent.java deleted file mode 100644 index 239efc7..0000000 --- a/src/main/java/com/c2kernel/graph/event/VertexMovedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class VertexMovedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/VertexRemovedEvent.java b/src/main/java/com/c2kernel/graph/event/VertexRemovedEvent.java deleted file mode 100644 index 2544506..0000000 --- a/src/main/java/com/c2kernel/graph/event/VertexRemovedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class VertexRemovedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/event/VerticesChangedEvent.java b/src/main/java/com/c2kernel/graph/event/VerticesChangedEvent.java deleted file mode 100644 index 23d4385..0000000 --- a/src/main/java/com/c2kernel/graph/event/VerticesChangedEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.event; - - -public class VerticesChangedEvent extends GraphModelEvent -{ -} diff --git a/src/main/java/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java b/src/main/java/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java deleted file mode 100644 index 37f50f3..0000000 --- a/src/main/java/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.layout; - -import java.util.Vector; - -import com.c2kernel.graph.model.DirectedEdge; -import com.c2kernel.graph.model.GraphModel; -import com.c2kernel.graph.model.GraphPoint; -import com.c2kernel.graph.model.Vertex; -import com.c2kernel.utils.Logger; - -public class DefaultGraphLayoutGenerator { - private static int mTopMargin = 100; - private static int mLeftMargin = 100; - private static int mHorzGap = 180; - private static int mVertGap = 100; - - private DefaultGraphLayoutGenerator() { - } - - public static void layoutGraph(GraphModel graphModel) { - Vertex start = graphModel.getStartVertex(); - Vector> rowVector = new Vector>(10, 10); - int[] midPoints = null; - int valueOfLargestMidPoint = 0; - if (start == null) { - Logger.msg(1,"Error graph must have a starting vertex to be layed out"); - return; - } - graphModel.clearTags(start); - visitVertex(graphModel, start, 0, rowVector, start); - midPoints = new int[rowVector.size()]; - valueOfLargestMidPoint = calculateRowMidPoints(rowVector, midPoints, valueOfLargestMidPoint); - fillInVertexLocations(graphModel, rowVector, valueOfLargestMidPoint, midPoints); - fillInEdgeLocations(graphModel); - graphModel.forceNotify(); - } - - private static void visitVertex(GraphModel graphModel, Vertex vertex, int rowIndex, Vector> rowVector, Object tag) { - int i = 0; - Vertex[] children = graphModel.getOutVertices(vertex); - vertex.setTag(tag); - addVertexToRow(vertex, rowIndex, rowVector); - for (i = 0; i < children.length; i++) { - if (!(children[i].hasTag(tag))) { - visitVertex(graphModel, children[i], rowIndex + 1, rowVector, tag); - } - } - } - - private static void addVertexToRow(Vertex vertex, int rowIndex, Vector> rowVector) { - Vector rowsVertices = null; - // If there is no vector of vertices already created for this row, - // then create one - if (rowVector.size() == rowIndex) { - rowVector.add(new Vector(10, 10)); - } - // Add the vertex to the row's vector of vertices - rowsVertices = rowVector.elementAt(rowIndex); - rowsVertices.add(vertex); - } - - private static int calculateRowMidPoints(Vector> rowVector, int[] midPoints, int valueOfLargestMidPoint) { - Vector rowsVertices = null; - int newValueOfLargestMidPoint = valueOfLargestMidPoint; - int rowsWidth = 0; - int i = 0; - for (i = 0; i < midPoints.length; i++) { - rowsVertices = rowVector.elementAt(i); - rowsWidth = mHorzGap * (rowsVertices.size() - 1); - midPoints[i] = rowsWidth / 2; - if (midPoints[i] > newValueOfLargestMidPoint) { - newValueOfLargestMidPoint = midPoints[i]; - } - } - return newValueOfLargestMidPoint; - } - - private static void fillInVertexLocations(GraphModel graphModel, Vector> rowVector, - int valueOfLargestMidPoint, int[] midPoints) { - Vector rowsVertices = null; - Vertex vertex = null; - int rowIndex = 0; - int column = 0; - int rowsLeftMargin = 0; - GraphPoint point = new GraphPoint(0, 0); - for (rowIndex = 0; rowIndex < rowVector.size(); rowIndex++) { - rowsVertices = rowVector.elementAt(rowIndex); - rowsLeftMargin = mLeftMargin + valueOfLargestMidPoint - midPoints[rowIndex]; - for (column = 0; column < rowsVertices.size(); column++) { - vertex = rowsVertices.elementAt(column); - point.x = rowsLeftMargin + column * mHorzGap; - point.y = mTopMargin + rowIndex * mVertGap; - vertex.moveAbsolute(point); - graphModel.checkSize(vertex); - } - } - } - - private static void fillInEdgeLocations(GraphModel graphModel) { - Vertex[] vertices = graphModel.getVertices(); - GraphPoint centrePoint = null; - DirectedEdge[] inEdges = null; - DirectedEdge[] outEdges = null; - int i = 0; - int j = 0; - for (i = 0; i < vertices.length; i++) { - centrePoint = vertices[i].getCentrePoint(); - inEdges = graphModel.getInEdges(vertices[i]); - outEdges = graphModel.getOutEdges(vertices[i]); - for (j = 0; j < inEdges.length; j++) { - inEdges[j].setTerminusPoint(centrePoint); - } - for (j = 0; j < outEdges.length; j++) { - outEdges[j].setOriginPoint(centrePoint); - } - } - } -} diff --git a/src/main/java/com/c2kernel/graph/model/DirectedEdge.java b/src/main/java/com/c2kernel/graph/model/DirectedEdge.java deleted file mode 100644 index 7de85d3..0000000 --- a/src/main/java/com/c2kernel/graph/model/DirectedEdge.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - - - - -public abstract class DirectedEdge -{ - // Persistent data - private int mId = -1; - private GraphPoint mOriginPoint = new GraphPoint(0, 0); - private GraphPoint mTerminusPoint = new GraphPoint(0, 0); - private int mOriginVertexId = -1; - private int mTerminusVertexId = -1; - - - public void setID(int id) - { - mId = id; - } - - - public int getID() - { - return mId; - } - - - public void setOriginPoint(GraphPoint p) - { - mOriginPoint = p; - } - - - public GraphPoint getOriginPoint() - { - return mOriginPoint; - } - - - public void setTerminusPoint(GraphPoint p) - { - mTerminusPoint = p; - } - - - public GraphPoint getTerminusPoint() - { - return mTerminusPoint; - } - - - public boolean containsPoint(GraphPoint p) - { - int midX = mOriginPoint.x + (mTerminusPoint.x - mOriginPoint.x)/2; - int midY = mOriginPoint.y + (mTerminusPoint.y - mOriginPoint.y)/2; - int minX = midX - 10; - int minY = midY - 10; - int maxX = midX + 10; - int maxY = midY + 10; - - return (p.x >= minX) && (p.x <= maxX) && (p.y >= minY) && (p.y <= maxY); - } - - - public void setOriginVertexId(int id) - { - mOriginVertexId = id; - } - - - public int getOriginVertexId() - { - return mOriginVertexId; - } - - - public void setTerminusVertexId(int id) - { - mTerminusVertexId = id; - } - - - public int getTerminusVertexId() - { - return mTerminusVertexId; - } - - - public void setName(String name) - { - } - - - public String getName() - { - return null; - } -} diff --git a/src/main/java/com/c2kernel/graph/model/EdgeFactory.java b/src/main/java/com/c2kernel/graph/model/EdgeFactory.java deleted file mode 100644 index 402e8b7..0000000 --- a/src/main/java/com/c2kernel/graph/model/EdgeFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - - - -public interface EdgeFactory -{ - public void create - ( - GraphModelManager graphModelManager, - Vertex origin, - Vertex terminus, - TypeNameAndConstructionInfo typeNameAndConstructionInfo - ); -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphModel.java b/src/main/java/com/c2kernel/graph/model/GraphModel.java deleted file mode 100644 index d2d39d9..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphModel.java +++ /dev/null @@ -1,543 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - -import java.util.Hashtable; - -import com.c2kernel.graph.event.ClearedEvent; -import com.c2kernel.graph.event.EdgeRemovedEvent; -import com.c2kernel.graph.event.EdgesChangedEvent; -import com.c2kernel.graph.event.ForcedNotifyEvent; -import com.c2kernel.graph.event.GraphModelEvent; -import com.c2kernel.graph.event.GraphModelResizedEvent; -import com.c2kernel.graph.event.NewEdgeEndPointChangedEvent; -import com.c2kernel.graph.event.StartVertexIdChangedEvent; -import com.c2kernel.graph.event.VertexAddedEvent; -import com.c2kernel.graph.event.VertexCreatedEvent; -import com.c2kernel.graph.event.VertexMovedEvent; -import com.c2kernel.graph.event.VertexRemovedEvent; -import com.c2kernel.graph.event.VerticesChangedEvent; -import com.c2kernel.utils.Logger; - -public class GraphModel { - /* Persistent data */ - - private int mWidth = 0; - private int mHeight = 0; - private int mNextId = 0; - protected int mStartVertexId = -1; - protected Hashtable mVertexHashtable = new Hashtable(); - protected Hashtable mEdgeHashtable = new Hashtable(); - private GraphableVertex mContainingVertex; - - /* Transient data */ - - protected transient Vertex mNewEdgeOriginVertex = null; - protected transient GraphPoint mNewEdgeEndPoint = null; - - private transient GraphModelManager mManager = null; - - /* External factories */ - - private VertexFactory mExternalVertexFactory = null; - private EdgeFactory mExternalEdgeFactory = null; - - /* Vertex outline creator */ - - private VertexOutlineCreator mVertexOutlineCreator = null; - - /* Notification Events */ - - private final ClearedEvent mClearedEvent = new ClearedEvent(); - private final EdgeRemovedEvent mEdgeRemovedEvent = new EdgeRemovedEvent(); - private final EdgesChangedEvent mEdgesChangedEvent = new EdgesChangedEvent(); - private final ForcedNotifyEvent mForcedNotifyEvent = new ForcedNotifyEvent(); - private final NewEdgeEndPointChangedEvent mNewEdgeEndPointChangedEvent = new NewEdgeEndPointChangedEvent(); - private final StartVertexIdChangedEvent mStartVertexIdChangedEvent = new StartVertexIdChangedEvent(); - private final VertexAddedEvent mVertexAddedEvent = new VertexAddedEvent(); - private final VertexCreatedEvent mVertexCreatedEvent = new VertexCreatedEvent(); - private final VertexMovedEvent mVertexMovedEvent = new VertexMovedEvent(); - private final VertexRemovedEvent mVertexRemovedEvent = new VertexRemovedEvent(); - private final VerticesChangedEvent mVerticesChangedEvent = new VerticesChangedEvent(); - private final GraphModelResizedEvent mGraphModelResizedEvent = new GraphModelResizedEvent(); - - // Calling this constructor does not create a vertex outline creator - // which is required by the method addVertexAndCreateId() - - private static int count=0; - - // count instances for debugging - private int number; - - public GraphModel() { - number=++count; - - } - - public int getNumber() { - return number; - } - - public void setNextId(int id) { - mNextId = id; - } - - public int getNextId() { - return mNextId; - } - - public void setManager(GraphModelManager mgr) { - mManager = mgr; - } - - public GraphModelManager getManager() { - return mManager; - } - - public GraphModel(VertexOutlineCreator vertexOutlineCreator) { - mVertexOutlineCreator = vertexOutlineCreator; - } - - public void setWidth(int width) { - - mWidth = width; - } - - public int getWidth() { - return mWidth; - } - - public void setHeight(int height) { - - mHeight = height; - } - - public int getHeight() { - return mHeight; - } - - public void checkSize(Vertex v) { - boolean resized = false; - GraphPoint centre = v.getCentrePoint(); - if (getWidth() < centre.x + v.getWidth()/2 +10 ) { - setWidth( centre.x + v.getWidth()/2 +10 ); - resized = true; - } - - if (getHeight() < centre.y + v.getHeight()/2 +10 ) { - setHeight(centre.y + v.getHeight()/2 +10 ); - resized = true; - } - - if (resized) { - publishEvent(mGraphModelResizedEvent); - } - - } - - public void setStartVertexId(int id) { - mStartVertexId = id; - publishEvent(mStartVertexIdChangedEvent); - } - - public int getStartVertexId() { - return mStartVertexId; - } - - public Vertex getStartVertex() { - return resolveVertex(getStartVertexId()); - } - - /** - * @return Returns the mParentVertex. - */ - public GraphableVertex getContainingVertex() { - return mContainingVertex; - } - /** - * @param parentVertex The mParentVertex to set. - */ - public void setContainingVertex(GraphableVertex vertex) { - mContainingVertex = vertex; - } - - public void setVertices(Vertex[] vertices) { - mVertexHashtable = new Hashtable(); - for (Vertex vertice : vertices) { - mVertexHashtable.put(String.valueOf(vertice.getID()), vertice); - checkSize(vertice); - - } - publishEvent(mVerticesChangedEvent); - } - - public Vertex[] getVertices() { - Object[] vertexObjs = mVertexHashtable.values().toArray(); - Vertex[] vertices = new Vertex[vertexObjs.length]; - int i = 0; - for (i = 0; i < vertices.length; i++) { - vertices[i] = (Vertex)vertexObjs[i]; - } - return vertices; - } - - public void setEdges(DirectedEdge[] edges) { - mEdgeHashtable = new Hashtable(); - for (DirectedEdge edge : edges) { - mEdgeHashtable.put(String.valueOf(edge.getID()), edge); - } - publishEvent(mEdgesChangedEvent); - } - - public DirectedEdge[] getEdges() { - Object[] edgeObjs = mEdgeHashtable.values().toArray(); - DirectedEdge[] edges = new DirectedEdge[edgeObjs.length]; - int i = 0; - for (i = 0; i < edges.length; i++) { - edges[i] = (DirectedEdge)edgeObjs[i]; - } - return edges; - } - - public Vertex getVertexById(int id) { - return mVertexHashtable.get(String.valueOf(id)); - } - - - public int addEdgeAndCreateId(DirectedEdge e, int originId, int terminusId) { - return addEdgeAndCreateId(e, resolveVertex(originId), resolveVertex(terminusId)); - } - - public int addEdgeAndCreateId(DirectedEdge e, Vertex origin, Vertex terminus) { - e.setID(mNextId); - e.setOriginVertexId(origin.getID()); - e.setOriginPoint(origin.getCentrePoint()); - e.setTerminusVertexId(terminus.getID()); - e.setTerminusPoint(terminus.getCentrePoint()); - origin.addOutEdgeId(mNextId); - terminus.addInEdgeId(mNextId); - mEdgeHashtable.put(String.valueOf(mNextId), e); - mNextId++; - return mNextId - 1; - } - - // Removes an edge, but does not modify the selection - public void removeEdge(DirectedEdge e) { - Vertex origin = getOrigin(e); - Vertex terminus = getTerminus(e); - int edgeId = e.getID(); - // Remove the id of the edge from the origin and terminus vertices - origin.removeOutEdgeId(edgeId); - terminus.removeInEdgeId(edgeId); - // Remove the edge - mEdgeHashtable.remove(String.valueOf(e.getID())); - publishEvent(mEdgeRemovedEvent); - } - - public int addVertexAndCreateId(Vertex v, GraphPoint location) { - if (location!= null) - { - if (mVertexOutlineCreator == null) { - Logger.msg(1,"You cannot add a vertex with no outline creator"); - return -1; - - } - mVertexHashtable.put(String.valueOf(mNextId), v); - placeVertex(v, location); - } - v.setID(mNextId); - return mNextId++; - } - - public void placeVertex(Vertex v, GraphPoint location) { - v.setCentrePoint(location); - if (mVertexOutlineCreator != null) { - mVertexOutlineCreator.setOutline(v); - } - publishEvent(mVertexAddedEvent); - checkSize(v); - } - - // Removes a vertex, but does not modify the selection - public void removeVertex(Vertex v) { - DirectedEdge[] inEdges = getInEdges(v); - DirectedEdge[] outEdges = getOutEdges(v); - Vertex origin = null; - Vertex terminus = null; - int edgeId = -1; - int i = 0; - // For each in edge - for (i = 0; i < inEdges.length; i++) { - edgeId = inEdges[i].getID(); - origin = getOrigin(inEdges[i]); - // Remove the id of the edge from the origin vertex - origin.removeOutEdgeId(edgeId); - // Remove the edge - mEdgeHashtable.remove(String.valueOf(edgeId)); - } - // Remove all the out edges - for (i = 0; i < outEdges.length; i++) { - edgeId = outEdges[i].getID(); - terminus = getTerminus(outEdges[i]); - // Remove the id of the edge from the terminus vertex - terminus.removeInEdgeId(edgeId); - // Remove the edge - mEdgeHashtable.remove(String.valueOf(edgeId)); - } - // Remove the vertex - mVertexHashtable.remove(String.valueOf(v.getID())); - publishEvent(mVertexRemovedEvent); - } - - public void moveAbsoluteVertex(Vertex v, GraphPoint p) { - // Make sure the new position stays within the graph - if (p.x < 0) p.x = 0; - if (p.y < 0) p.y = 0; - if (p.x > mWidth) p.x = mWidth; - if (p.y > mHeight) p.y = mHeight; - moveAbsoluteVertexAndConnectingEdges(v, p); - publishEvent(mVertexMovedEvent); - } - - private void moveAbsoluteVertexAndConnectingEdges(Vertex v, GraphPoint p) { - DirectedEdge[] inEdges = getInEdges(v); - DirectedEdge[] outEdges = getOutEdges(v); - int i = 0; - // Move the vertex to the new position - v.moveAbsolute(p); - // Move the ends of the incoming edges to the new position - for (i = 0; i < inEdges.length; i++) { - inEdges[i].setTerminusPoint(p); - } - // Move the ends of the outgoing edges to the new position - for (i = 0; i < outEdges.length; i++) { - outEdges[i].setOriginPoint(p); - } - checkSize(v); - } - - - - public Vertex resolveVertex(int id) { - return mVertexHashtable.get(String.valueOf(id)); - } - - public DirectedEdge resolveEdge(int id) { - return mEdgeHashtable.get(String.valueOf(id)); - } - - public DirectedEdge[] getInEdges(Vertex v) { - int[] ids = v.getInEdgeIds(); - return resolveEdges(ids); - } - - public DirectedEdge[] getOutEdges(Vertex v) { - int[] ids = v.getOutEdgeIds(); - return resolveEdges(ids); - } - - private DirectedEdge[] resolveEdges(int[] ids) { - DirectedEdge[] edges = new DirectedEdge[ids.length]; - int i = 0; - for (i = 0; i < ids.length; i++) { - edges[i] = resolveEdge(ids[i]); - } - return edges; - } - - public Vertex getOrigin(DirectedEdge e) { - return resolveVertex(e.getOriginVertexId()); - } - - public Vertex getTerminus(DirectedEdge e) { - return resolveVertex(e.getTerminusVertexId()); - } - - public Vertex[] getInVertices(Vertex v) { - DirectedEdge[] inEdges = getInEdges(v); - Vertex[] inVertices = new Vertex[inEdges.length]; - int i = 0; - for (i = 0; i < inEdges.length; i++) { - inVertices[i] = getOrigin(inEdges[i]); - } - return inVertices; - } - - public Vertex[] getOutVertices(Vertex v) { - DirectedEdge[] outEdges = getOutEdges(v); - Vertex[] outVertices = new Vertex[outEdges.length]; - int i = 0; - for (i = 0; i < outEdges.length; i++) { - outVertices[i] = getTerminus(outEdges[i]); - } - return outVertices; - } - - public DirectedEdge[] getConnectingEdges(int originVertexId, int terminusVertexId) { - Vertex origin = resolveVertex(originVertexId); - DirectedEdge[] outEdges = null; - int numEdgesFound = 0; - DirectedEdge[] edgesFound = null; - int i = 0; - int j = 0; - if (origin == null) return null; - outEdges = getOutEdges(origin); - for (i = 0; i < outEdges.length; i++) { - if (outEdges[i].getTerminusVertexId() == terminusVertexId) { - numEdgesFound++; - } - } - edgesFound = new DirectedEdge[numEdgesFound]; - for (i = 0; i < outEdges.length; i++) { - if (outEdges[i].getTerminusVertexId() == terminusVertexId) { - edgesFound[j] = outEdges[i]; - j++; - } - } - return edgesFound; - } - - public void clearTags(Object tag) { - Vertex vertex = null; - Object[] vertexObjs = mVertexHashtable.values().toArray(); - int i = 0; - for (i = 0; i < vertexObjs.length; i++) { - vertex = (Vertex)vertexObjs[i]; - vertex.clearTag(tag); - } - } - - public void forceNotify() { - publishEvent(mForcedNotifyEvent); - } - - public void clear() { - mVertexHashtable = new Hashtable(); - mEdgeHashtable = new Hashtable(); - mStartVertexId = -1; - publishEvent(mClearedEvent); - } - - - - public void setNewEdgeOriginVertex(Vertex v) { - mNewEdgeOriginVertex = v; - } - - public Vertex getNewEdgeOriginVertex() { - return mNewEdgeOriginVertex; - } - - public void setNewEdgeEndPoint(GraphPoint p) { - mNewEdgeEndPoint = p; - publishEvent(mNewEdgeEndPointChangedEvent); - } - - public GraphPoint getNewEdgeEndPoint() { - return mNewEdgeEndPoint; - } - - public void setExternalVertexFactory(VertexFactory factory) { - mExternalVertexFactory = factory; - } - - public void createVertex(GraphPoint location, TypeNameAndConstructionInfo typeNameAndConstructionInfo) throws Exception { - if (mExternalVertexFactory != null) { - mExternalVertexFactory.create(mManager, location, typeNameAndConstructionInfo); - publishEvent(mVertexCreatedEvent); - } - } - - private void publishEvent(GraphModelEvent event) { - if (mManager!=null) - mManager.notifyObservers(event); - - } - - public void setExternalEdgeFactory(EdgeFactory factory) { - mExternalEdgeFactory = factory; - } - - public void setVertexOutlineCreator(VertexOutlineCreator outlineCreator) { - mVertexOutlineCreator = outlineCreator; - } - - public void createDirectedEdge(Vertex origin, Vertex terminus, TypeNameAndConstructionInfo typeNameAndConstructionInfo) { - if (mExternalEdgeFactory != null) { - mExternalEdgeFactory.create(mManager, origin, terminus, typeNameAndConstructionInfo); - } - } - - - - public void resetVertexOutlines() { - Vertex[] vertices = getVertices(); - int i = 0; - for (i = 0; i < vertices.length; i++) { - mVertexOutlineCreator.setOutline(vertices[i]); - } - } - - public void setGraphModelCastorData(GraphModelCastorData data) { - int i = 0; - - // Create and populate the vertex hashtable - mVertexHashtable = new Hashtable(); - for (i = 0; i < data.mVertexImpls.length; i++) { - mVertexHashtable.put(String.valueOf(data.mVertexImpls[i].getID()), data.mVertexImpls[i]); - checkSize(data.mVertexImpls[i]); - } - // Create and populate the edge hastable - mEdgeHashtable = new Hashtable(); - for (i = 0; i < data.mEdgeImpls.length; i++) { - mEdgeHashtable.put(String.valueOf(data.mEdgeImpls[i].getID()), data.mEdgeImpls[i]); - } - // Set the start vertex id and the id generation counter - mStartVertexId = data.mStartVertexId; - mNextId = data.mNextId; - } - - public GraphModelCastorData getGraphModelCastorData() { - Object[] vertexObjs = mVertexHashtable.values().toArray(); - Vertex[] vertexImpls = new Vertex[vertexObjs.length]; - Object[] edgeObjs = mEdgeHashtable.values().toArray(); - DirectedEdge[] directedEdgeImpls = new DirectedEdge[edgeObjs.length]; - String className = null; - int i = 0; - // Put in the vertices - for (i = 0; i < vertexImpls.length; i++) { - vertexImpls[i] = (Vertex)vertexObjs[i]; - } - // Put in the edges - for (i = 0; i < directedEdgeImpls.length; i++) { - directedEdgeImpls[i] = (DirectedEdge)edgeObjs[i]; - } - // Disable persistency of the vertex outline creator: determined by container - // Determine the class name of the vertex outline creator -// if (mVertexOutlineCreator == null) { -// className = ""; -// } -// else { -// className = mVertexOutlineCreator.getClass().getName(); -// } - return new GraphModelCastorData(className, vertexImpls, directedEdgeImpls, mStartVertexId, mNextId); - } -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphModelCastorData.java b/src/main/java/com/c2kernel/graph/model/GraphModelCastorData.java deleted file mode 100644 index e0c0c84..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphModelCastorData.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - - -public class GraphModelCastorData -{ - // Deprecated: Vertex outline creator is now set by the container - public String mClassNameOfVertexOutlineCreator = ""; - public Vertex[] mVertexImpls = {}; - public DirectedEdge[] mEdgeImpls = {}; - public int mStartVertexId = 0; - public int mNextId = 0; - - - public GraphModelCastorData() - { - } - - public GraphModelCastorData(String classNameOfVertexOutlineCreator, - Vertex[] vertexImpls, - DirectedEdge[] edgeImpls, - int startVertexId, - int nextId) - { - mClassNameOfVertexOutlineCreator = classNameOfVertexOutlineCreator; - mVertexImpls = vertexImpls; - mEdgeImpls = edgeImpls; - mStartVertexId = startVertexId; - mNextId = nextId; - } -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphModelManager.java b/src/main/java/com/c2kernel/graph/model/GraphModelManager.java deleted file mode 100644 index a4209ce..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphModelManager.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Observable; -import java.util.Stack; - -import com.c2kernel.graph.event.EntireModelChangedEvent; -import com.c2kernel.graph.event.ForcedNotifyEvent; -import com.c2kernel.graph.event.GraphModelEvent; -import com.c2kernel.utils.Logger; - - -public class GraphModelManager extends Observable -{ - - private GraphModel mGraphModel; - private EdgeFactory mEdgeFactory; - private VertexFactory mVertexFactory; - private VertexOutlineCreator mVertexOutlineCreator; - private final EntireModelChangedEvent mEntireModelChangedEvent = new EntireModelChangedEvent(); - private final ForcedNotifyEvent mForcedNotifyEvent = new ForcedNotifyEvent(); - private final Stack mParentModels = new Stack(); - private final ArrayList mParentIds = new ArrayList(); - private boolean mEditable = true; - - // Calling this constructor does not create a vertex outline creator - // which is required by the method addVertexAndCreateId() - public GraphModelManager() - { - mGraphModel = new GraphModel(); - mGraphModel.setManager(this); - } - - public GraphModelManager(GraphModel newModel) { - newModel.setManager(this); - mGraphModel = newModel; - } - - public void replace(GraphModel newModel) { - mParentModels.clear(); - - //zoom back to where we were - for (Iterator iter = mParentIds.iterator(); iter.hasNext();) { - Integer parentId = iter.next(); - GraphableVertex childModelVertex = (GraphableVertex)newModel.getVertexById(parentId.intValue()); - if (childModelVertex == null) { // we've been deleted, stay here - Logger.msg(7, "Didn't find "+parentId+" in new model tree. Stopping here."); - do { iter.remove(); } while (iter.hasNext()); - break; - } - else { - mParentModels.push(newModel); - Logger.msg(7, "Pushing model and switching to "+parentId); - newModel = childModelVertex.getChildGraphModel(); - } - } - setModel(newModel); - } - - public void setModel(GraphModel newModel) { - // reset transient data - newModel.mNewEdgeOriginVertex = null; - newModel.mNewEdgeEndPoint = null; - - // copy factories over - newModel.setExternalEdgeFactory(mEdgeFactory); - newModel.setExternalVertexFactory(mVertexFactory); - newModel.setVertexOutlineCreator(mVertexOutlineCreator); - mVertexFactory.setCreationContext(newModel.getContainingVertex()); - newModel.setManager(this); - mGraphModel.setManager(null); - mGraphModel = newModel; - - // notify - notifyObservers(mEntireModelChangedEvent); - } - - public void zoomIn(Vertex child) { - GraphModel childModel = child.getChildGraphModel(); - if (childModel != null) { - mParentModels.push(mGraphModel); - mParentIds.add(Integer.valueOf(child.getID())); - setModel(childModel); - Logger.msg(7, "ZoomIn - Stack size: "+mParentModels.size()+" ids:"+mParentIds.size()); - } - } - - public void zoomOut() { - if (!mParentModels.empty()) { - setModel(mParentModels.pop()); - mParentIds.remove(mParentIds.size()-1); - } - Logger.msg(7, "ZoomOut - Stack size: "+mParentModels.size()+" ids:"+mParentIds.size()); - - } - - public void forceNotify() - { - notifyObservers(mForcedNotifyEvent); - } - - public GraphModel getModel() { - return mGraphModel; - } - - public void setExternalEdgeFactory(EdgeFactory newEdgeFactory) { - mEdgeFactory = newEdgeFactory; - mGraphModel.setExternalEdgeFactory(newEdgeFactory); - } - - public void setExternalVertexFactory(VertexFactory newVertexFactory) { - mVertexFactory = newVertexFactory; - mGraphModel.setExternalVertexFactory(newVertexFactory); - } - - public void setVertexOutlineCreator(VertexOutlineCreator newVertexOutlineCreator) { - mVertexOutlineCreator = newVertexOutlineCreator; - mGraphModel.setVertexOutlineCreator(newVertexOutlineCreator); - } - - public void notifyObservers(GraphModelEvent ev) { - setChanged(); - super.notifyObservers(ev); - } - - public void setEditable(boolean editable) { - mEditable = editable; - } - - public boolean isEditable() { - return mEditable; - } - - -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphPoint.java b/src/main/java/com/c2kernel/graph/model/GraphPoint.java deleted file mode 100644 index dad49f9..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphPoint.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - - -public class GraphPoint { - - public int x; - public int y; - - public GraphPoint() { - x=0; y=0; - } - - public GraphPoint(int x, int y) { - this.x = x; - this.y = y; - } -} diff --git a/src/main/java/com/c2kernel/graph/model/Graphable.java b/src/main/java/com/c2kernel/graph/model/Graphable.java deleted file mode 100644 index b2d6573..0000000 --- a/src/main/java/com/c2kernel/graph/model/Graphable.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - -/** -* @version $Revision: 1.6 $ $Date: 2003/05/12 13:10:20 $ -* @author $Author: abranson $ -*/ - -import com.c2kernel.utils.CastorHashMap; - -abstract public class Graphable extends Vertex -{ - - protected CastorHashMap mProperties = null; - public GraphModel children; - - public void setProperties(CastorHashMap props) - { - mProperties = props; - } - - public CastorHashMap getProperties() - { - return mProperties; - } - /** @associates Graphable that is directly containing it*/ - private Graphable parent; - - /** - * Returns the parent. - * @return Graphable - */ - public Graphable getParent() - { - return parent; - } - - /** - * Sets the parent. - * @param parent The parent to set - */ - public void setParent(Graphable parent) - { - this.parent = parent; - } - @Override - public GraphModel getChildGraphModel() { - return children; - } - - @Override - public Object getCreationContext() { - return this; - } - -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphableEdge.java b/src/main/java/com/c2kernel/graph/model/GraphableEdge.java deleted file mode 100644 index 8a48056..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphableEdge.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - -import com.c2kernel.utils.CastorHashMap; -import com.c2kernel.utils.KeyValuePair; - -/** -* @version $Revision: 1.2 $ $Date: 2003/05/12 13:10:20 $ -* @author $Author: abranson $ -*/ -public abstract class GraphableEdge extends DirectedEdge -{ - - private GraphableVertex mParent; - private CastorHashMap mProperties = null; - - public GraphableEdge() - { - mProperties = new CastorHashMap(); - } - - public GraphableEdge(GraphableVertex pre, GraphableVertex nex) - { - mProperties = new CastorHashMap(); - setParent(pre.getParent()); - pre.getParent().getChildrenGraphModel().addEdgeAndCreateId(this, pre, nex); - } - - /** - * Returns the parent. - * @return GraphableVertex - */ - public GraphableVertex getParent() - { - return mParent; - } - - /** - * Sets the parent. - * @param parent The parent to set - */ - public void setParent(GraphableVertex parent) - { - mParent = parent; - } - - /** - * Returns the properties. - * @return CastorHashMap - */ - public CastorHashMap getProperties() - { - return mProperties; - } - - /** - * Sets the properties. - * @param properties The properties to set - */ - public void setProperties(CastorHashMap properties) - { - mProperties = properties; - } - - public KeyValuePair[] getKeyValuePairs() { - return mProperties.getKeyValuePairs(); - } - - public void setKeyValuePairs(KeyValuePair[] pairs) { - mProperties.setKeyValuePairs(pairs); - } -} diff --git a/src/main/java/com/c2kernel/graph/model/GraphableVertex.java b/src/main/java/com/c2kernel/graph/model/GraphableVertex.java deleted file mode 100644 index b90441b..0000000 --- a/src/main/java/com/c2kernel/graph/model/GraphableVertex.java +++ /dev/null @@ -1,283 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; -/** -* @version $Revision: 1.24 $ $Date: 2005/10/05 07:39:37 $ -* @author $Author: abranson $ -*/ - - -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.utils.CastorHashMap; -import com.c2kernel.utils.KeyValuePair; -public abstract class GraphableVertex extends Vertex -{ - private CastorHashMap mProperties = null; - private boolean mIsLayoutable; - protected boolean mIsComposite; - private GraphModel mChildrenGraphModel; - public GraphableVertex() - { - mProperties = new CastorHashMap(); - } - public void setProperties(CastorHashMap props) - { - mProperties = props; - } - public CastorHashMap getProperties() - { - return mProperties; - } - protected Integer getVersionNumberProperty(String propName) throws InvalidDataException { - Object val = getProperties().get(propName); - if (val == null || val.equals("") || val.toString().equals("-1")) return null; - try { - return Integer.valueOf(val.toString()); - } catch (NumberFormatException ex) { - throw new InvalidDataException("Invalid version number for property '"+propName+"': "+val.toString()); - } - } - public KeyValuePair[] getKeyValuePairs() - { - return mProperties.getKeyValuePairs(); - } - public void setKeyValuePairs(KeyValuePair[] pairs) - { - mProperties.setKeyValuePairs(pairs); - } - /** @associates Graphable that is directly containing it*/ - private GraphableVertex parent; - /** - * Returns the parent. - * @return Graphable - */ - public GraphableVertex getParent() - { - return parent; - } - /** - * Sets the parent. - * @param parent The parent to set - */ - public void setParent(GraphableVertex parent) - { - if (this.equals(parent)) - throw new ExceptionInInitializerError(); - this.parent = parent; - } - @Override - public GraphModel getChildGraphModel() - { - return mChildrenGraphModel; - } - @Override - public Object getCreationContext() - { - return this; - } - public Vertex[] getOutGraphables() - { - if (parent == null) - return new Vertex[0]; // none if no parent - return parent.mChildrenGraphModel.getOutVertices(this); - } - public DirectedEdge[] getOutEdges() - { - if (parent == null) - return new DirectedEdge[0]; // none if no parent - return parent.mChildrenGraphModel.getOutEdges(this); - } - public DirectedEdge[] getInEdges() - { - if (parent == null) - return new DirectedEdge[0]; // none if no parent - DirectedEdge[] edges = getParent().mChildrenGraphModel.getInEdges(this); - if (edges != null) - return edges; - else - return new DirectedEdge[0]; - } - public GraphableVertex[] getChildren() - { - return getLayoutableChildren(); - } - - public DirectedEdge[] getChildrenEdges() - { - if (getIsComposite()) - { - return getChildGraphModel().getEdges(); - } - return null; - } - - public GraphableVertex[] getLayoutableChildren() - { - if (getIsComposite()) - { - Vertex[] vs = mChildrenGraphModel.getVertices(); - GraphableVertex[] gvs = new GraphableVertex[vs.length]; - for (int i = 0; i < vs.length; i++) - { - gvs[i] = (GraphableVertex) vs[i]; - } - return gvs; - } - return null; - } - - /**@returns the Graphable searched or null if not this or children*/ - public GraphableVertex search(String ids) - { - if (getName().equals(ids)) - return this; - if (String.valueOf(getID()).equals(ids)) - return this; - if (getIsComposite()) - { - GraphableVertex[] graphables = getChildren(); - if (ids.startsWith(String.valueOf(getID()))) - ids = ids.substring(ids.indexOf("/") + 1); - else if (ids.startsWith(getName())) - ids = ids.substring(getName().length() + 1); - else if (ids.startsWith(getPath())) - ids = ids.substring(getPath().length() + 1); - else - return null; - - for (GraphableVertex graphable : graphables) { - GraphableVertex grap = graphable.search(ids); - if (grap != null) return grap; - } - } - return null; - } - /** - * Returns the isLayoutable. - * @return boolean - */ - public boolean getIsLayoutable() - { - return mIsLayoutable; - } - /** - * Sets the isLayoutable. - * @param isLayoutable The isLayoutable to set - */ - public void setIsLayoutable(boolean isLayoutable) - { - mIsLayoutable = isLayoutable; - } - /** - * Returns the isComposite. - * @return boolean - */ - public boolean getIsComposite() - { - return mIsComposite; - } - /** - * Sets the isComposite. - * @param isComposite The isComposite to set - */ - public void setIsComposite(boolean isComposite) - { - mIsComposite = isComposite; - } - - public void addChild(GraphableVertex graphableVertex, GraphPoint g) - { - getChildGraphModel().addVertexAndCreateId(graphableVertex, g); - graphableVertex.setParent(this); - } - /** - * Returns the childrenGraph. - * @return GraphModel - */ - public GraphModel getChildrenGraphModel() - { - return mChildrenGraphModel; - } - /** - * Sets the childrenGraph. - * @param childrenGraph The childrenGraph to set - */ - public void setChildrenGraphModel(GraphModel childrenGraph) - { - mChildrenGraphModel = childrenGraph; - DirectedEdge[] edges = mChildrenGraphModel.getEdges(); - GraphableVertex[] graphables = this.getLayoutableChildren(); - if (graphables != null) - for (GraphableVertex graphable : graphables) - graphable.setParent(this); - if (edges != null) - for (DirectedEdge edge : edges) - ((GraphableEdge) edge).setParent(this); - childrenGraph.setContainingVertex(this); - } - - /** - * @see com.c2kernel.graph.model.Vertex#getCentrePoint() - */ - @Override - public GraphPoint getCentrePoint() - { - if (!getIsLayoutable()) - return null; - return super.getCentrePoint(); - } - /** - * @see com.c2kernel.graph.model.Vertex#getInEdgeIds() - */ - @Override - public int[] getInEdgeIds() - { - if (!getIsLayoutable()) - return null; - return super.getInEdgeIds(); - } - /** - * @see com.c2kernel.graph.model.Vertex#getOutEdgeIds() - */ - @Override - public int[] getOutEdgeIds() - { - if (!getIsLayoutable()) - return null; - return super.getOutEdgeIds(); - } - /** - * @see com.c2kernel.graph.model.Vertex#getOutlinePoints() - */ - @Override - public GraphPoint[] getOutlinePoints() - { - if (!getIsLayoutable()) - return null; - return super.getOutlinePoints(); - } - public String getPath() - { - if (getName() != null && !getName().equals("")) - return getParent().getPath() + "/" + getName(); - return getParent().getPath() + "/" + getID(); - } -} \ No newline at end of file diff --git a/src/main/java/com/c2kernel/graph/model/TypeNameAndConstructionInfo.java b/src/main/java/com/c2kernel/graph/model/TypeNameAndConstructionInfo.java deleted file mode 100644 index f3b348a..0000000 --- a/src/main/java/com/c2kernel/graph/model/TypeNameAndConstructionInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - - - -public class TypeNameAndConstructionInfo -{ - public String mName = null; - public Object mInfo = null; - - - public TypeNameAndConstructionInfo(String name, Object info) - { - mName = name; - mInfo = info; - } - - - @Override - public String toString() - { - return mName; - } -} diff --git a/src/main/java/com/c2kernel/graph/model/Vertex.java b/src/main/java/com/c2kernel/graph/model/Vertex.java deleted file mode 100644 index 2aaa423..0000000 --- a/src/main/java/com/c2kernel/graph/model/Vertex.java +++ /dev/null @@ -1,327 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.graph.model; - -import java.awt.Polygon; -import java.util.Vector; - - -public class Vertex -{ - private int mId = -1; - private String mName = ""; - private GraphPoint mCentrePoint = new GraphPoint(0, 0); - private int mHeight = 0; - private int mWidth = 0; - private Vector mInEdgeIdVector = new Vector(); - private Vector mOutEdgeIdVector = new Vector(); - private final Vector mTags = new Vector(); - - // The Java Polygon class is used to determine if a point - // lies within the outline of a vertex. Unfortunately - // both the polygon and the set of outline points need to - // kept in memory because a polygon never has 0 points - // which is required by Castor's unmarshall object mechanism - private Polygon mOutlinePolygon = new Polygon(); - private GraphPoint[] mOutlinePoints = new GraphPoint[0]; - - - private GraphModel graphModel; - - public void setID(int id) - { - mId = id; - } - - - public int getID() - { - return mId; - } - - - public void setName(String n) - { - mName = n; - } - - - public String getName() - { - return mName; - } - - - public void setCentrePoint(GraphPoint p) - { - mCentrePoint = p; - } - - - public GraphPoint getCentrePoint() - { - return mCentrePoint; - } - - - public void setHeight(int h) - { - mHeight = h; - } - - - public int getHeight() - { - return mHeight; - } - - - public void setWidth(int w) - { - mWidth = w; - } - - - public int getWidth() - { - return mWidth; - } - - - // Sets the outline points and re-calculates the - // height and width - public void setOutlinePoints(GraphPoint[] outline) - { - int topLeftX = outline[0].x; - int topLeftY = outline[0].y; - int bottomRightX = 0; - int bottomRightY = 0; - int i = 0; - - mOutlinePoints = outline; - - // Construct a polygon in the outline of the vertex - // and calculate the top left and bottom right corners - mOutlinePolygon = new Polygon(); - - for(i=0; i bottomRightX) - { - bottomRightX = outline[i].x; - } - - - if(outline[i].y > bottomRightY) - { - bottomRightY = outline[i].y; - } - } - - // Set the height and width - mHeight = bottomRightY - topLeftY; - mWidth = bottomRightX - topLeftX; - } - - - public GraphPoint[] getOutlinePoints() - { - return mOutlinePoints; - } - - public void moveAbsolute(GraphPoint p) - { - int deltaX = p.x - mCentrePoint.x; - int deltaY = p.y - mCentrePoint.y; - int i = 0; - - // Update the outline points and the polygon - for(i=0; i(10, 10); - for(i=0; i(10, 10); - for(i=0; i vector) - { - int[] array = new int[vector.size()]; - Integer integer = null; - int i = 0; - - for(i=0; i path = new Vector(10, 10); - - graphModel.clearTags(startVertex); - visitVertex(startVertex, graphModel, path, direction, startVertex, ignoreBackLinks); - - return vectorToVertexArray(path); - } - - - private static void visitVertex(Vertex vertex, GraphModel graphModel, Vector path, int direction, Object tag, boolean ignoreBackLinks) - { - Vertex[] children = null; - int i = 0; - - if(direction == kDown) - { - children = graphModel.getOutVertices(vertex); - } - else - { - children = graphModel.getInVertices(vertex); - } - - vertex.setTag(tag); - path.add(vertex); - - for(i=0; i vector) - { - Vertex[] vertices = new Vertex[vector.size()]; - int i = 0; - - - for(i=0; i