• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java EnergyModel类的典型用法和代码示例

java 8次浏览

本文整理汇总了Java中routing.util.EnergyModel的典型用法代码示例。如果您正苦于以下问题:Java EnergyModel类的具体用法?Java EnergyModel怎么用?Java EnergyModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

EnergyModel类属于routing.util包,在下文中一共展示了EnergyModel类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ActiveRouter

点赞 2

import routing.util.EnergyModel; //导入依赖的package包/类
/**
 * Constructor. Creates a new message router based on the settings in
 * the given Settings object.
 * @param s The settings object
 */
public ActiveRouter(Settings s) {
	super(s);

	this.policy = new MessageTransferAcceptPolicy(s);

	this.deleteDelivered = s.getBoolean(DELETE_DELIVERED_S, false);

	if (s.contains(EnergyModel.INIT_ENERGY_S)) {
		this.energy = new EnergyModel(s);
	} else {
		this.energy = null; /* no energy model */
	}
}
 

开发者ID:raveious,
项目名称:delay-tolerant-network,
代码行数:19,
代码来源:ActiveRouter.java

示例2: isActive

点赞 2

import routing.util.EnergyModel; //导入依赖的package包/类
/**
 * Returns true if the interface is on at the moment (false if not)
 * @return true if the interface is on at the moment (false if not)
 */
public boolean isActive() {
	boolean active;

	if (ah == null) {
		return true; /* no handler: always active */
	}

	active = ah.isActive(this.activenessJitterValue);

	if (active && host.getComBus().getDouble(EnergyModel.ENERGY_VALUE_ID,
				1) <= 0) {
		/* TODO: better way to check battery level */
		/* no battery -> inactive */
		active = false;
	}

	if (active == false && this.transmitRange > 0) {
		/* not active -> make range 0 */
		this.oldTransmitRange = this.transmitRange;
		host.getComBus().updateProperty(RANGE_ID, 0.0);
	} else if (active == true && this.transmitRange == 0.0) {
		/* active, but range == 0 -> restore range  */
		host.getComBus().updateProperty(RANGE_ID,
				this.oldTransmitRange);
	}
	return active;
}
 

开发者ID:raveious,
项目名称:delay-tolerant-network,
代码行数:32,
代码来源:NetworkInterface.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)