Created
December 9, 2011 16:16
-
-
Save megamind-android/1452170 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
| private static void display(int total, int friends, boolean user) { | |
| String message = ""; | |
| String text; | |
| if(friends>1){ | |
| text = "friends"; | |
| } | |
| else { | |
| text="friend"; | |
| } | |
| int remaining = total - friends - (user?1:0); | |
| //TODO: Logic to populate messsage. | |
| if(friends!=0 && total!=0){ | |
| if(user && total>friends){ | |
| if(remaining!=0){ | |
| message ="you,"+friends+ text+" and "+remaining+" others like this"; | |
| } | |
| else{ | |
| message ="you and "+friends+text+" like this"; | |
| } | |
| } | |
| else if(!user && remaining!=0){ | |
| message =friends+ text+" and "+remaining+" others like this"; | |
| } | |
| else if(!user && remaining==0){ | |
| message =friends+text+" like this"; | |
| } | |
| } | |
| else if(total!=0 && friends==0 && user){ | |
| message ="you and "+remaining+" others like this"; | |
| } | |
| else if(total!=0 && friends==0 && !user){ | |
| message = remaining+" others like this"; | |
| } | |
| else if(remaining==0){ | |
| message ="none like this"; | |
| } | |
| else if(remaining==-1){ | |
| message ="you like this"; | |
| } | |
| System.out.println("Total "+total+", friends "+friends+", user "+user+", message: "+message); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is useful to parse the Facebook like text.