blob: 17cc674ef0f4b9c8e3d839d2702398f5e52ba616 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2017 École Polytechnique de Montréal
*
* All rights reserved. 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
*******************************************************************************/
package org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.model.values;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.model.runtime.DataDrivenScenarioInfo;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.IAnalysisDataContainer;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
/**
* A value that resolves to the attribute name of the current attribute
*
* @author Geneviève Bastien
*/
public class DataDrivenValueSelf extends DataDrivenValue {
/**
* Constructor
*
* @param forcedType
* The desired type of the value
*/
public DataDrivenValueSelf(ITmfStateValue.Type forcedType) {
super(null, forcedType);
}
@Override
protected @Nullable Object resolveValue(int baseQuark, IAnalysisDataContainer container) {
ITmfStateSystem stateSystem = container.getStateSystem();
return stateSystem.getAttributeName(baseQuark);
}
@Override
protected @Nullable Object resolveValue(ITmfEvent event, int baseQuark, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) {
return resolveValue(baseQuark, container);
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof DataDrivenValueSelf)) {
return false;
}
return super.equals(obj);
}
}