ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound AntSoundPlayer.java SoundTask.java
Date Sun, 16 Dec 2001 00:34:27 GMT
donaldp     01/12/15 16:34:27

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound
                        AntSoundPlayer.java SoundTask.java
  Log:
  BuildException -> TaskException
  
  Removed uneeded imports.
  
  Processed code through style formatter.
  
  Revision  Changes    Path
  1.2       +27 -17    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
  
  Index: AntSoundPlayer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AntSoundPlayer.java	2001/12/15 12:06:31	1.1
  +++ AntSoundPlayer.java	2001/12/16 00:34:26	1.2
  @@ -6,6 +6,7 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.sound;
  +
   import java.io.File;
   import java.io.IOException;
   import javax.sound.sampled.AudioFormat;
  @@ -14,17 +15,14 @@
   import javax.sound.sampled.Clip;
   import javax.sound.sampled.DataLine;
   import javax.sound.sampled.Line;
  -import javax.sound.sampled.LineEvent;// imports for all the sound classes required
  -// note: comes with jmf or jdk1.3 +
  -// these can be obtained from http://java.sun.com/products/java-media/sound/
  +import javax.sound.sampled.LineEvent;
   import javax.sound.sampled.LineListener;
   import javax.sound.sampled.LineUnavailableException;
   import javax.sound.sampled.UnsupportedAudioFileException;
  -import org.apache.tools.ant.BuildEvent;// ant includes
  +import org.apache.tools.ant.BuildEvent;
   import org.apache.tools.ant.BuildListener;
   import org.apache.tools.ant.Project;
   
  -
   /**
    * This class is designed to be used by any AntTask that requires audio output.
    * It implements the BuildListener interface to listen for BuildEvents and could
  @@ -33,7 +31,7 @@
    * Both seem to work fine.
    *
    * @author Nick Pellow
  - * @version $Revision: 1.1 $, $Date: 2001/12/15 12:06:31 $
  + * @version $Revision: 1.2 $, $Date: 2001/12/16 00:34:26 $
    */
   
   public class AntSoundPlayer implements LineListener, BuildListener
  @@ -46,9 +44,10 @@
       private File fileFail = null;
       private int loopsFail = 0;
       private Long durationFail = null;
  -
  -    public AntSoundPlayer() { }
   
  +    public AntSoundPlayer()
  +    {
  +    }
   
       /**
        * @param fileFail The feature to be added to the BuildFailedSound attribute
  @@ -98,13 +97,14 @@
           }
       }
   
  -
       /**
        * Fired before any targets are started.
        *
        * @param event Description of Parameter
        */
  -    public void buildStarted( BuildEvent event ) { }
  +    public void buildStarted( BuildEvent event )
  +    {
  +    }
   
       /**
        * Fired whenever a message is logged.
  @@ -113,7 +113,9 @@
        * @see BuildEvent#getMessage()
        * @see BuildEvent#getPriority()
        */
  -    public void messageLogged( BuildEvent event ) { }
  +    public void messageLogged( BuildEvent event )
  +    {
  +    }
   
       /**
        * Fired when a target has finished. This event will still be thrown if an
  @@ -122,7 +124,9 @@
        * @param event Description of Parameter
        * @see BuildEvent#getException()
        */
  -    public void targetFinished( BuildEvent event ) { }
  +    public void targetFinished( BuildEvent event )
  +    {
  +    }
   
       /**
        * Fired when a target is started.
  @@ -130,7 +134,9 @@
        * @param event Description of Parameter
        * @see BuildEvent#getTarget()
        */
  -    public void targetStarted( BuildEvent event ) { }
  +    public void targetStarted( BuildEvent event )
  +    {
  +    }
   
       /**
        * Fired when a task has finished. This event will still be throw if an
  @@ -139,7 +145,9 @@
        * @param event Description of Parameter
        * @see BuildEvent#getException()
        */
  -    public void taskFinished( BuildEvent event ) { }
  +    public void taskFinished( BuildEvent event )
  +    {
  +    }
   
       /**
        * Fired when a task is started.
  @@ -147,7 +155,9 @@
        * @param event Description of Parameter
        * @see BuildEvent#getTask()
        */
  -    public void taskStarted( BuildEvent event ) { }
  +    public void taskStarted( BuildEvent event )
  +    {
  +    }
   
       /**
        * This is implemented to listen for any line events and closes the clip if
  @@ -205,10 +215,10 @@
           {
               AudioFormat format = audioInputStream.getFormat();
               DataLine.Info info = new DataLine.Info( Clip.class, format,
  -                AudioSystem.NOT_SPECIFIED );
  +                                                    AudioSystem.NOT_SPECIFIED );
               try
               {
  -                audioClip = ( Clip )AudioSystem.getLine( info );
  +                audioClip = (Clip)AudioSystem.getLine( info );
                   audioClip.addLineListener( this );
                   audioClip.open( audioInputStream );
               }
  
  
  
  1.2       +14 -9     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
  
  Index: SoundTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SoundTask.java	2001/12/15 12:06:31	1.1
  +++ SoundTask.java	2001/12/16 00:34:26	1.2
  @@ -6,10 +6,11 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.sound;
  +
   import java.io.File;
   import java.util.Random;
   import java.util.Vector;
  -import org.apache.tools.ant.BuildException;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   
  @@ -24,7 +25,7 @@
    * in xml and have Ant play them back
    *
    * @author Nick Pellow
  - * @version $Revision: 1.1 $, $Date: 2001/12/15 12:06:31 $
  + * @version $Revision: 1.2 $, $Date: 2001/12/16 00:34:26 $
    */
   
   public class SoundTask extends Task
  @@ -33,7 +34,9 @@
       private BuildAlert success = null;
       private BuildAlert fail = null;
   
  -    public SoundTask() { }
  +    public SoundTask()
  +    {
  +    }
   
       public BuildAlert createFail()
       {
  @@ -59,7 +62,7 @@
           else
           {
               soundPlayer.addBuildSuccessfulSound( success.getSource(),
  -                success.getLoops(), success.getDuration() );
  +                                                 success.getLoops(), success.getDuration()
);
           }
   
           if( fail == null )
  @@ -69,14 +72,16 @@
           else
           {
               soundPlayer.addBuildFailedSound( fail.getSource(),
  -                fail.getLoops(), fail.getDuration() );
  +                                             fail.getLoops(), fail.getDuration() );
           }
   
           getProject().addBuildListener( soundPlayer );
   
       }
   
  -    public void init() { }
  +    public void init()
  +    {
  +    }
   
       /**
        * A class to be extended by any BuildAlert's that require the output of
  @@ -158,7 +163,7 @@
                       Vector files = new Vector();
                       for( int i = 0; i < entries.length; i++ )
                       {
  -                        File f = new File( source, entries[i] );
  +                        File f = new File( source, entries[ i ] );
                           if( f.isFile() )
                           {
                               files.addElement( f );
  @@ -166,14 +171,14 @@
                       }
                       if( files.size() < 1 )
                       {
  -                        throw new BuildException( "No files found in directory " + source
);
  +                        throw new TaskException( "No files found in directory " + source
);
                       }
                       int numfiles = files.size();
                       // get a random number between 0 and the number of files
                       Random rn = new Random();
                       int x = rn.nextInt( numfiles );
                       // set the source to the file at that location
  -                    this.source = ( File )files.elementAt( x );
  +                    this.source = (File)files.elementAt( x );
                   }
               }
               else
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message