home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / text / Annotation.java next >
Encoding:
Java Source  |  1998-03-20  |  2.0 KB  |  64 lines

  1. /*
  2.  * @(#)Annotation.java    1.4 98/03/18
  3.  *
  4.  * Copyright 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.text;
  16.  
  17. /**
  18. * An Annotation object is used as a wrapper for a text attribute value if
  19. * <ul>
  20. * <li>The text range that the attribute is applied to is critical to the
  21. * semantics of the range. That means, the attribute cannot be applied to subranges
  22. * of the text range that it applies to, and, if two adjacent text ranges have
  23. * the same value for this attribute, the attribute still cannot be applied to
  24. * the combined range as a whole with this value.
  25. * <li>The attribute or its value usually do no longer apply if the underlying text is
  26. * changed.
  27. * </ul>
  28. *
  29. * An example is grammatical information attached to a sentence:
  30. * For the previous sentence, you can say that "an example"
  31. * is the subject, but you cannot say the same about "an", "example", or "exam".
  32. * When the text is changed, the grammatical information typically becomes invalid.
  33. * Another example is Japanese reading information (yomi).
  34. *
  35. * <p>
  36. * Wrapping the attribute value into an Annotation object guarantees that
  37. * adjacent text runs don't get merged even if the attribute values are equal,
  38. * and indicates to text containers that the attribute should be discarded if
  39. * the underlying text is modified.
  40. *
  41. * @see AttributedCharacterIterator
  42. */
  43.  
  44. public class Annotation {
  45.  
  46.     /**
  47.      * Constructs an annotation record with the given value.
  48.      * @param value The value of the attribute
  49.      */
  50.     public Annotation(Object value) {
  51.         this.value = value;
  52.     }
  53.  
  54.     /**
  55.      * Returns the value of the attribute.
  56.      */
  57.     public Object getValue() {
  58.         return value;
  59.     }
  60.     
  61.     private Object value;
  62.  
  63. };
  64.