Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
How to get accepted in Fileice (200% Working) 22/2012
Premium Account
FILE HOSTS PREMIUM ACCOUNT
ALL FILE HOST PREMIUM ACCOUNTS
Zynga Slingo Trainer v5.12
iTunes Gift Card Generator V3.1 2012
Diablo 3 GOLD Coins FREE
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Better way to get content via jQuery $.get()
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
Pastable version of
speed up this horrendous conditional chain
<pre class='prettyprint' language='java'>public static String findsite(InputStream text) { String site, line = null; Boolean nospace = true; BufferedReader reader = new BufferedReader(new InputStreamReader(text)); try { line = reader.readLine(); } catch(Exception e) {} if(line.indexOf("Full") == 0) { site = "fulltilt"; } else if((line.indexOf("Pok") == 0) || (line.indexOf("POK") == 0)) { site = "pokerstars"; } else if(line.indexOf("***** Hand History") == 0) { site = "888"; } else if(line.indexOf("***") == 0) { site = "partypoker"; } else if(line.indexOf("** Game ID") == 0) { site = "prima"; } else if(line.indexOf("Everest") == 0) { site = "everest"; } else if(line.indexOf("Betfair") == 0) { site = "betfair"; } else if((line.indexOf("STAGE") == 0) || (line.indexOf("Stage") == 0)){ site = "cereus"; } else if((line.indexOf("Game #") == 0) || (line.indexOf("GAME #") == 0)) { site = "ipoker"; } else if(line.indexOf("** Hand #") == 0) { site = "ladbrokes"; } else if(line.indexOf("WPEX") == 0) { site = "wpex"; } else if(line.indexOf("Hand Start.") == 0) { site = "tribeca"; } else if(line.indexOf("<game id") == 0) { site = "carbon"; } else if(line.indexOf("Bodog") == 0) { site = "bodog"; } else if(line.indexOf("Hand") == 0) { site = "cake"; } else { site = "fulltilt"; } return site; } public void txtToHand(InputStream sin) { String site; String tourn = "false"; //remove any blanklines and such sin = striphistory(sin); sin.mark(0); site = findsite(sin); try { sin.reset(); } catch(Exception e) {} try { // Create an input character stream from standard in ANTLRInputStream input = new ANTLRInputStream(sin); if( site == "fulltilt") { FullTiltLexer lexer = new FullTiltLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); FullTiltParser parser = new FullTiltParser(tokens); parser.hand_history(); if(parser.hd.seats.isEmpty()) { throw new NoSeatsException(); } parser.hd.site = "fulltilt"; parser.hd.site_id = 1; hand = parser.hd; } else if (site == "pokerstars") { PokerStarsLexer lexer = new PokerStarsLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); PokerStarsParser parser = new PokerStarsParser(tokens); parser.hand_history(); parser.hd.site = "pokerstars"; parser.hd.site_id = 2; hand = parser.hd; } else if (site == "partypoker") { PartyPokerLexer lexer = new PartyPokerLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); PartyPokerParser parser = new PartyPokerParser(tokens); parser.hand_history(); parser.hd.site = "partypoker"; parser.hd.site_id = 3; hand = parser.hd; } else if (site == "cereus") { CereusLexer lexer = new CereusLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); CereusParser parser = new CereusParser(tokens); parser.hand_history(); parser.hd.site = "cereus"; parser.hd.site_id = 4; hand = parser.hd; } else if (site == "cake") { CakeLexer lexer = new CakeLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); CakeParser parser = new CakeParser(tokens); parser.hand_history(); parser.hd.site = "cake"; parser.hd.site_id = 5; hand = parser.hd; } else if (site == "prima") { PrimaLexer lexer = new PrimaLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); PrimaParser parser = new PrimaParser(tokens); parser.hand_history(); parser.hd.site = "prima"; parser.hd.site_id = 6; hand = parser.hd; } else if (site == "ipoker") { IPokerLexer lexer = new IPokerLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); IPokerParser parser = new IPokerParser(tokens); parser.hand_history(); parser.hd.site = "ipoker"; parser.hd.site_id = 7; hand = parser.hd; } else if (site == "888") { EightLexer lexer = new EightLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); EightParser parser = new EightParser(tokens); parser.hand_history(); parser.hd.site = "888"; parser.hd.site_id = 7; hand = parser.hd; } } catch(Exception e) {} }</pre> <a href="http://www.refactormycode.com/codes/880-speed-up-this-horrendous-conditional-chain" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>