id
int32
0
165k
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
100,400
lessthanoptimal/ddogleg
src/org/ddogleg/fitting/modelset/ransac/Ransac.java
Ransac.randomDraw
public static <T> void randomDraw(List<T> dataSet, int numSample, List<T> initialSample, Random rand) { initialSample.clear(); for (int i = 0; i < numSample; i++) { // index of last element that has not been selected int indexLast = dataSet.size()-i-1; // randomly select an item from the list w...
java
public static <T> void randomDraw(List<T> dataSet, int numSample, List<T> initialSample, Random rand) { initialSample.clear(); for (int i = 0; i < numSample; i++) { // index of last element that has not been selected int indexLast = dataSet.size()-i-1; // randomly select an item from the list w...
[ "public", "static", "<", "T", ">", "void", "randomDraw", "(", "List", "<", "T", ">", "dataSet", ",", "int", "numSample", ",", "List", "<", "T", ">", "initialSample", ",", "Random", "rand", ")", "{", "initialSample", ".", "clear", "(", ")", ";", "for"...
Performs a random draw in the dataSet. When an element is selected it is moved to the end of the list so that it can't be selected again. @param dataSet List that points are to be selected from. Modified.
[ "Performs", "a", "random", "draw", "in", "the", "dataSet", ".", "When", "an", "element", "is", "selected", "it", "is", "moved", "to", "the", "end", "of", "the", "list", "so", "that", "it", "can", "t", "be", "selected", "again", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/fitting/modelset/ransac/Ransac.java#L170-L187
100,401
lessthanoptimal/ddogleg
src/org/ddogleg/fitting/modelset/ransac/Ransac.java
Ransac.selectMatchSet
@SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDi...
java
@SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDi...
[ "@", "SuppressWarnings", "(", "{", "\"ForLoopReplaceableByForEach\"", "}", ")", "protected", "void", "selectMatchSet", "(", "List", "<", "Point", ">", "dataSet", ",", "double", "threshold", ",", "Model", "param", ")", "{", "candidatePoints", ".", "clear", "(", ...
Looks for points in the data set which closely match the current best fit model in the optimizer. @param dataSet The points being considered
[ "Looks", "for", "points", "in", "the", "data", "set", "which", "closely", "match", "the", "current", "best", "fit", "model", "in", "the", "optimizer", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/fitting/modelset/ransac/Ransac.java#L195-L209
100,402
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java
StandardKMeans_F64.matchPointsToClusters
protected void matchPointsToClusters(List<double[]> points) { sumDistance = 0; for (int i = 0; i < points.size(); i++) { double[]p = points.get(i); // find the cluster which is closest to the point int bestCluster = findBestMatch(p); // sum up all the points which are members of this cluster double...
java
protected void matchPointsToClusters(List<double[]> points) { sumDistance = 0; for (int i = 0; i < points.size(); i++) { double[]p = points.get(i); // find the cluster which is closest to the point int bestCluster = findBestMatch(p); // sum up all the points which are members of this cluster double...
[ "protected", "void", "matchPointsToClusters", "(", "List", "<", "double", "[", "]", ">", "points", ")", "{", "sumDistance", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "size", "(", ")", ";", "i", "++", ")", "{",...
Finds the cluster which is the closest to each point. The point is the added to the sum for the cluster and its member count incremented
[ "Finds", "the", "cluster", "which", "is", "the", "closest", "to", "each", "point", ".", "The", "point", "is", "the", "added", "to", "the", "sum", "for", "the", "cluster", "and", "its", "member", "count", "incremented" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java#L200-L217
100,403
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java
StandardKMeans_F64.findBestMatch
protected int findBestMatch(double[] p) { int bestCluster = -1; bestDistance = Double.MAX_VALUE; for (int j = 0; j < clusters.size; j++) { double d = distanceSq(p,clusters.get(j)); if( d < bestDistance ) { bestDistance = d; bestCluster = j; } } return bestCluster; }
java
protected int findBestMatch(double[] p) { int bestCluster = -1; bestDistance = Double.MAX_VALUE; for (int j = 0; j < clusters.size; j++) { double d = distanceSq(p,clusters.get(j)); if( d < bestDistance ) { bestDistance = d; bestCluster = j; } } return bestCluster; }
[ "protected", "int", "findBestMatch", "(", "double", "[", "]", "p", ")", "{", "int", "bestCluster", "=", "-", "1", ";", "bestDistance", "=", "Double", ".", "MAX_VALUE", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "clusters", ".", "size", "...
Searches for this cluster which is the closest to p
[ "Searches", "for", "this", "cluster", "which", "is", "the", "closest", "to", "p" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java#L222-L234
100,404
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java
StandardKMeans_F64.updateClusterCenters
protected void updateClusterCenters() { // compute the new centers of each cluster for (int i = 0; i < clusters.size; i++) { double mc = memberCount.get(i); double[] w = workClusters.get(i); double[] c = clusters.get(i); for (int j = 0; j < w.length; j++) { c[j] = w[j] / mc; } } }
java
protected void updateClusterCenters() { // compute the new centers of each cluster for (int i = 0; i < clusters.size; i++) { double mc = memberCount.get(i); double[] w = workClusters.get(i); double[] c = clusters.get(i); for (int j = 0; j < w.length; j++) { c[j] = w[j] / mc; } } }
[ "protected", "void", "updateClusterCenters", "(", ")", "{", "// compute the new centers of each cluster", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clusters", ".", "size", ";", "i", "++", ")", "{", "double", "mc", "=", "memberCount", ".", "get", "(...
Sets the location of each cluster to the average location of all its members.
[ "Sets", "the", "location", "of", "each", "cluster", "to", "the", "average", "location", "of", "all", "its", "members", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java#L239-L250
100,405
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java
StandardKMeans_F64.distanceSq
protected static double distanceSq(double[] a, double[] b) { double sum = 0; for (int i = 0; i < a.length; i++) { double d = a[i]-b[i]; sum += d*d; } return sum; }
java
protected static double distanceSq(double[] a, double[] b) { double sum = 0; for (int i = 0; i < a.length; i++) { double d = a[i]-b[i]; sum += d*d; } return sum; }
[ "protected", "static", "double", "distanceSq", "(", "double", "[", "]", "a", ",", "double", "[", "]", "b", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{"...
Returns the euclidean distance squared between the two poits
[ "Returns", "the", "euclidean", "distance", "squared", "between", "the", "two", "poits" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/kmeans/StandardKMeans_F64.java#L255-L262
100,406
lessthanoptimal/ddogleg
src/org/ddogleg/struct/RecycleManager.java
RecycleManager.requestInstance
public T requestInstance() { T a; if( unused.size() > 0 ) { a = unused.pop(); } else { a = createInstance(); } return a; }
java
public T requestInstance() { T a; if( unused.size() > 0 ) { a = unused.pop(); } else { a = createInstance(); } return a; }
[ "public", "T", "requestInstance", "(", ")", "{", "T", "a", ";", "if", "(", "unused", ".", "size", "(", ")", ">", "0", ")", "{", "a", "=", "unused", ".", "pop", "(", ")", ";", "}", "else", "{", "a", "=", "createInstance", "(", ")", ";", "}", ...
Either returns a recycled instance or a new one.
[ "Either", "returns", "a", "recycled", "instance", "or", "a", "new", "one", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/RecycleManager.java#L43-L51
100,407
lessthanoptimal/ddogleg
src/org/ddogleg/struct/RecycleManager.java
RecycleManager.createInstance
protected T createInstance() { try { return targetClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
protected T createInstance() { try { return targetClass.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "protected", "T", "createInstance", "(", ")", "{", "try", "{", "return", "targetClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "...
Creates a new instance using the class. overload this to handle more complex constructors
[ "Creates", "a", "new", "instance", "using", "the", "class", ".", "overload", "this", "to", "handle", "more", "complex", "constructors" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/RecycleManager.java#L63-L71
100,408
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.setFunction
public void setFunction( GradientLineFunction function , double funcMinValue ) { this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = ...
java
public void setFunction( GradientLineFunction function , double funcMinValue ) { this.function = function; this.funcMinValue = funcMinValue; lineSearch.setFunction(function,funcMinValue); N = function.getN(); B = new DMatrixRMaj(N,N); searchVector = new DMatrixRMaj(N,1); g = new DMatrixRMaj(N,1); s = ...
[ "public", "void", "setFunction", "(", "GradientLineFunction", "function", ",", "double", "funcMinValue", ")", "{", "this", ".", "function", "=", "function", ";", "this", ".", "funcMinValue", "=", "funcMinValue", ";", "lineSearch", ".", "setFunction", "(", "funct...
Specify the function being optimized @param function Function to optimize @param funcMinValue Minimum possible function value. E.g. 0 for least squares.
[ "Specify", "the", "function", "being", "optimized" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L122-L138
100,409
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.computeSearchDirection
private boolean computeSearchDirection() { // Compute the function's gradient function.computeGradient(temp0_Nx1.data); // compute the change in gradient for( int i = 0; i < N; i++ ) { y.data[i] = temp0_Nx1.data[i] - g.data[i]; g.data[i] = temp0_Nx1.data[i]; } // Update the inverse Hessian matrix ...
java
private boolean computeSearchDirection() { // Compute the function's gradient function.computeGradient(temp0_Nx1.data); // compute the change in gradient for( int i = 0; i < N; i++ ) { y.data[i] = temp0_Nx1.data[i] - g.data[i]; g.data[i] = temp0_Nx1.data[i]; } // Update the inverse Hessian matrix ...
[ "private", "boolean", "computeSearchDirection", "(", ")", "{", "// Compute the function's gradient", "function", ".", "computeGradient", "(", "temp0_Nx1", ".", "data", ")", ";", "// compute the change in gradient", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Computes the next search direction using BFGS
[ "Computes", "the", "next", "search", "direction", "using", "BFGS" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L213-L252
100,410
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.resetMatrixB
private void resetMatrixB() { // find the magnitude of the largest diagonal element double maxDiag = 0; for( int i = 0; i < N; i++ ) { double d = Math.abs(B.get(i,i)); if( d > maxDiag ) maxDiag = d; } B.zero(); for( int i = 0; i < N; i++ ) { B.set(i,i,maxDiag); } }
java
private void resetMatrixB() { // find the magnitude of the largest diagonal element double maxDiag = 0; for( int i = 0; i < N; i++ ) { double d = Math.abs(B.get(i,i)); if( d > maxDiag ) maxDiag = d; } B.zero(); for( int i = 0; i < N; i++ ) { B.set(i,i,maxDiag); } }
[ "private", "void", "resetMatrixB", "(", ")", "{", "// find the magnitude of the largest diagonal element", "double", "maxDiag", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "double", "d", "=", "Math", "."...
This is a total hack. Set B to a diagonal matrix where each diagonal element is the value of the largest absolute value in B. This will be SPD and hopefully not screw up the search.
[ "This", "is", "a", "total", "hack", ".", "Set", "B", "to", "a", "diagonal", "matrix", "where", "each", "diagonal", "element", "is", "the", "value", "of", "the", "largest", "absolute", "value", "in", "B", ".", "This", "will", "be", "SPD", "and", "hopefu...
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L259-L272
100,411
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java
QuasiNewtonBFGS.performLineSearch
private boolean performLineSearch() { // if true then it can't iterate any more if( lineSearch.iterate() ) { // see if the line search failed if( !lineSearch.isConverged() ) { if( firstStep ) { // if it failed on the very first step then it might have been too large // try halving the step size ...
java
private boolean performLineSearch() { // if true then it can't iterate any more if( lineSearch.iterate() ) { // see if the line search failed if( !lineSearch.isConverged() ) { if( firstStep ) { // if it failed on the very first step then it might have been too large // try halving the step size ...
[ "private", "boolean", "performLineSearch", "(", ")", "{", "// if true then it can't iterate any more", "if", "(", "lineSearch", ".", "iterate", "(", ")", ")", "{", "// see if the line search failed", "if", "(", "!", "lineSearch", ".", "isConverged", "(", ")", ")", ...
Performs a 1-D line search along the chosen direction until the Wolfe conditions have been meet. @return true if the search has terminated.
[ "Performs", "a", "1", "-", "D", "line", "search", "along", "the", "chosen", "direction", "until", "the", "Wolfe", "conditions", "have", "been", "meet", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/QuasiNewtonBFGS.java#L312-L380
100,412
lessthanoptimal/ddogleg
src/org/ddogleg/fitting/modelset/distance/FitByMeanStatistics.java
FitByMeanStatistics.computeMean
private void computeMean() { meanError = 0; int size = allPoints.size(); for (PointIndex<Point> inlier : allPoints) { Point pt = inlier.data; meanError += modelError.computeDistance(pt); } meanError /= size; }
java
private void computeMean() { meanError = 0; int size = allPoints.size(); for (PointIndex<Point> inlier : allPoints) { Point pt = inlier.data; meanError += modelError.computeDistance(pt); } meanError /= size; }
[ "private", "void", "computeMean", "(", ")", "{", "meanError", "=", "0", ";", "int", "size", "=", "allPoints", ".", "size", "(", ")", ";", "for", "(", "PointIndex", "<", "Point", ">", "inlier", ":", "allPoints", ")", "{", "Point", "pt", "=", "inlier",...
Computes the mean and standard deviation of the points from the model
[ "Computes", "the", "mean", "and", "standard", "deviation", "of", "the", "points", "from", "the", "model" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/fitting/modelset/distance/FitByMeanStatistics.java#L88-L100
100,413
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java
TrustRegionBase_F64.initialize
public void initialize(double initial[] , int numberOfParameters , double minimumFunctionValue ) { super.initialize(initial,numberOfParameters); tmp_p.reshape(numberOfParameters,1); regionRadius = config.regionInitial; fx = cost(x); if( verbose != null ) { verbose.println("Steps fx change ...
java
public void initialize(double initial[] , int numberOfParameters , double minimumFunctionValue ) { super.initialize(initial,numberOfParameters); tmp_p.reshape(numberOfParameters,1); regionRadius = config.regionInitial; fx = cost(x); if( verbose != null ) { verbose.println("Steps fx change ...
[ "public", "void", "initialize", "(", "double", "initial", "[", "]", ",", "int", "numberOfParameters", ",", "double", "minimumFunctionValue", ")", "{", "super", ".", "initialize", "(", "initial", ",", "numberOfParameters", ")", ";", "tmp_p", ".", "reshape", "("...
Specifies initial state of the search and completion criteria @param initial Initial parameter state @param numberOfParameters Number many parameters are being optimized. @param minimumFunctionValue The minimum possible value that the function can output
[ "Specifies", "initial", "state", "of", "the", "search", "and", "completion", "criteria" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java#L91-L117
100,414
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java
TrustRegionBase_F64.updateDerivates
@Override protected boolean updateDerivates() { functionGradientHessian(x,sameStateAsCost,gradient,hessian); if( config.hessianScaling ) { computeHessianScaling(); applyHessianScaling(); } // Convergence should be tested on scaled variables to remove their arbitrary natural scale // from influencing ...
java
@Override protected boolean updateDerivates() { functionGradientHessian(x,sameStateAsCost,gradient,hessian); if( config.hessianScaling ) { computeHessianScaling(); applyHessianScaling(); } // Convergence should be tested on scaled variables to remove their arbitrary natural scale // from influencing ...
[ "@", "Override", "protected", "boolean", "updateDerivates", "(", ")", "{", "functionGradientHessian", "(", "x", ",", "sameStateAsCost", ",", "gradient", ",", "hessian", ")", ";", "if", "(", "config", ".", "hessianScaling", ")", "{", "computeHessianScaling", "(",...
Computes all the derived data structures and attempts to update the parameters @return true if it has converged.
[ "Computes", "all", "the", "derived", "data", "structures", "and", "attempts", "to", "update", "the", "parameters" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java#L123-L147
100,415
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java
TrustRegionBase_F64.computeStep
@Override protected boolean computeStep() { // If first iteration and automatic if( regionRadius == -1 ) { // user has selected unconstrained method for initial step size parameterUpdate.computeUpdate(p, Double.MAX_VALUE); regionRadius = parameterUpdate.getStepLength(); if( regionRadius == Double.MAX_...
java
@Override protected boolean computeStep() { // If first iteration and automatic if( regionRadius == -1 ) { // user has selected unconstrained method for initial step size parameterUpdate.computeUpdate(p, Double.MAX_VALUE); regionRadius = parameterUpdate.getStepLength(); if( regionRadius == Double.MAX_...
[ "@", "Override", "protected", "boolean", "computeStep", "(", ")", "{", "// If first iteration and automatic", "if", "(", "regionRadius", "==", "-", "1", ")", "{", "// user has selected unconstrained method for initial step size", "parameterUpdate", ".", "computeUpdate", "("...
Changes the trust region's size and attempts to do a step again @return true if it has converged.
[ "Changes", "the", "trust", "region", "s", "size", "and", "attempts", "to", "do", "a", "step", "again" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java#L153-L199
100,416
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java
TrustRegionBase_F64.considerCandidate
protected boolean considerCandidate(double fx_candidate, double fx_prev, double predictedReduction, double stepLength ) { // compute model prediction accuracy double actualReduction = fx_prev-fx_candidate; if( actualReduction == 0 || predictedReduction == 0 ) { if( verbose != null ) verbose.pr...
java
protected boolean considerCandidate(double fx_candidate, double fx_prev, double predictedReduction, double stepLength ) { // compute model prediction accuracy double actualReduction = fx_prev-fx_candidate; if( actualReduction == 0 || predictedReduction == 0 ) { if( verbose != null ) verbose.pr...
[ "protected", "boolean", "considerCandidate", "(", "double", "fx_candidate", ",", "double", "fx_prev", ",", "double", "predictedReduction", ",", "double", "stepLength", ")", "{", "// compute model prediction accuracy", "double", "actualReduction", "=", "fx_prev", "-", "f...
Consider updating the system with the change in state p. The update will never be accepted if the cost function increases. @param fx_candidate Actual score at the candidate 'x' @param fx_prev Score at the current 'x' @param predictedReduction Reduction in score predicted by quadratic model @param stepLength The lengt...
[ "Consider", "updating", "the", "system", "with", "the", "change", "in", "state", "p", ".", "The", "update", "will", "never", "be", "accepted", "if", "the", "cost", "function", "increases", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java#L235-L274
100,417
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java
LevenbergMarquardt_F64.initialize
public void initialize(double initial[] , int numberOfParameters , int numberOfFunctions ) { super.initialize(initial,numberOfParameters); lambda = config.dampeningInitial; nu = NU_INITIAL; residuals.reshape(numberOfFunctions,1); diagOrig.reshape(numberOfParameters,1); diagStep.reshape(numberOfParameters,...
java
public void initialize(double initial[] , int numberOfParameters , int numberOfFunctions ) { super.initialize(initial,numberOfParameters); lambda = config.dampeningInitial; nu = NU_INITIAL; residuals.reshape(numberOfFunctions,1); diagOrig.reshape(numberOfParameters,1); diagStep.reshape(numberOfParameters,...
[ "public", "void", "initialize", "(", "double", "initial", "[", "]", ",", "int", "numberOfParameters", ",", "int", "numberOfFunctions", ")", "{", "super", ".", "initialize", "(", "initial", ",", "numberOfParameters", ")", ";", "lambda", "=", "config", ".", "d...
Initializes the search. @param initial Initial state @param numberOfParameters number of parameters @param numberOfFunctions number of functions
[ "Initializes", "the", "search", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java#L113-L133
100,418
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java
LevenbergMarquardt_F64.computeStep
@Override protected boolean computeStep() { // compute the new location and it's score if( !computeStep(lambda,gradient,p) ) { if( config.mixture == 0.0 ) { throw new OptimizationException("Singular matrix encountered. Try setting mixture to a non-zero value"); } lambda *= 4; if( verbose != null )...
java
@Override protected boolean computeStep() { // compute the new location and it's score if( !computeStep(lambda,gradient,p) ) { if( config.mixture == 0.0 ) { throw new OptimizationException("Singular matrix encountered. Try setting mixture to a non-zero value"); } lambda *= 4; if( verbose != null )...
[ "@", "Override", "protected", "boolean", "computeStep", "(", ")", "{", "// compute the new location and it's score", "if", "(", "!", "computeStep", "(", "lambda", ",", "gradient", ",", "p", ")", ")", "{", "if", "(", "config", ".", "mixture", "==", "0.0", ")"...
Compute a new possible state and determine if it should be accepted or not. If accepted update the state @return true if it has converged or false if it has not
[ "Compute", "a", "new", "possible", "state", "and", "determine", "if", "it", "should", "be", "accepted", "or", "not", ".", "If", "accepted", "update", "the", "state" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java#L165-L201
100,419
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java
LevenbergMarquardt_F64.processStepResults
private boolean processStepResults(double fx_candidate, double actualReduction, double predictedReduction) { double ratio = actualReduction/predictedReduction; boolean accepted; // Accept the new state if the score improved if( fx_candidate < fx ) { // reduce the amount of dampening. Magic equation from [1...
java
private boolean processStepResults(double fx_candidate, double actualReduction, double predictedReduction) { double ratio = actualReduction/predictedReduction; boolean accepted; // Accept the new state if the score improved if( fx_candidate < fx ) { // reduce the amount of dampening. Magic equation from [1...
[ "private", "boolean", "processStepResults", "(", "double", "fx_candidate", ",", "double", "actualReduction", ",", "double", "predictedReduction", ")", "{", "double", "ratio", "=", "actualReduction", "/", "predictedReduction", ";", "boolean", "accepted", ";", "// Accep...
Sees if this is an improvement worth accepting. Adjust dampening parameter and change the state if accepted. @return true if it has converged or false if it has not
[ "Sees", "if", "this", "is", "an", "improvement", "worth", "accepting", ".", "Adjust", "dampening", "parameter", "and", "change", "the", "state", "if", "accepted", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java#L209-L244
100,420
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java
LevenbergMarquardt_F64.acceptNewState
private void acceptNewState( double fx_candidate ) { DMatrixRMaj tmp = x; x = x_next; x_next = tmp; fx = fx_candidate; mode = Mode.COMPUTE_DERIVATIVES; }
java
private void acceptNewState( double fx_candidate ) { DMatrixRMaj tmp = x; x = x_next; x_next = tmp; fx = fx_candidate; mode = Mode.COMPUTE_DERIVATIVES; }
[ "private", "void", "acceptNewState", "(", "double", "fx_candidate", ")", "{", "DMatrixRMaj", "tmp", "=", "x", ";", "x", "=", "x_next", ";", "x_next", "=", "tmp", ";", "fx", "=", "fx_candidate", ";", "mode", "=", "Mode", ".", "COMPUTE_DERIVATIVES", ";", "...
The new state has been accepted. Switch the internal state over to this @param fx_candidate The new state
[ "The", "new", "state", "has", "been", "accepted", ".", "Switch", "the", "internal", "state", "over", "to", "this" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java#L250-L258
100,421
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java
LevenbergMarquardt_F64.computeStep
protected boolean computeStep( double lambda, DMatrixRMaj gradient , DMatrixRMaj step ) { final double mixture = config.mixture; for (int i = 0; i < diagOrig.numRows; i++) { double v = min(config.diagonal_max, max(config.diagonal_min,diagOrig.data[i])); diagStep.data[i] = v + lambda*(mixture + (1.0-mixture)*...
java
protected boolean computeStep( double lambda, DMatrixRMaj gradient , DMatrixRMaj step ) { final double mixture = config.mixture; for (int i = 0; i < diagOrig.numRows; i++) { double v = min(config.diagonal_max, max(config.diagonal_min,diagOrig.data[i])); diagStep.data[i] = v + lambda*(mixture + (1.0-mixture)*...
[ "protected", "boolean", "computeStep", "(", "double", "lambda", ",", "DMatrixRMaj", "gradient", ",", "DMatrixRMaj", "step", ")", "{", "final", "double", "mixture", "=", "config", ".", "mixture", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "diag...
Adjusts the Hessian's diagonal elements value and computes the next step @param lambda (Input) tuning @param gradient (Input) gradient @param step (Output) step @return true if solver could compute the next step
[ "Adjusts", "the", "Hessian", "s", "diagonal", "elements", "value", "and", "computes", "the", "next", "step" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/lm/LevenbergMarquardt_F64.java#L291-L312
100,422
lessthanoptimal/ddogleg
src/org/ddogleg/solver/Polynomial.java
Polynomial.evaluate
public double evaluate( double variable ) { if( size == 0 ) { return 0; } else if( size == 1 ) { return c[0]; } else if( Double.isInfinite(variable)) { // Only the largest power with a non-zero coefficient needs to be evaluated int degree = computeDegree(); if( degree%2 == 0 ) variable = Doub...
java
public double evaluate( double variable ) { if( size == 0 ) { return 0; } else if( size == 1 ) { return c[0]; } else if( Double.isInfinite(variable)) { // Only the largest power with a non-zero coefficient needs to be evaluated int degree = computeDegree(); if( degree%2 == 0 ) variable = Doub...
[ "public", "double", "evaluate", "(", "double", "variable", ")", "{", "if", "(", "size", "==", "0", ")", "{", "return", "0", ";", "}", "else", "if", "(", "size", "==", "1", ")", "{", "return", "c", "[", "0", "]", ";", "}", "else", "if", "(", "...
Computes the polynomials output given the variable value Can handle infinite numbers @return Output
[ "Computes", "the", "polynomials", "output", "given", "the", "variable", "value", "Can", "handle", "infinite", "numbers" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/Polynomial.java#L74-L103
100,423
lessthanoptimal/ddogleg
src/org/ddogleg/solver/Polynomial.java
Polynomial.isIdentical
public boolean isIdentical( Polynomial p , double tol ) { int m = Math.max(p.size(), size()); // make sure trailing coefficients are close to zero for( int i = p.size; i < m; i++ ) { if( Math.abs(c[i]) > tol ) { return false; } } for( int i = size; i < m; i++ ) { if( Math.abs(p.c[i]) > tol ) { ...
java
public boolean isIdentical( Polynomial p , double tol ) { int m = Math.max(p.size(), size()); // make sure trailing coefficients are close to zero for( int i = p.size; i < m; i++ ) { if( Math.abs(c[i]) > tol ) { return false; } } for( int i = size; i < m; i++ ) { if( Math.abs(p.c[i]) > tol ) { ...
[ "public", "boolean", "isIdentical", "(", "Polynomial", "p", ",", "double", "tol", ")", "{", "int", "m", "=", "Math", ".", "max", "(", "p", ".", "size", "(", ")", ",", "size", "(", ")", ")", ";", "// make sure trailing coefficients are close to zero", "for"...
Checks to see if the coefficients of two polynomials are identical to within tolerance. If the lengths of the polynomials are not the same then the extra coefficients in the longer polynomial must be within tolerance of zero. @param p Polynomial that this polynomial is being compared against. @param tol Similarity to...
[ "Checks", "to", "see", "if", "the", "coefficients", "of", "two", "polynomials", "are", "identical", "to", "within", "tolerance", ".", "If", "the", "lengths", "of", "the", "polynomials", "are", "not", "the", "same", "then", "the", "extra", "coefficients", "in...
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/Polynomial.java#L154-L179
100,424
lessthanoptimal/ddogleg
src/org/ddogleg/solver/Polynomial.java
Polynomial.truncateZeros
public void truncateZeros( double tol ) { // double max = 0; // for( int i = 0; i < size; i++ ) { // double d = Math.abs(c[i]); // if( d > max ) // max = d; // } // // tol *= max; int i = size-1; for( ; i >= 0; i-- ) { if( Math.abs(c[i]) > tol ) break; } size = i+1; }
java
public void truncateZeros( double tol ) { // double max = 0; // for( int i = 0; i < size; i++ ) { // double d = Math.abs(c[i]); // if( d > max ) // max = d; // } // // tol *= max; int i = size-1; for( ; i >= 0; i-- ) { if( Math.abs(c[i]) > tol ) break; } size = i+1; }
[ "public", "void", "truncateZeros", "(", "double", "tol", ")", "{", "//\t\tdouble max = 0;", "//\t\tfor( int i = 0; i < size; i++ ) {", "//\t\t\tdouble d = Math.abs(c[i]);", "//\t\t\tif( d > max )", "//\t\t\t\tmax = d;", "//\t\t}", "//", "//\t\ttol *= max;", "int", "i", "=", "si...
Prunes zero coefficients from the end of a sequence. A coefficient is zero if its absolute value is less than or equal to tolerance. @param tol Tolerance for zero. Try 1e-15
[ "Prunes", "zero", "coefficients", "from", "the", "end", "of", "a", "sequence", ".", "A", "coefficient", "is", "zero", "if", "its", "absolute", "value", "is", "less", "than", "or", "equal", "to", "tolerance", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/Polynomial.java#L187-L205
100,425
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/searches/KdTreeSearchNStandard.java
KdTreeSearchNStandard.findNeighbor
@Override public void findNeighbor(P target, int searchN, FastQueue<KdTreeResult> results) { if( searchN <= 0 ) throw new IllegalArgumentException("I'm sorry, but I refuse to search for less than or equal to 0 neighbors."); if( tree.root == null ) return; this.searchN = searchN; this.target = target; ...
java
@Override public void findNeighbor(P target, int searchN, FastQueue<KdTreeResult> results) { if( searchN <= 0 ) throw new IllegalArgumentException("I'm sorry, but I refuse to search for less than or equal to 0 neighbors."); if( tree.root == null ) return; this.searchN = searchN; this.target = target; ...
[ "@", "Override", "public", "void", "findNeighbor", "(", "P", "target", ",", "int", "searchN", ",", "FastQueue", "<", "KdTreeResult", ">", "results", ")", "{", "if", "(", "searchN", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"I'm sorry...
Finds the nodes which are closest to 'target' and within range of the maximum distance. @param target A point @param searchN Number of nearest-neighbors it will search for @param results Storage for the found neighbors
[ "Finds", "the", "nodes", "which", "are", "closest", "to", "target", "and", "within", "range", "of", "the", "maximum", "distance", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/searches/KdTreeSearchNStandard.java#L79-L92
100,426
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/searches/KdTreeSearchNStandard.java
KdTreeSearchNStandard.checkBestDistance
private void checkBestDistance(KdTree.Node node, FastQueue<KdTreeResult> neighbors) { double distSq = distance.distance((P)node.point,target); // <= because multiple nodes could be at the bestDistanceSq if( distSq <= mostDistantNeighborSq) { if( neighbors.size() < searchN ) { // the list of nearest neighbo...
java
private void checkBestDistance(KdTree.Node node, FastQueue<KdTreeResult> neighbors) { double distSq = distance.distance((P)node.point,target); // <= because multiple nodes could be at the bestDistanceSq if( distSq <= mostDistantNeighborSq) { if( neighbors.size() < searchN ) { // the list of nearest neighbo...
[ "private", "void", "checkBestDistance", "(", "KdTree", ".", "Node", "node", ",", "FastQueue", "<", "KdTreeResult", ">", "neighbors", ")", "{", "double", "distSq", "=", "distance", ".", "distance", "(", "(", "P", ")", "node", ".", "point", ",", "target", ...
See if the node being considered is a new nearest-neighbor
[ "See", "if", "the", "node", "being", "considered", "is", "a", "new", "nearest", "-", "neighbor" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/searches/KdTreeSearchNStandard.java#L137-L184
100,427
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/gmm/ExpectationMaximizationGmm_F64.java
ExpectationMaximizationGmm_F64.expectation
protected double expectation() { double sumChiSq = 0; for (int i = 0; i < info.size(); i++) { PointInfo p = info.get(i); // identify the best cluster match and save it's chi-square for convergence testing double bestLikelihood = 0; double bestChiSq = Double.MAX_VALUE; double total = 0; for (int...
java
protected double expectation() { double sumChiSq = 0; for (int i = 0; i < info.size(); i++) { PointInfo p = info.get(i); // identify the best cluster match and save it's chi-square for convergence testing double bestLikelihood = 0; double bestChiSq = Double.MAX_VALUE; double total = 0; for (int...
[ "protected", "double", "expectation", "(", ")", "{", "double", "sumChiSq", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "info", ".", "size", "(", ")", ";", "i", "++", ")", "{", "PointInfo", "p", "=", "info", ".", "get", "(", ...
For each point compute the "responsibility" for each Gaussian @return The sum of chi-square. Can be used to estimate the total error.
[ "For", "each", "point", "compute", "the", "responsibility", "for", "each", "Gaussian" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/gmm/ExpectationMaximizationGmm_F64.java#L155-L190
100,428
lessthanoptimal/ddogleg
src/org/ddogleg/clustering/gmm/ExpectationMaximizationGmm_F64.java
ExpectationMaximizationGmm_F64.maximization
protected void maximization() { // discard previous parameters by zeroing for (int i = 0; i < mixture.size; i++) { mixture.get(i).zero(); } // compute the new mean for (int i = 0; i < info.size; i++) { PointInfo p = info.get(i); for (int j = 0; j < mixture.size; j++) { mixture.get(j).addMean(p....
java
protected void maximization() { // discard previous parameters by zeroing for (int i = 0; i < mixture.size; i++) { mixture.get(i).zero(); } // compute the new mean for (int i = 0; i < info.size; i++) { PointInfo p = info.get(i); for (int j = 0; j < mixture.size; j++) { mixture.get(j).addMean(p....
[ "protected", "void", "maximization", "(", ")", "{", "// discard previous parameters by zeroing", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mixture", ".", "size", ";", "i", "++", ")", "{", "mixture", ".", "get", "(", "i", ")", ".", "zero", "(", ...
Using points responsibility information to recompute the Gaussians and their weights, maximizing the likelihood of the mixture.
[ "Using", "points", "responsibility", "information", "to", "recompute", "the", "Gaussians", "and", "their", "weights", "maximizing", "the", "likelihood", "of", "the", "mixture", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/gmm/ExpectationMaximizationGmm_F64.java#L196-L244
100,429
lessthanoptimal/ddogleg
src/org/ddogleg/solver/FitQuadratic1D.java
FitQuadratic1D.process
public boolean process( int offset , int length , double ...data ) { if( data.length < 3 ) throw new IllegalArgumentException("At least three points"); A.reshape(data.length,3); y.reshape(data.length,1); int indexDst = 0; int indexSrc = offset; for( int i = 0; i < length; i++ ) { double d = data[ind...
java
public boolean process( int offset , int length , double ...data ) { if( data.length < 3 ) throw new IllegalArgumentException("At least three points"); A.reshape(data.length,3); y.reshape(data.length,1); int indexDst = 0; int indexSrc = offset; for( int i = 0; i < length; i++ ) { double d = data[ind...
[ "public", "boolean", "process", "(", "int", "offset", ",", "int", "length", ",", "double", "...", "data", ")", "{", "if", "(", "data", ".", "length", "<", "3", ")", "throw", "new", "IllegalArgumentException", "(", "\"At least three points\"", ")", ";", "A"...
Computes polynomial coefficients for the given data. @param length Number of elements in data with relevant data. @param data Set of observation data. @return true if successful or false if it fails.
[ "Computes", "polynomial", "coefficients", "for", "the", "given", "data", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/FitQuadratic1D.java#L52-L77
100,430
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/math/HessianSchurComplement_Base.java
HessianSchurComplement_Base.innerVectorHessian
@Override public double innerVectorHessian( DMatrixRMaj v ) { int M = A.getNumRows(); double sum = 0; sum += innerProduct(v.data, 0, A, v.data, 0); sum += 2*innerProduct(v.data, 0, B, v.data, M); sum += innerProduct(v.data, M, D, v.data, M); return sum; }
java
@Override public double innerVectorHessian( DMatrixRMaj v ) { int M = A.getNumRows(); double sum = 0; sum += innerProduct(v.data, 0, A, v.data, 0); sum += 2*innerProduct(v.data, 0, B, v.data, M); sum += innerProduct(v.data, M, D, v.data, M); return sum; }
[ "@", "Override", "public", "double", "innerVectorHessian", "(", "DMatrixRMaj", "v", ")", "{", "int", "M", "=", "A", ".", "getNumRows", "(", ")", ";", "double", "sum", "=", "0", ";", "sum", "+=", "innerProduct", "(", "v", ".", "data", ",", "0", ",", ...
Vector matrix inner product of Hessian in block format. <p> [A B;C D]*[x;y] = [c;d]<br> A*x + B*y = c<br> C*x + D*y = d<br> [x;y]<sup>T</sup>[A B;C D]*[x;y] = [x;y]<sup>T</sup>*[c;d]<br> </p> @param v row vector @return v'*H*v = v'*[A B;C D]*v
[ "Vector", "matrix", "inner", "product", "of", "Hessian", "in", "block", "format", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/math/HessianSchurComplement_Base.java#L97-L107
100,431
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/math/HessianSchurComplement_Base.java
HessianSchurComplement_Base.computeGradient
@Override public void computeGradient(S jacLeft , S jacRight , DMatrixRMaj residuals, DMatrixRMaj gradient) { // Find the gradient using the two matrices for Jacobian // g = J'*r = [L,R]'*r x1.reshape(jacLeft.getNumCols(),1); x2.reshape(jacRight.getNumCols(),1); multTransA(jacLeft,residuals,x1); m...
java
@Override public void computeGradient(S jacLeft , S jacRight , DMatrixRMaj residuals, DMatrixRMaj gradient) { // Find the gradient using the two matrices for Jacobian // g = J'*r = [L,R]'*r x1.reshape(jacLeft.getNumCols(),1); x2.reshape(jacRight.getNumCols(),1); multTransA(jacLeft,residuals,x1); m...
[ "@", "Override", "public", "void", "computeGradient", "(", "S", "jacLeft", ",", "S", "jacRight", ",", "DMatrixRMaj", "residuals", ",", "DMatrixRMaj", "gradient", ")", "{", "// Find the gradient using the two matrices for Jacobian", "// g = J'*r = [L,R]'*r", "x1", ".", "...
Computes the gradient using Schur complement @param jacLeft (Input) Left side of Jacobian @param jacRight (Input) Right side of Jacobian @param residuals (Input) Residuals @param gradient (Output) Gradient
[ "Computes", "the", "gradient", "using", "Schur", "complement" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/math/HessianSchurComplement_Base.java#L200-L213
100,432
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.buildFromPoints
private Node buildFromPoints(int lower, int upper) { if (upper == lower) { return null; } final Node node = new Node(); node.index = lower; if (upper - lower > 1) { // choose an arbitrary vantage point and move it to the start int i = random.nextInt(upper - lower - 1) + lower; listS...
java
private Node buildFromPoints(int lower, int upper) { if (upper == lower) { return null; } final Node node = new Node(); node.index = lower; if (upper - lower > 1) { // choose an arbitrary vantage point and move it to the start int i = random.nextInt(upper - lower - 1) + lower; listS...
[ "private", "Node", "buildFromPoints", "(", "int", "lower", ",", "int", "upper", ")", "{", "if", "(", "upper", "==", "lower", ")", "{", "return", "null", ";", "}", "final", "Node", "node", "=", "new", "Node", "(", ")", ";", "node", ".", "index", "="...
Builds the tree from a set of points by recursively partitioning them according to a random pivot. @param lower start of range @param upper end of range (exclusive) @return root of the tree or null if lower == upper
[ "Builds", "the", "tree", "from", "a", "set", "of", "points", "by", "recursively", "partitioning", "them", "according", "to", "a", "random", "pivot", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L93-L123
100,433
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.nthElement
private void nthElement(int left, int right, int n, double[] origin) { int npos = partitionItems(left, right, n, origin); if (npos < n) nthElement(npos + 1, right, n, origin); if (npos > n) nthElement(left, npos, n, origin); }
java
private void nthElement(int left, int right, int n, double[] origin) { int npos = partitionItems(left, right, n, origin); if (npos < n) nthElement(npos + 1, right, n, origin); if (npos > n) nthElement(left, npos, n, origin); }
[ "private", "void", "nthElement", "(", "int", "left", ",", "int", "right", ",", "int", "n", ",", "double", "[", "]", "origin", ")", "{", "int", "npos", "=", "partitionItems", "(", "left", ",", "right", ",", "n", ",", "origin", ")", ";", "if", "(", ...
Ensures that the n-th element is in a correct position in the list based on the distance from origin. @param left start of range @param right end of range (exclusive) @param n element to put in the right position @param origin origin to compute the distance to
[ "Ensures", "that", "the", "n", "-", "th", "element", "is", "in", "a", "correct", "position", "in", "the", "list", "based", "on", "the", "distance", "from", "origin", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L133-L139
100,434
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.partitionItems
private int partitionItems(int left, int right, int pivot, double[] origin) { double pivotDistance = distance(origin, items[pivot]); listSwap(items, pivot, right - 1); listSwap(indexes, pivot, right - 1); int storeIndex = left; for (int i = left; i < right - 1; i++) { if (distance(origin, items[i]) <...
java
private int partitionItems(int left, int right, int pivot, double[] origin) { double pivotDistance = distance(origin, items[pivot]); listSwap(items, pivot, right - 1); listSwap(indexes, pivot, right - 1); int storeIndex = left; for (int i = left; i < right - 1; i++) { if (distance(origin, items[i]) <...
[ "private", "int", "partitionItems", "(", "int", "left", ",", "int", "right", ",", "int", "pivot", ",", "double", "[", "]", "origin", ")", "{", "double", "pivotDistance", "=", "distance", "(", "origin", ",", "items", "[", "pivot", "]", ")", ";", "listSw...
Partition the points based on their distance to origin around the selected pivot. @param left range start @param right range end (exclusive) @param pivot pivot for the partition @param origin origin to compute the distance to @return index of the pivot
[ "Partition", "the", "points", "based", "on", "their", "distance", "to", "origin", "around", "the", "selected", "pivot", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L149-L164
100,435
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.listSwap
private <E> void listSwap(E[] list, int a, int b) { final E tmp = list[a]; list[a] = list[b]; list[b] = tmp; }
java
private <E> void listSwap(E[] list, int a, int b) { final E tmp = list[a]; list[a] = list[b]; list[b] = tmp; }
[ "private", "<", "E", ">", "void", "listSwap", "(", "E", "[", "]", "list", ",", "int", "a", ",", "int", "b", ")", "{", "final", "E", "tmp", "=", "list", "[", "a", "]", ";", "list", "[", "a", "]", "=", "list", "[", "b", "]", ";", "list", "[...
Swaps two items in the given list. @param list list to swap the items in @param a index of the first item @param b index of the second item @param <E> list type
[ "Swaps", "two", "items", "in", "the", "given", "list", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L173-L177
100,436
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.distance
private static double distance(double[] p1, double[] p2) { switch (p1.length) { case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1])); case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2]));...
java
private static double distance(double[] p1, double[] p2) { switch (p1.length) { case 2: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1])); case 3: return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) + (p1[1] - p2[1]) * (p1[1] - p2[1]) + (p1[2] - p2[2]) * (p1[2] - p2[2]));...
[ "private", "static", "double", "distance", "(", "double", "[", "]", "p1", ",", "double", "[", "]", "p2", ")", "{", "switch", "(", "p1", ".", "length", ")", "{", "case", "2", ":", "return", "Math", ".", "sqrt", "(", "(", "p1", "[", "0", "]", "-"...
Compute the Euclidean distance between p1 and p2. @param p1 first point @param p2 second point @return Euclidean distance
[ "Compute", "the", "Euclidean", "distance", "between", "p1", "and", "p2", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L191-L204
100,437
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.search
private PriorityQueue<HeapItem> search(final double[] target, double maxDistance, final int k) { PriorityQueue<HeapItem> heap = new PriorityQueue<HeapItem>(); if (root == null) { return heap; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); no...
java
private PriorityQueue<HeapItem> search(final double[] target, double maxDistance, final int k) { PriorityQueue<HeapItem> heap = new PriorityQueue<HeapItem>(); if (root == null) { return heap; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); no...
[ "private", "PriorityQueue", "<", "HeapItem", ">", "search", "(", "final", "double", "[", "]", "target", ",", "double", "maxDistance", ",", "final", "int", "k", ")", "{", "PriorityQueue", "<", "HeapItem", ">", "heap", "=", "new", "PriorityQueue", "<", "Heap...
Recursively search for the k nearest neighbors to target. @param target target point @param maxDistance maximum distance @param k number of neighbors to find
[ "Recursively", "search", "for", "the", "k", "nearest", "neighbors", "to", "target", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L212-L246
100,438
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/VpTree.java
VpTree.searchNearest
private boolean searchNearest(final double[] target, double maxDistance, NnData<double[]> result) { if (root == null) { return false; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); nodes.add(root); result.distance = Double.POSITIVE_INFINITY;...
java
private boolean searchNearest(final double[] target, double maxDistance, NnData<double[]> result) { if (root == null) { return false; } double tau = maxDistance; final FastQueue<Node> nodes = new FastQueue<Node>(20, Node.class, false); nodes.add(root); result.distance = Double.POSITIVE_INFINITY;...
[ "private", "boolean", "searchNearest", "(", "final", "double", "[", "]", "target", ",", "double", "maxDistance", ",", "NnData", "<", "double", "[", "]", ">", "result", ")", "{", "if", "(", "root", "==", "null", ")", "{", "return", "false", ";", "}", ...
Equivalent to the above search method to find one nearest neighbor. It is faster as it does not need to allocate and use the heap data structure. @param target target point @param maxDistance maximum distance @param result information about the nearest point (output parameter) @return true if a nearest point was found ...
[ "Equivalent", "to", "the", "above", "search", "method", "to", "find", "one", "nearest", "neighbor", ".", "It", "is", "faster", "as", "it", "does", "not", "need", "to", "allocate", "and", "use", "the", "heap", "data", "structure", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/VpTree.java#L256-L290
100,439
lessthanoptimal/ddogleg
src/org/ddogleg/nn/alg/searches/KdTreeSearch1Standard.java
KdTreeSearch1Standard.findNeighbor
@Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
java
@Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
[ "@", "Override", "public", "KdTree", ".", "Node", "findNeighbor", "(", "P", "target", ")", "{", "if", "(", "tree", ".", "root", "==", "null", ")", "return", "null", ";", "this", ".", "target", "=", "target", ";", "this", ".", "closest", "=", "null", ...
Finds the node which is closest to 'target' @param target A point @return Closest node or null if none is within the minimum distance.
[ "Finds", "the", "node", "which", "is", "closest", "to", "target" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/searches/KdTreeSearch1Standard.java#L77-L89
100,440
lessthanoptimal/ddogleg
src/org/ddogleg/solver/impl/FindRealRootsSturm.java
FindRealRootsSturm.process
public void process( Polynomial poly ) { sturm.initialize(poly); if( searchRadius <= 0 ) numRoots = sturm.countRealRoots(Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY); else numRoots = sturm.countRealRoots(-searchRadius,searchRadius); if( numRoots == 0 ) return; if( searchRadius <= 0 ) hand...
java
public void process( Polynomial poly ) { sturm.initialize(poly); if( searchRadius <= 0 ) numRoots = sturm.countRealRoots(Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY); else numRoots = sturm.countRealRoots(-searchRadius,searchRadius); if( numRoots == 0 ) return; if( searchRadius <= 0 ) hand...
[ "public", "void", "process", "(", "Polynomial", "poly", ")", "{", "sturm", ".", "initialize", "(", "poly", ")", ";", "if", "(", "searchRadius", "<=", "0", ")", "numRoots", "=", "sturm", ".", "countRealRoots", "(", "Double", ".", "NEGATIVE_INFINITY", ",", ...
Find real roots for the specified polynomial. @param poly Polynomial which has less than or equal to the number of coefficients specified in this class's constructor.
[ "Find", "real", "roots", "for", "the", "specified", "polynomial", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L112-L133
100,441
lessthanoptimal/ddogleg
src/org/ddogleg/solver/impl/FindRealRootsSturm.java
FindRealRootsSturm.handleAllRoots
private void handleAllRoots() { int totalFound = 0; double r = 1; int iter = 0; // increase the search region centered around 0 until at least one root has been found while( iter++ < maxBoundIterations && (totalFound=sturm.countRealRoots(-r,r)) <= 0 ) { r = 2*r*r; } if( Double.isInfinite(r) ) throw...
java
private void handleAllRoots() { int totalFound = 0; double r = 1; int iter = 0; // increase the search region centered around 0 until at least one root has been found while( iter++ < maxBoundIterations && (totalFound=sturm.countRealRoots(-r,r)) <= 0 ) { r = 2*r*r; } if( Double.isInfinite(r) ) throw...
[ "private", "void", "handleAllRoots", "(", ")", "{", "int", "totalFound", "=", "0", ";", "double", "r", "=", "1", ";", "int", "iter", "=", "0", ";", "// increase the search region centered around 0 until at least one root has been found", "while", "(", "iter", "++", ...
Search for all real roots. First find a region about 0 which contains at least one root. Then search above and below.
[ "Search", "for", "all", "real", "roots", ".", "First", "find", "a", "region", "about", "0", "which", "contains", "at", "least", "one", "root", ".", "Then", "search", "above", "and", "below", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L140-L195
100,442
lessthanoptimal/ddogleg
src/org/ddogleg/solver/impl/FindRealRootsSturm.java
FindRealRootsSturm.bisectionRoot
private void bisectionRoot( double l , double u , int index ) { // use bisection until there is an estimate within tolerance int iter = 0; while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) { double m = (l+u)/2.0; int numRoots = sturm.countRealRoots(m,u); if( numRoots == 1 ) { l ...
java
private void bisectionRoot( double l , double u , int index ) { // use bisection until there is an estimate within tolerance int iter = 0; while( u-l > boundTolerance*Math.abs(l) && iter++ < maxBoundIterations) { double m = (l+u)/2.0; int numRoots = sturm.countRealRoots(m,u); if( numRoots == 1 ) { l ...
[ "private", "void", "bisectionRoot", "(", "double", "l", ",", "double", "u", ",", "int", "index", ")", "{", "// use bisection until there is an estimate within tolerance", "int", "iter", "=", "0", ";", "while", "(", "u", "-", "l", ">", "boundTolerance", "*", "M...
Searches for a single real root inside the range. Only one root is assumed to be inside @param l lower value of search range @param u upper value of search range @param index
[ "Searches", "for", "a", "single", "real", "root", "inside", "the", "range", ".", "Only", "one", "root", "is", "assumed", "to", "be", "inside" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L204-L226
100,443
lessthanoptimal/ddogleg
src/org/ddogleg/solver/impl/FindRealRootsSturm.java
FindRealRootsSturm.boundEachRoot
private void boundEachRoot( double l , double u , int startIndex , int numRoots ) { // Find an upper and lower bound which contains one real root only int iter = 0; double allUpper = u; int root = 0; int lastFound = 0; double lastUpper = u; while( root < numRoots && iter++ < maxBoundIterations) { doub...
java
private void boundEachRoot( double l , double u , int startIndex , int numRoots ) { // Find an upper and lower bound which contains one real root only int iter = 0; double allUpper = u; int root = 0; int lastFound = 0; double lastUpper = u; while( root < numRoots && iter++ < maxBoundIterations) { doub...
[ "private", "void", "boundEachRoot", "(", "double", "l", ",", "double", "u", ",", "int", "startIndex", ",", "int", "numRoots", ")", "{", "// Find an upper and lower bound which contains one real root only", "int", "iter", "=", "0", ";", "double", "allUpper", "=", "...
Finds a crude upper and lower bound for each root that includes only one root. NOTE: Performance could be improved with better book keeping. For example, if it knows a bound with for two roots, then one for one root it then knows the bounds for both roots.
[ "Finds", "a", "crude", "upper", "and", "lower", "bound", "for", "each", "root", "that", "includes", "only", "one", "root", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/impl/FindRealRootsSturm.java#L234-L273
100,444
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/GaussNewtonBase_F64.java
GaussNewtonBase_F64.iterate
public boolean iterate() { boolean converged; switch( mode ) { case COMPUTE_DERIVATIVES: totalFullSteps++; converged = updateDerivates(); if( !converged ) { totalSelectSteps++; converged = computeStep(); } break; case DETERMINE_STEP: totalSelectSteps++; converged = compu...
java
public boolean iterate() { boolean converged; switch( mode ) { case COMPUTE_DERIVATIVES: totalFullSteps++; converged = updateDerivates(); if( !converged ) { totalSelectSteps++; converged = computeStep(); } break; case DETERMINE_STEP: totalSelectSteps++; converged = compu...
[ "public", "boolean", "iterate", "(", ")", "{", "boolean", "converged", ";", "switch", "(", "mode", ")", "{", "case", "COMPUTE_DERIVATIVES", ":", "totalFullSteps", "++", ";", "converged", "=", "updateDerivates", "(", ")", ";", "if", "(", "!", "converged", "...
Performs one iteration @return true if it has converged or false if not
[ "Performs", "one", "iteration" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/GaussNewtonBase_F64.java#L110-L140
100,445
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/GaussNewtonBase_F64.java
GaussNewtonBase_F64.computeHessianScaling
public void computeHessianScaling(DMatrixRMaj scaling ) { double max = 0; for (int i = 0; i < scaling.numRows; i++) { // mathematically it should never be negative but... double v = scaling.data[i] = sqrt(abs(scaling.data[i])); if( v > max ) max = v; } // Add this number to avoid divide by zero. ...
java
public void computeHessianScaling(DMatrixRMaj scaling ) { double max = 0; for (int i = 0; i < scaling.numRows; i++) { // mathematically it should never be negative but... double v = scaling.data[i] = sqrt(abs(scaling.data[i])); if( v > max ) max = v; } // Add this number to avoid divide by zero. ...
[ "public", "void", "computeHessianScaling", "(", "DMatrixRMaj", "scaling", ")", "{", "double", "max", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "scaling", ".", "numRows", ";", "i", "++", ")", "{", "// mathematically it should never be ...
Applies the standard formula for computing scaling. This is broken off into its own function so that it easily invoked if the function above is overridden @param scaling Vector containing scaling information
[ "Applies", "the", "standard", "formula", "for", "computing", "scaling", ".", "This", "is", "broken", "off", "into", "its", "own", "function", "so", "that", "it", "easily", "invoked", "if", "the", "function", "above", "is", "overridden" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/GaussNewtonBase_F64.java#L169-L186
100,446
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/GaussNewtonBase_F64.java
GaussNewtonBase_F64.computePredictedReduction
public double computePredictedReduction( DMatrixRMaj p ) { return -CommonOps_DDRM.dot(gradient,p) - 0.5*hessian.innerVectorHessian(p); }
java
public double computePredictedReduction( DMatrixRMaj p ) { return -CommonOps_DDRM.dot(gradient,p) - 0.5*hessian.innerVectorHessian(p); }
[ "public", "double", "computePredictedReduction", "(", "DMatrixRMaj", "p", ")", "{", "return", "-", "CommonOps_DDRM", ".", "dot", "(", "gradient", ",", "p", ")", "-", "0.5", "*", "hessian", ".", "innerVectorHessian", "(", "p", ")", ";", "}" ]
Computes predicted reduction for step 'p' @param p Change in state or the step @return predicted reduction in quadratic model
[ "Computes", "predicted", "reduction", "for", "step", "p" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/GaussNewtonBase_F64.java#L240-L242
100,447
lessthanoptimal/ddogleg
src/org/ddogleg/struct/GrowQueue_I32.java
GrowQueue_I32.setTo
public void setTo( int[] array , int offset , int length ) { resize(length); System.arraycopy(array,offset,data,0,length); }
java
public void setTo( int[] array , int offset , int length ) { resize(length); System.arraycopy(array,offset,data,0,length); }
[ "public", "void", "setTo", "(", "int", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "resize", "(", "length", ")", ";", "System", ".", "arraycopy", "(", "array", ",", "offset", ",", "data", ",", "0", ",", "length", ")", ...
Sets this array to be equal to the array segment @param array (Input) source array @param offset first index @param length number of elements to copy
[ "Sets", "this", "array", "to", "be", "equal", "to", "the", "array", "segment" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/GrowQueue_I32.java#L138-L141
100,448
lessthanoptimal/ddogleg
src/org/ddogleg/struct/GrowQueue_I32.java
GrowQueue_I32.insert
public void insert( int index , int value ) { if( size == data.length ) { int temp[] = new int[ size * 2]; System.arraycopy(data,0,temp,0,index); temp[index] = value; System.arraycopy(data,index,temp,index+1,size-index); this.data = temp; size++; } else { size++; for( int i = size-1; i > ind...
java
public void insert( int index , int value ) { if( size == data.length ) { int temp[] = new int[ size * 2]; System.arraycopy(data,0,temp,0,index); temp[index] = value; System.arraycopy(data,index,temp,index+1,size-index); this.data = temp; size++; } else { size++; for( int i = size-1; i > ind...
[ "public", "void", "insert", "(", "int", "index", ",", "int", "value", ")", "{", "if", "(", "size", "==", "data", ".", "length", ")", "{", "int", "temp", "[", "]", "=", "new", "int", "[", "size", "*", "2", "]", ";", "System", ".", "arraycopy", "...
Inserts the value at the specified index and shifts all the other values down.
[ "Inserts", "the", "value", "at", "the", "specified", "index", "and", "shifts", "all", "the", "other", "values", "down", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/GrowQueue_I32.java#L171-L186
100,449
lessthanoptimal/ddogleg
src/org/ddogleg/struct/GrowQueue_I32.java
GrowQueue_I32.removeHead
public void removeHead( int total ) { for( int j = total; j < size; j++ ) { data[j-total] = data[j]; } size -= total; }
java
public void removeHead( int total ) { for( int j = total; j < size; j++ ) { data[j-total] = data[j]; } size -= total; }
[ "public", "void", "removeHead", "(", "int", "total", ")", "{", "for", "(", "int", "j", "=", "total", ";", "j", "<", "size", ";", "j", "++", ")", "{", "data", "[", "j", "-", "total", "]", "=", "data", "[", "j", "]", ";", "}", "size", "-=", "...
Removes the first 'total' elements from the queue. Element 'total' will be the new start of the queue @param total Number of elements to remove from the head of the queue
[ "Removes", "the", "first", "total", "elements", "from", "the", "queue", ".", "Element", "total", "will", "be", "the", "new", "start", "of", "the", "queue" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/struct/GrowQueue_I32.java#L193-L198
100,450
lessthanoptimal/ddogleg
src/org/ddogleg/combinatorics/Permute.java
Permute.init
private void init( List<T> list ) { this.list = list; indexes = new int[ list.size() ]; counters = new int[ list.size() ]; for( int i = 0; i < indexes.length ; i++ ) { counters[i] = indexes[i] = i; } total = 1; for( int i = 2; i <= indexes.length ; i++ ) { total *= i; } permutation = 0; }
java
private void init( List<T> list ) { this.list = list; indexes = new int[ list.size() ]; counters = new int[ list.size() ]; for( int i = 0; i < indexes.length ; i++ ) { counters[i] = indexes[i] = i; } total = 1; for( int i = 2; i <= indexes.length ; i++ ) { total *= i; } permutation = 0; }
[ "private", "void", "init", "(", "List", "<", "T", ">", "list", ")", "{", "this", ".", "list", "=", "list", ";", "indexes", "=", "new", "int", "[", "list", ".", "size", "(", ")", "]", ";", "counters", "=", "new", "int", "[", "list", ".", "size",...
Initializes the permutation for a new list @param list List which is to be permuted.
[ "Initializes", "the", "permutation", "for", "a", "new", "list" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/combinatorics/Permute.java#L88-L103
100,451
lessthanoptimal/ddogleg
src/org/ddogleg/combinatorics/Permute.java
Permute.next
public boolean next() { if( indexes.length <= 1 || permutation >= total-1 ) return false; int N = indexes.length-2; int k = N; swap(k, counters[k]++); while( counters[k] == indexes.length ) { k -= 1; swap(k, counters[k]++); } swap(counters[k], k); //before while (k < indexes.length - 1) { ...
java
public boolean next() { if( indexes.length <= 1 || permutation >= total-1 ) return false; int N = indexes.length-2; int k = N; swap(k, counters[k]++); while( counters[k] == indexes.length ) { k -= 1; swap(k, counters[k]++); } swap(counters[k], k); //before while (k < indexes.length - 1) { ...
[ "public", "boolean", "next", "(", ")", "{", "if", "(", "indexes", ".", "length", "<=", "1", "||", "permutation", ">=", "total", "-", "1", ")", "return", "false", ";", "int", "N", "=", "indexes", ".", "length", "-", "2", ";", "int", "k", "=", "N",...
This will permute the list once
[ "This", "will", "permute", "the", "list", "once" ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/combinatorics/Permute.java#L115-L136
100,452
lessthanoptimal/ddogleg
src/org/ddogleg/combinatorics/Permute.java
Permute.previous
public boolean previous() { if( indexes.length <= 1 || permutation <= 0 ) return false; int N = indexes.length-2; int k = N; while( counters[k] <= k ) { k--; } swap(counters[k], k); counters[k]--; swap(k, counters[k]); int foo = k+1; while( counters[k+1] == k+1 && k < indexes.length-2) { ...
java
public boolean previous() { if( indexes.length <= 1 || permutation <= 0 ) return false; int N = indexes.length-2; int k = N; while( counters[k] <= k ) { k--; } swap(counters[k], k); counters[k]--; swap(k, counters[k]); int foo = k+1; while( counters[k+1] == k+1 && k < indexes.length-2) { ...
[ "public", "boolean", "previous", "(", ")", "{", "if", "(", "indexes", ".", "length", "<=", "1", "||", "permutation", "<=", "0", ")", "return", "false", ";", "int", "N", "=", "indexes", ".", "length", "-", "2", ";", "int", "k", "=", "N", ";", "whi...
This will undo a permutation.
[ "This", "will", "undo", "a", "permutation", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/combinatorics/Permute.java#L141-L168
100,453
lessthanoptimal/ddogleg
src/org/ddogleg/combinatorics/Permute.java
Permute.getPermutation
public List<T> getPermutation(List<T> storage) { if( storage == null ) storage = new ArrayList<T>(); else storage.clear(); for( int i = 0; i < list.size(); i++ ) { storage.add(get(i)); } return storage; }
java
public List<T> getPermutation(List<T> storage) { if( storage == null ) storage = new ArrayList<T>(); else storage.clear(); for( int i = 0; i < list.size(); i++ ) { storage.add(get(i)); } return storage; }
[ "public", "List", "<", "T", ">", "getPermutation", "(", "List", "<", "T", ">", "storage", ")", "{", "if", "(", "storage", "==", "null", ")", "storage", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "else", "storage", ".", "clear", "(", "...
Returns a list containing the current permutation. @param storage Optional storage. If null a new list will be declared. @return Current permutation
[ "Returns", "a", "list", "containing", "the", "current", "permutation", "." ]
3786bf448ba23d0e04962dd08c34fa68de276029
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/combinatorics/Permute.java#L201-L212
100,454
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.recipient
@Override public Sms recipient(Recipient... recipients) { this.recipients.addAll(Arrays.asList(recipients)); return this; }
java
@Override public Sms recipient(Recipient... recipients) { this.recipients.addAll(Arrays.asList(recipients)); return this; }
[ "@", "Override", "public", "Sms", "recipient", "(", "Recipient", "...", "recipients", ")", "{", "this", ".", "recipients", ".", "addAll", "(", "Arrays", ".", "asList", "(", "recipients", ")", ")", ";", "return", "this", ";", "}" ]
Add a recipient for the message @param recipients one or several recipient to add @return this instance for fluent chaining
[ "Add", "a", "recipient", "for", "the", "message" ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L169-L173
100,455
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.from
public Sms from(String name, String phoneNumber) { return from(name, new PhoneNumber(phoneNumber)); }
java
public Sms from(String name, String phoneNumber) { return from(name, new PhoneNumber(phoneNumber)); }
[ "public", "Sms", "from", "(", "String", "name", ",", "String", "phoneNumber", ")", "{", "return", "from", "(", "name", ",", "new", "PhoneNumber", "(", "phoneNumber", ")", ")", ";", "}" ]
Set the sender using the phone number as string. @param name the name of the sender @param phoneNumber the sender number @return this instance for fluent chaining
[ "Set", "the", "sender", "using", "the", "phone", "number", "as", "string", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L206-L208
100,456
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.to
public Sms to(PhoneNumber... numbers) { for (PhoneNumber number : numbers) { to((String) null, number); } return this; }
java
public Sms to(PhoneNumber... numbers) { for (PhoneNumber number : numbers) { to((String) null, number); } return this; }
[ "public", "Sms", "to", "(", "PhoneNumber", "...", "numbers", ")", "{", "for", "(", "PhoneNumber", "number", ":", "numbers", ")", "{", "to", "(", "(", "String", ")", "null", ",", "number", ")", ";", "}", "return", "this", ";", "}" ]
Add a recipient specifying the phone number. @param numbers one or several recipient numbers @return this instance for fluent chaining
[ "Add", "a", "recipient", "specifying", "the", "phone", "number", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L230-L235
100,457
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.to
public Sms to(String... numbers) { for (String num : numbers) { to(new Recipient(num)); } return this; }
java
public Sms to(String... numbers) { for (String num : numbers) { to(new Recipient(num)); } return this; }
[ "public", "Sms", "to", "(", "String", "...", "numbers", ")", "{", "for", "(", "String", "num", ":", "numbers", ")", "{", "to", "(", "new", "Recipient", "(", "num", ")", ")", ";", "}", "return", "this", ";", "}" ]
Add a recipient specifying the phone number as string. @param numbers one or several recipient numbers @return this instance for fluent chaining
[ "Add", "a", "recipient", "specifying", "the", "phone", "number", "as", "string", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L244-L249
100,458
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.to
public Sms to(String name, PhoneNumber number) { to(new Recipient(name, number)); return this; }
java
public Sms to(String name, PhoneNumber number) { to(new Recipient(name, number)); return this; }
[ "public", "Sms", "to", "(", "String", "name", ",", "PhoneNumber", "number", ")", "{", "to", "(", "new", "Recipient", "(", "name", ",", "number", ")", ")", ";", "return", "this", ";", "}" ]
Add a recipient specifying the name and the phone number. @param name the name of the recipient @param number the number of the recipient @return this instance for fluent chaining
[ "Add", "a", "recipient", "specifying", "the", "name", "and", "the", "phone", "number", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L260-L263
100,459
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.toRecipient
public static Recipient[] toRecipient(PhoneNumber[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (PhoneNumber t : to) { addresses[i++] = new Recipient(t); } return addresses; }
java
public static Recipient[] toRecipient(PhoneNumber[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (PhoneNumber t : to) { addresses[i++] = new Recipient(t); } return addresses; }
[ "public", "static", "Recipient", "[", "]", "toRecipient", "(", "PhoneNumber", "[", "]", "to", ")", "{", "Recipient", "[", "]", "addresses", "=", "new", "Recipient", "[", "to", ".", "length", "]", ";", "int", "i", "=", "0", ";", "for", "(", "PhoneNumb...
Converts a list of phone numbers to a list of recipients. @param to the list of phone numbers @return the list of recipients
[ "Converts", "a", "list", "of", "phone", "numbers", "to", "a", "list", "of", "recipients", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L286-L293
100,460
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java
Sms.toRecipient
public static Recipient[] toRecipient(String[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (String t : to) { addresses[i++] = new Recipient(t); } return addresses; }
java
public static Recipient[] toRecipient(String[] to) { Recipient[] addresses = new Recipient[to.length]; int i = 0; for (String t : to) { addresses[i++] = new Recipient(t); } return addresses; }
[ "public", "static", "Recipient", "[", "]", "toRecipient", "(", "String", "[", "]", "to", ")", "{", "Recipient", "[", "]", "addresses", "=", "new", "Recipient", "[", "to", ".", "length", "]", ";", "int", "i", "=", "0", ";", "for", "(", "String", "t"...
Converts a list of string to a list of recipients. @param to the list of phone numbers as string @return the list of recipients
[ "Converts", "a", "list", "of", "string", "to", "a", "list", "of", "recipients", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/message/Sms.java#L302-L309
100,461
groupe-sii/ogham
ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/builder/sendgrid/SendGridBuilder.java
SendGridBuilder.username
public SendGridBuilder username(String... username) { for (String u : username) { if (u != null) { usernames.add(u); } } return this; }
java
public SendGridBuilder username(String... username) { for (String u : username) { if (u != null) { usernames.add(u); } } return this; }
[ "public", "SendGridBuilder", "username", "(", "String", "...", "username", ")", "{", "for", "(", "String", "u", ":", "username", ")", "{", "if", "(", "u", "!=", "null", ")", "{", "usernames", ".", "add", "(", "u", ")", ";", "}", "}", "return", "thi...
Set username for SendGrid HTTP API. You can specify a direct value. For example: <pre> .username("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .username("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evalu...
[ "Set", "username", "for", "SendGrid", "HTTP", "API", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/builder/sendgrid/SendGridBuilder.java#L212-L219
100,462
groupe-sii/ogham
ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/builder/sendgrid/SendGridBuilder.java
SendGridBuilder.password
public SendGridBuilder password(String... password) { for (String p : password) { if (p != null) { passwords.add(p); } } return this; }
java
public SendGridBuilder password(String... password) { for (String p : password) { if (p != null) { passwords.add(p); } } return this; }
[ "public", "SendGridBuilder", "password", "(", "String", "...", "password", ")", "{", "for", "(", "String", "p", ":", "password", ")", "{", "if", "(", "p", "!=", "null", ")", "{", "passwords", ".", "add", "(", "p", ")", ";", "}", "}", "return", "thi...
Set password for SendGrid HTTP API. You can specify a direct value. For example: <pre> .password("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .password("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evalu...
[ "Set", "password", "for", "SendGrid", "HTTP", "API", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/builder/sendgrid/SendGridBuilder.java#L249-L256
100,463
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/util/bean/BeanWrapperUtils.java
BeanWrapperUtils.isInvalid
public static boolean isInvalid(Object bean) { if (bean == null) { return false; } return isPrimitiveOrWrapper(bean.getClass()) || INVALID_TYPES.contains(bean.getClass()) || isInstanceOfInvalid(bean.getClass()); }
java
public static boolean isInvalid(Object bean) { if (bean == null) { return false; } return isPrimitiveOrWrapper(bean.getClass()) || INVALID_TYPES.contains(bean.getClass()) || isInstanceOfInvalid(bean.getClass()); }
[ "public", "static", "boolean", "isInvalid", "(", "Object", "bean", ")", "{", "if", "(", "bean", "==", "null", ")", "{", "return", "false", ";", "}", "return", "isPrimitiveOrWrapper", "(", "bean", ".", "getClass", "(", ")", ")", "||", "INVALID_TYPES", "."...
Check if the bean type can be wrapped or not. @param bean the bean instance @return false if null or valid type, true if primitive type or string
[ "Check", "if", "the", "bean", "type", "can", "be", "wrapped", "or", "not", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/bean/BeanWrapperUtils.java#L38-L45
100,464
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java
Email.recipient
@Override public Email recipient(Recipient... recipients) { this.recipients.addAll(Arrays.asList(recipients)); return this; }
java
@Override public Email recipient(Recipient... recipients) { this.recipients.addAll(Arrays.asList(recipients)); return this; }
[ "@", "Override", "public", "Email", "recipient", "(", "Recipient", "...", "recipients", ")", "{", "this", ".", "recipients", ".", "addAll", "(", "Arrays", ".", "asList", "(", "recipients", ")", ")", ";", "return", "this", ";", "}" ]
Add a recipient of the mail. @param recipients one or several recipient to add @return this instance for fluent chaining
[ "Add", "a", "recipient", "of", "the", "mail", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java#L296-L300
100,465
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java
Email.to
public Email to(EmailAddress... to) { for (EmailAddress t : to) { recipient(t, RecipientType.TO); } return this; }
java
public Email to(EmailAddress... to) { for (EmailAddress t : to) { recipient(t, RecipientType.TO); } return this; }
[ "public", "Email", "to", "(", "EmailAddress", "...", "to", ")", "{", "for", "(", "EmailAddress", "t", ":", "to", ")", "{", "recipient", "(", "t", ",", "RecipientType", ".", "TO", ")", ";", "}", "return", "this", ";", "}" ]
Add a "to" recipient address. @param to one or several recipient addresses @return this instance for fluent chaining
[ "Add", "a", "to", "recipient", "address", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java#L324-L329
100,466
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java
Email.cc
public Email cc(EmailAddress... cc) { for (EmailAddress c : cc) { recipient(c, RecipientType.CC); } return this; }
java
public Email cc(EmailAddress... cc) { for (EmailAddress c : cc) { recipient(c, RecipientType.CC); } return this; }
[ "public", "Email", "cc", "(", "EmailAddress", "...", "cc", ")", "{", "for", "(", "EmailAddress", "c", ":", "cc", ")", "{", "recipient", "(", "c", ",", "RecipientType", ".", "CC", ")", ";", "}", "return", "this", ";", "}" ]
Add a "cc" recipient address. @param cc one or several recipient addresses @return this instance for fluent chaining
[ "Add", "a", "cc", "recipient", "address", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java#L353-L358
100,467
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java
Email.bcc
public Email bcc(EmailAddress... bcc) { for (EmailAddress b : bcc) { recipient(b, RecipientType.BCC); } return this; }
java
public Email bcc(EmailAddress... bcc) { for (EmailAddress b : bcc) { recipient(b, RecipientType.BCC); } return this; }
[ "public", "Email", "bcc", "(", "EmailAddress", "...", "bcc", ")", "{", "for", "(", "EmailAddress", "b", ":", "bcc", ")", "{", "recipient", "(", "b", ",", "RecipientType", ".", "BCC", ")", ";", "}", "return", "this", ";", "}" ]
Add a "bcc" recipient address. @param bcc one or several recipient addresses @return this instance for fluent chaining
[ "Add", "a", "bcc", "recipient", "address", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/email/message/Email.java#L382-L387
100,468
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/sms/builder/SmsBuilder.java
SmsBuilder.sender
public <T extends Builder<? extends MessageSender>> T sender(Class<T> builderClass) { return senderBuilderHelper.register(builderClass); }
java
public <T extends Builder<? extends MessageSender>> T sender(Class<T> builderClass) { return senderBuilderHelper.register(builderClass); }
[ "public", "<", "T", "extends", "Builder", "<", "?", "extends", "MessageSender", ">", ">", "T", "sender", "(", "Class", "<", "T", ">", "builderClass", ")", "{", "return", "senderBuilderHelper", ".", "register", "(", "builderClass", ")", ";", "}" ]
Registers and configures sender through a dedicated builder. For example: <pre> .sender(CloudhopperBuilder.class) .host("localhost"); </pre> <p> If your custom builder is annotated by one or several of: <ul> <li>{@link RequiredClass}</li> <li>{@link RequiredProperty}</li> <li>{@link RequiredClasses}</li> <li>{@link ...
[ "Registers", "and", "configures", "sender", "through", "a", "dedicated", "builder", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/sms/builder/SmsBuilder.java#L510-L512
100,469
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java
ImageInlineUtils.isInlineModeAllowed
public static boolean isInlineModeAllowed(Element img, InlineMode mode) { // if already inlined => reject (do not inline twice) if (!img.attr(INLINED_ATTR).isEmpty()) { return false; } // if inline mode defined but not the wanted mode => reject if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_...
java
public static boolean isInlineModeAllowed(Element img, InlineMode mode) { // if already inlined => reject (do not inline twice) if (!img.attr(INLINED_ATTR).isEmpty()) { return false; } // if inline mode defined but not the wanted mode => reject if (!img.attr(INLINE_MODE_ATTR).isEmpty() && !img.attr(INLINE_...
[ "public", "static", "boolean", "isInlineModeAllowed", "(", "Element", "img", ",", "InlineMode", "mode", ")", "{", "// if already inlined => reject (do not inline twice)", "if", "(", "!", "img", ".", "attr", "(", "INLINED_ATTR", ")", ".", "isEmpty", "(", ")", ")", ...
Checks if inlining mode is allowed on the provided element. @param img the image element to check if the actual inlining mode is allowed @param mode the actual mode @return true if this mode is allowed, false otherwise
[ "Checks", "if", "inlining", "mode", "is", "allowed", "on", "the", "provided", "element", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/html/inliner/impl/jsoup/ImageInlineUtils.java#L31-L43
100,470
groupe-sii/ogham
ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CharsetBuilder.java
CharsetBuilder.convert
public CharsetBuilder convert(String nioCharsetName, String cloudhopperCharset) { mappings.add(new CharsetMapping(nioCharsetName, cloudhopperCharset)); return this; }
java
public CharsetBuilder convert(String nioCharsetName, String cloudhopperCharset) { mappings.add(new CharsetMapping(nioCharsetName, cloudhopperCharset)); return this; }
[ "public", "CharsetBuilder", "convert", "(", "String", "nioCharsetName", ",", "String", "cloudhopperCharset", ")", "{", "mappings", ".", "add", "(", "new", "CharsetMapping", "(", "nioCharsetName", ",", "cloudhopperCharset", ")", ")", ";", "return", "this", ";", "...
Registers a charset conversion. Conversion is required by Cloudhopper in order to use a charset supported by the SMPP protocol. You can register several charset conversions. @param nioCharsetName the charset used by the Java application @param cloudhopperCharset the charset supported by the SMPP protocol @return this...
[ "Registers", "a", "charset", "conversion", ".", "Conversion", "is", "required", "by", "Cloudhopper", "in", "order", "to", "use", "a", "charset", "supported", "by", "the", "SMPP", "protocol", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CharsetBuilder.java#L82-L85
100,471
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/resource/resolver/FirstSupportingResourceResolver.java
FirstSupportingResourceResolver.getSupportingResolver
@Override public ResourceResolver getSupportingResolver(String path) { LOG.debug("Finding resolver for resource {}...", path); for (ResourceResolver resolver : resolvers) { if (resolver.supports(path)) { LOG.debug("{} can handle resource {}", resolver, path); return resolver; } } LOG.debug("No r...
java
@Override public ResourceResolver getSupportingResolver(String path) { LOG.debug("Finding resolver for resource {}...", path); for (ResourceResolver resolver : resolvers) { if (resolver.supports(path)) { LOG.debug("{} can handle resource {}", resolver, path); return resolver; } } LOG.debug("No r...
[ "@", "Override", "public", "ResourceResolver", "getSupportingResolver", "(", "String", "path", ")", "{", "LOG", ".", "debug", "(", "\"Finding resolver for resource {}...\"", ",", "path", ")", ";", "for", "(", "ResourceResolver", "resolver", ":", "resolvers", ")", ...
Find the first supporting resolver. @param path the name of the path of the resource @return the first resolver supporting the path
[ "Find", "the", "first", "supporting", "resolver", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/resource/resolver/FirstSupportingResourceResolver.java#L93-L105
100,472
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/builder/resolution/ResourceResolutionBuilderHelper.java
ResourceResolutionBuilderHelper.buildResolvers
public List<ResourceResolver> buildResolvers() { List<ResourceResolver> resolvers = new ArrayList<>(); resolvers.addAll(customResolvers); // ensure that default lookup is always the last registered List<ResolverHelper> helpers = new ArrayList<>(); if (classPath != null) { helpers.add(new ResolverHelper(cla...
java
public List<ResourceResolver> buildResolvers() { List<ResourceResolver> resolvers = new ArrayList<>(); resolvers.addAll(customResolvers); // ensure that default lookup is always the last registered List<ResolverHelper> helpers = new ArrayList<>(); if (classPath != null) { helpers.add(new ResolverHelper(cla...
[ "public", "List", "<", "ResourceResolver", ">", "buildResolvers", "(", ")", "{", "List", "<", "ResourceResolver", ">", "resolvers", "=", "new", "ArrayList", "<>", "(", ")", ";", "resolvers", ".", "addAll", "(", "customResolvers", ")", ";", "// ensure that defa...
Build the list of resource resolvers. <p> The list is ordered to ensure that empty string lookup is always the last registered. </p> <p> If some custom resolvers are registered, they are used before default ones in the order they were registered. </p> @return the list of resource resolvers
[ "Build", "the", "list", "of", "resource", "resolvers", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/resolution/ResourceResolutionBuilderHelper.java#L95-L114
100,473
groupe-sii/ogham
ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CloudhopperBuilder.java
CloudhopperBuilder.port
public CloudhopperBuilder port(String... port) { for (String p : port) { if (port != null) { ports.add(p); } } return this; }
java
public CloudhopperBuilder port(String... port) { for (String p : port) { if (port != null) { ports.add(p); } } return this; }
[ "public", "CloudhopperBuilder", "port", "(", "String", "...", "port", ")", "{", "for", "(", "String", "p", ":", "port", ")", "{", "if", "(", "port", "!=", "null", ")", "{", "ports", ".", "add", "(", "p", ")", ";", "}", "}", "return", "this", ";",...
Set the SMPP server port. You can specify a direct value. For example: <pre> .port("2775"); </pre> <p> You can also specify one or several property keys. For example: <pre> .port("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evaluated. The evaluat...
[ "Set", "the", "SMPP", "server", "port", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CloudhopperBuilder.java#L434-L441
100,474
groupe-sii/ogham
ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CloudhopperBuilder.java
CloudhopperBuilder.interfaceVersion
public CloudhopperBuilder interfaceVersion(String... version) { for (String v : version) { if (v != null) { interfaceVersions.add(v); } } return this; }
java
public CloudhopperBuilder interfaceVersion(String... version) { for (String v : version) { if (v != null) { interfaceVersions.add(v); } } return this; }
[ "public", "CloudhopperBuilder", "interfaceVersion", "(", "String", "...", "version", ")", "{", "for", "(", "String", "v", ":", "version", ")", "{", "if", "(", "v", "!=", "null", ")", "{", "interfaceVersions", ".", "add", "(", "v", ")", ";", "}", "}", ...
Set the SMPP protocol version. You can specify a direct value. For example: <pre> .interfaceVersion("3.4"); </pre> <p> You can also specify one or several property keys. For example: <pre> .interfaceVersion("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immedi...
[ "Set", "the", "SMPP", "protocol", "version", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-cloudhopper/src/main/java/fr/sii/ogham/sms/builder/cloudhopper/CloudhopperBuilder.java#L524-L531
100,475
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java
MapContentHandler.addContentHandler
public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) { map.put(clazz, handler); }
java
public void addContentHandler(Class<? extends Content> clazz, JavaMailContentHandler handler) { map.put(clazz, handler); }
[ "public", "void", "addContentHandler", "(", "Class", "<", "?", "extends", "Content", ">", "clazz", ",", "JavaMailContentHandler", "handler", ")", "{", "map", ".", "put", "(", "clazz", ",", "handler", ")", ";", "}" ]
Register a new content handler. @param clazz the class of the content @param handler the content handler
[ "Register", "a", "new", "content", "handler", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapContentHandler.java#L61-L63
100,476
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java
MessagingBuilder.configure
public void configure() { Collections.sort(configurers, new PriorityComparator()); for (PrioritizedConfigurer configurer : configurers) { configurer.getConfigurer().configure(this); } }
java
public void configure() { Collections.sort(configurers, new PriorityComparator()); for (PrioritizedConfigurer configurer : configurers) { configurer.getConfigurer().configure(this); } }
[ "public", "void", "configure", "(", ")", "{", "Collections", ".", "sort", "(", "configurers", ",", "new", "PriorityComparator", "(", ")", ")", ";", "for", "(", "PrioritizedConfigurer", "configurer", ":", "configurers", ")", "{", "configurer", ".", "getConfigur...
Apply all registered configurers on this builder instance. <p> When using {@link #standard()} and {@link #minimal()} factory methods, this method is automatically called.
[ "Apply", "all", "registered", "configurers", "on", "this", "builder", "instance", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java#L294-L299
100,477
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java
MessagingBuilder.build
@Override public MessagingService build() { LOG.info("Using service that calls all registered senders"); List<ConditionalSender> senders = buildSenders(); LOG.debug("Registered senders: {}", senders); MessagingService service = new EverySupportingMessagingService(senders); if (wrapUncaught) { service = ne...
java
@Override public MessagingService build() { LOG.info("Using service that calls all registered senders"); List<ConditionalSender> senders = buildSenders(); LOG.debug("Registered senders: {}", senders); MessagingService service = new EverySupportingMessagingService(senders); if (wrapUncaught) { service = ne...
[ "@", "Override", "public", "MessagingService", "build", "(", ")", "{", "LOG", ".", "info", "(", "\"Using service that calls all registered senders\"", ")", ";", "List", "<", "ConditionalSender", ">", "senders", "=", "buildSenders", "(", ")", ";", "LOG", ".", "de...
Builds the messaging service. The messaging service relies on the generated senders. Each sender is able to manage one or multiple messages. The default implementation of the messaging service is to ask each sender if it is able to handle the message and if it the case, then use this sender to really send the message. ...
[ "Builds", "the", "messaging", "service", ".", "The", "messaging", "service", "relies", "on", "the", "generated", "senders", ".", "Each", "sender", "is", "able", "to", "manage", "one", "or", "multiple", "messages", ".", "The", "default", "implementation", "of",...
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java#L1069-L1079
100,478
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapAttachmentResourceHandler.java
MapAttachmentResourceHandler.addResourceHandler
public void addResourceHandler(Class<? extends NamedResource> clazz, JavaMailAttachmentResourceHandler handler) { map.put(clazz, handler); }
java
public void addResourceHandler(Class<? extends NamedResource> clazz, JavaMailAttachmentResourceHandler handler) { map.put(clazz, handler); }
[ "public", "void", "addResourceHandler", "(", "Class", "<", "?", "extends", "NamedResource", ">", "clazz", ",", "JavaMailAttachmentResourceHandler", "handler", ")", "{", "map", ".", "put", "(", "clazz", ",", "handler", ")", ";", "}" ]
Register a new attachment resource handler. @param clazz the class of the attachment resource @param handler the attachment resource handler
[ "Register", "a", "new", "attachment", "resource", "handler", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/javamail/MapAttachmentResourceHandler.java#L64-L66
100,479
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/util/classpath/SimpleClasspathHelper.java
SimpleClasspathHelper.exists
public boolean exists(String className) { if(this.classLoader!=null) { if(exists(className, this.classLoader)) { LOG.debug("class {} found using class specific class loader", className); return true; } return false; } if(existsWithDefaultClassLoader(className)) { LOG.debug("class {} found usin...
java
public boolean exists(String className) { if(this.classLoader!=null) { if(exists(className, this.classLoader)) { LOG.debug("class {} found using class specific class loader", className); return true; } return false; } if(existsWithDefaultClassLoader(className)) { LOG.debug("class {} found usin...
[ "public", "boolean", "exists", "(", "String", "className", ")", "{", "if", "(", "this", ".", "classLoader", "!=", "null", ")", "{", "if", "(", "exists", "(", "className", ",", "this", ".", "classLoader", ")", ")", "{", "LOG", ".", "debug", "(", "\"cl...
Test if the class name is defined in the classpath. @param className the class name @return true if the class exists in the classpath, false otherwise
[ "Test", "if", "the", "class", "name", "is", "defined", "in", "the", "classpath", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/classpath/SimpleClasspathHelper.java#L25-L46
100,480
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/util/EqualsBuilder.java
EqualsBuilder.append
public EqualsBuilder append(Object objectFieldValue, Object otherFieldValue) { if (equals && !same) { delegate.append(objectFieldValue, otherFieldValue); } return this; }
java
public EqualsBuilder append(Object objectFieldValue, Object otherFieldValue) { if (equals && !same) { delegate.append(objectFieldValue, otherFieldValue); } return this; }
[ "public", "EqualsBuilder", "append", "(", "Object", "objectFieldValue", ",", "Object", "otherFieldValue", ")", "{", "if", "(", "equals", "&&", "!", "same", ")", "{", "delegate", ".", "append", "(", "objectFieldValue", ",", "otherFieldValue", ")", ";", "}", "...
Test if two Objects are equal using their equals method. @param objectFieldValue the value of a field of the object @param otherFieldValue the value of a field of the other object @return used to chain calls
[ "Test", "if", "two", "Objects", "are", "equal", "using", "their", "equals", "method", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/EqualsBuilder.java#L145-L150
100,481
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/condition/fluent/FluentCondition.java
FluentCondition.and
@SafeVarargs public final FluentCondition<T> and(Condition<T>... conditions) { List<Condition<T>> merged = new ArrayList<>(); merged.add(delegate); for (Condition<T> condition : conditions) { merged.add(condition); } return Conditions.and(merged); }
java
@SafeVarargs public final FluentCondition<T> and(Condition<T>... conditions) { List<Condition<T>> merged = new ArrayList<>(); merged.add(delegate); for (Condition<T> condition : conditions) { merged.add(condition); } return Conditions.and(merged); }
[ "@", "SafeVarargs", "public", "final", "FluentCondition", "<", "T", ">", "and", "(", "Condition", "<", "T", ">", "...", "conditions", ")", "{", "List", "<", "Condition", "<", "T", ">>", "merged", "=", "new", "ArrayList", "<>", "(", ")", ";", "merged", ...
Create a logical AND operator between current condition and conditions provided in parameters. For example: <pre> requiredClass("javax.mail.Transport").and(requiredClass("foo.Bar")); </pre> Means that the result will be true only if the result of the current condition (<code>requiredClass("javax.mail.Transport")</co...
[ "Create", "a", "logical", "AND", "operator", "between", "current", "condition", "and", "conditions", "provided", "in", "parameters", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/condition/fluent/FluentCondition.java#L73-L81
100,482
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/builder/retry/RetryBuilder.java
RetryBuilder.fixedDelay
public FixedDelayBuilder<RetryBuilder<P>> fixedDelay() { if (fixedDelay == null) { fixedDelay = new FixedDelayBuilder<>(this, environmentBuilder); } return fixedDelay; }
java
public FixedDelayBuilder<RetryBuilder<P>> fixedDelay() { if (fixedDelay == null) { fixedDelay = new FixedDelayBuilder<>(this, environmentBuilder); } return fixedDelay; }
[ "public", "FixedDelayBuilder", "<", "RetryBuilder", "<", "P", ">", ">", "fixedDelay", "(", ")", "{", "if", "(", "fixedDelay", "==", "null", ")", "{", "fixedDelay", "=", "new", "FixedDelayBuilder", "<>", "(", "this", ",", "environmentBuilder", ")", ";", "}"...
Retry several times with a fixed delay between each try until the maximum attempts is reached. For example: <pre> .fixedDelay() .delay(500) .maxRetries(5) </pre> Means that a retry will be attempted every 500ms until 5 attempts are reached (inclusive). For example, you want to connect to an external system at t1=0 a...
[ "Retry", "several", "times", "with", "a", "fixed", "delay", "between", "each", "try", "until", "the", "maximum", "attempts", "is", "reached", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/retry/RetryBuilder.java#L83-L88
100,483
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/builder/javamail/UsernamePasswordAuthenticatorBuilder.java
UsernamePasswordAuthenticatorBuilder.username
public UsernamePasswordAuthenticatorBuilder username(String... username) { for (String u : username) { if (u != null && !u.isEmpty()) { usernames.add(u); } } return this; }
java
public UsernamePasswordAuthenticatorBuilder username(String... username) { for (String u : username) { if (u != null && !u.isEmpty()) { usernames.add(u); } } return this; }
[ "public", "UsernamePasswordAuthenticatorBuilder", "username", "(", "String", "...", "username", ")", "{", "for", "(", "String", "u", ":", "username", ")", "{", "if", "(", "u", "!=", "null", "&&", "!", "u", ".", "isEmpty", "(", ")", ")", "{", "usernames",...
Set the username to use for the authentication. You can specify a direct value. For example: <pre> .username("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .username("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immed...
[ "Set", "the", "username", "to", "use", "for", "the", "authentication", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/builder/javamail/UsernamePasswordAuthenticatorBuilder.java#L93-L100
100,484
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/builder/javamail/UsernamePasswordAuthenticatorBuilder.java
UsernamePasswordAuthenticatorBuilder.password
public UsernamePasswordAuthenticatorBuilder password(String... password) { for (String p : password) { if (p != null && !p.isEmpty()) { passwords.add(p); } } return this; }
java
public UsernamePasswordAuthenticatorBuilder password(String... password) { for (String p : password) { if (p != null && !p.isEmpty()) { passwords.add(p); } } return this; }
[ "public", "UsernamePasswordAuthenticatorBuilder", "password", "(", "String", "...", "password", ")", "{", "for", "(", "String", "p", ":", "password", ")", "{", "if", "(", "p", "!=", "null", "&&", "!", "p", ".", "isEmpty", "(", ")", ")", "{", "passwords",...
Set the password to use for the authentication. You can specify a direct value. For example: <pre> .password("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .password("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immed...
[ "Set", "the", "password", "to", "use", "for", "the", "authentication", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/builder/javamail/UsernamePasswordAuthenticatorBuilder.java#L130-L137
100,485
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/builder/retry/FixedDelayBuilder.java
FixedDelayBuilder.maxRetries
public FixedDelayBuilder<P> maxRetries(String... maxRetries) { for (String m : maxRetries) { if (m != null) { maxRetriesProps.add(m); } } return this; }
java
public FixedDelayBuilder<P> maxRetries(String... maxRetries) { for (String m : maxRetries) { if (m != null) { maxRetriesProps.add(m); } } return this; }
[ "public", "FixedDelayBuilder", "<", "P", ">", "maxRetries", "(", "String", "...", "maxRetries", ")", "{", "for", "(", "String", "m", ":", "maxRetries", ")", "{", "if", "(", "m", "!=", "null", ")", "{", "maxRetriesProps", ".", "add", "(", "m", ")", ";...
Set the maximum number of attempts. You can specify a direct value. For example: <pre> .maxRetries("10"); </pre> <p> You can also specify one or several property keys. For example: <pre> .delay("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evaluat...
[ "Set", "the", "maximum", "number", "of", "attempts", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/retry/FixedDelayBuilder.java#L134-L141
100,486
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java
OvhSmsSender.handleResponse
private void handleResponse(Sms message, Response response) throws IOException, JsonProcessingException, MessageNotSentException { if (response.getStatus().isSuccess()) { JsonNode json = mapper.readTree(response.getBody()); int ovhStatus = json.get("status").asInt(); // 100 <= ovh status < 200 ====> OK -> ju...
java
private void handleResponse(Sms message, Response response) throws IOException, JsonProcessingException, MessageNotSentException { if (response.getStatus().isSuccess()) { JsonNode json = mapper.readTree(response.getBody()); int ovhStatus = json.get("status").asInt(); // 100 <= ovh status < 200 ====> OK -> ju...
[ "private", "void", "handleResponse", "(", "Sms", "message", ",", "Response", "response", ")", "throws", "IOException", ",", "JsonProcessingException", ",", "MessageNotSentException", "{", "if", "(", "response", ".", "getStatus", "(", ")", ".", "isSuccess", "(", ...
Handle OVH response. If status provided in response is less than 200, then the message has been sent. Otherwise, the message has not been sent. @param message the SMS to send @param response the received response from OVH API @throws IOException when the response couldn't be read @throws JsonProcessingException when t...
[ "Handle", "OVH", "response", ".", "If", "status", "provided", "in", "response", "is", "less", "than", "200", "then", "the", "message", "has", "been", "sent", ".", "Otherwise", "the", "message", "has", "not", "been", "sent", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java#L125-L147
100,487
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java
OvhSmsSender.convert
private static List<String> convert(List<Recipient> recipients) throws PhoneNumberException { List<String> tos = new ArrayList<>(recipients.size()); // convert phone numbers to international format for (Recipient recipient : recipients) { tos.add(toInternational(recipient.getPhoneNumber())); } return tos; ...
java
private static List<String> convert(List<Recipient> recipients) throws PhoneNumberException { List<String> tos = new ArrayList<>(recipients.size()); // convert phone numbers to international format for (Recipient recipient : recipients) { tos.add(toInternational(recipient.getPhoneNumber())); } return tos; ...
[ "private", "static", "List", "<", "String", ">", "convert", "(", "List", "<", "Recipient", ">", "recipients", ")", "throws", "PhoneNumberException", "{", "List", "<", "String", ">", "tos", "=", "new", "ArrayList", "<>", "(", "recipients", ".", "size", "(",...
Convert the list of SMS recipients to international phone numbers usable by OVH. @param recipients the list of recipients @return the list of international phone numbers @throws PhoneNumberException
[ "Convert", "the", "list", "of", "SMS", "recipients", "to", "international", "phone", "numbers", "usable", "by", "OVH", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java#L172-L179
100,488
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java
OvhSmsBuilder.url
public OvhSmsBuilder url(String... url) { for (String u : url) { if (u != null) { urls.add(u); } } return this; }
java
public OvhSmsBuilder url(String... url) { for (String u : url) { if (u != null) { urls.add(u); } } return this; }
[ "public", "OvhSmsBuilder", "url", "(", "String", "...", "url", ")", "{", "for", "(", "String", "u", ":", "url", ")", "{", "if", "(", "u", "!=", "null", ")", "{", "urls", ".", "add", "(", "u", ")", ";", "}", "}", "return", "this", ";", "}" ]
Set the URL of the OVH SMS HTTP API. You can specify a direct value. For example: <pre> .url("https://www.ovh.com/cgi-bin/sms/http2sms.cgi"); </pre> <p> You can also specify one or several property keys. For example: <pre> .host("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The pro...
[ "Set", "the", "URL", "of", "the", "OVH", "SMS", "HTTP", "API", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java#L218-L225
100,489
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java
OvhSmsBuilder.account
public OvhSmsBuilder account(String... account) { for (String a : account) { if (a != null) { accounts.add(a); } } return this; }
java
public OvhSmsBuilder account(String... account) { for (String a : account) { if (a != null) { accounts.add(a); } } return this; }
[ "public", "OvhSmsBuilder", "account", "(", "String", "...", "account", ")", "{", "for", "(", "String", "a", ":", "account", ")", "{", "if", "(", "a", "!=", "null", ")", "{", "accounts", ".", "add", "(", "a", ")", ";", "}", "}", "return", "this", ...
Set the OVH account identifier. You can specify a direct value. For example: <pre> .account("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .account("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evaluated. ...
[ "Set", "the", "OVH", "account", "identifier", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java#L255-L262
100,490
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java
OvhSmsBuilder.login
public OvhSmsBuilder login(String... login) { for (String l : login) { if (l != null) { logins.add(l); } } return this; }
java
public OvhSmsBuilder login(String... login) { for (String l : login) { if (l != null) { logins.add(l); } } return this; }
[ "public", "OvhSmsBuilder", "login", "(", "String", "...", "login", ")", "{", "for", "(", "String", "l", ":", "login", ")", "{", "if", "(", "l", "!=", "null", ")", "{", "logins", ".", "add", "(", "l", ")", ";", "}", "}", "return", "this", ";", "...
Set the OVH username. You can specify a direct value. For example: <pre> .login("foo"); </pre> <p> You can also specify one or several property keys. For example: <pre> .login("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evaluated. The evaluation...
[ "Set", "the", "OVH", "username", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java#L292-L299
100,491
groupe-sii/ogham
ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java
OvhSmsBuilder.password
public OvhSmsBuilder password(String... password) { for (String p : password) { if (p != null) { passwords.add(p); } } return this; }
java
public OvhSmsBuilder password(String... password) { for (String p : password) { if (p != null) { passwords.add(p); } } return this; }
[ "public", "OvhSmsBuilder", "password", "(", "String", "...", "password", ")", "{", "for", "(", "String", "p", ":", "password", ")", "{", "if", "(", "p", "!=", "null", ")", "{", "passwords", ".", "add", "(", "p", ")", ";", "}", "}", "return", "this"...
Set the OVH password. You can specify a direct value. For example: <pre> .password("bar"); </pre> <p> You can also specify one or several property keys. For example: <pre> .password("${custom.property.high-priority}", "${custom.property.low-priority}"); </pre> The properties are not immediately evaluated. The eval...
[ "Set", "the", "OVH", "password", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/builder/ovh/OvhSmsBuilder.java#L329-L336
100,492
groupe-sii/ogham
ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/sender/impl/sendgrid/handler/MapContentHandler.java
MapContentHandler.register
public SendGridContentHandler register(final Class<? extends Content> clazz, final SendGridContentHandler handler) { if (handler == null) { throw new IllegalArgumentException("[handler] cannot be null"); } if (clazz == null) { throw new IllegalArgumentException("[clazz] cannot be null"); } LOG....
java
public SendGridContentHandler register(final Class<? extends Content> clazz, final SendGridContentHandler handler) { if (handler == null) { throw new IllegalArgumentException("[handler] cannot be null"); } if (clazz == null) { throw new IllegalArgumentException("[clazz] cannot be null"); } LOG....
[ "public", "SendGridContentHandler", "register", "(", "final", "Class", "<", "?", "extends", "Content", ">", "clazz", ",", "final", "SendGridContentHandler", "handler", ")", "{", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "IllegalArgumentExcept...
Registers a handler for a given content type. @param clazz the content type @param handler the handler @return the handler formerly associated with the content type, if there was one
[ "Registers", "a", "handler", "for", "a", "given", "content", "type", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-sendgrid/src/main/java/fr/sii/ogham/email/sender/impl/sendgrid/handler/MapContentHandler.java#L43-L53
100,493
groupe-sii/ogham
ogham-template-freemarker/src/main/java/fr/sii/ogham/template/freemarker/builder/AbstractFreemarkerBuilder.java
AbstractFreemarkerBuilder.configuration
public FreemarkerConfigurationBuilder<MYSELF> configuration() { if (configurationBuilder == null) { configurationBuilder = new FreemarkerConfigurationBuilder<>(myself, environmentBuilder); } return configurationBuilder; }
java
public FreemarkerConfigurationBuilder<MYSELF> configuration() { if (configurationBuilder == null) { configurationBuilder = new FreemarkerConfigurationBuilder<>(myself, environmentBuilder); } return configurationBuilder; }
[ "public", "FreemarkerConfigurationBuilder", "<", "MYSELF", ">", "configuration", "(", ")", "{", "if", "(", "configurationBuilder", "==", "null", ")", "{", "configurationBuilder", "=", "new", "FreemarkerConfigurationBuilder", "<>", "(", "myself", ",", "environmentBuild...
Fluent configurer for Freemarker configuration. @return the fluent builder for Freemarker configuration object
[ "Fluent", "configurer", "for", "Freemarker", "configuration", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-template-freemarker/src/main/java/fr/sii/ogham/template/freemarker/builder/AbstractFreemarkerBuilder.java#L203-L208
100,494
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.createMimeMessage
private MimeMessage createMimeMessage() { // prepare the message Session session = Session.getInstance(properties, authenticator); return new MimeMessage(session); }
java
private MimeMessage createMimeMessage() { // prepare the message Session session = Session.getInstance(properties, authenticator); return new MimeMessage(session); }
[ "private", "MimeMessage", "createMimeMessage", "(", ")", "{", "// prepare the message", "Session", "session", "=", "Session", ".", "getInstance", "(", "properties", ",", "authenticator", ")", ";", "return", "new", "MimeMessage", "(", "session", ")", ";", "}" ]
Initialize the session and create the mime message. @return the mime message
[ "Initialize", "the", "session", "and", "create", "the", "mime", "message", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L124-L128
100,495
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.setFrom
private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { if (email.getFrom() == null) { throw new IllegalArgumentException("The sender address has not been set"); } mimeMsg.setFrom(toInternetAddress(email.getFrom())); }
java
private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { if (email.getFrom() == null) { throw new IllegalArgumentException("The sender address has not been set"); } mimeMsg.setFrom(toInternetAddress(email.getFrom())); }
[ "private", "void", "setFrom", "(", "Email", "email", ",", "MimeMessage", "mimeMsg", ")", "throws", "MessagingException", ",", "AddressException", ",", "UnsupportedEncodingException", "{", "if", "(", "email", ".", "getFrom", "(", ")", "==", "null", ")", "{", "t...
Set the sender address on the mime message. @param email the source email @param mimeMsg the mime message to fill @throws MessagingException when the email address is not valid @throws AddressException when the email address is not valid @throws UnsupportedEncodingException when the email address is not valid
[ "Set", "the", "sender", "address", "on", "the", "mime", "message", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L144-L149
100,496
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.setRecipients
private void setRecipients(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { for (Recipient recipient : email.getRecipients()) { mimeMsg.addRecipient(convert(recipient.getType()), toInternetAddress(recipient.getAddress())); } }
java
private void setRecipients(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { for (Recipient recipient : email.getRecipients()) { mimeMsg.addRecipient(convert(recipient.getType()), toInternetAddress(recipient.getAddress())); } }
[ "private", "void", "setRecipients", "(", "Email", "email", ",", "MimeMessage", "mimeMsg", ")", "throws", "MessagingException", ",", "AddressException", ",", "UnsupportedEncodingException", "{", "for", "(", "Recipient", "recipient", ":", "email", ".", "getRecipients", ...
Set the recipients addresses on the mime message. @param email the source email @param mimeMsg the mime message to fill @throws MessagingException when the email address is not valid @throws AddressException when the email address is not valid @throws UnsupportedEncodingException when the email address is not valid
[ "Set", "the", "recipients", "addresses", "on", "the", "mime", "message", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L165-L169
100,497
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.setMimeContent
private void setMimeContent(Email email, MimeMessage mimeMsg) throws MessagingException, ContentHandlerException, AttachmentResourceHandlerException { LOG.debug("Add message content for email {}", email); // create the root as mixed MimeMultipart rootContainer = new MimeMultipart("mixed"); // create the contain...
java
private void setMimeContent(Email email, MimeMessage mimeMsg) throws MessagingException, ContentHandlerException, AttachmentResourceHandlerException { LOG.debug("Add message content for email {}", email); // create the root as mixed MimeMultipart rootContainer = new MimeMultipart("mixed"); // create the contain...
[ "private", "void", "setMimeContent", "(", "Email", "email", ",", "MimeMessage", "mimeMsg", ")", "throws", "MessagingException", ",", "ContentHandlerException", ",", "AttachmentResourceHandlerException", "{", "LOG", ".", "debug", "(", "\"Add message content for email {}\"", ...
Set the content on the mime message. <p> If the source email has several contents (for example text and html) and attachments (with attachment content disposition), the mime message looks like: <pre> mixed related alternative [text/plain] text message [text/html] html message attachment 1 attachment 2 </pre> <p> If ...
[ "Set", "the", "content", "on", "the", "mime", "message", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L232-L266
100,498
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.addAttachment
private void addAttachment(Multipart multipart, Attachment attachment) throws AttachmentResourceHandlerException { MimeBodyPart part = new MimeBodyPart(); try { part.setFileName(attachment.getResource().getName()); part.setDisposition(attachment.getDisposition()); part.setDescription(attachment.getDescript...
java
private void addAttachment(Multipart multipart, Attachment attachment) throws AttachmentResourceHandlerException { MimeBodyPart part = new MimeBodyPart(); try { part.setFileName(attachment.getResource().getName()); part.setDisposition(attachment.getDisposition()); part.setDescription(attachment.getDescript...
[ "private", "void", "addAttachment", "(", "Multipart", "multipart", ",", "Attachment", "attachment", ")", "throws", "AttachmentResourceHandlerException", "{", "MimeBodyPart", "part", "=", "new", "MimeBodyPart", "(", ")", ";", "try", "{", "part", ".", "setFileName", ...
Add an attachment on the mime message. @param multipart the mime message to fill @param attachment the attachment to add @throws AttachmentResourceHandlerException when the attachment couldn't be attached
[ "Add", "an", "attachment", "on", "the", "mime", "message", "." ]
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L278-L290
100,499
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/sender/MultiImplementationSender.java
MultiImplementationSender.addImplementation
public final MultiImplementationSender<M> addImplementation(Condition<Message> condition, MessageSender implementation) { implementations.add(new Implementation(condition, implementation)); return this; }
java
public final MultiImplementationSender<M> addImplementation(Condition<Message> condition, MessageSender implementation) { implementations.add(new Implementation(condition, implementation)); return this; }
[ "public", "final", "MultiImplementationSender", "<", "M", ">", "addImplementation", "(", "Condition", "<", "Message", ">", "condition", ",", "MessageSender", "implementation", ")", "{", "implementations", ".", "add", "(", "new", "Implementation", "(", "condition", ...
Register a new possible implementation with the associated condition. The implementation is added at the end so any other possible implementation will be used before this one if the associated condition allow it. @param condition the condition that indicates if the implementation can be used at runtime @param implemen...
[ "Register", "a", "new", "possible", "implementation", "with", "the", "associated", "condition", ".", "The", "implementation", "is", "added", "at", "the", "end", "so", "any", "other", "possible", "implementation", "will", "be", "used", "before", "this", "one", ...
e273b845604add74b5a25dfd931cb3c166b1008f
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/sender/MultiImplementationSender.java#L90-L93