public class BoxEvaluation
extends java.lang.Object
evaluate()
returns an instance of this class.
The evaluate()
method checks to see if the placement
is legal, or if there's some other problem. If not, it counts the
number of items, and the area of the items as well. Both are written
into the public variables below. The fraction of allocated items can
be requested through a call to getFracItems()
.Modifier and Type | Field and Description |
---|---|
java.lang.String |
errorMessage
Potential error message if something went wrong.
|
boolean |
isLegal
Is this a legal arrangement of items?
|
int |
itemAreaInBox
The total area of items in the box.
|
int |
numItemsInBox
How many items are in the box?
|
Constructor and Description |
---|
BoxEvaluation() |
Modifier and Type | Method and Description |
---|---|
double |
getFracArea()
Return the fraction of total-item-area placed in the box.
|
double |
getFracItems()
Return the fraction of items placed in the box.
|
java.lang.String |
toString()
Print evaluation data.
|
public java.lang.String errorMessage
public boolean isLegal
public int numItemsInBox
public int totalItems
public int itemAreaInBox
public int totalArea
public double getFracItems()
public double getFracArea()
public java.lang.String toString()
toString
in class java.lang.Object