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.toolkit;
025:
026: import jacareto.struct.StructureElement;
027:
028: /**
029: * This class stores the record and structure insert point for CleverPHL.
030: *
031: * @author <a href="mailto:markus.bois@web.de">Markus Bois</a>
032: * @version 1.00
033: */
034: public class InsertPoint {
035: /** The selected structureelement */
036: private StructureElement selectedElement;
037:
038: /** The structureelement where the new elements should be added. */
039: private StructureElement structureToAdd;
040:
041: /** The index in the structureelement */
042: private int structureIndexToAdd;
043:
044: /** The index in the record */
045: private int recordIndexToAdd;
046:
047: /**
048: * Creates a new InsertPoint.
049: *
050: * @param selectedElement the element is selected in the tree.
051: * @param structureToAdd the element where the children should be added.
052: * @param structureIndexToAdd the index where the new elements should be added.
053: * @param recordIndexToAdd the index where the recordables should be added
054: */
055: public InsertPoint(StructureElement selectedElement,
056: StructureElement structureToAdd, int structureIndexToAdd,
057: int recordIndexToAdd) {
058: this .selectedElement = selectedElement;
059: this .structureToAdd = structureToAdd;
060: this .structureIndexToAdd = structureIndexToAdd;
061: this .recordIndexToAdd = recordIndexToAdd;
062: }
063:
064: /**
065: * Returns the index where the recordable should be inserted in the record.
066: *
067: * @return the index in the record
068: */
069: public int getRecordIndexToAdd() {
070: return recordIndexToAdd;
071: }
072:
073: /**
074: * Returns the selected struture element in the tree.
075: *
076: * @return the structure element
077: */
078: public StructureElement getSelectedElement() {
079: return selectedElement;
080: }
081:
082: /**
083: * Returns the index where the element should be inserted in the structure.
084: *
085: * @return the index in the structure
086: */
087: public int getStructureIndexToAdd() {
088: return structureIndexToAdd;
089: }
090:
091: /**
092: * Returns the structureelement where the new elements shoud be inserted.
093: *
094: * @return the new parent structure element
095: */
096: public StructureElement getStructureToAdd() {
097: return structureToAdd;
098: }
099:
100: /**
101: * Returns a string representation.
102: *
103: * @return the insert point as string.
104: */
105: public String toString() {
106: return "si: " + structureIndexToAdd + "; ri: "
107: + recordIndexToAdd;
108: }
109: }
|