Browse Source

Remove some unused cruft

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271267 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
e055d2d5ad
6 changed files with 18 additions and 230 deletions
  1. +2
    -13
      proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java
  2. +7
    -38
      proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java
  3. +0
    -64
      proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java
  4. +2
    -13
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java
  5. +7
    -38
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java
  6. +0
    -64
      proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java

+ 2
- 13
proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.tools.ant.types;// java io classes
package org.apache.tools.ant.types;

import java.io.File;
import java.io.FileInputStream;
@@ -81,7 +81,7 @@ public class FilterSet
*
* @param filter The feature to be added to the Filter attribute
*/
public void addFilter( Filter filter )
public void addFilter( final Filter filter )
{
m_filters.add( filter );
}
@@ -121,17 +121,6 @@ public class FilterSet
return new FiltersFile();
}*/

/**
* Test to see if this filter set it empty.
*
* @return Return true if there are filter in this set otherwise false.
*/
public boolean hasFilters()
throws TaskException
{
return m_filters.size() > 0;
}

/**
* Read the filters from the given file.
*


+ 7
- 38
proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java View File

@@ -7,14 +7,10 @@
*/
package org.apache.tools.ant.types;// java io classes

// java util classes

import java.util.ArrayList;
import java.util.Iterator;
import org.apache.myrmidon.api.TaskException;

// ant classes

/**
* A FilterSetCollection is a collection of filtersets each of which may have a
* different start/end token settings.
@@ -23,40 +19,11 @@ import org.apache.myrmidon.api.TaskException;
*/
public class FilterSetCollection
{
private ArrayList m_filterSets = new ArrayList();

private ArrayList filterSets = new ArrayList();

public FilterSetCollection()
{
}

public FilterSetCollection( FilterSet filterSet )
public void addFilterSet( final FilterSet filterSet )
{
addFilterSet( filterSet );
}

public void addFilterSet( FilterSet filterSet )
{
filterSets.add( filterSet );
}

/**
* Test to see if this filter set it empty.
*
* @return Return true if there are filter in this set otherwise false.
*/
public boolean hasFilters()
throws TaskException
{
for( Iterator e = filterSets.iterator(); e.hasNext(); )
{
FilterSet filterSet = (FilterSet)e.next();
if( filterSet.hasFilters() )
{
return true;
}
}
return false;
m_filterSets.add( filterSet );
}

/**
@@ -70,9 +37,11 @@ public class FilterSetCollection
throws TaskException
{
String replacedLine = line;
for( Iterator e = filterSets.iterator(); e.hasNext(); )

final Iterator filterSets = m_filterSets.iterator();
while( filterSets.hasNext() )
{
FilterSet filterSet = (FilterSet)e.next();
final FilterSet filterSet = (FilterSet)filterSets.next();
replacedLine = filterSet.replaceTokens( replacedLine );
}
return replacedLine;


+ 0
- 64
proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java View File

@@ -52,70 +52,6 @@ public class FileUtils
return (String[])result.toArray( new String[ result.size() ] );
}

/**
* Convienence method to copy a file from a source to a destination
* specifying if token filtering must be used, if source files may overwrite
* newer destination files and the last modified time of <code>destFile</code>
* file should be made equal to the last modified time of <code>sourceFile</code>
* .
*/
public static void copyFile( final File sourceFile,
final File destFile,
final FilterSetCollection filters )
throws IOException, TaskException
{
if( !destFile.exists() ||
destFile.lastModified() < sourceFile.lastModified() )
{
if( destFile.exists() && destFile.isFile() )
{
destFile.delete();
}

// ensure that parent dir of dest file exists!
// not using getParentFile method to stay 1.1 compat
File parent = destFile.getParentFile();
if( !parent.exists() )
{
parent.mkdirs();
}

if( filters != null && filters.hasFilters() )
{
BufferedReader in = new BufferedReader( new FileReader( sourceFile ) );
BufferedWriter out = new BufferedWriter( new FileWriter( destFile ) );

String newline = null;
String line = in.readLine();
while( line != null )
{
if( line.length() == 0 )
{
out.newLine();
}
else
{
newline = filters.replaceTokens( line );
out.write( newline );
out.newLine();
}
line = in.readLine();
}

IOUtil.shutdownReader( in );
IOUtil.shutdownWriter( out );
}
else
{
final FileInputStream in = new FileInputStream( sourceFile );
final FileOutputStream out = new FileOutputStream( destFile );
IOUtil.copy( in, out );
IOUtil.shutdownStream( in );
IOUtil.shutdownStream( out );
}
}
}

/**
* &quot;normalize&quot; the given absolute path. <p>
*


+ 2
- 13
proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.tools.ant.types;// java io classes
package org.apache.tools.ant.types;

import java.io.File;
import java.io.FileInputStream;
@@ -81,7 +81,7 @@ public class FilterSet
*
* @param filter The feature to be added to the Filter attribute
*/
public void addFilter( Filter filter )
public void addFilter( final Filter filter )
{
m_filters.add( filter );
}
@@ -121,17 +121,6 @@ public class FilterSet
return new FiltersFile();
}*/

