public class ArraysUtil
extends java.lang.Object
Constructor and Description |
---|
ArraysUtil() |
Modifier and Type | Method and Description |
---|---|
static int[][] |
componentsExpandedToRangeOfComponents(boolean[] comps)
Deprecated.
|
static int[][] |
componentsToRangeOfComponents(int[] comps)
Deprecated.
|
static int[][] |
expandedIndexesToRanges(boolean[] expanded)
Changes the representation from the components as an one-dimensional
array to a bi-dimensional array of ranges.
|
static int[][] |
indexesToRanges(int[] indexes)
Converts a one-dimensional array of indexes to a two-dimensional array
of range of indexes.
|
static int[][] |
joinOverlapedRanges(int[][] ranges)
This method joins overlaped ranges.
|
static void |
printByteStream(byte[] buffer,
int length)
Prints out an array of bytes.
|
static int[] |
rangeOfComponentsToComponents(int[][] rangeOfComps)
Deprecated.
|
static boolean[] |
rangeOfComponentsToComponentsExpanded(int[][] rangeOfComps,
int maxComps)
Deprecated.
|
static boolean[] |
rangesToExpandedIndexes(int[][] ranges,
int maxIndex)
Converts a bi-dimensional array of ranges of values to an one-dimensional
array where the positions belonging to the ranges are set to true, and
others to false.
|
static int[] |
rangesToIndexes(int[][] ranges)
Converts from a bi-dimensional array of ranges of values to an
one-dimensional array of indexes.
|
public static int[][] indexesToRanges(int[] indexes)
This method supposes that the input one-dimensional array has not repeated values. Otherwise, output data could not be obtained or it could be wrong.
indexes
- an array of indexes.public static int[] rangesToIndexes(int[][] ranges)
Ranges are supposed that they are not overlpped. Otherwise, output could be wrong.
ranges
- a bi-dimensional array with the ranges of the
indexes. The first dimension is the index of the
range and the second dimension indicates: 0 is the first
index of the range, and 1 is the last index of the range.public static boolean[] rangesToExpandedIndexes(int[][] ranges, int maxIndex)
ranges
- a bi-dimensional array with the ranges of the
indexes. The first dimension is the index of the
range and the second dimension indicates: 0 is the first
index of the range, and 1 is the last index of the range.maxIndex
- is the maximum value of indexes.true
, it means that the indexe was in the range. Otherwise, it was
not.public static int[][] expandedIndexesToRanges(boolean[] expanded)
comps
is an one-dimensional with length the maximum image
components where the selected components are true
.comps
- an one-dimensional array with the indexes of the selected
components set to true
value.public static int[][] joinOverlapedRanges(int[][] ranges)
compsRanges
- a bi-dimensional array with the ranges of the
indexes. The first dimension is the index of the
range and the second dimension indicates: 0 is the first
index of the range, and 1 is the last index of the range.public static void printByteStream(byte[] buffer, int length)
Only for debugging purposes.
buffer
- length
- @Deprecated public static int[][] componentsToRangeOfComponents(int[] comps)
OBS: This method will be deprecated in next releases. It will be replaced
by indexesToRanges(int[])
.
comps
- an array with the component number.@Deprecated public static int[] rangeOfComponentsToComponents(int[][] rangeOfComps)
OBS: This method will be deprecated in next releases. It will be replaced
by #rangesToIndexes(int[])
.
rangeOfComps
- a bi-dimensional array with the ranges of the
components. The first dimension is the index of the
range and the second dimension indicates: 0 the
first component of the range, and 1 the last
component of the range.@Deprecated public static boolean[] rangeOfComponentsToComponentsExpanded(int[][] rangeOfComps, int maxComps)
OBS: This method will be deprecated in next releases. It will be replaced
by #rangesToExpandedIndexes(int[])
.
rangeOfComps
- a bi-dimensional array with the ranges of the
components. The first dimension is the index of the
range and the second dimension indicates: 0 the
first component of the range, and 1 the last
component of the range.maxComps
- is the maximum number of components.true
, it means the component is chosen. Otherwise, it is not
chosen.@Deprecated public static int[][] componentsExpandedToRangeOfComponents(boolean[] comps)
comps
is an one-dimensional with length the maximum image
components where the selected components are true
.
OBS: This method will be deprecated in next releases. It will be replaced
by #expandedIndexesToRanges(int[])
.
comps
- an one-dimensional array with the indexes of the selected
components set to true
value.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)