public boolean isWithinBounds(double x) {
        if (B.getX() < A.getX()) {
            return ((x >= B.getX()) && (x <= A.getX()));
        } else {
            return ((x >= A.getX()) && (x <= B.getX()));
        }
    }