@Test public void testGet() { Model mo = new DefaultModel(); Assert.assertNull(ShareableResource.get(mo, "cpu")); ShareableResource cpu = new ShareableResource("cpu"); ShareableResource mem = new ShareableResource("mem"); mo.attach(cpu); Assert.assertEquals(ShareableResource.get(mo, "cpu"), cpu); Assert.assertNull(ShareableResource.get(mo, "mem")); mo.attach(mem); Assert.assertEquals(ShareableResource.get(mo, "cpu"), cpu); Assert.assertEquals(ShareableResource.get(mo, "mem"), mem); }
public static ShareableResource get(Model mo, String id) { return (ShareableResource) mo.getView(VIEW_ID_BASE + id); }
ShareableResource implements ModelView { public static ShareableResource get(Model mo, String id) { return (ShareableResource) mo.getView(VIEW_ID_BASE + id); } }
ShareableResource implements ModelView { public static ShareableResource get(Model mo, String id) { return (ShareableResource) mo.getView(VIEW_ID_BASE + id); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); }
ShareableResource implements ModelView { public static ShareableResource get(Model mo, String id) { return (ShareableResource) mo.getView(VIEW_ID_BASE + id); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); int getConsumption(VM vm); int getCapacity(Node n); Set<VM> getDefinedVMs(); Set<Node> getDefinedNodes(); ShareableResource setConsumption(VM vm, int val); ShareableResource setConsumption(int val, VM... vms); ShareableResource setCapacity(Node n, int val); ShareableResource setCapacity(int val, Node... nodes); void unset(VM vm); void unset(Node n); void unset(VM... vms); void unset(Node... nodes); boolean consumptionDefined(VM vm); boolean capacityDefined(Node n); @Override String getIdentifier(); static String getIdentifier(String rcId); String getResourceIdentifier(); int getDefaultConsumption(); int getDefaultCapacity(); @Override boolean equals(Object o); @Override int hashCode(); @Override ShareableResource copy(); @Override String toString(); @Override boolean substituteVM(VM oldRef, VM newRef); int sumConsumptions(Collection<VM> ids, boolean undef); int sumCapacities(Collection<Node> ids, boolean undef); static ShareableResource get(Model mo, String id); }
ShareableResource implements ModelView { public static ShareableResource get(Model mo, String id) { return (ShareableResource) mo.getView(VIEW_ID_BASE + id); } ShareableResource(String r);  ShareableResource(String id, int defCapacity, int defConsumption); int getConsumption(VM vm); int getCapacity(Node n); Set<VM> getDefinedVMs(); Set<Node> getDefinedNodes(); ShareableResource setConsumption(VM vm, int val); ShareableResource setConsumption(int val, VM... vms); ShareableResource setCapacity(Node n, int val); ShareableResource setCapacity(int val, Node... nodes); void unset(VM vm); void unset(Node n); void unset(VM... vms); void unset(Node... nodes); boolean consumptionDefined(VM vm); boolean capacityDefined(Node n); @Override String getIdentifier(); static String getIdentifier(String rcId); String getResourceIdentifier(); int getDefaultConsumption(); int getDefaultCapacity(); @Override boolean equals(Object o); @Override int hashCode(); @Override ShareableResource copy(); @Override String toString(); @Override boolean substituteVM(VM oldRef, VM newRef); int sumConsumptions(Collection<VM> ids, boolean undef); int sumCapacities(Collection<Node> ids, boolean undef); static ShareableResource get(Model mo, String id); static final String VIEW_ID_BASE; static final int DEFAULT_NO_VALUE; }