com.mucommander.runtime
Class ComparableRuntimeProperty

java.lang.Object
  extended by com.mucommander.runtime.RuntimeProperty
      extended by com.mucommander.runtime.ComparableRuntimeProperty
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
JavaVersion, OsVersion

public abstract class ComparableRuntimeProperty
extends RuntimeProperty
implements java.lang.Comparable

ComparableRuntimeProperty is a runtime property for which the values have a natural order. This class provides methods to compare instances, using an int value specified at creation time as the discriminator.

The subclass must ensure that no two instances have the same discriminator value. Based on this assumption, if compareTo(Object) returns 0, then instances are equal according to the shallow equals operator '=='.

Author:
Maxence Bernard

Field Summary
protected  int discriminator
          The descriminator set at creation time
 
Fields inherited from class com.mucommander.runtime.RuntimeProperty
stringRepresentation
 
Constructor Summary
protected ComparableRuntimeProperty(java.lang.String stringRepresentation, int discriminator)
          Creates a new RuntimeProperty using the specified String representation and order discriminator.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean isCurrentHigher()
          Returns true if the current runtime's value of this property is higher than this instance, according to compareTo(Object).
 boolean isCurrentLower()
          Returns true if the current runtime's value of this property is lower than this instance, according to compareTo(Object).
 boolean isCurrentOrHigher()
          Returns true if the current runtime's value of this property is equal or higher to this instance, according to compareTo(Object).
 boolean isCurrentOrLower()
          Returns true if the current runtime's value of this property is equal or lower to this instance, according to compareTo(Object).
 
Methods inherited from class com.mucommander.runtime.RuntimeProperty
getCurrentValue, isCurrent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

discriminator

protected final int discriminator
The descriminator set at creation time

Constructor Detail

ComparableRuntimeProperty

protected ComparableRuntimeProperty(java.lang.String stringRepresentation,
                                    int discriminator)
Creates a new RuntimeProperty using the specified String representation and order discriminator.

Parameters:
stringRepresentation - a String representation of this property
discriminator - the descriminator that serves to compare an instance with another against
Method Detail

isCurrentOrLower

public boolean isCurrentOrLower()
Returns true if the current runtime's value of this property is equal or lower to this instance, according to compareTo(Object).

Returns:
true if the current runtime's value of this property is equal or lower to this instance

isCurrentLower

public boolean isCurrentLower()
Returns true if the current runtime's value of this property is lower than this instance, according to compareTo(Object).

Returns:
true if the current runtime's value of this property is lower than this instance

isCurrentOrHigher

public boolean isCurrentOrHigher()
Returns true if the current runtime's value of this property is equal or higher to this instance, according to compareTo(Object).

Returns:
true if the current runtime's value of this property is equal or higher to this instance

isCurrentHigher

public boolean isCurrentHigher()
Returns true if the current runtime's value of this property is higher than this instance, according to compareTo(Object).

Returns:
true if the current runtime's value of this property is higher than this instance

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard