0,0 → 1,32 |
package ak.simplechat; |
|
import java.util.Date; |
import java.util.List; |
import java.util.ArrayList; |
|
public class Logic |
{ |
public static final int MESSAGES_LIMIT = 30; |
private static ArrayList messages = new ArrayList(); |
|
public static void addMessage(String user, String message) |
{ |
synchronized(messages) { |
messages.add(0, new Message(user, message, new Date())); |
|
while(messages.size() > MESSAGES_LIMIT) |
messages.remove(messages.size() - 1); |
} |
} |
|
public static List getMessages() |
{ |
List result; |
|
synchronized(messages) { |
result = (List)messages.clone(); |
} |
|
return result; |
} |
} |
Property changes: |
Added: svn:keywords |
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id |
\ No newline at end of property |