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 AttributeType
  {
  public static final AttributeType VOID_TYPE=new AttributeType("void",true);

  protected String name;

  protected boolean is_compatible_with_all_types;

  protected boolean is_built_in;

  ArrayList compatible_types=new ArrayList();

  public AttributeType(String name, boolean is_built_in)
    {
    this.name=name;
    this.is_built_in=is_built_in;
    is_compatible_with_all_types=true;
    }

  public void setIsCompatibleWithAll(boolean flag)
    {
    is_compatible_with_all_types=flag;
    }

  public boolean isCompatibleWithAll()
    {
    return is_compatible_with_all_types;
    }

  public void addCompatibleType(AttributeType type)
    {
    compatible_types.add(type);
    is_compatible_with_all_types=false;
    }

  public void removeCompatibleType(AttributeType type)
    {
    compatible_types.remove(type);
    }

  public String getName()
    {
    return name;
    }

  public String toString()
    {
    return name.toString();
    }

  public boolean getIsBuiltIn()
    {
    return is_built_in;
    }

  }