package osa.attribute.atgrammar.grammar.symbols;

import java.util.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: </p>
 * <p>Company: </p>
 * @author not attributable
 * @version
 */

public class AttributeTypeSystem
  {
  TreeMap types=new TreeMap();
  public AttributeTypeSystem()
    {
    addAttributeType(AttributeType.VOID_TYPE);
    addAttributeType(new AttributeType("boolean",true));
    addAttributeType(new AttributeType("integer",true));
    addAttributeType(new AttributeType("float",true));
    addAttributeType(new AttributeType("char",true));
    }

  public boolean addAttributeType(AttributeType type)
    {
    if(types.containsValue(type))
      {
      return false;
      }
    types.put(type.getName(),type);
    return true;
    }

  public AttributeType getAttributeType(String name)
    {
    return (AttributeType)types.get(name);
    }

  public ArrayList getTypesList()
    {
    return new ArrayList(types.values());
    }

  }