home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / netscape / plugin / composer / io / Comment.class (.txt) next >
Encoding:
Java Class File  |  1997-11-03  |  1.9 KB  |  70 lines

  1. package netscape.plugin.composer.io;
  2.  
  3. public class Comment extends Token {
  4.    String text;
  5.    private static final String SELECTION_START = new String("-- selection start --");
  6.    private static final String SELECTION_END = new String("-- selection end --");
  7.    private static final String SELECTION_START_PLUS = new String("-- selection start+ --");
  8.    private static final String SELECTION_END_PLUS = new String("-- selection end+ --");
  9.  
  10.    public Comment(StringBuffer var1) {
  11.       this.text = var1.toString();
  12.    }
  13.  
  14.    Comment(FooStringBuffer var1) {
  15.       this.text = var1.toString();
  16.    }
  17.  
  18.    public Comment(String var1) {
  19.       this.text = var1;
  20.    }
  21.  
  22.    public String getText() {
  23.       return this.text;
  24.    }
  25.  
  26.    public String toString() {
  27.       return "<!" + this.text + ">";
  28.    }
  29.  
  30.    public int hashCode() {
  31.       return this.text.hashCode();
  32.    }
  33.  
  34.    public boolean equals(Object var1) {
  35.       return var1 != null && var1 instanceof Comment ? this.text.equals(((Comment)var1).text) : false;
  36.    }
  37.  
  38.    public static Comment createSelectionStart() {
  39.       return createSelectionStart(false);
  40.    }
  41.  
  42.    public static Comment createSelectionStart(boolean var0) {
  43.       return new Comment(var0 ? SELECTION_START_PLUS : SELECTION_START);
  44.    }
  45.  
  46.    public static Comment createSelectionEnd() {
  47.       return createSelectionEnd(false);
  48.    }
  49.  
  50.    public static Comment createSelectionEnd(boolean var0) {
  51.       return new Comment(var0 ? SELECTION_END_PLUS : SELECTION_END);
  52.    }
  53.  
  54.    public boolean isSelection() {
  55.       return this.isSelectionStart() || this.isSelectionEnd();
  56.    }
  57.  
  58.    public boolean isSelectionStart() {
  59.       return this.text.equals(SELECTION_START) || this.text.equals(SELECTION_START_PLUS);
  60.    }
  61.  
  62.    public boolean isSelectionEnd() {
  63.       return this.text.equals(SELECTION_END) || this.text.equals(SELECTION_END_PLUS);
  64.    }
  65.  
  66.    public boolean isSelectionStickyAfter() {
  67.       return this.text.equals(SELECTION_START_PLUS) || this.text.equals(SELECTION_END_PLUS);
  68.    }
  69. }
  70.