Java 类java.awt.geom.IllegalPathStateException 实例源码

项目:WebPLP    文件:PLPProject.java   
/**
 * Validates the given file to be a directory, and throws an exception if the given
 * file is not a directory, or if the file is null.
 * 
 * @param projectDirectory
 *            File to validate
 */
private static void validateProjectDirectory(File projectDirectory)
{
    if (projectDirectory == null)
    {
        throw new IllegalArgumentException("Directory must be non-null");
    }
    // When creating project, the directory has not been created yet so always throws
    // error
    else
    {
        //moved this
        if (!projectDirectory.exists())
            projectDirectory.mkdir();

        if (!projectDirectory.isDirectory())

        {
            String path = projectDirectory.getAbsolutePath();
            String message = "Path must point to a directory. Found: " + path;
            throw new IllegalPathStateException(message);
        }
    }
}
项目:jdk8u-jdk    文件:Path2DCopyConstructor.java   
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
项目:jdk8u-jdk    文件:Path2DCopyConstructor.java   
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
项目:jdk8u-jdk    文件:Path2DCopyConstructor.java   
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
项目:jdk8u-jdk    文件:Path2DCopyConstructor.java   
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
项目:openjdk-jdk10    文件:Path2DCopyConstructor.java   
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
项目:openjdk-jdk10    文件:Path2DCopyConstructor.java   
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
项目:openjdk-jdk10    文件:Path2DCopyConstructor.java   
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
项目:openjdk-jdk10    文件:Path2DCopyConstructor.java   
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
项目:openjdk9    文件:Path2DCopyConstructor.java   
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
项目:openjdk9    文件:Path2DCopyConstructor.java   
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
项目:openjdk9    文件:Path2DCopyConstructor.java   
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
项目:openjdk9    文件:Path2DCopyConstructor.java   
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
项目:jdk8u_jdk    文件:Path2DCopyConstructor.java   
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
项目:jdk8u_jdk    文件:Path2DCopyConstructor.java   
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
项目:jdk8u_jdk    文件:Path2DCopyConstructor.java   
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
项目:jdk8u_jdk    文件:Path2DCopyConstructor.java   
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
项目:lookaside_java-1.8.0-openjdk    文件:Path2DCopyConstructor.java   
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
项目:lookaside_java-1.8.0-openjdk    文件:Path2DCopyConstructor.java   
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
项目:lookaside_java-1.8.0-openjdk    文件:Path2DCopyConstructor.java   
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
项目:lookaside_java-1.8.0-openjdk    文件:Path2DCopyConstructor.java   
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
项目:cmoct-sourcecode    文件:PolygonControler.java   
public double getArea(float scaleX, float scaleY)
{
    try
    {
        return GeomertyToolkit
                .getArea(GeomertyToolkit.toPath(points), scaleX, scaleY);
    } catch (IllegalPathStateException e)
    {
        return 0;
    }

}
项目:cmoct-sourcecode    文件:PolygonControler.java   
public double getLength(float scaleX, float scaleY)
{
    try
    {
        return GeomertyToolkit.getPathLength(GeomertyToolkit.toPath(points), scaleX, scaleY);
    }
    catch(IllegalPathStateException e)
    {
        return 0;
    }
}
项目:swingx    文件:Morphing2D.java   
/**
 * <p>Creates a new morphing shape. A morphing shape can be used to turn
 * one shape into another one. The transformation can be controlled by the
 * morph property.</p>
 *
 * @param startShape the shape to morph from
 * @param endShape   the shape to morph to
 *
 * @throws IllegalPathStateException if the shapes do not have the same
 *                                   winding rule
 * @see #getMorphing()
 * @see #setMorphing(double)
 */
public Morphing2D(Shape startShape, Shape endShape) {
    startGeometry = new Geometry(startShape);
    endGeometry = new Geometry(endShape);
    if (startGeometry.getWindingRule() != endGeometry.getWindingRule()) {
        throw new IllegalPathStateException("shapes must use same " +
                                            "winding rule");
    }
    double tvals0[] = startGeometry.getTvals();
    double tvals1[] = endGeometry.getTvals();
    double masterTvals[] = mergeTvals(tvals0, tvals1);
    startGeometry.setTvals(masterTvals);
    endGeometry.setTvals(masterTvals);
}
项目:filthy-rich-clients    文件:Morphing2D.java   
/**
 * <p>Creates a new morphing shape. A morphing shape can be used to turn
 * one shape into another one. The transformation can be controlled by the
 * morph property.</p>
 *
 * @param startShape the shape to morph from
 * @param endShape   the shape to morph to
 *
 * @throws IllegalPathStateException if the shapes do not have the same
 *                                   winding rule
 * @see #getMorphing()
 * @see #setMorphing(double)
 */
