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.Collection;
15  import java.util.List;
16  
17  /***
18   * TextPiece can have many small not overlapping selections within. It stores
19   * selection Intervals within text piece(0<=start<=end<length).
20   * 
21   * @author  Martin Kollar 30.9.2005
22   * 			Tomas Studva
23   */
24  public interface ITextPieceSelectionStatus {
25  
26      /***
27       * Returns selection that relates to this text piece.
28       * 
29       * @return list by copy, not overlapping Intervals within text piece.
30       */
31      public List<Interval> getSelectionIntervals();
32  
33      /***
34       * Test if something is selected, but not everything
35       * 
36       * @return <code>true</code>, if something is selected, but it is not fully selected
37       */
38      public boolean isPartlySelected();
39  
40      /***
41       * Test if whole text is selected.
42       * 
43       * @return <code>true</code>, if whole ITextPieceKeeper is selected
44       */
45      public boolean isFullySelected();
46      
47      /***
48       * Sets what is selected
49       * 
50       * @param intervals Collection of intervals, that are in range text and are
51       * 			not overlaping
52       */
53      public void setSelectionIntervals(Collection<Interval> intervals);
54      
55      /***
56       * Clears the selection
57       */
58      public void clear();
59      
60      /***
61       * Makes logical OR of interval and this.intervals. Holding property that intervlas are
62       * not overlaping.
63       * @param interval Interval to add to selection
64       */
65      public void addSelectionInterval(Interval interval);
66      
67      /***
68       * Subtracts interval from selection
69       * @param interval Interval to subtract
70       */
71      public void subtractSelectionInterval(Interval interval);
72  
73      /***
74       * Makes XOR with this new interval
75       * 
76       * @param intervals Interval to XOR with others
77       */
78      public void xorSelectionIntervals(Collection<Interval> intervals);
79  }