You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/12/08 06:09:11 UTC
cvs commit: maven-components/maven-project/src/test/org/apache/maven/project project.xml
jvanzyl 2003/12/07 21:09:11
Modified: maven-project/src/java/org/apache/maven/project
DefaultProjectBuilder.java ProjectBuilder.java
maven-project/src/java/org/apache/maven/util
CollectionUtils.java
maven-project/src/test/org/apache/maven/project project.xml
Log:
o everything is working now, the first set of tests are in place and we're
at 55% coverage. Won't take long to get to ~100% coverage and then the
fun will begin as a huge slew of tests will be added.
Revision Changes Path
1.9 +4 -9 maven-components/maven-project/src/java/org/apache/maven/project/DefaultProjectBuilder.java
Index: DefaultProjectBuilder.java
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/java/org/apache/maven/project/DefaultProjectBuilder.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultProjectBuilder.java 8 Dec 2003 04:52:10 -0000 1.8
+++ DefaultProjectBuilder.java 8 Dec 2003 05:09:11 -0000 1.9
@@ -63,16 +63,10 @@
public Project build( File project )
throws Exception
{
- return getProject( project, true );
+ return build( project, true );
}
- public Project getProject( File project )
- throws Exception
- {
- return getProject( project, true );
- }
-
- public Project getProject( File projectDescriptor, boolean useParentPom )
+ public Project build( File projectDescriptor, boolean useParentPom )
throws Exception
{
Project project = new Project();
@@ -399,7 +393,8 @@
for ( int i = 0; i < files.length; i++ )
{
- Project p = getProject( new File( files[i] ) );
+ Project p = build( new File( files[i] ) );
+
projects.add( p );
}
1.6 +0 -3 maven-components/maven-project/src/java/org/apache/maven/project/ProjectBuilder.java
Index: ProjectBuilder.java
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/java/org/apache/maven/project/ProjectBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProjectBuilder.java 8 Dec 2003 04:52:10 -0000 1.5
+++ ProjectBuilder.java 8 Dec 2003 05:09:11 -0000 1.6
@@ -11,9 +11,6 @@
static String DEFAULTS_PROPERTIES = "driver.properties";
- Project getProject( File project )
- throws Exception;
-
Project build( File project )
throws Exception;
}
1.2 +0 -200 maven-components/maven-project/src/java/org/apache/maven/util/CollectionUtils.java
Index: CollectionUtils.java
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/java/org/apache/maven/util/CollectionUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CollectionUtils.java 1 Sep 2003 16:06:22 -0000 1.1
+++ CollectionUtils.java 8 Dec 2003 05:09:11 -0000 1.2
@@ -127,36 +127,6 @@
return result;
}
-
- /**
- * Returns a {@link Collection} containing the union
- * of the given {@link Collection}s.
- * <p>
- * The cardinality of each element in the returned {@link Collection}
- * will be equal to the maximum of the cardinality of that element
- * in the two given {@link Collection}s.
- *
- * @see Collection#addAll
- */
- public static Collection union( final Collection a, final Collection b )
- {
- ArrayList list = new ArrayList();
- Map mapa = getCardinalityMap( a );
- Map mapb = getCardinalityMap( b );
- Set elts = new HashSet( a );
- elts.addAll( b );
- Iterator it = elts.iterator();
- while ( it.hasNext() )
- {
- Object obj = it.next();
- for ( int i = 0,m = Math.max( getFreq( obj, mapa ), getFreq( obj, mapb ) ); i < m; i++ )
- {
- list.add( obj );
- }
- }
- return list;
- }
-
/**
* Returns a {@link Collection} containing the intersection
* of the given {@link Collection}s.
@@ -166,7 +136,6 @@
* in the two given {@link Collection}s.
*
* @see Collection#retainAll
- * @see #containsAny
*/
public static Collection intersection( final Collection a, final Collection b )
{
@@ -188,38 +157,6 @@
}
/**
- * Returns a {@link Collection} containing the exclusive disjunction
- * (symmetric difference) of the given {@link Collection}s.
- * <p>
- * The cardinality of each element <i>e</i> in the returned {@link Collection}
- * will be equal to
- * <tt>max(cardinality(<i>e</i>,<i>a</i>),cardinality(<i>e</i>,<i>b</i>)) - min(cardinality(<i>e</i>,<i>a</i>),cardinality(<i>e</i>,<i>b</i>))</tt>.
- * <p>
- * This is equivalent to
- * <tt>{@link #subtract subtract}({@link #union union(a,b)},{@link #intersection intersection(a,b)})</tt>
- * or
- * <tt>{@link #union union}({@link #subtract subtract(a,b)},{@link #subtract subtract(b,a)})</tt>.
- */
- public static Collection disjunction( final Collection a, final Collection b )
- {
- ArrayList list = new ArrayList();
- Map mapa = getCardinalityMap( a );
- Map mapb = getCardinalityMap( b );
- Set elts = new HashSet( a );
- elts.addAll( b );
- Iterator it = elts.iterator();
- while ( it.hasNext() )
- {
- Object obj = it.next();
- for ( int i = 0,m = ( ( Math.max( getFreq( obj, mapa ), getFreq( obj, mapb ) ) ) - ( Math.min( getFreq( obj, mapa ), getFreq( obj, mapb ) ) ) ); i < m; i++ )
- {
- list.add( obj );
- }
- }
- return list;
- }
-
- /**
* Returns a {@link Collection} containing <tt><i>a</i> - <i>b</i></tt>.
* The cardinality of each element <i>e</i> in the returned {@link Collection}
* will be the cardinality of <i>e</i> in <i>a</i> minus the cardinality
@@ -239,33 +176,6 @@
}
/**
- * Returns <code>true</code> iff some element of <i>a</i>
- * is also an element of <i>b</i> (or, equivalently, if
- * some element of <i>b</i> is also an element of <i>a</i>).
- * In other words, this method returns <code>true</code>
- * iff the {@link #intersection} of <i>a</i> and <i>b</i>
- * is not empty.
- * @since 2.1
- * @param a a non-<code>null</code> Collection
- * @param b a non-<code>null</code> Collection
- * @return <code>true</code> iff the intersection of <i>a</i> and <i>b</i> is non-empty
- * @see #intersection
- */
- public static boolean containsAny( final Collection a, final Collection b )
- {
- // TO DO: we may be able to optimize this by ensuring either a or b
- // is the larger of the two Collections, but I'm not sure which.
- for ( Iterator iter = a.iterator(); iter.hasNext(); )
- {
- if ( b.contains( iter.next() ) )
- {
- return true;
- }
- }
- return false;
- }
-
- /**
* Returns a {@link Map} mapping each unique element in
* the given {@link Collection} to an {@link Integer}
* representing the number of occurances of that element
@@ -288,116 +198,6 @@
else
{
count.put( obj, new Integer( c.intValue() + 1 ) );
- }
- }
- return count;
- }
-
- /**
- * Returns <tt>true</tt> iff <i>a</i> is a sub-collection of <i>b</i>,
- * that is, iff the cardinality of <i>e</i> in <i>a</i> is less
- * than or equal to the cardinality of <i>e</i> in <i>b</i>,
- * for each element <i>e</i> in <i>a</i>.
- *
- * @see #isProperSubCollection
- * @see Collection#containsAll
- */
- public static boolean isSubCollection( final Collection a, final Collection b )
- {
- Map mapa = getCardinalityMap( a );
- Map mapb = getCardinalityMap( b );
- Iterator it = a.iterator();
- while ( it.hasNext() )
- {
- Object obj = it.next();
- if ( getFreq( obj, mapa ) > getFreq( obj, mapb ) )
- {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns <tt>true</tt> iff <i>a</i> is a <i>proper</i> sub-collection of <i>b</i>,
- * that is, iff the cardinality of <i>e</i> in <i>a</i> is less
- * than or equal to the cardinality of <i>e</i> in <i>b</i>,
- * for each element <i>e</i> in <i>a</i>, and there is at least one
- * element <i>f</i> such that the cardinality of <i>f</i> in <i>b</i>
- * is strictly greater than the cardinality of <i>f</i> in <i>a</i>.
- *
- * @see #isSubCollection
- * @see Collection#containsAll
- */
- public static boolean isProperSubCollection( final Collection a, final Collection b )
- {
- // XXX optimize me!
- return CollectionUtils.isSubCollection( a, b ) && ( !( CollectionUtils.isEqualCollection( a, b ) ) );
- }
-
- /**
- * Returns <tt>true</tt> iff the given {@link Collection}s contain
- * exactly the same elements with exactly the same cardinality.
- * <p>
- * That is, iff the cardinality of <i>e</i> in <i>a</i> is
- * equal to the cardinality of <i>e</i> in <i>b</i>,
- * for each element <i>e</i> in <i>a</i> or <i>b</i>.
- */
- public static boolean isEqualCollection( final Collection a, final Collection b )
- {
- if ( a.size() != b.size() )
- {
- return false;
- }
- else
- {
- Map mapa = getCardinalityMap( a );
- Map mapb = getCardinalityMap( b );
- if ( mapa.size() != mapb.size() )
- {
- return false;
- }
- else
- {
- Iterator it = mapa.keySet().iterator();
- while ( it.hasNext() )
- {
- Object obj = it.next();
- if ( getFreq( obj, mapa ) != getFreq( obj, mapb ) )
- {
- return false;
- }
- }
- return true;
- }
- }
- }
-
- /**
- * Returns the number of occurrences of <i>obj</i>
- * in <i>col</i>.
- */
- public static int cardinality( Object obj, final Collection col )
- {
- int count = 0;
- if ( null == obj )
- {
- for ( Iterator it = col.iterator(); it.hasNext(); )
- {
- if ( null == it.next() )
- {
- count++;
- }
- }
- }
- else
- {
- for ( Iterator it = col.iterator(); it.hasNext(); )
- {
- if ( obj.equals( it.next() ) )
- {
- count++;
- }
}
}
return count;
1.2 +2 -2 maven-components/maven-project/src/test/org/apache/maven/project/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-project/src/test/org/apache/maven/project/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 1 Sep 2003 16:06:26 -0000 1.1
+++ project.xml 8 Dec 2003 05:09:11 -0000 1.2
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
- <pomVersion>3</pomVersion>
+ <modelVersion>3</modelVersion>
<groupId>maven</groupId>
<artifactId>maven</artifactId>
<name>Maven</name>
- <currentVersion>1.0-beta-9</currentVersion>
+ <version>1.0-beta-9</version>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<description>Description</description>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org