package de.dhbwstuttgart.typeinference.result;

import java.util.HashMap;
import java.util.Map;

import org.antlr.v4.runtime.Token;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;

public class ResultPairMap {

	private Table<Token, String, ResultPair<?,?>> indexMap = HashBasedTable.create();
	private Map<Token, ResultPair<?, ?>> inner = new HashMap<>();
	
	public static final ResultPairMap RESULT_PAIRS = new ResultPairMap();
	
	private ResultPairMap() {
		// Nothing to do here.
	}
	
	public void put(Token tkn, String insertString, ResultPair<?, ?> resultPair) {
		indexMap.put(tkn, insertString.trim(), resultPair);
		inner.put(tkn, resultPair);
	}
	
	public ResultPair<?,?> get(Token tkn, String insertString) {
		return inner.get(tkn);
	}
	
	public void clear() {
		inner.clear();
		indexMap.clear();
	}
}
