1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
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     
105 
106 }