View Javadoc

1   /*
2    * Copyright 1999-2006 Faculty of Mathematics, Physics
3    * and Informatics, Comenius University, Bratislava. This file is protected by
4    * the Mozilla Public License version 1.1 (the License); you may not use this
5    * file except in compliance with the License. You may obtain a copy of the
6    * License at http://euromath2.sourceforge.net/license.html Unless required by
7    * applicable law or agreed to in writing, software distributed under the
8    * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
9    * OF ANY KIND, either express or implied. See the License for the specific
10   * language governing permissions and limitations under the License.
11   */
12  package sk.uniba.euromath.editor.textEditor;
13  
14  import java.util.List;
15  
16  /***
17   * Container for ITextPieceKeepers. Holds together ITextPieceKeepers for text of
18   * one node. They are ordered and indexed as follows text in node they keeps.
19   * Only in noticed order can be added to container. Container creates
20   * ItextPieceInfo for each added and stores it. Node is identified by id.
21   * 
22   * @author Tomáš Studva
23   * 
24   */
25  public interface ITextPieceContainer {
26  
27      /***
28       * Returns ITextPieceKeeper stored with index index.
29       * 
30       * @param index
31       *            of wanted keeper
32       * @return ITextPieceKeeper with index index
33       */
34      public ITextPieceKeeper getPiece(int index);
35  
36      /***
37       * Returns number of all stored pieces.
38       * 
39       * @return number of all stored pieces
40       */
41      public int getPieceCount();
42  
43      /***
44       * Returns ITextPieceInfo for ITextPieceKeeper. This info is the same as
45       * ITextPieceKeeper has set.
46       * 
47       * @param forPiece
48       *            ITextPieceKeeper stored in this container
49       * @return ITextPieceInfo about ITextPieceKeeper forPiece
50       */
51      public ITextPieceInfo getInfo(ITextPieceKeeper forPiece);
52  
53      /***
54       * Returns all stored ITextPieceKeeper. If is correctly filled by
55       * ITextPieceKeepers, than returns all ITexPieceKeepers for node.
56       * 
57       * @return all stored ITextPieceKeeper
58       */
59      public List<ITextPieceKeeper> getAll();
60  
61      /***
62       * Returns next stored ITextPieceKeeper in order they are stored. For
63       * ordering see coment for class.
64       * 
65       * @param piece
66       *            asked for successor
67       * @return successor or null if <code>piece</code> is the last part
68       */
69      public ITextPieceKeeper getNext(ITextPieceKeeper piece);
70  
71      /***
72       * Returns previous stored ITextPieceKeeper in order they are stored. For
73       * ordering see coment for class.
74       * 
75       * @param piece
76       *            asked for predeccessor
77       * @return predeccessor or null if <code>piece</code> is the first part
78       */
79      public ITextPieceKeeper getPrevious(ITextPieceKeeper piece);
80  
81      /***
82       * Returns index of ITextPieceKeeper piece in this container as is stored.
83       * For ordering see coment for class.
84       * 
85       * @param piece
86       *            asked for index
87       * @return returns index of piece
88       */
89      public int indexOf(ITextPieceKeeper piece);
90      
91      /***
92       * 
93       * @param offset offset of whole text in textual Node
94       * @return ITextPieceKeeper in that is this offset
95       */
96      public ITextPieceKeeper OffsetInPieceKeeper(int offset);
97  
98      /***
99       * @return Text in the Container, that should by not very different from
100      *         text in TextNode
101      * TODO: give a description of that difference and it can occur 
102      */
103     public String getWholeContainerText();
104     // public void invalidate();
105 
106 }