org.knime.base.node.preproc.discretization.caim2
Class Interval

java.lang.Object
  extended by org.knime.base.node.preproc.discretization.caim2.Interval

public class Interval
extends Object

Represents a double interval.

Author:
Christoph Sieb, University of Konstanz

Constructor Summary
Interval(Config content)
          Creates an interval from its boundaries and whether the boundaries belong to the interval or not.
Interval(double leftBound, double rightBound, boolean includeLeft, boolean includeRight)
          Creates an interval from its boundaries and whether the boundaries belong to the interval or not.
 
Method Summary
 int compareLeftBoundToLeft(Interval intervalToCompare)
          Compares the left bound of this interval to the left bound of the given interval.
 int compareLeftBoundToRight(Interval intervalToCompare)
          Compares the left bound of this interval to the right bound of the given interval.
 int compareRightBoundToLeft(Interval intervalToCompare)
          Compares the right bound of this interval to the left bound of the given interval.
 int compareRightBoundToRight(Interval intervalToCompare)
          Compares the right bound of this interval to the right bound of the given interval.
 boolean contains(double value)
          Checks if the given value is located within this interval or not.
 double getLeftBound()
           
 double getRightBound()
           
 boolean isIncludeLeft()
           
 boolean isIncludeRight()
           
 void saveToModelContent(Config modelContent)
          Saves this interval to a ModelContentWO object.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Interval

public Interval(double leftBound,
                double rightBound,
                boolean includeLeft,
                boolean includeRight)
Creates an interval from its boundaries and whether the boundaries belong to the interval or not.

Parameters:
leftBound - the left bound of the interval
rightBound - the right bound of the interval
includeLeft - whether the left bound is included in the interval
includeRight - whether the right bound is included in the interval

Interval

public Interval(Config content)
         throws InvalidSettingsException
Creates an interval from its boundaries and whether the boundaries belong to the interval or not.

Parameters:
content - the Config object to create this interval from
Throws:
InvalidSettingsException - thrown if the settings to restore are invalid
Method Detail

isIncludeLeft

public boolean isIncludeLeft()
Returns:
wheter the left bound is included in the interval

isIncludeRight

public boolean isIncludeRight()
Returns:
wheter the right bound is included in the interval

getLeftBound

public double getLeftBound()
Returns:
the left bound

getRightBound

public double getRightBound()
Returns:
the right bound

compareLeftBoundToLeft

public int compareLeftBoundToLeft(Interval intervalToCompare)
Compares the left bound of this interval to the left bound of the given interval. If this left bound is smaller, equal or greater a negative, zero or positive integer is returned. Also the include property is respected

Parameters:
intervalToCompare - the interval to compare to this interval
Returns:
a negativ, zero or positive integer if this left bound is smaler equal or bigger than the left one to compare to

compareRightBoundToRight

public int compareRightBoundToRight(Interval intervalToCompare)
Compares the right bound of this interval to the right bound of the given interval. If this right bound is smaller, equal or greater a negative, zero or positive integer is returned. Also the include property is respected

Parameters:
intervalToCompare - the interval to compare to this interval
Returns:
a negativ, zero or positive integer if this right bound is smaler equal or bigger than the right one to compare to

compareRightBoundToLeft

public int compareRightBoundToLeft(Interval intervalToCompare)
Compares the right bound of this interval to the left bound of the given interval. If this right bound is smaller, equal or greater a negative, zero or positive integer is returned. Also the include property is respected

Parameters:
intervalToCompare - the interval to compare to this interval
Returns:
a negativ, zero or positive integer if this right bound is smaler equal or bigger than the left one of the interval to compare to

compareLeftBoundToRight

public int compareLeftBoundToRight(Interval intervalToCompare)
Compares the left bound of this interval to the right bound of the given interval. If this left bound is smaller, equal or greater a negative, zero or positive integer is returned. Also the include property is respected

Parameters:
intervalToCompare - the interval to compare to this interval
Returns:
a negativ, zero or positive integer if this left bound is smaler equal or bigger than the right one of the interval to compare to

toString

public String toString()

Overrides:
toString in class Object

contains

public boolean contains(double value)
Checks if the given value is located within this interval or not.

Parameters:
value - the value to check
Returns:
true if the given value is located within the interval

saveToModelContent

public void saveToModelContent(Config modelContent)
Saves this interval to a ModelContentWO object.

Parameters:
modelContent - the Config object to store the Interval to


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.