Skip to content

Instantly share code, notes, and snippets.

@jagwire
jagwire / Generic Decorator
Created May 7, 2013
A generic decorator for Observable objects.
View Generic Decorator
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
Example M-V-P cell pattern for Wonderland U.
View MVP pattern: 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
Java singleton pattern
View java-singleton
public enum Singleton {
INSTANCE;
private Singleton() { }
}