1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.apache.commons.numbers.examples.jmh.arrays;
18
19 /**
20 * An interval that provides analysis of indices within the range.
21 *
22 * @since 1.2
23 */
24 interface IntervalAnalysis {
25 /**
26 * Test if the interval is saturated at the specified {@code separation}. The
27 * separation distance is provided as a power of 2.
28 *
29 * <pre>{@code distance = 1 << separation}</pre>
30 *
31 * <p>A saturated interval will have all neighbouring indices separated
32 * <em>approximately</em> within the maximum separation distance.
33 *
34 * <p>Implementations may:
35 * <ol>
36 * <li>Use approximations for performance, for example
37 * compressing indices into blocks of the defined separation.
38 * <pre>{@code c = (i - left) >> separation}</pre>
39 * <li>Support only a range of the possible
40 * {@code separation} values in {@code [0, 30]}. Unsupported {@code separation}
41 * values should return {@code false}.
42 * </ol>
43 *
44 * @param separation Log2 of the maximum separation between indices.
45 * @return true if saturated
46 */
47 boolean saturated(int separation);
48 }