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


Java HiddenHopEnergyDemand类代码示例

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


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

示例1: isSolelyForwardingHop

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
public static boolean isSolelyForwardingHop(SubstrateNode sn) {
	boolean isUsed = false;
	
	for (AbstractResource r : sn.get()) {
		if (r instanceof PowerResource) {
			for (vnreal.mapping.Mapping m : r.getMappings()) {
				if (!(m.getDemand() instanceof HiddenHopEnergyDemand)) {
					return false;
				}
			}
			if (((PowerResource) r).isUsed()) {
				isUsed = true;
			}
		} else {
			if (!r.getMappings().isEmpty()) {
				return false;
			}
		}
	}

	return isUsed;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:23,代码来源:Utils.java

示例2: getStressLevel

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
public static int getStressLevel(NetworkEntity<? extends AbstractResource> e) {
	List<NetworkEntity<?>> vEntities = new LinkedList<NetworkEntity<?>>();
	
	for (AbstractResource r : e.get()) {
		for (vnreal.mapping.Mapping m : r.getMappings()) {
			AbstractDemand d = m.getDemand();

			if (!(d instanceof HiddenHopEnergyDemand)) {

				NetworkEntity<?> owner = d.getOwner();

				if (!vEntities.contains(owner)) {
					vEntities.add(owner);
				}

			}
		}
	}
	
	return vEntities.size();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:22,代码来源:Utils.java

示例3: isSolelyForwardingHop

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
public static boolean isSolelyForwardingHop(SubstrateNode sn) {
    boolean isUsed = false;

    for (AbstractResource r : sn.get()) {
        if (r instanceof EnergyResource) {
            for (vnreal.mapping.Mapping m : r.getMappings()) {
                if (!(m.getDemand() instanceof HiddenHopEnergyDemand)) {
                    return false;
                }
            }
            if (((EnergyResource) r).isUsed()) {
                isUsed = true;
            }
        } else {
            if (!r.getMappings().isEmpty()) {
                return false;
            }
        }
    }

    return isUsed;
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:23,代码来源:Utils.java

示例4: getStressLevel

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
public static int getStressLevel(NetworkEntity<? extends AbstractResource> e) {
    List<NetworkEntity<?>> vEntities = new LinkedList<NetworkEntity<?>>();

    for (AbstractResource r : e.get()) {
        for (vnreal.mapping.Mapping m : r.getMappings()) {
            AbstractDemand d = m.getDemand();

            if (!(d instanceof HiddenHopEnergyDemand)) {

                NetworkEntity<?> owner = d.getOwner();

                if (!vEntities.contains(owner)) {
                    vEntities.add(owner);
                }

            }
        }
    }

    return vEntities.size();
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:22,代码来源:Utils.java

示例5: occupyHiddenHop

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
private static Collection<ResourceDemandEntry> occupyHiddenHop(
		SubstrateNode s, List<AbstractDemand> hiddenHopCPUDemands) {
	
	LinkedList<ResourceDemandEntry> result =
		new LinkedList<ResourceDemandEntry>();
	
	PowerResource er = Utils.getEnergyResource(s);
	if (er != null) {
		HiddenHopEnergyDemand demand = new HiddenHopEnergyDemand(s);
		demand.occupy(er);
		
		result.add(new ResourceDemandEntry(er, demand));
	}
	
	if (hiddenHopCPUDemands != null)
		for (AbstractDemand hd : hiddenHopCPUDemands) {
			for (AbstractResource r : s.get()) {
				if (r.accepts(hd) && r.fulfills(hd) && hd.occupy(r)) {
					result.add(new ResourceDemandEntry(r, hd));
					continue;
				}
			}

			throw new AssertionError();
		}
	
	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:29,代码来源:Utils.java

示例6: occupyHiddenHop

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
private static Collection<ResourceDemandEntry<AbstractResource, AbstractDemand>> occupyHiddenHop(
        SubstrateNode s, List<AbstractDemand> hiddenHopCPUDemands, boolean useEnergyResource) {

    LinkedList<ResourceDemandEntry<AbstractResource, AbstractDemand>> result =
            new LinkedList<ResourceDemandEntry<AbstractResource, AbstractDemand>>();

    if (useEnergyResource) {
        EnergyResource er = Utils.getEnergyResource(s);
        HiddenHopEnergyDemand demand = new HiddenHopEnergyDemand(s);
        demand.occupy(er);

        result.add(new ResourceDemandEntry<AbstractResource, AbstractDemand>(er, demand));
    }

    for (AbstractDemand hd : hiddenHopCPUDemands) {
        for (AbstractResource r : s.get()) {
            if (r.accepts(hd) && r.fulfills(hd) && hd.occupy(r)) {
                result.add(new ResourceDemandEntry<AbstractResource, AbstractDemand>(r, hd));
                continue;
            }
        }

        throw new AssertionError();
    }

    return result;
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:28,代码来源:Utils.java

示例7: occupyHiddenHop

import vnreal.hiddenhopmapping.HiddenHopEnergyDemand; //导入依赖的package包/类
private static Collection<ResourceDemandEntry<AbstractResource, AbstractDemand>> occupyHiddenHop(
		SubstrateNode s, List<AbstractDemand> hiddenHopCPUDemands, boolean useEnergyResource) {
	
	LinkedList<ResourceDemandEntry<AbstractResource, AbstractDemand>> result =
		new LinkedList<ResourceDemandEntry<AbstractResource, AbstractDemand>>();
	
	if (useEnergyResource) {
		PowerResource er = Utils.getEnergyResource(s);
		HiddenHopEnergyDemand demand = new HiddenHopEnergyDemand(s);
		demand.occupy(er);
		
		result.add(new ResourceDemandEntry<AbstractResource, AbstractDemand>(er, demand));
	}
	
	for (AbstractDemand hd : hiddenHopCPUDemands) {
		for (AbstractResource r : s.get()) {
			if (r.accepts(hd) && r.fulfills(hd) && hd.occupy(r)) {
				result.add(new ResourceDemandEntry<AbstractResource, AbstractDemand>(r, hd));
				continue;
			}
		}
		
		throw new AssertionError();
	}
	
	return result;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:28,代码来源:Utils.java


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