/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.internal.corext.refactoring.typeconstraints2;

import org.eclipse.core.runtime.Assert;

import org.eclipse.jdt.core.ICompilationUnit;

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.CompilationUnitRange;
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType;

public final class CastVariable2 extends ConstraintVariable2 implements ITypeConstraintVariable {

	private final CompilationUnitRange fRange;
	private final ConstraintVariable2 fExpressionVariable;

	public CastVariable2(TType type, CompilationUnitRange range, ConstraintVariable2 expressionVariable) {
		super(type);
		Assert.isNotNull(expressionVariable);
		Assert.isNotNull(range);
		fRange= range;
		fExpressionVariable= expressionVariable;
	}

	@Override
	public CompilationUnitRange getRange() {
		return fRange;
	}

	@Override
	public ICompilationUnit getCompilationUnit() {
		return fRange.getCompilationUnit();
	}

	@Override
	public void setCompilationUnit(ICompilationUnit unit) {
		throw new UnsupportedOperationException();
	}

	public ConstraintVariable2 getExpressionVariable() {
		return fExpressionVariable;
	}

	// hashCode() and equals(..) not necessary (unique per construction)
}
