All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.javacc.utils.OptionInfo Maven / Gradle / Ivy

There is a newer version: 4.1.5
Show newest version
package org.javacc.utils;


/**
 * @author Chris Ainsley
 */
public class OptionInfo implements Comparable 
{
  String _name;
  OptionType _type;
  Object _default;

  public OptionInfo (final String name, final OptionType type, final Object default1)
  {
    _name = name;
    _type = type;
    _default = default1;
  }

  public String getName ()
  {
    return _name;
  }

  public OptionType getType ()
  {
    return _type;
  }

  public Object getDefault ()
  {
    return _default;
  }

  @Override
  public int hashCode ()
  {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((_default == null) ? 0 : _default.hashCode ());
    result = prime * result + ((_name == null) ? 0 : _name.hashCode ());
    result = prime * result + ((_type == null) ? 0 : _type.hashCode ());
    return result;
  }

  @Override
  public boolean equals (final Object obj)
  {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass () != obj.getClass ())
      return false;
    final OptionInfo other = (OptionInfo) obj;
    if (_default == null)
    {
      if (other._default != null)
        return false;
    }
    else
      if (!_default.equals (other._default))
        return false;
    if (_name == null)
    {
      if (other._name != null)
        return false;
    }
    else
      if (!_name.equals (other._name))
        return false;
    if (_type != other._type)
      return false;
    return true;
  }

  public int compareTo (final OptionInfo o)
  {
    return this._name.compareTo (o._name);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy