当前位置: 首页>>代码示例>>Java>>正文


Java Amount.isGreaterThan方法代码示例

本文整理汇总了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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:PeriodicTemporalConstraintImpl.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:19,代码来源:AmountExtent.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:TemporalNetworkCommandBuilder.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:ConstraintViolationPrinter.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:31,代码来源:ConstraintViolationPrinter.java

示例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);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:TemporalPropagation.java

示例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);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:24,代码来源:TemporalPropagation.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:BinaryTemporalConstraintImpl.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:8,代码来源:AmountExtent.java

示例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);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:14,代码来源:TemporalPropagation.java


注:本文中的org.jscience.physics.amount.Amount.isGreaterThan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。