blob: 7522875cef671f55827f5b4b7f866073c43749a7 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2015 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.debug.internal.ui.views.variables;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IIndexedValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
/**
* A parition (subrange) of values of an indexed value
*/
public class IndexedValuePartition implements IIndexedValue {
// the starting offset of this parition, into the associated collection
private int fOffset;
// the length of this partition
private int fLength;
// the indexed value
private IIndexedValue fValue;
/**
* Creates a parition for an indexed value.
*
* @param value indexed value
* @param offset beginning offset of this partition (into the value)
* @param length the length of this parition
*/
public IndexedValuePartition(IIndexedValue value, int offset, int length) {
fValue = value;
fOffset = offset;
fLength = length;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IIndexedValue#getSize()
*/
@Override
public int getSize() {
return fLength;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IIndexedValue#getVariable(int)
*/
@Override
public IVariable getVariable(int offset) throws DebugException {
return fValue.getVariable(offset);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
*/
@Override
public String getReferenceTypeName() throws DebugException {
return fValue.getReferenceTypeName();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getValueString()
*/
@Override
public String getValueString() {
return IInternalDebugCoreConstants.EMPTY_STRING;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getVariables()
*/
@Override
public IVariable[] getVariables() throws DebugException {
return getVariables(fOffset, fLength);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#hasVariables()
*/
@Override
public boolean hasVariables() {
return fLength > 0;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#isAllocated()
*/
@Override
public boolean isAllocated() throws DebugException {
return fValue.isAllocated();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
*/
@Override
public IDebugTarget getDebugTarget() {
return fValue.getDebugTarget();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
*/
@Override
public ILaunch getLaunch() {
return fValue.getLaunch();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
@Override
public String getModelIdentifier() {
return fValue.getModelIdentifier();
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@Override
public <T> T getAdapter(Class<T> adapter) {
return fValue.getAdapter(adapter);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IIndexedValue#getVariables(int, int)
*/
@Override
public IVariable[] getVariables(int offset, int length) throws DebugException {
return fValue.getVariables(offset, length);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IIndexedValue#getInitialOffset()
*/
@Override
public int getInitialOffset() {
return fOffset;
}
}