Source:
<code>public void eventHandle(ITmfEvent event, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) { if (!(container instanceof XmlPatternStateProvider)) { return; } XmlPatternStateProvider provider = (XmlPatternStateProvider) container; long start = provider.getHistoryBuilder().getStartTime(provider, <START> (TmfXmlScenarioInfo) <END> scenarioInfo, event); long end = event.getTimestamp().toNanos(); Object segmentName = fType.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); Map<String, ITmfStateValue> fields = new HashMap<>(); for (Entry<String, DataDrivenValue> field : fFields.entrySet()) { Object value = field.getValue().getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); fields.put(field.getKey(), value instanceof ITmfStateValue ? (ITmfStateValue) value : TmfStateValue.newValue(value)); } if (fStart != null) { Object startVal = fStart.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (startVal instanceof Number) { start = ((Number) startVal).longValue(); } } if (fEnd != null) { Object endVal = fEnd.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (endVal instanceof Number) { long endL = ((Number) endVal).longValue(); end = endL >= start ? endL : end; } } else if (fDuration != null) { Object durationVal = fDuration.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (durationVal instanceof Number) { long durationL = ((Number) durationVal).longValue(); long endL = start + durationL; end = endL >= start ? endL : end; } } TmfXmlPatternSegment segment = new TmfXmlPatternSegment(start, end, String.valueOf(segmentName), fields); provider.getListener().onNewSegment(segment); }</code><technical_language>Blind cast</technical_language>

Target:
public void eventHandle(ITmfEvent event, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) { if (!(container instanceof XmlPatternStateProvider && scenarioInfo instanceof TmfXmlScenarioInfo)) { return; } XmlPatternStateProvider provider = (XmlPatternStateProvider) container; long start = provider.getHistoryBuilder().getStartTime(provider, (TmfXmlScenarioInfo) scenarioInfo, event); long end = event.getTimestamp().toNanos(); Object segmentName = fType.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); Map<String, ITmfStateValue> fields = new HashMap<>(); for (Entry<String, DataDrivenValue> field : fFields.entrySet()) { Object value = field.getValue().getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); fields.put(field.getKey(), value instanceof ITmfStateValue ? (ITmfStateValue) value : TmfStateValue.newValue(value)); } if (fStart != null) { Object startVal = fStart.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (startVal instanceof Number) { start = ((Number) startVal).longValue(); } } if (fEnd != null) { Object endVal = fEnd.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (endVal instanceof Number) { long endL = ((Number) endVal).longValue(); end = endL >= start ? endL : end; } } else if (fDuration != null) { Object durationVal = fDuration.getValue(event, ITmfStateSystem.ROOT_ATTRIBUTE, scenarioInfo, container); if (durationVal instanceof Number) { long durationL = ((Number) durationVal).longValue(); long endL = start + durationL; end = endL >= start ? endL : end; } } TmfXmlPatternSegment segment = new TmfXmlPatternSegment(start, end, String.valueOf(segmentName), fields); provider.getListener().onNewSegment(segment); }