harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r823778 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java
Date Sat, 10 Oct 2009 03:40:19 GMT
Author: ndbeyer
Date: Sat Oct 10 03:40:18 2009
New Revision: 823778

URL: http://svn.apache.org/viewvc?rev=823778&view=rev
Log:
formatting cleanup - remove tabs, etc - no functional changes

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java?rev=823778&r1=823777&r2=823778&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/geom/CrossingHelper.java
Sat Oct 10 03:40:18 2009
@@ -26,7 +26,7 @@
     private double[][] coords;
     private int[] sizes;
     private List<IntersectPoint> isectPoints = new ArrayList<IntersectPoint>();
-   
+
     public CrossingHelper(double[][] coords, int[] sizes) {
         this.coords = coords;
         this.sizes = sizes;
@@ -36,11 +36,11 @@
         int pointCount1 = sizes[0] / 2;
         int pointCount2 = sizes[1] / 2;
         int[] indices = new int[pointCount1 + pointCount2];
-        
+
         for(int i = 0; i < pointCount1 + pointCount2; i++) {
             indices[i] = i;
         }
-        
+
         sort(coords[0], pointCount1, coords[1], pointCount2, indices);
         // the set for the shapes edges storing
         List<Edge> edges = new ArrayList<Edge>();
@@ -52,42 +52,42 @@
             if (indices[i] < pointCount1) {
                 begIndex = indices[i];
                 endIndex = indices[i] - 1;
-                
+
                 if (endIndex < 0) {
                     endIndex = pointCount1 - 1;
                 }
-                
+
                 areaNumber = 0;
             } else if (indices[i] < pointCount1 + pointCount2) {
                 begIndex = indices[i] - pointCount1;
                 endIndex = indices[i] - 1 - pointCount1;
-                
+
                 if (endIndex < 0) {
                     endIndex = pointCount2 - 1;
                 }
-                
+
                 areaNumber = 1;
             } else {
                 throw new IndexOutOfBoundsException();
             }
-            
+
             if (!removeEdge(edges, begIndex, endIndex)) {
                 edge = new Edge(begIndex, endIndex, areaNumber);
-                intersectShape(edges, coords[0], pointCount1, 
-                		       coords[1], pointCount2, edge);
+                intersectShape(edges, coords[0], pointCount1,
+                        coords[1], pointCount2, edge);
                 edges.add(edge);
             }
-            
+
             begIndex = indices[i];
             endIndex = indices[i] + 1;
-            
+
             if ((begIndex < pointCount1) && (endIndex == pointCount1)) {
                 endIndex = 0;
-            } else if ((begIndex >= pointCount1) && 
-            		   (endIndex == (pointCount2 + pointCount1))) {
+            } else if ((begIndex >= pointCount1) &&
+                    (endIndex == (pointCount2 + pointCount1))) {
                 endIndex = pointCount1;
             }
-            
+
             if (endIndex < pointCount1) {
                 areaNumber = 0;
             } else {
@@ -95,36 +95,36 @@
                 endIndex -= pointCount1;
                 begIndex -= pointCount1;
             }
-            
+
             if (!removeEdge(edges, begIndex, endIndex)) {
                 edge = new Edge(begIndex, endIndex, areaNumber);
-                intersectShape(edges, coords[0], pointCount1, 
-                		       coords[1], pointCount2, edge);
+                intersectShape(edges, coords[0], pointCount1,
+                        coords[1], pointCount2, edge);
                 edges.add(edge);
             }
         }
