package org.jerrymouse.cc.site.bean;

public class Format {
	private Type type;
	private Integer weight;
	private Integer height;

	public Format() {
	}

	public Format(String line) {
		super();
		int i = line.indexOf(':');
		if (i == -1) {
			type = new Type(line);
		} else {
			type = new Type(line.substring(0, i));
			line = line.substring(i + 1);
			i = line.indexOf('*');
			weight = Integer.parseInt(line.substring(0, i));
			height = Integer.parseInt(line.substring(i + 1));
		}
	}

	public Format(Type type) {
		this.type = type;
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return type.toString();
	}
}
