package dk.itu.mario.level.grammar;

import dk.itu.mario.level.LevelComponent;

public class Variable implements Clause, Comparable<Variable> {
	private boolean terminal;
	private LevelComponent.TYPE type;
	private String value;
	
	public Variable(String value, LevelComponent.TYPE type) {
		this.value = value;
		this.terminal = (value.toLowerCase().equals(value));
		this.type = type;
	}
	
	public LevelComponent.TYPE getType() {
		return type;
	}
	
	public String getValue() {
		return value;
	}
	
	public boolean isTerminal() {
		return terminal;
	}
	
	@Override
	public String toString() {
		return value;
	}

	@Override
	public int compareTo(Variable o) {
		return this.value.compareTo(o.value);
	}

	@Override
	public Clause getSubClause(int index) {
		throw new UnsupportedOperationException();
	}

	@Override
	public int getNumSubClauses() {
		throw new UnsupportedOperationException();
	}

	@Override
	public boolean isChoice() {
		return false;
	}

	@Override
	public Clause makeRandomChoice() {
		throw new UnsupportedOperationException();
	}
	
	@Override
	public boolean isVariable() {
		return true;
	}
}