本文整理汇总了Java中org.monte.media.math.Rational.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java Rational.compareTo方法的具体用法?Java Rational.compareTo怎么用?Java Rational.compareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.monte.media.math.Rational
的用法示例。
在下文中一共展示了Rational.compareTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDuration
import org.monte.media.math.Rational; //导入方法依赖的package包/类
@Override
public Rational getDuration() {
try {
ensureRealized();
} catch (IOException ex) {
ex.printStackTrace();
return new Rational(0, 1);
}
if (movieDuration == null) {
Rational maxDuration = new Rational(0, 1);
for (Track tr : tracks) {
Rational trackDuration = new Rational((tr.length * tr.scale + tr.startTime), tr.rate);
if (maxDuration.compareTo(trackDuration) < 0) {
maxDuration = trackDuration;
}
}
movieDuration = maxDuration;
}
return movieDuration;
}
示例2: reduceListRational
import org.monte.media.math.Rational; //导入方法依赖的package包/类
private static void reduceListRational(Rational value, InfGetter<Rational> g, ArrayList<AmigaDisplayInfo> infs) {
ArrayList<AmigaDisplayInfo> bestInfs = new ArrayList<AmigaDisplayInfo>();
bestInfs.add(infs.get(0));
float bestCost = g.get(infs.get(0)).subtract(value).floatValue();
bestCost *= bestCost;
for (Iterator<AmigaDisplayInfo> i = infs.iterator(); i.hasNext();) {
AmigaDisplayInfo inf = i.next();
Rational iv = g.get(inf);
if (iv.compareTo(value) != 0) {
i.remove();
}
float icost = iv.subtract(value).floatValue();
icost *= icost;
if (icost < bestCost) {
bestInfs.clear();
bestCost = icost;
} else if (icost == bestCost) {
bestInfs.add(inf);
}
}
if (infs.isEmpty()) {
infs.addAll(bestInfs);
}
}