Coverage Report - uk.co.javagear.GGFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
GGFilter
0% 
0% 
2
 
 1  
 /*
 2  
  * GGFilter.java
 3  
  *
 4  
  * This file is part of JavaGear.
 5  
  *
 6  
  * JavaGear is free software; you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation; either version 2 of the License, or
 9  
  * (at your option) any later version.
 10  
  *
 11  
  * JavaGear is distributed in the hope that it will be useful,
 12  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14  
  * GNU General Public License for more details.
 15  
  *
 16  
  * You should have received a copy of the GNU General Public License
 17  
  * along with JavaGear; if not, write to the Free Software
 18  
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 19  
  */
 20  
 
 21  
 package uk.co.javagear;
 22  
 
 23  
 import java.io.File;
 24  
 
 25  
 /**
 26  
  * JavaGear File Filters (Code from "Core Java Volume #1").
 27  
  *
 28  
  * @author Copyright (C) 2002 Chris White
 29  
  * @version 17th March 2002
 30  
  * @see "JavaGear Final Project Report"
 31  
  */
 32  0
 public class GGFilter extends RomFilter {
 33  
     
 34  
     /**
 35  
      * Returns <code>true</code> if the file given is accepted and <code>false</code> otherwise.
 36  
      * This filter accepts all directories and files with extension <code>gg</code>.
 37  
      *
 38  
      * @param f the instance of <code>File</code> to accept or reject.
 39  
      * @return <code>true</code> if the file given is accepted and <code>false</code> otherwise.
 40  
      */
 41  
     public boolean accept(File f) {
 42  
         // Allow directories
 43  0
         if (f.isDirectory()) {
 44  0
             return true;
 45  
         }
 46  
         
 47  0
         String extension = getExtension(f);
 48  
         
 49  0
         return extension.equals(Setup.System.GG.getRomFileExtension());
 50  
     }
 51  
     
 52  
     /**
 53  
      * Returns a description of this filter, <code>"Sega Game Gear ROMs (*.GG)"</code>.
 54  
      *
 55  
      * @return a description of this filter, <code>"Sega Game Gear ROMs (*.GG)"</code>.
 56  
      */
 57  
     public String getDescription() {
 58  0
         return Setup.System.GG.getName() + " ROMs (*."
 59  
                 + Setup.System.GG.getRomFileExtension().toUpperCase() + ")";
 60  
     }
 61  
 }