本文整理汇总了Java中org.jscience.physics.amount.Amount.isGreaterThan方法的典型用法代码示例。如果您正苦于以下问题:Java Amount.isGreaterThan方法的具体用法?Java Amount.isGreaterThan怎么用?Java Amount.isGreaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jscience.physics.amount.Amount
的用法示例。
在下文中一共展示了Amount.isGreaterThan方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isViolated
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
public boolean isViolated() {
ConstraintPoint point = getPoint();
Date date = point.getDate();
if (date == null) {
return false;
}
Amount<Duration> offset = ConstraintUtils.getPeriodicConstraintOffset(date);
Amount<Duration> earliest = getEarliest();
Amount<Duration> latest = getLatest();
if ((earliest != null) && offset.isLessThan(earliest)) {
if (!closeEnough(offset, earliest)) {
return true;
}
}
if ((latest != null) && offset.isGreaterThan(latest)) {
if (!closeEnough(offset, latest)) {
return true;
}
}
return false;
}
示例2: union
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
public AmountExtent<T> union(AmountExtent<T> extent) {
if (extent == null) {
return this;
}
Amount<T> min = getMin();
Amount<T> max = getMax();
if (max == null || (extent.getMax() != null
&& max.getUnit().isCompatible(extent.getMax().getUnit())
&& max.isLessThan(extent.getMax()))) {
max = extent.getMax();
}
if (min == null || (extent.getMin() != null
&& min.getUnit().isCompatible(extent.getMin().getUnit())
&& min.isGreaterThan(extent.getMin()))) {
min = extent.getMin();
}
return new AmountExtent<T>(min, max);
}
示例3: addNetworkDurationConstraint
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
private TemporalNetwork<Time>.TemporalConstraint addNetworkDurationConstraint(Amount<Duration> duration, TemporalNetwork<Time>.Timepoint start, TemporalNetwork<Time>.Timepoint end) {
TemporalNetwork<Time>.TemporalConstraint durationConstraint = null;
if (duration != null) {
if (!duration.isGreaterThan(Amount.valueOf(0, SI.SECOND))) {
duration = Amount.valueOf(1, SI.MILLI(SI.SECOND));
}
Time timeDuration = model.convertTimeDistanceToNetwork(duration);
durationConstraint = network.addTemporalConstraint(start, end, timeDuration, timeDuration);
} else {
durationConstraint = network.addTemporalConstraint(start, end, network.getTime(0L), network.getTime(DistanceGraph.POS_INFINITY)); // allow any nonnegative duration for activities with no
// extent
}
return durationConstraint;
}
示例4: getDistanceViolationText
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
String getDistanceViolationText(ConstraintPoint pointA, ConstraintPoint pointB, Amount<Duration> minDelta, Amount<Duration> maxDelta) {
Amount<Duration> delta = computeDelta(pointA, pointB);
String result = "";
if (minDelta != null && minDelta.approximates(ZERO) && maxDelta != null && maxDelta.approximates(ZERO) && delta.compareTo(ZERO) != 0) {
result = "The " + getHypertext(pointA);
result += " and the " + getHypertext(pointB);
result += " are different.";
} else if (maxDelta != null && maxDelta.approximates(ZERO)) {
// A's timepoint must occur before B's timepoint
result = "The " + getHypertext(pointA);
result += " is after the " + getHypertext(pointB);
result += ".";
} else if (minDelta != null && delta.isLessThan(minDelta.abs())) {
result = "The " + getHypertext(pointA);
result += " and the " + getHypertext(pointB);
result += " are ";
result += DurationFormat.getEnglishDuration(minDelta.abs().minus(delta).longValue(SI.SECOND));
result += " too close together.";
} else if (maxDelta != null && delta.isGreaterThan(maxDelta.abs())) {
result = "The " + getHypertext(pointA);
result += " and the " + getHypertext(pointB);
result += " are ";
result += DurationFormat.getEnglishDuration(delta.minus(maxDelta.abs()).longValue(SI.SECOND));
result += " too far apart.";
}
return result;
}
示例5: getDistanceRequirementText
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
protected String getDistanceRequirementText(ConstraintPoint pointA, ConstraintPoint pointB, Amount<Duration> minDelta, Amount<Duration> maxDelta, boolean usePronoun) {
String result = "";
if (minDelta != null && minDelta.approximates(ZERO) && maxDelta != null && maxDelta.approximates(ZERO)) {
result = getTwoNodeText(pointA, pointB, usePronoun, result);
result += " should be the same.";
} else if (minDelta != null && minDelta.approximates(ZERO)) {
result += "The " + getHypertext(pointB);
result += " should be no earlier than ";
result += "the " + getHypertext(pointA);
result += ".";
} else if (maxDelta != null && maxDelta.approximates(ZERO)) {
result += "The " + getHypertext(pointB);
result += " should be no later than ";
result += "the " + getHypertext(pointA);
result += ".";
} else {
Amount<Duration> delta = computeDelta(pointA, pointB);
result = getTwoNodeText(pointA, pointB, usePronoun, result);
result += " should be separated by";
if (minDelta != null && (maxDelta==null || minDelta.approximates(maxDelta))) {
result += " exactly " + DurationFormat.getEnglishDuration(minDelta.longValue(SI.SECOND));
} else if (minDelta != null && delta.isLessThan(minDelta)) {
result += " at least " + DurationFormat.getEnglishDuration(minDelta.longValue(SI.SECOND));
} else if (maxDelta != null && delta.isGreaterThan(maxDelta)) {
result += " at most " + DurationFormat.getEnglishDuration(maxDelta.longValue(SI.SECOND));
}
result += ".";
}
return result;
}
示例6: maybeUpdateParentDuration
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
/**
* If the parent uses child times, then update it in response to the supplied duration change, if necessary.
* This is only allowed if there is no start or end time on the parent.
*
* @param member
* @param oldDuration
* @param newDuration
* @param notifications
*/
public static void maybeUpdateParentDuration(TemporalMemberImpl member, Amount<Duration> oldDuration, Amount<Duration> newDuration, NotificationChain notifications) {
TemporalMemberImpl parent = getContainingParentTemporalMember(member);
if (parent != null) {
if (newDuration.isGreaterThan(oldDuration)) {
growDuration(parent, newDuration, notifications);
}
if (newDuration.isLessThan(oldDuration)) {
shrinkDuration(parent, oldDuration, newDuration, notifications);
}
}
}
示例7: shrinkDuration
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
/**
* This is called when a child has gotten shorter in duration. So, if the old duration was
* the sole cause for the length of the parent, the parent will be shortened and notifications
* will be posted.
*
* @param parent
* @param oldDuration
* @param newDuration
* @param notifications
*/
private static void shrinkDuration(TemporalMemberImpl parent, Amount<Duration> oldDuration, Amount<Duration> newDuration, NotificationChain notifications) {
Amount<Duration> duration = parent.getDuration();
if (!oldDuration.isLessThan(duration)) {
for (EPlanChild child : parent.getPlanElement().getChildren()) {
TemporalMember member = child.getMember(TemporalMember.class, true);
Amount<Duration> childDuration = member.getDuration();
if (childDuration.isGreaterThan(newDuration)) {
newDuration = childDuration;
}
}
parent.setDuration(newDuration, notifications);
}
}
示例8: isViolated
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
@Override
public boolean isViolated() {
ConstraintPoint pointA = getPointA();
Date dateA = pointA.getDate();
if (dateA == null) {
return false;
}
ConstraintPoint pointB = getPointB();
Date dateB = pointB.getDate();
if (dateB == null) {
return false;
}
Amount<Duration> delta = DateUtils.subtract(dateB, dateA);
Amount<Duration> minimum = getMinimumBminusA();
Amount<Duration> maximum = getMaximumBminusA();
if ((minimum != null) && delta.isLessThan(minimum)) {
if (!closeEnough(delta, minimum)) {
return true;
}
}
if ((maximum != null) && delta.isGreaterThan(maximum)) {
if (!closeEnough(delta, maximum)) {
return true;
}
}
return false;
}
示例9: intersection
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
public AmountExtent<T> intersection(AmountExtent<T> extent) {
Amount<T> min = getMin();
Amount<T> max = getMax();
if (max == null || (extent.getMax() != null && max.isGreaterThan(extent.getMax()))) max = extent.getMax();
if (min == null || (extent.getMin() != null && min.isLessThan(extent.getMin()))) min = extent.getMin();
return new AmountExtent<T>(min, max);
}
示例10: growDuration
import org.jscience.physics.amount.Amount; //导入方法依赖的package包/类
/**
* This is called when a child has gotten longer in duration. So, if the new duration is longer
* than the existing parent, the parent will be enlarged and notifications will be posted.
*
* @param parent
* @param newDuration
* @param notifications
*/
private static void growDuration(TemporalMemberImpl parent, Amount<Duration> newDuration, NotificationChain notifications) {
if (newDuration.isGreaterThan(parent.getDuration())) {
parent.setDuration(newDuration, notifications);
}
}