public class GHNDescriptor extends SortableElement<java.lang.Float,java.lang.String>
Constructor and Description |
---|
GHNDescriptor(int allocatedResources,
java.lang.String elem,
GCUBEScope scope,
XMLResult profile)
Creates a new GHNDescriptor that is sortable on the
sortIdx value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares two
GHNDescriptor elems. |
float |
getAccuracy()
Returns the actual score of a GHN.
|
int |
getHits() |
java.lang.String |
getID() |
float |
getLoadLast15M() |
float |
getLoadLast1M() |
float |
getLoadLast5M() |
PlanBuilderIdentifier |
getOwner()
Deprecated.
for internal use only
|
int |
getRICount() |
GCUBEScope |
getScope() |
java.lang.Float |
getScore() |
java.lang.Float |
getSortIndex()
Differently from a generic
SortableElement ,
here the sorting is based on the number of allocated
resources plus the number of reserved ones. |
int |
hashCode() |
boolean |
hasProfile() |
void |
increaseRICount() |
boolean |
isReservableBy(PlanBuilderIdentifier wfID)
Once reserved a GHN is uniquely associated to the plan
that firstly reserved it.
|
boolean |
isReserved()
To check if a
GHNDescriptor is reserved
by someone. |
void |
registerScore(int score)
Registers the new score hit by this GHN.
|
void |
reserve(PlanBuilderIdentifier wfID)
Deprecated.
do not use this
|
void |
revokeAllReservations(PlanBuilderIdentifier wfID)
Forgets all previous reservations.
|
void |
revokeReservation(PlanBuilderIdentifier wfID)
Forgets a previous reservation.
|
boolean |
satisfies(Requirement[] requirements)
Given a list of
Requirement elements checks if all these requirements
are satisfied. |
void |
setProfile(XMLResult profile)
Deprecated.
for internal use only
|
void |
setRICount(int allocatedResources)
Used internally to update the number of RI associated to a GHN.
|
compareTo, getElement, toString
public GHNDescriptor(int allocatedResources, java.lang.String elem, GCUBEScope scope, XMLResult profile)
allocatedResources
- the number of allocated resources.
Used by SortableElement
compare method.elem
- the ghn identifier.public final void reserve(PlanBuilderIdentifier wfID)
public final boolean isReservableBy(PlanBuilderIdentifier wfID)
wfID
- the PlanBuilderIdentifier
requiring the reservation.public final PlanBuilderIdentifier getOwner()
public final boolean isReserved()
GHNDescriptor
is reserved
by someone.public final void revokeReservation(PlanBuilderIdentifier wfID)
public final void revokeAllReservations(PlanBuilderIdentifier wfID)
public final java.lang.String getID()
public final void setRICount(int allocatedResources)
allocatedResources
- the number of allocated RI.public final int getRICount()
public final void increaseRICount()
public final GCUBEScope getScope()
public final java.lang.Float getSortIndex()
SortableElement
,
here the sorting is based on the number of allocated
resources plus the number of reserved ones.
Namely each GHN is sorted on the number of resource instances
"virtually" allocated on them.getSortIndex
in class SortableElement<java.lang.Float,java.lang.String>
public final java.lang.Float getScore()
public final boolean equals(java.lang.Object obj)
GHNDescriptor
elems.
The comparison is made on the unique ID of the GHN
regardless the number of allocated resources of them.
That is because it is assumed a single GHN descriptor
present in the system at each time (or in the global queue
of registered GHN retrieved from the IS or in the
private queue of GHN reserved by a workflow).
The compared GHNDescriptor
elements must be in the same scope.equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final void registerScore(int score)
score
- the percentage score reached (0..100).public final float getAccuracy()
public final int getHits()
public final void setProfile(XMLResult profile)
profile
- public final boolean hasProfile()
public final boolean satisfies(Requirement[] requirements) throws GCUBEFault
Requirement
elements checks if all these requirements
are satisfied.requirements
- an array of Requirement
elements.GCUBEFault
- if no profile is associated.public final float getLoadLast1M()
public final float getLoadLast5M()
public final float getLoadLast15M()