/** * Returns the pen position. * GetPen * * @return the current pen position */ public Point2D getPenPosition() { return (Point2D) penPosition.clone(); }
public class Person implements Cloneable { protected String name; // Note that overridden clone is public public Object clone() { Person clone = (Person)super.clone(); // No need to copy name as the reference will be // copied by Object's clone and String is immutable return clone; } } public class Employee extends Person { protected int id; protected java.awt.Point location; public Object clone() { Employee clone = (Employee )super.clone(); // No need to copy id as Object's clone has already copied it // Need to clone location as Point is mutable and could change clone.location = location.clone(); return clone; } }
@Override public Point2D mapDestPoint(Point2D destPt, int sourceIndex) { if (destPt == null) { throw new IllegalArgumentException("Bad dest pt"); // JaiI18N.getString("Generic0")); } else if (sourceIndex < 0 || sourceIndex >= getNumSources()) { throw new IndexOutOfBoundsException("Bad src"); // JaiI18N.getString("Generic1")); } double[] coords = new double[] {destPt.getX(), destPt.getY()}; try { mapDestPoint(coords); } catch (TransformException e) { LOGGER.log(Level.WARNING, "Error transforming coords", e); return null; } Point2D ret = ((Point2D) destPt.clone()); ret.setLocation(coords[0], coords[1]); if (dst.getEnvelope2D().contains(ret)) return ret; else return null; }
Point2D ret = ((Point2D) srcPt.clone()); ret.setLocation(coords[0], coords[1]); if (inside(ret, src.getRenderedImage())) return ret;
/** * Returns the reference point of this marker. */ public Point2D getRef(){ return (Point2D)ref.clone(); }
/** * {@inheritDoc} */ @Override public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * {@inheritDoc} */ public final Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * {@inheritDoc} */ @Override public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * {@inheritDoc} */ public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * Returns the pen position. * GetPen * * @return the current pen position */ public Point2D getPenPosition() { return (Point2D) penPosition.clone(); }
/** * {@inheritDoc} */ public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * {@inheritDoc} */ public final Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { return (Point2D) srcPt.clone(); }
/** * Returns the pen position. * GetPen * * @return the current pen position */ public Point2D getPenPosition() { return (Point2D) mPenPosition.clone(); }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) dstPt = (Point2D) srcPt.clone(); else dstPt.setLocation(srcPt); return dstPt; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) dstPt = (Point2D) srcPt.clone(); else dstPt.setLocation(srcPt); return dstPt; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) { dstPt = (Point2D) srcPt.clone(); } else { dstPt.setLocation(srcPt); } return dstPt; }
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) { if (dstPt == null) dstPt = (Point2D) srcPt.clone(); else dstPt.setLocation(srcPt); return dstPt; }
/** Sets the base of this element. * @param base The new bas that should be used to draw this element. * @see #getBase() */ public void setBase(Point2D base) { m_base = (Point2D)base.clone(); onBaseChanged(); }
/** * Return the mouse position in PCanvas coordinates. * * @return mouse position in PCanvas coordinates */ public Point2D getCanvasPosition() { return (Point2D) inputManager.getCurrentCanvasPosition().clone(); }