1 55 package org.apache.avalon.framework; 56 57 import java.util.Map ; 58 59 117 public abstract class ValuedEnum 118 extends Enum 119 { 120 123 private final int m_value; 124 125 137 protected ValuedEnum( final String name, final int value ) 138 { 139 this( name, value, null ); 140 } 141 142 155 protected ValuedEnum( final String name, final int value, final Map map ) 156 { 157 super( name, map ); 158 m_value = value; 159 } 160 161 166 public final int getValue() 167 { 168 return m_value; 169 } 170 171 177 public final boolean isEqualTo( final ValuedEnum other ) 178 { 179 return m_value == other.m_value; 180 } 181 182 188 public final boolean isGreaterThan( final ValuedEnum other ) 189 { 190 return m_value > other.m_value; 191 } 192 193 199 public final boolean isGreaterThanOrEqual( final ValuedEnum other ) 200 { 201 return m_value >= other.m_value; 202 } 203 204 210 public final boolean isLessThan( final ValuedEnum other ) 211 { 212 return m_value < other.m_value; 213 } 214 215 221 public final boolean isLessThanOrEqual( final ValuedEnum other ) 222 { 223 return m_value <= other.m_value; 224 } 225 226 232 public String toString() 233 { 234 return getClass().getName() + "[" + getName() + "=" + m_value + "]"; 235 } 236 } 237 238 | Popular Tags |