Package org.jacop.constraints
Class Rectangle
- java.lang.Object
-
- org.jacop.constraints.Rectangle
-
- Direct Known Subclasses:
RectangleWithCondition
public class Rectangle extends java.lang.Object
Defines a rectangle used in the diffn constraint.- Version:
- 4.7
-
-
Constructor Summary
Constructors Constructor Description Rectangle(java.util.List<? extends IntVar> list)
It constructs a rectangle.Rectangle(Rectangle rect)
It constructs a rectangle.Rectangle(IntVar[] list)
It constructs a rectangle.Rectangle(IntVar[] origin, IntVar[] length)
It constructs a rectangle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
dim()
boolean
domOverlap(Rectangle r)
It returns true if this rectangle overlaps with a given rectangle.static java.util.stream.Stream<Var>
getStream(Rectangle[] scope)
(package private) boolean
intervalOverlap(int min1, int max1, int min2, int max2)
(package private) IntVar
length(int i)
int
maxLevel()
It computes the maximum level of any variable constituting the rectangle.(package private) long
minArea()
boolean
minLengthEq0()
It checks if a minimum length in any dimension of the rectangle can be equal 0.boolean
minUse(int selDimension, IntRectangle u)
boolean
minUse(IntRectangle u)
(package private) Var
origin(int i)
boolean
settled()
It checks whether the rectangle is completely fixed.static Rectangle[]
toArrayOf2DRectangles(java.util.List<? extends java.util.List<? extends IntVar>> rectangles)
static Rectangle[]
toArrayOf2DRectangles(IntVar[][] rectangles)
static Rectangle[]
toArrayOf2DRectangles(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Rectangle
public Rectangle(IntVar[] origin, IntVar[] length)
It constructs a rectangle.- Parameters:
length
- the length of the rectangle in each dimension.origin
- the origin of the rectangle in each dimension.
-
Rectangle
public Rectangle(IntVar[] list)
It constructs a rectangle.- Parameters:
list
- it specifies for each dimension (one after the other) its origin and length.
-
Rectangle
public Rectangle(java.util.List<? extends IntVar> list)
It constructs a rectangle.- Parameters:
list
- it specifies for each dimension (one after the other) its origin and length.
-
Rectangle
public Rectangle(Rectangle rect)
It constructs a rectangle.- Parameters:
rect
- the rectangle based on which a new rectangle is created.
-
-
Method Detail
-
dim
int dim()
-
domOverlap
public boolean domOverlap(Rectangle r)
It returns true if this rectangle overlaps with a given rectangle.- Parameters:
r
- the rectangle for which the overlapping is being checked.- Returns:
- true if rectangles overlap, false otherwise.
-
intervalOverlap
boolean intervalOverlap(int min1, int max1, int min2, int max2)
-
length
IntVar length(int i)
-
maxLevel
public int maxLevel()
It computes the maximum level of any variable constituting the rectangle.- Returns:
- the maximum level.
-
minArea
long minArea()
-
minLengthEq0
public boolean minLengthEq0()
It checks if a minimum length in any dimension of the rectangle can be equal 0.- Returns:
- true if in any dimension the rectangle has minimum possible length equal 0, false otherwise.
-
minUse
public boolean minUse(int selDimension, IntRectangle u)
-
minUse
public boolean minUse(IntRectangle u)
-
origin
Var origin(int i)
-
settled
public boolean settled()
It checks whether the rectangle is completely fixed.- Returns:
- true if all variables constituting rectangle are grounded, false otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toArrayOf2DRectangles
public static Rectangle[] toArrayOf2DRectangles(java.util.List<? extends java.util.List<? extends IntVar>> rectangles)
-
toArrayOf2DRectangles
public static Rectangle[] toArrayOf2DRectangles(IntVar[] origin1, IntVar[] origin2, IntVar[] length1, IntVar[] length2)
-
-