Created
January 12, 2013 03:47
-
-
Save sanaulla123/4515945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Parser { | |
private Parser successor; | |
public void parse(String fileName){ | |
if ( getSuccessor() != null ){ | |
getSuccessor().parse(fileName); | |
} | |
else{ | |
System.out.println("Unable to find the correct parser for the file: "+fileName); | |
} | |
} | |
protected boolean canHandleFile(String fileName, String format){ | |
return (fileName == null) || (fileName.endsWith(format)); | |
} | |
Parser getSuccessor() { | |
return successor; | |
} | |
void setSuccessor(Parser successor) { | |
this.successor = successor; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment