Import views plugins
[deliverable/tracecompass.git] / tmf / org.lttng.scope.tmf2.views.core / src / org / lttng / scope / tmf2 / views / core / MathUtils.java
1 /*
2 * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 */
9
10 package org.lttng.scope.tmf2.views.core;
11
12 /**
13 * Uncommon math utility methods.
14 *
15 * @author Alexandre Montplaisir
16 */
17 public final class MathUtils {
18
19 private MathUtils() {}
20
21 /**
22 * Find the multiple of 'multipleOf' that is greater but closest to
23 * 'number'. If 'number' is already a multiple of 'multipleOf', the same
24 * value will be returned.
25 *
26 * @param number
27 * The starting number
28 * @param multipleOf
29 * We want the returned value to be a multiple of this number
30 * @return The closest, greater multiple
31 */
32 public static long roundToClosestHigherMultiple(long number, long multipleOf) {
33 return (long) (Math.ceil((double) number / multipleOf) * multipleOf);
34 }
35 }
This page took 0.03063 seconds and 5 git commands to generate.