MyStack
This commit is contained in:
@@ -211,25 +211,28 @@ public class Circle2D {
|
||||
|
||||
int idealCount = 0;
|
||||
int actualCount = 0;
|
||||
int arrayIndex = 0;
|
||||
for (int i = 0; i < oldArray.length; ++i) {
|
||||
actualCount = 0;
|
||||
for (int j = 0; j < oldArray.length; ++j) {
|
||||
boolean doesOverlap = oldArray[i].overlaps(oldArray[j]);
|
||||
if (doesOverlap) {
|
||||
++actualCount;
|
||||
int arrayIndex2 = 0;
|
||||
for (int arrayIndex = 0; arrayIndex < oldArray.length; ++arrayIndex) {
|
||||
for (int i = 0; i < oldArray.length; ++i) {
|
||||
actualCount = 0;
|
||||
for (int j = 0; j < oldArray.length; ++j) {
|
||||
boolean doesOverlap = oldArray[i].overlaps(oldArray[j]);
|
||||
if (doesOverlap) {
|
||||
++actualCount;
|
||||
}
|
||||
}
|
||||
if (actualCount == idealCount) {
|
||||
array[arrayIndex2] = oldArray[i];
|
||||
System.out.println(oldArray[i]);
|
||||
arrayIndex2++;
|
||||
}
|
||||
idealCount++;
|
||||
}
|
||||
if (actualCount == idealCount) {
|
||||
array[arrayIndex] = oldArray[i];
|
||||
System.out.println(oldArray[i]);
|
||||
arrayIndex++;
|
||||
}
|
||||
idealCount++;
|
||||
}
|
||||
System.out.println();
|
||||
return array;
|
||||
}
|
||||
System.out.println();
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
public static void print(Circle2D[] array)
|
||||
{
|
||||
@@ -272,7 +275,7 @@ public class Circle2D {
|
||||
printPerimeter(circleArray);
|
||||
Circle2D[] sortedArray = sortCirclesByPerimeter(circleArray);
|
||||
printPerimeter(sortedArray);
|
||||
print(circleArray);
|
||||
print(circleArray);
|
||||
Circle2D[] overlapArray = Circle2D.sortCirclesByNumberOfTimesOverlapping(circleArray);
|
||||
print(overlapArray);
|
||||
|
||||
|
Reference in New Issue
Block a user