當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。