Created
April 20, 2011 21:26
-
-
Save collinvandyck/932910 to your computer and use it in GitHub Desktop.
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 util.matching.Regex | |
| class KillsScala2.8.1 { | |
| val ErrorR = new Regex("\\[ERROR\\](.*)") | |
| val LogR = new Regex("\\[LOG\\](.*)") | |
| val SuspendedUserR = new Regex("\\[SUSPENDED_USER\\](.*)") | |
| val CreatedUserR = new Regex("\\[CREATED_USER\\](.*)") | |
| val NumUsersProcessedR = new Regex("\\[NUM_USERS_PROCESSED\\](.*)") | |
| val NumUsersPendingR = new Regex("\\[NUM_USERS_PENDING\\](.*)") | |
| val NumTotalUsersR = new Regex("\\[NUM_TOTAL_USERS\\](.*)") | |
| val PercentDoneR = new Regex("\\[PERCENT_DONE\\](.*)") | |
| val StatusR = new Regex("\\[STATUS\\](.*)") | |
| def matchIt(str: String) { | |
| str match { | |
| case ErrorR(error) => | |
| case LogR(log) => | |
| case SuspendedUserR(user) => | |
| case CreatedUserR(user) => | |
| case NumUsersProcessedR(num) => | |
| case NumUsersPendingR(num) => | |
| case NumTotalUsersR(num) => | |
| case PercentDoneR(num) => | |
| case StatusR(status) => | |
| case unknown => throw new Exception("Unknown") | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment