repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/items/ActionDrawerItem.java
ActionDrawerItem.onCreateView
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, int highlightColor) { Context ctx = inflater.getContext(); View view = inflater.inflate(R.layout.navdrawer_item, container, false); ImageView iconView = ButterKnife.findById(view, R.id.icon); TextView titleView = ButterKnife.findById(view, R.id.title); // Set the text FontLoader.apply(titleView, Face.ROBOTO_MEDIUM); titleView.setText(text); // Set the icon, if provided iconView.setVisibility(icon > 0 ? View.VISIBLE : View.GONE); if(icon > 0) iconView.setImageResource(icon); // configure its appearance according to whether or not it's selected titleView.setTextColor(selected ? highlightColor : UIUtils.getColorAttr(ctx, android.R.attr.textColorPrimary)); iconView.setColorFilter(selected ? highlightColor : ctx.getResources().getColor(R.color.navdrawer_icon_tint)); return view; }
java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, int highlightColor) { Context ctx = inflater.getContext(); View view = inflater.inflate(R.layout.navdrawer_item, container, false); ImageView iconView = ButterKnife.findById(view, R.id.icon); TextView titleView = ButterKnife.findById(view, R.id.title); // Set the text FontLoader.apply(titleView, Face.ROBOTO_MEDIUM); titleView.setText(text); // Set the icon, if provided iconView.setVisibility(icon > 0 ? View.VISIBLE : View.GONE); if(icon > 0) iconView.setImageResource(icon); // configure its appearance according to whether or not it's selected titleView.setTextColor(selected ? highlightColor : UIUtils.getColorAttr(ctx, android.R.attr.textColorPrimary)); iconView.setColorFilter(selected ? highlightColor : ctx.getResources().getColor(R.color.navdrawer_icon_tint)); return view; }
[ "@", "Override", "public", "View", "onCreateView", "(", "LayoutInflater", "inflater", ",", "ViewGroup", "container", ",", "int", "highlightColor", ")", "{", "Context", "ctx", "=", "inflater", ".", "getContext", "(", ")", ";", "View", "view", "=", "inflater", ...
Called to create this view @param inflater the layout inflater to inflate a layout from system @param container the container the layout is going to be placed in @return
[ "Called", "to", "create", "this", "view" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/items/ActionDrawerItem.java#L61-L88
RKumsher/utils
src/main/java/com/github/rkumsher/collection/ArrayUtils.java
ArrayUtils.containsAll
@SafeVarargs public static <T> boolean containsAll(T[] arrayToCheck, T... elementsToCheckFor) { return containsAll(arrayToCheck, Arrays.asList(elementsToCheckFor)); }
java
@SafeVarargs public static <T> boolean containsAll(T[] arrayToCheck, T... elementsToCheckFor) { return containsAll(arrayToCheck, Arrays.asList(elementsToCheckFor)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "boolean", "containsAll", "(", "T", "[", "]", "arrayToCheck", ",", "T", "...", "elementsToCheckFor", ")", "{", "return", "containsAll", "(", "arrayToCheck", ",", "Arrays", ".", "asList", "(", "elementsTo...
Returns whether or not the given array contains all the given elements to check for. <pre> ArrayUtils.containsAll(new String[] {}) = true; ArrayUtils.containsAll(new String[] {"a"}, "a") = true; ArrayUtils.containsAll(new String[] {"a"}, "b") = false; ArrayUtils.containsAll(new String[] {"a", "b"}, "a", "b", "a", "b") = true; </pre> @param arrayToCheck array to to check @param elementsToCheckFor elements to check for @param <T> the type of elements in the given array @return whether or not the given array contains all the given elements to check for.
[ "Returns", "whether", "or", "not", "the", "given", "array", "contains", "all", "the", "given", "elements", "to", "check", "for", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/collection/ArrayUtils.java#L78-L81
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/CanvasSize.java
CanvasSize.clipToMargin
public boolean clipToMargin(double[] origin, double[] target) { assert (target.length == 2 && origin.length == 2); if ((origin[0] < minx && target[0] < minx) // || (origin[0] > maxx && target[0] > maxx) // || (origin[1] < miny && target[1] < miny) // || (origin[1] > maxy && target[1] > maxy)) { return false; } double deltax = target[0] - origin[0]; double deltay = target[1] - origin[1]; double fmaxx = (maxx - origin[0]) / deltax; double fmaxy = (maxy - origin[1]) / deltay; double fminx = (minx - origin[0]) / deltax; double fminy = (miny - origin[1]) / deltay; double factor1 = MathUtil.min(1, fmaxx > fminx ? fmaxx : fminx, fmaxy > fminy ? fmaxy : fminy); double factor2 = MathUtil.max(0, fmaxx < fminx ? fmaxx : fminx, fmaxy < fminy ? fmaxy : fminy); if (factor1 <= factor2) { return false; // Clipped! } target[0] = origin[0] + factor1 * deltax; target[1] = origin[1] + factor1 * deltay; origin[0] += factor2 * deltax; origin[1] += factor2 * deltay; return true; }
java
public boolean clipToMargin(double[] origin, double[] target) { assert (target.length == 2 && origin.length == 2); if ((origin[0] < minx && target[0] < minx) // || (origin[0] > maxx && target[0] > maxx) // || (origin[1] < miny && target[1] < miny) // || (origin[1] > maxy && target[1] > maxy)) { return false; } double deltax = target[0] - origin[0]; double deltay = target[1] - origin[1]; double fmaxx = (maxx - origin[0]) / deltax; double fmaxy = (maxy - origin[1]) / deltay; double fminx = (minx - origin[0]) / deltax; double fminy = (miny - origin[1]) / deltay; double factor1 = MathUtil.min(1, fmaxx > fminx ? fmaxx : fminx, fmaxy > fminy ? fmaxy : fminy); double factor2 = MathUtil.max(0, fmaxx < fminx ? fmaxx : fminx, fmaxy < fminy ? fmaxy : fminy); if (factor1 <= factor2) { return false; // Clipped! } target[0] = origin[0] + factor1 * deltax; target[1] = origin[1] + factor1 * deltay; origin[0] += factor2 * deltax; origin[1] += factor2 * deltay; return true; }
[ "public", "boolean", "clipToMargin", "(", "double", "[", "]", "origin", ",", "double", "[", "]", "target", ")", "{", "assert", "(", "target", ".", "length", "==", "2", "&&", "origin", ".", "length", "==", "2", ")", ";", "if", "(", "(", "origin", "[...
Clip a line on the margin (modifies arrays!) @param origin Origin point, <b>will be modified</b> @param target Target point, <b>will be modified</b> @return {@code false} if entirely outside the margin
[ "Clip", "a", "line", "on", "the", "margin", "(", "modifies", "arrays!", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/CanvasSize.java#L141-L165
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java
LibraryUtils.handleException
public static void handleException(ExceptionHandler exceptionHandler, ProgressStatus progressStatus, Exception e, String message) { ProcessingLibraryException exception = new ProcessingLibraryException(message, e, progressStatus); exceptionHandler.handleException(exception); }
java
public static void handleException(ExceptionHandler exceptionHandler, ProgressStatus progressStatus, Exception e, String message) { ProcessingLibraryException exception = new ProcessingLibraryException(message, e, progressStatus); exceptionHandler.handleException(exception); }
[ "public", "static", "void", "handleException", "(", "ExceptionHandler", "exceptionHandler", ",", "ProgressStatus", "progressStatus", ",", "Exception", "e", ",", "String", "message", ")", "{", "ProcessingLibraryException", "exception", "=", "new", "ProcessingLibraryExcepti...
A wrapper function of handling exceptions that have a known root cause, such as {@link AmazonServiceException}. @param exceptionHandler the {@link ExceptionHandler} to handle exceptions. @param progressStatus the current progress status {@link ProgressStatus}. @param e the exception needs to be handled. @param message the exception message.
[ "A", "wrapper", "function", "of", "handling", "exceptions", "that", "have", "a", "known", "root", "cause", "such", "as", "{" ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/utils/LibraryUtils.java#L169-L172
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.printDebug
public static void printDebug(final Collection pCollection, final String pMethodName) { printDebug(pCollection, pMethodName, System.out); }
java
public static void printDebug(final Collection pCollection, final String pMethodName) { printDebug(pCollection, pMethodName, System.out); }
[ "public", "static", "void", "printDebug", "(", "final", "Collection", "pCollection", ",", "final", "String", "pMethodName", ")", "{", "printDebug", "(", "pCollection", ",", "pMethodName", ",", "System", ".", "out", ")", ";", "}" ]
Invokes a given method of every element in a {@code java.util.Collection} and prints the results to {@code System.out}. The method to be invoked must have no formal parameters. <p> If an exception is throwed during the method invocation, the element's {@code toString()} method is called. For bulk data types, recursive invocations and invocations of other methods in this class, are used. <p> Be aware that the {@code Collection} interface embraces a large portion of the bulk data types in the {@code java.util} package, e.g. {@code List}, {@code Set}, {@code Vector} and {@code HashSet}. <p> For debugging of arrays, use the method <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Arrays.html#asList(java.lang.Object[])">{@code java.util.Arrays.asList(Object[])}</a> method for converting the object array to a list before calling this method. <p> @param pCollection the {@code java.util.Collection} to be printed. @param pMethodName a {@code java.lang.String} holding the name of the method to be invoked on each collection element. @see <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Collection.html">{@code java.util.Collection}</a>
[ "Invokes", "a", "given", "method", "of", "every", "element", "in", "a", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L520-L522
derari/cthul
matchers/src/main/java/org/cthul/matchers/diagnose/nested/Nested.java
Nested.useParentheses
public static boolean useParentheses(int pSelf, int pNested) { if (pSelf == PrecedencedSelfDescribing.P_NONE || pSelf == PrecedencedSelfDescribing.P_UNARY_NO_PAREN) { return false; } if (pNested < PrecedencedSelfDescribing.P_UNARY) { return pNested <= pSelf; } else { return pNested < pSelf; } }
java
public static boolean useParentheses(int pSelf, int pNested) { if (pSelf == PrecedencedSelfDescribing.P_NONE || pSelf == PrecedencedSelfDescribing.P_UNARY_NO_PAREN) { return false; } if (pNested < PrecedencedSelfDescribing.P_UNARY) { return pNested <= pSelf; } else { return pNested < pSelf; } }
[ "public", "static", "boolean", "useParentheses", "(", "int", "pSelf", ",", "int", "pNested", ")", "{", "if", "(", "pSelf", "==", "PrecedencedSelfDescribing", ".", "P_NONE", "||", "pSelf", "==", "PrecedencedSelfDescribing", ".", "P_UNARY_NO_PAREN", ")", "{", "ret...
Compares own precedence against nested and return @param pSelf @param pNested @return true iff parentheses should be used
[ "Compares", "own", "precedence", "against", "nested", "and", "return" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/matchers/src/main/java/org/cthul/matchers/diagnose/nested/Nested.java#L133-L143
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java
ThresholdBlock.applyThreshold
protected void applyThreshold( T input, GrayU8 output ) { for (int blockY = 0; blockY < stats.height; blockY++) { for (int blockX = 0; blockX < stats.width; blockX++) { original.thresholdBlock(blockX,blockY,input,stats,output); } } }
java
protected void applyThreshold( T input, GrayU8 output ) { for (int blockY = 0; blockY < stats.height; blockY++) { for (int blockX = 0; blockX < stats.width; blockX++) { original.thresholdBlock(blockX,blockY,input,stats,output); } } }
[ "protected", "void", "applyThreshold", "(", "T", "input", ",", "GrayU8", "output", ")", "{", "for", "(", "int", "blockY", "=", "0", ";", "blockY", "<", "stats", ".", "height", ";", "blockY", "++", ")", "{", "for", "(", "int", "blockX", "=", "0", ";...
Applies the dynamically computed threshold to each pixel in the image, one block at a time
[ "Applies", "the", "dynamically", "computed", "threshold", "to", "each", "pixel", "in", "the", "image", "one", "block", "at", "a", "time" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdBlock.java#L132-L138
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.getFieldType
static JCExpression getFieldType(JavacNode field, FieldAccess fieldAccess) { if (field.getKind() == Kind.METHOD) return ((JCMethodDecl) field.get()).restype; boolean lookForGetter = lookForGetter(field, fieldAccess); GetterMethod getter = lookForGetter ? findGetter(field) : null; if (getter == null) { return ((JCVariableDecl) field.get()).vartype; } return getter.type; }
java
static JCExpression getFieldType(JavacNode field, FieldAccess fieldAccess) { if (field.getKind() == Kind.METHOD) return ((JCMethodDecl) field.get()).restype; boolean lookForGetter = lookForGetter(field, fieldAccess); GetterMethod getter = lookForGetter ? findGetter(field) : null; if (getter == null) { return ((JCVariableDecl) field.get()).vartype; } return getter.type; }
[ "static", "JCExpression", "getFieldType", "(", "JavacNode", "field", ",", "FieldAccess", "fieldAccess", ")", "{", "if", "(", "field", ".", "getKind", "(", ")", "==", "Kind", ".", "METHOD", ")", "return", "(", "(", "JCMethodDecl", ")", "field", ".", "get", ...
Returns the type of the field, unless a getter exists for this field, in which case the return type of the getter is returned. @see #createFieldAccessor(TreeMaker, JavacNode, FieldAccess)
[ "Returns", "the", "type", "of", "the", "field", "unless", "a", "getter", "exists", "for", "this", "field", "in", "which", "case", "the", "return", "type", "of", "the", "getter", "is", "returned", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L924-L936
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java
ViewHelper.setImageBitmap
public static void setImageBitmap(EfficientCacheView cacheView, int viewId, Bitmap bm) { View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof ImageView) { ((ImageView) view).setImageBitmap(bm); } }
java
public static void setImageBitmap(EfficientCacheView cacheView, int viewId, Bitmap bm) { View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof ImageView) { ((ImageView) view).setImageBitmap(bm); } }
[ "public", "static", "void", "setImageBitmap", "(", "EfficientCacheView", "cacheView", ",", "int", "viewId", ",", "Bitmap", "bm", ")", "{", "View", "view", "=", "cacheView", ".", "findViewByIdEfficient", "(", "viewId", ")", ";", "if", "(", "view", "instanceof",...
Equivalent to calling ImageView.setImageBitmap @param cacheView The cache of views to get the view from @param viewId The id of the view whose image should change @param bm The bitmap to set
[ "Equivalent", "to", "calling", "ImageView", ".", "setImageBitmap" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L231-L236
alkacon/opencms-core
src/org/opencms/jlan/CmsJlanDiskInterface.java
CmsJlanDiskInterface.getCms
protected CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { CmsJlanRepository repository = ((CmsJlanDeviceContext)connection.getContext()).getRepository(); CmsObjectWrapper result = repository.getCms(session, connection); return result; }
java
protected CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { CmsJlanRepository repository = ((CmsJlanDeviceContext)connection.getContext()).getRepository(); CmsObjectWrapper result = repository.getCms(session, connection); return result; }
[ "protected", "CmsObjectWrapper", "getCms", "(", "SrvSession", "session", ",", "TreeConnection", "connection", ")", "throws", "CmsException", "{", "CmsJlanRepository", "repository", "=", "(", "(", "CmsJlanDeviceContext", ")", "connection", ".", "getContext", "(", ")", ...
Creates a CmsObjectWrapper for the current session.<p> @param session the current session @param connection the tree connection @return the correctly configured CmsObjectWrapper for this session @throws CmsException if something goes wrong
[ "Creates", "a", "CmsObjectWrapper", "for", "the", "current", "session", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanDiskInterface.java#L430-L435
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.beginForceFailoverAllowDataLoss
public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); }
java
public InstanceFailoverGroupInner beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).toBlocking().single().body(); }
[ "public", "InstanceFailoverGroupInner", "beginForceFailoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "locationName", ",", "String", "failoverGroupName", ")", "{", "return", "beginForceFailoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName",...
Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the InstanceFailoverGroupInner object if successful.
[ "Fails", "over", "from", "the", "current", "primary", "managed", "instance", "to", "this", "managed", "instance", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L940-L942
gwtbootstrap3/gwtbootstrap3-extras
src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java
Animate.getStyleNameFromAnimation
private static String getStyleNameFromAnimation(final String animation, int count, int duration, int delay) { // fix input if (count < 0) count = -1; if (duration < 0) duration = -1; if (delay < 0) delay = -1; String styleName = ""; // for all valid animations if (animation != null && !animation.isEmpty() && animation.split(" ").length > 1) { styleName += animation.split(" ")[1]+"-"+count+"-"+duration+"-"+delay; // for all custom animations } else if (animation != null && !animation.isEmpty() && animation.split(" ").length == 1) { styleName += animation+"-"+count+"-"+duration+"-"+delay; } return styleName; }
java
private static String getStyleNameFromAnimation(final String animation, int count, int duration, int delay) { // fix input if (count < 0) count = -1; if (duration < 0) duration = -1; if (delay < 0) delay = -1; String styleName = ""; // for all valid animations if (animation != null && !animation.isEmpty() && animation.split(" ").length > 1) { styleName += animation.split(" ")[1]+"-"+count+"-"+duration+"-"+delay; // for all custom animations } else if (animation != null && !animation.isEmpty() && animation.split(" ").length == 1) { styleName += animation+"-"+count+"-"+duration+"-"+delay; } return styleName; }
[ "private", "static", "String", "getStyleNameFromAnimation", "(", "final", "String", "animation", ",", "int", "count", ",", "int", "duration", ",", "int", "delay", ")", "{", "// fix input", "if", "(", "count", "<", "0", ")", "count", "=", "-", "1", ";", "...
Helper method, which returns unique class name for combination of animation and it's settings. @param animation Animation CSS class name. @param count Number of animation repeats. @param duration Animation duration in ms. @param delay Delay before starting the animation loop in ms. @return String representation of class name like "animation-count-duration-delay".
[ "Helper", "method", "which", "returns", "unique", "class", "name", "for", "combination", "of", "animation", "and", "it", "s", "settings", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java#L359-L382
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java
VmlGraphicsContext.drawSymbolDefinition
public void drawSymbolDefinition(Object parent, String id, SymbolInfo symbol, ShapeStyle style, Matrix transformation) { if (isAttached()) { if (symbol == null) { return; } symbolDefs.put(id, new SymbolDefinition(symbol, style)); if (symbol.getImage() != null) { // When it's an image symbol, add an extra definition for it's selection: SymbolInfo selected = new SymbolInfo(); ImageInfo selectedImage = new ImageInfo(); selectedImage.setHref(symbol.getImage().getSelectionHref()); selectedImage.setWidth(symbol.getImage().getWidth()); selectedImage.setHeight(symbol.getImage().getHeight()); selected.setImage(selectedImage); symbolDefs.put(id + "-selection", new SymbolDefinition(selected, null)); } } }
java
public void drawSymbolDefinition(Object parent, String id, SymbolInfo symbol, ShapeStyle style, Matrix transformation) { if (isAttached()) { if (symbol == null) { return; } symbolDefs.put(id, new SymbolDefinition(symbol, style)); if (symbol.getImage() != null) { // When it's an image symbol, add an extra definition for it's selection: SymbolInfo selected = new SymbolInfo(); ImageInfo selectedImage = new ImageInfo(); selectedImage.setHref(symbol.getImage().getSelectionHref()); selectedImage.setWidth(symbol.getImage().getWidth()); selectedImage.setHeight(symbol.getImage().getHeight()); selected.setImage(selectedImage); symbolDefs.put(id + "-selection", new SymbolDefinition(selected, null)); } } }
[ "public", "void", "drawSymbolDefinition", "(", "Object", "parent", ",", "String", "id", ",", "SymbolInfo", "symbol", ",", "ShapeStyle", "style", ",", "Matrix", "transformation", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "if", "(", "symbol", "=...
Draw a type (shapetype for vml). @param parent the parent of the shapetype @param id the types's unique identifier @param symbol the symbol information @param style The default style to apply on the shape-type. Can be overridden when a shape uses this shape-type. @param transformation the transformation to apply on the symbol
[ "Draw", "a", "type", "(", "shapetype", "for", "vml", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L358-L376
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonParser.java
BsonParser.regexStrToFlags
@SuppressWarnings("deprecation") protected int regexStrToFlags(String pattern) throws JsonParseException { int flags = 0; for (int i = 0; i < pattern.length(); ++i) { char c = pattern.charAt(i); switch (c) { case 'i': flags |= Pattern.CASE_INSENSITIVE; break; case 'm': flags |= Pattern.MULTILINE; break; case 's': flags |= Pattern.DOTALL; break; case 'u': flags |= Pattern.UNICODE_CASE; break; case 'l': case 'x': //unsupported break; default: throw new JsonParseException("Invalid regex", getTokenLocation()); } } return flags; }
java
@SuppressWarnings("deprecation") protected int regexStrToFlags(String pattern) throws JsonParseException { int flags = 0; for (int i = 0; i < pattern.length(); ++i) { char c = pattern.charAt(i); switch (c) { case 'i': flags |= Pattern.CASE_INSENSITIVE; break; case 'm': flags |= Pattern.MULTILINE; break; case 's': flags |= Pattern.DOTALL; break; case 'u': flags |= Pattern.UNICODE_CASE; break; case 'l': case 'x': //unsupported break; default: throw new JsonParseException("Invalid regex", getTokenLocation()); } } return flags; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "protected", "int", "regexStrToFlags", "(", "String", "pattern", ")", "throws", "JsonParseException", "{", "int", "flags", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pattern", ".",...
Converts a BSON regex pattern string to a combined value of Java flags that can be used in {@link Pattern#compile(String, int)} @param pattern the regex pattern string @return the Java flags @throws JsonParseException if the pattern string contains a unsupported flag
[ "Converts", "a", "BSON", "regex", "pattern", "string", "to", "a", "combined", "value", "of", "Java", "flags", "that", "can", "be", "used", "in", "{" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonParser.java#L480-L512
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java
ExpressRouteCrossConnectionPeeringsInner.beginDelete
public void beginDelete(String resourceGroupName, String crossConnectionName, String peeringName) { beginDeleteWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String crossConnectionName, String peeringName) { beginDeleteWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "crossConnectionName", ",", "peeringName", ")", ".", ...
Deletes the specified peering from the ExpressRouteCrossConnection. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "peering", "from", "the", "ExpressRouteCrossConnection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java#L298-L300
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_network_private_networkId_GET
public OvhNetwork project_serviceName_network_private_networkId_GET(String serviceName, String networkId) throws IOException { String qPath = "/cloud/project/{serviceName}/network/private/{networkId}"; StringBuilder sb = path(qPath, serviceName, networkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetwork.class); }
java
public OvhNetwork project_serviceName_network_private_networkId_GET(String serviceName, String networkId) throws IOException { String qPath = "/cloud/project/{serviceName}/network/private/{networkId}"; StringBuilder sb = path(qPath, serviceName, networkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetwork.class); }
[ "public", "OvhNetwork", "project_serviceName_network_private_networkId_GET", "(", "String", "serviceName", ",", "String", "networkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/network/private/{networkId}\"", ";", "StringBuilder", ...
Get private network REST: GET /cloud/project/{serviceName}/network/private/{networkId} @param networkId [required] Network id @param serviceName [required] Service name
[ "Get", "private", "network" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L781-L786
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.putFloat
public static int putFloat(byte [] bytes, int offset, float f) { return putInt(bytes, offset, Float.floatToRawIntBits(f)); }
java
public static int putFloat(byte [] bytes, int offset, float f) { return putInt(bytes, offset, Float.floatToRawIntBits(f)); }
[ "public", "static", "int", "putFloat", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "float", "f", ")", "{", "return", "putInt", "(", "bytes", ",", "offset", ",", "Float", ".", "floatToRawIntBits", "(", "f", ")", ")", ";", "}" ]
Put a float value out to the specified byte array position. @param bytes byte array @param offset offset to write to @param f float value @return New offset in <code>bytes</code>
[ "Put", "a", "float", "value", "out", "to", "the", "specified", "byte", "array", "position", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L469-L471
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java
CassandraDataHandlerBase.getThriftRow
private ThriftRow getThriftRow(Object id, String columnFamily, Map<String, ThriftRow> thriftRows) { ThriftRow tr = thriftRows.get(columnFamily); if (tr == null) { tr = new ThriftRow(); tr.setColumnFamilyName(columnFamily); // column-family name tr.setId(id); // Id thriftRows.put(columnFamily, tr); } return tr; }
java
private ThriftRow getThriftRow(Object id, String columnFamily, Map<String, ThriftRow> thriftRows) { ThriftRow tr = thriftRows.get(columnFamily); if (tr == null) { tr = new ThriftRow(); tr.setColumnFamilyName(columnFamily); // column-family name tr.setId(id); // Id thriftRows.put(columnFamily, tr); } return tr; }
[ "private", "ThriftRow", "getThriftRow", "(", "Object", "id", ",", "String", "columnFamily", ",", "Map", "<", "String", ",", "ThriftRow", ">", "thriftRows", ")", "{", "ThriftRow", "tr", "=", "thriftRows", ".", "get", "(", "columnFamily", ")", ";", "if", "("...
Gets the thrift row. @param id the id @param columnFamily the column family @param thriftRows the thrift rows @return the thrift row
[ "Gets", "the", "thrift", "row", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L436-L447
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.blockingUnaryCall
public static <ReqT, RespT> RespT blockingUnaryCall( Channel channel, MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, ReqT req) { ThreadlessExecutor executor = new ThreadlessExecutor(); ClientCall<ReqT, RespT> call = channel.newCall(method, callOptions.withExecutor(executor)); try { ListenableFuture<RespT> responseFuture = futureUnaryCall(call, req); while (!responseFuture.isDone()) { try { executor.waitAndDrain(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw Status.CANCELLED .withDescription("Call was interrupted") .withCause(e) .asRuntimeException(); } } return getUnchecked(responseFuture); } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { throw cancelThrow(call, e); } }
java
public static <ReqT, RespT> RespT blockingUnaryCall( Channel channel, MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, ReqT req) { ThreadlessExecutor executor = new ThreadlessExecutor(); ClientCall<ReqT, RespT> call = channel.newCall(method, callOptions.withExecutor(executor)); try { ListenableFuture<RespT> responseFuture = futureUnaryCall(call, req); while (!responseFuture.isDone()) { try { executor.waitAndDrain(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw Status.CANCELLED .withDescription("Call was interrupted") .withCause(e) .asRuntimeException(); } } return getUnchecked(responseFuture); } catch (RuntimeException e) { throw cancelThrow(call, e); } catch (Error e) { throw cancelThrow(call, e); } }
[ "public", "static", "<", "ReqT", ",", "RespT", ">", "RespT", "blockingUnaryCall", "(", "Channel", "channel", ",", "MethodDescriptor", "<", "ReqT", ",", "RespT", ">", "method", ",", "CallOptions", "callOptions", ",", "ReqT", "req", ")", "{", "ThreadlessExecutor...
Executes a unary call and blocks on the response. The {@code call} should not be already started. After calling this method, {@code call} should no longer be used. @return the single response message.
[ "Executes", "a", "unary", "call", "and", "blocks", "on", "the", "response", ".", "The", "{", "@code", "call", "}", "should", "not", "be", "already", "started", ".", "After", "calling", "this", "method", "{", "@code", "call", "}", "should", "no", "longer"...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L123-L146
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java
NFSubstitution.doSubstitution
public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) { // perform a transformation on the number that is dependent // on the type of substitution this is, then just call its // rule set's format() method to format the result long numberToFormat = transformNumber(number); if (ruleSet != null) { ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount); } else { toInsertInto.insert(position + pos, numberFormat.format(numberToFormat)); } }
java
public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) { // perform a transformation on the number that is dependent // on the type of substitution this is, then just call its // rule set's format() method to format the result long numberToFormat = transformNumber(number); if (ruleSet != null) { ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount); } else { toInsertInto.insert(position + pos, numberFormat.format(numberToFormat)); } }
[ "public", "void", "doSubstitution", "(", "long", "number", ",", "StringBuilder", "toInsertInto", ",", "int", "position", ",", "int", "recursionCount", ")", "{", "// perform a transformation on the number that is dependent", "// on the type of substitution this is, then just call ...
Performs a mathematical operation on the number, formats it using either ruleSet or decimalFormat, and inserts the result into toInsertInto. @param number The number being formatted. @param toInsertInto The string we insert the result into @param position The position in toInsertInto where the owning rule's rule text begins (this value is added to this substitution's position to determine exactly where to insert the new text)
[ "Performs", "a", "mathematical", "operation", "on", "the", "number", "formats", "it", "using", "either", "ruleSet", "or", "decimalFormat", "and", "inserts", "the", "result", "into", "toInsertInto", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java#L293-L304
jparsec/jparsec
jparsec/src/main/java/org/jparsec/pattern/Patterns.java
Patterns.some
@Deprecated public static Pattern some(int min, int max, CharPredicate predicate) { return times(min, max, predicate); }
java
@Deprecated public static Pattern some(int min, int max, CharPredicate predicate) { return times(min, max, predicate); }
[ "@", "Deprecated", "public", "static", "Pattern", "some", "(", "int", "min", ",", "int", "max", ",", "CharPredicate", "predicate", ")", "{", "return", "times", "(", "min", ",", "max", ",", "predicate", ")", ";", "}" ]
Returns a {@link Pattern} that matches at least {@code min} and up to {@code max} number of characters satisfying {@code predicate}, @deprecated Use {@link #times(int, int, CharPredicate)} instead.
[ "Returns", "a", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L400-L403
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java
VisualizeImageData.colorizeSign
public static void colorizeSign( GrayF32 input , float maxAbsValue , Bitmap output , byte[] storage ) { shapeShape(input, output); if( storage == null ) storage = declareStorage(output,null); if( maxAbsValue < 0 ) maxAbsValue = ImageStatistics.maxAbs(input); int indexDst = 0; for( int y = 0; y < input.height; y++ ) { int indexSrc = input.startIndex + y*input.stride; for( int x = 0; x < input.width; x++ ) { float value = input.data[ indexSrc++ ]; if( value > 0 ) { storage[indexDst++] = (byte) (255f*value/maxAbsValue); storage[indexDst++] = 0; storage[indexDst++] = 0; } else { storage[indexDst++] = 0; storage[indexDst++] = (byte) (-255f*value/maxAbsValue); storage[indexDst++] = 0; } storage[indexDst++] = (byte) 0xFF; } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
java
public static void colorizeSign( GrayF32 input , float maxAbsValue , Bitmap output , byte[] storage ) { shapeShape(input, output); if( storage == null ) storage = declareStorage(output,null); if( maxAbsValue < 0 ) maxAbsValue = ImageStatistics.maxAbs(input); int indexDst = 0; for( int y = 0; y < input.height; y++ ) { int indexSrc = input.startIndex + y*input.stride; for( int x = 0; x < input.width; x++ ) { float value = input.data[ indexSrc++ ]; if( value > 0 ) { storage[indexDst++] = (byte) (255f*value/maxAbsValue); storage[indexDst++] = 0; storage[indexDst++] = 0; } else { storage[indexDst++] = 0; storage[indexDst++] = (byte) (-255f*value/maxAbsValue); storage[indexDst++] = 0; } storage[indexDst++] = (byte) 0xFF; } } output.copyPixelsFromBuffer(ByteBuffer.wrap(storage)); }
[ "public", "static", "void", "colorizeSign", "(", "GrayF32", "input", ",", "float", "maxAbsValue", ",", "Bitmap", "output", ",", "byte", "[", "]", "storage", ")", "{", "shapeShape", "(", "input", ",", "output", ")", ";", "if", "(", "storage", "==", "null"...
Renders positive and negative values as two different colors. @param input (Input) Image with positive and negative values. @param maxAbsValue The largest absolute value of any pixel in the image. Set to < 0 if not known. @param output (Output) Bitmap ARGB_8888 image. @param storage Optional working buffer for Bitmap image.
[ "Renders", "positive", "and", "negative", "values", "as", "two", "different", "colors", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/VisualizeImageData.java#L137-L166
jenkinsci/jenkins
core/src/main/java/hudson/model/User.java
User.getOrCreateByIdOrFullName
public static @Nonnull User getOrCreateByIdOrFullName(@Nonnull String idOrFullName) { return get(idOrFullName, true, Collections.emptyMap()); }
java
public static @Nonnull User getOrCreateByIdOrFullName(@Nonnull String idOrFullName) { return get(idOrFullName, true, Collections.emptyMap()); }
[ "public", "static", "@", "Nonnull", "User", "getOrCreateByIdOrFullName", "(", "@", "Nonnull", "String", "idOrFullName", ")", "{", "return", "get", "(", "idOrFullName", ",", "true", ",", "Collections", ".", "emptyMap", "(", ")", ")", ";", "}" ]
Get the user by ID or Full Name. <p> If the user does not exist, creates a new one on-demand. <p> Use {@link #getById} when you know you have an ID. In this method Jenkins will try to resolve the {@link User} by full name with help of various {@link hudson.tasks.UserNameResolver}. This is slow (see JENKINS-23281). @param idOrFullName User ID or full name @return User instance. It will be created on-demand. @since 2.91
[ "Get", "the", "user", "by", "ID", "or", "Full", "Name", ".", "<p", ">", "If", "the", "user", "does", "not", "exist", "creates", "a", "new", "one", "on", "-", "demand", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L569-L571
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.ints
public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); if (randomNumberOrigin >= randomNumberBound) throw new IllegalArgumentException(BAD_RANGE); return StreamSupport.intStream (new RandomIntsSpliterator (0L, streamSize, randomNumberOrigin, randomNumberBound), false); }
java
public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); if (randomNumberOrigin >= randomNumberBound) throw new IllegalArgumentException(BAD_RANGE); return StreamSupport.intStream (new RandomIntsSpliterator (0L, streamSize, randomNumberOrigin, randomNumberBound), false); }
[ "public", "IntStream", "ints", "(", "long", "streamSize", ",", "int", "randomNumberOrigin", ",", "int", "randomNumberBound", ")", "{", "if", "(", "streamSize", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "BAD_SIZE", ")", ";", "if", "(", ...
Returns a stream producing the given {@code streamSize} number of pseudorandom {@code int} values, each conforming to the given origin (inclusive) and bound (exclusive). @param streamSize the number of values to generate @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) of each random value @return a stream of pseudorandom {@code int} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code streamSize} is less than zero, or {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound} @since 1.8
[ "Returns", "a", "stream", "producing", "the", "given", "{", "@code", "streamSize", "}", "number", "of", "pseudorandom", "{", "@code", "int", "}", "values", "each", "conforming", "to", "the", "given", "origin", "(", "inclusive", ")", "and", "bound", "(", "e...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L515-L525
domaframework/doma-gen
src/main/java/org/seasar/doma/extension/gen/Generator.java
Generator.createTemplateLoader
protected TemplateLoader createTemplateLoader(File templateFilePrimaryDir) { TemplateLoader primary = null; if (templateFilePrimaryDir != null) { try { primary = new FileTemplateLoader(templateFilePrimaryDir); } catch (IOException e) { throw new GenException(Message.DOMAGEN9001, e, e); } } TemplateLoader secondary = new ResourceTemplateLoader(DEFAULT_TEMPLATE_DIR_NAME); if (primary == null) { return secondary; } return new MultiTemplateLoader(new TemplateLoader[] {primary, secondary}); }
java
protected TemplateLoader createTemplateLoader(File templateFilePrimaryDir) { TemplateLoader primary = null; if (templateFilePrimaryDir != null) { try { primary = new FileTemplateLoader(templateFilePrimaryDir); } catch (IOException e) { throw new GenException(Message.DOMAGEN9001, e, e); } } TemplateLoader secondary = new ResourceTemplateLoader(DEFAULT_TEMPLATE_DIR_NAME); if (primary == null) { return secondary; } return new MultiTemplateLoader(new TemplateLoader[] {primary, secondary}); }
[ "protected", "TemplateLoader", "createTemplateLoader", "(", "File", "templateFilePrimaryDir", ")", "{", "TemplateLoader", "primary", "=", "null", ";", "if", "(", "templateFilePrimaryDir", "!=", "null", ")", "{", "try", "{", "primary", "=", "new", "FileTemplateLoader...
{@link TemplateLoader}を作成します。 @param templateFilePrimaryDir テンプレートファイルを格納したプライマリディレクトリ、プライマリディレクトリを使用しない場合{@code null} @return {@link TemplateLoader}
[ "{", "@link", "TemplateLoader", "}", "を作成します。" ]
train
https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/Generator.java#L70-L84
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/Deferrers.java
Deferrers.processDeferredActions
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void processDeferredActions() { final int stackDepth = ThreadUtils.stackDepth(); final List<Deferred> list = REGISTRY.get(); final Iterator<Deferred> iterator = list.iterator(); while (iterator.hasNext()) { final Deferred deferred = iterator.next(); if (deferred.getStackDepth() >= stackDepth) { try { deferred.executeDeferred(); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during deferred action processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (list.isEmpty()) { REGISTRY.remove(); } }
java
@Weight(value = Weight.Unit.VARIABLE, comment = "Depends on the current call stack depth") public static void processDeferredActions() { final int stackDepth = ThreadUtils.stackDepth(); final List<Deferred> list = REGISTRY.get(); final Iterator<Deferred> iterator = list.iterator(); while (iterator.hasNext()) { final Deferred deferred = iterator.next(); if (deferred.getStackDepth() >= stackDepth) { try { deferred.executeDeferred(); } catch (Exception ex) { final UnexpectedProcessingError error = new UnexpectedProcessingError("Error during deferred action processing", ex); MetaErrorListeners.fireError(error.getMessage(), error); } finally { iterator.remove(); } } } if (list.isEmpty()) { REGISTRY.remove(); } }
[ "@", "Weight", "(", "value", "=", "Weight", ".", "Unit", ".", "VARIABLE", ",", "comment", "=", "\"Depends on the current call stack depth\"", ")", "public", "static", "void", "processDeferredActions", "(", ")", "{", "final", "int", "stackDepth", "=", "ThreadUtils"...
Process all defer actions for the current stack depth level. @since 1.0
[ "Process", "all", "defer", "actions", "for", "the", "current", "stack", "depth", "level", "." ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/Deferrers.java#L214-L237
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/ReadStreamOld.java
ReadStreamOld.writeToStream
public void writeToStream(OutputStream os, int len) throws IOException { while (len > 0) { if (_readLength <= _readOffset) { if (! readBuffer()) return; } int sublen = Math.min(len, _readLength - _readOffset); os.write(_readBuffer, _readOffset, sublen); _readOffset += sublen; len -= sublen; } }
java
public void writeToStream(OutputStream os, int len) throws IOException { while (len > 0) { if (_readLength <= _readOffset) { if (! readBuffer()) return; } int sublen = Math.min(len, _readLength - _readOffset); os.write(_readBuffer, _readOffset, sublen); _readOffset += sublen; len -= sublen; } }
[ "public", "void", "writeToStream", "(", "OutputStream", "os", ",", "int", "len", ")", "throws", "IOException", "{", "while", "(", "len", ">", "0", ")", "{", "if", "(", "_readLength", "<=", "_readOffset", ")", "{", "if", "(", "!", "readBuffer", "(", ")"...
Writes <code>len<code> bytes to the output stream from this stream. @param os destination stream. @param len bytes to write.
[ "Writes", "<code", ">", "len<code", ">", "bytes", "to", "the", "output", "stream", "from", "this", "stream", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/ReadStreamOld.java#L1072-L1087
atomix/atomix
utils/src/main/java/io/atomix/utils/logging/ContextualLoggerFactory.java
ContextualLoggerFactory.getLogger
public static ContextualLogger getLogger(String name, LoggerContext context) { return new ContextualLogger(LoggerFactory.getLogger(name), context); }
java
public static ContextualLogger getLogger(String name, LoggerContext context) { return new ContextualLogger(LoggerFactory.getLogger(name), context); }
[ "public", "static", "ContextualLogger", "getLogger", "(", "String", "name", ",", "LoggerContext", "context", ")", "{", "return", "new", "ContextualLogger", "(", "LoggerFactory", ".", "getLogger", "(", "name", ")", ",", "context", ")", ";", "}" ]
Returns a contextual logger. @param name the contextual logger name @param context the logger context @return the logger
[ "Returns", "a", "contextual", "logger", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/logging/ContextualLoggerFactory.java#L32-L34
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readUser
public CmsUser readUser(CmsRequestContext context, String username, String password) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), password); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_NAME_1, username), e); } finally { dbc.clear(); } return result; }
java
public CmsUser readUser(CmsRequestContext context, String username, String password) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUser result = null; try { result = m_driverManager.readUser(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), password); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_USER_FOR_NAME_1, username), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsUser", "readUser", "(", "CmsRequestContext", "context", ",", "String", "username", ",", "String", "password", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsUse...
Returns a user object if the password for the user is correct.<p> If the user/password pair is not valid a <code>{@link CmsException}</code> is thrown.<p> @param context the current request context @param username the user name of the user that is to be read @param password the password of the user that is to be read @return user read @throws CmsException if operation was not successful
[ "Returns", "a", "user", "object", "if", "the", "password", "for", "the", "user", "is", "correct", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5523-L5535
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.deposit_depositId_payment_GET
public OvhPayment deposit_depositId_payment_GET(String depositId) throws IOException { String qPath = "/me/deposit/{depositId}/payment"; StringBuilder sb = path(qPath, depositId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPayment.class); }
java
public OvhPayment deposit_depositId_payment_GET(String depositId) throws IOException { String qPath = "/me/deposit/{depositId}/payment"; StringBuilder sb = path(qPath, depositId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPayment.class); }
[ "public", "OvhPayment", "deposit_depositId_payment_GET", "(", "String", "depositId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/deposit/{depositId}/payment\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "depositId", ")", ";", ...
Get this object properties REST: GET /me/deposit/{depositId}/payment @param depositId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3304-L3309
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.string2Writer
public static void string2Writer(String source, Writer out) throws IOException { char[] buffer = source.toCharArray(); for (int i = 0; i < buffer.length; i++) { out.append(buffer[i]); } out.flush(); }
java
public static void string2Writer(String source, Writer out) throws IOException { char[] buffer = source.toCharArray(); for (int i = 0; i < buffer.length; i++) { out.append(buffer[i]); } out.flush(); }
[ "public", "static", "void", "string2Writer", "(", "String", "source", ",", "Writer", "out", ")", "throws", "IOException", "{", "char", "[", "]", "buffer", "=", "source", ".", "toCharArray", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "...
String 2 writer. @param source the source @param out the out @throws IOException Signals that an I/O exception has occurred.
[ "String", "2", "writer", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L211-L218
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/TrafficUtils.java
TrafficUtils.current
public static long current(Context context, String tag) { Long appRxValue = sReceivedBytes.get(tag); Long appTxValue = sSendBytes.get(tag); if (appRxValue == null || appTxValue == null) { if (DEBUG) { LogUtils.w(TAG, "current() appRxValue or appTxValue is null."); } return 0; } final int uid = getUid(context); long appRxValue2 = TrafficStats.getUidRxBytes(uid); long appTxValue2 = TrafficStats.getUidTxBytes(uid); long rxValue = appRxValue2 - appRxValue; long txValue = appTxValue2 - appTxValue; if (DEBUG) { LogUtils.v(TAG, "current() rxValue=" + rxValue / 1000 + " txValue=" + txValue / 1000 + " uid=" + uid); } return rxValue; }
java
public static long current(Context context, String tag) { Long appRxValue = sReceivedBytes.get(tag); Long appTxValue = sSendBytes.get(tag); if (appRxValue == null || appTxValue == null) { if (DEBUG) { LogUtils.w(TAG, "current() appRxValue or appTxValue is null."); } return 0; } final int uid = getUid(context); long appRxValue2 = TrafficStats.getUidRxBytes(uid); long appTxValue2 = TrafficStats.getUidTxBytes(uid); long rxValue = appRxValue2 - appRxValue; long txValue = appTxValue2 - appTxValue; if (DEBUG) { LogUtils.v(TAG, "current() rxValue=" + rxValue / 1000 + " txValue=" + txValue / 1000 + " uid=" + uid); } return rxValue; }
[ "public", "static", "long", "current", "(", "Context", "context", ",", "String", "tag", ")", "{", "Long", "appRxValue", "=", "sReceivedBytes", ".", "get", "(", "tag", ")", ";", "Long", "appTxValue", "=", "sSendBytes", ".", "get", "(", "tag", ")", ";", ...
计算当前流量 @param context Context @param tag traffic tag @return received bytes
[ "计算当前流量" ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/TrafficUtils.java#L59-L78
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Mailer.java
Mailer.logSession
private void logSession(Session session, TransportStrategy transportStrategy) { final String logmsg = "starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)"; Properties properties = session.getProperties(); logger.debug(String.format(logmsg, properties.get(transportStrategy.propertyNameHost()), properties.get(transportStrategy.propertyNamePort()), properties.get(transportStrategy.propertyNameUsername()), properties.get(transportStrategy.propertyNameAuthenticate()), transportStrategy)); }
java
private void logSession(Session session, TransportStrategy transportStrategy) { final String logmsg = "starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)"; Properties properties = session.getProperties(); logger.debug(String.format(logmsg, properties.get(transportStrategy.propertyNameHost()), properties.get(transportStrategy.propertyNamePort()), properties.get(transportStrategy.propertyNameUsername()), properties.get(transportStrategy.propertyNameAuthenticate()), transportStrategy)); }
[ "private", "void", "logSession", "(", "Session", "session", ",", "TransportStrategy", "transportStrategy", ")", "{", "final", "String", "logmsg", "=", "\"starting mail session (host: %s, port: %s, username: %s, authenticate: %s, transport: %s)\"", ";", "Properties", "properties",...
Simply logs host details, credentials used and whether authentication will take place and finally the transport protocol used.
[ "Simply", "logs", "host", "details", "credentials", "used", "and", "whether", "authentication", "will", "take", "place", "and", "finally", "the", "transport", "protocol", "used", "." ]
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Mailer.java#L240-L246
stephanrauh/AngularFaces
AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/AttributeUtilities.java
AttributeUtilities.getAttribute
public static Object getAttribute(UIComponent component, String attributeName) { Object value = component.getPassThroughAttributes().get(attributeName); if (null == value) { value = component.getAttributes().get(attributeName); } if (null == value) { if (!attributeName.equals(attributeName.toLowerCase())) { return getAttribute(component, attributeName.toLowerCase()); } } if (value instanceof ValueExpression) { value = ((ValueExpression) value).getValue(FacesContext.getCurrentInstance().getELContext()); } return value; }
java
public static Object getAttribute(UIComponent component, String attributeName) { Object value = component.getPassThroughAttributes().get(attributeName); if (null == value) { value = component.getAttributes().get(attributeName); } if (null == value) { if (!attributeName.equals(attributeName.toLowerCase())) { return getAttribute(component, attributeName.toLowerCase()); } } if (value instanceof ValueExpression) { value = ((ValueExpression) value).getValue(FacesContext.getCurrentInstance().getELContext()); } return value; }
[ "public", "static", "Object", "getAttribute", "(", "UIComponent", "component", ",", "String", "attributeName", ")", "{", "Object", "value", "=", "component", ".", "getPassThroughAttributes", "(", ")", ".", "get", "(", "attributeName", ")", ";", "if", "(", "nul...
Apache MyFaces make HMTL attributes of HTML elements pass-through-attributes. This method finds the attribute, no matter whether it is stored as an ordinary or as an pass-through-attribute.
[ "Apache", "MyFaces", "make", "HMTL", "attributes", "of", "HTML", "elements", "pass", "-", "through", "-", "attributes", ".", "This", "method", "finds", "the", "attribute", "no", "matter", "whether", "it", "is", "stored", "as", "an", "ordinary", "or", "as", ...
train
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/core/transformation/AttributeUtilities.java#L37-L51
a-schild/jave2
jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java
DefaultFFMPEGLocator.copyFile
private void copyFile(String path, File dest) { String resourceName= "native/" + path; try { LOG.debug("Copy from resource <"+resourceName+"> to target <"+dest.getAbsolutePath()+">"); if (copy(getClass().getResourceAsStream(resourceName), dest.getAbsolutePath())) { if (dest.exists()) { LOG.debug("Target <"+dest.getAbsolutePath()+"> exists"); } else { LOG.fatal("Target <"+dest.getAbsolutePath()+"> does not exist"); } } else { LOG.fatal("Copy resource to target <"+dest.getAbsolutePath()+"> failed"); } } catch (NullPointerException ex) { LOG.error("Could not find ffmpeg executable for "+resourceName+" is the correct platform jar included?"); throw ex; } }
java
private void copyFile(String path, File dest) { String resourceName= "native/" + path; try { LOG.debug("Copy from resource <"+resourceName+"> to target <"+dest.getAbsolutePath()+">"); if (copy(getClass().getResourceAsStream(resourceName), dest.getAbsolutePath())) { if (dest.exists()) { LOG.debug("Target <"+dest.getAbsolutePath()+"> exists"); } else { LOG.fatal("Target <"+dest.getAbsolutePath()+"> does not exist"); } } else { LOG.fatal("Copy resource to target <"+dest.getAbsolutePath()+"> failed"); } } catch (NullPointerException ex) { LOG.error("Could not find ffmpeg executable for "+resourceName+" is the correct platform jar included?"); throw ex; } }
[ "private", "void", "copyFile", "(", "String", "path", ",", "File", "dest", ")", "{", "String", "resourceName", "=", "\"native/\"", "+", "path", ";", "try", "{", "LOG", ".", "debug", "(", "\"Copy from resource <\"", "+", "resourceName", "+", "\"> to target <\""...
Copies a file bundled in the package to the supplied destination. @param path The name of the bundled file. @param dest The destination. @throws RuntimeException If an unexpected error occurs.
[ "Copies", "a", "file", "bundled", "in", "the", "package", "to", "the", "supplied", "destination", "." ]
train
https://github.com/a-schild/jave2/blob/1e7d6a1ca7c27cc63570f1aabb5c84ee124f3e26/jave-core/src/main/java/ws/schild/jave/DefaultFFMPEGLocator.java#L127-L153
xwiki/xwiki-rendering
xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java
WikiPageUtil.isValidXmlName
public static boolean isValidXmlName(String tagName, boolean colonEnabled) { boolean valid = false; int len = tagName != null ? tagName.length() : 0; for (int i = 0; i < len; i++) { char ch = tagName.charAt(i); if (i == 0) { valid = isValidXmlNameStartChar(ch, colonEnabled); } else { valid = isValidXmlNameChar(ch, colonEnabled); } if (!valid) { break; } } return valid; }
java
public static boolean isValidXmlName(String tagName, boolean colonEnabled) { boolean valid = false; int len = tagName != null ? tagName.length() : 0; for (int i = 0; i < len; i++) { char ch = tagName.charAt(i); if (i == 0) { valid = isValidXmlNameStartChar(ch, colonEnabled); } else { valid = isValidXmlNameChar(ch, colonEnabled); } if (!valid) { break; } } return valid; }
[ "public", "static", "boolean", "isValidXmlName", "(", "String", "tagName", ",", "boolean", "colonEnabled", ")", "{", "boolean", "valid", "=", "false", ";", "int", "len", "=", "tagName", "!=", "null", "?", "tagName", ".", "length", "(", ")", ":", "0", ";"...
This method checks the given string and returns <code>true</code> if it is a valid XML name <p> See http://www.w3.org/TR/xml/#NT-Name. </p> @param tagName the name to check @param colonEnabled if this flag is <code>true</code> then this method accepts the ':' symbol in the name @return <code>true</code> if the given string is a valid XML name
[ "This", "method", "checks", "the", "given", "string", "and", "returns", "<code", ">", "true<", "/", "code", ">", "if", "it", "is", "a", "valid", "XML", "name", "<p", ">", "See", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "xm...
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java#L236-L252
zaproxy/zaproxy
src/org/zaproxy/zap/extension/pscan/ExtensionPassiveScan.java
ExtensionPassiveScan.setPluginPassiveScannerAlertThreshold
void setPluginPassiveScannerAlertThreshold(int pluginId, Plugin.AlertThreshold alertThreshold) { PluginPassiveScanner scanner = getPluginPassiveScanner(pluginId); if (scanner != null) { scanner.setAlertThreshold(alertThreshold); scanner.setEnabled(!Plugin.AlertThreshold.OFF.equals(alertThreshold)); scanner.save(); } }
java
void setPluginPassiveScannerAlertThreshold(int pluginId, Plugin.AlertThreshold alertThreshold) { PluginPassiveScanner scanner = getPluginPassiveScanner(pluginId); if (scanner != null) { scanner.setAlertThreshold(alertThreshold); scanner.setEnabled(!Plugin.AlertThreshold.OFF.equals(alertThreshold)); scanner.save(); } }
[ "void", "setPluginPassiveScannerAlertThreshold", "(", "int", "pluginId", ",", "Plugin", ".", "AlertThreshold", "alertThreshold", ")", "{", "PluginPassiveScanner", "scanner", "=", "getPluginPassiveScanner", "(", "pluginId", ")", ";", "if", "(", "scanner", "!=", "null",...
Sets the value of {@code alertThreshold} of the plug-in passive scanner with the given {@code pluginId}. <p> If the {@code alertThreshold} is {@code OFF} the scanner is also disabled. The call to this method has no effect if no scanner with the given {@code pluginId} exist. @param pluginId the ID of the plug-in passive scanner @param alertThreshold the alert threshold that will be set @see org.parosproxy.paros.core.scanner.Plugin.AlertThreshold
[ "Sets", "the", "value", "of", "{", "@code", "alertThreshold", "}", "of", "the", "plug", "-", "in", "passive", "scanner", "with", "the", "given", "{", "@code", "pluginId", "}", ".", "<p", ">", "If", "the", "{", "@code", "alertThreshold", "}", "is", "{",...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/pscan/ExtensionPassiveScan.java#L386-L393
kyoken74/gwt-angular
gwt-angular-user/src/main/java/com/asayama/gwt/angular/user/client/ui/directive/GwtWidget.java
GwtWidget.link
@Override public void link(NGScope scope, JQElement element, JSON attrs) { IsWidget widget = scope.get(getName()); String id = "gwt-widget-" + counter++; element.attr("id", id); RootPanel.get(id).add(widget); }
java
@Override public void link(NGScope scope, JQElement element, JSON attrs) { IsWidget widget = scope.get(getName()); String id = "gwt-widget-" + counter++; element.attr("id", id); RootPanel.get(id).add(widget); }
[ "@", "Override", "public", "void", "link", "(", "NGScope", "scope", ",", "JQElement", "element", ",", "JSON", "attrs", ")", "{", "IsWidget", "widget", "=", "scope", ".", "get", "(", "getName", "(", ")", ")", ";", "String", "id", "=", "\"gwt-widget-\"", ...
Replaces the element body with the GWT widget passed via gwt-widget attribute. GWT widget must implement IsWidget interface.
[ "Replaces", "the", "element", "body", "with", "the", "GWT", "widget", "passed", "via", "gwt", "-", "widget", "attribute", ".", "GWT", "widget", "must", "implement", "IsWidget", "interface", "." ]
train
https://github.com/kyoken74/gwt-angular/blob/99a6efa277dd4771d9cba976b25fdf0ac4fdeca2/gwt-angular-user/src/main/java/com/asayama/gwt/angular/user/client/ui/directive/GwtWidget.java#L36-L42
roboconf/roboconf-platform
core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java
RabbitMqUtils.configureFactory
public static void configureFactory( ConnectionFactory factory, Map<String,String> configuration ) throws IOException { final Logger logger = Logger.getLogger( RabbitMqUtils.class.getName()); logger.fine( "Configuring a connection factory for RabbitMQ." ); String messageServerIp = configuration.get( RABBITMQ_SERVER_IP ); if( messageServerIp != null ) { Map.Entry<String,Integer> entry = Utils.findUrlAndPort( messageServerIp ); factory.setHost( entry.getKey()); if( entry.getValue() > 0 ) factory.setPort( entry.getValue()); } factory.setUsername( configuration.get( RABBITMQ_SERVER_USERNAME )); factory.setPassword( configuration.get( RABBITMQ_SERVER_PASSWORD )); // Timeout for connection establishment: 5s factory.setConnectionTimeout( 5000 ); // Configure automatic reconnection factory.setAutomaticRecoveryEnabled( true ); // Recovery interval: 10s factory.setNetworkRecoveryInterval( 10000 ); // Exchanges and so on should be redeclared if necessary factory.setTopologyRecoveryEnabled( true ); // SSL if( Boolean.parseBoolean( configuration.get( RABBITMQ_USE_SSL ))) { logger.fine( "Connection factory for RabbitMQ: SSL is used." ); InputStream clientIS = null; InputStream storeIS = null; try { clientIS = new FileInputStream( configuration.get( RABBITMQ_SSL_KEY_STORE_PATH )); storeIS = new FileInputStream( configuration.get( RABBITMQ_SSL_TRUST_STORE_PATH )); char[] keyStorePassphrase = configuration.get( RABBITMQ_SSL_KEY_STORE_PASSPHRASE ).toCharArray(); KeyStore ks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_KEY_STORE_TYPE, DEFAULT_SSL_KEY_STORE_TYPE )); ks.load( clientIS, keyStorePassphrase ); String value = getValue( configuration, RABBITMQ_SSL_KEY_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( value ); kmf.init( ks, keyStorePassphrase ); char[] trustStorePassphrase = configuration.get( RABBITMQ_SSL_TRUST_STORE_PASSPHRASE ).toCharArray(); KeyStore tks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_TRUST_STORE_TYPE, DEFAULT_SSL_TRUST_STORE_TYPE )); tks.load( storeIS, trustStorePassphrase ); value = getValue( configuration, RABBITMQ_SSL_TRUST_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( value ); tmf.init( tks ); SSLContext c = SSLContext.getInstance( getValue( configuration, RABBITMQ_SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL )); c.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); factory.useSslProtocol( c ); } catch( GeneralSecurityException e ) { throw new IOException( "SSL configuration for the RabbitMQ factory failed.", e ); } finally { Utils.closeQuietly( storeIS ); Utils.closeQuietly( clientIS ); } } }
java
public static void configureFactory( ConnectionFactory factory, Map<String,String> configuration ) throws IOException { final Logger logger = Logger.getLogger( RabbitMqUtils.class.getName()); logger.fine( "Configuring a connection factory for RabbitMQ." ); String messageServerIp = configuration.get( RABBITMQ_SERVER_IP ); if( messageServerIp != null ) { Map.Entry<String,Integer> entry = Utils.findUrlAndPort( messageServerIp ); factory.setHost( entry.getKey()); if( entry.getValue() > 0 ) factory.setPort( entry.getValue()); } factory.setUsername( configuration.get( RABBITMQ_SERVER_USERNAME )); factory.setPassword( configuration.get( RABBITMQ_SERVER_PASSWORD )); // Timeout for connection establishment: 5s factory.setConnectionTimeout( 5000 ); // Configure automatic reconnection factory.setAutomaticRecoveryEnabled( true ); // Recovery interval: 10s factory.setNetworkRecoveryInterval( 10000 ); // Exchanges and so on should be redeclared if necessary factory.setTopologyRecoveryEnabled( true ); // SSL if( Boolean.parseBoolean( configuration.get( RABBITMQ_USE_SSL ))) { logger.fine( "Connection factory for RabbitMQ: SSL is used." ); InputStream clientIS = null; InputStream storeIS = null; try { clientIS = new FileInputStream( configuration.get( RABBITMQ_SSL_KEY_STORE_PATH )); storeIS = new FileInputStream( configuration.get( RABBITMQ_SSL_TRUST_STORE_PATH )); char[] keyStorePassphrase = configuration.get( RABBITMQ_SSL_KEY_STORE_PASSPHRASE ).toCharArray(); KeyStore ks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_KEY_STORE_TYPE, DEFAULT_SSL_KEY_STORE_TYPE )); ks.load( clientIS, keyStorePassphrase ); String value = getValue( configuration, RABBITMQ_SSL_KEY_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); KeyManagerFactory kmf = KeyManagerFactory.getInstance( value ); kmf.init( ks, keyStorePassphrase ); char[] trustStorePassphrase = configuration.get( RABBITMQ_SSL_TRUST_STORE_PASSPHRASE ).toCharArray(); KeyStore tks = KeyStore.getInstance( getValue( configuration, RABBITMQ_SSL_TRUST_STORE_TYPE, DEFAULT_SSL_TRUST_STORE_TYPE )); tks.load( storeIS, trustStorePassphrase ); value = getValue( configuration, RABBITMQ_SSL_TRUST_MNGR_FACTORY, DEFAULT_SSL_MNGR_FACTORY ); TrustManagerFactory tmf = TrustManagerFactory.getInstance( value ); tmf.init( tks ); SSLContext c = SSLContext.getInstance( getValue( configuration, RABBITMQ_SSL_PROTOCOL, DEFAULT_SSL_PROTOCOL )); c.init( kmf.getKeyManagers(), tmf.getTrustManagers(), null ); factory.useSslProtocol( c ); } catch( GeneralSecurityException e ) { throw new IOException( "SSL configuration for the RabbitMQ factory failed.", e ); } finally { Utils.closeQuietly( storeIS ); Utils.closeQuietly( clientIS ); } } }
[ "public", "static", "void", "configureFactory", "(", "ConnectionFactory", "factory", ",", "Map", "<", "String", ",", "String", ">", "configuration", ")", "throws", "IOException", "{", "final", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "RabbitMqUt...
Configures the connection factory with the right settings. @param factory the connection factory @param configuration the messaging configuration @throws IOException if something went wrong @see RabbitMqConstants
[ "Configures", "the", "connection", "factory", "with", "the", "right", "settings", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L87-L154
lmdbjava/lmdbjava
src/main/java/org/lmdbjava/Env.java
Env.openDbi
public Dbi<T> openDbi(final String name, final DbiFlags... flags) { final byte[] nameBytes = name == null ? null : name.getBytes(UTF_8); return openDbi(nameBytes, flags); }
java
public Dbi<T> openDbi(final String name, final DbiFlags... flags) { final byte[] nameBytes = name == null ? null : name.getBytes(UTF_8); return openDbi(nameBytes, flags); }
[ "public", "Dbi", "<", "T", ">", "openDbi", "(", "final", "String", "name", ",", "final", "DbiFlags", "...", "flags", ")", "{", "final", "byte", "[", "]", "nameBytes", "=", "name", "==", "null", "?", "null", ":", "name", ".", "getBytes", "(", "UTF_8",...
Convenience method that opens a {@link Dbi} with a UTF-8 database name. @param name name of the database (or null if no name is required) @param flags to open the database with @return a database that is ready to use
[ "Convenience", "method", "that", "opens", "a", "{", "@link", "Dbi", "}", "with", "a", "UTF", "-", "8", "database", "name", "." ]
train
https://github.com/lmdbjava/lmdbjava/blob/5912beb1037722c71f3ddc05e70fcbe739dfa272/src/main/java/org/lmdbjava/Env.java#L262-L265
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java
CATAsynchConsumer.sendMessage
private boolean sendMessage(SIBusMessage sibMessage, boolean lastMsg, Integer priority) throws MessageEncodeFailedException, IncorrectMessageTypeException, MessageCopyFailedException, UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendMessage", new Object[] { sibMessage, lastMsg, priority }); boolean ok = false; // If we are at FAP9 or above we can do a 'chunked' send of the message in seperate // slices to make life easier on the Java memory manager final HandshakeProperties props = getConversation().getHandshakeProperties(); if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) { ok = sendChunkedMessage(sibMessage, lastMsg, priority); } else { ok = sendEntireMessage(sibMessage, null, lastMsg, priority); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendMessage", ok); return ok; }
java
private boolean sendMessage(SIBusMessage sibMessage, boolean lastMsg, Integer priority) throws MessageEncodeFailedException, IncorrectMessageTypeException, MessageCopyFailedException, UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendMessage", new Object[] { sibMessage, lastMsg, priority }); boolean ok = false; // If we are at FAP9 or above we can do a 'chunked' send of the message in seperate // slices to make life easier on the Java memory manager final HandshakeProperties props = getConversation().getHandshakeProperties(); if (props.getFapLevel() >= JFapChannelConstants.FAP_VERSION_9) { ok = sendChunkedMessage(sibMessage, lastMsg, priority); } else { ok = sendEntireMessage(sibMessage, null, lastMsg, priority); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendMessage", ok); return ok; }
[ "private", "boolean", "sendMessage", "(", "SIBusMessage", "sibMessage", ",", "boolean", "lastMsg", ",", "Integer", "priority", ")", "throws", "MessageEncodeFailedException", ",", "IncorrectMessageTypeException", ",", "MessageCopyFailedException", ",", "UnsupportedEncodingExce...
Method to perform a single send of a message to the client. @param sibMessage The message to send. @param lastMsg true if this is the last message in the batch. @param priority The priority to sent the message @return Returns false if a communications error prevented the message from being sent. @throws MessageEncodeFailedException if the message encoded.
[ "Method", "to", "perform", "a", "single", "send", "of", "a", "message", "to", "the", "client", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATAsynchConsumer.java#L689-L712
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.primitiveArrayGet
protected static Object primitiveArrayGet(Object self, int idx) { return Array.get(self, normaliseIndex(idx, Array.getLength(self))); }
java
protected static Object primitiveArrayGet(Object self, int idx) { return Array.get(self, normaliseIndex(idx, Array.getLength(self))); }
[ "protected", "static", "Object", "primitiveArrayGet", "(", "Object", "self", ",", "int", "idx", ")", "{", "return", "Array", ".", "get", "(", "self", ",", "normaliseIndex", "(", "idx", ",", "Array", ".", "getLength", "(", "self", ")", ")", ")", ";", "}...
Implements the getAt(int) method for primitive type arrays. @param self an array object @param idx the index of interest @return the returned value from the array @since 1.5.0
[ "Implements", "the", "getAt", "(", "int", ")", "method", "for", "primitive", "type", "arrays", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14544-L14546
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/ALasDataManager.java
ALasDataManager.getDataManager
public static ALasDataManager getDataManager( File dataFile, GridCoverage2D inDem, double elevThreshold, CoordinateReferenceSystem inCrs ) { String lcName = dataFile.getName().toLowerCase(); if (lcName.endsWith(".las")) { return new LasFileDataManager(dataFile, inDem, elevThreshold, inCrs); } else if (lcName.equals(LasIndexer.INDEX_LASFOLDER)) { return new LasFolderIndexDataManager(dataFile, inDem, elevThreshold, inCrs); } else { try { EDb edb = EDb.fromFileDesktop(dataFile); if (edb != null && edb.isSpatial()) { return new DatabaseLasDataManager(dataFile, inDem, elevThreshold, inCrs); } } catch (Exception e) { // ignore, will be handled } throw new IllegalArgumentException("Can only read .las and " + LasIndexer.INDEX_LASFOLDER + " files."); } }
java
public static ALasDataManager getDataManager( File dataFile, GridCoverage2D inDem, double elevThreshold, CoordinateReferenceSystem inCrs ) { String lcName = dataFile.getName().toLowerCase(); if (lcName.endsWith(".las")) { return new LasFileDataManager(dataFile, inDem, elevThreshold, inCrs); } else if (lcName.equals(LasIndexer.INDEX_LASFOLDER)) { return new LasFolderIndexDataManager(dataFile, inDem, elevThreshold, inCrs); } else { try { EDb edb = EDb.fromFileDesktop(dataFile); if (edb != null && edb.isSpatial()) { return new DatabaseLasDataManager(dataFile, inDem, elevThreshold, inCrs); } } catch (Exception e) { // ignore, will be handled } throw new IllegalArgumentException("Can only read .las and " + LasIndexer.INDEX_LASFOLDER + " files."); } }
[ "public", "static", "ALasDataManager", "getDataManager", "(", "File", "dataFile", ",", "GridCoverage2D", "inDem", ",", "double", "elevThreshold", ",", "CoordinateReferenceSystem", "inCrs", ")", "{", "String", "lcName", "=", "dataFile", ".", "getName", "(", ")", "....
Factory method to create {@link ALasDataManager}. @param lasFile the las file or las folder index file. @param inDem a dem to normalize the elevation. If <code>!null</code>, the height over the dtm is added as {@link LasRecord#groundElevation}. @param elevThreshold a threshold to use for the elevation normalization. @param inCrs the data {@link org.opengis.referencing.crs.CoordinateReferenceSystem}. if null, the one of the dem is read, if available.
[ "Factory", "method", "to", "create", "{", "@link", "ALasDataManager", "}", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/ALasDataManager.java#L73-L92
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java
AbstractAnnotationVisitor.addValue
private void addValue(String name, ValueDescriptor<?> value) { if (arrayValueDescriptor != null && name == null) { getArrayValue().add(value); } else { setValue(descriptor, value); } }
java
private void addValue(String name, ValueDescriptor<?> value) { if (arrayValueDescriptor != null && name == null) { getArrayValue().add(value); } else { setValue(descriptor, value); } }
[ "private", "void", "addValue", "(", "String", "name", ",", "ValueDescriptor", "<", "?", ">", "value", ")", "{", "if", "(", "arrayValueDescriptor", "!=", "null", "&&", "name", "==", "null", ")", "{", "getArrayValue", "(", ")", ".", "add", "(", "value", ...
Add the descriptor as value to the current annotation or array value. @param name The name. @param value The value.
[ "Add", "the", "descriptor", "as", "value", "to", "the", "current", "annotation", "or", "array", "value", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java#L121-L127
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_orderableHostProfiles_GET
public ArrayList<net.minidev.ovh.api.dedicatedcloud.host.OvhProfile> serviceName_datacenter_datacenterId_orderableHostProfiles_GET(String serviceName, Long datacenterId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableHostProfiles"; StringBuilder sb = path(qPath, serviceName, datacenterId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<net.minidev.ovh.api.dedicatedcloud.host.OvhProfile> serviceName_datacenter_datacenterId_orderableHostProfiles_GET(String serviceName, Long datacenterId) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableHostProfiles"; StringBuilder sb = path(qPath, serviceName, datacenterId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "dedicatedcloud", ".", "host", ".", "OvhProfile", ">", "serviceName_datacenter_datacenterId_orderableHostProfiles_GET", "(", "String", "serviceName", ",", "Long", "datacenterId", ")", "t...
List available hosts in a given Private Cloud Datacenter REST: GET /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableHostProfiles @param serviceName [required] Domain of the service @param datacenterId [required]
[ "List", "available", "hosts", "in", "a", "given", "Private", "Cloud", "Datacenter" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2355-L2360
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java
ExtensionsInner.getAsync
public Observable<ExtensionInner> getAsync(String resourceGroupName, String clusterName, String extensionName) { return getWithServiceResponseAsync(resourceGroupName, clusterName, extensionName).map(new Func1<ServiceResponse<ExtensionInner>, ExtensionInner>() { @Override public ExtensionInner call(ServiceResponse<ExtensionInner> response) { return response.body(); } }); }
java
public Observable<ExtensionInner> getAsync(String resourceGroupName, String clusterName, String extensionName) { return getWithServiceResponseAsync(resourceGroupName, clusterName, extensionName).map(new Func1<ServiceResponse<ExtensionInner>, ExtensionInner>() { @Override public ExtensionInner call(ServiceResponse<ExtensionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExtensionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "extensionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "ext...
Gets the extension properties for the specified HDInsight cluster extension. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param extensionName The name of the cluster extension. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExtensionInner object
[ "Gets", "the", "extension", "properties", "for", "the", "specified", "HDInsight", "cluster", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L733-L740
aws/aws-sdk-java
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/Hit.java
Hit.withHighlights
public Hit withHighlights(java.util.Map<String, String> highlights) { setHighlights(highlights); return this; }
java
public Hit withHighlights(java.util.Map<String, String> highlights) { setHighlights(highlights); return this; }
[ "public", "Hit", "withHighlights", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "highlights", ")", "{", "setHighlights", "(", "highlights", ")", ";", "return", "this", ";", "}" ]
<p> The highlights returned from a document that matches the search request. </p> @param highlights The highlights returned from a document that matches the search request. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "highlights", "returned", "from", "a", "document", "that", "matches", "the", "search", "request", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/Hit.java#L259-L262
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/SoyAutoescapeException.java
SoyAutoescapeException.createCausedWithNode
static SoyAutoescapeException createCausedWithNode( String message, Throwable cause, SoyNode node) { return new SoyAutoescapeException(message, cause, node); }
java
static SoyAutoescapeException createCausedWithNode( String message, Throwable cause, SoyNode node) { return new SoyAutoescapeException(message, cause, node); }
[ "static", "SoyAutoescapeException", "createCausedWithNode", "(", "String", "message", ",", "Throwable", "cause", ",", "SoyNode", "node", ")", "{", "return", "new", "SoyAutoescapeException", "(", "message", ",", "cause", ",", "node", ")", ";", "}" ]
Creates a SoyAutoescapeException, with meta info filled in based on the given Soy node. @param message The error message. @param cause The cause of this exception. @param node The node from which to derive the exception meta info. @return The new SoyAutoescapeException object.
[ "Creates", "a", "SoyAutoescapeException", "with", "meta", "info", "filled", "in", "based", "on", "the", "given", "Soy", "node", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/SoyAutoescapeException.java#L48-L51
Azure/azure-sdk-for-java
dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java
RecordSetsInner.listByTypeAsync
public Observable<Page<RecordSetInner>> listByTypeAsync(final String resourceGroupName, final String zoneName, final RecordType recordType, final Integer top, final String recordsetnamesuffix) { return listByTypeWithServiceResponseAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) .map(new Func1<ServiceResponse<Page<RecordSetInner>>, Page<RecordSetInner>>() { @Override public Page<RecordSetInner> call(ServiceResponse<Page<RecordSetInner>> response) { return response.body(); } }); }
java
public Observable<Page<RecordSetInner>> listByTypeAsync(final String resourceGroupName, final String zoneName, final RecordType recordType, final Integer top, final String recordsetnamesuffix) { return listByTypeWithServiceResponseAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) .map(new Func1<ServiceResponse<Page<RecordSetInner>>, Page<RecordSetInner>>() { @Override public Page<RecordSetInner> call(ServiceResponse<Page<RecordSetInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "RecordSetInner", ">", ">", "listByTypeAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "zoneName", ",", "final", "RecordType", "recordType", ",", "final", "Integer", "top", ",", "final", "Str...
Lists the record sets of a specified type in a DNS zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @param recordType The type of record sets to enumerate. Possible values include: 'A', 'AAAA', 'CNAME', 'MX', 'NS', 'PTR', 'SOA', 'SRV', 'TXT' @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets. @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .&lt;recordSetNameSuffix&gt; @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RecordSetInner&gt; object
[ "Lists", "the", "record", "sets", "of", "a", "specified", "type", "in", "a", "DNS", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java#L1015-L1023
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.lngLatToMeters
public Coordinate lngLatToMeters(Coordinate coord) { double mx = coord.x * originShift / 180.0; double my = Math.log(Math.tan((90 + coord.y) * Math.PI / 360.0)) / (Math.PI / 180.0); my *= originShift / 180.0; return new Coordinate(mx, my); }
java
public Coordinate lngLatToMeters(Coordinate coord) { double mx = coord.x * originShift / 180.0; double my = Math.log(Math.tan((90 + coord.y) * Math.PI / 360.0)) / (Math.PI / 180.0); my *= originShift / 180.0; return new Coordinate(mx, my); }
[ "public", "Coordinate", "lngLatToMeters", "(", "Coordinate", "coord", ")", "{", "double", "mx", "=", "coord", ".", "x", "*", "originShift", "/", "180.0", ";", "double", "my", "=", "Math", ".", "log", "(", "Math", ".", "tan", "(", "(", "90", "+", "coo...
Converts given coordinate in WGS84 Datum to XY in Spherical Mercator EPSG:3857 @param coord The coordinate to convert @return The coordinate transformed to EPSG:3857
[ "Converts", "given", "coordinate", "in", "WGS84", "Datum", "to", "XY", "in", "Spherical", "Mercator", "EPSG", ":", "3857" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L64-L69
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java
AssertMessages.outsideRangeInclusiveParameter
@Pure @Inline(value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)", imported = {AssertMessages.class}) public static String outsideRangeInclusiveParameter(Object currentValue, Object minValue, Object maxValue) { return outsideRangeInclusiveParameter(0, currentValue, minValue, maxValue); }
java
@Pure @Inline(value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)", imported = {AssertMessages.class}) public static String outsideRangeInclusiveParameter(Object currentValue, Object minValue, Object maxValue) { return outsideRangeInclusiveParameter(0, currentValue, minValue, maxValue); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)\"", ",", "imported", "=", "{", "AssertMessages", ".", "class", "}", ")", "public", "static", "String", "outsideRangeInclusiveParameter", "(", "Object", "curren...
First parameter value is outside range. @param currentValue current value. @param minValue minimum value in range. @param maxValue maximum value in range. @return the error message.
[ "First", "parameter", "value", "is", "outside", "range", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L250-L255
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/map/MapJsonSerializer.java
MapJsonSerializer.newInstance
public static <M extends Map<?, ?>> MapJsonSerializer<M, ?, ?> newInstance( KeySerializer<?> keySerializer, JsonSerializer<?> valueSerializer ) { return new MapJsonSerializer( keySerializer, valueSerializer ); }
java
public static <M extends Map<?, ?>> MapJsonSerializer<M, ?, ?> newInstance( KeySerializer<?> keySerializer, JsonSerializer<?> valueSerializer ) { return new MapJsonSerializer( keySerializer, valueSerializer ); }
[ "public", "static", "<", "M", "extends", "Map", "<", "?", ",", "?", ">", ">", "MapJsonSerializer", "<", "M", ",", "?", ",", "?", ">", "newInstance", "(", "KeySerializer", "<", "?", ">", "keySerializer", ",", "JsonSerializer", "<", "?", ">", "valueSeria...
<p>newInstance</p> @param keySerializer {@link KeySerializer} used to serialize the keys. @param valueSerializer {@link JsonSerializer} used to serialize the values. @return a new instance of {@link MapJsonSerializer} @param <M> a M object.
[ "<p", ">", "newInstance<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/map/MapJsonSerializer.java#L49-L52
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java
EntityGroupImpl.getChildren
@Override public Set<IGroupMember> getChildren() throws GroupsException { final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier(); Element element = childrenCache.get(cacheKey); if (element == null) { final Set<IGroupMember> children = buildChildrenSet(); element = new Element(cacheKey, children); childrenCache.put(element); } @SuppressWarnings("unchecked") final Set<IGroupMember> rslt = (Set<IGroupMember>) element.getObjectValue(); return rslt; }
java
@Override public Set<IGroupMember> getChildren() throws GroupsException { final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier(); Element element = childrenCache.get(cacheKey); if (element == null) { final Set<IGroupMember> children = buildChildrenSet(); element = new Element(cacheKey, children); childrenCache.put(element); } @SuppressWarnings("unchecked") final Set<IGroupMember> rslt = (Set<IGroupMember>) element.getObjectValue(); return rslt; }
[ "@", "Override", "public", "Set", "<", "IGroupMember", ">", "getChildren", "(", ")", "throws", "GroupsException", "{", "final", "EntityIdentifier", "cacheKey", "=", "getUnderlyingEntityIdentifier", "(", ")", ";", "Element", "element", "=", "childrenCache", ".", "g...
Returns an <code>Iterator</code> over the <code>GroupMembers</code> in our member <code> Collection</code>. Reflects pending changes. @return Iterator
[ "Returns", "an", "<code", ">", "Iterator<", "/", "code", ">", "over", "the", "<code", ">", "GroupMembers<", "/", "code", ">", "in", "our", "member", "<code", ">", "Collection<", "/", "code", ">", ".", "Reflects", "pending", "changes", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java#L295-L310
zaproxy/zaproxy
src/org/zaproxy/zap/extension/spider/ExtensionSpider.java
ExtensionSpider.startScan
@SuppressWarnings({"fallthrough"}) @Override public int startScan(String displayName, Target target, User user, Object[] customConfigurations) { switch (Control.getSingleton().getMode()) { case safe: throw new IllegalStateException("Scans are not allowed in Safe mode"); case protect: String uri = getTargetUriOutOfScope(target, customConfigurations); if (uri != null) { throw new IllegalStateException("Scans are not allowed on targets not in scope when in Protected mode: " + uri); } //$FALL-THROUGH$ case standard: case attack: // No problem break; } int id = this.scanController.startScan(displayName, target, user, customConfigurations); if (View.isInitialised()) { addScanToUi(this.scanController.getScan(id)); } return id; }
java
@SuppressWarnings({"fallthrough"}) @Override public int startScan(String displayName, Target target, User user, Object[] customConfigurations) { switch (Control.getSingleton().getMode()) { case safe: throw new IllegalStateException("Scans are not allowed in Safe mode"); case protect: String uri = getTargetUriOutOfScope(target, customConfigurations); if (uri != null) { throw new IllegalStateException("Scans are not allowed on targets not in scope when in Protected mode: " + uri); } //$FALL-THROUGH$ case standard: case attack: // No problem break; } int id = this.scanController.startScan(displayName, target, user, customConfigurations); if (View.isInitialised()) { addScanToUi(this.scanController.getScan(id)); } return id; }
[ "@", "SuppressWarnings", "(", "{", "\"fallthrough\"", "}", ")", "@", "Override", "public", "int", "startScan", "(", "String", "displayName", ",", "Target", "target", ",", "User", "user", ",", "Object", "[", "]", "customConfigurations", ")", "{", "switch", "(...
Starts a new spider scan, with the given display name, using the given target and, optionally, spidering from the perspective of a user and with custom configurations. <p> <strong>Note:</strong> The preferred method to start the scan is with {@link #startScan(Target, User, Object[])}, unless a custom display name is really needed. @param target the target that will be spidered @param user the user that will be used to spider, might be {@code null} @param customConfigurations other custom configurations for the spider, might be {@code null} @return the ID of the spider scan @throws IllegalStateException if the target or custom configurations are not allowed in the current {@link org.parosproxy.paros.control.Control.Mode mode}.
[ "Starts", "a", "new", "spider", "scan", "with", "the", "given", "display", "name", "using", "the", "given", "target", "and", "optionally", "spidering", "from", "the", "perspective", "of", "a", "user", "and", "with", "custom", "configurations", ".", "<p", ">"...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/spider/ExtensionSpider.java#L622-L645
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
StorableGenerator.loadStorageForFetch
private void loadStorageForFetch(CodeBuilder b, TypeDesc type) { b.loadThis(); b.loadField(SUPPORT_FIELD_NAME, mSupportType); TypeDesc storageType = TypeDesc.forClass(Storage.class); TypeDesc repositoryType = TypeDesc.forClass(Repository.class); b.invokeInterface (mSupportType, "getRootRepository", repositoryType, null); b.loadConstant(type); // This may throw a RepositoryException. Label tryStart = b.createLabel().setLocation(); b.invokeInterface(repositoryType, STORAGE_FOR_METHOD_NAME, storageType, new TypeDesc[]{TypeDesc.forClass(Class.class)}); Label tryEnd = b.createLabel().setLocation(); Label noException = b.createLabel(); b.branch(noException); b.exceptionHandler(tryStart, tryEnd, RepositoryException.class.getName()); b.invokeVirtual (RepositoryException.class.getName(), "toFetchException", TypeDesc.forClass(FetchException.class), null); b.throwObject(); noException.setLocation(); }
java
private void loadStorageForFetch(CodeBuilder b, TypeDesc type) { b.loadThis(); b.loadField(SUPPORT_FIELD_NAME, mSupportType); TypeDesc storageType = TypeDesc.forClass(Storage.class); TypeDesc repositoryType = TypeDesc.forClass(Repository.class); b.invokeInterface (mSupportType, "getRootRepository", repositoryType, null); b.loadConstant(type); // This may throw a RepositoryException. Label tryStart = b.createLabel().setLocation(); b.invokeInterface(repositoryType, STORAGE_FOR_METHOD_NAME, storageType, new TypeDesc[]{TypeDesc.forClass(Class.class)}); Label tryEnd = b.createLabel().setLocation(); Label noException = b.createLabel(); b.branch(noException); b.exceptionHandler(tryStart, tryEnd, RepositoryException.class.getName()); b.invokeVirtual (RepositoryException.class.getName(), "toFetchException", TypeDesc.forClass(FetchException.class), null); b.throwObject(); noException.setLocation(); }
[ "private", "void", "loadStorageForFetch", "(", "CodeBuilder", "b", ",", "TypeDesc", "type", ")", "{", "b", ".", "loadThis", "(", ")", ";", "b", ".", "loadField", "(", "SUPPORT_FIELD_NAME", ",", "mSupportType", ")", ";", "TypeDesc", "storageType", "=", "TypeD...
Generates code that loads a Storage instance on the stack, throwing a FetchException if Storage request fails. @param type type of Storage to request
[ "Generates", "code", "that", "loads", "a", "Storage", "instance", "on", "the", "stack", "throwing", "a", "FetchException", "if", "Storage", "request", "fails", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2132-L2158
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.stringForQuery
public static String stringForQuery(SQLiteStatement prog, String[] selectionArgs) { prog.bindAllArgsAsStrings(selectionArgs); return prog.simpleQueryForString(); }
java
public static String stringForQuery(SQLiteStatement prog, String[] selectionArgs) { prog.bindAllArgsAsStrings(selectionArgs); return prog.simpleQueryForString(); }
[ "public", "static", "String", "stringForQuery", "(", "SQLiteStatement", "prog", ",", "String", "[", "]", "selectionArgs", ")", "{", "prog", ".", "bindAllArgsAsStrings", "(", "selectionArgs", ")", ";", "return", "prog", ".", "simpleQueryForString", "(", ")", ";",...
Utility method to run the pre-compiled query and return the value in the first column of the first row.
[ "Utility", "method", "to", "run", "the", "pre", "-", "compiled", "query", "and", "return", "the", "value", "in", "the", "first", "column", "of", "the", "first", "row", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L867-L870
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/MultiMap.java
MultiMap.hasPseudo
public boolean hasPseudo(E el, P pseudo) { HashMap<P, D> map = pseudoMaps.get(el); if (map == null) return false; else return map.containsKey(pseudo); }
java
public boolean hasPseudo(E el, P pseudo) { HashMap<P, D> map = pseudoMaps.get(el); if (map == null) return false; else return map.containsKey(pseudo); }
[ "public", "boolean", "hasPseudo", "(", "E", "el", ",", "P", "pseudo", ")", "{", "HashMap", "<", "P", ",", "D", ">", "map", "=", "pseudoMaps", ".", "get", "(", "el", ")", ";", "if", "(", "map", "==", "null", ")", "return", "false", ";", "else", ...
Checks if the given pseudo element is available for the given element @param el The element @param pseudo The tested pseudo element @return true when there is some value associated with the given pair
[ "Checks", "if", "the", "given", "pseudo", "element", "is", "available", "for", "the", "given", "element" ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L180-L187
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/CursorRenderer.java
CursorRenderer.addImage
public void addImage(int id, Media media) { final Integer key = Integer.valueOf(id); surfaces.put(key, Drawable.loadImage(media)); if (surfaceId == null) { surfaceId = key; } }
java
public void addImage(int id, Media media) { final Integer key = Integer.valueOf(id); surfaces.put(key, Drawable.loadImage(media)); if (surfaceId == null) { surfaceId = key; } }
[ "public", "void", "addImage", "(", "int", "id", ",", "Media", "media", ")", "{", "final", "Integer", "key", "=", "Integer", ".", "valueOf", "(", "id", ")", ";", "surfaces", ".", "put", "(", "key", ",", "Drawable", ".", "loadImage", "(", "media", ")",...
Add a cursor image. Once there are no more images to add, a call to {@link #load()} will be necessary. @param id The cursor id. @param media The cursor media. @throws LionEngineException If invalid media.
[ "Add", "a", "cursor", "image", ".", "Once", "there", "are", "no", "more", "images", "to", "add", "a", "call", "to", "{", "@link", "#load", "()", "}", "will", "be", "necessary", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/CursorRenderer.java#L89-L97
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java
JobLauncherFactory.newJobLauncher
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker) throws Exception { return newJobLauncher(sysProps, jobProps, instanceBroker, ImmutableList.of()); }
java
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker) throws Exception { return newJobLauncher(sysProps, jobProps, instanceBroker, ImmutableList.of()); }
[ "public", "static", "@", "Nonnull", "JobLauncher", "newJobLauncher", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ",", "SharedResourcesBroker", "<", "GobblinScopeTypes", ">", "instanceBroker", ")", "throws", "Exception", "{", "return", "newJobLauncher",...
Create a new {@link JobLauncher}. <p> This method will never return a {@code null}. </p> @param sysProps system configuration properties @param jobProps job configuration properties @param instanceBroker @return newly created {@link JobLauncher}
[ "Create", "a", "new", "{", "@link", "JobLauncher", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L83-L86
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java
SRTPCryptoContext.reverseTransformPacket
public boolean reverseTransformPacket(RawPacket pkt) { int seqNo = pkt.getSequenceNumber(); if (!seqNumSet) { seqNumSet = true; seqNum = seqNo; } // Guess the SRTP index (48 bit), see rFC 3711, 3.3.1 // Stores the guessed roc in this.guessedROC long guessedIndex = guessIndex(seqNo); // Replay control if (!checkReplay(seqNo, guessedIndex)) { return false; } // Authenticate packet if (policy.getAuthType() != SRTPPolicy.NULL_AUTHENTICATION) { int tagLength = policy.getAuthTagLength(); // get original authentication and store in tempStore pkt.readRegionToBuff(pkt.getLength() - tagLength, tagLength, tempStore); pkt.shrink(tagLength); // save computed authentication in tagStore authenticatePacketHMCSHA1(pkt, guessedROC); for (int i = 0; i < tagLength; i++) { if ((tempStore[i] & 0xff) != (tagStore[i] & 0xff)) { return false; } } } // Decrypt packet switch (policy.getEncType()) { case SRTPPolicy.AESCM_ENCRYPTION: case SRTPPolicy.TWOFISH_ENCRYPTION: // using Counter Mode encryption processPacketAESCM(pkt); break; case SRTPPolicy.AESF8_ENCRYPTION: case SRTPPolicy.TWOFISHF8_ENCRYPTION: // using F8 Mode encryption processPacketAESF8(pkt); break; default: return false; } update(seqNo, guessedIndex); return true; }
java
public boolean reverseTransformPacket(RawPacket pkt) { int seqNo = pkt.getSequenceNumber(); if (!seqNumSet) { seqNumSet = true; seqNum = seqNo; } // Guess the SRTP index (48 bit), see rFC 3711, 3.3.1 // Stores the guessed roc in this.guessedROC long guessedIndex = guessIndex(seqNo); // Replay control if (!checkReplay(seqNo, guessedIndex)) { return false; } // Authenticate packet if (policy.getAuthType() != SRTPPolicy.NULL_AUTHENTICATION) { int tagLength = policy.getAuthTagLength(); // get original authentication and store in tempStore pkt.readRegionToBuff(pkt.getLength() - tagLength, tagLength, tempStore); pkt.shrink(tagLength); // save computed authentication in tagStore authenticatePacketHMCSHA1(pkt, guessedROC); for (int i = 0; i < tagLength; i++) { if ((tempStore[i] & 0xff) != (tagStore[i] & 0xff)) { return false; } } } // Decrypt packet switch (policy.getEncType()) { case SRTPPolicy.AESCM_ENCRYPTION: case SRTPPolicy.TWOFISH_ENCRYPTION: // using Counter Mode encryption processPacketAESCM(pkt); break; case SRTPPolicy.AESF8_ENCRYPTION: case SRTPPolicy.TWOFISHF8_ENCRYPTION: // using F8 Mode encryption processPacketAESF8(pkt); break; default: return false; } update(seqNo, guessedIndex); return true; }
[ "public", "boolean", "reverseTransformPacket", "(", "RawPacket", "pkt", ")", "{", "int", "seqNo", "=", "pkt", ".", "getSequenceNumber", "(", ")", ";", "if", "(", "!", "seqNumSet", ")", "{", "seqNumSet", "=", "true", ";", "seqNum", "=", "seqNo", ";", "}",...
Transform a SRTP packet into a RTP packet. This method is called when a SRTP packet is received. Operations done by the this operation include: Authentication check, Packet replay check and Decryption. Both encryption and authentication functionality can be turned off as long as the SRTPPolicy used in this SRTPCryptoContext requires no encryption and no authentication. Then the packet will be sent out untouched. However this is not encouraged. If no SRTP feature is enabled, then we shall not use SRTP TransformConnector. We should use the original method (RTPManager managed transportation) instead. @param pkt the RTP packet that is just received @return true if the packet can be accepted false if the packet failed authentication or failed replay check
[ "Transform", "a", "SRTP", "packet", "into", "a", "RTP", "packet", ".", "This", "method", "is", "called", "when", "a", "SRTP", "packet", "is", "received", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java#L397-L451
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/dependency/Evidence.java
Evidence.compareToIgnoreCaseWithNullCheck
private int compareToIgnoreCaseWithNullCheck(String me, String other) { if (me == null && other == null) { return 0; } else if (me == null) { return -1; //the other string is greater than me } else if (other == null) { return 1; //me is greater than the other string } return me.compareToIgnoreCase(other); }
java
private int compareToIgnoreCaseWithNullCheck(String me, String other) { if (me == null && other == null) { return 0; } else if (me == null) { return -1; //the other string is greater than me } else if (other == null) { return 1; //me is greater than the other string } return me.compareToIgnoreCase(other); }
[ "private", "int", "compareToIgnoreCaseWithNullCheck", "(", "String", "me", ",", "String", "other", ")", "{", "if", "(", "me", "==", "null", "&&", "other", "==", "null", ")", "{", "return", "0", ";", "}", "else", "if", "(", "me", "==", "null", ")", "{...
Wrapper around {@link java.lang.String#compareToIgnoreCase(java.lang.String) String.compareToIgnoreCase} with an exhaustive, possibly duplicative, check against nulls. @param me the value to be compared @param other the other value to be compared @return true if the values are equal; otherwise false
[ "Wrapper", "around", "{", "@link", "java", ".", "lang", ".", "String#compareToIgnoreCase", "(", "java", ".", "lang", ".", "String", ")", "String", ".", "compareToIgnoreCase", "}", "with", "an", "exhaustive", "possibly", "duplicative", "check", "against", "nulls"...
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/dependency/Evidence.java#L243-L252
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.openConnection
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
java
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { boolean ok = false; final Connection connection = connectionManager.connect(); try { channelHandler.executeRequest(new ServerRegisterRequest(), null, callback); // HC is the same version, so it will support sending the subject channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE); channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE); channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport)); ok = true; } finally { if(!ok) { connection.close(); } } }
[ "synchronized", "void", "openConnection", "(", "final", "ModelController", "controller", ",", "final", "ActiveOperation", ".", "CompletedCallback", "<", "ModelNode", ">", "callback", ")", "throws", "Exception", "{", "boolean", "ok", "=", "false", ";", "final", "Co...
Connect to the HC and retrieve the current model updates. @param controller the server controller @param callback the operation completed callback @throws IOException for any error
[ "Connect", "to", "the", "HC", "and", "retrieve", "the", "current", "model", "updates", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L126-L141
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/util/FormatUtilities.java
FormatUtilities.getFormattedTime
static public String getFormattedTime(long dt, String format, boolean isTime) { String ret = ""; SimpleDateFormat df = null; try { if(dt > 0) { df = formatPool.getFormat(format); if(isTime) df.setTimeZone(DateUtilities.getCurrentTimeZone()); else df.setTimeZone(DateUtilities.defaultTZ); ret = df.format(new Date(dt)); } } catch(Exception e) { } if(df != null) formatPool.release(df); return ret; }
java
static public String getFormattedTime(long dt, String format, boolean isTime) { String ret = ""; SimpleDateFormat df = null; try { if(dt > 0) { df = formatPool.getFormat(format); if(isTime) df.setTimeZone(DateUtilities.getCurrentTimeZone()); else df.setTimeZone(DateUtilities.defaultTZ); ret = df.format(new Date(dt)); } } catch(Exception e) { } if(df != null) formatPool.release(df); return ret; }
[ "static", "public", "String", "getFormattedTime", "(", "long", "dt", ",", "String", "format", ",", "boolean", "isTime", ")", "{", "String", "ret", "=", "\"\"", ";", "SimpleDateFormat", "df", "=", "null", ";", "try", "{", "if", "(", "dt", ">", "0", ")",...
Returns the given time parsed using "HH:mm:ss". @param dt The time to be parsed @param format The format to use when parsing the date @param isTime <CODE>true</CODE> if the given time has a timezone @return The given time parsed using "HH:mm:ss"
[ "Returns", "the", "given", "time", "parsed", "using", "HH", ":", "mm", ":", "ss", "." ]
train
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L392-L417
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentImpl.java
ComponentImpl.registerUDF
@Override public void registerUDF(Collection.Key key, UDF udf) throws ApplicationException { registerUDF(key, (UDFPlus) udf, useShadow, false); }
java
@Override public void registerUDF(Collection.Key key, UDF udf) throws ApplicationException { registerUDF(key, (UDFPlus) udf, useShadow, false); }
[ "@", "Override", "public", "void", "registerUDF", "(", "Collection", ".", "Key", "key", ",", "UDF", "udf", ")", "throws", "ApplicationException", "{", "registerUDF", "(", "key", ",", "(", "UDFPlus", ")", "udf", ",", "useShadow", ",", "false", ")", ";", "...
/* public void reg(Collection.Key key, UDFPlus udf) throws ApplicationException { registerUDF(key, udf,useShadow,false); } public void reg(String key, UDFPlus udf) throws ApplicationException { registerUDF(KeyImpl.init(key), udf,useShadow,false); }
[ "/", "*", "public", "void", "reg", "(", "Collection", ".", "Key", "key", "UDFPlus", "udf", ")", "throws", "ApplicationException", "{", "registerUDF", "(", "key", "udf", "useShadow", "false", ")", ";", "}", "public", "void", "reg", "(", "String", "key", "...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L1663-L1666
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.postArtifact
public void postArtifact(final Artifact artifact, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.artifactResourcePath()); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, artifact); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST artifact"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
java
public void postArtifact(final Artifact artifact, final String user, final String password) throws GrapesCommunicationException, AuthenticationException { final Client client = getClient(user, password); final WebResource resource = client.resource(serverURL).path(RequestUtils.artifactResourcePath()); final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, artifact); client.destroy(); if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){ final String message = "Failed to POST artifact"; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } }
[ "public", "void", "postArtifact", "(", "final", "Artifact", "artifact", ",", "final", "String", "user", ",", "final", "String", "password", ")", "throws", "GrapesCommunicationException", ",", "AuthenticationException", "{", "final", "Client", "client", "=", "getClie...
Post an artifact to the Grapes server @param artifact The artifact to post @param user The user posting the information @param password The user password @throws GrapesCommunicationException @throws javax.naming.AuthenticationException
[ "Post", "an", "artifact", "to", "the", "Grapes", "server" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L418-L431
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/DOMWriter.java
DOMWriter.printNode
public static String printNode(Node node, boolean prettyprint) { StringWriter strw = new StringWriter(); new DOMWriter(strw).setPrettyprint(prettyprint).print(node); return strw.toString(); }
java
public static String printNode(Node node, boolean prettyprint) { StringWriter strw = new StringWriter(); new DOMWriter(strw).setPrettyprint(prettyprint).print(node); return strw.toString(); }
[ "public", "static", "String", "printNode", "(", "Node", "node", ",", "boolean", "prettyprint", ")", "{", "StringWriter", "strw", "=", "new", "StringWriter", "(", ")", ";", "new", "DOMWriter", "(", "strw", ")", ".", "setPrettyprint", "(", "prettyprint", ")", ...
Print a node with explicit prettyprinting. The defaults for all other DOMWriter properties apply.
[ "Print", "a", "node", "with", "explicit", "prettyprinting", ".", "The", "defaults", "for", "all", "other", "DOMWriter", "properties", "apply", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMWriter.java#L150-L155
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.insertElementAt
public void insertElementAt(int value, int at) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.insertElementAt(value, at); }
java
public void insertElementAt(int value, int at) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.insertElementAt(value, at); }
[ "public", "void", "insertElementAt", "(", "int", "value", ",", "int", "at", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE",...
Inserts the specified node in this vector at the specified index. Each component in this vector with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously. @param value The node to be inserted. @param at The index where the insert should occur. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Inserts", "the", "specified", "node", "in", "this", "vector", "at", "the", "specified", "index", ".", "Each", "component", "in", "this", "vector", "with", "an", "index", "greater", "or", "equal", "to", "the", "specified", "index", "is", "shifted", "upward",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L913-L920
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLContext.java
SSLContext.createSSLEngine
public final SSLEngine createSSLEngine(String peerHost, int peerPort) { try { return contextSpi.engineCreateSSLEngine(peerHost, peerPort); } catch (AbstractMethodError e) { UnsupportedOperationException unsup = new UnsupportedOperationException( "Provider: " + getProvider() + " does not support this operation"); unsup.initCause(e); throw unsup; } }
java
public final SSLEngine createSSLEngine(String peerHost, int peerPort) { try { return contextSpi.engineCreateSSLEngine(peerHost, peerPort); } catch (AbstractMethodError e) { UnsupportedOperationException unsup = new UnsupportedOperationException( "Provider: " + getProvider() + " does not support this operation"); unsup.initCause(e); throw unsup; } }
[ "public", "final", "SSLEngine", "createSSLEngine", "(", "String", "peerHost", ",", "int", "peerPort", ")", "{", "try", "{", "return", "contextSpi", ".", "engineCreateSSLEngine", "(", "peerHost", ",", "peerPort", ")", ";", "}", "catch", "(", "AbstractMethodError"...
Creates a new <code>SSLEngine</code> using this context using advisory peer information. <P> Applications using this factory method are providing hints for an internal session reuse strategy. <P> Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified. @param peerHost the non-authoritative name of the host @param peerPort the non-authoritative port @return the new <code>SSLEngine</code> object @throws UnsupportedOperationException if the underlying provider does not implement the operation. @throws IllegalStateException if the SSLContextImpl requires initialization and the <code>init()</code> has not been called @since 1.5
[ "Creates", "a", "new", "<code", ">", "SSLEngine<", "/", "code", ">", "using", "this", "context", "using", "advisory", "peer", "information", ".", "<P", ">", "Applications", "using", "this", "factory", "method", "are", "providing", "hints", "for", "an", "inte...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLContext.java#L393-L404
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java
LongTermRetentionBackupsInner.beginDelete
public void beginDelete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); }
java
public void beginDelete(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { beginDeleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "locationName", ",", "String", "longTermRetentionServerName", ",", "String", "longTermRetentionDatabaseName", ",", "String", "backupName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "locationName", ",", "longTermRet...
Deletes a long term retention backup. @param locationName The location of the database @param longTermRetentionServerName the String value @param longTermRetentionDatabaseName the String value @param backupName The backup name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "long", "term", "retention", "backup", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java#L293-L295
j-easy/easy-random
easy-random-randomizers/src/main/java/org/jeasy/random/randomizers/EmailRandomizer.java
EmailRandomizer.aNewEmailRandomizer
public static EmailRandomizer aNewEmailRandomizer(final long seed, final Locale locale, final boolean safe) { return new EmailRandomizer(seed, locale, safe); }
java
public static EmailRandomizer aNewEmailRandomizer(final long seed, final Locale locale, final boolean safe) { return new EmailRandomizer(seed, locale, safe); }
[ "public", "static", "EmailRandomizer", "aNewEmailRandomizer", "(", "final", "long", "seed", ",", "final", "Locale", "locale", ",", "final", "boolean", "safe", ")", "{", "return", "new", "EmailRandomizer", "(", "seed", ",", "locale", ",", "safe", ")", ";", "}...
Create a new {@link EmailRandomizer}. @param seed the initial seed @param locale the locale to use @param safe true to generate safe emails (invalid domains), false otherwise @return a new {@link EmailRandomizer}
[ "Create", "a", "new", "{", "@link", "EmailRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-randomizers/src/main/java/org/jeasy/random/randomizers/EmailRandomizer.java#L114-L116
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java
JmxUtils.unregisterJMXBean
public static void unregisterJMXBean(ServletContext servletContext, String resourceType, String mBeanPrefix) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbs != null) { ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType, mBeanPrefix); // register the jawrApplicationConfigManager if it's not already // done ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix); if (mbs.isRegistered(appJawrMgrObjectName)) { mbs.unregisterMBean(appJawrMgrObjectName); } if (mbs.isRegistered(jawrConfigMgrObjName)) { mbs.unregisterMBean(jawrConfigMgrObjName); } } } catch (InstanceNotFoundException | MBeanRegistrationException e) { LOGGER.error("Unable to unregister the Jawr MBean for resource type '" + resourceType + "'", e); } }
java
public static void unregisterJMXBean(ServletContext servletContext, String resourceType, String mBeanPrefix) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbs != null) { ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType, mBeanPrefix); // register the jawrApplicationConfigManager if it's not already // done ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix); if (mbs.isRegistered(appJawrMgrObjectName)) { mbs.unregisterMBean(appJawrMgrObjectName); } if (mbs.isRegistered(jawrConfigMgrObjName)) { mbs.unregisterMBean(jawrConfigMgrObjName); } } } catch (InstanceNotFoundException | MBeanRegistrationException e) { LOGGER.error("Unable to unregister the Jawr MBean for resource type '" + resourceType + "'", e); } }
[ "public", "static", "void", "unregisterJMXBean", "(", "ServletContext", "servletContext", ",", "String", "resourceType", ",", "String", "mBeanPrefix", ")", "{", "try", "{", "MBeanServer", "mbs", "=", "ManagementFactory", ".", "getPlatformMBeanServer", "(", ")", ";",...
Unregister the JMX Bean @param servletContext the servlet context @param resourceType the resource type @param mBeanPrefix the mBeanPrefix
[ "Unregister", "the", "JMX", "Bean" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JmxUtils.java#L118-L144
ThreeTen/threetenbp
src/main/java/org/threeten/bp/zone/TzdbZoneRulesCompiler.java
TzdbZoneRulesCompiler.parseZoneLine
private boolean parseZoneLine(StringTokenizer st, List<TZDBZone> zoneList) { TZDBZone zone = new TZDBZone(); zoneList.add(zone); zone.standardOffset = parseOffset(st.nextToken()); String savingsRule = parseOptional(st.nextToken()); if (savingsRule == null) { zone.fixedSavingsSecs = 0; zone.savingsRule = null; } else { try { zone.fixedSavingsSecs = parsePeriod(savingsRule); zone.savingsRule = null; } catch (Exception ex) { zone.fixedSavingsSecs = null; zone.savingsRule = savingsRule; } } zone.text = st.nextToken(); if (st.hasMoreTokens()) { zone.year = Year.of(Integer.parseInt(st.nextToken())); if (st.hasMoreTokens()) { parseMonthDayTime(st, zone); } return false; } else { return true; } }
java
private boolean parseZoneLine(StringTokenizer st, List<TZDBZone> zoneList) { TZDBZone zone = new TZDBZone(); zoneList.add(zone); zone.standardOffset = parseOffset(st.nextToken()); String savingsRule = parseOptional(st.nextToken()); if (savingsRule == null) { zone.fixedSavingsSecs = 0; zone.savingsRule = null; } else { try { zone.fixedSavingsSecs = parsePeriod(savingsRule); zone.savingsRule = null; } catch (Exception ex) { zone.fixedSavingsSecs = null; zone.savingsRule = savingsRule; } } zone.text = st.nextToken(); if (st.hasMoreTokens()) { zone.year = Year.of(Integer.parseInt(st.nextToken())); if (st.hasMoreTokens()) { parseMonthDayTime(st, zone); } return false; } else { return true; } }
[ "private", "boolean", "parseZoneLine", "(", "StringTokenizer", "st", ",", "List", "<", "TZDBZone", ">", "zoneList", ")", "{", "TZDBZone", "zone", "=", "new", "TZDBZone", "(", ")", ";", "zoneList", ".", "add", "(", "zone", ")", ";", "zone", ".", "standard...
Parses a Zone line. @param st the tokenizer, not null @return true if the zone is complete
[ "Parses", "a", "Zone", "line", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/TzdbZoneRulesCompiler.java#L731-L758
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
DBIDUtil.internalIntersectionSize
private static int internalIntersectionSize(DBIDs first, DBIDs second) { second = second.size() > 16 && !(second instanceof SetDBIDs) ? newHashSet(second) : second; int c = 0; for(DBIDIter it = first.iter(); it.valid(); it.advance()) { if(second.contains(it)) { c++; } } return c; }
java
private static int internalIntersectionSize(DBIDs first, DBIDs second) { second = second.size() > 16 && !(second instanceof SetDBIDs) ? newHashSet(second) : second; int c = 0; for(DBIDIter it = first.iter(); it.valid(); it.advance()) { if(second.contains(it)) { c++; } } return c; }
[ "private", "static", "int", "internalIntersectionSize", "(", "DBIDs", "first", ",", "DBIDs", "second", ")", "{", "second", "=", "second", ".", "size", "(", ")", ">", "16", "&&", "!", "(", "second", "instanceof", "SetDBIDs", ")", "?", "newHashSet", "(", "...
Compute the set intersection size of two sets. @param first First set @param second Second set @return size
[ "Compute", "the", "set", "intersection", "size", "of", "two", "sets", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L354-L363
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java
MSPDITimephasedWorkNormaliser.validateSameDay
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
java
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
[ "private", "void", "validateSameDay", "(", "ProjectCalendar", "calendar", ",", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "Date", "assignmentStart", "=", "assignment", ".", "getS...
Ensures that the start and end dates for ranges fit within the working times for a given day. @param calendar current calendar @param list assignment data
[ "Ensures", "that", "the", "start", "and", "end", "dates", "for", "ranges", "fit", "within", "the", "working", "times", "for", "a", "given", "day", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java#L279-L309
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java
CrystalCell.transfToOrthonormal
public Matrix4d transfToOrthonormal(Matrix4d m) { Vector3d trans = new Vector3d(m.m03,m.m13,m.m23); transfToOrthonormal(trans); Matrix3d rot = new Matrix3d(); m.getRotationScale(rot); // see Giacovazzo section 2.E, eq. 2.E.1 // Rprime = MT-1 * R * MT rot.mul(this.getMTranspose()); rot.mul(this.getMTransposeInv(),rot); return new Matrix4d(rot,trans,1.0); }
java
public Matrix4d transfToOrthonormal(Matrix4d m) { Vector3d trans = new Vector3d(m.m03,m.m13,m.m23); transfToOrthonormal(trans); Matrix3d rot = new Matrix3d(); m.getRotationScale(rot); // see Giacovazzo section 2.E, eq. 2.E.1 // Rprime = MT-1 * R * MT rot.mul(this.getMTranspose()); rot.mul(this.getMTransposeInv(),rot); return new Matrix4d(rot,trans,1.0); }
[ "public", "Matrix4d", "transfToOrthonormal", "(", "Matrix4d", "m", ")", "{", "Vector3d", "trans", "=", "new", "Vector3d", "(", "m", ".", "m03", ",", "m", ".", "m13", ",", "m", ".", "m23", ")", ";", "transfToOrthonormal", "(", "trans", ")", ";", "Matrix...
Transform given Matrix4d in crystal basis to the orthonormal basis using the PDB axes convention (NCODE=1) @param m @return
[ "Transform", "given", "Matrix4d", "in", "crystal", "basis", "to", "the", "orthonormal", "basis", "using", "the", "PDB", "axes", "convention", "(", "NCODE", "=", "1", ")" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java#L280-L292
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.bucketSort
public static void bucketSort( int[] arr, int m ) { int[] count = new int[m]; int j, i = 0; //System.out.println(count[0]==0?"true":"false"); for ( j = 0; j < arr.length; j++ ) { count[ arr[j] ]++; } //loop and filter the elements for ( j = 0; j < m; j++ ) { if ( count[j] > 0 ) { while ( count[j]-- > 0 ) { arr[i++] = j; } } } }
java
public static void bucketSort( int[] arr, int m ) { int[] count = new int[m]; int j, i = 0; //System.out.println(count[0]==0?"true":"false"); for ( j = 0; j < arr.length; j++ ) { count[ arr[j] ]++; } //loop and filter the elements for ( j = 0; j < m; j++ ) { if ( count[j] > 0 ) { while ( count[j]-- > 0 ) { arr[i++] = j; } } } }
[ "public", "static", "void", "bucketSort", "(", "int", "[", "]", "arr", ",", "int", "m", ")", "{", "int", "[", "]", "count", "=", "new", "int", "[", "m", "]", ";", "int", "j", ",", "i", "=", "0", ";", "//System.out.println(count[0]==0?\"true\":\"false\"...
bucket sort algorithm @param arr an int array @param m the large-most one for all the Integers in arr
[ "bucket", "sort", "algorithm" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L356-L373
voldemort/voldemort
src/java/voldemort/rest/GetMetadataResponseSender.java
GetMetadataResponseSender.sendResponse
@Override public void sendResponse(StoreStats performanceStats, boolean isFromLocalZone, long startTimeInMs) throws Exception { ChannelBuffer responseContent = ChannelBuffers.dynamicBuffer(this.responseValue.length); responseContent.writeBytes(responseValue); // 1. Create the Response object HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK); // 2. Set the right headers response.setHeader(CONTENT_TYPE, "binary"); response.setHeader(CONTENT_TRANSFER_ENCODING, "binary"); // 3. Copy the data into the payload response.setContent(responseContent); response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes()); if(logger.isDebugEnabled()) { logger.debug("Response = " + response); } // Write the response to the Netty Channel this.messageEvent.getChannel().write(response); if(performanceStats != null && isFromLocalZone) { recordStats(performanceStats, startTimeInMs, Tracked.GET); } }
java
@Override public void sendResponse(StoreStats performanceStats, boolean isFromLocalZone, long startTimeInMs) throws Exception { ChannelBuffer responseContent = ChannelBuffers.dynamicBuffer(this.responseValue.length); responseContent.writeBytes(responseValue); // 1. Create the Response object HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK); // 2. Set the right headers response.setHeader(CONTENT_TYPE, "binary"); response.setHeader(CONTENT_TRANSFER_ENCODING, "binary"); // 3. Copy the data into the payload response.setContent(responseContent); response.setHeader(CONTENT_LENGTH, response.getContent().readableBytes()); if(logger.isDebugEnabled()) { logger.debug("Response = " + response); } // Write the response to the Netty Channel this.messageEvent.getChannel().write(response); if(performanceStats != null && isFromLocalZone) { recordStats(performanceStats, startTimeInMs, Tracked.GET); } }
[ "@", "Override", "public", "void", "sendResponse", "(", "StoreStats", "performanceStats", ",", "boolean", "isFromLocalZone", ",", "long", "startTimeInMs", ")", "throws", "Exception", "{", "ChannelBuffer", "responseContent", "=", "ChannelBuffers", ".", "dynamicBuffer", ...
Sends a normal HTTP response containing the serialization information in a XML format
[ "Sends", "a", "normal", "HTTP", "response", "containing", "the", "serialization", "information", "in", "a", "XML", "format" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/GetMetadataResponseSender.java#L33-L62
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_webstorage_serviceName_storage_duration_POST
public OvhOrder cdn_webstorage_serviceName_storage_duration_POST(String serviceName, String duration, OvhOrderStorageEnum storage) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/storage/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "storage", storage); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cdn_webstorage_serviceName_storage_duration_POST(String serviceName, String duration, OvhOrderStorageEnum storage) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/storage/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "storage", storage); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cdn_webstorage_serviceName_storage_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhOrderStorageEnum", "storage", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/webstorage/{serviceName}/storage/{d...
Create order REST: POST /order/cdn/webstorage/{serviceName}/storage/{duration} @param storage [required] Storage option that will be ordered @param serviceName [required] The internal name of your CDN Static offer @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5498-L5505
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromPublisher
public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<? extends ServerSentEvent> contentPublisher, HttpHeaders trailingHeaders) { requireNonNull(headers, "headers"); requireNonNull(contentPublisher, "contentPublisher"); requireNonNull(trailingHeaders, "trailingHeaders"); return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders, ServerSentEvents::toHttpData); }
java
public static HttpResponse fromPublisher(HttpHeaders headers, Publisher<? extends ServerSentEvent> contentPublisher, HttpHeaders trailingHeaders) { requireNonNull(headers, "headers"); requireNonNull(contentPublisher, "contentPublisher"); requireNonNull(trailingHeaders, "trailingHeaders"); return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders, ServerSentEvents::toHttpData); }
[ "public", "static", "HttpResponse", "fromPublisher", "(", "HttpHeaders", "headers", ",", "Publisher", "<", "?", "extends", "ServerSentEvent", ">", "contentPublisher", ",", "HttpHeaders", "trailingHeaders", ")", "{", "requireNonNull", "(", "headers", ",", "\"headers\""...
Creates a new Server-Sent Events stream from the specified {@link Publisher}. @param headers the HTTP headers supposed to send @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Publisher", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L109-L117
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageHandleFactoryImpl.java
JsMessageHandleFactoryImpl.createJsMessageHandle
public final JsMessageHandle createJsMessageHandle(SIBUuid8 uuid ,long value ) throws NullPointerException { if (uuid == null) { throw new NullPointerException("uuid"); } return new JsMessageHandleImpl(uuid, Long.valueOf(value)); }
java
public final JsMessageHandle createJsMessageHandle(SIBUuid8 uuid ,long value ) throws NullPointerException { if (uuid == null) { throw new NullPointerException("uuid"); } return new JsMessageHandleImpl(uuid, Long.valueOf(value)); }
[ "public", "final", "JsMessageHandle", "createJsMessageHandle", "(", "SIBUuid8", "uuid", ",", "long", "value", ")", "throws", "NullPointerException", "{", "if", "(", "uuid", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"uuid\"", ")", ";"...
Create a new JsMessageHandle to represent an SIBusMessage. @param destinationName The name of the SIBus Destination @param localOnly Indicates that the Destination should be localized to the local Messaging Engine. @return JsMessageHandle The new JsMessageHandle. @exception NullPointerException Thrown if either parameter is null.
[ "Create", "a", "new", "JsMessageHandle", "to", "represent", "an", "SIBusMessage", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageHandleFactoryImpl.java#L47-L56
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FilterFileSystem.java
FilterFileSystem.startLocalOutput
public Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { return fs.startLocalOutput(fsOutputFile, tmpLocalFile); }
java
public Path startLocalOutput(Path fsOutputFile, Path tmpLocalFile) throws IOException { return fs.startLocalOutput(fsOutputFile, tmpLocalFile); }
[ "public", "Path", "startLocalOutput", "(", "Path", "fsOutputFile", ",", "Path", "tmpLocalFile", ")", "throws", "IOException", "{", "return", "fs", ".", "startLocalOutput", "(", "fsOutputFile", ",", "tmpLocalFile", ")", ";", "}" ]
Returns a local File that the user can write output to. The caller provides both the eventual FS target name and the local working file. If the FS is local, we write directly into the target. If the FS is remote, we write into the tmp local area.
[ "Returns", "a", "local", "File", "that", "the", "user", "can", "write", "output", "to", ".", "The", "caller", "provides", "both", "the", "eventual", "FS", "target", "name", "and", "the", "local", "working", "file", ".", "If", "the", "FS", "is", "local", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FilterFileSystem.java#L354-L357
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayScriptInContext
@Deprecated public static String getDisplayScriptInContext(String localeID, ULocale displayLocale) { return getDisplayScriptInContextInternal(new ULocale(localeID), displayLocale); }
java
@Deprecated public static String getDisplayScriptInContext(String localeID, ULocale displayLocale) { return getDisplayScriptInContextInternal(new ULocale(localeID), displayLocale); }
[ "@", "Deprecated", "public", "static", "String", "getDisplayScriptInContext", "(", "String", "localeID", ",", "ULocale", "displayLocale", ")", "{", "return", "getDisplayScriptInContextInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "displayLocale", ")", ...
<strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. @param localeID the id of the locale whose script will be displayed. @param displayLocale the locale in which to display the name. @return the localized script name. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "script", "localized", "for", "display", "in", "the", "provided", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1546-L1549
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.getThis
public <T> Local<T> getThis(TypeId<T> type) { if (thisLocal == null) { throw new IllegalStateException("static methods cannot access 'this'"); } return coerce(thisLocal, type); }
java
public <T> Local<T> getThis(TypeId<T> type) { if (thisLocal == null) { throw new IllegalStateException("static methods cannot access 'this'"); } return coerce(thisLocal, type); }
[ "public", "<", "T", ">", "Local", "<", "T", ">", "getThis", "(", "TypeId", "<", "T", ">", "type", ")", "{", "if", "(", "thisLocal", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"static methods cannot access 'this'\"", ")", ";", ...
Returns the local for {@code this} of type {@code type}. It is an error to call {@code getThis()} if this is a static method.
[ "Returns", "the", "local", "for", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L254-L259
square/okhttp
okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.java
CacheStrategy.isCacheable
public static boolean isCacheable(Response response, Request request) { // Always go to network for uncacheable response codes (RFC 7231 section 6.1), // This implementation doesn't support caching partial content. switch (response.code()) { case HTTP_OK: case HTTP_NOT_AUTHORITATIVE: case HTTP_NO_CONTENT: case HTTP_MULT_CHOICE: case HTTP_MOVED_PERM: case HTTP_NOT_FOUND: case HTTP_BAD_METHOD: case HTTP_GONE: case HTTP_REQ_TOO_LONG: case HTTP_NOT_IMPLEMENTED: case StatusLine.HTTP_PERM_REDIRECT: // These codes can be cached unless headers forbid it. break; case HTTP_MOVED_TEMP: case StatusLine.HTTP_TEMP_REDIRECT: // These codes can only be cached with the right response headers. // http://tools.ietf.org/html/rfc7234#section-3 // s-maxage is not checked because OkHttp is a private cache that should ignore s-maxage. if (response.header("Expires") != null || response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) { break; } // Fall-through. default: // All other codes cannot be cached. return false; } // A 'no-store' directive on request or response prevents the response from being cached. return !response.cacheControl().noStore() && !request.cacheControl().noStore(); }
java
public static boolean isCacheable(Response response, Request request) { // Always go to network for uncacheable response codes (RFC 7231 section 6.1), // This implementation doesn't support caching partial content. switch (response.code()) { case HTTP_OK: case HTTP_NOT_AUTHORITATIVE: case HTTP_NO_CONTENT: case HTTP_MULT_CHOICE: case HTTP_MOVED_PERM: case HTTP_NOT_FOUND: case HTTP_BAD_METHOD: case HTTP_GONE: case HTTP_REQ_TOO_LONG: case HTTP_NOT_IMPLEMENTED: case StatusLine.HTTP_PERM_REDIRECT: // These codes can be cached unless headers forbid it. break; case HTTP_MOVED_TEMP: case StatusLine.HTTP_TEMP_REDIRECT: // These codes can only be cached with the right response headers. // http://tools.ietf.org/html/rfc7234#section-3 // s-maxage is not checked because OkHttp is a private cache that should ignore s-maxage. if (response.header("Expires") != null || response.cacheControl().maxAgeSeconds() != -1 || response.cacheControl().isPublic() || response.cacheControl().isPrivate()) { break; } // Fall-through. default: // All other codes cannot be cached. return false; } // A 'no-store' directive on request or response prevents the response from being cached. return !response.cacheControl().noStore() && !request.cacheControl().noStore(); }
[ "public", "static", "boolean", "isCacheable", "(", "Response", "response", ",", "Request", "request", ")", "{", "// Always go to network for uncacheable response codes (RFC 7231 section 6.1),", "// This implementation doesn't support caching partial content.", "switch", "(", "respons...
Returns true if {@code response} can be stored to later serve another request.
[ "Returns", "true", "if", "{" ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/cache/CacheStrategy.java#L63-L101
sagiegurari/fax4j
src/main/java/org/fax4j/util/IOHelper.java
IOHelper.writeFile
public static void writeFile(byte[] content,File file) throws IOException { OutputStream outputStream=null; try { //create output stream to file outputStream=new FileOutputStream(file); //write to file outputStream.write(content); } finally { //close writer IOHelper.closeResource(outputStream); } }
java
public static void writeFile(byte[] content,File file) throws IOException { OutputStream outputStream=null; try { //create output stream to file outputStream=new FileOutputStream(file); //write to file outputStream.write(content); } finally { //close writer IOHelper.closeResource(outputStream); } }
[ "public", "static", "void", "writeFile", "(", "byte", "[", "]", "content", ",", "File", "file", ")", "throws", "IOException", "{", "OutputStream", "outputStream", "=", "null", ";", "try", "{", "//create output stream to file", "outputStream", "=", "new", "FileOu...
Writes the content to the file. @param content The content to write to the provided file @param file The target file @throws IOException Any IO exception
[ "Writes", "the", "content", "to", "the", "file", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/IOHelper.java#L463-L479
primefaces/primefaces
src/main/java/org/primefaces/component/importconstants/ImportConstantsTagHandler.java
ImportConstantsTagHandler.getClassFromAttribute
protected Class<?> getClassFromAttribute(TagAttribute attribute, FaceletContext ctx) { String type = attribute.getValue(ctx); try { return LangUtils.loadClassForName(type); } catch (ClassNotFoundException e) { throw new FacesException("Class " + type + " not found.", e); } }
java
protected Class<?> getClassFromAttribute(TagAttribute attribute, FaceletContext ctx) { String type = attribute.getValue(ctx); try { return LangUtils.loadClassForName(type); } catch (ClassNotFoundException e) { throw new FacesException("Class " + type + " not found.", e); } }
[ "protected", "Class", "<", "?", ">", "getClassFromAttribute", "(", "TagAttribute", "attribute", ",", "FaceletContext", "ctx", ")", "{", "String", "type", "=", "attribute", ".", "getValue", "(", "ctx", ")", ";", "try", "{", "return", "LangUtils", ".", "loadCl...
Gets the {@link Class} from the {@link TagAttribute}. @param attribute The {@link TagAttribute}. @param ctx The {@link FaceletContext}. @return The {@link Class}.
[ "Gets", "the", "{", "@link", "Class", "}", "from", "the", "{", "@link", "TagAttribute", "}", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/component/importconstants/ImportConstantsTagHandler.java#L86-L95
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java
BermudanSwaptionFromSwapSchedules.getConditionalExpectationEstimator
public ConditionalExpectationEstimator getConditionalExpectationEstimator(double exerciseTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { RandomVariable[] regressionBasisFunctions = regressionBasisFunctionProvider.getBasisFunctions(exerciseTime, model); return conditionalExpectationRegressionFactory.getConditionalExpectationEstimator(regressionBasisFunctions, regressionBasisFunctions); }
java
public ConditionalExpectationEstimator getConditionalExpectationEstimator(double exerciseTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { RandomVariable[] regressionBasisFunctions = regressionBasisFunctionProvider.getBasisFunctions(exerciseTime, model); return conditionalExpectationRegressionFactory.getConditionalExpectationEstimator(regressionBasisFunctions, regressionBasisFunctions); }
[ "public", "ConditionalExpectationEstimator", "getConditionalExpectationEstimator", "(", "double", "exerciseTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "RandomVariable", "[", "]", "regressionBasisFunctions", "=", "regress...
The conditional expectation is calculated using a Monte-Carlo regression technique. @param exerciseTime The exercise time @param model The valuation model @return The condition expectation estimator @throws CalculationException Thrown if underlying model failed to calculate stochastic process.
[ "The", "conditional", "expectation", "is", "calculated", "using", "a", "Monte", "-", "Carlo", "regression", "technique", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/BermudanSwaptionFromSwapSchedules.java#L324-L327
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java
ApnsPayloadBuilder.addCustomProperty
public ApnsPayloadBuilder addCustomProperty(final String key, final Object value) { this.customProperties.put(key, value); return this; }
java
public ApnsPayloadBuilder addCustomProperty(final String key, final Object value) { this.customProperties.put(key, value); return this; }
[ "public", "ApnsPayloadBuilder", "addCustomProperty", "(", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "this", ".", "customProperties", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
<p>Adds a custom property to the payload. According to Apple's documentation:</p> <blockquote>Providers can specify custom payload values outside the Apple-reserved {@code aps} namespace. Custom values must use the JSON structured and primitive types: dictionary (object), array, string, number, and Boolean. You should not include customer information (or any sensitive data) as custom payload data. Instead, use it for such purposes as setting context (for the user interface) or internal metrics. For example, a custom payload value might be a conversation identifier for use by an instant-message client application or a timestamp identifying when the provider sent the notification. Any action associated with an alert message should not be destructive—for example, it should not delete data on the device.</blockquote> <p>The value for the property is serialized to JSON by <a href="https://github.com/google/gson">Gson</a>. For a detailed explanation of how Gson serializes Java objects to JSON, please see the <a href="https://github.com/google/gson/blob/master/UserGuide.md#TOC-Using-Gson">Gson User Guide</a>.</p> @param key the key of the custom property in the payload object @param value the value of the custom property @return a reference to this payload builder @see Gson#toJson(Object) @see <a href="https://github.com/google/gson/blob/master/UserGuide.md#TOC-Using-Gson">Gson User Guide - Using Gson</a>
[ "<p", ">", "Adds", "a", "custom", "property", "to", "the", "payload", ".", "According", "to", "Apple", "s", "documentation", ":", "<", "/", "p", ">" ]
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java#L680-L683
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/DummySSLSocketFactory.java
DummySSLSocketFactory.trySetFakeRemoteHost
private static void trySetFakeRemoteHost(Socket socket) { try { final Method setHostMethod = socket.getClass().getMethod("setHost", String.class); String fakeHostName = "greenmailHost" + new BigInteger(130, new Random()).toString(32); setHostMethod.invoke(socket, fakeHostName); } catch (NoSuchMethodException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } catch (InvocationTargetException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } catch (IllegalAccessException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } }
java
private static void trySetFakeRemoteHost(Socket socket) { try { final Method setHostMethod = socket.getClass().getMethod("setHost", String.class); String fakeHostName = "greenmailHost" + new BigInteger(130, new Random()).toString(32); setHostMethod.invoke(socket, fakeHostName); } catch (NoSuchMethodException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } catch (InvocationTargetException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } catch (IllegalAccessException e) { log.debug("Could not set fake remote host. SSL connection setup may be slow."); } }
[ "private", "static", "void", "trySetFakeRemoteHost", "(", "Socket", "socket", ")", "{", "try", "{", "final", "Method", "setHostMethod", "=", "socket", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"setHost\"", ",", "String", ".", "class", ")", ";", "...
We set the host name of the remote machine because otherwise the SSL implementation is going to try to try to do a reverse lookup to find out the host name for the host which is really slow. Of course we don't know the host name of the remote machine so we just set a fake host name that is unique. <p/> This forces the SSL stack to do key negotiation every time we connect to a host but is still much faster than doing the reverse hostname lookup. The negotiation is caused by the fact that the SSL stack remembers a trust relationship with a host. If we connect to the same host twice this relationship is reused. Since we set the host name to a random value this reuse never happens. @param socket Socket to set host on
[ "We", "set", "the", "host", "name", "of", "the", "remote", "machine", "because", "otherwise", "the", "SSL", "implementation", "is", "going", "to", "try", "to", "try", "to", "do", "a", "reverse", "lookup", "to", "find", "out", "the", "host", "name", "for"...
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/DummySSLSocketFactory.java#L123-L135
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfDocument.java
PdfDocument.remoteGoto
void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury) { addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, new PdfAction(filename, page))); }
java
void remoteGoto(String filename, int page, float llx, float lly, float urx, float ury) { addAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, new PdfAction(filename, page))); }
[ "void", "remoteGoto", "(", "String", "filename", ",", "int", "page", ",", "float", "llx", ",", "float", "lly", ",", "float", "urx", ",", "float", "ury", ")", "{", "addAnnotation", "(", "new", "PdfAnnotation", "(", "writer", ",", "llx", ",", "lly", ",",...
Implements a link to another document. @param filename the filename for the remote document @param page the page to jump to @param llx the lower left x corner of the activation area @param lly the lower left y corner of the activation area @param urx the upper right x corner of the activation area @param ury the upper right y corner of the activation area
[ "Implements", "a", "link", "to", "another", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2040-L2042
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.writeFile
public OutputStream writeFile(@NotNull final Transaction txn, @NotNull final File file) { return new VfsOutputStream(this, txn, file.getDescriptor(), new LastModifiedTrigger(txn, file, pathnames)); }
java
public OutputStream writeFile(@NotNull final Transaction txn, @NotNull final File file) { return new VfsOutputStream(this, txn, file.getDescriptor(), new LastModifiedTrigger(txn, file, pathnames)); }
[ "public", "OutputStream", "writeFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "File", "file", ")", "{", "return", "new", "VfsOutputStream", "(", "this", ",", "txn", ",", "file", ".", "getDescriptor", "(", ")", ","...
Returns {@linkplain OutputStream} to write the contents of the specified file from the beginning. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @return {@linkplain OutputStream} to write the contents of the specified file from the beginning @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #appendFile(Transaction, File) @see #touchFile(Transaction, File)
[ "Returns", "{", "@linkplain", "OutputStream", "}", "to", "write", "the", "contents", "of", "the", "specified", "file", "from", "the", "beginning", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L494-L496
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/QueryFactory.java
QueryFactory.addCriteriaForOjbConcreteClasses
private static Criteria addCriteriaForOjbConcreteClasses(ClassDescriptor cld, Criteria crit) { /** * 1. check if this class has a ojbConcreteClass attribute */ Criteria concreteClassDiscriminator = null; Collection classes = getExtentClasses(cld); /** * 1. create a new Criteria for objConcreteClass */ if (!classes.isEmpty()) { concreteClassDiscriminator = new Criteria(); if (classes.size() > 1) { concreteClassDiscriminator = new Criteria(); concreteClassDiscriminator.addIn(ClassDescriptor.OJB_CONCRETE_CLASS, classes); } else { concreteClassDiscriminator.addEqualTo(ClassDescriptor.OJB_CONCRETE_CLASS, classes.toArray()[0]); } } /** * 2. only add the AND (objConcreteClass = "some.class" OR....) if we've actually found concrete * classes. */ if (concreteClassDiscriminator != null) { /** * it's possible there is no criteria attached to the query, and in this * case we still have to add the IN/EqualTo criteria for the concrete class type * so check if the crit is null and then create a blank one if needed. */ if (crit == null) { crit = new Criteria(); } crit.addAndCriteria(concreteClassDiscriminator); } /** * will just return the passed in criteria if no OJB concrete class is attribute is found. */ return crit; }
java
private static Criteria addCriteriaForOjbConcreteClasses(ClassDescriptor cld, Criteria crit) { /** * 1. check if this class has a ojbConcreteClass attribute */ Criteria concreteClassDiscriminator = null; Collection classes = getExtentClasses(cld); /** * 1. create a new Criteria for objConcreteClass */ if (!classes.isEmpty()) { concreteClassDiscriminator = new Criteria(); if (classes.size() > 1) { concreteClassDiscriminator = new Criteria(); concreteClassDiscriminator.addIn(ClassDescriptor.OJB_CONCRETE_CLASS, classes); } else { concreteClassDiscriminator.addEqualTo(ClassDescriptor.OJB_CONCRETE_CLASS, classes.toArray()[0]); } } /** * 2. only add the AND (objConcreteClass = "some.class" OR....) if we've actually found concrete * classes. */ if (concreteClassDiscriminator != null) { /** * it's possible there is no criteria attached to the query, and in this * case we still have to add the IN/EqualTo criteria for the concrete class type * so check if the crit is null and then create a blank one if needed. */ if (crit == null) { crit = new Criteria(); } crit.addAndCriteria(concreteClassDiscriminator); } /** * will just return the passed in criteria if no OJB concrete class is attribute is found. */ return crit; }
[ "private", "static", "Criteria", "addCriteriaForOjbConcreteClasses", "(", "ClassDescriptor", "cld", ",", "Criteria", "crit", ")", "{", "/**\r\n * 1. check if this class has a ojbConcreteClass attribute\r\n */", "Criteria", "concreteClassDiscriminator", "=", "null", ...
Searches the class descriptor for the ojbConcrete class attribute if it finds the concrete class attribute, append a where clause which specifies we can load all classes that are this type or extents of this type. @param cld @param crit @return the passed in Criteria object + optionally and'ed criteria with OR'd class type discriminators.
[ "Searches", "the", "class", "descriptor", "for", "the", "ojbConcrete", "class", "attribute", "if", "it", "finds", "the", "concrete", "class", "attribute", "append", "a", "where", "clause", "which", "specifies", "we", "can", "load", "all", "classes", "that", "a...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/QueryFactory.java#L216-L263
JDBDT/jdbdt
src/main/java/org/jdbdt/DataSource.java
DataSource.theEmptySet
final DataSet theEmptySet() { if (theEmptyOne == null) { theEmptyOne = new DataSet(this, EMPTY_ROW_LIST); theEmptyOne.setReadOnly(); } return theEmptyOne; }
java
final DataSet theEmptySet() { if (theEmptyOne == null) { theEmptyOne = new DataSet(this, EMPTY_ROW_LIST); theEmptyOne.setReadOnly(); } return theEmptyOne; }
[ "final", "DataSet", "theEmptySet", "(", ")", "{", "if", "(", "theEmptyOne", "==", "null", ")", "{", "theEmptyOne", "=", "new", "DataSet", "(", "this", ",", "EMPTY_ROW_LIST", ")", ";", "theEmptyOne", ".", "setReadOnly", "(", ")", ";", "}", "return", "theE...
Return an empty, read-only data set, for use by {@link JDBDT#empty(DataSource)} @return Empty, read-only data set.
[ "Return", "an", "empty", "read", "-", "only", "data", "set", "for", "use", "by", "{" ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DataSource.java#L188-L194
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/client/DrpcRequestClient.java
DrpcRequestClient.createClient
protected DRPCClient createClient(String host, int port, int timeout) { return new DRPCClient(host, port, timeout); }
java
protected DRPCClient createClient(String host, int port, int timeout) { return new DRPCClient(host, port, timeout); }
[ "protected", "DRPCClient", "createClient", "(", "String", "host", ",", "int", "port", ",", "int", "timeout", ")", "{", "return", "new", "DRPCClient", "(", "host", ",", "port", ",", "timeout", ")", ";", "}" ]
DRPCClientを生成する。 @param host DRPCServerホスト @param port DRPCServerポート @param timeout DRPCタイムアウト(ミリ秒単位) @return DRPCClient
[ "DRPCClientを生成する。" ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/client/DrpcRequestClient.java#L168-L171
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java
ProjDepTreeFactor.addMsgs
private void addMsgs(VarTensor[] msgs, Tensor t, int tf) { assert msgs[0].getAlgebra().equals(t.getAlgebra()); EdgeScores es = EdgeScores.tensorToEdgeScores(t); for (VarTensor msg : msgs) { LinkVar link = (LinkVar) msg.getVars().get(0); double val = es.getScore(link.getParent(), link.getChild()); msg.addValue(tf, val); } }
java
private void addMsgs(VarTensor[] msgs, Tensor t, int tf) { assert msgs[0].getAlgebra().equals(t.getAlgebra()); EdgeScores es = EdgeScores.tensorToEdgeScores(t); for (VarTensor msg : msgs) { LinkVar link = (LinkVar) msg.getVars().get(0); double val = es.getScore(link.getParent(), link.getChild()); msg.addValue(tf, val); } }
[ "private", "void", "addMsgs", "(", "VarTensor", "[", "]", "msgs", ",", "Tensor", "t", ",", "int", "tf", ")", "{", "assert", "msgs", "[", "0", "]", ".", "getAlgebra", "(", ")", ".", "equals", "(", "t", ".", "getAlgebra", "(", ")", ")", ";", "EdgeS...
Adds to messages on a Messages[]. @param msgs The output messages. @param t The input messages. @param tf Whether to set TRUE or FALSE messages.
[ "Adds", "to", "messages", "on", "a", "Messages", "[]", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java#L318-L326
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.getByResourceGroup
public ExpressRouteCircuitInner getByResourceGroup(String resourceGroupName, String circuitName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).toBlocking().single().body(); }
java
public ExpressRouteCircuitInner getByResourceGroup(String resourceGroupName, String circuitName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).toBlocking().single().body(); }
[ "public", "ExpressRouteCircuitInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "circuitName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ")", ".", "toBlocking", "(", ")", ...
Gets information about the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of express route circuit. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCircuitInner object if successful.
[ "Gets", "information", "about", "the", "specified", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L310-L312
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java
CPDAvailabilityEstimatePersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDAvailabilityEstimate cpdAvailabilityEstimate : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpdAvailabilityEstimate); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDAvailabilityEstimate cpdAvailabilityEstimate : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpdAvailabilityEstimate); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPDAvailabilityEstimate", "cpdAvailabilityEstimate", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ...
Removes all the cpd availability estimates where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cpd", "availability", "estimates", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java#L1416-L1422
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONCompare.java
JSONCompare.compareJSON
public static JSONCompareResult compareJSON(JSONArray expected, JSONArray actual, JSONComparator comparator) throws JSONException { return comparator.compareJSON(expected, actual); }
java
public static JSONCompareResult compareJSON(JSONArray expected, JSONArray actual, JSONComparator comparator) throws JSONException { return comparator.compareJSON(expected, actual); }
[ "public", "static", "JSONCompareResult", "compareJSON", "(", "JSONArray", "expected", ",", "JSONArray", "actual", ",", "JSONComparator", "comparator", ")", "throws", "JSONException", "{", "return", "comparator", ".", "compareJSON", "(", "expected", ",", "actual", ")...
Compares JSON object provided to the expected JSON object using provided comparator, and returns the results of the comparison. @param expected expected json array @param actual actual json array @param comparator comparator to use @return result of the comparison @throws JSONException JSON parsing error
[ "Compares", "JSON", "object", "provided", "to", "the", "expected", "JSON", "object", "using", "provided", "comparator", "and", "returns", "the", "results", "of", "the", "comparison", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONCompare.java#L91-L94
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/ChatApi.java
ChatApi.sendCustomNotification
public ApiSuccessResponse sendCustomNotification(String id, CustomNotificationData customNotificationData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendCustomNotificationWithHttpInfo(id, customNotificationData); return resp.getData(); }
java
public ApiSuccessResponse sendCustomNotification(String id, CustomNotificationData customNotificationData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendCustomNotificationWithHttpInfo(id, customNotificationData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "sendCustomNotification", "(", "String", "id", ",", "CustomNotificationData", "customNotificationData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "sendCustomNotificationWithHttpInfo", "(", ...
Send a custom notification Send a custom notification to the specified chat. The notification is typically used as a trigger for some custom behavior on the recipient&#39;s end. @param id The ID of the chat interaction. (required) @param customNotificationData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "a", "custom", "notification", "Send", "a", "custom", "notification", "to", "the", "specified", "chat", ".", "The", "notification", "is", "typically", "used", "as", "a", "trigger", "for", "some", "custom", "behavior", "on", "the", "recipient&#39", ";",...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1445-L1448
kiswanij/jk-util
src/main/java/com/jk/util/model/table/JKDefaultTableModel.java
JKDefaultTableModel.insertRow
public void insertRow(final int row, final Vector rowData) { this.dataVector.insertElementAt(rowData, row); justifyRows(row, row + 1); fireTableRowsInserted(row, row); }
java
public void insertRow(final int row, final Vector rowData) { this.dataVector.insertElementAt(rowData, row); justifyRows(row, row + 1); fireTableRowsInserted(row, row); }
[ "public", "void", "insertRow", "(", "final", "int", "row", ",", "final", "Vector", "rowData", ")", "{", "this", ".", "dataVector", ".", "insertElementAt", "(", "rowData", ",", "row", ")", ";", "justifyRows", "(", "row", ",", "row", "+", "1", ")", ";", ...
Inserts a row at <code>row</code> in the model. The new row will contain <code>null</code> values unless <code>rowData</code> is specified. Notification of the row being added will be generated. @param row the row index of the row to be inserted @param rowData optional data of the row being added @exception ArrayIndexOutOfBoundsException if the row was invalid
[ "Inserts", "a", "row", "at", "<code", ">", "row<", "/", "code", ">", "in", "the", "model", ".", "The", "new", "row", "will", "contain", "<code", ">", "null<", "/", "code", ">", "values", "unless", "<code", ">", "rowData<", "/", "code", ">", "is", "...
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L437-L441