Browse Source

Checkstyle: indentation/whitespace (cf master)

master
Gintas Grigelionis 7 years ago
parent
commit
1909e147ee
3 changed files with 89 additions and 92 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  2. +87
    -90
      src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java
  3. +1
    -1
      src/tests/junit/org/apache/tools/ant/BuildFileRule.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/MacroDef.java View File

@@ -670,7 +670,7 @@ public class MacroDef extends AntlibDefinition {
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
return true;
}
if (obj == null || !obj.getClass().equals(getClass())) {
return false;


+ 87
- 90
src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java View File

@@ -28,77 +28,76 @@ import java.util.NoSuchElementException;
*/
public final class Enumerations {

private Enumerations() {
}
private Enumerations() {
}

/**
* creates an enumeration from an array of objects.
* @param array the array of object to enumerate.
* @return the enumeration over the array of objects.
*/
public static Enumeration fromArray(Object[] array) {
return new ArrayEnumeration(array);
}
/**
* creates an enumeration from an array of objects.
* @param array the array of object to enumerate.
* @return the enumeration over the array of objects.
*/
public static Enumeration fromArray(Object[] array) {
return new ArrayEnumeration(array);
}

/**
* creates an enumeration from an array of enumeration. The created enumeration
* will sequentially enumerate over all elements of each enumeration and skip
* <tt>null</tt> enumeration elements in the array.
* @param enums the array of enumerations.
* @return the enumeration over the array of enumerations.
*/
public static Enumeration fromCompound(Enumeration[] enums) {
return new CompoundEnumeration(enums);
}
/**
* creates an enumeration from an array of enumeration. The created enumeration
* will sequentially enumerate over all elements of each enumeration and skip
* <tt>null</tt> enumeration elements in the array.
* @param enums the array of enumerations.
* @return the enumeration over the array of enumerations.
*/
public static Enumeration fromCompound(Enumeration[] enums) {
return new CompoundEnumeration(enums);
}

}


/**
* Convenient enumeration over an array of objects.
*/
class ArrayEnumeration implements Enumeration {

/** object array */
private Object[] array;
/** object array */
private Object[] array;

/** current index */
private int pos;
/** current index */
private int pos;

/**
* Initialize a new enumeration that wraps an array.
* @param array the array of object to enumerate.
*/
public ArrayEnumeration(Object[] array) {
this.array = array;
this.pos = 0;
}
/**
* Tests if this enumeration contains more elements.
*
* @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide;
* <code>false</code> otherwise.
*/
public boolean hasMoreElements() {
return (pos < array.length);
}
/**
* Initialize a new enumeration that wraps an array.
* @param array the array of object to enumerate.
*/
public ArrayEnumeration(Object[] array) {
this.array = array;
this.pos = 0;
}
/**
* Tests if this enumeration contains more elements.
*
* @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide;
* <code>false</code> otherwise.
*/
public boolean hasMoreElements() {
return (pos < array.length);
}

/**
* Returns the next element of this enumeration if this enumeration
* object has at least one more element to provide.
*
* @return the next element of this enumeration.
* @throws NoSuchElementException if no more elements exist.
*/
public Object nextElement() throws NoSuchElementException {
if (hasMoreElements()) {
Object o = array[pos];
pos++;
return o;
}
throw new NoSuchElementException();
/**
* Returns the next element of this enumeration if this enumeration
* object has at least one more element to provide.
*
* @return the next element of this enumeration.
* @throws NoSuchElementException if no more elements exist.
*/
public Object nextElement() throws NoSuchElementException {
if (hasMoreElements()) {
Object o = array[pos];
pos++;
return o;
}
throw new NoSuchElementException();
}
}
/**
* Convenient enumeration over an array of enumeration. For example:
@@ -130,48 +129,46 @@ class ArrayEnumeration implements Enumeration {
* }
* </pre>
*/
class CompoundEnumeration implements Enumeration {
class CompoundEnumeration implements Enumeration {

/** enumeration array */
private Enumeration[] enumArray;
/** enumeration array */
private Enumeration[] enumArray;

/** index in the enums array */
private int index = 0;
/** index in the enums array */
private int index = 0;

public CompoundEnumeration(Enumeration[] enumarray) {
this.enumArray = enumarray;
this.enumArray = enumarray;
}

/**
* Tests if this enumeration contains more elements.
*
* @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide;
* <code>false</code> otherwise.
*/
/**
* Tests if this enumeration contains more elements.
*
* @return <code>true</code> if and only if this enumeration object
* contains at least one more element to provide;
* <code>false</code> otherwise.
*/
public boolean hasMoreElements() {
while (index < enumArray.length) {
if (enumArray[index] != null && enumArray[index].hasMoreElements()) {
return true;
}
index++;
}
return false;
while (index < enumArray.length) {
if (enumArray[index] != null && enumArray[index].hasMoreElements()) {
return true;
}
index++;
}
return false;
}

/**
* Returns the next element of this enumeration if this enumeration
* object has at least one more element to provide.
*
* @return the next element of this enumeration.
* @throws NoSuchElementException if no more elements exist.
*/
/**
* Returns the next element of this enumeration if this enumeration
* object has at least one more element to provide.
*
* @return the next element of this enumeration.
* @throws NoSuchElementException if no more elements exist.
*/
public Object nextElement() throws NoSuchElementException {
if (hasMoreElements()) {
return enumArray[index].nextElement();
}
throw new NoSuchElementException();
if (hasMoreElements()) {
return enumArray[index].nextElement();
}
throw new NoSuchElementException();
}
}



+ 1
- 1
src/tests/junit/org/apache/tools/ant/BuildFileRule.java View File

@@ -170,7 +170,7 @@ public class BuildFileRule extends ExternalResource {
*
* @param targetName the target in the currently configured build file to run.
*/
public void executeTarget(String targetName) {
public void executeTarget(String targetName) {
outputBuffer = new StringBuffer();
PrintStream out = new PrintStream(new AntOutputStream(outputBuffer));
errorBuffer = new StringBuffer();


Loading…
Cancel
Save