aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/equalparts/cardbase/cardfield/CardField.java
blob: e08857708986a95f16976e65e03ec1312d165ffc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package eu.equalparts.cardbase.cardfield;
import eu.equalparts.cardbase.filtering.Filter;

public abstract class CardField<T extends Comparable<T>> implements Comparable<CardField<T>> {
	private String name;
	private T value;
	
	public CardField(String name, T value) {
		this.name = name;
		this.value = value;
	}
	
	public String getName() {
		return name;
	}
	
	public T get() {
		return value;
	}
	
	public void set(T newValue) {
		this.value = newValue;
	}
	
	@Override
	public int compareTo(CardField<T> o) {
		return value.compareTo(o.get());
	}
	
	public abstract boolean filter(Filter filter);
}