/**
* Test to see if this filter set it empty.
*
* @return Return true if there are filter in this set otherwise false.
*/
public boolean hasFilters()
throws TaskException
{
return m_filters.size() > 0;
}

/**
* Read the filters from the given file.
*


+ 7
- 38
proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSetCollection.java View File

@@ -7,14 +7,10 @@
*/
package org.apache.tools.ant.types;// java io classes

// java util classes

import java.util.ArrayList;
import java.util.Iterator;
import org.apache.myrmidon.api.TaskException;

// ant classes

/**
* A FilterSetCollection is a collection of filtersets each of which may have a
* different start/end token settings.
@@ -23,40 +19,11 @@ import org.apache.myrmidon.api.TaskException;
*/
public class FilterSetCollection
{
private ArrayList m_filterSets = new ArrayList();

private ArrayList filterSets = new ArrayList();

public FilterSetCollection()
{
}

public FilterSetCollection( FilterSet filterSet )
public void addFilterSet( final FilterSet filterSet )
{
addFilterSet( filterSet );
}

public void addFilterSet( FilterSet filterSet )
{
filterSets.add( filterSet );
}

/**
* Test to see if this filter set it empty.
*
* @return Return true if there are filter in this set otherwise false.
*/
public boolean hasFilters()
throws TaskException
{
for( Iterator e = filterSets.iterator(); e.hasNext(); )
{
FilterSet filterSet = (FilterSet)e.next();
if( filterSet.hasFilters() )
{
return true;
}
}
return false;
m_filterSets.add( filterSet );
}

/**
@@ -70,9 +37,11 @@ public class FilterSetCollection
throws TaskException
{
String replacedLine = line;
for( Iterator e = filterSets.iterator(); e.hasNext(); )

final Iterator filterSets = m_filterSets.iterator();
while( filterSets.hasNext() )
{
FilterSet filterSet = (FilterSet)e.next();
final FilterSet filterSet = (FilterSet)filterSets.next();
replacedLine = filterSet.replaceTokens( replacedLine );
}
return replacedLine;


+ 0
- 64
proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java View File

@@ -52,70 +52,6 @@ public class FileUtils
return (String[])result.toArray( new String[ result.size() ] );
}

/**
* Convienence method to copy a file from a source to a destination
* specifying if token filtering must be used, if source files may overwrite
* newer destination files and the last modified time of <code>destFile</code>
* file should be made equal to the last modified time of <code>sourceFile</code>
* .
*/
public static void copyFile( final File sourceFile,
final File destFile,
final FilterSetCollection filters )
throws IOException, TaskException
{
if( !destFile.exists() ||
destFile.lastModified() < sourceFile.lastModified() )
{
if( destFile.exists() && destFile.isFile() )
{
destFile.delete();
}

// ensure that parent dir of dest file exists!
// not using getParentFile method to stay 1.1 compat
File parent = destFile.getParentFile();
if( !parent.exists() )
{
parent.mkdirs();
}

if( filters != null && filters.hasFilters() )
{
BufferedReader in = new BufferedReader( new FileReader( sourceFile ) );
BufferedWriter out = new BufferedWriter( new FileWriter( destFile ) );

String newline = null;
String line = in.readLine();
while( line != null )
{
if( line.length() == 0 )
{
out.newLine();
}
else
{
newline = filters.replaceTokens( line );
out.write( newline );
out.newLine();
}
line = in.readLine();
}

IOUtil.shutdownReader( in );
IOUtil.shutdownWriter( out );
}
else
{
final FileInputStream in = new FileInputStream( sourceFile );
final FileOutputStream out = new FileOutputStream( destFile );
IOUtil.copy( in, out );
IOUtil.shutdownStream( in );
IOUtil.shutdownStream( out );
}
}
}

/**
* &quot;normalize&quot; the given absolute path. <p>
*


Loading…
Cancel
Save