1 40 41 package org.dspace.app.statistics; 42 43 51 public class Stat implements Comparable 52 { 53 56 57 private String key = null; 58 59 60 private int value = 0; 61 62 63 private String reference = null; 64 65 66 private String units = null; 67 68 74 Stat(String key, int value) 75 { 76 this.key = key; 77 this.value = value; 78 } 79 80 87 Stat(String key, int value, String reference) 88 { 89 this.key = key; 90 this.value = value; 91 this.reference = reference; 92 } 93 94 99 public void setUnits(String unit) 100 { 101 this.units = unit; 102 } 103 104 109 public String getUnits() 110 { 111 return this.units; 112 } 113 114 119 public int getValue() 120 { 121 return this.value; 122 } 123 124 125 130 public String getKey() 131 { 132 return this.key; 133 } 134 135 136 141 public String getReference() 142 { 143 return this.reference; 144 } 145 146 147 152 public void setKey(String key) 153 { 154 this.key = key; 155 } 156 157 158 163 public void setReference(String reference) 164 { 165 this.reference = reference; 166 } 167 168 169 179 public int compareTo(Object o) 180 { 181 int objectValue = ((Stat) o).getValue(); 182 183 if (objectValue < this.getValue()) 184 { 185 return -1; 186 } 187 else if (objectValue == this.getValue()) 188 { 189 return 0; 190 } 191 else if (objectValue > this.getValue()) 192 { 193 return 1; 194 } 195 196 return 0; 197 } 198 199 } 200 | Popular Tags |