SimilarElement.java :  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » ui » text » correction » Java Open Source

Java Open Source » IDE Eclipse » jdt 
jdt » org » eclipse » jdt » internal » ui » text » correction » SimilarElement.java
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.internal.ui.text.correction;

import java.util.Arrays;

public class SimilarElement {

  private final int fKind;
  private final String fName;
  private final String[] fTypesParameters;
  private final int fRelevance;

  public SimilarElement(int kind, String name, int relevance) {
    this(kind, name, null, relevance);
  }

  public SimilarElement(int kind, String name, String[] typesParameters, int relevance) {
    fKind= kind;
    fName= name;
    fTypesParameters= typesParameters;
    fRelevance= relevance;
  }

  /**
   * Gets the kind.
   * @return Returns a int
   */
  public int getKind() {
    return fKind;
  }

  /**
   * Gets the parameter types.
   * @return Returns a int
   */
  public String[] getTypesParameter() {
    return fTypesParameters;
  }

  /**
   * Gets the name.
   * @return Returns a String
   */
  public String getName() {
    return fName;
  }

  /**
   * Gets the relevance.
   * @return Returns a int
   */
  public int getRelevance() {
    return fRelevance;
  }

  /* (non-Javadoc)
   * @see Object#equals(Object)
   */
  public boolean equals(Object obj) {
    if (obj instanceof SimilarElement) {
      SimilarElement elem= (SimilarElement) obj;
      return fName.equals(elem.fName) && fKind == elem.fKind && Arrays.equals(fTypesParameters, elem.fTypesParameters);
    }
    return false;
  }

  /* (non-Javadoc)
   * @see Object#hashCode()
   */
  public int hashCode() {
    return fName.hashCode() + fKind;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.