Show
Ignore:
Timestamp:
03/06/10 15:42:39 (2 years ago)
Author:
romain.reuillon
Message:

ui enhancement

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/openmole/misc/org.openmole.misc.tools/src/main/java/org/openmole/misc/tools/structure/Counter.java

    r3149 r3161  
    2222 * @author Romain Reuillon <romain.reuillon at openmole.org> 
    2323 */ 
    24 public class Counter { 
     24public class Counter implements Comparable<Counter> { 
    2525 
    26     int value; 
     26    Integer value; 
    2727 
    2828    public Counter() { 
     
    4242    } 
    4343 
    44     public int getValue() { 
     44    public Integer getValue() { 
    4545        return value; 
    4646    } 
    4747 
    48      public void increment(int val) { 
     48     public void increment(Integer val) { 
    4949        value+=val; 
    5050    } 
     
    5454    } 
    5555 
     56    @Override 
     57    public String toString() { 
     58        return getValue().toString(); 
     59    } 
     60 
     61    @Override 
     62    public boolean equals(Object obj) { 
     63        if (obj == null) { 
     64            return false; 
     65        } 
     66        if (getClass() != obj.getClass()) { 
     67            return false; 
     68        } 
     69        final Counter other = (Counter) obj; 
     70        if (this.getValue() != other.getValue() && (this.getValue() == null || !this.getValue().equals(other.getValue()))) { 
     71            return false; 
     72        } 
     73        return true; 
     74    } 
     75 
     76    @Override 
     77    public int hashCode() { 
     78        int hash = this.getValue().hashCode(); 
     79        return hash; 
     80    } 
     81 
     82 
     83 
     84    public int compareTo(Counter intgr) { 
     85        return getValue().compareTo(intgr.getValue()); 
     86    } 
     87 
     88 
     89 
     90 
     91 
    5692} 

logo cemagref

logo iscpif

logo lifegrid

logo region auvergne

logo patres project