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"));
    addAttributeType(new AttributeType("integer"));
    addAttributeType(new AttributeType("float"));
    addAttributeType(new AttributeType("char"));
    }

  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());
    }

  }