repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java | ReidSolomonCodes.findErrorEvaluator | void findErrorEvaluator( GrowQueue_I8 syndromes , GrowQueue_I8 errorLocator ,
GrowQueue_I8 evaluator )
{
math.polyMult_flipA(syndromes,errorLocator,evaluator);
int N = errorLocator.size-1;
int offset = evaluator.size-N;
for (int i = 0; i < N; i++) {
evaluator.data[i] = evaluator.data[i+offset];
}
... | java | void findErrorEvaluator( GrowQueue_I8 syndromes , GrowQueue_I8 errorLocator ,
GrowQueue_I8 evaluator )
{
math.polyMult_flipA(syndromes,errorLocator,evaluator);
int N = errorLocator.size-1;
int offset = evaluator.size-N;
for (int i = 0; i < N; i++) {
evaluator.data[i] = evaluator.data[i+offset];
}
... | [
"void",
"findErrorEvaluator",
"(",
"GrowQueue_I8",
"syndromes",
",",
"GrowQueue_I8",
"errorLocator",
",",
"GrowQueue_I8",
"evaluator",
")",
"{",
"math",
".",
"polyMult_flipA",
"(",
"syndromes",
",",
"errorLocator",
",",
"evaluator",
")",
";",
"int",
"N",
"=",
"e... | Compute the error evaluator polynomial Omega.
@param syndromes (Input) syndromes
@param errorLocator (Input) error locator polynomial.
@param evaluator (Output) error evaluator polynomial. large to small coef | [
"Compute",
"the",
"error",
"evaluator",
"polynomial",
"Omega",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/ReidSolomonCodes.java#L294-L313 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java | PyramidOps.declareOutput | public static <O extends ImageGray<O>>
O[] declareOutput( ImagePyramid<?> pyramid , Class<O> outputType ) {
O[] ret = (O[])Array.newInstance(outputType,pyramid.getNumLayers());
for( int i = 0; i < ret.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
ret[i] = GeneralizedImageOps.... | java | public static <O extends ImageGray<O>>
O[] declareOutput( ImagePyramid<?> pyramid , Class<O> outputType ) {
O[] ret = (O[])Array.newInstance(outputType,pyramid.getNumLayers());
for( int i = 0; i < ret.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
ret[i] = GeneralizedImageOps.... | [
"public",
"static",
"<",
"O",
"extends",
"ImageGray",
"<",
"O",
">",
">",
"O",
"[",
"]",
"declareOutput",
"(",
"ImagePyramid",
"<",
"?",
">",
"pyramid",
",",
"Class",
"<",
"O",
">",
"outputType",
")",
"{",
"O",
"[",
"]",
"ret",
"=",
"(",
"O",
"["... | Creates an array of single band images for each layer in the provided pyramid. Each image will
be the same size as the corresponding layer in the pyramid.
@param pyramid (Input) Image pyramid
@param outputType (Input) Output image type
@param <O> Output image type
@return An array of images | [
"Creates",
"an",
"array",
"of",
"single",
"band",
"images",
"for",
"each",
"layer",
"in",
"the",
"provided",
"pyramid",
".",
"Each",
"image",
"will",
"be",
"the",
"same",
"size",
"as",
"the",
"corresponding",
"layer",
"in",
"the",
"pyramid",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java#L51-L62 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java | PyramidOps.reshapeOutput | public static <O extends ImageGray<O>>
void reshapeOutput( ImagePyramid<?> pyramid , O[] output ) {
for( int i = 0; i < output.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
output[i].reshape(w, h);
}
} | java | public static <O extends ImageGray<O>>
void reshapeOutput( ImagePyramid<?> pyramid , O[] output ) {
for( int i = 0; i < output.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
output[i].reshape(w, h);
}
} | [
"public",
"static",
"<",
"O",
"extends",
"ImageGray",
"<",
"O",
">",
">",
"void",
"reshapeOutput",
"(",
"ImagePyramid",
"<",
"?",
">",
"pyramid",
",",
"O",
"[",
"]",
"output",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"output",
"... | Reshapes each image in the array to match the layers in the pyramid
@param pyramid (Input) Image pyramid
@param output (Output) List of images which is to be resized
@param <O> Image type | [
"Reshapes",
"each",
"image",
"in",
"the",
"array",
"to",
"match",
"the",
"layers",
"in",
"the",
"pyramid"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java#L70-L78 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/color/HistogramFeatureOps.java | HistogramFeatureOps.histogram | public static void histogram(GrayU8 image , int maxPixelValue , TupleDesc_F64 histogram )
{
int numBins = histogram.size();
int divisor = maxPixelValue+1;
histogram.fill(0);
for( int y = 0; y < image.height; y++ ) {
int index = image.startIndex + y*image.stride;
for( int x = 0; x < image.width; x++ , ... | java | public static void histogram(GrayU8 image , int maxPixelValue , TupleDesc_F64 histogram )
{
int numBins = histogram.size();
int divisor = maxPixelValue+1;
histogram.fill(0);
for( int y = 0; y < image.height; y++ ) {
int index = image.startIndex + y*image.stride;
for( int x = 0; x < image.width; x++ , ... | [
"public",
"static",
"void",
"histogram",
"(",
"GrayU8",
"image",
",",
"int",
"maxPixelValue",
",",
"TupleDesc_F64",
"histogram",
")",
"{",
"int",
"numBins",
"=",
"histogram",
".",
"size",
"(",
")",
";",
"int",
"divisor",
"=",
"maxPixelValue",
"+",
"1",
";"... | Computes a single-band normalized histogram from an integer image..
@param image Input image. Not modified.
@param maxPixelValue Maximum possible value for a pixel for all bands.
@param histogram Output histogram. Must have same number of bands as input image. Modified. | [
"Computes",
"a",
"single",
"-",
"band",
"normalized",
"histogram",
"from",
"an",
"integer",
"image",
".."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/color/HistogramFeatureOps.java#L52-L69 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/core/image/GeneralizedImageOps.java | GeneralizedImageOps.convertGenericToSpecificType | public static <T> T convertGenericToSpecificType(Class<?> type) {
if (type == GrayI8.class)
return (T) GrayU8.class;
if (type == GrayI16.class)
return (T) GrayS16.class;
if (type == InterleavedI8.class)
return (T) InterleavedU8.class;
if (type == InterleavedI16.class)
return (T) InterleavedS16.class... | java | public static <T> T convertGenericToSpecificType(Class<?> type) {
if (type == GrayI8.class)
return (T) GrayU8.class;
if (type == GrayI16.class)
return (T) GrayS16.class;
if (type == InterleavedI8.class)
return (T) InterleavedU8.class;
if (type == InterleavedI16.class)
return (T) InterleavedS16.class... | [
"public",
"static",
"<",
"T",
">",
"T",
"convertGenericToSpecificType",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"GrayI8",
".",
"class",
")",
"return",
"(",
"T",
")",
"GrayU8",
".",
"class",
";",
"if",
"(",
"type",
"=... | If an image is to be created then the generic type can't be used a specific one needs to be. An arbitrary
specific image type is returned here. | [
"If",
"an",
"image",
"is",
"to",
"be",
"created",
"then",
"the",
"generic",
"type",
"can",
"t",
"be",
"used",
"a",
"specific",
"one",
"needs",
"to",
"be",
".",
"An",
"arbitrary",
"specific",
"image",
"type",
"is",
"returned",
"here",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/core/image/GeneralizedImageOps.java#L293-L303 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/LineImageOps.java | LineImageOps.pruneSimilarLines | public static List<LineParametric2D_F32>
pruneSimilarLines( List<LineParametric2D_F32> lines ,
float intensity[] ,
float toleranceAngle ,
float toleranceDist ,
int imgWidth ,
int imgHeight )
{
int indexSort[] = new int[ intensity.length ];
QuickSort_F32 sort = new QuickSor... | java | public static List<LineParametric2D_F32>
pruneSimilarLines( List<LineParametric2D_F32> lines ,
float intensity[] ,
float toleranceAngle ,
float toleranceDist ,
int imgWidth ,
int imgHeight )
{
int indexSort[] = new int[ intensity.length ];
QuickSort_F32 sort = new QuickSor... | [
"public",
"static",
"List",
"<",
"LineParametric2D_F32",
">",
"pruneSimilarLines",
"(",
"List",
"<",
"LineParametric2D_F32",
">",
"lines",
",",
"float",
"intensity",
"[",
"]",
",",
"float",
"toleranceAngle",
",",
"float",
"toleranceDist",
",",
"int",
"imgWidth",
... | Prunes similar looking lines, but keeps the lines with the most intensity.
@param lines
@param intensity
@param toleranceAngle
@return | [
"Prunes",
"similar",
"looking",
"lines",
"but",
"keeps",
"the",
"lines",
"with",
"the",
"most",
"intensity",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/LineImageOps.java#L73-L130 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/LineImageOps.java | LineImageOps.convert | public static LineSegment2D_F32 convert(LineParametric2D_F32 l,
int width, int height) {
double t0 = (0-l.p.x)/l.getSlopeX();
double t1 = (0-l.p.y)/l.getSlopeY();
double t2 = (width-l.p.x)/l.getSlopeX();
double t3 = (height-l.p.y)/l.getSlopeY();
Point2D_F32 a = computePoint(l, t0);
Point2D_F32 b ... | java | public static LineSegment2D_F32 convert(LineParametric2D_F32 l,
int width, int height) {
double t0 = (0-l.p.x)/l.getSlopeX();
double t1 = (0-l.p.y)/l.getSlopeY();
double t2 = (width-l.p.x)/l.getSlopeX();
double t3 = (height-l.p.y)/l.getSlopeY();
Point2D_F32 a = computePoint(l, t0);
Point2D_F32 b ... | [
"public",
"static",
"LineSegment2D_F32",
"convert",
"(",
"LineParametric2D_F32",
"l",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"double",
"t0",
"=",
"(",
"0",
"-",
"l",
".",
"p",
".",
"x",
")",
"/",
"l",
".",
"getSlopeX",
"(",
")",
";",
... | Find the point in which the line intersects the image border and create a line segment at those points | [
"Find",
"the",
"point",
"in",
"which",
"the",
"line",
"intersects",
"the",
"image",
"border",
"and",
"create",
"a",
"line",
"segment",
"at",
"those",
"points"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/LineImageOps.java#L234-L257 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/RectifyImageOps.java | RectifyImageOps.applyMask | public static void applyMask(GrayF32 disparity , GrayU8 mask , int radius ) {
if( disparity.isSubimage() || mask.isSubimage() )
throw new RuntimeException("Input is subimage. Currently not support but no reason why it can't be. Ask for it");
int N = disparity.width*disparity.height;
for (int i = 0; i < N; i++... | java | public static void applyMask(GrayF32 disparity , GrayU8 mask , int radius ) {
if( disparity.isSubimage() || mask.isSubimage() )
throw new RuntimeException("Input is subimage. Currently not support but no reason why it can't be. Ask for it");
int N = disparity.width*disparity.height;
for (int i = 0; i < N; i++... | [
"public",
"static",
"void",
"applyMask",
"(",
"GrayF32",
"disparity",
",",
"GrayU8",
"mask",
",",
"int",
"radius",
")",
"{",
"if",
"(",
"disparity",
".",
"isSubimage",
"(",
")",
"||",
"mask",
".",
"isSubimage",
"(",
")",
")",
"throw",
"new",
"RuntimeExce... | Applies a mask which indicates which pixels had mappings to the unrectified image. Pixels which were
outside of the original image will be set to 255. The border is extended because the sharp edge
in the rectified image can cause in incorrect match between image features.
@param disparity (Input) disparity
@param mask... | [
"Applies",
"a",
"mask",
"which",
"indicates",
"which",
"pixels",
"had",
"mappings",
"to",
"the",
"unrectified",
"image",
".",
"Pixels",
"which",
"were",
"outside",
"of",
"the",
"original",
"image",
"will",
"be",
"set",
"to",
"255",
".",
"The",
"border",
"i... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/RectifyImageOps.java#L437-L472 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java | FitLinesToContour.fitAnchored | public boolean fitAnchored( int anchor0 , int anchor1 , GrowQueue_I32 corners , GrowQueue_I32 output )
{
this.anchor0 = anchor0;
this.anchor1 = anchor1;
int numLines = anchor0==anchor1? corners.size() : CircularIndex.distanceP(anchor0,anchor1,corners.size);
if( numLines < 2 ) {
throw new RuntimeException("... | java | public boolean fitAnchored( int anchor0 , int anchor1 , GrowQueue_I32 corners , GrowQueue_I32 output )
{
this.anchor0 = anchor0;
this.anchor1 = anchor1;
int numLines = anchor0==anchor1? corners.size() : CircularIndex.distanceP(anchor0,anchor1,corners.size);
if( numLines < 2 ) {
throw new RuntimeException("... | [
"public",
"boolean",
"fitAnchored",
"(",
"int",
"anchor0",
",",
"int",
"anchor1",
",",
"GrowQueue_I32",
"corners",
",",
"GrowQueue_I32",
"output",
")",
"{",
"this",
".",
"anchor0",
"=",
"anchor0",
";",
"this",
".",
"anchor1",
"=",
"anchor1",
";",
"int",
"n... | Fits line segments along the contour with the first and last corner fixed at the original corners. The output
will be a new set of corner indexes. Since the corner list is circular, it is assumed that anchor1 comes after
anchor0. The same index can be specified for an anchor, it will just go around the entire circle... | [
"Fits",
"line",
"segments",
"along",
"the",
"contour",
"with",
"the",
"first",
"and",
"last",
"corner",
"fixed",
"at",
"the",
"original",
"corners",
".",
"The",
"output",
"will",
"be",
"a",
"new",
"set",
"of",
"corner",
"indexes",
".",
"Since",
"the",
"c... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L91-L132 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java | FitLinesToContour.sanityCheckCornerOrder | boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) {
int contourAnchor0 = corners.get(anchor0);
int previous = 0;
for (int i = 1; i < numLines; i++) {
int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size()));
int pixelsFromAnchor0 = CircularIndex.distanceP(conto... | java | boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) {
int contourAnchor0 = corners.get(anchor0);
int previous = 0;
for (int i = 1; i < numLines; i++) {
int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size()));
int pixelsFromAnchor0 = CircularIndex.distanceP(conto... | [
"boolean",
"sanityCheckCornerOrder",
"(",
"int",
"numLines",
",",
"GrowQueue_I32",
"corners",
")",
"{",
"int",
"contourAnchor0",
"=",
"corners",
".",
"get",
"(",
"anchor0",
")",
";",
"int",
"previous",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";"... | All the corners should be in increasing order from the first anchor. | [
"All",
"the",
"corners",
"should",
"be",
"in",
"increasing",
"order",
"from",
"the",
"first",
"anchor",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L157-L171 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java | FitLinesToContour.fitLinesUsingCorners | boolean fitLinesUsingCorners( int numLines , GrowQueue_I32 cornerIndexes) {
for (int i = 1; i <= numLines; i++) {
int index0 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i - 1, cornerIndexes.size));
int index1 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i, cornerIndexes.size));
if( index0 =... | java | boolean fitLinesUsingCorners( int numLines , GrowQueue_I32 cornerIndexes) {
for (int i = 1; i <= numLines; i++) {
int index0 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i - 1, cornerIndexes.size));
int index1 = cornerIndexes.get(CircularIndex.addOffset(anchor0, i, cornerIndexes.size));
if( index0 =... | [
"boolean",
"fitLinesUsingCorners",
"(",
"int",
"numLines",
",",
"GrowQueue_I32",
"cornerIndexes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"numLines",
";",
"i",
"++",
")",
"{",
"int",
"index0",
"=",
"cornerIndexes",
".",
"get",
"(",
... | Fits lines across the sequence of corners
@param numLines number of lines it will fit | [
"Fits",
"lines",
"across",
"the",
"sequence",
"of",
"corners"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L270-L288 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java | FitLinesToContour.fitLine | boolean fitLine( int contourIndex0 , int contourIndex1 , LineGeneral2D_F64 line ) {
int numPixels = CircularIndex.distanceP(contourIndex0,contourIndex1,contour.size());
// if its too small
if( numPixels < minimumLineLength )
return false;
Point2D_I32 c0 = contour.get(contourIndex0);
Point2D_I32 c1 = cont... | java | boolean fitLine( int contourIndex0 , int contourIndex1 , LineGeneral2D_F64 line ) {
int numPixels = CircularIndex.distanceP(contourIndex0,contourIndex1,contour.size());
// if its too small
if( numPixels < minimumLineLength )
return false;
Point2D_I32 c0 = contour.get(contourIndex0);
Point2D_I32 c1 = cont... | [
"boolean",
"fitLine",
"(",
"int",
"contourIndex0",
",",
"int",
"contourIndex1",
",",
"LineGeneral2D_F64",
"line",
")",
"{",
"int",
"numPixels",
"=",
"CircularIndex",
".",
"distanceP",
"(",
"contourIndex0",
",",
"contourIndex1",
",",
"contour",
".",
"size",
"(",
... | Given a sequence of points on the contour find the best fit line.
@param contourIndex0 contour index of first point in the sequence
@param contourIndex1 contour index of last point (exclusive) in the sequence
@param line storage for the found line
@return true if successful or false if it failed | [
"Given",
"a",
"sequence",
"of",
"points",
"on",
"the",
"contour",
"find",
"the",
"best",
"fit",
"line",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L298-L335 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java | FitLinesToContour.closestPoint | int closestPoint( Point2D_F64 target ) {
double bestDistance = Double.MAX_VALUE;
int bestIndex = -1;
for (int i = 0; i < contour.size(); i++) {
Point2D_I32 c = contour.get(i);
double d = UtilPoint2D_F64.distanceSq(target.x,target.y,c.x,c.y);
if( d < bestDistance ) {
bestDistance = d;
bestIndex =... | java | int closestPoint( Point2D_F64 target ) {
double bestDistance = Double.MAX_VALUE;
int bestIndex = -1;
for (int i = 0; i < contour.size(); i++) {
Point2D_I32 c = contour.get(i);
double d = UtilPoint2D_F64.distanceSq(target.x,target.y,c.x,c.y);
if( d < bestDistance ) {
bestDistance = d;
bestIndex =... | [
"int",
"closestPoint",
"(",
"Point2D_F64",
"target",
")",
"{",
"double",
"bestDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"int",
"bestIndex",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"contour",
".",
"size",
"(",
")",
... | Returns the closest point on the contour to the provided point in space
@return index of closest point | [
"Returns",
"the",
"closest",
"point",
"on",
"the",
"contour",
"to",
"the",
"provided",
"point",
"in",
"space"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L341-L354 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeBinaryGridToPixel.java | QrCodeBinaryGridToPixel.setTransformFromLinesSquare | public void setTransformFromLinesSquare( QrCode qr ) {
// clear old points
storagePairs2D.reset();
storagePairs3D.reset();
// use 3 of the corners to set the coordinate system
// set(0, 0, qr.ppCorner,0); <-- prone to damage. Significantly degrades results if used
set(0, 7, qr.ppCorner,1);
set(7, 7, qr.pp... | java | public void setTransformFromLinesSquare( QrCode qr ) {
// clear old points
storagePairs2D.reset();
storagePairs3D.reset();
// use 3 of the corners to set the coordinate system
// set(0, 0, qr.ppCorner,0); <-- prone to damage. Significantly degrades results if used
set(0, 7, qr.ppCorner,1);
set(7, 7, qr.pp... | [
"public",
"void",
"setTransformFromLinesSquare",
"(",
"QrCode",
"qr",
")",
"{",
"// clear old points",
"storagePairs2D",
".",
"reset",
"(",
")",
";",
"storagePairs3D",
".",
"reset",
"(",
")",
";",
"// use 3 of the corners to set the coordinate system",
"//\t\tset(0, 0, qr... | Used to estimate the image to grid coordinate system before the version is known. The top left square is
used to fix the coordinate system. Then 4 lines between corners going to other QR codes is used to
make it less suspectable to errors in the first 4 corners | [
"Used",
"to",
"estimate",
"the",
"image",
"to",
"grid",
"coordinate",
"system",
"before",
"the",
"version",
"is",
"known",
".",
"The",
"top",
"left",
"square",
"is",
"used",
"to",
"fix",
"the",
"coordinate",
"system",
".",
"Then",
"4",
"lines",
"between",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeBinaryGridToPixel.java#L83-L107 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeBinaryGridToPixel.java | QrCodeBinaryGridToPixel.removeOutsideCornerFeatures | public void removeOutsideCornerFeatures() {
if( pairs2D.size() != storagePairs2D.size )
throw new RuntimeException("This can only be called when all the features have been added");
pairs2D.remove(11);
pairs2D.remove(5);
pairs2D.remove(0);
} | java | public void removeOutsideCornerFeatures() {
if( pairs2D.size() != storagePairs2D.size )
throw new RuntimeException("This can only be called when all the features have been added");
pairs2D.remove(11);
pairs2D.remove(5);
pairs2D.remove(0);
} | [
"public",
"void",
"removeOutsideCornerFeatures",
"(",
")",
"{",
"if",
"(",
"pairs2D",
".",
"size",
"(",
")",
"!=",
"storagePairs2D",
".",
"size",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"This can only be called when all the features have been added\"",
")",
";... | Outside corners on position patterns are more likely to be damaged, so remove them | [
"Outside",
"corners",
"on",
"position",
"patterns",
"are",
"more",
"likely",
"to",
"be",
"damaged",
"so",
"remove",
"them"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeBinaryGridToPixel.java#L142-L149 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/peak/FactorySearchLocalPeak.java | FactorySearchLocalPeak.meanShiftUniform | public static <T extends ImageGray<T>>
SearchLocalPeak<T> meanShiftUniform( int maxIterations, float convergenceTol , Class<T> imageType ) {
WeightPixel_F32 weights = new WeightPixelUniform_F32();
MeanShiftPeak<T> alg = new MeanShiftPeak<>(maxIterations, convergenceTol, weights, imageType);
return new MeanShiftP... | java | public static <T extends ImageGray<T>>
SearchLocalPeak<T> meanShiftUniform( int maxIterations, float convergenceTol , Class<T> imageType ) {
WeightPixel_F32 weights = new WeightPixelUniform_F32();
MeanShiftPeak<T> alg = new MeanShiftPeak<>(maxIterations, convergenceTol, weights, imageType);
return new MeanShiftP... | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"SearchLocalPeak",
"<",
"T",
">",
"meanShiftUniform",
"(",
"int",
"maxIterations",
",",
"float",
"convergenceTol",
",",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"WeightPixel_F32"... | Mean-shift based search with a uniform kernel
@param maxIterations Maximum number of iterations. Try 15
@param convergenceTol Convergence tolerance. try 1e-3
@param imageType Type of input image
@return mean-shift search | [
"Mean",
"-",
"shift",
"based",
"search",
"with",
"a",
"uniform",
"kernel"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/peak/FactorySearchLocalPeak.java#L43-L48 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/peak/FactorySearchLocalPeak.java | FactorySearchLocalPeak.meanShiftGaussian | public static <T extends ImageGray<T>>
SearchLocalPeak<T> meanShiftGaussian( int maxIterations, float convergenceTol , Class<T> imageType) {
WeightPixel_F32 weights = new WeightPixelGaussian_F32();
MeanShiftPeak<T> alg = new MeanShiftPeak<>(maxIterations, convergenceTol, weights, imageType);
return new MeanShift... | java | public static <T extends ImageGray<T>>
SearchLocalPeak<T> meanShiftGaussian( int maxIterations, float convergenceTol , Class<T> imageType) {
WeightPixel_F32 weights = new WeightPixelGaussian_F32();
MeanShiftPeak<T> alg = new MeanShiftPeak<>(maxIterations, convergenceTol, weights, imageType);
return new MeanShift... | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"SearchLocalPeak",
"<",
"T",
">",
"meanShiftGaussian",
"(",
"int",
"maxIterations",
",",
"float",
"convergenceTol",
",",
"Class",
"<",
"T",
">",
"imageType",
")",
"{",
"WeightPixel_F32... | Mean-shift based search with a Gaussian kernel
@param maxIterations Maximum number of iterations. Try 15
@param convergenceTol Convergence tolerance. try 1e-3
@param imageType Type of input image
@return mean-shift search | [
"Mean",
"-",
"shift",
"based",
"search",
"with",
"a",
"Gaussian",
"kernel"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/peak/FactorySearchLocalPeak.java#L57-L62 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.loopBlocks | public static void loopBlocks(int start , int endExclusive , int minBlock,
IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
thro... | java | public static void loopBlocks(int start , int endExclusive , int minBlock,
IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
thro... | [
"public",
"static",
"void",
"loopBlocks",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"int",
"minBlock",
",",
"IntRangeConsumer",
"consumer",
")",
"{",
"final",
"ForkJoinPool",
"pool",
"=",
"BoofConcurrency",
".",
"pool",
";",
"int",
"numThreads",
"=... | Automatically breaks the problem up into blocks based on the number of threads available. It is assumed
that there is some cost associated with processing a block and the number of blocks is minimized.
Examples:
<ul>
<li>Given a range of 0 to 100, and minBlock is 5, and 10 threads. Blocks will be size 10.</li>
<li>Giv... | [
"Automatically",
"breaks",
"the",
"problem",
"up",
"into",
"blocks",
"based",
"on",
"the",
"number",
"of",
"threads",
"available",
".",
"It",
"is",
"assumed",
"that",
"there",
"is",
"some",
"cost",
"associated",
"with",
"processing",
"a",
"block",
"and",
"th... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L101-L119 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.loopBlocks | public static void loopBlocks(int start , int endExclusive , IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
throw new IllegalArgumentExc... | java | public static void loopBlocks(int start , int endExclusive , IntRangeConsumer consumer ) {
final ForkJoinPool pool = BoofConcurrency.pool;
int numThreads = pool.getParallelism();
int range = endExclusive-start;
if( range == 0 ) // nothing to do here!
return;
if( range < 0 )
throw new IllegalArgumentExc... | [
"public",
"static",
"void",
"loopBlocks",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"IntRangeConsumer",
"consumer",
")",
"{",
"final",
"ForkJoinPool",
"pool",
"=",
"BoofConcurrency",
".",
"pool",
";",
"int",
"numThreads",
"=",
"pool",
".",
"getPara... | Splits the range of values up into blocks. It's assumed the cost to process a block is small so
more can be created.
@param start First index, inclusive
@param endExclusive Last index, exclusive
@param consumer The consumer | [
"Splits",
"the",
"range",
"of",
"values",
"up",
"into",
"blocks",
".",
"It",
"s",
"assumed",
"the",
"cost",
"to",
"process",
"a",
"block",
"is",
"small",
"so",
"more",
"can",
"be",
"created",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L136-L155 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.sum | public static Number sum(int start , int endExclusive , Class type, IntProducerNumber producer ) {
try {
return pool.submit(new IntOperatorTask.Sum(start,endExclusive,type,producer)).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
} | java | public static Number sum(int start , int endExclusive , Class type, IntProducerNumber producer ) {
try {
return pool.submit(new IntOperatorTask.Sum(start,endExclusive,type,producer)).get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"Number",
"sum",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"Class",
"type",
",",
"IntProducerNumber",
"producer",
")",
"{",
"try",
"{",
"return",
"pool",
".",
"submit",
"(",
"new",
"IntOperatorTask",
".",
"Sum",
"(",
"start"... | Computes sums up the results using the specified primitive type
@param start First index, inclusive
@param endExclusive Last index, exclusive
@param type Primtive data type, e.g. int.class, float.class, double.class
@param producer Given an integer input produce a Number output
@return The sum | [
"Computes",
"sums",
"up",
"the",
"results",
"using",
"the",
"specified",
"primitive",
"type"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L166-L172 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/lists/RecycleStack.java | RecycleStack.pop | public synchronized T pop() {
if( list.isEmpty() ) {
return factory.newInstance();
} else {
return list.remove(list.size()-1);
}
} | java | public synchronized T pop() {
if( list.isEmpty() ) {
return factory.newInstance();
} else {
return list.remove(list.size()-1);
}
} | [
"public",
"synchronized",
"T",
"pop",
"(",
")",
"{",
"if",
"(",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"factory",
".",
"newInstance",
"(",
")",
";",
"}",
"else",
"{",
"return",
"list",
".",
"remove",
"(",
"list",
".",
"size",
"(",
... | Returns an instance. If there are instances queued up internally one of those is returned. Otherwise
a new instance is created.
@return object instance | [
"Returns",
"an",
"instance",
".",
"If",
"there",
"are",
"instances",
"queued",
"up",
"internally",
"one",
"of",
"those",
"is",
"returned",
".",
"Otherwise",
"a",
"new",
"instance",
"is",
"created",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/lists/RecycleStack.java#L49-L55 | train |
lessthanoptimal/BoofCV | applications/src/main/java/boofcv/app/fiducials/CreateFiducialDocumentPDF.java | CreateFiducialDocumentPDF.printGrid | private void printGrid(PDPageContentStream pcs, float offsetX , float offsetY,
int numRows, int numCols , float sizeBox ) throws IOException {
float pageWidth = (float)paper.convertWidth(units)*UNIT_TO_POINTS;
float pageHeight = (float)paper.convertHeight(units)*UNIT_TO_POINTS;
// pcs.setLineCapStyle(1);... | java | private void printGrid(PDPageContentStream pcs, float offsetX , float offsetY,
int numRows, int numCols , float sizeBox ) throws IOException {
float pageWidth = (float)paper.convertWidth(units)*UNIT_TO_POINTS;
float pageHeight = (float)paper.convertHeight(units)*UNIT_TO_POINTS;
// pcs.setLineCapStyle(1);... | [
"private",
"void",
"printGrid",
"(",
"PDPageContentStream",
"pcs",
",",
"float",
"offsetX",
",",
"float",
"offsetY",
",",
"int",
"numRows",
",",
"int",
"numCols",
",",
"float",
"sizeBox",
")",
"throws",
"IOException",
"{",
"float",
"pageWidth",
"=",
"(",
"fl... | Draws the grid in light grey on the document | [
"Draws",
"the",
"grid",
"in",
"light",
"grey",
"on",
"the",
"document"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/applications/src/main/java/boofcv/app/fiducials/CreateFiducialDocumentPDF.java#L191-L210 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/abst/filter/derivative/AnyImageDerivative.java | AnyImageDerivative.setInput | public void setInput( I input ) {
this.inputImage = input;
// reset the state flag so that everything need sto be computed
if( stale != null ) {
for( int i = 0; i < stale.length; i++) {
boolean a[] = stale[i];
for( int j = 0; j < a.length; j++ ) {
a[j] = true;
}
}
}
} | java | public void setInput( I input ) {
this.inputImage = input;
// reset the state flag so that everything need sto be computed
if( stale != null ) {
for( int i = 0; i < stale.length; i++) {
boolean a[] = stale[i];
for( int j = 0; j < a.length; j++ ) {
a[j] = true;
}
}
}
} | [
"public",
"void",
"setInput",
"(",
"I",
"input",
")",
"{",
"this",
".",
"inputImage",
"=",
"input",
";",
"// reset the state flag so that everything need sto be computed",
"if",
"(",
"stale",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Sets the new input image from which the image derivatives are computed from.
@param input Input image. | [
"Sets",
"the",
"new",
"input",
"image",
"from",
"which",
"the",
"image",
"derivatives",
"are",
"computed",
"from",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/abst/filter/derivative/AnyImageDerivative.java#L131-L143 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/abst/feature/dense/GenericDenseDescribeImageDense.java | GenericDenseDescribeImageDense.configure | public void configure( double descriptorRegionScale , double periodX, double periodY) {
this.radius = descriptorRegionScale*scaleToRadius;
this.periodX = (int)(periodX+0.5);
this.periodY = (int)(periodY+0.5);
this.featureWidth = (int)(alg.getCanonicalWidth()*descriptorRegionScale + 0.5);
descriptions = new F... | java | public void configure( double descriptorRegionScale , double periodX, double periodY) {
this.radius = descriptorRegionScale*scaleToRadius;
this.periodX = (int)(periodX+0.5);
this.periodY = (int)(periodY+0.5);
this.featureWidth = (int)(alg.getCanonicalWidth()*descriptorRegionScale + 0.5);
descriptions = new F... | [
"public",
"void",
"configure",
"(",
"double",
"descriptorRegionScale",
",",
"double",
"periodX",
",",
"double",
"periodY",
")",
"{",
"this",
".",
"radius",
"=",
"descriptorRegionScale",
"*",
"scaleToRadius",
";",
"this",
".",
"periodX",
"=",
"(",
"int",
")",
... | Configures size of the descriptor and the frequency at which it's computed
@param descriptorRegionScale Relative size of the descriptor region to its canonical size
@param periodX Period in pixels along x-axis of samples
@param periodY Period in pixels along y-axis of samples | [
"Configures",
"size",
"of",
"the",
"descriptor",
"and",
"the",
"frequency",
"at",
"which",
"it",
"s",
"computed"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/abst/feature/dense/GenericDenseDescribeImageDense.java#L80-L92 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java | SceneStructureCommon.setPoint | public void setPoint( int which , double x , double y , double z ) {
points[which].set(x,y,z);
} | java | public void setPoint( int which , double x , double y , double z ) {
points[which].set(x,y,z);
} | [
"public",
"void",
"setPoint",
"(",
"int",
"which",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"points",
"[",
"which",
"]",
".",
"set",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] | Specifies the location of a point in 3D space
@param which Which point is being specified
@param x coordinate along x-axis
@param y coordinate along y-axis
@param z coordinate along z-axis | [
"Specifies",
"the",
"location",
"of",
"a",
"point",
"in",
"3D",
"space"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java#L52-L54 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java | SceneStructureCommon.connectPointToView | public void connectPointToView( int pointIndex , int viewIndex ) {
SceneStructureMetric.Point p = points[pointIndex];
for (int i = 0; i < p.views.size; i++) {
if( p.views.data[i] == viewIndex )
throw new IllegalArgumentException("Tried to add the same view twice. viewIndex="+viewIndex);
}
p.views.add(vi... | java | public void connectPointToView( int pointIndex , int viewIndex ) {
SceneStructureMetric.Point p = points[pointIndex];
for (int i = 0; i < p.views.size; i++) {
if( p.views.data[i] == viewIndex )
throw new IllegalArgumentException("Tried to add the same view twice. viewIndex="+viewIndex);
}
p.views.add(vi... | [
"public",
"void",
"connectPointToView",
"(",
"int",
"pointIndex",
",",
"int",
"viewIndex",
")",
"{",
"SceneStructureMetric",
".",
"Point",
"p",
"=",
"points",
"[",
"pointIndex",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"p",
".",
"view... | Specifies that the point was observed in this view.
@param pointIndex index of point
@param viewIndex index of view | [
"Specifies",
"that",
"the",
"point",
"was",
"observed",
"in",
"this",
"view",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java#L73-L81 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java | SceneStructureCommon.removePoints | public void removePoints( GrowQueue_I32 which ) {
SceneStructureMetric.Point results[] = new SceneStructureMetric.Point[points.length-which.size];
int indexWhich = 0;
for (int i = 0; i < points.length ; i++) {
if( indexWhich < which.size && which.data[indexWhich] == i ) {
indexWhich++;
} else {
res... | java | public void removePoints( GrowQueue_I32 which ) {
SceneStructureMetric.Point results[] = new SceneStructureMetric.Point[points.length-which.size];
int indexWhich = 0;
for (int i = 0; i < points.length ; i++) {
if( indexWhich < which.size && which.data[indexWhich] == i ) {
indexWhich++;
} else {
res... | [
"public",
"void",
"removePoints",
"(",
"GrowQueue_I32",
"which",
")",
"{",
"SceneStructureMetric",
".",
"Point",
"results",
"[",
"]",
"=",
"new",
"SceneStructureMetric",
".",
"Point",
"[",
"points",
".",
"length",
"-",
"which",
".",
"size",
"]",
";",
"int",
... | Removes the points specified in 'which' from the list of points. 'which' must be ordered
from lowest to highest index.
@param which Ordered list of point indexes to remove | [
"Removes",
"the",
"points",
"specified",
"in",
"which",
"from",
"the",
"list",
"of",
"points",
".",
"which",
"must",
"be",
"ordered",
"from",
"lowest",
"to",
"highest",
"index",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java#L93-L106 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/robust/SelectBestStereoTransform.java | SelectBestStereoTransform.select | public void select(List<Se3_F64> candidatesAtoB,
List<AssociatedPair> observations ,
Se3_F64 model ) {
// use positive depth constraint to select the best one
Se3_F64 bestModel = null;
int bestCount = -1;
for( int i = 0; i < candidatesAtoB.size(); i++ ) {
Se3_F64 s = candidatesAtoB.get(i);
... | java | public void select(List<Se3_F64> candidatesAtoB,
List<AssociatedPair> observations ,
Se3_F64 model ) {
// use positive depth constraint to select the best one
Se3_F64 bestModel = null;
int bestCount = -1;
for( int i = 0; i < candidatesAtoB.size(); i++ ) {
Se3_F64 s = candidatesAtoB.get(i);
... | [
"public",
"void",
"select",
"(",
"List",
"<",
"Se3_F64",
">",
"candidatesAtoB",
",",
"List",
"<",
"AssociatedPair",
">",
"observations",
",",
"Se3_F64",
"model",
")",
"{",
"// use positive depth constraint to select the best one",
"Se3_F64",
"bestModel",
"=",
"null",
... | Selects the transform which describes a view where observations appear in front of the camera the most
@param candidatesAtoB List of possible transforms
@param observations observations in both stereo cameras in normalized image coordinates
@param model (Output) the selected transform from a to b | [
"Selects",
"the",
"transform",
"which",
"describes",
"a",
"view",
"where",
"observations",
"appear",
"in",
"front",
"of",
"the",
"camera",
"the",
"most"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/robust/SelectBestStereoTransform.java#L60-L86 | train |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/image/GrayF32.java | GrayF32.get | public float get(int x, int y) {
if (!isInBounds(x, y))
throw new ImageAccessException("Requested pixel is out of bounds: ( " + x + " , " + y + " )");
return unsafe_get(x,y);
} | java | public float get(int x, int y) {
if (!isInBounds(x, y))
throw new ImageAccessException("Requested pixel is out of bounds: ( " + x + " , " + y + " )");
return unsafe_get(x,y);
} | [
"public",
"float",
"get",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"!",
"isInBounds",
"(",
"x",
",",
"y",
")",
")",
"throw",
"new",
"ImageAccessException",
"(",
"\"Requested pixel is out of bounds: ( \"",
"+",
"x",
"+",
"\" , \"",
"+",
"y",... | Returns the value of the specified pixel.
@param x pixel coordinate.
@param y pixel coordinate.
@return Pixel intensity value. | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"pixel",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/GrayF32.java#L55-L60 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java | BinaryThinning.apply | public void apply(GrayU8 binary , int maxLoops) {
this.binary = binary;
inputBorder.setImage(binary);
ones0.reset();
zerosOut.reset();
findOnePixels(ones0);
for (int loop = 0; (loop < maxLoops || maxLoops == -1) && ones0.size > 0; loop++) {
boolean changed = false;
// do one cycle through all the... | java | public void apply(GrayU8 binary , int maxLoops) {
this.binary = binary;
inputBorder.setImage(binary);
ones0.reset();
zerosOut.reset();
findOnePixels(ones0);
for (int loop = 0; (loop < maxLoops || maxLoops == -1) && ones0.size > 0; loop++) {
boolean changed = false;
// do one cycle through all the... | [
"public",
"void",
"apply",
"(",
"GrayU8",
"binary",
",",
"int",
"maxLoops",
")",
"{",
"this",
".",
"binary",
"=",
"binary",
";",
"inputBorder",
".",
"setImage",
"(",
"binary",
")",
";",
"ones0",
".",
"reset",
"(",
")",
";",
"zerosOut",
".",
"reset",
... | Applies the thinning algorithm. Runs for the specified number of loops or until no change is detected.
@param binary Input binary image which is to be thinned. This is modified
@param maxLoops Maximum number of thinning loops. Set to -1 to run until the image is no longer modified. | [
"Applies",
"the",
"thinning",
"algorithm",
".",
"Runs",
"for",
"the",
"specified",
"number",
"of",
"loops",
"or",
"until",
"no",
"change",
"is",
"detected",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java#L99-L136 | train |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java | BinaryThinning.findOnePixels | protected void findOnePixels(GrowQueue_I32 ones) {
for (int y = 0; y < binary.height; y++) {
int index = binary.startIndex + y* binary.stride;
for (int x = 0; x < binary.width; x++, index++) {
if( binary.data[index] != 0 ) {
ones.add(index);
}
}
}
} | java | protected void findOnePixels(GrowQueue_I32 ones) {
for (int y = 0; y < binary.height; y++) {
int index = binary.startIndex + y* binary.stride;
for (int x = 0; x < binary.width; x++, index++) {
if( binary.data[index] != 0 ) {
ones.add(index);
}
}
}
} | [
"protected",
"void",
"findOnePixels",
"(",
"GrowQueue_I32",
"ones",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"binary",
".",
"height",
";",
"y",
"++",
")",
"{",
"int",
"index",
"=",
"binary",
".",
"startIndex",
"+",
"y",
"*",
"bina... | Scans through the image and record the array index of all marked pixels | [
"Scans",
"through",
"the",
"image",
"and",
"record",
"the",
"array",
"index",
"of",
"all",
"marked",
"pixels"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java#L141-L150 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java | PruneStructureFromSceneMetric.pruneObservationsBehindCamera | public void pruneObservationsBehindCamera() {
Point3D_F64 X = new Point3D_F64();
for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
SceneObservations.View v = observations.views[viewIndex];
SceneStructureMetric.View view = structure.views[viewIndex];
for (int pointIndex = 0; po... | java | public void pruneObservationsBehindCamera() {
Point3D_F64 X = new Point3D_F64();
for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
SceneObservations.View v = observations.views[viewIndex];
SceneStructureMetric.View view = structure.views[viewIndex];
for (int pointIndex = 0; po... | [
"public",
"void",
"pruneObservationsBehindCamera",
"(",
")",
"{",
"Point3D_F64",
"X",
"=",
"new",
"Point3D_F64",
"(",
")",
";",
"for",
"(",
"int",
"viewIndex",
"=",
"0",
";",
"viewIndex",
"<",
"observations",
".",
"views",
".",
"length",
";",
"viewIndex",
... | Check to see if a point is behind the camera which is viewing it. If it is remove that observation
since it can't possibly be observed. | [
"Check",
"to",
"see",
"if",
"a",
"point",
"is",
"behind",
"the",
"camera",
"which",
"is",
"viewing",
"it",
".",
"If",
"it",
"is",
"remove",
"that",
"observation",
"since",
"it",
"can",
"t",
"possibly",
"be",
"observed",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java#L143-L170 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java | PruneStructureFromSceneMetric.prunePoints | public void prunePoints(int neighbors , double distance ) {
// Use a nearest neighbor search to find near by points
Point3D_F64 worldX = new Point3D_F64();
List<Point3D_F64> cloud = new ArrayList<>();
for (int i = 0; i < structure.points.length; i++) {
SceneStructureMetric.Point structureP = structure.point... | java | public void prunePoints(int neighbors , double distance ) {
// Use a nearest neighbor search to find near by points
Point3D_F64 worldX = new Point3D_F64();
List<Point3D_F64> cloud = new ArrayList<>();
for (int i = 0; i < structure.points.length; i++) {
SceneStructureMetric.Point structureP = structure.point... | [
"public",
"void",
"prunePoints",
"(",
"int",
"neighbors",
",",
"double",
"distance",
")",
"{",
"// Use a nearest neighbor search to find near by points",
"Point3D_F64",
"worldX",
"=",
"new",
"Point3D_F64",
"(",
")",
";",
"List",
"<",
"Point3D_F64",
">",
"cloud",
"="... | Prune a feature it has fewer than X neighbors within Y distance. Observations
associated with this feature are also pruned.
Call {@link #pruneViews(int)} to makes sure the graph is valid.
@param neighbors Number of other features which need to be near by
@param distance Maximum distance a point can be to be considere... | [
"Prune",
"a",
"feature",
"it",
"has",
"fewer",
"than",
"X",
"neighbors",
"within",
"Y",
"distance",
".",
"Observations",
"associated",
"with",
"this",
"feature",
"are",
"also",
"pruned",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java#L235-L286 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java | PruneStructureFromSceneMetric.pruneViews | public void pruneViews( int count ) {
List<SceneStructureMetric.View> remainingS = new ArrayList<>();
List<SceneObservations.View> remainingO = new ArrayList<>();
for (int viewId = 0; viewId < structure.views.length; viewId++) {
SceneObservations.View view = observations.views[viewId];
// See if has enoug... | java | public void pruneViews( int count ) {
List<SceneStructureMetric.View> remainingS = new ArrayList<>();
List<SceneObservations.View> remainingO = new ArrayList<>();
for (int viewId = 0; viewId < structure.views.length; viewId++) {
SceneObservations.View view = observations.views[viewId];
// See if has enoug... | [
"public",
"void",
"pruneViews",
"(",
"int",
"count",
")",
"{",
"List",
"<",
"SceneStructureMetric",
".",
"View",
">",
"remainingS",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"SceneObservations",
".",
"View",
">",
"remainingO",
"=",
"new",
... | Removes views with less than 'count' features visible. Observations of features in removed views are also
removed.
@param count Prune if it has this number of views or less | [
"Removes",
"views",
"with",
"less",
"than",
"count",
"features",
"visible",
".",
"Observations",
"of",
"features",
"in",
"removed",
"views",
"are",
"also",
"removed",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java#L294-L327 | train |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java | PruneStructureFromSceneMetric.pruneUnusedCameras | public void pruneUnusedCameras() {
// Count how many views are used by each camera
int histogram[] = new int[structure.cameras.length];
for (int i = 0; i < structure.views.length; i++) {
histogram[structure.views[i].camera]++;
}
// See which cameras need to be removed and create a look up table from old ... | java | public void pruneUnusedCameras() {
// Count how many views are used by each camera
int histogram[] = new int[structure.cameras.length];
for (int i = 0; i < structure.views.length; i++) {
histogram[structure.views[i].camera]++;
}
// See which cameras need to be removed and create a look up table from old ... | [
"public",
"void",
"pruneUnusedCameras",
"(",
")",
"{",
"// Count how many views are used by each camera",
"int",
"histogram",
"[",
"]",
"=",
"new",
"int",
"[",
"structure",
".",
"cameras",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Prunes cameras that are not referenced by any views. | [
"Prunes",
"cameras",
"that",
"are",
"not",
"referenced",
"by",
"any",
"views",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java#L332-L361 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.setIntrinsic | public void setIntrinsic(CameraPinholeBrown intrinsic) {
planeProjection.setIntrinsic(intrinsic);
normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false,true);
pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false);
// Find the change in angle caused by a pixel error i... | java | public void setIntrinsic(CameraPinholeBrown intrinsic) {
planeProjection.setIntrinsic(intrinsic);
normToPixel = LensDistortionFactory.narrow(intrinsic).distort_F64(false,true);
pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false);
// Find the change in angle caused by a pixel error i... | [
"public",
"void",
"setIntrinsic",
"(",
"CameraPinholeBrown",
"intrinsic",
")",
"{",
"planeProjection",
".",
"setIntrinsic",
"(",
"intrinsic",
")",
";",
"normToPixel",
"=",
"LensDistortionFactory",
".",
"narrow",
"(",
"intrinsic",
")",
".",
"distort_F64",
"(",
"fal... | Camera the camera's intrinsic parameters. Can be called at any time.
@param intrinsic Intrinsic camera parameters | [
"Camera",
"the",
"camera",
"s",
"intrinsic",
"parameters",
".",
"Can",
"be",
"called",
"at",
"any",
"time",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L174-L183 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.setExtrinsic | public void setExtrinsic(Se3_F64 planeToCamera) {
this.planeToCamera = planeToCamera;
planeToCamera.invert(cameraToPlane);
planeProjection.setPlaneToCamera(planeToCamera, true);
} | java | public void setExtrinsic(Se3_F64 planeToCamera) {
this.planeToCamera = planeToCamera;
planeToCamera.invert(cameraToPlane);
planeProjection.setPlaneToCamera(planeToCamera, true);
} | [
"public",
"void",
"setExtrinsic",
"(",
"Se3_F64",
"planeToCamera",
")",
"{",
"this",
".",
"planeToCamera",
"=",
"planeToCamera",
";",
"planeToCamera",
".",
"invert",
"(",
"cameraToPlane",
")",
";",
"planeProjection",
".",
"setPlaneToCamera",
"(",
"planeToCamera",
... | Camera the camera's extrinsic parameters. Can be called at any time.
@param planeToCamera Transform from the plane to camera. | [
"Camera",
"the",
"camera",
"s",
"extrinsic",
"parameters",
".",
"Can",
"be",
"called",
"at",
"any",
"time",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L190-L195 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.reset | public void reset() {
tick = 0;
first = true;
tracker.reset();
keyToWorld.reset();
currToKey.reset();
currToWorld.reset();
worldToCurrCam3D.reset();
} | java | public void reset() {
tick = 0;
first = true;
tracker.reset();
keyToWorld.reset();
currToKey.reset();
currToWorld.reset();
worldToCurrCam3D.reset();
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"tick",
"=",
"0",
";",
"first",
"=",
"true",
";",
"tracker",
".",
"reset",
"(",
")",
";",
"keyToWorld",
".",
"reset",
"(",
")",
";",
"currToKey",
".",
"reset",
"(",
")",
";",
"currToWorld",
".",
"reset",
... | Resets the algorithm into its initial state | [
"Resets",
"the",
"algorithm",
"into",
"its",
"initial",
"state"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L200-L208 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.addNewTracks | private void addNewTracks() {
tracker.spawnTracks();
List<PointTrack> spawned = tracker.getNewTracks(null);
// estimate 3D coordinate using stereo vision
for (PointTrack t : spawned) {
// System.out.println("track spawn "+t.x+" "+t.y);
VoTrack p = t.getCookie();
if (p == null) {
t.cookie = p = new ... | java | private void addNewTracks() {
tracker.spawnTracks();
List<PointTrack> spawned = tracker.getNewTracks(null);
// estimate 3D coordinate using stereo vision
for (PointTrack t : spawned) {
// System.out.println("track spawn "+t.x+" "+t.y);
VoTrack p = t.getCookie();
if (p == null) {
t.cookie = p = new ... | [
"private",
"void",
"addNewTracks",
"(",
")",
"{",
"tracker",
".",
"spawnTracks",
"(",
")",
";",
"List",
"<",
"PointTrack",
">",
"spawned",
"=",
"tracker",
".",
"getNewTracks",
"(",
"null",
")",
";",
"// estimate 3D coordinate using stereo vision",
"for",
"(",
... | Requests that new tracks are spawned, determines if they are on the plane or not, and computes other required
data structures. | [
"Requests",
"that",
"new",
"tracks",
"are",
"spawned",
"determines",
"if",
"they",
"are",
"on",
"the",
"plane",
"or",
"not",
"and",
"computes",
"other",
"required",
"data",
"structures",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L261-L306 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.sortTracksForEstimation | private void sortTracksForEstimation() {
// reset data structures
planeSamples.reset();
farAngles.reset();
tracksOnPlane.clear();
tracksFar.clear();
// list of active tracks
List<PointTrack> active = tracker.getActiveTracks(null);
for (PointTrack t : active) {
VoTrack p = t.getCookie();
// comp... | java | private void sortTracksForEstimation() {
// reset data structures
planeSamples.reset();
farAngles.reset();
tracksOnPlane.clear();
tracksFar.clear();
// list of active tracks
List<PointTrack> active = tracker.getActiveTracks(null);
for (PointTrack t : active) {
VoTrack p = t.getCookie();
// comp... | [
"private",
"void",
"sortTracksForEstimation",
"(",
")",
"{",
"// reset data structures",
"planeSamples",
".",
"reset",
"(",
")",
";",
"farAngles",
".",
"reset",
"(",
")",
";",
"tracksOnPlane",
".",
"clear",
"(",
")",
";",
"tracksFar",
".",
"clear",
"(",
")",... | Splits the set of active tracks into on plane and infinity sets. For each set also perform specific sanity
checks to make sure basic constraints are still being meet. If not then the track will not be considered for
motion estimation. | [
"Splits",
"the",
"set",
"of",
"active",
"tracks",
"into",
"on",
"plane",
"and",
"infinity",
"sets",
".",
"For",
"each",
"set",
"also",
"perform",
"specific",
"sanity",
"checks",
"to",
"make",
"sure",
"basic",
"constraints",
"are",
"still",
"being",
"meet",
... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L335-L380 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.isRotationFromAxisY | protected boolean isRotationFromAxisY(PointTrack t, Vector3D_F64 pointing) {
VoTrack p = t.getCookie();
// remove rotations not along x-z plane
double normXZ = Math.sqrt(pointing.x * pointing.x + pointing.z * pointing.z);
pointingAdj.set(pointing.x / normXZ, p.pointingY, pointing.z / normXZ);
// Put pointin... | java | protected boolean isRotationFromAxisY(PointTrack t, Vector3D_F64 pointing) {
VoTrack p = t.getCookie();
// remove rotations not along x-z plane
double normXZ = Math.sqrt(pointing.x * pointing.x + pointing.z * pointing.z);
pointingAdj.set(pointing.x / normXZ, p.pointingY, pointing.z / normXZ);
// Put pointin... | [
"protected",
"boolean",
"isRotationFromAxisY",
"(",
"PointTrack",
"t",
",",
"Vector3D_F64",
"pointing",
")",
"{",
"VoTrack",
"p",
"=",
"t",
".",
"getCookie",
"(",
")",
";",
"// remove rotations not along x-z plane",
"double",
"normXZ",
"=",
"Math",
".",
"sqrt",
... | Checks for motion which can't be caused by rotations along the y-axis alone. This is done by adjusting the
pointing vector in the plane reference frame such that it has the same y component as when the track was spawned
and that the x-z components are normalized to one, to ensure consistent units. That pointing vecto... | [
"Checks",
"for",
"motion",
"which",
"can",
"t",
"be",
"caused",
"by",
"rotations",
"along",
"the",
"y",
"-",
"axis",
"alone",
".",
"This",
"is",
"done",
"by",
"adjusting",
"the",
"pointing",
"vector",
"in",
"the",
"plane",
"reference",
"frame",
"such",
"... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L390-L411 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.computeAngleOfRotation | private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) {
VoTrack p = t.getCookie();
// Compute ground pointing vector
groundCurr.x = pointingPlane.z;
groundCurr.y = -pointingPlane.x;
double norm = groundCurr.norm();
groundCurr.x /= norm;
groundCurr.y /= norm;
// dot product. ve... | java | private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) {
VoTrack p = t.getCookie();
// Compute ground pointing vector
groundCurr.x = pointingPlane.z;
groundCurr.y = -pointingPlane.x;
double norm = groundCurr.norm();
groundCurr.x /= norm;
groundCurr.y /= norm;
// dot product. ve... | [
"private",
"void",
"computeAngleOfRotation",
"(",
"PointTrack",
"t",
",",
"Vector3D_F64",
"pointingPlane",
")",
"{",
"VoTrack",
"p",
"=",
"t",
".",
"getCookie",
"(",
")",
";",
"// Compute ground pointing vector",
"groundCurr",
".",
"x",
"=",
"pointingPlane",
".",
... | Computes the angle of rotation between two pointing vectors on the ground plane and adds it to a list.
@param pointingPlane Pointing vector of observation in plane reference frame | [
"Computes",
"the",
"angle",
"of",
"rotation",
"between",
"two",
"pointing",
"vectors",
"on",
"the",
"ground",
"plane",
"and",
"adds",
"it",
"to",
"a",
"list",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L418-L440 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.estimateFar | private void estimateFar() {
// do nothing if there are objects at infinity
farInlierCount = 0;
if (farAngles.size == 0)
return;
farAnglesCopy.reset();
farAnglesCopy.addAll(farAngles);
// find angle which maximizes inlier set
farAngle = maximizeCountInSpread(farAnglesCopy.data, farAngles.size, 2 * t... | java | private void estimateFar() {
// do nothing if there are objects at infinity
farInlierCount = 0;
if (farAngles.size == 0)
return;
farAnglesCopy.reset();
farAnglesCopy.addAll(farAngles);
// find angle which maximizes inlier set
farAngle = maximizeCountInSpread(farAnglesCopy.data, farAngles.size, 2 * t... | [
"private",
"void",
"estimateFar",
"(",
")",
"{",
"// do nothing if there are objects at infinity",
"farInlierCount",
"=",
"0",
";",
"if",
"(",
"farAngles",
".",
"size",
"==",
"0",
")",
"return",
";",
"farAnglesCopy",
".",
"reset",
"(",
")",
";",
"farAnglesCopy",... | Estimates only rotation using points at infinity. A robust estimation algorithm is used which finds an angle
which maximizes the inlier set, like RANSAC does. Unlike RANSAC this will produce an optimal result. | [
"Estimates",
"only",
"rotation",
"using",
"points",
"at",
"infinity",
".",
"A",
"robust",
"estimation",
"algorithm",
"is",
"used",
"which",
"finds",
"an",
"angle",
"which",
"maximizes",
"the",
"inlier",
"set",
"like",
"RANSAC",
"does",
".",
"Unlike",
"RANSAC",... | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L446-L469 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.fuseEstimates | private void fuseEstimates() {
// weighted average for angle
double x = closeMotionKeyToCurr.c * closeInlierCount + Math.cos(farAngle) * farInlierCount;
double y = closeMotionKeyToCurr.s * closeInlierCount + Math.sin(farAngle) * farInlierCount;
// update the motion estimate
closeMotionKeyToCurr.setYaw(Math.... | java | private void fuseEstimates() {
// weighted average for angle
double x = closeMotionKeyToCurr.c * closeInlierCount + Math.cos(farAngle) * farInlierCount;
double y = closeMotionKeyToCurr.s * closeInlierCount + Math.sin(farAngle) * farInlierCount;
// update the motion estimate
closeMotionKeyToCurr.setYaw(Math.... | [
"private",
"void",
"fuseEstimates",
"(",
")",
"{",
"// weighted average for angle",
"double",
"x",
"=",
"closeMotionKeyToCurr",
".",
"c",
"*",
"closeInlierCount",
"+",
"Math",
".",
"cos",
"(",
"farAngle",
")",
"*",
"farInlierCount",
";",
"double",
"y",
"=",
"c... | Fuse the estimates for yaw from both sets of points using a weighted vector average and save the results
into currToKey | [
"Fuse",
"the",
"estimates",
"for",
"yaw",
"from",
"both",
"sets",
"of",
"points",
"using",
"a",
"weighted",
"vector",
"average",
"and",
"save",
"the",
"results",
"into",
"currToKey"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L500-L511 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.getWorldToCurr3D | public Se3_F64 getWorldToCurr3D() {
// compute transform in 2D space
Se2_F64 currToWorld = getCurrToWorld2D();
// 2D to 3D coordinates
currPlaneToWorld3D.getT().set(-currToWorld.T.y, 0, currToWorld.T.x);
DMatrixRMaj R = currPlaneToWorld3D.getR();
// set rotation around Y axis.
// Transpose the 2D trans... | java | public Se3_F64 getWorldToCurr3D() {
// compute transform in 2D space
Se2_F64 currToWorld = getCurrToWorld2D();
// 2D to 3D coordinates
currPlaneToWorld3D.getT().set(-currToWorld.T.y, 0, currToWorld.T.x);
DMatrixRMaj R = currPlaneToWorld3D.getR();
// set rotation around Y axis.
// Transpose the 2D trans... | [
"public",
"Se3_F64",
"getWorldToCurr3D",
"(",
")",
"{",
"// compute transform in 2D space",
"Se2_F64",
"currToWorld",
"=",
"getCurrToWorld2D",
"(",
")",
";",
"// 2D to 3D coordinates",
"currPlaneToWorld3D",
".",
"getT",
"(",
")",
".",
"set",
"(",
"-",
"currToWorld",
... | Converts 2D motion estimate into a 3D motion estimate
@return from world to current frame. | [
"Converts",
"2D",
"motion",
"estimate",
"into",
"a",
"3D",
"motion",
"estimate"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L566-L588 | train |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java | VisOdomMonoPlaneInfinity.maximizeCountInSpread | public static double maximizeCountInSpread(double[] data, int size, double maxSpread) {
if (size <= 0)
return 0;
Arrays.sort(data, 0, size);
int length = 0;
for (; length < size; length++) {
double s = UtilAngle.dist(data[0], data[length]);
if (s > maxSpread) {
break;
}
}
int bestStart = ... | java | public static double maximizeCountInSpread(double[] data, int size, double maxSpread) {
if (size <= 0)
return 0;
Arrays.sort(data, 0, size);
int length = 0;
for (; length < size; length++) {
double s = UtilAngle.dist(data[0], data[length]);
if (s > maxSpread) {
break;
}
}
int bestStart = ... | [
"public",
"static",
"double",
"maximizeCountInSpread",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"size",
",",
"double",
"maxSpread",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"return",
"0",
";",
"Arrays",
".",
"sort",
"(",
"data",
",",
"0",
","... | Finds the value which has the largest number of points above and below it within the specified spread
@param data Input data. Is modified by sort
@param size number of elements in data
@param maxSpread the spread it's going after
@return best value | [
"Finds",
"the",
"value",
"which",
"has",
"the",
"largest",
"number",
"of",
"points",
"above",
"and",
"below",
"it",
"within",
"the",
"specified",
"spread"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L599-L635 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java | SiftScaleSpace.computeNextOctave | public boolean computeNextOctave() {
currentOctave += 1;
if( currentOctave > lastOctave ) {
return false;
}
if( octaveImages[numScales].width <= 5 || octaveImages[numScales].height <= 5)
return false;
// the 2nd image from the top of the stack has 2x the sigma as the first
PyramidOps.scaleDown2(octa... | java | public boolean computeNextOctave() {
currentOctave += 1;
if( currentOctave > lastOctave ) {
return false;
}
if( octaveImages[numScales].width <= 5 || octaveImages[numScales].height <= 5)
return false;
// the 2nd image from the top of the stack has 2x the sigma as the first
PyramidOps.scaleDown2(octa... | [
"public",
"boolean",
"computeNextOctave",
"(",
")",
"{",
"currentOctave",
"+=",
"1",
";",
"if",
"(",
"currentOctave",
">",
"lastOctave",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"octaveImages",
"[",
"numScales",
"]",
".",
"width",
"<=",
"5",
"||... | Computes the next octave. If the last octave has already been computed false is returned.
@return true if an octave was computed or false if the last one was already reached | [
"Computes",
"the",
"next",
"octave",
".",
"If",
"the",
"last",
"octave",
"has",
"already",
"been",
"computed",
"false",
"is",
"returned",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L199-L212 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java | SiftScaleSpace.computeOctaveScales | private void computeOctaveScales() {
octaveImages[0] = tempImage0;
for (int i = 1; i < numScales+3; i++) {
octaveImages[i].reshape(tempImage0.width, tempImage0.height);
applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]);
}
for (int i = 1; i < numScales+3; i++) {
differenceOfGauss... | java | private void computeOctaveScales() {
octaveImages[0] = tempImage0;
for (int i = 1; i < numScales+3; i++) {
octaveImages[i].reshape(tempImage0.width, tempImage0.height);
applyGaussian(octaveImages[i - 1], octaveImages[i], kernelSigmaToK[i-1]);
}
for (int i = 1; i < numScales+3; i++) {
differenceOfGauss... | [
"private",
"void",
"computeOctaveScales",
"(",
")",
"{",
"octaveImages",
"[",
"0",
"]",
"=",
"tempImage0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"numScales",
"+",
"3",
";",
"i",
"++",
")",
"{",
"octaveImages",
"[",
"i",
"]",
".",
... | Computes all the scale images in an octave. This includes DoG images. | [
"Computes",
"all",
"the",
"scale",
"images",
"in",
"an",
"octave",
".",
"This",
"includes",
"DoG",
"images",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L217-L228 | train |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java | SiftScaleSpace.applyGaussian | void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) {
tempBlur.reshape(input.width, input.height);
GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur);
GConvolveImageOps.verticalNormalized(kernel, tempBlur,output);
} | java | void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) {
tempBlur.reshape(input.width, input.height);
GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur);
GConvolveImageOps.verticalNormalized(kernel, tempBlur,output);
} | [
"void",
"applyGaussian",
"(",
"GrayF32",
"input",
",",
"GrayF32",
"output",
",",
"Kernel1D",
"kernel",
")",
"{",
"tempBlur",
".",
"reshape",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
")",
";",
"GConvolveImageOps",
".",
"horizontalNormalized",
... | Applies the separable kernel to the input image and stores the results in the output image. | [
"Applies",
"the",
"separable",
"kernel",
"to",
"the",
"input",
"image",
"and",
"stores",
"the",
"results",
"in",
"the",
"output",
"image",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L241-L245 | train |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldHelperFunctions.java | TldHelperFunctions.computeOverlap | public double computeOverlap( ImageRectangle a , ImageRectangle b ) {
if( !a.intersection(b,work) )
return 0;
int areaI = work.area();
int bottom = a.area() + b.area() - areaI;
return areaI/ (double)bottom;
} | java | public double computeOverlap( ImageRectangle a , ImageRectangle b ) {
if( !a.intersection(b,work) )
return 0;
int areaI = work.area();
int bottom = a.area() + b.area() - areaI;
return areaI/ (double)bottom;
} | [
"public",
"double",
"computeOverlap",
"(",
"ImageRectangle",
"a",
",",
"ImageRectangle",
"b",
")",
"{",
"if",
"(",
"!",
"a",
".",
"intersection",
"(",
"b",
",",
"work",
")",
")",
"return",
"0",
";",
"int",
"areaI",
"=",
"work",
".",
"area",
"(",
")",... | Computes the fractional area of intersection between the two regions.
@return number from 0 to 1. higher means more intersection | [
"Computes",
"the",
"fractional",
"area",
"of",
"intersection",
"between",
"the",
"two",
"regions",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldHelperFunctions.java#L38-L47 | train |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/calibration/SubpixelGridTargetDisplay.java | SubpixelGridTargetDisplay.getCenter | public Point2D_F64 getCenter() {
Rectangle r = getVisibleRect();
double x = (r.x+r.width/2)/scale;
double y = (r.y+r.height/2)/scale;
return new Point2D_F64(x,y);
} | java | public Point2D_F64 getCenter() {
Rectangle r = getVisibleRect();
double x = (r.x+r.width/2)/scale;
double y = (r.y+r.height/2)/scale;
return new Point2D_F64(x,y);
} | [
"public",
"Point2D_F64",
"getCenter",
"(",
")",
"{",
"Rectangle",
"r",
"=",
"getVisibleRect",
"(",
")",
";",
"double",
"x",
"=",
"(",
"r",
".",
"x",
"+",
"r",
".",
"width",
"/",
"2",
")",
"/",
"scale",
";",
"double",
"y",
"=",
"(",
"r",
".",
"y... | The center pixel in the current view at a scale of 1 | [
"The",
"center",
"pixel",
"in",
"the",
"current",
"view",
"at",
"a",
"scale",
"of",
"1"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/calibration/SubpixelGridTargetDisplay.java#L86-L93 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java | GitFlowVersionInfo.isValidVersion | public static boolean isValidVersion(final String version) {
return StringUtils.isNotBlank(version)
&& (ALTERNATE_PATTERN.matcher(version).matches() || STANDARD_PATTERN
.matcher(version).matches());
} | java | public static boolean isValidVersion(final String version) {
return StringUtils.isNotBlank(version)
&& (ALTERNATE_PATTERN.matcher(version).matches() || STANDARD_PATTERN
.matcher(version).matches());
} | [
"public",
"static",
"boolean",
"isValidVersion",
"(",
"final",
"String",
"version",
")",
"{",
"return",
"StringUtils",
".",
"isNotBlank",
"(",
"version",
")",
"&&",
"(",
"ALTERNATE_PATTERN",
".",
"matcher",
"(",
"version",
")",
".",
"matches",
"(",
")",
"||"... | Validates version.
@param version
Version to validate.
@return <code>true</code> when version is valid, <code>false</code>
otherwise. | [
"Validates",
"version",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java#L55-L59 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java | GitFlowVersionInfo.featureVersion | public String featureVersion(final String featureName) {
String version = toString();
if (featureName != null) {
version = getReleaseVersionString() + "-" + featureName
+ (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : "");
}
return version;
} | java | public String featureVersion(final String featureName) {
String version = toString();
if (featureName != null) {
version = getReleaseVersionString() + "-" + featureName
+ (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : "");
}
return version;
} | [
"public",
"String",
"featureVersion",
"(",
"final",
"String",
"featureName",
")",
"{",
"String",
"version",
"=",
"toString",
"(",
")",
";",
"if",
"(",
"featureName",
"!=",
"null",
")",
"{",
"version",
"=",
"getReleaseVersionString",
"(",
")",
"+",
"\"-\"",
... | Gets version with appended feature name.
@param featureName
Feature name to append.
@return Version with appended feature name. | [
"Gets",
"version",
"with",
"appended",
"feature",
"name",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java#L111-L118 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.initExecutables | private void initExecutables() {
if (StringUtils.isBlank(cmdMvn.getExecutable())) {
if (StringUtils.isBlank(mvnExecutable)) {
mvnExecutable = "mvn";
}
cmdMvn.setExecutable(mvnExecutable);
}
if (StringUtils.isBlank(cmdGit.getExecutable())) {
... | java | private void initExecutables() {
if (StringUtils.isBlank(cmdMvn.getExecutable())) {
if (StringUtils.isBlank(mvnExecutable)) {
mvnExecutable = "mvn";
}
cmdMvn.setExecutable(mvnExecutable);
}
if (StringUtils.isBlank(cmdGit.getExecutable())) {
... | [
"private",
"void",
"initExecutables",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"cmdMvn",
".",
"getExecutable",
"(",
")",
")",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"mvnExecutable",
")",
")",
"{",
"mvnExecutable",
"... | Initializes command line executables. | [
"Initializes",
"command",
"line",
"executables",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L180-L193 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.validateConfiguration | protected void validateConfiguration(String... params)
throws MojoFailureException {
if (StringUtils.isNotBlank(argLine)
&& MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) {
throw new MojoFailureException(
"The argLine doesn't match allowed pattern."... | java | protected void validateConfiguration(String... params)
throws MojoFailureException {
if (StringUtils.isNotBlank(argLine)
&& MAVEN_DISALLOWED_PATTERN.matcher(argLine).find()) {
throw new MojoFailureException(
"The argLine doesn't match allowed pattern."... | [
"protected",
"void",
"validateConfiguration",
"(",
"String",
"...",
"params",
")",
"throws",
"MojoFailureException",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"argLine",
")",
"&&",
"MAVEN_DISALLOWED_PATTERN",
".",
"matcher",
"(",
"argLine",
")",
".",
... | Validates plugin configuration. Throws exception if configuration is not
valid.
@param params
Configuration parameters to validate.
@throws MojoFailureException
If configuration is not valid. | [
"Validates",
"plugin",
"configuration",
".",
"Throws",
"exception",
"if",
"configuration",
"is",
"not",
"valid",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L204-L220 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.getCurrentProjectVersion | protected String getCurrentProjectVersion() throws MojoFailureException {
final Model model = readModel(mavenSession.getCurrentProject());
if (model.getVersion() == null) {
throw new MojoFailureException(
"Cannot get current project version. This plugin should be executed... | java | protected String getCurrentProjectVersion() throws MojoFailureException {
final Model model = readModel(mavenSession.getCurrentProject());
if (model.getVersion() == null) {
throw new MojoFailureException(
"Cannot get current project version. This plugin should be executed... | [
"protected",
"String",
"getCurrentProjectVersion",
"(",
")",
"throws",
"MojoFailureException",
"{",
"final",
"Model",
"model",
"=",
"readModel",
"(",
"mavenSession",
".",
"getCurrentProject",
"(",
")",
")",
";",
"if",
"(",
"model",
".",
"getVersion",
"(",
")",
... | Gets current project version from pom.xml file.
@return Current project version.
@throws MojoFailureException | [
"Gets",
"current",
"project",
"version",
"from",
"pom",
".",
"xml",
"file",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L228-L235 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.readModel | private Model readModel(MavenProject project) throws MojoFailureException {
try {
// read pom.xml
Model model;
FileReader fileReader = new FileReader(project.getFile().getAbsoluteFile());
MavenXpp3Reader mavenReader = new MavenXpp3Reader();
try {
... | java | private Model readModel(MavenProject project) throws MojoFailureException {
try {
// read pom.xml
Model model;
FileReader fileReader = new FileReader(project.getFile().getAbsoluteFile());
MavenXpp3Reader mavenReader = new MavenXpp3Reader();
try {
... | [
"private",
"Model",
"readModel",
"(",
"MavenProject",
"project",
")",
"throws",
"MojoFailureException",
"{",
"try",
"{",
"// read pom.xml",
"Model",
"model",
";",
"FileReader",
"fileReader",
"=",
"new",
"FileReader",
"(",
"project",
".",
"getFile",
"(",
")",
"."... | Reads model from Maven project pom.xml.
@param project
Maven project
@return Maven model
@throws MojoFailureException | [
"Reads",
"model",
"from",
"Maven",
"project",
"pom",
".",
"xml",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L245-L262 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.validBranchName | protected boolean validBranchName(final String branchName)
throws MojoFailureException, CommandLineException {
CommandResult r = executeGitCommandExitCode("check-ref-format",
"--allow-onelevel", branchName);
return r.getExitCode() == SUCCESS_EXIT_CODE;
} | java | protected boolean validBranchName(final String branchName)
throws MojoFailureException, CommandLineException {
CommandResult r = executeGitCommandExitCode("check-ref-format",
"--allow-onelevel", branchName);
return r.getExitCode() == SUCCESS_EXIT_CODE;
} | [
"protected",
"boolean",
"validBranchName",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"CommandResult",
"r",
"=",
"executeGitCommandExitCode",
"(",
"\"check-ref-format\"",
",",
"\"--allow-onelevel\"",
",",
... | Checks if branch name is acceptable.
@param branchName
Branch name to check.
@return <code>true</code> when name is valid, <code>false</code>
otherwise.
@throws MojoFailureException
@throws CommandLineException | [
"Checks",
"if",
"branch",
"name",
"is",
"acceptable",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L330-L335 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeGitHasUncommitted | private boolean executeGitHasUncommitted() throws MojoFailureException,
CommandLineException {
boolean uncommited = false;
// 1 if there were differences and 0 means no differences
// git diff --no-ext-diff --ignore-submodules --quiet --exit-code
final CommandResult diffCom... | java | private boolean executeGitHasUncommitted() throws MojoFailureException,
CommandLineException {
boolean uncommited = false;
// 1 if there were differences and 0 means no differences
// git diff --no-ext-diff --ignore-submodules --quiet --exit-code
final CommandResult diffCom... | [
"private",
"boolean",
"executeGitHasUncommitted",
"(",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"boolean",
"uncommited",
"=",
"false",
";",
"// 1 if there were differences and 0 means no differences",
"// git diff --no-ext-diff --ignore-submodules --qu... | Executes git commands to check for uncommitted changes.
@return <code>true</code> when there are uncommitted changes,
<code>false</code> otherwise.
@throws CommandLineException
@throws MojoFailureException | [
"Executes",
"git",
"commands",
"to",
"check",
"for",
"uncommitted",
"changes",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L345-L377 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.initGitFlowConfig | protected void initGitFlowConfig() throws MojoFailureException,
CommandLineException {
gitSetConfig("gitflow.branch.master",
gitFlowConfig.getProductionBranch());
gitSetConfig("gitflow.branch.develop",
gitFlowConfig.getDevelopmentBranch());
gitSetConf... | java | protected void initGitFlowConfig() throws MojoFailureException,
CommandLineException {
gitSetConfig("gitflow.branch.master",
gitFlowConfig.getProductionBranch());
gitSetConfig("gitflow.branch.develop",
gitFlowConfig.getDevelopmentBranch());
gitSetConf... | [
"protected",
"void",
"initGitFlowConfig",
"(",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"gitSetConfig",
"(",
"\"gitflow.branch.master\"",
",",
"gitFlowConfig",
".",
"getProductionBranch",
"(",
")",
")",
";",
"gitSetConfig",
"(",
"\"gitflo... | Executes git config commands to set Git Flow configuration.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"config",
"commands",
"to",
"set",
"Git",
"Flow",
"configuration",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L385-L404 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitSetConfig | private void gitSetConfig(final String name, String value)
throws MojoFailureException, CommandLineException {
if (value == null || value.isEmpty()) {
value = "\"\"";
}
// ignore error exit codes
executeGitCommandExitCode("config", name, value);
} | java | private void gitSetConfig(final String name, String value)
throws MojoFailureException, CommandLineException {
if (value == null || value.isEmpty()) {
value = "\"\"";
}
// ignore error exit codes
executeGitCommandExitCode("config", name, value);
} | [
"private",
"void",
"gitSetConfig",
"(",
"final",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"value",
... | Executes git config command.
@param name
Option name.
@param value
Option value.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"config",
"command",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L416-L424 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitFindTags | protected String gitFindTags() throws MojoFailureException, CommandLineException {
String tags = executeGitCommandReturn("for-each-ref", "--sort=*authordate", "--format=\"%(refname:short)\"",
"refs/tags/");
// https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3
tags = re... | java | protected String gitFindTags() throws MojoFailureException, CommandLineException {
String tags = executeGitCommandReturn("for-each-ref", "--sort=*authordate", "--format=\"%(refname:short)\"",
"refs/tags/");
// https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3
tags = re... | [
"protected",
"String",
"gitFindTags",
"(",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"String",
"tags",
"=",
"executeGitCommandReturn",
"(",
"\"for-each-ref\"",
",",
"\"--sort=*authordate\"",
",",
"\"--format=\\\"%(refname:short)\\\"\"",
",",
"... | Executes git for-each-ref to get all tags.
@return Git tags.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"for",
"-",
"each",
"-",
"ref",
"to",
"get",
"all",
"tags",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L471-L477 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitFindLastTag | protected String gitFindLastTag() throws MojoFailureException, CommandLineException {
String tag = executeGitCommandReturn("for-each-ref", "--sort=-*authordate", "--count=1",
"--format=\"%(refname:short)\"", "refs/tags/");
// https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3
... | java | protected String gitFindLastTag() throws MojoFailureException, CommandLineException {
String tag = executeGitCommandReturn("for-each-ref", "--sort=-*authordate", "--count=1",
"--format=\"%(refname:short)\"", "refs/tags/");
// https://github.com/aleksandr-m/gitflow-maven-plugin/issues/3
... | [
"protected",
"String",
"gitFindLastTag",
"(",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"String",
"tag",
"=",
"executeGitCommandReturn",
"(",
"\"for-each-ref\"",
",",
"\"--sort=-*authordate\"",
",",
"\"--count=1\"",
",",
"\"--format=\\\"%(refn... | Executes git for-each-ref to get the last tag.
@return Last tag.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"for",
"-",
"each",
"-",
"ref",
"to",
"get",
"the",
"last",
"tag",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L486-L493 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.removeQuotes | private String removeQuotes(String str) {
if (str != null && !str.isEmpty()) {
str = str.replaceAll("\"", "");
}
return str;
} | java | private String removeQuotes(String str) {
if (str != null && !str.isEmpty()) {
str = str.replaceAll("\"", "");
}
return str;
} | [
"private",
"String",
"removeQuotes",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"!=",
"null",
"&&",
"!",
"str",
".",
"isEmpty",
"(",
")",
")",
"{",
"str",
"=",
"str",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\"",
")",
";",
"}",
"return",
... | Removes double quotes from the string.
@param str
String to remove quotes from.
@return String without quotes. | [
"Removes",
"double",
"quotes",
"from",
"the",
"string",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L502-L507 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitCheckBranchExists | protected boolean gitCheckBranchExists(final String branchName)
throws MojoFailureException, CommandLineException {
CommandResult commandResult = executeGitCommandExitCode("show-ref",
"--verify", "--quiet", "refs/heads/" + branchName);
return commandResult.getExitCode() == SU... | java | protected boolean gitCheckBranchExists(final String branchName)
throws MojoFailureException, CommandLineException {
CommandResult commandResult = executeGitCommandExitCode("show-ref",
"--verify", "--quiet", "refs/heads/" + branchName);
return commandResult.getExitCode() == SU... | [
"protected",
"boolean",
"gitCheckBranchExists",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"CommandResult",
"commandResult",
"=",
"executeGitCommandExitCode",
"(",
"\"show-ref\"",
",",
"\"--verify\"",
",",
... | Checks if local branch with given name exists.
@param branchName
Name of the branch to check.
@return <code>true</code> if local branch exists, <code>false</code>
otherwise.
@throws MojoFailureException
@throws CommandLineException | [
"Checks",
"if",
"local",
"branch",
"with",
"given",
"name",
"exists",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L519-L524 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitCheckTagExists | protected boolean gitCheckTagExists(final String tagName) throws MojoFailureException, CommandLineException {
CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet",
"refs/tags/" + tagName);
return commandResult.getExitCode() == SUCCESS_EXIT_CODE;
} | java | protected boolean gitCheckTagExists(final String tagName) throws MojoFailureException, CommandLineException {
CommandResult commandResult = executeGitCommandExitCode("show-ref", "--verify", "--quiet",
"refs/tags/" + tagName);
return commandResult.getExitCode() == SUCCESS_EXIT_CODE;
} | [
"protected",
"boolean",
"gitCheckTagExists",
"(",
"final",
"String",
"tagName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"CommandResult",
"commandResult",
"=",
"executeGitCommandExitCode",
"(",
"\"show-ref\"",
",",
"\"--verify\"",
",",
"\"-... | Checks if local tag with given name exists.
@param tagName
Name of the tag to check.
@return <code>true</code> if local tag exists, <code>false</code> otherwise.
@throws MojoFailureException
@throws CommandLineException | [
"Checks",
"if",
"local",
"tag",
"with",
"given",
"name",
"exists",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L535-L539 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitCheckout | protected void gitCheckout(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Checking out '" + branchName + "' branch.");
executeGitCommand("checkout", branchName);
} | java | protected void gitCheckout(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Checking out '" + branchName + "' branch.");
executeGitCommand("checkout", branchName);
} | [
"protected",
"void",
"gitCheckout",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Checking out '\"",
"+",
"branchName",
"+",
"\"' branch.\"",
")",
";",
"execu... | Executes git checkout.
@param branchName
Branch name to checkout.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"checkout",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L549-L554 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitCreateAndCheckout | protected void gitCreateAndCheckout(final String newBranchName,
final String fromBranchName) throws MojoFailureException,
CommandLineException {
getLog().info(
"Creating a new branch '" + newBranchName + "' from '"
+ fromBranchName + "' and checkin... | java | protected void gitCreateAndCheckout(final String newBranchName,
final String fromBranchName) throws MojoFailureException,
CommandLineException {
getLog().info(
"Creating a new branch '" + newBranchName + "' from '"
+ fromBranchName + "' and checkin... | [
"protected",
"void",
"gitCreateAndCheckout",
"(",
"final",
"String",
"newBranchName",
",",
"final",
"String",
"fromBranchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Creating a new branch '\"",
... | Executes git checkout -b.
@param newBranchName
Create branch with this name.
@param fromBranchName
Create branch from this branch.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"checkout",
"-",
"b",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L566-L574 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.replaceProperties | private String replaceProperties(String message, Map<String, String> map) {
if (map != null) {
for (Entry<String, String> entr : map.entrySet()) {
message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
}
}
return message;
... | java | private String replaceProperties(String message, Map<String, String> map) {
if (map != null) {
for (Entry<String, String> entr : map.entrySet()) {
message = StringUtils.replace(message, "@{" + entr.getKey() + "}", entr.getValue());
}
}
return message;
... | [
"private",
"String",
"replaceProperties",
"(",
"String",
"message",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entr",
":",
"map",
... | Replaces properties in message.
@param message
@param map
Key is a string to replace wrapped in <code>@{...}</code>. Value
is a string to replace with.
@return | [
"Replaces",
"properties",
"in",
"message",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L604-L611 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitBranchDelete | protected void gitBranchDelete(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Deleting '" + branchName + "' branch.");
executeGitCommand("branch", "-d", branchName);
} | java | protected void gitBranchDelete(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Deleting '" + branchName + "' branch.");
executeGitCommand("branch", "-d", branchName);
} | [
"protected",
"void",
"gitBranchDelete",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Deleting '\"",
"+",
"branchName",
"+",
"\"' branch.\"",
")",
";",
"execu... | Executes git branch -d.
@param branchName
Branch name to delete.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"branch",
"-",
"d",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L762-L767 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitBranchDeleteForce | protected void gitBranchDeleteForce(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Deleting (-D) '" + branchName + "' branch.");
executeGitCommand("branch", "-D", branchName);
} | java | protected void gitBranchDeleteForce(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info("Deleting (-D) '" + branchName + "' branch.");
executeGitCommand("branch", "-D", branchName);
} | [
"protected",
"void",
"gitBranchDeleteForce",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Deleting (-D) '\"",
"+",
"branchName",
"+",
"\"' branch.\"",
")",
";"... | Executes git branch -D.
@param branchName
Branch name to delete.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"branch",
"-",
"D",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L777-L782 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitFetchRemoteAndCreate | protected void gitFetchRemoteAndCreate(final String branchName)
throws MojoFailureException, CommandLineException {
if (!gitCheckBranchExists(branchName)) {
getLog().info(
"Local branch '"
+ branchName
+ "' doesn... | java | protected void gitFetchRemoteAndCreate(final String branchName)
throws MojoFailureException, CommandLineException {
if (!gitCheckBranchExists(branchName)) {
getLog().info(
"Local branch '"
+ branchName
+ "' doesn... | [
"protected",
"void",
"gitFetchRemoteAndCreate",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"if",
"(",
"!",
"gitCheckBranchExists",
"(",
"branchName",
")",
")",
"{",
"getLog",
"(",
")",
".",
"info"... | Fetches and checkouts from remote if local branch doesn't exist.
@param branchName
Branch name to check.
@throws MojoFailureException
@throws CommandLineException | [
"Fetches",
"and",
"checkouts",
"from",
"remote",
"if",
"local",
"branch",
"doesn",
"t",
"exist",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L792-L804 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitFetchRemoteAndCompare | protected void gitFetchRemoteAndCompare(final String branchName)
throws MojoFailureException, CommandLineException {
if (gitFetchRemote(branchName)) {
getLog().info(
"Comparing local branch '" + branchName + "' with remote '"
+ gitFlowConfi... | java | protected void gitFetchRemoteAndCompare(final String branchName)
throws MojoFailureException, CommandLineException {
if (gitFetchRemote(branchName)) {
getLog().info(
"Comparing local branch '" + branchName + "' with remote '"
+ gitFlowConfi... | [
"protected",
"void",
"gitFetchRemoteAndCompare",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"if",
"(",
"gitFetchRemote",
"(",
"branchName",
")",
")",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"... | Executes git fetch and compares local branch with the remote.
@param branchName
Branch name to fetch and compare.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"fetch",
"and",
"compares",
"local",
"branch",
"with",
"the",
"remote",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L814-L837 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.gitFetchRemote | private boolean gitFetchRemote(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info(
"Fetching remote branch '" + gitFlowConfig.getOrigin() + " "
+ branchName + "'.");
CommandResult result = executeGitCommandExitC... | java | private boolean gitFetchRemote(final String branchName)
throws MojoFailureException, CommandLineException {
getLog().info(
"Fetching remote branch '" + gitFlowConfig.getOrigin() + " "
+ branchName + "'.");
CommandResult result = executeGitCommandExitC... | [
"private",
"boolean",
"gitFetchRemote",
"(",
"final",
"String",
"branchName",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Fetching remote branch '\"",
"+",
"gitFlowConfig",
".",
"getOrigin",
"(",
... | Executes git fetch.
@param branchName
Branch name to fetch.
@return <code>true</code> if git fetch returned success exit code,
<code>false</code> otherwise.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"git",
"fetch",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L849-L869 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.mvnSetVersions | protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException {
getLog().info("Updating version(s) to '" + version + "'.");
String newVersion = "-DnewVersion=" + version;
String g = "";
String a = "";
if (versionsForceUpdate) {
... | java | protected void mvnSetVersions(final String version) throws MojoFailureException, CommandLineException {
getLog().info("Updating version(s) to '" + version + "'.");
String newVersion = "-DnewVersion=" + version;
String g = "";
String a = "";
if (versionsForceUpdate) {
... | [
"protected",
"void",
"mvnSetVersions",
"(",
"final",
"String",
"version",
")",
"throws",
"MojoFailureException",
",",
"CommandLineException",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Updating version(s) to '\"",
"+",
"version",
"+",
"\"'.\"",
")",
";",
"Strin... | Executes 'set' goal of versions-maven-plugin or 'set-version' of
tycho-versions-plugin in case it is tycho build.
@param version
New version to set.
@throws MojoFailureException
@throws CommandLineException | [
"Executes",
"set",
"goal",
"of",
"versions",
"-",
"maven",
"-",
"plugin",
"or",
"set",
"-",
"version",
"of",
"tycho",
"-",
"versions",
"-",
"plugin",
"in",
"case",
"it",
"is",
"tycho",
"build",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L924-L955 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.mvnRun | protected void mvnRun(final String goals) throws Exception {
getLog().info("Running Maven goals: " + goals);
executeMvnCommand(CommandLineUtils.translateCommandline(goals));
} | java | protected void mvnRun(final String goals) throws Exception {
getLog().info("Running Maven goals: " + goals);
executeMvnCommand(CommandLineUtils.translateCommandline(goals));
} | [
"protected",
"void",
"mvnRun",
"(",
"final",
"String",
"goals",
")",
"throws",
"Exception",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"Running Maven goals: \"",
"+",
"goals",
")",
";",
"executeMvnCommand",
"(",
"CommandLineUtils",
".",
"translateCommandline",
... | Executes Maven goals.
@param goals
The goals to execute.
@throws Exception | [
"Executes",
"Maven",
"goals",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L993-L997 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeGitCommandReturn | private String executeGitCommandReturn(final String... args)
throws CommandLineException, MojoFailureException {
return executeCommand(cmdGit, true, null, args).getOut();
} | java | private String executeGitCommandReturn(final String... args)
throws CommandLineException, MojoFailureException {
return executeCommand(cmdGit, true, null, args).getOut();
} | [
"private",
"String",
"executeGitCommandReturn",
"(",
"final",
"String",
"...",
"args",
")",
"throws",
"CommandLineException",
",",
"MojoFailureException",
"{",
"return",
"executeCommand",
"(",
"cmdGit",
",",
"true",
",",
"null",
",",
"args",
")",
".",
"getOut",
... | Executes Git command and returns output.
@param args
Git command line arguments.
@return Command output.
@throws CommandLineException
@throws MojoFailureException | [
"Executes",
"Git",
"command",
"and",
"returns",
"output",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1008-L1011 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeGitCommandExitCode | private CommandResult executeGitCommandExitCode(final String... args)
throws CommandLineException, MojoFailureException {
return executeCommand(cmdGit, false, null, args);
} | java | private CommandResult executeGitCommandExitCode(final String... args)
throws CommandLineException, MojoFailureException {
return executeCommand(cmdGit, false, null, args);
} | [
"private",
"CommandResult",
"executeGitCommandExitCode",
"(",
"final",
"String",
"...",
"args",
")",
"throws",
"CommandLineException",
",",
"MojoFailureException",
"{",
"return",
"executeCommand",
"(",
"cmdGit",
",",
"false",
",",
"null",
",",
"args",
")",
";",
"}... | Executes Git command without failing on non successful exit code.
@param args
Git command line arguments.
@return Command result.
@throws CommandLineException
@throws MojoFailureException | [
"Executes",
"Git",
"command",
"without",
"failing",
"on",
"non",
"successful",
"exit",
"code",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1022-L1025 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeGitCommand | private void executeGitCommand(final String... args)
throws CommandLineException, MojoFailureException {
executeCommand(cmdGit, true, null, args);
} | java | private void executeGitCommand(final String... args)
throws CommandLineException, MojoFailureException {
executeCommand(cmdGit, true, null, args);
} | [
"private",
"void",
"executeGitCommand",
"(",
"final",
"String",
"...",
"args",
")",
"throws",
"CommandLineException",
",",
"MojoFailureException",
"{",
"executeCommand",
"(",
"cmdGit",
",",
"true",
",",
"null",
",",
"args",
")",
";",
"}"
] | Executes Git command.
@param args
Git command line arguments.
@throws CommandLineException
@throws MojoFailureException | [
"Executes",
"Git",
"command",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1035-L1038 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeMvnCommand | private void executeMvnCommand(final String... args)
throws CommandLineException, MojoFailureException {
executeCommand(cmdMvn, true, argLine, args);
} | java | private void executeMvnCommand(final String... args)
throws CommandLineException, MojoFailureException {
executeCommand(cmdMvn, true, argLine, args);
} | [
"private",
"void",
"executeMvnCommand",
"(",
"final",
"String",
"...",
"args",
")",
"throws",
"CommandLineException",
",",
"MojoFailureException",
"{",
"executeCommand",
"(",
"cmdMvn",
",",
"true",
",",
"argLine",
",",
"args",
")",
";",
"}"
] | Executes Maven command.
@param args
Maven command line arguments.
@throws CommandLineException
@throws MojoFailureException | [
"Executes",
"Maven",
"command",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1048-L1051 | train |
aleksandr-m/gitflow-maven-plugin | src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java | AbstractGitFlowMojo.executeCommand | private CommandResult executeCommand(final Commandline cmd,
final boolean failOnError, final String argStr,
final String... args) throws CommandLineException,
MojoFailureException {
// initialize executables
initExecutables();
if (getLog().isDebugEnabled()) {... | java | private CommandResult executeCommand(final Commandline cmd,
final boolean failOnError, final String argStr,
final String... args) throws CommandLineException,
MojoFailureException {
// initialize executables
initExecutables();
if (getLog().isDebugEnabled()) {... | [
"private",
"CommandResult",
"executeCommand",
"(",
"final",
"Commandline",
"cmd",
",",
"final",
"boolean",
"failOnError",
",",
"final",
"String",
"argStr",
",",
"final",
"String",
"...",
"args",
")",
"throws",
"CommandLineException",
",",
"MojoFailureException",
"{"... | Executes command line.
@param cmd
Command line.
@param failOnError
Whether to throw exception on NOT success exit code.
@param argStr
Command line arguments as a string.
@param args
Command line arguments.
@return {@link CommandResult} instance holding command exit code, output
and error if any.
@throws CommandLineExc... | [
"Executes",
"command",
"line",
"."
] | d7be13c653d885c1cb1d8cd0337fa9db985c381e | https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L1071-L1112 | train |
dadoonet/fscrawler | elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESVersion.java | ESVersion.fromString | public static ESVersion fromString(String version) {
String lVersion = version;
final boolean snapshot = lVersion.endsWith("-SNAPSHOT");
if (snapshot) {
lVersion = lVersion.substring(0, lVersion.length() - 9);
}
String[] parts = lVersion.split("[.-]");
if (par... | java | public static ESVersion fromString(String version) {
String lVersion = version;
final boolean snapshot = lVersion.endsWith("-SNAPSHOT");
if (snapshot) {
lVersion = lVersion.substring(0, lVersion.length() - 9);
}
String[] parts = lVersion.split("[.-]");
if (par... | [
"public",
"static",
"ESVersion",
"fromString",
"(",
"String",
"version",
")",
"{",
"String",
"lVersion",
"=",
"version",
";",
"final",
"boolean",
"snapshot",
"=",
"lVersion",
".",
"endsWith",
"(",
"\"-SNAPSHOT\"",
")",
";",
"if",
"(",
"snapshot",
")",
"{",
... | Returns the version given its string representation, current version if the argument is null or empty | [
"Returns",
"the",
"version",
"given",
"its",
"string",
"representation",
"current",
"version",
"if",
"the",
"argument",
"is",
"null",
"or",
"empty"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESVersion.java#L32-L78 | train |
dadoonet/fscrawler | elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESDocumentField.java | ESDocumentField.getValue | public <V> V getValue() {
if (values == null || values.isEmpty()) {
return null;
}
return (V)values.get(0);
} | java | public <V> V getValue() {
if (values == null || values.isEmpty()) {
return null;
}
return (V)values.get(0);
} | [
"public",
"<",
"V",
">",
"V",
"getValue",
"(",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"(",
"V",
")",
"values",
".",
"get",
"(",
"0",
")",
";",
"}"... | The first value of the hit. | [
"The",
"first",
"value",
"of",
"the",
"hit",
"."
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ESDocumentField.java#L55-L60 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.updateFsJob | private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception {
// We need to round that latest date to the lower second and
// remove 2 seconds.
// See #82: https://github.com/dadoonet/fscrawler/issues/82
scanDate = scanDate.minus(2, ChronoUnit.SECONDS);
FsJo... | java | private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception {
// We need to round that latest date to the lower second and
// remove 2 seconds.
// See #82: https://github.com/dadoonet/fscrawler/issues/82
scanDate = scanDate.minus(2, ChronoUnit.SECONDS);
FsJo... | [
"private",
"void",
"updateFsJob",
"(",
"String",
"jobName",
",",
"LocalDateTime",
"scanDate",
")",
"throws",
"Exception",
"{",
"// We need to round that latest date to the lower second and",
"// remove 2 seconds.",
"// See #82: https://github.com/dadoonet/fscrawler/issues/82",
"scanD... | Update the job metadata
@param jobName job name
@param scanDate last date we scan the dirs
@throws Exception In case of error | [
"Update",
"the",
"job",
"metadata"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L208-L220 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.indexDirectory | private void indexDirectory(String path) throws Exception {
fr.pilato.elasticsearch.crawler.fs.beans.Path pathObject = new fr.pilato.elasticsearch.crawler.fs.beans.Path();
// The real and complete path
pathObject.setReal(path);
String rootdir = path.substring(0, path.lastIndexOf(File.sep... | java | private void indexDirectory(String path) throws Exception {
fr.pilato.elasticsearch.crawler.fs.beans.Path pathObject = new fr.pilato.elasticsearch.crawler.fs.beans.Path();
// The real and complete path
pathObject.setReal(path);
String rootdir = path.substring(0, path.lastIndexOf(File.sep... | [
"private",
"void",
"indexDirectory",
"(",
"String",
"path",
")",
"throws",
"Exception",
"{",
"fr",
".",
"pilato",
".",
"elasticsearch",
".",
"crawler",
".",
"fs",
".",
"beans",
".",
"Path",
"pathObject",
"=",
"new",
"fr",
".",
"pilato",
".",
"elasticsearch... | Index a directory
@param path complete path like /path/to/subdir | [
"Index",
"a",
"directory"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L537-L548 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.removeEsDirectoryRecursively | private void removeEsDirectoryRecursively(final String path) throws Exception {
logger.debug("Delete folder [{}]", path);
Collection<String> listFile = getFileDirectory(path);
for (String esfile : listFile) {
esDelete(fsSettings.getElasticsearch().getIndex(), SignTool.sign(path.conc... | java | private void removeEsDirectoryRecursively(final String path) throws Exception {
logger.debug("Delete folder [{}]", path);
Collection<String> listFile = getFileDirectory(path);
for (String esfile : listFile) {
esDelete(fsSettings.getElasticsearch().getIndex(), SignTool.sign(path.conc... | [
"private",
"void",
"removeEsDirectoryRecursively",
"(",
"final",
"String",
"path",
")",
"throws",
"Exception",
"{",
"logger",
".",
"debug",
"(",
"\"Delete folder [{}]\"",
",",
"path",
")",
";",
"Collection",
"<",
"String",
">",
"listFile",
"=",
"getFileDirectory",... | Remove a full directory and sub dirs recursively | [
"Remove",
"a",
"full",
"directory",
"and",
"sub",
"dirs",
"recursively"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L553-L567 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.esIndex | private void esIndex(String index, String id, String json, String pipeline) {
logger.debug("Indexing {}/{}?pipeline={}", index, id, pipeline);
logger.trace("JSon indexed : {}", json);
if (!closed) {
esClient.index(index, id, json, pipeline);
} else {
logger.warn(... | java | private void esIndex(String index, String id, String json, String pipeline) {
logger.debug("Indexing {}/{}?pipeline={}", index, id, pipeline);
logger.trace("JSon indexed : {}", json);
if (!closed) {
esClient.index(index, id, json, pipeline);
} else {
logger.warn(... | [
"private",
"void",
"esIndex",
"(",
"String",
"index",
",",
"String",
"id",
",",
"String",
"json",
",",
"String",
"pipeline",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Indexing {}/{}?pipeline={}\"",
",",
"index",
",",
"id",
",",
"pipeline",
")",
";",
"logge... | Add to bulk an IndexRequest in JSon format | [
"Add",
"to",
"bulk",
"an",
"IndexRequest",
"in",
"JSon",
"format"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L572-L581 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.esDelete | private void esDelete(String index, String id) {
logger.debug("Deleting {}/{}", index, id);
if (!closed) {
esClient.delete(index, id);
} else {
logger.warn("trying to remove a file while closing crawler. Document [{}]/[{}] has been ignored", index, id);
}
} | java | private void esDelete(String index, String id) {
logger.debug("Deleting {}/{}", index, id);
if (!closed) {
esClient.delete(index, id);
} else {
logger.warn("trying to remove a file while closing crawler. Document [{}]/[{}] has been ignored", index, id);
}
} | [
"private",
"void",
"esDelete",
"(",
"String",
"index",
",",
"String",
"id",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Deleting {}/{}\"",
",",
"index",
",",
"id",
")",
";",
"if",
"(",
"!",
"closed",
")",
"{",
"esClient",
".",
"delete",
"(",
"index",
"... | Add to bulk a DeleteRequest | [
"Add",
"to",
"bulk",
"a",
"DeleteRequest"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L586-L593 | train |
dadoonet/fscrawler | elasticsearch-client/elasticsearch-client-v6/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/v6/ElasticsearchClientV6.java | ElasticsearchClientV6.checkVersion | @Override
public void checkVersion() throws IOException {
ESVersion esVersion = getVersion();
if (esVersion.major != compatibleVersion()) {
throw new RuntimeException("The Elasticsearch client version [" +
compatibleVersion() + "] is not compatible with the Elasticsea... | java | @Override
public void checkVersion() throws IOException {
ESVersion esVersion = getVersion();
if (esVersion.major != compatibleVersion()) {
throw new RuntimeException("The Elasticsearch client version [" +
compatibleVersion() + "] is not compatible with the Elasticsea... | [
"@",
"Override",
"public",
"void",
"checkVersion",
"(",
")",
"throws",
"IOException",
"{",
"ESVersion",
"esVersion",
"=",
"getVersion",
"(",
")",
";",
"if",
"(",
"esVersion",
".",
"major",
"!=",
"compatibleVersion",
"(",
")",
")",
"{",
"throw",
"new",
"Run... | For Elasticsearch 6, we need to make sure we are running at least Elasticsearch 6.4
@throws IOException when something is wrong while asking the version of the node. | [
"For",
"Elasticsearch",
"6",
"we",
"need",
"to",
"make",
"sure",
"we",
"are",
"running",
"at",
"least",
"Elasticsearch",
"6",
".",
"4"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-v6/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/v6/ElasticsearchClientV6.java#L179-L192 | train |
dadoonet/fscrawler | rest/src/main/java/fr/pilato/elasticsearch/crawler/fs/rest/RestServer.java | RestServer.start | public static void start(FsSettings settings, ElasticsearchClient esClient) {
// We create the service only one
if (httpServer == null) {
// create a resource config that scans for JAX-RS resources and providers
// in fr.pilato.elasticsearch.crawler.fs.rest package
fi... | java | public static void start(FsSettings settings, ElasticsearchClient esClient) {
// We create the service only one
if (httpServer == null) {
// create a resource config that scans for JAX-RS resources and providers
// in fr.pilato.elasticsearch.crawler.fs.rest package
fi... | [
"public",
"static",
"void",
"start",
"(",
"FsSettings",
"settings",
",",
"ElasticsearchClient",
"esClient",
")",
"{",
"// We create the service only one",
"if",
"(",
"httpServer",
"==",
"null",
")",
"{",
"// create a resource config that scans for JAX-RS resources and provide... | Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
@param settings FSCrawler settings
@param esClient Elasticsearch client | [
"Starts",
"Grizzly",
"HTTP",
"server",
"exposing",
"JAX",
"-",
"RS",
"resources",
"defined",
"in",
"this",
"application",
"."
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/rest/src/main/java/fr/pilato/elasticsearch/crawler/fs/rest/RestServer.java#L44-L64 | train |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsCrawlerImpl.java | FsCrawlerImpl.upgrade | @SuppressWarnings("deprecation")
public boolean upgrade() throws Exception {
// We need to start a client so we can send requests to elasticsearch
try {
esClient.start();
} catch (Exception t) {
logger.fatal("We can not start Elasticsearch Client. Exiting.", t);
... | java | @SuppressWarnings("deprecation")
public boolean upgrade() throws Exception {
// We need to start a client so we can send requests to elasticsearch
try {
esClient.start();
} catch (Exception t) {
logger.fatal("We can not start Elasticsearch Client. Exiting.", t);
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"boolean",
"upgrade",
"(",
")",
"throws",
"Exception",
"{",
"// We need to start a client so we can send requests to elasticsearch",
"try",
"{",
"esClient",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",... | Upgrade FSCrawler indices
@return true if done successfully
@throws Exception In case of error | [
"Upgrade",
"FSCrawler",
"indices"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsCrawlerImpl.java#L94-L147 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.getOwnerName | public static String getOwnerName(final File file) {
try {
final Path path = Paths.get(file.getAbsolutePath());
final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
return ownerAttributeView != null ? ownerAttribute... | java | public static String getOwnerName(final File file) {
try {
final Path path = Paths.get(file.getAbsolutePath());
final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
return ownerAttributeView != null ? ownerAttribute... | [
"public",
"static",
"String",
"getOwnerName",
"(",
"final",
"File",
"file",
")",
"{",
"try",
"{",
"final",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"final",
"FileOwnerAttributeView",
"ownerAttributeVi... | Determines the 'owner' of the file. | [
"Determines",
"the",
"owner",
"of",
"the",
"file",
"."
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L358-L368 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.copyDefaultResources | public static void copyDefaultResources(Path configPath) throws IOException {
Path targetResourceDir = configPath.resolve("_default");
for (String filename : MAPPING_RESOURCES) {
Path target = targetResourceDir.resolve(filename);
if (Files.exists(target)) {
logge... | java | public static void copyDefaultResources(Path configPath) throws IOException {
Path targetResourceDir = configPath.resolve("_default");
for (String filename : MAPPING_RESOURCES) {
Path target = targetResourceDir.resolve(filename);
if (Files.exists(target)) {
logge... | [
"public",
"static",
"void",
"copyDefaultResources",
"(",
"Path",
"configPath",
")",
"throws",
"IOException",
"{",
"Path",
"targetResourceDir",
"=",
"configPath",
".",
"resolve",
"(",
"\"_default\"",
")",
";",
"for",
"(",
"String",
"filename",
":",
"MAPPING_RESOURC... | Copy default resources files which are available as project resources under
fr.pilato.elasticsearch.crawler.fs._default package to a given configuration path
under a _default sub directory.
@param configPath The config path which is by default .fscrawler
@throws IOException If copying does not work | [
"Copy",
"default",
"resources",
"files",
"which",
"are",
"available",
"as",
"project",
"resources",
"under",
"fr",
".",
"pilato",
".",
"elasticsearch",
".",
"crawler",
".",
"fs",
".",
"_default",
"package",
"to",
"a",
"given",
"configuration",
"path",
"under",... | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L441-L453 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.copyResourceFile | public static void copyResourceFile(String source, Path target) throws IOException {
InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
FileUtils.copyInputStreamToFile(resource, target.toFile());
} | java | public static void copyResourceFile(String source, Path target) throws IOException {
InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
FileUtils.copyInputStreamToFile(resource, target.toFile());
} | [
"public",
"static",
"void",
"copyResourceFile",
"(",
"String",
"source",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"InputStream",
"resource",
"=",
"FsCrawlerUtil",
".",
"class",
".",
"getResourceAsStream",
"(",
"source",
")",
";",
"FileUtils",
".... | Copy a single resource file from the classpath or from a JAR.
@param target The target
@throws IOException If copying does not work | [
"Copy",
"a",
"single",
"resource",
"file",
"from",
"the",
"classpath",
"or",
"from",
"a",
"JAR",
"."
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L460-L463 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.readPropertiesFromClassLoader | public static Properties readPropertiesFromClassLoader(String resource) {
Properties properties = new Properties();
try {
properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource));
} catch (IOException e) {
throw new RuntimeException(e);
... | java | public static Properties readPropertiesFromClassLoader(String resource) {
Properties properties = new Properties();
try {
properties.load(FsCrawlerUtil.class.getClassLoader().getResourceAsStream(resource));
} catch (IOException e) {
throw new RuntimeException(e);
... | [
"public",
"static",
"Properties",
"readPropertiesFromClassLoader",
"(",
"String",
"resource",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"properties",
".",
"load",
"(",
"FsCrawlerUtil",
".",
"class",
".",
"getClass... | Read a property file from the class loader
@param resource Resource name
@return The properties loaded | [
"Read",
"a",
"property",
"file",
"from",
"the",
"class",
"loader"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L470-L478 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.copyDirs | public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException {
if (Files.notExists(target)) {
Files.createDirectory(target);
}
logger.debug(" --> Copying resources from [{}]", source);
if (Files.notExists(source)) {
throw new R... | java | public static void copyDirs(Path source, Path target, CopyOption... options) throws IOException {
if (Files.notExists(target)) {
Files.createDirectory(target);
}
logger.debug(" --> Copying resources from [{}]", source);
if (Files.notExists(source)) {
throw new R... | [
"public",
"static",
"void",
"copyDirs",
"(",
"Path",
"source",
",",
"Path",
"target",
",",
"CopyOption",
"...",
"options",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"notExists",
"(",
"target",
")",
")",
"{",
"Files",
".",
"createDirectory... | Copy files from a source to a target
under a _default sub directory.
@param source The source dir
@param target The target dir
@param options Potential options
@throws IOException If copying does not work | [
"Copy",
"files",
"from",
"a",
"source",
"to",
"a",
"target",
"under",
"a",
"_default",
"sub",
"directory",
"."
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L488-L502 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.unzip | public static void unzip(String jarFile, Path destination) throws IOException {
Map<String, String> zipProperties = new HashMap<>();
/* We want to read an existing ZIP File, so we set this to false */
zipProperties.put("create", "false");
zipProperties.put("encoding", "UTF-8");
U... | java | public static void unzip(String jarFile, Path destination) throws IOException {
Map<String, String> zipProperties = new HashMap<>();
/* We want to read an existing ZIP File, so we set this to false */
zipProperties.put("create", "false");
zipProperties.put("encoding", "UTF-8");
U... | [
"public",
"static",
"void",
"unzip",
"(",
"String",
"jarFile",
",",
"Path",
"destination",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"zipProperties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"/* We want to read an existing... | Unzip a jar file
@param jarFile Jar file url like file:/path/to/foo.jar
@param destination Directory where we want to extract the content to
@throws IOException In case of any IO problem | [
"Unzip",
"a",
"jar",
"file"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L543-L569 | train |
dadoonet/fscrawler | framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java | FsCrawlerUtil.isFileSizeUnderLimit | public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) {
boolean result = true;
if (limit != null) {
// We check the file size to avoid indexing too big files
ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes);
int compare = fil... | java | public static boolean isFileSizeUnderLimit(ByteSizeValue limit, long fileSizeAsBytes) {
boolean result = true;
if (limit != null) {
// We check the file size to avoid indexing too big files
ByteSizeValue fileSize = new ByteSizeValue(fileSizeAsBytes);
int compare = fil... | [
"public",
"static",
"boolean",
"isFileSizeUnderLimit",
"(",
"ByteSizeValue",
"limit",
",",
"long",
"fileSizeAsBytes",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"limit",
"!=",
"null",
")",
"{",
"// We check the file size to avoid indexing too big file... | Compare if a file size is strictly under a given limit
@param limit Limit. If null, we consider that there is no limit and we return true.
@param fileSizeAsBytes File size
@return true if under the limit. false otherwise. | [
"Compare",
"if",
"a",
"file",
"size",
"is",
"strictly",
"under",
"a",
"given",
"limit"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L612-L624 | train |
dadoonet/fscrawler | elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java | ElasticsearchClientUtil.findClass | private static Class<ElasticsearchClient> findClass(int version) throws ClassNotFoundException {
String className = "fr.pilato.elasticsearch.crawler.fs.client.v" + version + ".ElasticsearchClientV" + version;
logger.trace("Trying to find a class named [{}]", className);
Class<?> aClass = Class.f... | java | private static Class<ElasticsearchClient> findClass(int version) throws ClassNotFoundException {
String className = "fr.pilato.elasticsearch.crawler.fs.client.v" + version + ".ElasticsearchClientV" + version;
logger.trace("Trying to find a class named [{}]", className);
Class<?> aClass = Class.f... | [
"private",
"static",
"Class",
"<",
"ElasticsearchClient",
">",
"findClass",
"(",
"int",
"version",
")",
"throws",
"ClassNotFoundException",
"{",
"String",
"className",
"=",
"\"fr.pilato.elasticsearch.crawler.fs.client.v\"",
"+",
"version",
"+",
"\".ElasticsearchClientV\"",
... | Try to load an ElasticsearchClient class
@param version Version number to use. It's only the major part of the version. Like 5 or 6.
@return The Client class | [
"Try",
"to",
"load",
"an",
"ElasticsearchClient",
"class"
] | cca00a14e21ef9986aa30e19b160463aed6bf921 | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/elasticsearch-client/elasticsearch-client-base/src/main/java/fr/pilato/elasticsearch/crawler/fs/client/ElasticsearchClientUtil.java#L100-L110 | train |
EsotericSoftware/yamlbeans | src/com/esotericsoftware/yamlbeans/YamlConfig.java | YamlConfig.setClassTag | public void setClassTag (String tag, Class type) {
if (tag == null) throw new IllegalArgumentException("tag cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
classNameToTag.put(type.getName(), tag);
tagToClass.put(tag, type);
} | java | public void setClassTag (String tag, Class type) {
if (tag == null) throw new IllegalArgumentException("tag cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
classNameToTag.put(type.getName(), tag);
tagToClass.put(tag, type);
} | [
"public",
"void",
"setClassTag",
"(",
"String",
"tag",
",",
"Class",
"type",
")",
"{",
"if",
"(",
"tag",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"tag cannot be null.\"",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"throw",... | Allows the specified tag to be used in YAML instead of the full class name. | [
"Allows",
"the",
"specified",
"tag",
"to",
"be",
"used",
"in",
"YAML",
"instead",
"of",
"the",
"full",
"class",
"name",
"."
] | f5610997edbc5534fc7e9f0a91654d14742345ca | https://github.com/EsotericSoftware/yamlbeans/blob/f5610997edbc5534fc7e9f0a91654d14742345ca/src/com/esotericsoftware/yamlbeans/YamlConfig.java#L69-L74 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.