Coverage Report - palmed.edit.selection.ISelection

Classes in this Package Line Coverage Branch Coverage Complexity
ISelection
N/A 
N/A 
1

 1  
 /**
 2  
  * Redistribution  and use  in source  and binary  forms, with  or without
 3  
  * modification, are permitted provided  that the following conditions are
 4  
  * met :
 5  
  *
 6  
  * . Redistributions  of  source  code  must  retain  the  above copyright
 7  
  *   notice, this list of conditions and the following disclaimer.
 8  
  *
 9  
  * . Redistributions in  binary form  must reproduce  the above  copyright
 10  
  *   notice, this list of conditions  and the following disclaimer in  the
 11  
  *   documentation and/or other materials provided with the distribution.
 12  
  *
 13  
  * . The name of the author may not be used to endorse or promote products
 14  
  *   derived from this software without specific prior written permission.
 15  
  *
 16  
  * THIS SOFTWARE IS  PROVIDED BY THE  AUTHOR ``AS IS''  AND ANY EXPRESS  OR
 17  
  * IMPLIED  WARRANTIES,  INCLUDING,  BUT   NOT  LIMITED  TO,  THE   IMPLIED
 18  
  * WARRANTIES OF MERCHANTABILITY AND  FITNESS FOR A PARTICULAR  PURPOSE ARE
 19  
  * DISCLAIMED.  IN NO  EVENT SHALL  THE AUTHOR  BE LIABLE  FOR ANY  DIRECT,
 20  
  * INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR  CONSEQUENTIAL  DAMAGES
 21  
  * (INCLUDING,  BUT  NOT LIMITED  TO,  PROCUREMENT OF  SUBSTITUTE  GOODS OR
 22  
  * SERVICES;  LOSS  OF USE,  DATA,  OR PROFITS;  OR  BUSINESS INTERRUPTION)
 23  
  * HOWEVER CAUSED  AND ON  ANY THEORY  OF LIABILITY,  WHETHER IN  CONTRACT,
 24  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 25  
  * ANY  WAY  OUT OF  THE  USE OF  THIS  SOFTWARE, EVEN  IF  ADVISED OF  THE
 26  
  * POSSIBILITY OF SUCH DAMAGE.
 27  
  *
 28  
  * $Id$
 29  
  */
 30  
 
 31  
 package palmed.edit.selection;
 32  
 
 33  
 import java.io.IOException;
 34  
 import java.io.InputStream;
 35  
 import java.io.OutputStream;
 36  
 import palmed.io.ISerializable;
 37  
 
 38  
 /**
 39  
  * This interface defines the operations available on a text selection.
 40  
  *
 41  
  * @author Mathieu Champlon
 42  
  * @version $Revision$ $Date$
 43  
  */
 44  
 public interface ISelection extends ISerializable
 45  
 {
 46  
     /**
 47  
      * Test if the selection is empty.
 48  
      *
 49  
      * @return whether the selection is empty or not
 50  
      */
 51  
     boolean isEmpty();
 52  
 
 53  
     /**
 54  
      * Extend selection one character forward.
 55  
      */
 56  
     void forward();
 57  
 
 58  
     /**
 59  
      * Extend selection one character backward.
 60  
      */
 61  
     void backward();
 62  
 
 63  
     /**
 64  
      * Extend selection up to the given point.
 65  
      *
 66  
      * @param x the destination column
 67  
      * @param y the destination line
 68  
      */
 69  
     void extend( int x, int y );
 70  
 
 71  
     /**
 72  
      * Clear selection.
 73  
      */
 74  
     void clear();
 75  
 
 76  
     /**
 77  
      * Delete selection.
 78  
      */
 79  
     void delete();
 80  
 
 81  
     /**
 82  
      * Visit a line of text.
 83  
      *
 84  
      * @param visitor the visitor
 85  
      * @param y the line number
 86  
      */
 87  
     void accept( ILineVisitor visitor, int y );
 88  
 
 89  
     /**
 90  
      * Reset selection.
 91  
      */
 92  
     void reset();
 93  
 
 94  
     /**
 95  
      * Register a view to receive insertion point notification changes.
 96  
      *
 97  
      * @param view the view to register
 98  
      */
 99  
     void register( ISelectionView view );
 100  
 
 101  
     /**
 102  
      * Copy the current selected text.
 103  
      *
 104  
      * @param stream the stream to write to
 105  
      * @throws IOException an io exception occurs
 106  
      */
 107  
     void copy( OutputStream stream ) throws IOException;
 108  
 
 109  
     /**
 110  
      * Cut the current selected text.
 111  
      *
 112  
      * @param stream the stream to write to
 113  
      * @throws IOException an io exception occurs
 114  
      */
 115  
     void cut( OutputStream stream ) throws IOException;
 116  
 
 117  
     /**
 118  
      * Paste the given text.
 119  
      *
 120  
      * @param stream the stream to read from
 121  
      * @throws IOException an io exception occurs
 122  
      */
 123  
     void paste( InputStream stream ) throws IOException;
 124  
 
 125  
     /**
 126  
      * Replace the current selection with the text from the given stream.
 127  
      *
 128  
      * @param stream the stream
 129  
      * @throws IOException an io exception occurs
 130  
      */
 131  
     void read( InputStream stream ) throws IOException;
 132  
 
 133  
     /**
 134  
      * Write the current selected text to the given stream.
 135  
      *
 136  
      * @param stream the stream
 137  
      * @throws IOException an io exception occurs
 138  
      */
 139  
     void write( OutputStream stream ) throws IOException;
 140  
 }