01: /*
02: * JBoss, Home of Professional Open Source
03: * Copyright 2005, JBoss Inc., and individual contributors as indicated
04: * by the @authors tag. See the copyright.txt in the distribution for a
05: * full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jbpm.graph.def;
23:
24: import java.io.Serializable;
25: import java.util.*;
26:
27: /**
28: * is a common supertype for a ProcessDefinition and a SuperState.
29: */
30: public interface NodeCollection extends Serializable {
31:
32: /**
33: * is the ordered list of nodes.
34: */
35: List getNodes();
36:
37: /**
38: * maps node-names to nodes. returns an empty map if
39: * no nodes are contained.
40: */
41: Map getNodesMap();
42:
43: /**
44: * retrieves a node by name.
45: * @return the node or null if no such node is present.
46: */
47: Node getNode(String name);
48:
49: /**
50: * is true if this node-collection contains a node with the
51: * given name, false otherwise.
52: */
53: boolean hasNode(String name);
54:
55: /**
56: * adds the given node to this node-collection.
57: * @return the added node.
58: * @throws IllegalArgumentException if node is null.
59: */
60: Node addNode(Node node);
61:
62: /**
63: * removes the given node from this node-collection.
64: * @return the removed node or null if the node was not present in this collection.
65: * @throws IllegalArgumentException if node is null or if the node is not contained in this nodecollection.
66: */
67: Node removeNode(Node node);
68:
69: /**
70: * changes the order of the nodes : the node on oldIndex
71: * is removed and inserted in the newIndex. All nodes inbetween
72: * the old and the new index shift one index position.
73: * @throws IndexOutOfBoundsException
74: */
75: void reorderNode(int oldIndex, int newIndex);
76:
77: /**
78: * generates a new name for a node to be added to this collection.
79: */
80: String generateNodeName();
81:
82: /**
83: * finds the node by the given hierarchical name. use .. for
84: * the parent, use slashes '/' to separate the node names.
85: */
86: Node findNode(String hierarchicalName);
87: }
|