Skip to content

Commit

Permalink
Remove unused code, minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
skjolber committed Nov 29, 2023
1 parent b9a3db4 commit fbc27ad
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@ public class StackPlacement implements Placement3D, Serializable {
protected int y; // depth coordinate
protected int z; // height coordinate

// TODO weight constraint
protected int maxSupportedPressure; // i.e.
protected int maxSupportedWeight;

public StackPlacement(Stackable stackable, StackValue value, int x, int y, int z, int maxSupportedPressure,
int maxSupportedWeight) {
public StackPlacement(Stackable stackable, StackValue value, int x, int y, int z) {
super();
this.stackable = stackable;
this.value = value;
this.x = x;
this.y = y;
this.z = z;
this.maxSupportedPressure = maxSupportedPressure;
this.maxSupportedWeight = maxSupportedWeight;
}

public StackPlacement() {
Expand Down Expand Up @@ -147,14 +140,6 @@ public void setValue(StackValue value) {
this.value = value;
}

public void setMaxSupportedPressure(int maxSupportedPressure) {
this.maxSupportedPressure = maxSupportedPressure;
}

public void setMaxSupportedWeight(int maxSupportedWeight) {
this.maxSupportedWeight = maxSupportedWeight;
}

public int getWeight() {
return stackable.getWeight();
}
Expand Down
24 changes: 0 additions & 24 deletions api/src/main/java/com/github/skjolber/packing/api/ep/Point3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,30 +271,6 @@ public boolean intersects(Point3D<?> point) {
return !(point.getMaxX() < minX || point.getMinX() > maxX || point.getMaxY() < minY || point.getMinY() > maxY || point.getMaxZ() < minZ || point.getMinZ() > maxZ);
}

public boolean isYZPlaneEdgeZ(int z) {
return false;
}

public boolean isYZPlaneEdgeY(int z) {
return false;
}

public boolean isXYPlaneEdgeX(int x) {
return false;
}

public boolean isXYPlaneEdgeY(int y) {
return false;
}

public boolean isXZPlaneEdgeX(int x) {
return false;
}

public boolean isXZPlaneEdgeZ(int z) {
return false;
}

public boolean shadowedX(int min, int max) {
return minX < min && maxX > max;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai
Stack levelStack = new DefaultStack();
stack.add(levelStack);

StackPlacement first = new StackPlacement(stackable, bestFirstStackValue, 0, 0, 0, -1, -1);
StackPlacement first = new StackPlacement(stackable, bestFirstStackValue, 0, 0, 0);

levelStack.add(first);

Expand Down Expand Up @@ -216,7 +216,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai

Point2D<StackPlacement> point = extremePoints2D.getValue(bestPointIndex);

StackPlacement stackPlacement = new StackPlacement(remove, bestStackValue, point.getMinX(), point.getMinY(), 0, -1, -1);
StackPlacement stackPlacement = new StackPlacement(remove, bestStackValue, point.getMinX(), point.getMinY(), 0);
levelStack.add(stackPlacement);
extremePoints2D.add(bestPointIndex, stackPlacement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai
Stack levelStack = new DefaultStack();
stack.add(levelStack);

StackPlacement first = new StackPlacement(stackable, firstStackValue, 0, 0, 0, -1, -1);
StackPlacement first = new StackPlacement(stackable, firstStackValue, 0, 0, 0);

levelStack.add(first);

Expand Down Expand Up @@ -197,7 +197,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai

Point3D<StackPlacement> point = extremePoints3D.getValue(bestPointIndex);

StackPlacement stackPlacement = new StackPlacement(remove, bestStackValue, point.getMinX(), point.getMinY(), point.getMinZ(), -1, -1);
StackPlacement stackPlacement = new StackPlacement(remove, bestStackValue, point.getMinX(), point.getMinY(), point.getMinZ());
levelStack.add(stackPlacement);
extremePoints3D.add(bestPointIndex, stackPlacement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public DefaultPackResult pack(List<Stackable> stackables, Container targetContai

Point3D<StackPlacement> point = extremePoints3D.getValue(bestPointIndex);

StackPlacement stackPlacement = new StackPlacement(bestStackable, bestStackValue, point.getMinX(), point.getMinY(), point.getMinZ(), -1, -1);
StackPlacement stackPlacement = new StackPlacement(bestStackable, bestStackValue, point.getMinX(), point.getMinY(), point.getMinZ());
stack.add(stackPlacement);
extremePoints3D.add(bestPointIndex, stackPlacement);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ public Point2D<P> clone(int maxX, int maxY) {
}

@Override
public Placement2D getXSupport() {
return xSupport;
public int getSupportedMaxX() {
return xSupport.getAbsoluteEndX();
}


@Override
public int getSupportedMinX() {
return xSupport.getAbsoluteX();
}

@Override
public SimplePoint2D<P> moveX(int x) {
if(x <= xSupport.getAbsoluteEndX()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ public SimplePoint2D<P> clone(int maxX, int maxY) {
}

@Override
public Placement2D getYSupport() {
return ySupport;
public int getSupportedMaxY() {
return ySupport.getAbsoluteEndY();
}

@Override
public int getSupportedMinY() {
return ySupport.getAbsoluteY();
}

@Override
public Placement2D getXSupport() {
return xSupport;
public int getSupportedMaxX() {
return xSupport.getAbsoluteEndX();
}

@Override
public int getSupportedMinX() {
return xSupport.getAbsoluteX();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ public Point2D<P> clone(int maxX, int maxY) {
}

@Override
public Placement2D getYSupport() {
return ySupport;
public int getSupportedMaxY() {
return ySupport.getAbsoluteEndY();
}

@Override
public int getSupportedMinY() {
return ySupport.getAbsoluteY();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.skjolber.packing.ep.points2d;

import com.github.skjolber.packing.api.Placement2D;

/**
*
* Point supported by a line in the x direction, effectively enforcing a y coordinate.
Expand All @@ -10,6 +8,8 @@

public interface XSupportPoint2D {

Placement2D getXSupport();
int getSupportedMinX();

int getSupportedMaxX();

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.skjolber.packing.ep.points2d;

import com.github.skjolber.packing.api.Placement2D;

/**
*
* Point supported by a line in the y direction, effectively enforcing an x coordinate.
Expand All @@ -10,6 +8,9 @@

public interface YSupportPoint2D {

Placement2D getYSupport();
int getSupportedMinY();

int getSupportedMaxY();


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class CustomIntYComparator implements IntComparator {

@Override
public int compare(int value1, int value2) {

Point3D<?> o1 = values.get(value1);
Point3D<?> o2 = values.get(value2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class CustomIntZComparator implements IntComparator {

@Override
public int compare(int value1, int value2) {

Point3D<?> o1 = values.get(value1);
Point3D<?> o2 = values.get(value2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,14 @@ public Default3DPlanePoint3D<P> clone(int maxX, int maxY, int maxZ) {
yzPlane, xzPlane, xyPlane);
}

@Override
public Placement3D getXZPlane() {
return xzPlane;
}

@Override
public Placement3D getYZPlane() {
return yzPlane;
}

@Override
public Placement3D getXYPlane() {
return xyPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public boolean isXYPlaneEdgeX(int x) {
public boolean isXYPlaneEdgeY(int y) {
return xyPlane.getAbsoluteEndY() == y - 1;
}

@Override

public Placement3D getXYPlane() {
return xyPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,10 @@ public DefaultXYPlaneXZPlanePoint3D<P> clone(int maxX, int maxY, int maxZ) {
return new DefaultXYPlaneXZPlanePoint3D<>(minX, minY, minZ, maxX, maxY, maxZ, xzPlane, xyPlane);
}

@Override
public Placement3D getXZPlane() {
return xzPlane;
}

@Override
public Placement3D getXYPlane() {
return xyPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public boolean isYZPlaneEdgeY(int y) {
return yzPlane.getAbsoluteEndY() == y - 1;
}

@Override
public Placement3D getYZPlane() {
return yzPlane;
}
Expand Down Expand Up @@ -91,7 +90,6 @@ public boolean isXYPlaneEdgeY(int y) {
return xyPlane.getAbsoluteEndY() == y - 1;
}

@Override
public Placement3D getXYPlane() {
return xyPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public DefaultXZPlanePoint3D<P> clone(int maxX, int maxY, int maxZ) {
xzPlane);
}

@Override
public Placement3D getXZPlane() {
return xzPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ public DefaultXZPlaneYZPlanePoint3D<P> clone(int maxX, int maxY, int maxZ) {
xzPlane, yzPlane);
}

@Override
public Placement3D getXZPlane() {
return xzPlane;
}

@Override
public Placement3D getYZPlane() {
return yzPlane;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public boolean isYZPlaneEdgeY(int y) {
return yzPlane.getAbsoluteEndY() == y - 1;
}

@Override
public Placement3D getYZPlane() {
return yzPlane;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.skjolber.packing.ep.points3d;

import com.github.skjolber.packing.api.Placement3D;

/**
*
* Z is fixed within a X-Y plane.
Expand All @@ -18,5 +16,4 @@ public interface XYPlanePoint3D {

int getSupportedXYPlaneMaxY();

Placement3D getXYPlane();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.skjolber.packing.ep.points3d;

import com.github.skjolber.packing.api.Placement3D;

/**
*
* Y is fixed within an x-z plane
Expand All @@ -17,6 +15,4 @@ public interface XZPlanePoint3D {
int getSupportedXZPlaneMinZ();

int getSupportedXZPlaneMaxZ();

Placement3D getXZPlane();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.skjolber.packing.ep.points3d;

import com.github.skjolber.packing.api.Placement3D;

/**
*
* X is fixed within a Y-Z plane.
Expand All @@ -17,5 +15,4 @@ public interface YZPlanePoint3D {

int getSupportedYZPlaneMaxZ();

Placement3D getYZPlane();
}
Loading

0 comments on commit fbc27ad

Please sign in to comment.