public class SubMapping extends Object implements Mapping
Modifications made on the mapping are automatically reported on the parent mapping. However, it is not allowed to remove a node or a VM.
Constructor and Description |
---|
SubMapping(Mapping p,
Collection<Node> sc)
Make a new mapping.
|
SubMapping(Mapping p,
Collection<Node> sc,
Set<VM> subReady)
Make a new mapping.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addOfflineNode(Node n)
Set a node offline.
|
boolean |
addOnlineNode(Node n)
Set a node online.
|
boolean |
addReadyVM(VM vm)
Set a VM ready for being running.
|
boolean |
addRunningVM(VM vm,
Node n)
Set a VM running on a node.
|
boolean |
addSleepingVM(VM vm,
Node n)
Set a VM sleeping on a node.
|
void |
clear()
Remove all the nodes and the VMs in the mapping.
|
void |
clearAllVMs()
Remove all the VMs in the mapping
|
void |
clearNode(Node u)
Remove all the VMs remove on a given node
|
DefaultMapping |
clone()
Clone this mapping using a
DefaultMapping . |
boolean |
contains(Node n)
Check if a node is in the mapping.
|
boolean |
contains(VM vm)
Check if a VM is in the mapping.
|
boolean |
equals(Object o) |
void |
fillVMIndex(gnu.trove.map.hash.TIntIntHashMap index,
int p)
Fill an index with the VM presents in this mapping
|
Set<Node> |
getAllNodes()
Get all the nodes involved in the mapping.
|
Set<VM> |
getAllVMs()
Get all the VMs involved in the mapping.
|
int |
getNbNodes()
Get the number of nodes in the mapping
|
int |
getNbVMs()
Get the number of VMs in the mapping.
|
Set<Node> |
getOfflineNodes()
Get the offline nodes..
|
Set<Node> |
getOnlineNodes()
Get the online nodes.
|
Mapping |
getParent()
Get the parent mapping.
|
Set<VM> |
getReadyVMs()
Get the VMs that are ready.
|
Set<VM> |
getRunningVMs()
Get the VMs that are running.
|
Set<VM> |
getRunningVMs(Collection<Node> ns)
Get all the VMs running on a collection of nodes.
|
Set<VM> |
getRunningVMs(Node n)
Get the VMs that are running on a node.
|
Set<VM> |
getSleepingVMs()
Get the VMs that are sleeping.
|
Set<VM> |
getSleepingVMs(Collection<Node> ns)
Get all the VMs sleeping on a collection of nodes.
|
Set<VM> |
getSleepingVMs(Node n)
Get the VMs that are sleeping on a node.
|
NodeState |
getState(Node n)
Get the state of a node
|
VMState |
getState(VM v)
Get the state of a VM
|
Node |
getVMLocation(VM vm)
Get the location of a running or a sleeping VM.
|
int |
hashCode() |
boolean |
isOffline(Node n)
Check if a node is in the offline state.
|
boolean |
isOnline(Node n)
Check if a node is in the online state.
|
boolean |
isReady(VM v)
Check if a VM is in the ready state.
|
boolean |
isRunning(VM v)
Check if a VM is in the running state.
|
boolean |
isSleeping(VM v)
Check if a VM is in the sleeping state.
|
boolean |
remove(Node n)
Remove a node.
|
boolean |
remove(VM vm)
Remove a VM.
|
String |
toString() |
public SubMapping(Mapping p, Collection<Node> sc, Set<VM> subReady)
p
- the parent mappingsc
- the nodes that limit the scope of the new mapping. These nodes must all belong to the original mappingsubReady
- the subset of ready VMs to include in this mapping. These VMs must all belong to the original mappingpublic SubMapping(Mapping p, Collection<Node> sc)
p
- the parent mappingsc
- the nodes that limit the scope of the new mapping. These nodes must all belong to the original mappingpublic boolean addRunningVM(VM vm, Node n)
Mapping
addRunningVM
in interface Mapping
vm
- the VMn
- the node that will host the VM. The node must already be considered as online.true
iff the VM is assigned on the node.public boolean addSleepingVM(VM vm, Node n)
Mapping
addSleepingVM
in interface Mapping
vm
- the VMn
- the node that will host the VM. The node must already be considered as online.false
iff the hosting node is offline or unknownpublic boolean addReadyVM(VM vm)
Mapping
addReadyVM
in interface Mapping
vm
- the VMtrue
iff the VM is now in the ready statepublic boolean remove(Node n)
Mapping
public Set<Node> getOnlineNodes()
Mapping
getOnlineNodes
in interface Mapping
public boolean addOnlineNode(Node n)
Mapping
addOnlineNode
in interface Mapping
n
- the node.true
iff the node is now in the online statepublic boolean addOfflineNode(Node n)
Mapping
addOfflineNode
in interface Mapping
n
- the nodetrue
if the node is offline. false
otherwisepublic Set<Node> getOfflineNodes()
Mapping
getOfflineNodes
in interface Mapping
public Set<VM> getRunningVMs()
Mapping
getRunningVMs
in interface Mapping
public Set<VM> getSleepingVMs()
Mapping
getSleepingVMs
in interface Mapping
public Set<VM> getSleepingVMs(Node n)
Mapping
getSleepingVMs
in interface Mapping
n
- the node.public Set<VM> getRunningVMs(Node n)
Mapping
getRunningVMs
in interface Mapping
n
- the node.public Set<VM> getReadyVMs()
Mapping
getReadyVMs
in interface Mapping
public Set<VM> getAllVMs()
Mapping
public Set<Node> getAllNodes()
Mapping
getAllNodes
in interface Mapping
public Node getVMLocation(VM vm)
Mapping
getVMLocation
in interface Mapping
vm
- the VM.null
is the VM
is not in the sleeping state nor the running statepublic Set<VM> getRunningVMs(Collection<Node> ns)
Mapping
getRunningVMs
in interface Mapping
ns
- a set of nodespublic DefaultMapping clone()
DefaultMapping
.public boolean contains(VM vm)
Mapping
public boolean contains(Node n)
Mapping
public void clear()
Mapping
public void clearNode(Node u)
Mapping
public void clearAllVMs()
Mapping
clearAllVMs
in interface Mapping
public void fillVMIndex(gnu.trove.map.hash.TIntIntHashMap index, int p)
index
- the index to fillp
- the index value to use for each VM in the mappingpublic boolean isRunning(VM v)
Mapping
public boolean isSleeping(VM v)
Mapping
isSleeping
in interface Mapping
v
- the VM to checktrue
iff the VM is sleeping on a nodepublic boolean isReady(VM v)
Mapping
public boolean isOnline(Node n)
Mapping
public boolean isOffline(Node n)
Mapping
public Set<VM> getSleepingVMs(Collection<Node> ns)
Mapping
getSleepingVMs
in interface Mapping
ns
- a set of nodespublic Mapping getParent()
public int getNbNodes()
Mapping
getNbNodes
in interface Mapping
public int getNbVMs()
Mapping
public VMState getState(VM v)
Mapping
Copyright © 2015 University of Nice-Sophia Antipolis. All Rights Reserved.