// Path: CutletLib/src/main/java/com/cutlet/lib/model/Dimension.java
// @ToString
// public class Dimension implements Serializable{
// 
//     private double length;
//     private double width;
// 
//     public Dimension(final double length, final double width) {
//         this.length = length;
//         this.width = width;
//     }
// 
//     public double getLength() {
//         return length;
//     }
// 
//     public void setLength(final double length) {
//         this.length = length;
//     }
// 
//     public double getWidth() {
//         return width;
//     }
// 
//     public void setWidth(final double width) {
//         this.width = width;
//     }
// 
//     public double getArea() {
//         return getLength() * getWidth();
//     }
// 
//     public boolean canHold(@NonNull final Dimension other) {
//         return other.getLength() <= this.getLength() && other.getWidth() <= this.getWidth();
//     }    
//     
//     public Dimension rotated() {
//         return new Dimension(width, length);
//     }
// }
// 
// Path: CutletLib/src/main/java/com/cutlet/lib/model/Position.java
// @ToString
// public class Position implements Serializable {
// 
//     private double x, y;
// 
//     public Position(final double x, final double y) {
//         this.x = x;
//         this.y = y;
//     }
// 
//     public double getX() {
//         return x;
//     }
// 
//     public void setX(final double x) {
//         this.x = x;
//     }
// 
//     public double getY() {
//         return y;
//     }
// 
//     public void setY(final double y) {
//         this.y = y;
//     }
// 
// }


import lombok.NonNull;
import com.cutlet.lib.model.Dimension;
import com.cutlet.lib.model.Position;

/*
 * Copyright (C) 2017 rudolf.muehlbauer@gmail.com
 */

package com.cutlet.lib.data.cuttree;





/*
*   ---------------------l--------------------   ^
*   |          ^                             |   |
*   |         t|r           r                |   y
*   |          v          -h->               w
*   |          |            t                |
*   |                                        |
* (0,0)---------------------------------------   x->
 */


/**
 *
 * @author rmuehlba
 */
public class CutNode extends AbstractCutTreeNode {

    public enum Direction {
        VERTICAL, HORIZONTAL,
    };
    
    private CutTreeNode target;
    private CutTreeNode rest;
    
    private final Position cutPos;
    private final Dimension cutDim;
    
    private final double kerf;
    private final double cutLength;
    private final Direction direction;

    public CutNode(@NonNull final CutTreeNode parent,
            final double kerf, 
            final double cutPosition, 
            @NonNull final Direction direction,
            @NonNull final Position position, 
            @NonNull final Dimension dimension) {
        
        super(parent, position, dimension);

        final Position thisPosition = getPosition();

// Path: CutletLib/src/main/java/com/cutlet/lib/model/Dimension.java
// @ToString
// public class Dimension implements Serializable{
// 
//     private double length;
//     private double width;
// 
//     public Dimension(final double length, final double width) {
//         this.length = length;
//         this.width = width;
//     }
// 
//     public double getLength() {
//         return length;
//     }
// 
//     public void setLength(final double length) {
//         this.length = length;
//     }
// 
//     public double getWidth() {
//         return width;
//     }
// 
//     public void setWidth(final double width) {
//         this.width = width;
//     }
// 
//     public double getArea() {
//         return getLength() * getWidth();
//     }
// 
//     public boolean canHold(@NonNull final Dimension other) {
//         return other.getLength() <= this.getLength() && other.getWidth() <= this.getWidth();
//     }    
//     
//     public Dimension rotated() {
//         return new Dimension(width, length);
//     }
// }
// 
// Path: CutletLib/src/main/java/com/cutlet/lib/model/Position.java
// @ToString
// public class Position implements Serializable {
// 
//     private double x, y;
// 
//     public Position(final double x, final double y) {
//         this.x = x;
//         this.y = y;
//     }
// 
//     public double getX() {
//         return x;
//     }
// 
//     public void setX(final double x) {
//         this.x = x;
//     }
// 
//     public double getY() {
//         return y;
//     }
// 
//     public void setY(final double y) {
//         this.y = y;
//     }
// 
// }


// Path: CutletLib/src/main/java/com/cutlet/lib/data/cuttree/CutNode.java
import lombok.NonNull;
import com.cutlet.lib.model.Dimension;
import com.cutlet.lib.model.Position;

/*
 * Copyright (C) 2017 rudolf.muehlbauer@gmail.com
 */

package com.cutlet.lib.data.cuttree;





/*
*   ---------------------l--------------------   ^
*   |          ^                             |   |
*   |         t|r           r                |   y
*   |          v          -h->               w
*   |          |            t                |
*   |                                        |
* (0,0)---------------------------------------   x->
 */


/**
 *
 * @author rmuehlba
 */
public class CutNode extends AbstractCutTreeNode {

    public enum Direction {
        VERTICAL, HORIZONTAL,
    };
    
    private CutTreeNode target;
    private CutTreeNode rest;
    
    private final Position cutPos;
    private final Dimension cutDim;
    
    private final double kerf;
    private final double cutLength;
    private final Direction direction;

    public CutNode(@NonNull final CutTreeNode parent,
            final double kerf, 
            final double cutPosition, 
            @NonNull final Direction direction,
            @NonNull final Position position, 
            @NonNull final Dimension dimension) {
        
        super(parent, position, dimension);

        final Position thisPosition = getPosition();

        final Dimension thisDimension = getDimension();
