diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/graph/geom/plane/Path2D.java | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/graph/geom/plane/Path2D.java')
-rw-r--r-- | src/jogl/classes/jogamp/graph/geom/plane/Path2D.java | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java index a87c0a0a1..3b79c28b6 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java @@ -108,7 +108,7 @@ public final class Path2D implements Cloneable { * Constructs a new GeneralPath.Iterator for given general path * @param path - the source GeneralPath object */ - Iterator(Path2D path) { + Iterator(final Path2D path) { this(path, null); } @@ -117,7 +117,7 @@ public final class Path2D implements Cloneable { * @param path - the source GeneralPath object * @param at - the AffineTransform object to apply rectangle path */ - Iterator(Path2D path, AffineTransform at) { + Iterator(final Path2D path, final AffineTransform at) { this.p = path; this.t = at; } @@ -138,12 +138,12 @@ public final class Path2D implements Cloneable { } @Override - public int currentSegment(float[] coords) { + public int currentSegment(final float[] coords) { if (isDone()) { throw new NoSuchElementException(iteratorOutOfBounds); } - int type = p.types[typeIndex]; - int count = Path2D.pointShift[type]; + final int type = p.types[typeIndex]; + final int count = Path2D.pointShift[type]; System.arraycopy(p.points, pointIndex, coords, 0, count); if (t != null) { t.transform(coords, 0, coords, 0, count / 2); @@ -158,24 +158,24 @@ public final class Path2D implements Cloneable { this(WIND_NON_ZERO, BUFFER_SIZE); } - public Path2D(int rule) { + public Path2D(final int rule) { this(rule, BUFFER_SIZE); } - public Path2D(int rule, int initialCapacity) { + public Path2D(final int rule, final int initialCapacity) { setWindingRule(rule); types = new byte[initialCapacity]; points = new float[initialCapacity * 2]; } - public Path2D(Path2D path) { + public Path2D(final Path2D path) { this(WIND_NON_ZERO, BUFFER_SIZE); - PathIterator p = path.iterator(null); + final PathIterator p = path.iterator(null); setWindingRule(p.getWindingRule()); append(p, false); } - public void setWindingRule(int rule) { + public void setWindingRule(final int rule) { if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) { throw new NoSuchElementException(invalidWindingRuleValue); } @@ -190,23 +190,23 @@ public final class Path2D implements Cloneable { * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. * @param pointCount - the point count to be added in buffer */ - void checkBuf(int pointCount, boolean checkMove) { + void checkBuf(final int pointCount, final boolean checkMove) { if (checkMove && typeSize == 0) { throw new IllegalPathStateException("First segment should be SEG_MOVETO type"); } if (typeSize == types.length) { - byte tmp[] = new byte[typeSize + BUFFER_CAPACITY]; + final byte tmp[] = new byte[typeSize + BUFFER_CAPACITY]; System.arraycopy(types, 0, tmp, 0, typeSize); types = tmp; } if (pointSize + pointCount > points.length) { - float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)]; + final float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)]; System.arraycopy(points, 0, tmp, 0, pointSize); points = tmp; } } - public void moveTo(float x, float y) { + public void moveTo(final float x, final float y) { if (typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_MOVETO) { points[pointSize - 2] = x; points[pointSize - 1] = y; @@ -218,14 +218,14 @@ public final class Path2D implements Cloneable { } } - public void lineTo(float x, float y) { + public void lineTo(final float x, final float y) { checkBuf(2, true); types[typeSize++] = PathIterator.SEG_LINETO; points[pointSize++] = x; points[pointSize++] = y; } - public void quadTo(float x1, float y1, float x2, float y2) { + public void quadTo(final float x1, final float y1, final float x2, final float y2) { checkBuf(4, true); types[typeSize++] = PathIterator.SEG_QUADTO; points[pointSize++] = x1; @@ -234,7 +234,7 @@ public final class Path2D implements Cloneable { points[pointSize++] = y2; } - public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { + public void curveTo(final float x1, final float y1, final float x2, final float y2, final float x3, final float y3) { checkBuf(6, true); types[typeSize++] = PathIterator.SEG_CUBICTO; points[pointSize++] = x1; @@ -265,12 +265,12 @@ public final class Path2D implements Cloneable { return "[size "+size()+", closed "+isClosed()+"]"; } - public void append(Path2D path, boolean connect) { - PathIterator p = path.iterator(null); + public void append(final Path2D path, final boolean connect) { + final PathIterator p = path.iterator(null); append(p, connect); } - public void append(PathIterator path, boolean connect) { + public void append(final PathIterator path, boolean connect) { while (!path.isDone()) { final float coords[] = new float[6]; final int segmentType = path.currentSegment(coords); @@ -315,7 +315,7 @@ public final class Path2D implements Cloneable { if (types[typeSize - 1] == PathIterator.SEG_CLOSE) { for (int i = typeSize - 2; i > 0; i--) { - int type = types[i]; + final int type = types[i]; if (type == PathIterator.SEG_MOVETO) { break; } @@ -330,12 +330,12 @@ public final class Path2D implements Cloneable { pointSize = 0; } - public void transform(AffineTransform t) { + public void transform(final AffineTransform t) { t.transform(points, 0, points, 0, pointSize / 2); } - public Path2D createTransformedShape(AffineTransform t) { - Path2D p = (Path2D)clone(); + public Path2D createTransformedShape(final AffineTransform t) { + final Path2D p = (Path2D)clone(); if (t != null) { p.transform(t); } @@ -351,8 +351,8 @@ public final class Path2D implements Cloneable { ry1 = ry2 = points[i--]; rx1 = rx2 = points[i--]; while (i > 0) { - float y = points[i--]; - float x = points[i--]; + final float y = points[i--]; + final float x = points[i--]; if (x < rx1) { rx1 = x; } else @@ -375,36 +375,36 @@ public final class Path2D implements Cloneable { * @param cross - the point cross count * @return true if point is inside path, or false otherwise */ - boolean isInside(int cross) { + boolean isInside(final int cross) { if (rule == WIND_NON_ZERO) { return Crossing.isInsideNonZero(cross); } return Crossing.isInsideEvenOdd(cross); } - public boolean contains(float px, float py) { + public boolean contains(final float px, final float py) { return isInside(Crossing.crossShape(this, px, py)); } - public boolean contains(float rx, float ry, float rw, float rh) { - int cross = Crossing.intersectShape(this, rx, ry, rw, rh); + public boolean contains(final float rx, final float ry, final float rw, final float rh) { + final int cross = Crossing.intersectShape(this, rx, ry, rw, rh); return cross != Crossing.CROSSING && isInside(cross); } - public boolean intersects(float rx, float ry, float rw, float rh) { - int cross = Crossing.intersectShape(this, rx, ry, rw, rh); + public boolean intersects(final float rx, final float ry, final float rw, final float rh) { + final int cross = Crossing.intersectShape(this, rx, ry, rw, rh); return cross == Crossing.CROSSING || isInside(cross); } - public boolean contains(Vertex p) { + public boolean contains(final Vertex p) { return contains(p.getX(), p.getY()); } - public boolean contains(AABBox r) { + public boolean contains(final AABBox r) { return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } - public boolean intersects(AABBox r) { + public boolean intersects(final AABBox r) { return intersects(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } @@ -412,7 +412,7 @@ public final class Path2D implements Cloneable { return new Iterator(this); } - public PathIterator iterator(AffineTransform t) { + public PathIterator iterator(final AffineTransform t) { return new Iterator(this, t); } @@ -423,11 +423,11 @@ public final class Path2D implements Cloneable { @Override public Object clone() { try { - Path2D p = (Path2D) super.clone(); + final Path2D p = (Path2D) super.clone(); p.types = types.clone(); p.points = points.clone(); return p; - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new InternalError(); } } |