content: /*******************************************************************************
   * Copyright (c) 2000, 2007 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.wst.jsdt.internal.ui.text.template.contentassist;
  
  import org.eclipse.core.runtime.Assert;
  import org.eclipse.jface.text.IDocument;
  import org.eclipse.jface.text.contentassist.ICompletionProposal;
  import org.eclipse.jface.text.link.LinkedPositionGroup;
  import org.eclipse.jface.text.link.ProposalPosition;
  
  
  /**
   *
   */
  public class VariablePosition extends ProposalPosition {
  
  	private MultiVariableGuess fGuess;
  	private MultiVariable fVariable;
  
  	public VariablePosition(IDocument document, int offset, int length, MultiVariableGuess guess, MultiVariable variable) {
  		this(document, offset, length, LinkedPositionGroup.NO_STOP, guess, variable);
  	}
  
  	public VariablePosition(IDocument document, int offset, int length, int sequence, MultiVariableGuess guess, MultiVariable variable) {
  		super(document, offset, length, sequence, null);
  		Assert.isNotNull(guess);
  		Assert.isNotNull(variable);
  		fVariable= variable;
  		fGuess= guess;
  	}
  
  
  	/*
  	 * @see org.eclipse.jface.text.link.ProposalPosition#equals(java.lang.Object)
  	 */
  	public boolean equals(Object o) {
  		if (o instanceof VariablePosition && super.equals(o)) {
  			return fGuess.equals(((VariablePosition) o).fGuess);
  		}
  		return false;
  	}
  
  	/*
  	 * @see org.eclipse.jface.text.link.ProposalPosition#hashCode()
  	 */
  	public int hashCode() {
  		return super.hashCode() | fGuess.hashCode();
  	}
  
  	/*
  	 * @see org.eclipse.jface.text.link.ProposalPosition#getChoices()
  	 */
  	public ICompletionProposal[] getChoices() {
  		return fGuess.getProposals(fVariable, offset, length);
  	}
  
  	/**
  	 * Returns the variable.
  	 * 
  	 * @return the variable.
  	 */
  	public MultiVariable getVariable() {
  		return fVariable;
  	}
  
  }
  