001: /*
002: * Jacareto Copyright (c) 2002-2005
003: * Applied Computer Science Research Group, Darmstadt University of
004: * Technology, Institute of Mathematics & Computer Science,
005: * Ludwigsburg University of Education, and Computer Based
006: * Learning Research Group, Aachen University. All rights reserved.
007: *
008: * Jacareto is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * Jacareto is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public
019: * License along with Jacareto; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: package jacareto.struct;
025:
026: import jacareto.system.Environment;
027:
028: import java.util.Iterator;
029: import java.util.Vector;
030:
031: /**
032: * The interaction-model element. It can include other structures.
033: *
034: * @author <a href="mailto:markus.bois@web.de">Markus Bois</a>
035: * @version 1.0
036: */
037: public abstract class InteractionModelStructureElement extends
038: StructureElement {
039: /** The name of the interaction-model-elemet */
040: private String name;
041:
042: /** The id in the interaction-model */
043: private String id;
044:
045: /** The setted concepts or concept attributes */
046: private Vector conceptualElements;
047:
048: /**
049: * Creates a new "interaction-model" structure element.
050: *
051: * @param env the environment
052: * @param children the child structure elements
053: */
054: public InteractionModelStructureElement(Environment env,
055: StructureElement[] children) {
056: this (env, children, "", "");
057: }
058:
059: /**
060: * Creates a new "interaction-model" structure element.
061: *
062: * @param env the environment
063: * @param children the child structure elements
064: * @param name the name of the task
065: * @param id the id in the interaction-model
066: */
067: public InteractionModelStructureElement(Environment env,
068: StructureElement[] children, String name, String id) {
069: super (env, null, children, true);
070: this .name = name;
071: this .id = id;
072: this .conceptualElements = new Vector();
073: }
074:
075: /**
076: * Returns the setted conceptual elements.
077: *
078: * @return DOCUMENT ME!
079: */
080: public Vector getConceptualElements() {
081: return conceptualElements;
082: }
083:
084: /**
085: * Adds a new concept or concept attribute.
086: *
087: * @param element the element that should be added.
088: */
089: public void addConceptualElement(String element) {
090: Iterator it = conceptualElements.iterator();
091: boolean found_it = false;
092:
093: while (it.hasNext() && !found_it) {
094: String compare = (String) it.next();
095: found_it = compare.equals(element);
096: }
097:
098: if (!found_it) {
099: conceptualElements.add(element);
100: }
101: }
102:
103: /**
104: * Removes a concept or concept attribute.
105: *
106: * @param element the element that should removed.
107: */
108: public void removeConceptualElement(String element) {
109: Iterator it = conceptualElements.iterator();
110: boolean done = false;
111:
112: while (it.hasNext() && !done) {
113: String compare = (String) it.next();
114:
115: if (compare.equals(element)) {
116: conceptualElements.remove(compare);
117: done = true;
118: }
119: }
120: }
121:
122: /**
123: * Remove all setted concepts or concept attributes.
124: */
125: public void clearConceptualElements() {
126: conceptualElements.clear();
127: }
128:
129: /**
130: * Returns the id
131: *
132: * @return DOCUMENT ME!
133: */
134: public String getID() {
135: return id;
136: }
137:
138: /**
139: * Returns the name of the element.
140: *
141: * @return DOCUMENT ME!
142: */
143: public String getName() {
144: return name;
145: }
146: }
|