Created
November 26, 2012 08:58
-
-
Save jlandure/4147277 to your computer and use it in GitHub Desktop.
CountElementDevFest
This file contains hidden or 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.File; | |
| import java.lang.reflect.Method; | |
| import java.lang.reflect.Type; | |
| import org.apache.commons.io.FileUtils; | |
| import org.apache.commons.io.LineIterator; | |
| import org.apache.commons.lang.StringUtils; | |
| public class CountElementDevFest { | |
| private final static String TYPE_BUFFER = "byte[]";// "char[]" | |
| private final static String NAME_DEFAULT_INOUT_BUFFER = "return";// "char[]" | |
| private final static String SUFFIX_BUFFER = "Buf"; | |
| private final static String SUFFIX_METHOD = "Native"; | |
| /** | |
| * @param args | |
| * @throws Exception | |
| */ | |
| public static void main(String[] args) throws Exception { | |
| LineIterator lineIterator = FileUtils.lineIterator(new File( | |
| "/home/actility/Downloads/stats.csv")); | |
| int soc_ssii = 0; | |
| // "une SII" | |
| int soc_editeur = 0; | |
| // "un éditeur" | |
| int soc_startup = 0; | |
| // "une startup" | |
| int soc_others = 0; | |
| // "encore autre chose !" | |
| int lang_java = 0; | |
| // "Java" | |
| int lang_html_js = 0; | |
| // "HTML / Javascript" | |
| int lang_php = 0; | |
| // "Php" | |
| int lang_python = 0; | |
| // "Python" | |
| int lang_net = 0; | |
| // ".Net" | |
| int lang_go = 0; | |
| // "Go" | |
| int lang_dart = 0; | |
| // "Dart" | |
| int lang_objective_c = 0; | |
| // "Objective C" | |
| int pref_android = 0; | |
| // "Android" | |
| int pref_gwt = 0; | |
| // "GWT" | |
| int pref_html = 0; | |
| // "HTML5" | |
| int pref_dart = 0; | |
| // "Dart" | |
| int pref_appengine = 0; | |
| // "AppEngine" | |
| int pref_gapi = 0; | |
| // "Google API" | |
| int pref_maps = 0; | |
| // "Maps" | |
| int pref_angular = 0; | |
| // "Angular JS" | |
| int pref_appscript = 0; | |
| // "AppScript" | |
| int pref_go = 0; | |
| // "Go" | |
| int numberLine = 0; | |
| String line; | |
| String[] decoupe; | |
| String lang; | |
| String soc; | |
| String pref; | |
| while (lineIterator.hasNext()) { | |
| numberLine++; | |
| line = lineIterator.nextLine(); | |
| // decoupe = StringUtils.split(line, ";"); | |
| decoupe = StringUtils.splitPreserveAllTokens(line, ";"); | |
| if (decoupe.length != 3) { | |
| System.out.println("pb line " + numberLine + " >>" + line); | |
| } else { | |
| soc = decoupe[0]; | |
| lang = decoupe[1]; | |
| pref = decoupe[2]; | |
| if (numberLine == 5) { | |
| System.out.println(soc); | |
| System.out.println(lang); | |
| System.out.println(pref); | |
| } | |
| if (StringUtils.contains(soc, "une SII")) { | |
| soc_ssii++; | |
| } else if (StringUtils.contains(soc, "un éditeur")) { | |
| soc_editeur++; | |
| } else if (StringUtils.contains(soc, "une startup")) { | |
| soc_startup++; | |
| } else if (StringUtils.contains(soc, "encore autre chose !")) { | |
| soc_others++; | |
| } | |
| if (StringUtils.contains(lang, "Java")) { | |
| lang_java++; | |
| } | |
| if (StringUtils.contains(lang, "HTML / Javascript")) { | |
| lang_html_js++; | |
| } | |
| if (StringUtils.contains(lang, "Php")) { | |
| lang_php++; | |
| } | |
| if (StringUtils.contains(lang, "Python")) { | |
| lang_python++; | |
| } | |
| if (StringUtils.contains(lang, ".Net")) { | |
| lang_net++; | |
| } | |
| if (StringUtils.contains(lang, "Go")) { | |
| lang_go++; | |
| } | |
| if (StringUtils.contains(lang, "Dart")) { | |
| lang_dart++; | |
| } | |
| if (StringUtils.contains(lang, "Objective C")) { | |
| lang_objective_c++; | |
| } | |
| if (StringUtils.contains(pref, "Android")) { | |
| pref_android++; | |
| } | |
| if (StringUtils.contains(pref, "GWT")) { | |
| pref_gwt++; | |
| } | |
| if (StringUtils.contains(pref, "HTML5")) { | |
| pref_html++; | |
| } | |
| if (StringUtils.contains(pref, "Dart")) { | |
| pref_dart++; | |
| } | |
| if (StringUtils.contains(pref, "AppEngine")) { | |
| pref_appengine++; | |
| } | |
| if (StringUtils.contains(pref, "Google API")) { | |
| pref_gapi++; | |
| } | |
| if (StringUtils.contains(pref, "Maps")) { | |
| pref_maps++; | |
| } | |
| if (StringUtils.contains(pref, "Angular JS")) { | |
| pref_angular++; | |
| } | |
| if (StringUtils.contains(pref, "AppScript")) { | |
| pref_appscript++; | |
| } | |
| if (StringUtils.contains(pref, " Go ")) { | |
| pref_go++; | |
| } | |
| } | |
| } | |
| System.out.println("Editeur\t" + soc_ssii); | |
| System.out.println("Startup\t" + soc_startup); | |
| System.out.println("Editeur\t" + soc_editeur); | |
| System.out.println("Autres\t" + soc_others); | |
| System.out.println(); | |
| System.out.println(); | |
| System.out.println("Java\t" + lang_java); | |
| System.out.println("HTML / Javascript\t" + lang_html_js); | |
| System.out.println("Php\t" + lang_php); | |
| System.out.println("Python\t" + lang_python); | |
| System.out.println(".Net\t" + lang_net); | |
| System.out.println("Go\t" + lang_go); | |
| System.out.println("Dart\t" + lang_dart); | |
| System.out.println("Objective C\t" + lang_objective_c); | |
| System.out.println(); | |
| System.out.println(); | |
| System.out.println("Android\t" + pref_android); | |
| System.out.println("GWT\t" + pref_gwt); | |
| System.out.println("HTML5\t" + pref_html); | |
| System.out.println("Dart\t" + pref_dart); | |
| System.out.println("AppEngine\t" + pref_appengine); | |
| System.out.println("Google API\t" + pref_gapi); | |
| System.out.println("Maps\t" + pref_maps); | |
| System.out.println("Angular JS\t" + pref_angular); | |
| System.out.println("AppScript\t" + pref_appscript); | |
| System.out.println("Go\t" + pref_go); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment