public class ConstraintAnchor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstraintAnchor.Type
Define the type of anchor
|
| Modifier and Type | Field and Description |
|---|---|
int |
mMargin |
ConstraintWidget |
mOwner |
ConstraintAnchor |
mTarget |
ConstraintAnchor.Type |
mType |
| Constructor and Description |
|---|
ConstraintAnchor(ConstraintWidget owner,
ConstraintAnchor.Type type)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
connect(ConstraintAnchor toAnchor,
int margin)
Connects this anchor to another one.
|
boolean |
connect(ConstraintAnchor toAnchor,
int margin,
int goneMargin,
boolean forceConnection)
Connects this anchor to another one.
|
void |
copyFrom(ConstraintAnchor source,
java.util.HashMap<ConstraintWidget,ConstraintWidget> map) |
void |
findDependents(int orientation,
java.util.ArrayList<WidgetGroup> list,
WidgetGroup group) |
java.util.HashSet<ConstraintAnchor> |
getDependents() |
int |
getFinalValue() |
int |
getMargin()
Return the connection's margin from this anchor to its target.
|
ConstraintAnchor |
getOpposite()
Returns the opposite anchor to this one
|
ConstraintWidget |
getOwner()
Return the anchor's owner
|
SolverVariable |
getSolverVariable()
Return the solver variable for this anchor
|
ConstraintAnchor |
getTarget()
Return the connection's target (null if not connected)
|
ConstraintAnchor.Type |
getType()
Return the type of the anchor
|
boolean |
hasCenteredDependents() |
boolean |
hasDependents() |
boolean |
hasFinalValue() |
boolean |
isConnected()
Returns the connection status of this anchor
|
boolean |
isConnectionAllowed(ConstraintWidget target)
Return true if we can connect this anchor to this target.
|
boolean |
isConnectionAllowed(ConstraintWidget target,
ConstraintAnchor anchor)
Return true if we can connect this anchor to this target.
|
boolean |
isSideAnchor()
Return true if this anchor is a side anchor
|
boolean |
isSimilarDimensionConnection(ConstraintAnchor anchor)
Return true if the connection to the given anchor is in the
same dimension (horizontal or vertical)
|
boolean |
isValidConnection(ConstraintAnchor anchor)
Checks if the connection to a given anchor is valid.
|
boolean |
isVerticalAnchor()
Utility function returning true if this anchor is a vertical one.
|
void |
reset()
Resets the anchor's connection.
|
void |
resetFinalResolution() |
void |
resetSolverVariable(Cache cache)
Reset the solver variable
|
void |
setFinalValue(int finalValue) |
void |
setGoneMargin(int margin)
Set the gone margin of the connection (if there's one)
|
void |
setMargin(int margin)
Set the margin of the connection (if there's one)
|
java.lang.String |
toString()
Return a string representation of this anchor
|
public final ConstraintWidget mOwner
public final ConstraintAnchor.Type mType
public ConstraintAnchor mTarget
public int mMargin
public ConstraintAnchor(ConstraintWidget owner, ConstraintAnchor.Type type)
owner - the widget owner of this anchor.type - the anchor type.public void findDependents(int orientation,
java.util.ArrayList<WidgetGroup> list,
WidgetGroup group)
public java.util.HashSet<ConstraintAnchor> getDependents()
public boolean hasDependents()
public boolean hasCenteredDependents()
public void setFinalValue(int finalValue)
public int getFinalValue()
public void resetFinalResolution()
public boolean hasFinalValue()
public void copyFrom(ConstraintAnchor source, java.util.HashMap<ConstraintWidget,ConstraintWidget> map)
public SolverVariable getSolverVariable()
public void resetSolverVariable(Cache cache)
public ConstraintWidget getOwner()
public ConstraintAnchor.Type getType()
public int getMargin()
public ConstraintAnchor getTarget()
public void reset()
public boolean connect(ConstraintAnchor toAnchor, int margin, int goneMargin, boolean forceConnection)
toAnchor - margin - goneMargin - forceConnection - public boolean connect(ConstraintAnchor toAnchor, int margin)
toAnchor - margin - public boolean isConnected()
public boolean isValidConnection(ConstraintAnchor anchor)
anchor - the anchor we want to connect topublic boolean isSideAnchor()
public boolean isSimilarDimensionConnection(ConstraintAnchor anchor)
anchor - the anchor we want to connect topublic void setMargin(int margin)
margin - the new margin of the connectionpublic void setGoneMargin(int margin)
margin - the new margin of the connectionpublic boolean isVerticalAnchor()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isConnectionAllowed(ConstraintWidget target, ConstraintAnchor anchor)
target - the ConstraintWidget we are trying to connect toanchor - Allow anchor if it loops back to me directlypublic boolean isConnectionAllowed(ConstraintWidget target)
target - the ConstraintWidget we are trying to connect topublic final ConstraintAnchor getOpposite()