jetbrains.buildServer.util.positioning
Class PositionConstraint

java.lang.Object
  extended by jetbrains.buildServer.util.positioning.PositionConstraint

public abstract class PositionConstraint
extends java.lang.Object

Fixed set of objects describing ordering constraints. A generalization of PositionConstraint

Since:
6.0
See Also:
OrderAwareSorter

Field Summary
static PositionConstraint UNDEFINED
           
 
Constructor Summary
PositionConstraint()
           
 
Method Summary
static PositionConstraint after(java.lang.String... ids)
          Indicates that item must be placed after other items with specified identifiers
static PositionConstraint before(java.lang.String... ids)
          Indicates that item must be placed before other items with specified identifiers
static PositionConstraint between(java.util.Collection<java.lang.String> afterIds, java.util.Collection<java.lang.String> beforeIds)
          Indicates that item must be placed between other items.
abstract  int compareTo(java.lang.String id)
          "Compares" current PositionConstraint to id.
static PositionConstraint first()
          Indicates that the item must be the first.
 java.util.Collection<java.lang.String> getAfter()
           
 java.util.Collection<java.lang.String> getBefore()
           
 boolean isFirst()
           
 boolean isLast()
           
static PositionConstraint last()
          Indicates that item must be the last.
abstract  java.lang.String toString()
          Human readable presentation of the constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED

public static final PositionConstraint UNDEFINED
Constructor Detail

PositionConstraint

public PositionConstraint()
Method Detail

first

@NotNull
public static PositionConstraint first()
Indicates that the item must be the first.

Returns:
new constraint

last

@NotNull
public static PositionConstraint last()
Indicates that item must be the last.

Returns:
new constraint

isFirst

public boolean isFirst()
Returns:
true if isFirst
Since:
7.0

isLast

public boolean isLast()
Returns:
true is IsLast
Since:
7.0

getBefore

@NotNull
public java.util.Collection<java.lang.String> getBefore()
Returns:
id of items before
Since:
7.0

getAfter

@NotNull
public java.util.Collection<java.lang.String> getAfter()
Returns:
id of items after
Since:
7.0

before

@NotNull
public static PositionConstraint before(@NotNull
                                                java.lang.String... ids)
Indicates that item must be placed before other items with specified identifiers

Parameters:
ids - items identifiers
Returns:
new constraint

after

@NotNull
public static PositionConstraint after(@NotNull
                                               java.lang.String... ids)
Indicates that item must be placed after other items with specified identifiers

Parameters:
ids - items identifiers
Returns:
new constraint

between

@NotNull
public static PositionConstraint between(@NotNull
                                                 java.util.Collection<java.lang.String> afterIds,
                                                 @NotNull
                                                 java.util.Collection<java.lang.String> beforeIds)
Indicates that item must be placed between other items.

Parameters:
afterIds - the item will be placed after the items with provided ids
beforeIds - the item will be placed before the items with provided ids
Returns:
new constraint

toString

public abstract java.lang.String toString()
Human readable presentation of the constraint.

Overrides:
toString in class java.lang.Object
Returns:
see above

compareTo

public abstract int compareTo(java.lang.String id)
"Compares" current PositionConstraint to id. Returns a negative integer, zero, or a positive integer as item with "id" should be before, after or should not change its position based on the current constraint.

Parameters:
id - id of the item to compare item with current constraint to
Returns:
a negative integer if the "id"-specified item should be placed before the item with current constraint, or a positive integer if the "id"-specified item should be placed after the item with current constraint, or zero if the "id"-specified item is not comparable with the item having current constraint.