From 56898baae00a414e02ad7f6fd90eb0be31028056 Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Sat, 1 Oct 2016 08:31:27 -0400 Subject: [PATCH] timing.core: Simplify CalledFunctionFactory Remove duplicated lines. Make factory implementation final. Change-Id: Iee670eb29e514107ec6d0a18fc8e1ed83edccca5 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/82315 Reviewed-by: Genevieve Bastien Tested-by: Genevieve Bastien Reviewed-by: Hudson CI --- .../core/callgraph/CalledFunctionFactory.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/callgraph/CalledFunctionFactory.java b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/callgraph/CalledFunctionFactory.java index 6f91b59a4b..6a3e9ce2b4 100644 --- a/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/callgraph/CalledFunctionFactory.java +++ b/analysis/org.eclipse.tracecompass.analysis.timing.core/src/org/eclipse/tracecompass/internal/analysis/timing/core/callgraph/CalledFunctionFactory.java @@ -17,7 +17,7 @@ import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue; * * @author Matthew Khouzam */ -public class CalledFunctionFactory { +public final class CalledFunctionFactory { private static final String SEPARATOR = ": "; //$NON-NLS-1$ private static final String ERROR_MSG = "Cannot create a called function of type : "; //$NON-NLS-1$ @@ -45,18 +45,18 @@ public class CalledFunctionFactory { */ public static AbstractCalledFunction create(long start, long end, int depth, ITmfStateValue stateValue, int processId, @Nullable ICalledFunction parent) { switch (stateValue.getType()) { - case CUSTOM: - throw new IllegalArgumentException(ERROR_MSG + stateValue.getType() + SEPARATOR + stateValue.toString()); - case DOUBLE: - throw new IllegalArgumentException(ERROR_MSG + stateValue.getType() + SEPARATOR + stateValue.toString()); case INTEGER: return create(start, end, depth, stateValue.unboxInt(), processId, parent); case LONG: return create(start, end, depth, stateValue.unboxLong(), processId, parent); - case NULL: - throw new IllegalArgumentException(ERROR_MSG + stateValue.getType() + SEPARATOR + stateValue.toString()); case STRING: return create(start, end, depth, stateValue.unboxStr(), processId, parent); + case CUSTOM: + // Fall through + case DOUBLE: + // Fall through + case NULL: + // Fall through default: throw new IllegalArgumentException(ERROR_MSG + stateValue.getType() + SEPARATOR + stateValue.toString()); } @@ -105,7 +105,7 @@ public class CalledFunctionFactory { * the parent node * @return an ICalledFunction with the specified properties */ - public static CalledStringFunction create(long start, long end, int depth, String value, int processId, @Nullable ICalledFunction parent) { + public static CalledStringFunction create(long start, long end, int depth, String value, int processId, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } -- 2.34.1