public class EndpointAffinity extends Object
Constructor and Description |
---|
EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint)
Create EndpointAffinity instance for given Drillbit endpoint.
|
EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint,
double affinity)
Create EndpointAffinity instance for given Drillbit endpoint and affinity initialized to given affinity value.
|
EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint,
double affinity,
boolean mandatory,
int maxWidth)
Creates EndpointAffinity instance for given DrillbitEndpoint, affinity and mandatory assignment requirement flag.
|
Modifier and Type | Method and Description |
---|---|
void |
addAffinity(double f)
Add given affinity value to existing affinity value.
|
boolean |
equals(Object obj) |
double |
getAffinity()
Get the affinity value.
|
CoordinationProtos.DrillbitEndpoint |
getEndpoint()
Return the Drillbit endpoint in this instance.
|
int |
getMaxWidth() |
int |
hashCode() |
boolean |
isAssignmentRequired()
Is this endpoint required to be in fragment endpoint assignment list?
|
void |
setAssignmentRequired()
Set the endpoint requires at least one assignment.
|
void |
setMaxWidth(int maxWidth)
Set the new max width as the minimum of the the given value and current max width.
|
String |
toString() |
public EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint)
addAffinity(double)
.endpoint
- Drillbit endpoint.public EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint, double affinity)
addAffinity(double)
.endpoint
- Drillbit endpoint.affinity
- Initial affinity value.public EndpointAffinity(CoordinationProtos.DrillbitEndpoint endpoint, double affinity, boolean mandatory, int maxWidth)
endpoint
- Drillbit endpointaffinity
- Initial affinity valuemandatory
- Is this endpoint requires at least one mandatory assignment?maxWidth
- Maximum allowed assignments for this endpoint.public CoordinationProtos.DrillbitEndpoint getEndpoint()
public double getAffinity()
public void addAffinity(double f)
f
- Affinity value (must be a non-negative value).IllegalArgumentException
- If the given affinity value is negative.public void setAssignmentRequired()
public boolean isAssignmentRequired()
public int getMaxWidth()
public void setMaxWidth(int maxWidth)
maxWidth
- Copyright © 1970 The Apache Software Foundation. All rights reserved.