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 JsonParser extends Parser { | |
public JsonParser(Parser successor){ | |
this.setSuccessor(successor); | |
} | |
@Override | |
public void parse(String fileName) { | |
if ( canHandleFile(fileName, ".json")){ | |
System.out.println("A JSON parser is handling the file: "+fileName); |
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 TextParser extends Parser{ | |
public TextParser(Parser successor){ | |
this.setSuccessor(successor); | |
} | |
@Override | |
public void parse(String fileName) { | |
if ( canHandleFile(fileName, ".txt")){ | |
System.out.println("A text parser is handling the file: "+fileName); |
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); |
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
import java.io.IOException; | |
import java.nio.file.DirectoryStream; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
public class DirectoryFilterTest { | |
public static void main(String[] args) { | |
Path basePath = Paths.get("D:/tests"); |
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
import java.io.IOException; | |
import java.nio.charset.Charset; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.*; | |
import java.util.concurrent.*; | |
public class ExecutorServiceSample { |
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
import java.util.*; | |
public class EnhancedCollections{ | |
public static void main(String[] args){ | |
List<Integer> counts = new ArrayList<Integer>(); | |
for(int i=1;i <= 10; i++){ | |
counts.add(i); | |
} | |
//Using external iterators | |
System.out.println("Using external iterator"); |
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
5.1,3.5,1.4,0.2,Iris-setosa | |
4.9,3.0,1.4,0.2,Iris-setosa | |
4.7,3.2,1.3,0.2,Iris-setosa | |
4.6,3.1,1.5,0.2,Iris-setosa | |
5.0,3.6,1.4,0.2,Iris-setosa | |
5.4,3.9,1.7,0.4,Iris-setosa | |
4.6,3.4,1.4,0.3,Iris-setosa | |
5.0,3.4,1.5,0.2,Iris-setosa | |
4.4,2.9,1.4,0.2,Iris-setosa | |
4.9,3.1,1.5,0.1,Iris-setosa |
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
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* | |
* @author mohamed | |
*/ | |
public class NNAlgorithm { |
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
import java.io.Closeable; | |
import java.io.IOException; | |
/** | |
* Created by IntelliJ IDEA. | |
* User: mohamed | |
* Date: 2/5/12 | |
* Time: 9:24 PM | |
* To change this template use File | Settings | File Templates. | |
*/ |
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
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
/** | |
* Created by IntelliJ IDEA. | |
* User: mohamed | |
* Date: 1/5/12 | |
* Time: 8:49 PM |