📄 interval.java
字号:
package datamining;
import java.util.*;
/**
* Class for implementing an interval for non-derivable itemset.
*
* @author Michael Holler
*/
public class Interval {
private int lower;
private int upper;
/**
* Constructor for creating a Interval object.
*/
public Interval() {
this.lower = 0;
this.upper = 0;
}
/**
* Constructor for creating a Interval object.
* Sets the lower and upper bounds as parameter.
*
* @param lower the lower bound of the interval
* @param upper the upper bound of the interval
*/
public Interval(int lower, int upper) {
this.lower = lower;
this.upper = upper;
}
/**
* Increases the lower bound if the parameter is great than
* the current lower bound.
*
* @param low the wannabe lower bound
* @return true, if the parameter is greater than the
* current lower bound, else false
*/
public boolean setLower(int low) {
if (this.lower < low) {
this.lower = low;
return true;
} else {
return false;
}
}
/**
* Gets the lower bound of the interval.
*
* @return the lower bound
*/
public int lowerBound() {
return this.lower;
}
/**
* Decreases the upper bound if the parameter is great than
* the current lower bound.
*
* @param high the wannabe upper bound
* @return true, if the parameter is greater than the
* current lower bound, else false
*/
public boolean setUpper(int high) {
if (high < this.upper) {
this.upper = high;
return true;
} else {
return false;
}
}
/**
* Gets the upper bound of the interval.
*
* @return the upper bound
*/
public int upperBound() {
return this.upper;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -