1 19 20 package org.netbeans.spi.editor.errorstripe; 21 22 27 public final class UpToDateStatus implements Comparable { 28 29 31 private static final int UP_TO_DATE_OK_VALUE = 0; 32 33 37 private static final int UP_TO_DATE_PROCESSING_VALUE = 1; 38 39 43 private static final int UP_TO_DATE_DIRTY_VALUE = 2; 44 45 47 public static final UpToDateStatus UP_TO_DATE_OK = new UpToDateStatus (UP_TO_DATE_OK_VALUE); 48 49 53 public static final UpToDateStatus UP_TO_DATE_PROCESSING = new UpToDateStatus (UP_TO_DATE_PROCESSING_VALUE); 54 55 59 public static final UpToDateStatus UP_TO_DATE_DIRTY = new UpToDateStatus (UP_TO_DATE_DIRTY_VALUE); 60 61 private int status; 62 63 64 private UpToDateStatus(int status) { 65 this.status = status; 66 } 67 68 private int getStatus() { 69 return status; 70 } 71 72 public int compareTo(Object o) { 73 UpToDateStatus remote = (UpToDateStatus) o; 74 75 return status - remote.status; 76 } 77 78 public int hashCode() { 79 return 73 ^ status; 80 } 81 82 public boolean equals(Object obj) { 83 if (!(obj instanceof UpToDateStatus)) 84 return false; 85 86 return compareTo(obj) == 0; 87 } 88 89 private static final String [] statusNames = new String [] { 90 "OK", 91 "PROCESSING", 92 "DIRTY", 93 }; 94 95 public String toString() { 96 return statusNames[getStatus()]; 97 } 98 } 99 | Popular Tags |