Import GNU Classpath (20121202).

2012-12-19  Matthias Klose  <doko@ubuntu.com>

        Import GNU Classpath (20121202).

        * Regenerate class and header files.
        * Regenerate auto* files.
        * sources.am, gcj/javaprims.h: Regenerate.
        * gnu/java/nio/FileLockImpl.java (close): New override.

From-SVN: r194618
This commit is contained in:
Matthias Klose 2012-12-19 17:03:15 +00:00
parent baeb2e1647
commit a1906e8bbf
454 changed files with 5224 additions and 2925 deletions

View file

@ -91,18 +91,18 @@ public class Area implements Shape, Cloneable
* Segment vectors containing solid areas and holes
* This is package-private to avoid an accessor method.
*/
Vector solids;
Vector<Segment> solids;
/**
* Segment vectors containing solid areas and holes
* This is package-private to avoid an accessor method.
*/
Vector holes;
Vector<Segment> holes;
/**
* Vector (temporary) storing curve-curve intersections
*/
private Vector cc_intersections;
private Vector<double[]> ccIntersections;
/**
* Winding rule WIND_NON_ZERO used, after construction,
@ -115,8 +115,8 @@ public class Area implements Shape, Cloneable
*/
public Area()
{
solids = new Vector();
holes = new Vector();
solids = new Vector<Segment>();
holes = new Vector<Segment>();
}
/**
@ -135,7 +135,7 @@ public class Area implements Shape, Cloneable
{
this();
Vector p = makeSegment(s);
Vector<Segment> p = makeSegment(s);
// empty path
if (p == null)
@ -143,7 +143,7 @@ public class Area implements Shape, Cloneable
// delete empty paths
for (int i = 0; i < p.size(); i++)
if (((Segment) p.elementAt(i)).getSignedArea() == 0.0)
if (p.elementAt(i).getSignedArea() == 0.0)
p.remove(i--);
/*
@ -157,12 +157,11 @@ public class Area implements Shape, Cloneable
* 4: Repeat (3) until no segments remain in the list
* 5: Remove redundant paths and sort into solids and holes
*/
Vector paths = new Vector();
Segment v;
for (int i = 0; i < p.size(); i++)
{
Segment path = (Segment) p.elementAt(i);
Segment path = p.elementAt(i);
createNodesSelf(path);
}
@ -171,18 +170,18 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < p.size() - 1; i++)
for (int j = i + 1; j < p.size(); j++)
{
Segment path1 = (Segment) p.elementAt(i);
Segment path2 = (Segment) p.elementAt(j);
Segment path1 = p.elementAt(i);
Segment path2 = p.elementAt(j);
createNodes(path1, path2);
}
}
// we have intersecting points.
Vector segments = new Vector();
Vector<Segment> segments = new Vector<Segment>();
for (int i = 0; i < p.size(); i++)
{
Segment path = v = (Segment) p.elementAt(i);
Segment path = v = p.elementAt(i);
do
{
segments.add(v);
@ -191,7 +190,7 @@ public class Area implements Shape, Cloneable
while (v != path);
}
paths = weilerAtherton(segments);
Vector<Segment> paths = weilerAtherton(segments);
deleteRedundantPaths(paths);
}
@ -208,36 +207,34 @@ public class Area implements Shape, Cloneable
Area B = (Area) area.clone();
Vector pathA = new Vector();
Vector pathB = new Vector();
Vector<Segment> pathA = new Vector<Segment>();
Vector<Segment> pathB = new Vector<Segment>();
pathA.addAll(solids);
pathA.addAll(holes);
pathB.addAll(B.solids);
pathB.addAll(B.holes);
int nNodes = 0;
for (int i = 0; i < pathA.size(); i++)
{
Segment a = (Segment) pathA.elementAt(i);
Segment a = pathA.elementAt(i);
for (int j = 0; j < pathB.size(); j++)
{
Segment b = (Segment) pathB.elementAt(j);
nNodes += createNodes(a, b);
Segment b = pathB.elementAt(j);
createNodes(a, b);
}
}
Vector paths = new Vector();
Vector<Segment> paths = new Vector<Segment>();
Segment v;
// we have intersecting points.
Vector segments = new Vector();
Vector<Segment> segments = new Vector<Segment>();
// In a union operation, we keep all
// segments of A oustide B and all B outside A
for (int i = 0; i < pathA.size(); i++)
{
v = (Segment) pathA.elementAt(i);
v = pathA.elementAt(i);
Segment path = v;
do
{
@ -250,7 +247,7 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < pathB.size(); i++)
{
v = (Segment) pathB.elementAt(i);
v = pathB.elementAt(i);
Segment path = v;
do
{
@ -281,7 +278,7 @@ public class Area implements Shape, Cloneable
return;
}
Vector pathA = new Vector();
Vector<Segment> pathA = new Vector<Segment>();
Area B = (Area) area.clone();
pathA.addAll(solids);
pathA.addAll(holes);
@ -290,27 +287,23 @@ public class Area implements Shape, Cloneable
setDirection(B.holes, true);
setDirection(B.solids, false);
Vector pathB = new Vector();
Vector<Segment> pathB = new Vector<Segment>();
pathB.addAll(B.solids);
pathB.addAll(B.holes);
int nNodes = 0;
// create nodes
for (int i = 0; i < pathA.size(); i++)
{
Segment a = (Segment) pathA.elementAt(i);
Segment a = pathA.elementAt(i);
for (int j = 0; j < pathB.size(); j++)
{
Segment b = (Segment) pathB.elementAt(j);
nNodes += createNodes(a, b);
Segment b = pathB.elementAt(j);
createNodes(a, b);
}
}
Vector paths = new Vector();
// we have intersecting points.
Vector segments = new Vector();
Vector<Segment> segments = new Vector<Segment>();
// In a subtraction operation, we keep all
// segments of A oustide B and all B within A
@ -318,7 +311,7 @@ public class Area implements Shape, Cloneable
// and the segments before and after any node
for (int i = 0; i < pathA.size(); i++)
{
Segment v = (Segment) pathA.elementAt(i);
Segment v = pathA.elementAt(i);
Segment path = v;
if (v.isSegmentOutside(area) && v.node == null)
segments.add(v);
@ -357,7 +350,7 @@ public class Area implements Shape, Cloneable
while (v != path);
}
paths = weilerAtherton(segments);
Vector<Segment> paths = weilerAtherton(segments);
deleteRedundantPaths(paths);
}
@ -376,32 +369,28 @@ public class Area implements Shape, Cloneable
if (equals(area))
return;
Vector pathA = new Vector();
Vector<Segment> pathA = new Vector<Segment>();
Area B = (Area) area.clone();
pathA.addAll(solids);
pathA.addAll(holes);
Vector pathB = new Vector();
Vector<Segment> pathB = new Vector<Segment>();
pathB.addAll(B.solids);
pathB.addAll(B.holes);
int nNodes = 0;
// create nodes
for (int i = 0; i < pathA.size(); i++)
{
Segment a = (Segment) pathA.elementAt(i);
Segment a = pathA.elementAt(i);
for (int j = 0; j < pathB.size(); j++)
{
Segment b = (Segment) pathB.elementAt(j);
nNodes += createNodes(a, b);
Segment b = pathB.elementAt(j);
createNodes(a, b);
}
}
Vector paths = new Vector();
// we have intersecting points.
Vector segments = new Vector();
Vector<Segment> segments = new Vector<Segment>();
// In an intersection operation, we keep all
// segments of A within B and all B within A
@ -410,7 +399,7 @@ public class Area implements Shape, Cloneable
// and the segments before and after any node
for (int i = 0; i < pathA.size(); i++)
{
Segment v = (Segment) pathA.elementAt(i);
Segment v = pathA.elementAt(i);
Segment path = v;
if (! v.isSegmentOutside(area) && v.node == null)
segments.add(v);
@ -430,7 +419,7 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < pathB.size(); i++)
{
Segment v = (Segment) pathB.elementAt(i);
Segment v = pathB.elementAt(i);
Segment path = v;
if (! v.isSegmentOutside(this) && v.node == null)
segments.add(v);
@ -449,7 +438,7 @@ public class Area implements Shape, Cloneable
while (v != path);
}
paths = weilerAtherton(segments);
Vector<Segment> paths = weilerAtherton(segments);
deleteRedundantPaths(paths);
}
@ -476,10 +465,10 @@ public class Area implements Shape, Cloneable
return;
}
Vector pathA = new Vector();
Vector<Segment> pathA = new Vector<Segment>();
Area B = (Area) area.clone();
Vector pathB = new Vector();
Vector<Segment> pathB = new Vector<Segment>();
pathA.addAll(solids);
pathA.addAll(holes);
@ -489,28 +478,25 @@ public class Area implements Shape, Cloneable
pathB.addAll(B.solids);
pathB.addAll(B.holes);
int nNodes = 0;
for (int i = 0; i < pathA.size(); i++)
{
Segment a = (Segment) pathA.elementAt(i);
Segment a = pathA.elementAt(i);
for (int j = 0; j < pathB.size(); j++)
{
Segment b = (Segment) pathB.elementAt(j);
nNodes += createNodes(a, b);
Segment b = pathB.elementAt(j);
createNodes(a, b);
}
}
Vector paths = new Vector();
Segment v;
// we have intersecting points.
Vector segments = new Vector();
Vector<Segment> segments = new Vector<Segment>();
// In an XOR operation, we operate on all segments
for (int i = 0; i < pathA.size(); i++)
{
v = (Segment) pathA.elementAt(i);
v = pathA.elementAt(i);
Segment path = v;
do
{
@ -522,7 +508,7 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < pathB.size(); i++)
{
v = (Segment) pathB.elementAt(i);
v = pathB.elementAt(i);
Segment path = v;
do
{
@ -532,7 +518,7 @@ public class Area implements Shape, Cloneable
while (v != path);
}
paths = weilerAtherton(segments);
Vector<Segment> paths = weilerAtherton(segments);
deleteRedundantPaths(paths);
}
@ -541,8 +527,8 @@ public class Area implements Shape, Cloneable
*/
public void reset()
{
solids = new Vector();
holes = new Vector();
solids = new Vector<Segment>();
holes = new Vector<Segment>();
}
/**
@ -556,9 +542,9 @@ public class Area implements Shape, Cloneable
double totalArea = 0;
for (int i = 0; i < solids.size(); i++)
totalArea += Math.abs(((Segment) solids.elementAt(i)).getSignedArea());
totalArea += Math.abs(solids.elementAt(i).getSignedArea());
for (int i = 0; i < holes.size(); i++)
totalArea -= Math.abs(((Segment) holes.elementAt(i)).getSignedArea());
totalArea -= Math.abs(holes.elementAt(i).getSignedArea());
if (totalArea <= EPSILON)
return true;
@ -572,10 +558,10 @@ public class Area implements Shape, Cloneable
public boolean isPolygonal()
{
for (int i = 0; i < holes.size(); i++)
if (! ((Segment) holes.elementAt(i)).isPolygonal())
if (!holes.elementAt(i).isPolygonal())
return false;
for (int i = 0; i < solids.size(); i++)
if (! ((Segment) solids.elementAt(i)).isPolygonal())
if (!solids.elementAt(i).isPolygonal())
return false;
return true;
}
@ -599,7 +585,7 @@ public class Area implements Shape, Cloneable
if (holes.size() != 0 || solids.size() != 1)
return false;
Segment path = (Segment) solids.elementAt(0);
Segment path = solids.elementAt(0);
if (! path.isPolygonal())
return false;
@ -657,12 +643,12 @@ public class Area implements Shape, Cloneable
double xmax;
double ymin;
double ymax;
xmin = xmax = ((Segment) solids.elementAt(0)).P1.getX();
ymin = ymax = ((Segment) solids.elementAt(0)).P1.getY();
xmin = xmax = solids.elementAt(0).P1.getX();
ymin = ymax = solids.elementAt(0).P1.getY();
for (int path = 0; path < solids.size(); path++)
{
Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds();
Rectangle2D r = solids.elementAt(path).getPathBounds();
xmin = Math.min(r.getMinX(), xmin);
ymin = Math.min(r.getMinY(), ymin);
xmax = Math.max(r.getMaxX(), xmax);
@ -696,9 +682,9 @@ public class Area implements Shape, Cloneable
{
Area clone = new Area();
for (int i = 0; i < solids.size(); i++)
clone.solids.add(((Segment) solids.elementAt(i)).cloneSegmentList());
clone.solids.add(solids.elementAt(i).cloneSegmentList());
for (int i = 0; i < holes.size(); i++)
clone.holes.add(((Segment) holes.elementAt(i)).cloneSegmentList());
clone.holes.add(holes.elementAt(i).cloneSegmentList());
return clone;
}
catch (CloneNotSupportedException e)
@ -727,10 +713,10 @@ public class Area implements Shape, Cloneable
|| holes.size() != area.holes.size())
return false;
Vector pathA = new Vector();
Vector<Segment> pathA = new Vector<Segment>();
pathA.addAll(solids);
pathA.addAll(holes);
Vector pathB = new Vector();
Vector<Segment> pathB = new Vector<Segment>();
pathB.addAll(area.solids);
pathB.addAll(area.holes);
@ -741,8 +727,8 @@ public class Area implements Shape, Cloneable
{
for (int j = 0; j < nPaths; j++)
{
Segment p1 = (Segment) pathA.elementAt(i);
Segment p2 = (Segment) pathB.elementAt(j);
Segment p1 = pathA.elementAt(i);
Segment p2 = pathB.elementAt(j);
if (! match[0][i] && ! match[1][j])
if (p1.pathEquals(p2))
match[0][i] = match[1][j] = true;
@ -763,9 +749,9 @@ public class Area implements Shape, Cloneable
public void transform(AffineTransform at)
{
for (int i = 0; i < solids.size(); i++)
((Segment) solids.elementAt(i)).transformSegmentList(at);
solids.elementAt(i).transformSegmentList(at);
for (int i = 0; i < holes.size(); i++)
((Segment) holes.elementAt(i)).transformSegmentList(at);
holes.elementAt(i).transformSegmentList(at);
// Note that the orientation is not invariant under inversion
if ((at.getType() & AffineTransform.TYPE_FLIP) != 0)
@ -800,11 +786,11 @@ public class Area implements Shape, Cloneable
{
int n = 0;
for (int i = 0; i < solids.size(); i++)
if (((Segment) solids.elementAt(i)).contains(x, y))
if (solids.elementAt(i).contains(x, y))
n++;
for (int i = 0; i < holes.size(); i++)
if (((Segment) holes.elementAt(i)).contains(x, y))
if (holes.elementAt(i).contains(x, y))
n--;
return (n != 0);
@ -854,7 +840,7 @@ public class Area implements Shape, Cloneable
{
Segment v;
Segment start;
start = v = (Segment) solids.elementAt(path);
start = v = solids.elementAt(path);
do
{
if (l[i].hasIntersections(v))
@ -867,7 +853,7 @@ public class Area implements Shape, Cloneable
{
Segment v;
Segment start;
start = v = (Segment) holes.elementAt(path);
start = v = holes.elementAt(path);
do
{
if (l[i].hasIntersections(v))
@ -886,7 +872,7 @@ public class Area implements Shape, Cloneable
// but encloses a hole?
Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
for (int path = 0; path < holes.size(); path++)
if (! ((Segment) holes.elementAt(path)).isSegmentOutside(r))
if (! holes.elementAt(path).isSegmentOutside(r))
return false;
return true;
@ -938,7 +924,7 @@ public class Area implements Shape, Cloneable
{
Segment v;
Segment start;
start = v = (Segment) solids.elementAt(path);
start = v = solids.elementAt(path);
do
{
if (l[i].hasIntersections(v))
@ -951,7 +937,7 @@ public class Area implements Shape, Cloneable
{
Segment v;
Segment start;
start = v = (Segment) holes.elementAt(path);
start = v = holes.elementAt(path);
do
{
if (l[i].hasIntersections(v))
@ -967,7 +953,7 @@ public class Area implements Shape, Cloneable
return true;
// What if the rectangle encloses the whole shape?
Point2D p = ((Segment) solids.elementAt(0)).getMidPoint();
Point2D p = solids.elementAt(0).getMidPoint();
if ((new Rectangle2D.Double(x, y, w, h)).contains(p))
return true;
return false;
@ -1020,7 +1006,7 @@ public class Area implements Shape, Cloneable
*/
private class AreaIterator implements PathIterator
{
private Vector segments;
private Vector<IteratorSegment> segments;
private int index;
private AffineTransform at;
@ -1045,14 +1031,14 @@ public class Area implements Shape, Cloneable
{
this.at = at;
index = 0;
segments = new Vector();
Vector allpaths = new Vector();
segments = new Vector<IteratorSegment>();
Vector<Segment> allpaths = new Vector<Segment>();
allpaths.addAll(solids);
allpaths.addAll(holes);
for (int i = 0; i < allpaths.size(); i++)
{
Segment v = (Segment) allpaths.elementAt(i);
Segment v = allpaths.elementAt(i);
Segment start = v;
IteratorSegment is = new IteratorSegment();
@ -1078,7 +1064,7 @@ public class Area implements Shape, Cloneable
public int currentSegment(double[] coords)
{
IteratorSegment s = (IteratorSegment) segments.elementAt(index);
IteratorSegment s = segments.elementAt(index);
if (at != null)
at.transform(s.coords, 0, coords, 0, 3);
else
@ -1089,7 +1075,7 @@ public class Area implements Shape, Cloneable
public int currentSegment(float[] coords)
{
IteratorSegment s = (IteratorSegment) segments.elementAt(index);
IteratorSegment s = segments.elementAt(index);
double[] d = new double[6];
if (at != null)
{
@ -1129,13 +1115,13 @@ public class Area implements Shape, Cloneable
*
* Returns a Vector of the resulting paths.
*/
private Vector weilerAtherton(Vector segments)
private Vector<Segment> weilerAtherton(Vector<Segment> segments)
{
Vector paths = new Vector();
Vector<Segment> paths = new Vector<Segment>();
while (segments.size() > 0)
{
// Iterate over the path
Segment start = (Segment) segments.elementAt(0);
Segment start = segments.elementAt(0);
Segment s = start;
do
{
@ -1252,7 +1238,7 @@ public class Area implements Shape, Cloneable
double[] temp = new double[2];
temp[0] = t1 + s * w1;
temp[1] = t2 + t * w1;
cc_intersections.add(temp);
ccIntersections.add(temp);
return;
}
@ -1328,28 +1314,28 @@ public class Area implements Shape, Cloneable
if (! r1.intersects(r2))
return null;
cc_intersections = new Vector();
ccIntersections = new Vector<double[]>();
recursiveSubdivide(curve1.getCubicCurve2D(), curve2.getCubicCurve2D(),
getRecursionDepth(curve1), getRecursionDepth(curve2),
0.0, 0.0, 1.0, 1.0);
if (cc_intersections.size() == 0)
if (ccIntersections.size() == 0)
return null;
Intersection[] results = new Intersection[cc_intersections.size()];
for (int i = 0; i < cc_intersections.size(); i++)
Intersection[] results = new Intersection[ccIntersections.size()];
for (int i = 0; i < ccIntersections.size(); i++)
{
double[] temp = (double[]) cc_intersections.elementAt(i);
double[] temp = ccIntersections.elementAt(i);
results[i] = new Intersection(curve1.evaluatePoint(temp[0]), temp[0],
temp[1]);
}
cc_intersections = null;
ccIntersections = null;
return (results);
}
/**
* Returns the intersections between a line and a quadratic bezier
* Or null if no intersections are found1
* Or null if no intersections are found.
* This is done through combining the line's equation with the
* parametric form of the Bezier and solving the resulting quadratic.
* This is package-private to avoid an accessor method.
@ -1622,9 +1608,9 @@ public class Area implements Shape, Cloneable
* Helper method
* Turns a shape into a Vector of Segments
*/
private Vector makeSegment(Shape s)
private Vector<Segment> makeSegment(Shape s)
{
Vector paths = new Vector();
Vector<Segment> paths = new Vector<Segment>();
PathIterator pi = s.getPathIterator(null);
double[] coords = new double[6];
Segment subpath = null;
@ -1786,7 +1772,7 @@ public class Area implements Shape, Cloneable
}
while (a != A); // until one wrap.
return (nNodes);
return nNodes;
}
/**
@ -1824,7 +1810,7 @@ public class Area implements Shape, Cloneable
* solid areas) Clears any nodes. Sorts the remaining paths into solids
* and holes, sets their orientation and sets the solids and holes lists.
*/
private void deleteRedundantPaths(Vector paths)
private void deleteRedundantPaths(Vector<Segment> paths)
{
int npaths = paths.size();
@ -1836,19 +1822,19 @@ public class Area implements Shape, Cloneable
neg = ((windingRule == PathIterator.WIND_NON_ZERO) ? -1 : 1);
for (int i = 0; i < npaths; i++)
bb[i] = ((Segment) paths.elementAt(i)).getPathBounds();
bb[i] = paths.elementAt(i).getPathBounds();
// Find which path contains which, assign winding numbers
for (int i = 0; i < npaths; i++)
{
Segment pathA = (Segment) paths.elementAt(i);
Segment pathA = paths.elementAt(i);
pathA.nullNodes(); // remove any now-redundant nodes, in case.
int windingA = pathA.hasClockwiseOrientation() ? 1 : neg;
for (int j = 0; j < npaths; j++)
if (i != j)
{
Segment pathB = (Segment) paths.elementAt(j);
Segment pathB = paths.elementAt(j);
// A contains B
if (bb[i].intersects(bb[j]))
@ -1876,8 +1862,8 @@ public class Area implements Shape, Cloneable
windingNumbers[i][1] = contains[i][i];
}
Vector solids = new Vector();
Vector holes = new Vector();
Vector<Segment> solids = new Vector<Segment>();
Vector<Segment> holes = new Vector<Segment>();
if (windingRule == PathIterator.WIND_NON_ZERO)
{
@ -1913,12 +1899,12 @@ public class Area implements Shape, Cloneable
* @param clockwise gives the direction,
* true = clockwise, false = counter-clockwise
*/
private void setDirection(Vector paths, boolean clockwise)
private void setDirection(Vector<Segment> paths, boolean clockwise)
{
Segment v;
for (int i = 0; i < paths.size(); i++)
{
v = (Segment) paths.elementAt(i);
v = paths.elementAt(i);
if (clockwise != v.hasClockwiseOrientation())
v.reverseAll();
}
@ -2157,7 +2143,7 @@ public class Area implements Shape, Cloneable
*/
Segment cloneSegmentList() throws CloneNotSupportedException
{
Vector list = new Vector();
Vector<Segment> list = new Vector<Segment>();
Segment v = next;
while (v != this)
@ -2170,7 +2156,7 @@ public class Area implements Shape, Cloneable
v = clone;
for (int i = 0; i < list.size(); i++)
{
clone.next = (Segment) ((Segment) list.elementAt(i)).clone();
clone.next = (Segment) list.elementAt(i).clone();
clone = clone.next;
}
clone.next = v;
@ -2209,7 +2195,7 @@ public class Area implements Shape, Cloneable
*/
protected int createNodes(Segment b, Intersection[] x)
{
Vector v = new Vector();
Vector<Intersection> v = new Vector<Intersection>();
for (int i = 0; i < x.length; i++)
{
Point2D p = x[i].p;
@ -2222,7 +2208,7 @@ public class Area implements Shape, Cloneable
Intersection[] A = new Intersection[nNodes];
Intersection[] B = new Intersection[nNodes];
for (int i = 0; i < nNodes; i++)
A[i] = B[i] = (Intersection) v.elementAt(i);
A[i] = B[i] = v.elementAt(i);
// Create two lists sorted by the parameter
// Bubble sort, OK I suppose, since the number of intersections