-        
+
         return isectPoints.toArray(new IntersectPoint[isectPoints.size()]);
     }
 
     private boolean removeEdge(List<Edge> edges,  int begIndex, int endIndex) {
-    	
+
         for (Edge edge : edges) {
             if (edge.reverseCompare(begIndex, endIndex)) {
                 edges.remove(edge);
                 return true;
             }
         }
-        
+
         return false;
     }
 
     // return the quantity of intersect points
     private void intersectShape(List<Edge> edges,
-                               double[] coords1, int length1, 
-                               double[] coords2, int length2,
-                               Edge initEdge) {
-    	int areaOfEdge1, areaOfEdge2;
+            double[] coords1, int length1,
+            double[] coords2, int length2,
+            Edge initEdge) {
+        int areaOfEdge1, areaOfEdge2;
         int initBegin, initEnd;
         int addBegin, addEnd;
         double x1, y1, x2, y2, x3, y3, x4, y4;
@@ -136,37 +136,37 @@
             y1 = coords1[2* initEdge.begIndex + 1];
             x2 = coords1[2* initEdge.endIndex];
             y2 = coords1[2* initEdge.endIndex + 1];
-        	areaOfEdge1 = 0;
+            areaOfEdge1 = 0;
         } else {
             x1 = coords2[2* initEdge.begIndex];
             y1 = coords2[2* initEdge.begIndex + 1];
             x2 = coords2[2* initEdge.endIndex];
             y2 = coords2[2* initEdge.endIndex + 1];
-        	areaOfEdge1 = 1;
+            areaOfEdge1 = 1;
         }
