Remove duplicated lines.
Make factory implementation final.
Change-Id: Iee670eb29e514107ec6d0a18fc8e1ed83edccca5
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/82315
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Hudson CI
*
* @author Matthew Khouzam
*/
*
* @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$
private static final String SEPARATOR = ": "; //$NON-NLS-1$
private static final String ERROR_MSG = "Cannot create a called function of type : "; //$NON-NLS-1$
*/
public static AbstractCalledFunction create(long start, long end, int depth, ITmfStateValue stateValue, int processId, @Nullable ICalledFunction parent) {
switch (stateValue.getType()) {
*/
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 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 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());
}
default:
throw new IllegalArgumentException(ERROR_MSG + stateValue.getType() + SEPARATOR + stateValue.toString());
}
* the parent node
* @return an ICalledFunction with the specified properties
*/
* 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 + ']');
}
if (start > end) {
throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']');
}