Skip to content

Instantly share code, notes, and snippets.

@jagwire
jagwire / Generic Decorator
Created May 7, 2013 13:47
A generic decorator for Observable objects.
public interface Obj {
protected void doSomething();
}
public class ObjImpl implements Obj {
protected void doSomething() {
int x = 5*5;
}
@jagwire
jagwire / MVP pattern: Wonderland U
Created May 7, 2013 13:37
Example M-V-P cell pattern for Wonderland U.
public class Cell {
//Do we need to contractually obligate developers to only use a single instance of a component based on class?
//The difference is in using a List or a Map.
Collection<State> states;
//Given an enum of types: Text, 2D, JME3
//We should keep track of the various views in a map. No two instances of a cell view should have the same type
Map<EnumViewType, CellView> views;
//The alternative here is to have a single view with view components
@jagwire
jagwire / java-singleton
Created May 7, 2013 13:24
Java singleton pattern
public enum Singleton {
INSTANCE;
private Singleton() { }
}