- 
+
         for (Iterator<Edge> iter = edges.iterator(); iter.hasNext(); ) {
-        	edge = iter.next();
-        	
+            edge = iter.next();
+
             if (edge.areaNumber == 0) {
                 x3 = coords1[2* edge.begIndex];
                 y3 = coords1[2* edge.begIndex + 1];
                 x4 = coords1[2* edge.endIndex];
                 y4 = coords1[2* edge.endIndex + 1];
-            	areaOfEdge2 = 0;
+                areaOfEdge2 = 0;
             } else {
                 x3 = coords2[2* edge.begIndex];
                 y3 = coords2[2* edge.begIndex + 1];
                 x4 = coords2[2* edge.endIndex];
                 y4 = coords2[2* edge.endIndex + 1];
-            	areaOfEdge2 = 1;
+                areaOfEdge2 = 1;
             }
-            
+
             if ((areaOfEdge1 != areaOfEdge2) &&
-                (GeometryUtil.intersectLines(
-                    		x1, y1, x2, y2, x3, y3, x4, y4, point) == 1) &&
-                (!containsPoint(point))) {
- 
+                    (GeometryUtil.intersectLines(
+                            x1, y1, x2, y2, x3, y3, x4, y4, point) == 1) &&
+                            (!containsPoint(point))) {
+
                 if (initEdge.areaNumber == 0) {
                     initBegin = initEdge.begIndex;
                     initEnd = initEdge.endIndex;
@@ -178,34 +178,34 @@
                     addBegin = initEdge.begIndex;
                     addEnd = initEdge.endIndex;
                 }
-                
-                if (((initEnd == length1 - 1) && 
-                	 (initBegin == 0 && initEnd > initBegin)) || 
-                	(((initEnd != length1 - 1) || (initBegin != 0)) && 
-                	 ((initBegin != length1 - 1) || (initEnd != 0)) && 
-                	  (initBegin > initEnd))) {
-                	
+
+                if (((initEnd == length1 - 1) &&
+                        (initBegin == 0 && initEnd > initBegin)) ||
+                        (((initEnd != length1 - 1) || (initBegin != 0)) &&
+                                ((initBegin != length1 - 1) || (initEnd != 0)) &&
+                                (initBegin > initEnd))) {
+
                     int temp = initBegin;
                     initBegin = initEnd;
                     initEnd = temp;
                 }
-                
-                if (((addEnd == length2 - 1) && (addBegin == 0) && (addEnd
> addBegin)) || 
-                	(((addEnd != length2 - 1) || (addBegin != 0)) && 
-                	  ((addBegin != length2 - 1) || (addEnd != 0)) && (addBegin >
addEnd))) {
-                	
+
+                if (((addEnd == length2 - 1) && (addBegin == 0) && (addEnd
> addBegin)) ||
+                        (((addEnd != length2 - 1) || (addBegin != 0)) &&
+                                ((addBegin != length2 - 1) || (addEnd != 0)) && (addBegin
> addEnd))) {
+
                     int temp = addBegin;
                     addBegin = addEnd;
                     addEnd = temp;
                 }
-     
+
                 IntersectPoint ip;
                 for (Iterator<IntersectPoint> i = isectPoints.iterator(); i.hasNext();
) {
-                	ip = i.next();
-                	
-                    if ((initBegin == ip.getBegIndex(true)) && 
-                    	(initEnd == ip.getEndIndex(true))) {
-                    	
+                    ip = i.next();
+
+                    if ((initBegin == ip.getBegIndex(true)) &&
+                            (initEnd == ip.getEndIndex(true))) {
+
                         if (compare(ip.getX(), ip.getY(), point[0], point[1]) > 0) {
                             initEnd = - (isectPoints.indexOf(ip) + 1);
                             ip.setBegIndex1(-(isectPoints.size() + 1));
@@ -214,10 +214,10 @@
                             ip.setEndIndex1(-(isectPoints.size() + 1));
                         }
                     }
-                    
-                    if ((addBegin == ip.getBegIndex(false)) && 
-                    	(addEnd == ip.getEndIndex(false))) {
-                    	
+
+                    if ((addBegin == ip.getBegIndex(false)) &&
+                            (addEnd == ip.getEndIndex(false))) {
+
                         if (compare(ip.getX(), ip.getY(), point[0], point[1]) > 0) {
                             addEnd = - (isectPoints.indexOf(ip) + 1);
                             ip.setBegIndex2(-(isectPoints.size() + 1));
@@ -227,18 +227,18 @@
                         }
                     }
                 }
-                
-                isectPoints.add(new IntersectPoint(initBegin, initEnd, 
-                		                           addBegin, addEnd, 
-                								   point[0], point[1]));
+
+                isectPoints.add(new IntersectPoint(initBegin, initEnd,
+                        addBegin, addEnd,
+                        point[0], point[1]));
             }
         }
     }
 
     // the array sorting
     private static void sort(double[] coords1, int length1,
-                             double[] coords2, int length2,
-                             int[] array) {
+            double[] coords2, int length2,
+            int[] array) {
         int temp;
         int length = length1 + length2;
         double x1, y1, x2, y2;
@@ -260,7 +260,7 @@
             }
             int j = i;
             while (j > 0 && compare(x1, y1, x2, y2) <= 0) {
-            	temp = array[j];
+                temp = array[j];
                 array[j] = array[j-1];
                 array[j-1] = temp;
                 j--;
@@ -283,29 +283,29 @@
             }
         }
     }
-    
+
     public boolean containsPoint(double[] point) {
-    	IntersectPoint ipoint;
-    	
-    	for (Iterator<IntersectPoint> i = isectPoints.iterator(); i.hasNext(); ) {
-        	ipoint = i.next();
-        	
-        	if (ipoint.getX() == point[0] && ipoint.getY() == point[1]) {
-        		return true;
-        	}
-    	}
-    	
-    	return false;
+        IntersectPoint ipoint;
+
+        for (Iterator<IntersectPoint> i = isectPoints.iterator(); i.hasNext(); ) {
+            ipoint = i.next();
+
+            if (ipoint.getX() == point[0] && ipoint.getY() == point[1]) {
+                return true;
+            }
+        }
+
+        return false;
     }
 
     public static int compare(double x1, double y1, double x2, double y2) {
-    	
-    	if ((x1 < x2) || (x1 == x2 && y1 < y2)) {
-    		return 1;
-    	} else if (x1 == x2 && y1 == y2) {
-    		return 0;
-    	}
-    	
+
+        if ((x1 < x2) || (x1 == x2 && y1 < y2)) {
+            return 1;
+        } else if (x1 == x2 && y1 == y2) {
+            return 0;
+        }
+
         return -1;
     }
 



Mime
View raw message