| /******************************************************************************* |
| * Copyright (c) 2005, 2016 IBM Corporation and others. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.dltk.ruby.typeinference; |
| |
| import org.eclipse.dltk.ti.IContext; |
| import org.eclipse.dltk.ti.goals.AbstractTypeGoal; |
| |
| public class ConstantTypeGoal extends AbstractTypeGoal { |
| |
| private final int offset; |
| private final String name; |
| |
| public ConstantTypeGoal(IContext context, int offset, String name) { |
| super(context); |
| this.offset = offset; |
| this.name = name; |
| } |
| |
| public String getName() { |
| return name; |
| } |
| |
| public int getOffset() { |
| return offset; |
| } |
| |
| @Override |
| public int hashCode() { |
| final int prime = 31; |
| int result = super.hashCode(); |
| result = prime * result + ((name == null) ? 0 : name.hashCode()); |
| result = prime * result + offset; |
| return result; |
| } |
| |
| @Override |
| public boolean equals(Object obj) { |
| if (this == obj) |
| return true; |
| if (!super.equals(obj)) |
| return false; |
| if (getClass() != obj.getClass()) |
| return false; |
| ConstantTypeGoal other = (ConstantTypeGoal) obj; |
| if (offset != other.offset) |
| return false; |
| if (name == null) { |
| if (other.name != null) |
| return false; |
| } else if (!name.equals(other.name)) |
| return false; |
| return true; |
| } |
| |
| } |