KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > editor > errorstripe > UpToDateStatus


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.spi.editor.errorstripe;
21
22 /**Up-to-date status enumeration. See {@link UpToDateStatusProvider#getUpToDate}
23  * for more information.
24  *
25  * @author Jan Lahoda
26  */

27 public final class UpToDateStatus implements Comparable JavaDoc {
28
29     /**Up-to-date status saying everything is up-to-date.
30      */

31     private static final int UP_TO_DATE_OK_VALUE = 0;
32
33     /**Up-to-date status saying that the list of marks is
34      * not up-to-date, but a up-to-date list of marks is currently
35      * being found.
36      */

37     private static final int UP_TO_DATE_PROCESSING_VALUE = 1;
38     
39     /**Up-to-date status saying that the list of marks is
40      * not up-to-date, and nothing is currently done in order to
41      * get the up-to-date list.
42      */

43     private static final int UP_TO_DATE_DIRTY_VALUE = 2;
44
45     /**Up-to-date status saying everything is up-to-date.
46      */

47     public static final UpToDateStatus UP_TO_DATE_OK = new UpToDateStatus (UP_TO_DATE_OK_VALUE);
48     
49     /**Up-to-date status saying that the list of marks is
50      * not up-to-date, but a up-to-date list of marks is currently
51      * being found.
52      */

53     public static final UpToDateStatus UP_TO_DATE_PROCESSING = new UpToDateStatus (UP_TO_DATE_PROCESSING_VALUE);
54     
55     /**Up-to-date status saying that the list of marks is
56      * not up-to-date, and nothing is currently done in order to
57      * get the up-to-date list.
58      */

59     public static final UpToDateStatus UP_TO_DATE_DIRTY = new UpToDateStatus (UP_TO_DATE_DIRTY_VALUE);
60
61     private int status;
62     
63     /** Creates a new instance of UpToDateStatus */
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 JavaDoc 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 JavaDoc obj) {
83         if (!(obj instanceof UpToDateStatus))
84             return false;
85         
86         return compareTo(obj) == 0;
87     }
88     
89     private static final String JavaDoc[] statusNames = new String JavaDoc[] {
90         "OK",
91         "PROCESSING",
92         "DIRTY",
93     };
94     
95     public String JavaDoc toString() {
96         return statusNames[getStatus()];
97     }
98 }
99
Popular Tags