public Morphing2D(Shape startShape, Shape endShape) {
    startGeometry = new Geometry(startShape);
    endGeometry = new Geometry(endShape);
    if (startGeometry.getWindingRule() != endGeometry.getWindingRule()) {
        throw new IllegalPathStateException("shapes must use same " +
                                            "winding rule");
    }
    double tvals0[] = startGeometry.getTvals();
    double tvals1[] = endGeometry.getTvals();
    double masterTvals[] = mergeTvals(tvals0, tvals1);
    startGeometry.setTvals(masterTvals);
    endGeometry.setTvals(masterTvals);
}
项目:aibench-project    文件:Morphing2D.java   
/**
 * <p>Creates a new morphing shape. A morphing shape can be used to turn
 * one shape into another one. The transformation can be controlled by the
 * morph property.</p>
 *
 * @param startShape the shape to morph from
 * @param endShape   the shape to morph to
 *
 * @throws IllegalPathStateException if the shapes do not have the same
 *                                   winding rule
 * @see #getMorphing()
 * @see #setMorphing(double)
 */
public Morphing2D(Shape startShape, Shape endShape) {
    startGeometry = new Geometry(startShape);
    endGeometry = new Geometry(endShape);
    if (startGeometry.getWindingRule() != endGeometry.getWindingRule()) {
        throw new IllegalPathStateException("shapes must use same " +
                                            "winding rule");
    }
    double tvals0[] = startGeometry.getTvals();
    double tvals1[] = endGeometry.getTvals();
    double masterTvals[] = mergeTvals(tvals0, tvals1);
    startGeometry.setTvals(masterTvals);
    endGeometry.setTvals(masterTvals);
}
项目:marlin-renderer    文件:Path2D.java   
@Override
void needRoom(boolean needMove, int newCoords) {
    if ((numTypes == 0) && needMove) {
        throw new IllegalPathStateException("missing initial moveto "+
                                            "in path definition");
    }
    if (numTypes >= pointTypes.length) {
        pointTypes = expandPointTypes(pointTypes, 1);
    }
    if (numCoords > (floatCoords.length - newCoords)) {
        floatCoords = expandCoords(floatCoords, newCoords);
    }
}
项目:marlin-renderer    文件:Path2D.java   
@Override
void needRoom(boolean needMove, int newCoords) {
    if ((numTypes == 0) && needMove) {
        throw new IllegalPathStateException("missing initial moveto "+
                                            "in path definition");
    }
    if (numTypes >= pointTypes.length) {
        pointTypes = expandPointTypes(pointTypes, 1);
    }
    if (numCoords > (doubleCoords.length - newCoords)) {
        doubleCoords = expandCoords(doubleCoords, newCoords);
    }
}
项目:onprom    文件:Inheritance.java   
@Override
public Shape getShape() {
  Path2D shape = new Path2D.Float();
  int xDiff = Math.abs(getSuperclass().getCenterX() - getSubclass().getCenterX());
  int yDiff = Math.abs(getSuperclass().getCenterY() - getSubclass().getCenterY());
  if (xDiff > 2 * yDiff) {
    if (getSuperclass().getStartX() > getSubclass().getEndX()) {
      trianglePosition = Position.LEFT;
      shape.moveTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sin30);
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sinNeg30);
      shape.lineTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
    } else if (getSuperclass().getEndX() < getSubclass().getStartX()) {
      trianglePosition = Position.RIGHT;
      shape.moveTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sin30);
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sinNeg30);
      shape.lineTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
    }
  } else {
    if (getSuperclass().getStartY() > getSubclass().getEndY()) {
      trianglePosition = Position.TOP;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
      shape.lineTo(getSuperclass().getCenterX() - sin30,
        getSuperclass().getStartY() - cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() - sinNeg30,
        getSuperclass().getStartY() - cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
    } else {
      trianglePosition = Position.BOTTOM;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
      shape.lineTo(getSuperclass().getCenterX() + sin30,
        getSuperclass().getEndY() + cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() + sinNeg30,
        getSuperclass().getEndY() + cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
    }
  }
  try {
    shape.closePath();
  } catch (IllegalPathStateException e) {
    return super.getShape();
  }
  shape.append(super.getShape(), false);
  return shape;
}