repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/TelescopeFileProvider.java
TelescopeFileProvider.getUriForFile
public static Uri getUriForFile(Context context, File file) { """ Calls {@link #getUriForFile(Context, String, File)} using the correct authority for Telescope screenshots. """ return getUriForFile(context, context.getPackageName() + ".telescope.fileprovider", file); }
java
public static Uri getUriForFile(Context context, File file) { return getUriForFile(context, context.getPackageName() + ".telescope.fileprovider", file); }
[ "public", "static", "Uri", "getUriForFile", "(", "Context", "context", ",", "File", "file", ")", "{", "return", "getUriForFile", "(", "context", ",", "context", ".", "getPackageName", "(", ")", "+", "\".telescope.fileprovider\"", ",", "file", ")", ";", "}" ]
Calls {@link #getUriForFile(Context, String, File)} using the correct authority for Telescope screenshots.
[ "Calls", "{" ]
train
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/TelescopeFileProvider.java#L12-L14
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/BitmapUtil.java
BitmapUtil.clipSquare
public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size, final int borderWidth, @ColorInt final int borderColor) { """ Clips the long edge of a bitmap, if its width and height are not equal, in order to transform it into a square. Additionally, the bitmap is resized to a specific size and a border will be added. @param bitmap The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The bitmap may not be null @param size The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The size must be at least 1 @param borderWidth The width of the border as an {@link Integer} value in pixels. The width must be at least 0 @param borderColor The color of the border as an {@link Integer} value @return The clipped bitmap as an instance of the class {@link Bitmap} """ Condition.INSTANCE.ensureAtLeast(borderWidth, 0, "The border width must be at least 0"); Bitmap clippedBitmap = clipSquare(bitmap, size); Bitmap result = Bitmap.createBitmap(clippedBitmap.getWidth(), clippedBitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); float offset = borderWidth / 2.0f; Rect src = new Rect(0, 0, clippedBitmap.getWidth(), clippedBitmap.getHeight()); RectF dst = new RectF(offset, offset, result.getWidth() - offset, result.getHeight() - offset); canvas.drawBitmap(clippedBitmap, src, dst, null); if (borderWidth > 0 && Color.alpha(borderColor) != 0) { Paint paint = new Paint(); paint.setFilterBitmap(false); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(borderWidth); paint.setColor(borderColor); offset = borderWidth / 2.0f; RectF bounds = new RectF(offset, offset, result.getWidth() - offset, result.getWidth() - offset); canvas.drawRect(bounds, paint); } return result; }
java
public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size, final int borderWidth, @ColorInt final int borderColor) { Condition.INSTANCE.ensureAtLeast(borderWidth, 0, "The border width must be at least 0"); Bitmap clippedBitmap = clipSquare(bitmap, size); Bitmap result = Bitmap.createBitmap(clippedBitmap.getWidth(), clippedBitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); float offset = borderWidth / 2.0f; Rect src = new Rect(0, 0, clippedBitmap.getWidth(), clippedBitmap.getHeight()); RectF dst = new RectF(offset, offset, result.getWidth() - offset, result.getHeight() - offset); canvas.drawBitmap(clippedBitmap, src, dst, null); if (borderWidth > 0 && Color.alpha(borderColor) != 0) { Paint paint = new Paint(); paint.setFilterBitmap(false); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(borderWidth); paint.setColor(borderColor); offset = borderWidth / 2.0f; RectF bounds = new RectF(offset, offset, result.getWidth() - offset, result.getWidth() - offset); canvas.drawRect(bounds, paint); } return result; }
[ "public", "static", "Bitmap", "clipSquare", "(", "@", "NonNull", "final", "Bitmap", "bitmap", ",", "final", "int", "size", ",", "final", "int", "borderWidth", ",", "@", "ColorInt", "final", "int", "borderColor", ")", "{", "Condition", ".", "INSTANCE", ".", ...
Clips the long edge of a bitmap, if its width and height are not equal, in order to transform it into a square. Additionally, the bitmap is resized to a specific size and a border will be added. @param bitmap The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The bitmap may not be null @param size The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The size must be at least 1 @param borderWidth The width of the border as an {@link Integer} value in pixels. The width must be at least 0 @param borderColor The color of the border as an {@link Integer} value @return The clipped bitmap as an instance of the class {@link Bitmap}
[ "Clips", "the", "long", "edge", "of", "a", "bitmap", "if", "its", "width", "and", "height", "are", "not", "equal", "in", "order", "to", "transform", "it", "into", "a", "square", ".", "Additionally", "the", "bitmap", "is", "resized", "to", "a", "specific"...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L311-L337
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLib.java
TagLib.setELClass
protected void setELClass(String eLClass, Identification id, Attributes attributes) { """ Fuegt der TagLib die Evaluator Klassendefinition als Zeichenkette hinzu. Diese Methode wird durch die Klasse TagLibFactory verwendet. @param eLClass Zeichenkette der Evaluator Klassendefinition. """ this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes); }
java
protected void setELClass(String eLClass, Identification id, Attributes attributes) { this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes); }
[ "protected", "void", "setELClass", "(", "String", "eLClass", ",", "Identification", "id", ",", "Attributes", "attributes", ")", "{", "this", ".", "ELClass", "=", "ClassDefinitionImpl", ".", "toClassDefinition", "(", "eLClass", ",", "id", ",", "attributes", ")", ...
Fuegt der TagLib die Evaluator Klassendefinition als Zeichenkette hinzu. Diese Methode wird durch die Klasse TagLibFactory verwendet. @param eLClass Zeichenkette der Evaluator Klassendefinition.
[ "Fuegt", "der", "TagLib", "die", "Evaluator", "Klassendefinition", "als", "Zeichenkette", "hinzu", ".", "Diese", "Methode", "wird", "durch", "die", "Klasse", "TagLibFactory", "verwendet", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L244-L246
apereo/cas
support/cas-server-support-throttle-core/src/main/java/org/apereo/cas/web/support/AbstractThrottledSubmissionHandlerInterceptorAdapter.java
AbstractThrottledSubmissionHandlerInterceptorAdapter.throttleRequest
protected boolean throttleRequest(final HttpServletRequest request, final HttpServletResponse response) { """ Is request throttled. @param request the request @param response the response @return true if the request is throttled. False otherwise, letting it proceed. """ return configurationContext.getThrottledRequestExecutor() != null && configurationContext.getThrottledRequestExecutor().throttle(request, response); }
java
protected boolean throttleRequest(final HttpServletRequest request, final HttpServletResponse response) { return configurationContext.getThrottledRequestExecutor() != null && configurationContext.getThrottledRequestExecutor().throttle(request, response); }
[ "protected", "boolean", "throttleRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "{", "return", "configurationContext", ".", "getThrottledRequestExecutor", "(", ")", "!=", "null", "&&", "configurationContext",...
Is request throttled. @param request the request @param response the response @return true if the request is throttled. False otherwise, letting it proceed.
[ "Is", "request", "throttled", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-throttle-core/src/main/java/org/apereo/cas/web/support/AbstractThrottledSubmissionHandlerInterceptorAdapter.java#L86-L89
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java
RequiredParameters.applyTo
public ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException { """ Check for all required parameters defined: - has a value been passed - if not, does the parameter have an associated default value - does the type of the parameter match the one defined in RequiredParameters - does the value provided in the parameterTool adhere to the choices defined in the option. <p>If any check fails, a RequiredParametersException is thrown @param parameterTool - parameters supplied by the user. @return the updated ParameterTool containing all the required parameters @throws RequiredParametersException if any of the specified checks fail """ List<String> missingArguments = new LinkedList<>(); HashMap<String, String> newParameters = new HashMap<>(parameterTool.toMap()); for (Option o : data.values()) { if (newParameters.containsKey(o.getName())) { if (Objects.equals(newParameters.get(o.getName()), ParameterTool.NO_VALUE_KEY)) { // the parameter has been passed, but no value, check if there is a default value checkAndApplyDefaultValue(o, newParameters); } else { // a value has been passed in the parameterTool, now check if it adheres to all constraints checkAmbiguousValues(o, newParameters); checkIsCastableToDefinedType(o, newParameters); checkChoices(o, newParameters); } } else { // check if there is a default name or a value passed for a possibly defined alternative name. if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, newParameters)) { missingArguments.add(o.getName()); } } } if (!missingArguments.isEmpty()) { throw new RequiredParametersException(this.missingArgumentsText(missingArguments), missingArguments); } return ParameterTool.fromMap(newParameters); }
java
public ParameterTool applyTo(ParameterTool parameterTool) throws RequiredParametersException { List<String> missingArguments = new LinkedList<>(); HashMap<String, String> newParameters = new HashMap<>(parameterTool.toMap()); for (Option o : data.values()) { if (newParameters.containsKey(o.getName())) { if (Objects.equals(newParameters.get(o.getName()), ParameterTool.NO_VALUE_KEY)) { // the parameter has been passed, but no value, check if there is a default value checkAndApplyDefaultValue(o, newParameters); } else { // a value has been passed in the parameterTool, now check if it adheres to all constraints checkAmbiguousValues(o, newParameters); checkIsCastableToDefinedType(o, newParameters); checkChoices(o, newParameters); } } else { // check if there is a default name or a value passed for a possibly defined alternative name. if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, newParameters)) { missingArguments.add(o.getName()); } } } if (!missingArguments.isEmpty()) { throw new RequiredParametersException(this.missingArgumentsText(missingArguments), missingArguments); } return ParameterTool.fromMap(newParameters); }
[ "public", "ParameterTool", "applyTo", "(", "ParameterTool", "parameterTool", ")", "throws", "RequiredParametersException", "{", "List", "<", "String", ">", "missingArguments", "=", "new", "LinkedList", "<>", "(", ")", ";", "HashMap", "<", "String", ",", "String", ...
Check for all required parameters defined: - has a value been passed - if not, does the parameter have an associated default value - does the type of the parameter match the one defined in RequiredParameters - does the value provided in the parameterTool adhere to the choices defined in the option. <p>If any check fails, a RequiredParametersException is thrown @param parameterTool - parameters supplied by the user. @return the updated ParameterTool containing all the required parameters @throws RequiredParametersException if any of the specified checks fail
[ "Check", "for", "all", "required", "parameters", "defined", ":", "-", "has", "a", "value", "been", "passed", "-", "if", "not", "does", "the", "parameter", "have", "an", "associated", "default", "value", "-", "does", "the", "type", "of", "the", "parameter",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L89-L117
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/models/ProjectFilter.java
ProjectFilter.getQueryParams
public GitLabApiForm getQueryParams(int page, int perPage) { """ Get the query params specified by this filter. @param page specifies the page number @param perPage specifies the number of items per page @return a GitLabApiForm instance holding the query parameters for this ProjectFilter instance """ return (getQueryParams() .withParam(Constants.PAGE_PARAM, page) .withParam(Constants.PER_PAGE_PARAM, perPage)); }
java
public GitLabApiForm getQueryParams(int page, int perPage) { return (getQueryParams() .withParam(Constants.PAGE_PARAM, page) .withParam(Constants.PER_PAGE_PARAM, perPage)); }
[ "public", "GitLabApiForm", "getQueryParams", "(", "int", "page", ",", "int", "perPage", ")", "{", "return", "(", "getQueryParams", "(", ")", ".", "withParam", "(", "Constants", ".", "PAGE_PARAM", ",", "page", ")", ".", "withParam", "(", "Constants", ".", "...
Get the query params specified by this filter. @param page specifies the page number @param perPage specifies the number of items per page @return a GitLabApiForm instance holding the query parameters for this ProjectFilter instance
[ "Get", "the", "query", "params", "specified", "by", "this", "filter", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/models/ProjectFilter.java#L190-L194
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.insertionSort
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { """ method to sort an subarray from start to end with insertion sort algorithm @param arr an array of Comparable items @param start the begining position @param end the end position """ int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ]; } if ( i < j ) arr[ i ] = tmp; } }
java
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ]; } if ( i < j ) arr[ i ] = tmp; } }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "insertionSort", "(", "T", "[", "]", "arr", ",", "int", "start", ",", "int", "end", ")", "{", "int", "i", ";", "for", "(", "int", "j", "=", "start", ...
method to sort an subarray from start to end with insertion sort algorithm @param arr an array of Comparable items @param start the begining position @param end the end position
[ "method", "to", "sort", "an", "subarray", "from", "start", "to", "end", "with", "insertion", "sort", "algorithm" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L246-L257
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/d3/DisparityToColorPointCloud.java
DisparityToColorPointCloud.process
public void process(ImageGray disparity , BufferedImage color ) { """ Given the disparity image compute the 3D location of valid points and save pixel colors at that point @param disparity Disparity image @param color Color image of left camera """ cloudRgb.setMaxSize(disparity.width*disparity.height); cloudXyz.setMaxSize(disparity.width*disparity.height*3); cloudRgb.reset(); cloudXyz.reset(); if( disparity instanceof GrayU8) process((GrayU8)disparity,color); else process((GrayF32)disparity,color); }
java
public void process(ImageGray disparity , BufferedImage color ) { cloudRgb.setMaxSize(disparity.width*disparity.height); cloudXyz.setMaxSize(disparity.width*disparity.height*3); cloudRgb.reset(); cloudXyz.reset(); if( disparity instanceof GrayU8) process((GrayU8)disparity,color); else process((GrayF32)disparity,color); }
[ "public", "void", "process", "(", "ImageGray", "disparity", ",", "BufferedImage", "color", ")", "{", "cloudRgb", ".", "setMaxSize", "(", "disparity", ".", "width", "*", "disparity", ".", "height", ")", ";", "cloudXyz", ".", "setMaxSize", "(", "disparity", "....
Given the disparity image compute the 3D location of valid points and save pixel colors at that point @param disparity Disparity image @param color Color image of left camera
[ "Given", "the", "disparity", "image", "compute", "the", "3D", "location", "of", "valid", "points", "and", "save", "pixel", "colors", "at", "that", "point" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/d3/DisparityToColorPointCloud.java#L117-L127
phax/ph-css
ph-css/src/main/java/com/helger/css/decl/CSSExpression.java
CSSExpression.addNumber
@Nonnull public CSSExpression addNumber (@Nonnegative final int nIndex, final float fValue) { """ Shortcut method to add a numeric value @param nIndex The index where the member should be added. Must be &ge; 0. @param fValue The value to be added. @return this """ return addMember (nIndex, new CSSExpressionMemberTermSimple (fValue)); }
java
@Nonnull public CSSExpression addNumber (@Nonnegative final int nIndex, final float fValue) { return addMember (nIndex, new CSSExpressionMemberTermSimple (fValue)); }
[ "@", "Nonnull", "public", "CSSExpression", "addNumber", "(", "@", "Nonnegative", "final", "int", "nIndex", ",", "final", "float", "fValue", ")", "{", "return", "addMember", "(", "nIndex", ",", "new", "CSSExpressionMemberTermSimple", "(", "fValue", ")", ")", ";...
Shortcut method to add a numeric value @param nIndex The index where the member should be added. Must be &ge; 0. @param fValue The value to be added. @return this
[ "Shortcut", "method", "to", "add", "a", "numeric", "value" ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CSSExpression.java#L196-L200
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/LogUtils.java
LogUtils.streamFile
public static InputStream streamFile(final File file, final long offset) throws IOException { """ Open a stream to a file. @param offset If zero, stream the entire log. If positive, read from this byte position onwards. If negative, read this many bytes from the end of the file. @return input supplier for this log, if available from this provider """ final RandomAccessFile raf = new RandomAccessFile(file, "r"); final long rafLength = raf.length(); if (offset > 0) { raf.seek(offset); } else if (offset < 0 && offset < rafLength) { raf.seek(Math.max(0, rafLength + offset)); } return Channels.newInputStream(raf.getChannel()); }
java
public static InputStream streamFile(final File file, final long offset) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "r"); final long rafLength = raf.length(); if (offset > 0) { raf.seek(offset); } else if (offset < 0 && offset < rafLength) { raf.seek(Math.max(0, rafLength + offset)); } return Channels.newInputStream(raf.getChannel()); }
[ "public", "static", "InputStream", "streamFile", "(", "final", "File", "file", ",", "final", "long", "offset", ")", "throws", "IOException", "{", "final", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "final", ...
Open a stream to a file. @param offset If zero, stream the entire log. If positive, read from this byte position onwards. If negative, read this many bytes from the end of the file. @return input supplier for this log, if available from this provider
[ "Open", "a", "stream", "to", "a", "file", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/common/tasklogs/LogUtils.java#L38-L48
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.calculateLineIndentationLevel
protected int calculateLineIndentationLevel(final ParserData parserData, final String line, int lineNumber) throws IndentationException { """ Calculates the indentation level of a line using the amount of whitespace and the parsers indentation size setting. @param parserData @param line The line to calculate the indentation for. @return The lines indentation level. @throws IndentationException Thrown if the indentation for the line isn't valid. """ char[] lineCharArray = line.toCharArray(); int indentationCount = 0; // Count the amount of whitespace characters before any text to determine the level if (Character.isWhitespace(lineCharArray[0])) { for (char c : lineCharArray) { if (Character.isWhitespace(c)) { indentationCount++; } else { break; } } if (indentationCount % parserData.getIndentationSize() != 0) { throw new IndentationException(format(ProcessorConstants.ERROR_INCORRECT_INDENTATION_MSG, lineNumber, line.trim())); } } return indentationCount / parserData.getIndentationSize(); }
java
protected int calculateLineIndentationLevel(final ParserData parserData, final String line, int lineNumber) throws IndentationException { char[] lineCharArray = line.toCharArray(); int indentationCount = 0; // Count the amount of whitespace characters before any text to determine the level if (Character.isWhitespace(lineCharArray[0])) { for (char c : lineCharArray) { if (Character.isWhitespace(c)) { indentationCount++; } else { break; } } if (indentationCount % parserData.getIndentationSize() != 0) { throw new IndentationException(format(ProcessorConstants.ERROR_INCORRECT_INDENTATION_MSG, lineNumber, line.trim())); } } return indentationCount / parserData.getIndentationSize(); }
[ "protected", "int", "calculateLineIndentationLevel", "(", "final", "ParserData", "parserData", ",", "final", "String", "line", ",", "int", "lineNumber", ")", "throws", "IndentationException", "{", "char", "[", "]", "lineCharArray", "=", "line", ".", "toCharArray", ...
Calculates the indentation level of a line using the amount of whitespace and the parsers indentation size setting. @param parserData @param line The line to calculate the indentation for. @return The lines indentation level. @throws IndentationException Thrown if the indentation for the line isn't valid.
[ "Calculates", "the", "indentation", "level", "of", "a", "line", "using", "the", "amount", "of", "whitespace", "and", "the", "parsers", "indentation", "size", "setting", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L490-L509
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/JarURLConnection.java
JarURLConnection.parseSpecs
private void parseSpecs(URL url) throws MalformedURLException { """ /* get the specs for a given url out of the cache, and compute and cache them if they're not there. """ String spec = url.getFile(); int separator = spec.indexOf("!/"); /* * REMIND: we don't handle nested JAR URLs */ if (separator == -1) { throw new MalformedURLException("no !/ found in url spec:" + spec); } jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode (entryName); } }
java
private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); int separator = spec.indexOf("!/"); /* * REMIND: we don't handle nested JAR URLs */ if (separator == -1) { throw new MalformedURLException("no !/ found in url spec:" + spec); } jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode (entryName); } }
[ "private", "void", "parseSpecs", "(", "URL", "url", ")", "throws", "MalformedURLException", "{", "String", "spec", "=", "url", ".", "getFile", "(", ")", ";", "int", "separator", "=", "spec", ".", "indexOf", "(", "\"!/\"", ")", ";", "/*\n * REMIND: we...
/* get the specs for a given url out of the cache, and compute and cache them if they're not there.
[ "/", "*", "get", "the", "specs", "for", "a", "given", "url", "out", "of", "the", "cache", "and", "compute", "and", "cache", "them", "if", "they", "re", "not", "there", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/JarURLConnection.java#L164-L183
Javen205/IJPay
src/main/java/com/jpay/ext/kit/PaymentKit.java
PaymentKit.buildShortUrlParasMap
public static Map<String, String> buildShortUrlParasMap(String appid, String sub_appid, String mch_id, String sub_mch_id, String long_url, String paternerKey) { """ 构建短链接参数 @param appid @param sub_appid @param mch_id @param sub_mch_id @param long_url @param paternerKey @return <Map<String, String>> """ Map<String, String> params = new HashMap<String, String>(); params.put("appid", appid); params.put("sub_appid", sub_appid); params.put("mch_id", mch_id); params.put("sub_mch_id", sub_mch_id); params.put("long_url", long_url); return buildSignAfterParasMap(params, paternerKey); }
java
public static Map<String, String> buildShortUrlParasMap(String appid, String sub_appid, String mch_id, String sub_mch_id, String long_url, String paternerKey) { Map<String, String> params = new HashMap<String, String>(); params.put("appid", appid); params.put("sub_appid", sub_appid); params.put("mch_id", mch_id); params.put("sub_mch_id", sub_mch_id); params.put("long_url", long_url); return buildSignAfterParasMap(params, paternerKey); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "buildShortUrlParasMap", "(", "String", "appid", ",", "String", "sub_appid", ",", "String", "mch_id", ",", "String", "sub_mch_id", ",", "String", "long_url", ",", "String", "paternerKey", ")", "{", ...
构建短链接参数 @param appid @param sub_appid @param mch_id @param sub_mch_id @param long_url @param paternerKey @return <Map<String, String>>
[ "构建短链接参数" ]
train
https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/ext/kit/PaymentKit.java#L37-L48
dlew/joda-time-android
library/src/main/java/net/danlew/android/joda/DateUtils.java
DateUtils.getRelativeTimeSpanString
public static CharSequence getRelativeTimeSpanString(Context ctx, ReadablePartial time, boolean withPreposition) { """ Returns a relative time string to display the time expressed by millis. Missing fields from 'time' are filled in with values from the current time. See {@link android.text.format.DateUtils#getRelativeTimeSpanString} for full docs. @param withPreposition If true, the string returned will include the correct preposition ("at 9:20am", "on 10/12/2008" or "on May 29"). """ return getRelativeTimeSpanString(ctx, time.toDateTime(DateTime.now()), withPreposition); }
java
public static CharSequence getRelativeTimeSpanString(Context ctx, ReadablePartial time, boolean withPreposition) { return getRelativeTimeSpanString(ctx, time.toDateTime(DateTime.now()), withPreposition); }
[ "public", "static", "CharSequence", "getRelativeTimeSpanString", "(", "Context", "ctx", ",", "ReadablePartial", "time", ",", "boolean", "withPreposition", ")", "{", "return", "getRelativeTimeSpanString", "(", "ctx", ",", "time", ".", "toDateTime", "(", "DateTime", "...
Returns a relative time string to display the time expressed by millis. Missing fields from 'time' are filled in with values from the current time. See {@link android.text.format.DateUtils#getRelativeTimeSpanString} for full docs. @param withPreposition If true, the string returned will include the correct preposition ("at 9:20am", "on 10/12/2008" or "on May 29").
[ "Returns", "a", "relative", "time", "string", "to", "display", "the", "time", "expressed", "by", "millis", "." ]
train
https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L351-L353
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginRepository.java
PluginRepository.getPlugin
public final IPluginInterface getPlugin(final String name) throws UnknownPluginException { """ Returns the implementation of the plugin identified by the given name. @param name The plugin name @return the plugin identified by the given name * @throws UnknownPluginException if no plugin with the given name exists. * @see it.jnrpe.plugins.IPluginRepository#getPlugin(String) """ PluginDefinition pluginDef = pluginsDefinitionsMap.get(name); if (pluginDef == null) { throw new UnknownPluginException(name); } try { IPluginInterface pluginInterface = pluginDef.getPluginInterface(); if (pluginInterface == null) { pluginInterface = pluginDef.getPluginClass().newInstance(); } return new PluginProxy(pluginInterface, pluginDef); } catch (Exception e) { // FIXME : handle this exception e.printStackTrace(); } return null; }
java
public final IPluginInterface getPlugin(final String name) throws UnknownPluginException { PluginDefinition pluginDef = pluginsDefinitionsMap.get(name); if (pluginDef == null) { throw new UnknownPluginException(name); } try { IPluginInterface pluginInterface = pluginDef.getPluginInterface(); if (pluginInterface == null) { pluginInterface = pluginDef.getPluginClass().newInstance(); } return new PluginProxy(pluginInterface, pluginDef); } catch (Exception e) { // FIXME : handle this exception e.printStackTrace(); } return null; }
[ "public", "final", "IPluginInterface", "getPlugin", "(", "final", "String", "name", ")", "throws", "UnknownPluginException", "{", "PluginDefinition", "pluginDef", "=", "pluginsDefinitionsMap", ".", "get", "(", "name", ")", ";", "if", "(", "pluginDef", "==", "null"...
Returns the implementation of the plugin identified by the given name. @param name The plugin name @return the plugin identified by the given name * @throws UnknownPluginException if no plugin with the given name exists. * @see it.jnrpe.plugins.IPluginRepository#getPlugin(String)
[ "Returns", "the", "implementation", "of", "the", "plugin", "identified", "by", "the", "given", "name", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginRepository.java#L70-L89
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/binary/VisualizeBinaryData.java
VisualizeBinaryData.renderLabeled
public static BufferedImage renderLabeled(GrayS32 labelImage, int numRegions, BufferedImage out) { """ Renders a labeled where each region is assigned a random color. @param labelImage Labeled image with labels from 0 to numRegions-1 @param numRegions Number of labeled in the image @param out Output image. If null a new image is declared @return Colorized labeled image """ int colors[] = new int[numRegions]; Random rand = new Random(123); for( int i = 0; i < colors.length; i++ ) { colors[i] = rand.nextInt(); } return renderLabeled(labelImage, colors, out); }
java
public static BufferedImage renderLabeled(GrayS32 labelImage, int numRegions, BufferedImage out) { int colors[] = new int[numRegions]; Random rand = new Random(123); for( int i = 0; i < colors.length; i++ ) { colors[i] = rand.nextInt(); } return renderLabeled(labelImage, colors, out); }
[ "public", "static", "BufferedImage", "renderLabeled", "(", "GrayS32", "labelImage", ",", "int", "numRegions", ",", "BufferedImage", "out", ")", "{", "int", "colors", "[", "]", "=", "new", "int", "[", "numRegions", "]", ";", "Random", "rand", "=", "new", "R...
Renders a labeled where each region is assigned a random color. @param labelImage Labeled image with labels from 0 to numRegions-1 @param numRegions Number of labeled in the image @param out Output image. If null a new image is declared @return Colorized labeled image
[ "Renders", "a", "labeled", "where", "each", "region", "is", "assigned", "a", "random", "color", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/binary/VisualizeBinaryData.java#L332-L342
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.pointAtLight
public boolean pointAtLight(float x, float y) { """ Checks whether the given point is inside of any light volume @return true if point is inside of any light volume """ for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
java
public boolean pointAtLight(float x, float y) { for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
[ "public", "boolean", "pointAtLight", "(", "float", "x", ",", "float", "y", ")", "{", "for", "(", "Light", "light", ":", "lightList", ")", "{", "if", "(", "light", ".", "contains", "(", "x", ",", "y", ")", ")", "return", "true", ";", "}", "return", ...
Checks whether the given point is inside of any light volume @return true if point is inside of any light volume
[ "Checks", "whether", "the", "given", "point", "is", "inside", "of", "any", "light", "volume" ]
train
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L400-L405
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java
MapFileHelper.createAndLaunchWorld
public static boolean createAndLaunchWorld(WorldSettings worldsettings, boolean isTemporary) { """ Creates and launches a unique world according to the settings. @param worldsettings the world's settings @param isTemporary if true, the world will be deleted whenever newer worlds are created @return """ String s = getNewSaveFileLocation(isTemporary); Minecraft.getMinecraft().launchIntegratedServer(s, s, worldsettings); cleanupTemporaryWorlds(s); return true; }
java
public static boolean createAndLaunchWorld(WorldSettings worldsettings, boolean isTemporary) { String s = getNewSaveFileLocation(isTemporary); Minecraft.getMinecraft().launchIntegratedServer(s, s, worldsettings); cleanupTemporaryWorlds(s); return true; }
[ "public", "static", "boolean", "createAndLaunchWorld", "(", "WorldSettings", "worldsettings", ",", "boolean", "isTemporary", ")", "{", "String", "s", "=", "getNewSaveFileLocation", "(", "isTemporary", ")", ";", "Minecraft", ".", "getMinecraft", "(", ")", ".", "lau...
Creates and launches a unique world according to the settings. @param worldsettings the world's settings @param isTemporary if true, the world will be deleted whenever newer worlds are created @return
[ "Creates", "and", "launches", "a", "unique", "world", "according", "to", "the", "settings", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MapFileHelper.java#L106-L112
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/resources/FileResourceModelSource.java
FileResourceModelSource.parseFile
public static INodeSet parseFile(final File file, final Framework framework, final String project) throws ResourceModelSourceException, ConfigurationException { """ Utility method to directly parse the nodes from a file @param file file @param framework fwk @param project project name @return nodes @throws ResourceModelSourceException if an error occurs @throws ConfigurationException if a configuration error occurs """ final FileResourceModelSource prov = new FileResourceModelSource(framework); prov.configure( Configuration.build() .file(file) .includeServerNode(false) .generateFileAutomatically(false) .project(project) .requireFileExists(true) ); return prov.getNodes(); }
java
public static INodeSet parseFile(final File file, final Framework framework, final String project) throws ResourceModelSourceException, ConfigurationException { final FileResourceModelSource prov = new FileResourceModelSource(framework); prov.configure( Configuration.build() .file(file) .includeServerNode(false) .generateFileAutomatically(false) .project(project) .requireFileExists(true) ); return prov.getNodes(); }
[ "public", "static", "INodeSet", "parseFile", "(", "final", "File", "file", ",", "final", "Framework", "framework", ",", "final", "String", "project", ")", "throws", "ResourceModelSourceException", ",", "ConfigurationException", "{", "final", "FileResourceModelSource", ...
Utility method to directly parse the nodes from a file @param file file @param framework fwk @param project project name @return nodes @throws ResourceModelSourceException if an error occurs @throws ConfigurationException if a configuration error occurs
[ "Utility", "method", "to", "directly", "parse", "the", "nodes", "from", "a", "file" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/resources/FileResourceModelSource.java#L203-L217
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java
NumberFormat.getPattern
protected static String getPattern(ULocale forLocale, int choice) { """ Returns the pattern for the provided locale and choice. @param forLocale the locale of the data. @param choice the pattern format. @return the pattern """ /* for ISOCURRENCYSTYLE and PLURALCURRENCYSTYLE, * the pattern is the same as the pattern of CURRENCYSTYLE * but by replacing the single currency sign with * double currency sign or triple currency sign. */ String patternKey = null; switch (choice) { case NUMBERSTYLE: case INTEGERSTYLE: patternKey = "decimalFormat"; break; case CURRENCYSTYLE: String cfKeyValue = forLocale.getKeywordValue("cf"); patternKey = (cfKeyValue != null && cfKeyValue.equals("account")) ? "accountingFormat" : "currencyFormat"; break; case CASHCURRENCYSTYLE: case ISOCURRENCYSTYLE: case PLURALCURRENCYSTYLE: case STANDARDCURRENCYSTYLE: patternKey = "currencyFormat"; break; case PERCENTSTYLE: patternKey = "percentFormat"; break; case SCIENTIFICSTYLE: patternKey = "scientificFormat"; break; case ACCOUNTINGCURRENCYSTYLE: patternKey = "accountingFormat"; break; default: assert false; patternKey = "decimalFormat"; break; } ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle. getBundleInstance(ICUData.ICU_BASE_NAME, forLocale); NumberingSystem ns = NumberingSystem.getInstance(forLocale); String result = rb.findStringWithFallback( "NumberElements/" + ns.getName() + "/patterns/" + patternKey); if (result == null) { result = rb.getStringWithFallback("NumberElements/latn/patterns/" + patternKey); } return result; }
java
protected static String getPattern(ULocale forLocale, int choice) { /* for ISOCURRENCYSTYLE and PLURALCURRENCYSTYLE, * the pattern is the same as the pattern of CURRENCYSTYLE * but by replacing the single currency sign with * double currency sign or triple currency sign. */ String patternKey = null; switch (choice) { case NUMBERSTYLE: case INTEGERSTYLE: patternKey = "decimalFormat"; break; case CURRENCYSTYLE: String cfKeyValue = forLocale.getKeywordValue("cf"); patternKey = (cfKeyValue != null && cfKeyValue.equals("account")) ? "accountingFormat" : "currencyFormat"; break; case CASHCURRENCYSTYLE: case ISOCURRENCYSTYLE: case PLURALCURRENCYSTYLE: case STANDARDCURRENCYSTYLE: patternKey = "currencyFormat"; break; case PERCENTSTYLE: patternKey = "percentFormat"; break; case SCIENTIFICSTYLE: patternKey = "scientificFormat"; break; case ACCOUNTINGCURRENCYSTYLE: patternKey = "accountingFormat"; break; default: assert false; patternKey = "decimalFormat"; break; } ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle. getBundleInstance(ICUData.ICU_BASE_NAME, forLocale); NumberingSystem ns = NumberingSystem.getInstance(forLocale); String result = rb.findStringWithFallback( "NumberElements/" + ns.getName() + "/patterns/" + patternKey); if (result == null) { result = rb.getStringWithFallback("NumberElements/latn/patterns/" + patternKey); } return result; }
[ "protected", "static", "String", "getPattern", "(", "ULocale", "forLocale", ",", "int", "choice", ")", "{", "/* for ISOCURRENCYSTYLE and PLURALCURRENCYSTYLE,\n * the pattern is the same as the pattern of CURRENCYSTYLE\n * but by replacing the single currency sign with\n ...
Returns the pattern for the provided locale and choice. @param forLocale the locale of the data. @param choice the pattern format. @return the pattern
[ "Returns", "the", "pattern", "for", "the", "provided", "locale", "and", "choice", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1366-L1415
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java
JPAUtils.copyJoins
public static void copyJoins(From<?, ?> from, From<?, ?> to) { """ Copy Joins @param from source Join @param to destination Join """ for (Join<?, ?> j : from.getJoins()) { Join<?, ?> toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); toJoin.alias(getOrCreateAlias(j)); copyJoins(j, toJoin); } for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); copyFetches(f, toFetch); } }
java
public static void copyJoins(From<?, ?> from, From<?, ?> to) { for (Join<?, ?> j : from.getJoins()) { Join<?, ?> toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); toJoin.alias(getOrCreateAlias(j)); copyJoins(j, toJoin); } for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); copyFetches(f, toFetch); } }
[ "public", "static", "void", "copyJoins", "(", "From", "<", "?", ",", "?", ">", "from", ",", "From", "<", "?", ",", "?", ">", "to", ")", "{", "for", "(", "Join", "<", "?", ",", "?", ">", "j", ":", "from", ".", "getJoins", "(", ")", ")", "{",...
Copy Joins @param from source Join @param to destination Join
[ "Copy", "Joins" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L281-L294
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataSomeValuesFromImpl_CustomFieldSerializer.java
OWLDataSomeValuesFromImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataSomeValuesFromImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataSomeValuesFromImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDataSomeValuesFromImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataSomeValuesFromImpl_CustomFieldSerializer.java#L93-L96
tango-controls/JTango
server/src/main/java/org/tango/server/events/EventUtilities.java
EventUtilities.sendToSocket
static void sendToSocket(final ZMQ.Socket eventSocket, final String fullName, int counter, boolean isException, byte[] data) throws DevFailed { """ Send data so ZMQ Socket. <br> Warning. See http://zeromq.org/area:faq. "ZeroMQ sockets are not thread-safe.<br> The short version is that sockets should not be shared between threads. We recommend creating a dedicated socket for each thread. <br> For those situations where a dedicated socket per thread is infeasible, a socket may be shared if and only if each thread executes a full memory barrier before accessing the socket. Most languages support a Mutex or Spinlock which will execute the full memory barrier on your behalf." @param eventSocket @param fullName @param counter @param isException @param data @throws DevFailed """ XLOGGER.entry(); sendContextData(eventSocket, fullName, counter, isException); eventSocket.send(data); LOGGER.debug("event {} sent", fullName); XLOGGER.exit(); }
java
static void sendToSocket(final ZMQ.Socket eventSocket, final String fullName, int counter, boolean isException, byte[] data) throws DevFailed { XLOGGER.entry(); sendContextData(eventSocket, fullName, counter, isException); eventSocket.send(data); LOGGER.debug("event {} sent", fullName); XLOGGER.exit(); }
[ "static", "void", "sendToSocket", "(", "final", "ZMQ", ".", "Socket", "eventSocket", ",", "final", "String", "fullName", ",", "int", "counter", ",", "boolean", "isException", ",", "byte", "[", "]", "data", ")", "throws", "DevFailed", "{", "XLOGGER", ".", "...
Send data so ZMQ Socket. <br> Warning. See http://zeromq.org/area:faq. "ZeroMQ sockets are not thread-safe.<br> The short version is that sockets should not be shared between threads. We recommend creating a dedicated socket for each thread. <br> For those situations where a dedicated socket per thread is infeasible, a socket may be shared if and only if each thread executes a full memory barrier before accessing the socket. Most languages support a Mutex or Spinlock which will execute the full memory barrier on your behalf." @param eventSocket @param fullName @param counter @param isException @param data @throws DevFailed
[ "Send", "data", "so", "ZMQ", "Socket", ".", "<br", ">", "Warning", ".", "See", "http", ":", "//", "zeromq", ".", "org", "/", "area", ":", "faq", ".", "ZeroMQ", "sockets", "are", "not", "thread", "-", "safe", ".", "<br", ">", "The", "short", "versio...
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventUtilities.java#L438-L444
rythmengine/rythmengine
src/main/java/org/rythmengine/template/TemplateBase.java
TemplateBase.__render
protected RawData __render(String template, Object... args) { """ Render another template from this template. Could be used in template authoring. For example: <p/> <pre><code> {@literal @}args String customTemplate, Map<String, Object> customParams {@literal @}{ Object renderResult = render(customTemplate, customParams); } <p class="customer_content">@renderResult</p> </code></pre> @param template @param args @return render result """ if (null == template) return new RawData(""); return S.raw(__engine.sandbox().render(template, args)); }
java
protected RawData __render(String template, Object... args) { if (null == template) return new RawData(""); return S.raw(__engine.sandbox().render(template, args)); }
[ "protected", "RawData", "__render", "(", "String", "template", ",", "Object", "...", "args", ")", "{", "if", "(", "null", "==", "template", ")", "return", "new", "RawData", "(", "\"\"", ")", ";", "return", "S", ".", "raw", "(", "__engine", ".", "sandbo...
Render another template from this template. Could be used in template authoring. For example: <p/> <pre><code> {@literal @}args String customTemplate, Map<String, Object> customParams {@literal @}{ Object renderResult = render(customTemplate, customParams); } <p class="customer_content">@renderResult</p> </code></pre> @param template @param args @return render result
[ "Render", "another", "template", "from", "this", "template", ".", "Could", "be", "used", "in", "template", "authoring", ".", "For", "example", ":", "<p", "/", ">", "<pre", ">", "<code", ">", "{", "@literal", "@", "}", "args", "String", "customTemplate", ...
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L280-L283
SonarOpenCommunity/sonar-cxx
cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/CxxCompilerSensor.java
CxxCompilerSensor.isInputValid
protected boolean isInputValid(String filename, String line, String id, String msg) { """ Derived classes can overload this method @param filename @param line @param id @param msg @return true, if valid """ return !filename.isEmpty() || !line.isEmpty() || !id.isEmpty() || !msg.isEmpty(); }
java
protected boolean isInputValid(String filename, String line, String id, String msg) { return !filename.isEmpty() || !line.isEmpty() || !id.isEmpty() || !msg.isEmpty(); }
[ "protected", "boolean", "isInputValid", "(", "String", "filename", ",", "String", "line", ",", "String", "id", ",", "String", "msg", ")", "{", "return", "!", "filename", ".", "isEmpty", "(", ")", "||", "!", "line", ".", "isEmpty", "(", ")", "||", "!", ...
Derived classes can overload this method @param filename @param line @param id @param msg @return true, if valid
[ "Derived", "classes", "can", "overload", "this", "method" ]
train
https://github.com/SonarOpenCommunity/sonar-cxx/blob/7e7a3a44d6d86382a0434652a798f8235503c9b8/cxx-sensors/src/main/java/org/sonar/cxx/sensors/compiler/CxxCompilerSensor.java#L116-L118
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java
VmlGraphicsContext.drawCircle
public void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style) { """ Draw a circle on the <code>GraphicsContext</code>. @param parent parent group object @param name The circle's name. @param position The center position as a coordinate. @param radius The circle's radius. @param style The styling object by which the circle should be drawn. """ if (isAttached()) { Element circle = helper.createOrUpdateElement(parent, name, "oval", style); // Real position is the upper left corner of the circle: applyAbsolutePosition(circle, new Coordinate(position.getX() - radius, position.getY() - radius)); // width and height are both radius*2 int size = (int) (2 * radius); applyElementSize(circle, size, size, false); } }
java
public void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style) { if (isAttached()) { Element circle = helper.createOrUpdateElement(parent, name, "oval", style); // Real position is the upper left corner of the circle: applyAbsolutePosition(circle, new Coordinate(position.getX() - radius, position.getY() - radius)); // width and height are both radius*2 int size = (int) (2 * radius); applyElementSize(circle, size, size, false); } }
[ "public", "void", "drawCircle", "(", "Object", "parent", ",", "String", "name", ",", "Coordinate", "position", ",", "double", "radius", ",", "ShapeStyle", "style", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "circle", "=", "helper", ...
Draw a circle on the <code>GraphicsContext</code>. @param parent parent group object @param name The circle's name. @param position The center position as a coordinate. @param radius The circle's radius. @param style The styling object by which the circle should be drawn.
[ "Draw", "a", "circle", "on", "the", "<code", ">", "GraphicsContext<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L127-L138
morimekta/utils
io-util/src/main/java/net/morimekta/util/FileWatcher.java
FileWatcher.addWatcher
@Deprecated public void addWatcher(File file, Watcher watcher) { """ Start watching file path and notify watcher for updates on that file. @param file The file path to watch. @param watcher The watcher to be notified. @deprecated Use {@link #addWatcher(Path, Listener)} """ addWatcher(file.toPath(), watcher); }
java
@Deprecated public void addWatcher(File file, Watcher watcher) { addWatcher(file.toPath(), watcher); }
[ "@", "Deprecated", "public", "void", "addWatcher", "(", "File", "file", ",", "Watcher", "watcher", ")", "{", "addWatcher", "(", "file", ".", "toPath", "(", ")", ",", "watcher", ")", ";", "}" ]
Start watching file path and notify watcher for updates on that file. @param file The file path to watch. @param watcher The watcher to be notified. @deprecated Use {@link #addWatcher(Path, Listener)}
[ "Start", "watching", "file", "path", "and", "notify", "watcher", "for", "updates", "on", "that", "file", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L164-L167
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_features_backupFTP_access_POST
public OvhTask serviceName_features_backupFTP_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException { """ Create a new Backup FTP ACL REST: POST /dedicated/server/{serviceName}/features/backupFTP/access @param nfs [required] Wether to allow the NFS protocol for this ACL @param ipBlock [required] The IP Block specific to this ACL. It musts belong to your server. @param cifs [required] Wether to allow the CIFS (SMB) protocol for this ACL @param ftp [required] Wether to allow the FTP protocol for this ACL @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/features/backupFTP/access"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cifs", cifs); addBody(o, "ftp", ftp); addBody(o, "ipBlock", ipBlock); addBody(o, "nfs", nfs); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_features_backupFTP_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException { String qPath = "/dedicated/server/{serviceName}/features/backupFTP/access"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cifs", cifs); addBody(o, "ftp", ftp); addBody(o, "ipBlock", ipBlock); addBody(o, "nfs", nfs); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_features_backupFTP_access_POST", "(", "String", "serviceName", ",", "Boolean", "cifs", ",", "Boolean", "ftp", ",", "String", "ipBlock", ",", "Boolean", "nfs", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/...
Create a new Backup FTP ACL REST: POST /dedicated/server/{serviceName}/features/backupFTP/access @param nfs [required] Wether to allow the NFS protocol for this ACL @param ipBlock [required] The IP Block specific to this ACL. It musts belong to your server. @param cifs [required] Wether to allow the CIFS (SMB) protocol for this ACL @param ftp [required] Wether to allow the FTP protocol for this ACL @param serviceName [required] The internal name of your dedicated server
[ "Create", "a", "new", "Backup", "FTP", "ACL" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L853-L863
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/ArgUtils.java
ArgUtils.instanceOf
public static void instanceOf(final Object arg, final Class<?> clazz, final String name) { """ 検証対象の値が、指定したクラスを継承しているかどうか検証する。 @since 2.0 @param arg 検証対象の値 @param clazz 親クラス @param name 検証対象の引数の名前 """ if(arg == null) { throw new IllegalArgumentException(String.format("%s should not be null.", name)); } if(!clazz.isAssignableFrom(arg.getClass())) { throw new IllegalArgumentException(String.format("%s should not be class with '%s'.", name, clazz.getName())); } }
java
public static void instanceOf(final Object arg, final Class<?> clazz, final String name) { if(arg == null) { throw new IllegalArgumentException(String.format("%s should not be null.", name)); } if(!clazz.isAssignableFrom(arg.getClass())) { throw new IllegalArgumentException(String.format("%s should not be class with '%s'.", name, clazz.getName())); } }
[ "public", "static", "void", "instanceOf", "(", "final", "Object", "arg", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
検証対象の値が、指定したクラスを継承しているかどうか検証する。 @since 2.0 @param arg 検証対象の値 @param clazz 親クラス @param name 検証対象の引数の名前
[ "検証対象の値が、指定したクラスを継承しているかどうか検証する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/ArgUtils.java#L136-L146
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.createGlyph
private Glyph createGlyph(Entity e) { """ /* Creates a glyph representing the given PhysicalEntity. @param e PhysicalEntity or Gene to represent @return the created glyph """ String id = convertID(e.getUri()); if (glyphMap.containsKey(id)) return glyphMap.get(id); // Create its glyph and register Glyph g = createGlyphBasics(e, true); glyphMap.put(g.getId(), g); //TODO: export metadata (e.g., from bpe.getAnnotations() map) using the SBGN Extension feature // SBGNBase.Extension ext = new SBGNBase.Extension(); // g.setExtension(ext); // Element el = biopaxMetaDoc.createElement(e.getModelInterface().getSimpleName()); // el.setAttribute("uri", e.getUri()); // ext.getAny().add(el); if (g.getClone() != null) ubiqueSet.add(g); if(e instanceof PhysicalEntity) { PhysicalEntity pe = (PhysicalEntity) e; assignLocation(pe, g); if("or".equalsIgnoreCase(g.getClazz())) { buildGeneric(pe, g, null); } else if (pe instanceof Complex) { createComplexContent((Complex) pe, g); } } return g; }
java
private Glyph createGlyph(Entity e) { String id = convertID(e.getUri()); if (glyphMap.containsKey(id)) return glyphMap.get(id); // Create its glyph and register Glyph g = createGlyphBasics(e, true); glyphMap.put(g.getId(), g); //TODO: export metadata (e.g., from bpe.getAnnotations() map) using the SBGN Extension feature // SBGNBase.Extension ext = new SBGNBase.Extension(); // g.setExtension(ext); // Element el = biopaxMetaDoc.createElement(e.getModelInterface().getSimpleName()); // el.setAttribute("uri", e.getUri()); // ext.getAny().add(el); if (g.getClone() != null) ubiqueSet.add(g); if(e instanceof PhysicalEntity) { PhysicalEntity pe = (PhysicalEntity) e; assignLocation(pe, g); if("or".equalsIgnoreCase(g.getClazz())) { buildGeneric(pe, g, null); } else if (pe instanceof Complex) { createComplexContent((Complex) pe, g); } } return g; }
[ "private", "Glyph", "createGlyph", "(", "Entity", "e", ")", "{", "String", "id", "=", "convertID", "(", "e", ".", "getUri", "(", ")", ")", ";", "if", "(", "glyphMap", ".", "containsKey", "(", "id", ")", ")", "return", "glyphMap", ".", "get", "(", "...
/* Creates a glyph representing the given PhysicalEntity. @param e PhysicalEntity or Gene to represent @return the created glyph
[ "/", "*", "Creates", "a", "glyph", "representing", "the", "given", "PhysicalEntity", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L407-L438
nguyenq/tess4j
src/main/java/com/recognition/software/jdeskew/ImageUtil.java
ImageUtil.isBlack
public static boolean isBlack(BufferedImage image, int x, int y) { """ Whether the pixel is black. @param image source image @param x @param y @return """ if (image.getType() == BufferedImage.TYPE_BYTE_BINARY) { WritableRaster raster = image.getRaster(); int pixelRGBValue = raster.getSample(x, y, 0); return pixelRGBValue == 0; } int luminanceValue = 140; return isBlack(image, x, y, luminanceValue); }
java
public static boolean isBlack(BufferedImage image, int x, int y) { if (image.getType() == BufferedImage.TYPE_BYTE_BINARY) { WritableRaster raster = image.getRaster(); int pixelRGBValue = raster.getSample(x, y, 0); return pixelRGBValue == 0; } int luminanceValue = 140; return isBlack(image, x, y, luminanceValue); }
[ "public", "static", "boolean", "isBlack", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "image", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_BYTE_BINARY", ")", "{", "WritableRaster", "raster", "=", ...
Whether the pixel is black. @param image source image @param x @param y @return
[ "Whether", "the", "pixel", "is", "black", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/com/recognition/software/jdeskew/ImageUtil.java#L29-L38
alkacon/opencms-core
src-modules/org/opencms/workplace/explorer/CmsExplorer.java
CmsExplorer.getWorkplaceExplorerLink
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) { """ Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath. <p> @param cms the cms object @param explorerRootPath a root relative folder link (has to end with '/'). @return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath. """ // split the root site: StringBuffer siteRoot = new StringBuffer(); StringBuffer path = new StringBuffer('/'); Scanner scanner = new Scanner(explorerRootPath); scanner.useDelimiter("/"); int count = 0; while (scanner.hasNext()) { if (count < 2) { siteRoot.append('/').append(scanner.next()); } else { if (count == 2) { path.append('/'); } path.append(scanner.next()); path.append('/'); } count++; } String targetSiteRoot = siteRoot.toString(); String targetVfsFolder = path.toString(); // build the link StringBuilder link2Source = new StringBuilder(); link2Source.append("/system/workplace/views/workplace.jsp?"); link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE); link2Source.append("="); link2Source.append(targetVfsFolder); link2Source.append("&"); link2Source.append(CmsFrameset.PARAM_WP_VIEW); link2Source.append("="); link2Source.append( OpenCms.getLinkManager().substituteLinkForUnknownTarget( cms, "/system/workplace/views/explorer/explorer_fs.jsp")); link2Source.append("&"); link2Source.append(CmsWorkplace.PARAM_WP_SITE); link2Source.append("="); link2Source.append(targetSiteRoot); String result = link2Source.toString(); result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result); return result; }
java
public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) { // split the root site: StringBuffer siteRoot = new StringBuffer(); StringBuffer path = new StringBuffer('/'); Scanner scanner = new Scanner(explorerRootPath); scanner.useDelimiter("/"); int count = 0; while (scanner.hasNext()) { if (count < 2) { siteRoot.append('/').append(scanner.next()); } else { if (count == 2) { path.append('/'); } path.append(scanner.next()); path.append('/'); } count++; } String targetSiteRoot = siteRoot.toString(); String targetVfsFolder = path.toString(); // build the link StringBuilder link2Source = new StringBuilder(); link2Source.append("/system/workplace/views/workplace.jsp?"); link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE); link2Source.append("="); link2Source.append(targetVfsFolder); link2Source.append("&"); link2Source.append(CmsFrameset.PARAM_WP_VIEW); link2Source.append("="); link2Source.append( OpenCms.getLinkManager().substituteLinkForUnknownTarget( cms, "/system/workplace/views/explorer/explorer_fs.jsp")); link2Source.append("&"); link2Source.append(CmsWorkplace.PARAM_WP_SITE); link2Source.append("="); link2Source.append(targetSiteRoot); String result = link2Source.toString(); result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result); return result; }
[ "public", "static", "String", "getWorkplaceExplorerLink", "(", "final", "CmsObject", "cms", ",", "final", "String", "explorerRootPath", ")", "{", "// split the root site:", "StringBuffer", "siteRoot", "=", "new", "StringBuffer", "(", ")", ";", "StringBuffer", "path", ...
Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath. <p> @param cms the cms object @param explorerRootPath a root relative folder link (has to end with '/'). @return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
[ "Creates", "a", "link", "for", "the", "OpenCms", "workplace", "that", "will", "reload", "the", "whole", "workplace", "switch", "to", "the", "explorer", "view", "the", "site", "of", "the", "given", "explorerRootPath", "and", "show", "the", "folder", "given", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/explorer/CmsExplorer.java#L154-L197
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.addUserToGroups
public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) { """ Adds the user to groups. @param username the username @param userGroupsEntity the user groups entity @return the response """ return restClient.post("users/" + username + "/groups/", userGroupsEntity, new HashMap<String, String>()); }
java
public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) { return restClient.post("users/" + username + "/groups/", userGroupsEntity, new HashMap<String, String>()); }
[ "public", "Response", "addUserToGroups", "(", "String", "username", ",", "UserGroupsEntity", "userGroupsEntity", ")", "{", "return", "restClient", ".", "post", "(", "\"users/\"", "+", "username", "+", "\"/groups/\"", ",", "userGroupsEntity", ",", "new", "HashMap", ...
Adds the user to groups. @param username the username @param userGroupsEntity the user groups entity @return the response
[ "Adds", "the", "user", "to", "groups", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L511-L514
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/BboxService.java
BboxService.getCenterPoint
public static Coordinate getCenterPoint(Bbox bbox) { """ Get the center of the bounding box as a Coordinate. @param bbox The bounding box to get the center point for. @return The center of the given bounding box as a new coordinate. """ double centerX = (bbox.getWidth() == 0 ? bbox.getX() : bbox.getX() + bbox.getWidth() / 2); double centerY = (bbox.getHeight() == 0 ? bbox.getY() : bbox.getY() + bbox.getHeight() / 2); return new Coordinate(centerX, centerY); }
java
public static Coordinate getCenterPoint(Bbox bbox) { double centerX = (bbox.getWidth() == 0 ? bbox.getX() : bbox.getX() + bbox.getWidth() / 2); double centerY = (bbox.getHeight() == 0 ? bbox.getY() : bbox.getY() + bbox.getHeight() / 2); return new Coordinate(centerX, centerY); }
[ "public", "static", "Coordinate", "getCenterPoint", "(", "Bbox", "bbox", ")", "{", "double", "centerX", "=", "(", "bbox", ".", "getWidth", "(", ")", "==", "0", "?", "bbox", ".", "getX", "(", ")", ":", "bbox", ".", "getX", "(", ")", "+", "bbox", "."...
Get the center of the bounding box as a Coordinate. @param bbox The bounding box to get the center point for. @return The center of the given bounding box as a new coordinate.
[ "Get", "the", "center", "of", "the", "bounding", "box", "as", "a", "Coordinate", "." ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L65-L69
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.detectEnd
public static Point detectEnd(List<Location> subLocations, boolean isCircular) { """ This will attempt to find what the last point is and returns that position. If the location is circular this will return the total length of the location and does not mean the maximum point on the Sequence we may find the locations on """ int end = 0; Point lastPoint = null; if(isCircular) { for (Location sub : subLocations) { lastPoint = sub.getEnd(); end += lastPoint.getPosition(); } } else { lastPoint = subLocations.get(subLocations.size()-1).getEnd(); end = lastPoint.getPosition(); } return new SimplePoint(end, lastPoint.isUnknown(), lastPoint.isUncertain()); }
java
public static Point detectEnd(List<Location> subLocations, boolean isCircular) { int end = 0; Point lastPoint = null; if(isCircular) { for (Location sub : subLocations) { lastPoint = sub.getEnd(); end += lastPoint.getPosition(); } } else { lastPoint = subLocations.get(subLocations.size()-1).getEnd(); end = lastPoint.getPosition(); } return new SimplePoint(end, lastPoint.isUnknown(), lastPoint.isUncertain()); }
[ "public", "static", "Point", "detectEnd", "(", "List", "<", "Location", ">", "subLocations", ",", "boolean", "isCircular", ")", "{", "int", "end", "=", "0", ";", "Point", "lastPoint", "=", "null", ";", "if", "(", "isCircular", ")", "{", "for", "(", "Lo...
This will attempt to find what the last point is and returns that position. If the location is circular this will return the total length of the location and does not mean the maximum point on the Sequence we may find the locations on
[ "This", "will", "attempt", "to", "find", "what", "the", "last", "point", "is", "and", "returns", "that", "position", ".", "If", "the", "location", "is", "circular", "this", "will", "return", "the", "total", "length", "of", "the", "location", "and", "does",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L322-L336
Azure/autorest-clientruntime-for-java
client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java
FlatteningDeserializer.handleFlatteningForField
@SuppressWarnings("unchecked") private static void handleFlatteningForField(Field classField, JsonNode jsonNode) { """ Given a field of a POJO class and JsonNode corresponds to the same POJO class, check field's {@link JsonProperty} has flattening dots in it if so flatten the nested child JsonNode corresponds to the field in the given JsonNode. @param classField the field in a POJO class @param jsonNode the json node corresponds to POJO class that field belongs to """ final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class); if (jsonProperty != null) { final String jsonPropValue = jsonProperty.value(); if (containsFlatteningDots(jsonPropValue)) { JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue); ((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode); } } }
java
@SuppressWarnings("unchecked") private static void handleFlatteningForField(Field classField, JsonNode jsonNode) { final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class); if (jsonProperty != null) { final String jsonPropValue = jsonProperty.value(); if (containsFlatteningDots(jsonPropValue)) { JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue); ((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "handleFlatteningForField", "(", "Field", "classField", ",", "JsonNode", "jsonNode", ")", "{", "final", "JsonProperty", "jsonProperty", "=", "classField", ".", "getAnnotation", "(", "Js...
Given a field of a POJO class and JsonNode corresponds to the same POJO class, check field's {@link JsonProperty} has flattening dots in it if so flatten the nested child JsonNode corresponds to the field in the given JsonNode. @param classField the field in a POJO class @param jsonNode the json node corresponds to POJO class that field belongs to
[ "Given", "a", "field", "of", "a", "POJO", "class", "and", "JsonNode", "corresponds", "to", "the", "same", "POJO", "class", "check", "field", "s", "{", "@link", "JsonProperty", "}", "has", "flattening", "dots", "in", "it", "if", "so", "flatten", "the", "n...
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java#L147-L157
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_role_roleId_member_POST
public OvhOperation serviceName_role_roleId_member_POST(String serviceName, String roleId, String note, String username) throws IOException { """ Append user into the member list of specified role REST: POST /dbaas/logs/{serviceName}/role/{roleId}/member @param serviceName [required] Service name @param roleId [required] Role ID @param username [required] Username @param note [required] Custom note """ String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member"; StringBuilder sb = path(qPath, serviceName, roleId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "note", note); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_role_roleId_member_POST(String serviceName, String roleId, String note, String username) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member"; StringBuilder sb = path(qPath, serviceName, roleId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "note", note); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_role_roleId_member_POST", "(", "String", "serviceName", ",", "String", "roleId", ",", "String", "note", ",", "String", "username", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/role/{roleId}/...
Append user into the member list of specified role REST: POST /dbaas/logs/{serviceName}/role/{roleId}/member @param serviceName [required] Service name @param roleId [required] Role ID @param username [required] Username @param note [required] Custom note
[ "Append", "user", "into", "the", "member", "list", "of", "specified", "role" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L897-L905
phax/ph-css
ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java
CSSColorHelper.getHSLColorValue
@Nonnull @Nonempty public static String getHSLColorValue (final float fHue, final float fSaturation, final float fLightness) { """ Get the passed values as CSS HSL color value @param fHue Hue - is scaled to 0-359 @param fSaturation Saturation - is scaled to 0-100 @param fLightness Lightness - is scaled to 0-100 @return The CSS string to use """ return new StringBuilder (18).append (CCSSValue.PREFIX_HSL_OPEN) .append (getHSLHueValue (fHue)) .append (',') .append (getHSLPercentageValue (fSaturation)) .append ("%,") .append (getHSLPercentageValue (fLightness)) .append ("%") .append (CCSSValue.SUFFIX_HSL_CLOSE) .toString (); }
java
@Nonnull @Nonempty public static String getHSLColorValue (final float fHue, final float fSaturation, final float fLightness) { return new StringBuilder (18).append (CCSSValue.PREFIX_HSL_OPEN) .append (getHSLHueValue (fHue)) .append (',') .append (getHSLPercentageValue (fSaturation)) .append ("%,") .append (getHSLPercentageValue (fLightness)) .append ("%") .append (CCSSValue.SUFFIX_HSL_CLOSE) .toString (); }
[ "@", "Nonnull", "@", "Nonempty", "public", "static", "String", "getHSLColorValue", "(", "final", "float", "fHue", ",", "final", "float", "fSaturation", ",", "final", "float", "fLightness", ")", "{", "return", "new", "StringBuilder", "(", "18", ")", ".", "app...
Get the passed values as CSS HSL color value @param fHue Hue - is scaled to 0-359 @param fSaturation Saturation - is scaled to 0-100 @param fLightness Lightness - is scaled to 0-100 @return The CSS string to use
[ "Get", "the", "passed", "values", "as", "CSS", "HSL", "color", "value" ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java#L503-L516
JOML-CI/JOML
src/org/joml/Matrix3d.java
Matrix3d.rotationTowards
public Matrix3d rotationTowards(Vector3dc dir, Vector3dc up) { """ Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local <code>-z</code> axis with <code>center - eye</code>. <p> In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}. <p> This method is equivalent to calling: <code>setLookAlong(new Vector3d(dir).negate(), up).invert()</code> @see #rotationTowards(Vector3dc, Vector3dc) @see #rotateTowards(double, double, double, double, double, double) @param dir the direction to orient the local -z axis towards @param up the up vector @return this """ return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
java
public Matrix3d rotationTowards(Vector3dc dir, Vector3dc up) { return rotationTowards(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix3d", "rotationTowards", "(", "Vector3dc", "dir", ",", "Vector3dc", "up", ")", "{", "return", "rotationTowards", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", ...
Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local <code>-z</code> axis with <code>center - eye</code>. <p> In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}. <p> This method is equivalent to calling: <code>setLookAlong(new Vector3d(dir).negate(), up).invert()</code> @see #rotationTowards(Vector3dc, Vector3dc) @see #rotateTowards(double, double, double, double, double, double) @param dir the direction to orient the local -z axis towards @param up the up vector @return this
[ "Set", "this", "matrix", "to", "a", "model", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "aligns", "the", "local", "<code", ">", "-", "z<", "/", "code", ">", "axis", "with", "<code", ">", "center", "-", "eye<", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L4555-L4557
structr/structr
structr-core/src/main/java/org/structr/common/ValidationHelper.java
ValidationHelper.isValidStringMatchingRegex
public static boolean isValidStringMatchingRegex(final GraphObject node, final PropertyKey<String> key, final String expression, final ErrorBuffer errorBuffer) { """ Checks whether the value of the given property key of the given node if not null and matches the given regular expression. @param node @param key @param expression @param errorBuffer @return true if string matches expression """ final String value = node.getProperty(key); if (isValidStringMatchingRegex(value, expression)) { return true; } // no match errorBuffer.add(new MatchToken(node.getType(), key, expression)); return false; }
java
public static boolean isValidStringMatchingRegex(final GraphObject node, final PropertyKey<String> key, final String expression, final ErrorBuffer errorBuffer) { final String value = node.getProperty(key); if (isValidStringMatchingRegex(value, expression)) { return true; } // no match errorBuffer.add(new MatchToken(node.getType(), key, expression)); return false; }
[ "public", "static", "boolean", "isValidStringMatchingRegex", "(", "final", "GraphObject", "node", ",", "final", "PropertyKey", "<", "String", ">", "key", ",", "final", "String", "expression", ",", "final", "ErrorBuffer", "errorBuffer", ")", "{", "final", "String",...
Checks whether the value of the given property key of the given node if not null and matches the given regular expression. @param node @param key @param expression @param errorBuffer @return true if string matches expression
[ "Checks", "whether", "the", "value", "of", "the", "given", "property", "key", "of", "the", "given", "node", "if", "not", "null", "and", "matches", "the", "given", "regular", "expression", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/ValidationHelper.java#L165-L176
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/Zips.java
Zips.isEntryInDir
private boolean isEntryInDir(Set<String> dirNames, String entryName) { """ Checks if entry given by name resides inside of one of the dirs. @param dirNames dirs @param entryName entryPath """ // this should be done with a trie, put dirNames in a trie and check if entryName leads to // some node or not. for(String dirName : dirNames) { if (entryName.startsWith(dirName)) { return true; } } return false; }
java
private boolean isEntryInDir(Set<String> dirNames, String entryName) { // this should be done with a trie, put dirNames in a trie and check if entryName leads to // some node or not. for(String dirName : dirNames) { if (entryName.startsWith(dirName)) { return true; } } return false; }
[ "private", "boolean", "isEntryInDir", "(", "Set", "<", "String", ">", "dirNames", ",", "String", "entryName", ")", "{", "// this should be done with a trie, put dirNames in a trie and check if entryName leads to", "// some node or not.", "for", "(", "String", "dirName", ":", ...
Checks if entry given by name resides inside of one of the dirs. @param dirNames dirs @param entryName entryPath
[ "Checks", "if", "entry", "given", "by", "name", "resides", "inside", "of", "one", "of", "the", "dirs", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L607-L616
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java
LocalDate.plusYears
public LocalDate plusYears(long yearsToAdd) { """ Returns a copy of this {@code LocalDate} with the specified number of years added. <p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call. @param yearsToAdd the years to add, may be negative @return a {@code LocalDate} based on this date with the years added, not null @throws DateTimeException if the result exceeds the supported date range """ if (yearsToAdd == 0) { return this; } int newYear = YEAR.checkValidIntValue(year + yearsToAdd); // safe overflow return resolvePreviousValid(newYear, month, day); }
java
public LocalDate plusYears(long yearsToAdd) { if (yearsToAdd == 0) { return this; } int newYear = YEAR.checkValidIntValue(year + yearsToAdd); // safe overflow return resolvePreviousValid(newYear, month, day); }
[ "public", "LocalDate", "plusYears", "(", "long", "yearsToAdd", ")", "{", "if", "(", "yearsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "int", "newYear", "=", "YEAR", ".", "checkValidIntValue", "(", "year", "+", "yearsToAdd", ")", ";", "// saf...
Returns a copy of this {@code LocalDate} with the specified number of years added. <p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call. @param yearsToAdd the years to add, may be negative @return a {@code LocalDate} based on this date with the years added, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDate", "}", "with", "the", "specified", "number", "of", "years", "added", ".", "<p", ">", "This", "method", "adds", "the", "specified", "amount", "to", "the", "years", "field", "in", "three", "ste...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java#L1267-L1273
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java
OtpErlangList.stringValue
public String stringValue() throws OtpErlangException { """ Convert a list of integers into a Unicode string, interpreting each integer as a Unicode code point value. @return A java.lang.String object created through its constructor String(int[], int, int). @exception OtpErlangException for non-proper and non-integer lists. @exception OtpErlangRangeException if any integer does not fit into a Java int. @exception java.security.InvalidParameterException if any integer is not within the Unicode range. @see String#String(int[], int, int) """ if (!isProper()) { throw new OtpErlangException("Non-proper list: " + this); } final int[] values = new int[arity()]; for (int i = 0; i < values.length; ++i) { final OtpErlangObject o = elementAt(i); if (!(o instanceof OtpErlangLong)) { throw new OtpErlangException("Non-integer term: " + o); } final OtpErlangLong l = (OtpErlangLong) o; values[i] = l.intValue(); } return new String(values, 0, values.length); }
java
public String stringValue() throws OtpErlangException { if (!isProper()) { throw new OtpErlangException("Non-proper list: " + this); } final int[] values = new int[arity()]; for (int i = 0; i < values.length; ++i) { final OtpErlangObject o = elementAt(i); if (!(o instanceof OtpErlangLong)) { throw new OtpErlangException("Non-integer term: " + o); } final OtpErlangLong l = (OtpErlangLong) o; values[i] = l.intValue(); } return new String(values, 0, values.length); }
[ "public", "String", "stringValue", "(", ")", "throws", "OtpErlangException", "{", "if", "(", "!", "isProper", "(", ")", ")", "{", "throw", "new", "OtpErlangException", "(", "\"Non-proper list: \"", "+", "this", ")", ";", "}", "final", "int", "[", "]", "val...
Convert a list of integers into a Unicode string, interpreting each integer as a Unicode code point value. @return A java.lang.String object created through its constructor String(int[], int, int). @exception OtpErlangException for non-proper and non-integer lists. @exception OtpErlangRangeException if any integer does not fit into a Java int. @exception java.security.InvalidParameterException if any integer is not within the Unicode range. @see String#String(int[], int, int)
[ "Convert", "a", "list", "of", "integers", "into", "a", "Unicode", "string", "interpreting", "each", "integer", "as", "a", "Unicode", "code", "point", "value", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java#L437-L451
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.lindex
@SuppressWarnings("unchecked") /** * 返回列表 key 中,下标为 index 的元素。 * 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素, * 以 1 表示列表的第二个元素,以此类推。 * 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 * 如果 key 不是列表类型,返回一个错误。 */ public <T> T lindex(Object key, long index) { """ 返回列表 key 中,下标为 index 的元素。 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,以 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 如果 key 不是列表类型,返回一个错误。 """ Jedis jedis = getJedis(); try { return (T)valueFromBytes(jedis.lindex(keyToBytes(key), index)); } finally {close(jedis);} }
java
@SuppressWarnings("unchecked") /** * 返回列表 key 中,下标为 index 的元素。 * 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素, * 以 1 表示列表的第二个元素,以此类推。 * 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 * 如果 key 不是列表类型,返回一个错误。 */ public <T> T lindex(Object key, long index) { Jedis jedis = getJedis(); try { return (T)valueFromBytes(jedis.lindex(keyToBytes(key), index)); } finally {close(jedis);} }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "/**\r\n\t * 返回列表 key 中,下标为 index 的元素。\r\n\t * 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,\r\n\t * 以 1 表示列表的第二个元素,以此类推。\r\n\t * 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。\r\n\t * 如果 key 不是列表类型,返回一个错误。\r\n\t */", "public", "<", "T"...
返回列表 key 中,下标为 index 的元素。 下标(index)参数 start 和 stop 都以 0 为底,也就是说,以 0 表示列表的第一个元素,以 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 如果 key 不是列表类型,返回一个错误。
[ "返回列表", "key", "中,下标为", "index", "的元素。", "下标", "(", "index", ")", "参数", "start", "和", "stop", "都以", "0", "为底,也就是说,以", "0", "表示列表的第一个元素,以", "1", "表示列表的第二个元素,以此类推。", "你也可以使用负数下标,以", "-", "1", "表示列表的最后一个元素,", "-", "2", "表示列表的倒数第二个元素,以此类推。", "如果", "key", "不是列表类型...
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L611-L626
Azure/azure-sdk-for-java
devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java
ControllersInner.createAsync
public Observable<ControllerInner> createAsync(String resourceGroupName, String name, ControllerInner controller) { """ Creates an Azure Dev Spaces Controller. Creates an Azure Dev Spaces Controller with the specified create parameters. @param resourceGroupName Resource group to which the resource belongs. @param name Name of the resource. @param controller Controller create parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createWithServiceResponseAsync(resourceGroupName, name, controller).map(new Func1<ServiceResponse<ControllerInner>, ControllerInner>() { @Override public ControllerInner call(ServiceResponse<ControllerInner> response) { return response.body(); } }); }
java
public Observable<ControllerInner> createAsync(String resourceGroupName, String name, ControllerInner controller) { return createWithServiceResponseAsync(resourceGroupName, name, controller).map(new Func1<ServiceResponse<ControllerInner>, ControllerInner>() { @Override public ControllerInner call(ServiceResponse<ControllerInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ControllerInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "ControllerInner", "controller", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "cont...
Creates an Azure Dev Spaces Controller. Creates an Azure Dev Spaces Controller with the specified create parameters. @param resourceGroupName Resource group to which the resource belongs. @param name Name of the resource. @param controller Controller create parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "an", "Azure", "Dev", "Spaces", "Controller", ".", "Creates", "an", "Azure", "Dev", "Spaces", "Controller", "with", "the", "specified", "create", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java#L248-L255
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java
StringEscaper.formatHex
@Pure public static String formatHex(int amount, int digits) { """ Format the given int value to hexadecimal. @param amount the value to convert. @param digits the minimal number of digits. @return a string representation of the given value. """ final StringBuffer hex = new StringBuffer(Integer.toHexString(amount)); while (hex.length() < digits) { hex.insert(0, "0"); //$NON-NLS-1$ } return hex.toString(); }
java
@Pure public static String formatHex(int amount, int digits) { final StringBuffer hex = new StringBuffer(Integer.toHexString(amount)); while (hex.length() < digits) { hex.insert(0, "0"); //$NON-NLS-1$ } return hex.toString(); }
[ "@", "Pure", "public", "static", "String", "formatHex", "(", "int", "amount", ",", "int", "digits", ")", "{", "final", "StringBuffer", "hex", "=", "new", "StringBuffer", "(", "Integer", ".", "toHexString", "(", "amount", ")", ")", ";", "while", "(", "hex...
Format the given int value to hexadecimal. @param amount the value to convert. @param digits the minimal number of digits. @return a string representation of the given value.
[ "Format", "the", "given", "int", "value", "to", "hexadecimal", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java#L186-L193
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java
DataMaskingPoliciesInner.createOrUpdateAsync
public Observable<DataMaskingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { """ Creates or updates a database data masking policy. @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 serverName The name of the server. @param databaseName The name of the database. @param parameters Parameters for creating or updating a data masking policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataMaskingPolicyInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DataMaskingPolicyInner>, DataMaskingPolicyInner>() { @Override public DataMaskingPolicyInner call(ServiceResponse<DataMaskingPolicyInner> response) { return response.body(); } }); }
java
public Observable<DataMaskingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DataMaskingPolicyInner>, DataMaskingPolicyInner>() { @Override public DataMaskingPolicyInner call(ServiceResponse<DataMaskingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataMaskingPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "DataMaskingPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResp...
Creates or updates a database data masking policy. @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 serverName The name of the server. @param databaseName The name of the database. @param parameters Parameters for creating or updating a data masking policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataMaskingPolicyInner object
[ "Creates", "or", "updates", "a", "database", "data", "masking", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java#L108-L115
HeidelTime/heideltime
src/jvnsensegmenter/JVnSenSegmenter.java
JVnSenSegmenter.senSegmentFile
private static void senSegmentFile(String infile, String outfile, JVnSenSegmenter senSegmenter ) { """ Segment sentences. @param infile the infile @param outfile the outfile @param senSegmenter the sen segmenter """ try{ BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(infile), "UTF-8")); BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(outfile), "UTF-8")); String para = "", line = "", text = ""; while ((line = in.readLine()) != null){ if (!line.equals("")){ if (line.charAt(0) == '#'){ //skip comment line text += line + "\n"; continue; } para = senSegmenter.senSegment(line).trim(); text += para.trim() + "\n\n"; } else{ //blank line text += "\n"; } } text = text.trim(); out.write(text); out.newLine(); in.close(); out.close(); } catch (Exception e){ System.out.println("Error in sensegment file " + infile); } }
java
private static void senSegmentFile(String infile, String outfile, JVnSenSegmenter senSegmenter ){ try{ BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(infile), "UTF-8")); BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(outfile), "UTF-8")); String para = "", line = "", text = ""; while ((line = in.readLine()) != null){ if (!line.equals("")){ if (line.charAt(0) == '#'){ //skip comment line text += line + "\n"; continue; } para = senSegmenter.senSegment(line).trim(); text += para.trim() + "\n\n"; } else{ //blank line text += "\n"; } } text = text.trim(); out.write(text); out.newLine(); in.close(); out.close(); } catch (Exception e){ System.out.println("Error in sensegment file " + infile); } }
[ "private", "static", "void", "senSegmentFile", "(", "String", "infile", ",", "String", "outfile", ",", "JVnSenSegmenter", "senSegmenter", ")", "{", "try", "{", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "Fi...
Segment sentences. @param infile the infile @param outfile the outfile @param senSegmenter the sen segmenter
[ "Segment", "sentences", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvnsensegmenter/JVnSenSegmenter.java#L187-L222
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.padOrTrim
public static String padOrTrim(String str, int num) { """ Pad or trim so as to produce a string of exactly a certain length. @param str The String to be padded or truncated @param num The desired length """ if (str == null) { str = "null"; } int leng = str.length(); if (leng < num) { StringBuilder sb = new StringBuilder(str); for (int i = 0; i < num - leng; i++) { sb.append(' '); } return sb.toString(); } else if (leng > num) { return str.substring(0, num); } else { return str; } }
java
public static String padOrTrim(String str, int num) { if (str == null) { str = "null"; } int leng = str.length(); if (leng < num) { StringBuilder sb = new StringBuilder(str); for (int i = 0; i < num - leng; i++) { sb.append(' '); } return sb.toString(); } else if (leng > num) { return str.substring(0, num); } else { return str; } }
[ "public", "static", "String", "padOrTrim", "(", "String", "str", ",", "int", "num", ")", "{", "if", "(", "str", "==", "null", ")", "{", "str", "=", "\"null\"", ";", "}", "int", "leng", "=", "str", ".", "length", "(", ")", ";", "if", "(", "leng", ...
Pad or trim so as to produce a string of exactly a certain length. @param str The String to be padded or truncated @param num The desired length
[ "Pad", "or", "trim", "so", "as", "to", "produce", "a", "string", "of", "exactly", "a", "certain", "length", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L426-L442
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/Base64.java
Base64.encodeBytes
public static String encodeBytes( byte[] source, int off, int len, int options ) throws IOException { """ Encodes a byte array into Base64 notation. <p> Example options: <pre> GZIP: gzip-compresses object before encoding it. DO_BREAK_LINES: break lines at 76 characters &lt;i&gt;Note: Technically, this makes your encoding non-compliant.&lt;/i&gt; </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code> <p> As of v 2.3, if there is an error with the GZIP stream, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it. </p> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return The Base64-encoded data as a String @see Base64#GZIP @see Base64#DO_BREAK_LINES @throws java.io.IOException if there is an error @throws NullPointerException if source array is null @throws IllegalArgumentException if source array, offset, or length are invalid @since 2.0 """ byte[] encoded = encodeBytesToBytes(source, off, len, options); // Return value according to relevant encoding. try { return new String(encoded, PREFERRED_ENCODING); } // end try catch (java.io.UnsupportedEncodingException uue) { return new String(encoded); } // end catch }
java
public static String encodeBytes( byte[] source, int off, int len, int options ) throws IOException { byte[] encoded = encodeBytesToBytes(source, off, len, options); // Return value according to relevant encoding. try { return new String(encoded, PREFERRED_ENCODING); } // end try catch (java.io.UnsupportedEncodingException uue) { return new String(encoded); } // end catch }
[ "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ",", "int", "options", ")", "throws", "IOException", "{", "byte", "[", "]", "encoded", "=", "encodeBytesToBytes", "(", "source", ",", "off...
Encodes a byte array into Base64 notation. <p> Example options: <pre> GZIP: gzip-compresses object before encoding it. DO_BREAK_LINES: break lines at 76 characters &lt;i&gt;Note: Technically, this makes your encoding non-compliant.&lt;/i&gt; </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code> <p> As of v 2.3, if there is an error with the GZIP stream, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it. </p> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return The Base64-encoded data as a String @see Base64#GZIP @see Base64#DO_BREAK_LINES @throws java.io.IOException if there is an error @throws NullPointerException if source array is null @throws IllegalArgumentException if source array, offset, or length are invalid @since 2.0
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", ".", "<p", ">", "Example", "options", ":" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/Base64.java#L825-L839
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java
Utils.copyDirectory
public static void copyDirectory( File source, File target ) throws IOException { """ Copies a directory. <p> This method copies the content of the source directory into the a target directory. This latter is created if necessary. </p> @param source the directory to copy @param target the target directory @throws IOException if a problem occurred during the copy """ Utils.createDirectory( target ); for( File sourceFile : listAllFiles( source, false )) { String path = computeFileRelativeLocation( source, sourceFile ); File targetFile = new File( target, path ); Utils.createDirectory( targetFile.getParentFile()); copyStream( sourceFile, targetFile ); } }
java
public static void copyDirectory( File source, File target ) throws IOException { Utils.createDirectory( target ); for( File sourceFile : listAllFiles( source, false )) { String path = computeFileRelativeLocation( source, sourceFile ); File targetFile = new File( target, path ); Utils.createDirectory( targetFile.getParentFile()); copyStream( sourceFile, targetFile ); } }
[ "public", "static", "void", "copyDirectory", "(", "File", "source", ",", "File", "target", ")", "throws", "IOException", "{", "Utils", ".", "createDirectory", "(", "target", ")", ";", "for", "(", "File", "sourceFile", ":", "listAllFiles", "(", "source", ",",...
Copies a directory. <p> This method copies the content of the source directory into the a target directory. This latter is created if necessary. </p> @param source the directory to copy @param target the target directory @throws IOException if a problem occurred during the copy
[ "Copies", "a", "directory", ".", "<p", ">", "This", "method", "copies", "the", "content", "of", "the", "source", "directory", "into", "the", "a", "target", "directory", ".", "This", "latter", "is", "created", "if", "necessary", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L1250-L1260
beanshell/beanshell
src/main/java/bsh/engine/BshScriptEngine.java
BshScriptEngine.invokeFunction
@Override public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { """ Same as invoke(Object, String, Object...) with {@code null} as the first argument. Used to call top-level procedures defined in scripts. @param args Arguments to pass to the procedure @return The value returned by the procedure @throws javax.script.ScriptException if an error occurrs during invocation of the method. @throws NoSuchMethodException if method with given name or matching argument types cannot be found. @throws NullPointerException if method name is null. """ return invokeMethod(getGlobal(), name, args); }
java
@Override public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { return invokeMethod(getGlobal(), name, args); }
[ "@", "Override", "public", "Object", "invokeFunction", "(", "String", "name", ",", "Object", "...", "args", ")", "throws", "ScriptException", ",", "NoSuchMethodException", "{", "return", "invokeMethod", "(", "getGlobal", "(", ")", ",", "name", ",", "args", ")"...
Same as invoke(Object, String, Object...) with {@code null} as the first argument. Used to call top-level procedures defined in scripts. @param args Arguments to pass to the procedure @return The value returned by the procedure @throws javax.script.ScriptException if an error occurrs during invocation of the method. @throws NoSuchMethodException if method with given name or matching argument types cannot be found. @throws NullPointerException if method name is null.
[ "Same", "as", "invoke", "(", "Object", "String", "Object", "...", ")", "with", "{", "@code", "null", "}", "as", "the", "first", "argument", ".", "Used", "to", "call", "top", "-", "level", "procedures", "defined", "in", "scripts", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/BshScriptEngine.java#L302-L305
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java
Path2dfx.isCurvedProperty
public BooleanProperty isCurvedProperty() { """ Replies the isCurved property. @return the isCurved property. """ if (this.isCurved == null) { this.isCurved = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_CURVED, false); this.isCurved.bind(Bindings.createBooleanBinding(() -> { for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.CURVE_TO || type == PathElementType.QUAD_TO) { return true; } } return false; }, innerTypesProperty())); } return this.isCurved; }
java
public BooleanProperty isCurvedProperty() { if (this.isCurved == null) { this.isCurved = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_CURVED, false); this.isCurved.bind(Bindings.createBooleanBinding(() -> { for (final PathElementType type : innerTypesProperty()) { if (type == PathElementType.CURVE_TO || type == PathElementType.QUAD_TO) { return true; } } return false; }, innerTypesProperty())); } return this.isCurved; }
[ "public", "BooleanProperty", "isCurvedProperty", "(", ")", "{", "if", "(", "this", ".", "isCurved", "==", "null", ")", "{", "this", ".", "isCurved", "=", "new", "ReadOnlyBooleanWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "IS_CURVED", ",", "false",...
Replies the isCurved property. @return the isCurved property.
[ "Replies", "the", "isCurved", "property", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java#L333-L347
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java
AmazonDynamoDBClient.setEndpoint
public void setEndpoint(String endpoint, String serviceName, String regionId) throws IllegalArgumentException { """ Overrides the default endpoint for this client ("http://dynamodb.us-east-1.amazonaws.com/") and explicitly provides an AWS region ID and AWS service name to use when the client calculates a signature for requests. In almost all cases, this region ID and service name are automatically determined from the endpoint, and callers should use the simpler one-argument form of setEndpoint instead of this method. <p> <b>This method is not threadsafe. Endpoints should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit.</b> <p> Callers can pass in just the endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full URL, including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/"). If the protocol is not specified here, the default protocol from this client's {@link ClientConfiguration} will be used, which by default is HTTPS. <p> For more information on using AWS regions with the AWS SDK for Java, and a complete list of all available endpoints for all AWS services, see: <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912"> http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912</a> @param endpoint The endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full URL, including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/") of the region specific AWS endpoint this client will communicate with. @param serviceName The name of the AWS service to use when signing requests. @param regionId The ID of the region in which this service resides. @throws IllegalArgumentException If any problems are detected with the specified endpoint. @see AmazonDynamoDB#setRegion(Region) """ setEndpoint(endpoint); signer.setServiceName(serviceName); signer.setRegionName(regionId); }
java
public void setEndpoint(String endpoint, String serviceName, String regionId) throws IllegalArgumentException { setEndpoint(endpoint); signer.setServiceName(serviceName); signer.setRegionName(regionId); }
[ "public", "void", "setEndpoint", "(", "String", "endpoint", ",", "String", "serviceName", ",", "String", "regionId", ")", "throws", "IllegalArgumentException", "{", "setEndpoint", "(", "endpoint", ")", ";", "signer", ".", "setServiceName", "(", "serviceName", ")",...
Overrides the default endpoint for this client ("http://dynamodb.us-east-1.amazonaws.com/") and explicitly provides an AWS region ID and AWS service name to use when the client calculates a signature for requests. In almost all cases, this region ID and service name are automatically determined from the endpoint, and callers should use the simpler one-argument form of setEndpoint instead of this method. <p> <b>This method is not threadsafe. Endpoints should be configured when the client is created and before any service requests are made. Changing it afterwards creates inevitable race conditions for any service requests in transit.</b> <p> Callers can pass in just the endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full URL, including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/"). If the protocol is not specified here, the default protocol from this client's {@link ClientConfiguration} will be used, which by default is HTTPS. <p> For more information on using AWS regions with the AWS SDK for Java, and a complete list of all available endpoints for all AWS services, see: <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912"> http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3912</a> @param endpoint The endpoint (ex: "dynamodb.us-east-1.amazonaws.com/") or a full URL, including the protocol (ex: "http://dynamodb.us-east-1.amazonaws.com/") of the region specific AWS endpoint this client will communicate with. @param serviceName The name of the AWS service to use when signing requests. @param regionId The ID of the region in which this service resides. @throws IllegalArgumentException If any problems are detected with the specified endpoint. @see AmazonDynamoDB#setRegion(Region)
[ "Overrides", "the", "default", "endpoint", "for", "this", "client", "(", "http", ":", "//", "dynamodb", ".", "us", "-", "east", "-", "1", ".", "amazonaws", ".", "com", "/", ")", "and", "explicitly", "provides", "an", "AWS", "region", "ID", "and", "AWS"...
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L981-L985
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java
StreamMetrics.reportSegmentSplitsAndMerges
public static void reportSegmentSplitsAndMerges(String scope, String streamName, long splits, long merges) { """ Reports the number of segment splits and merges related to a particular scale operation on a Stream. Both global and Stream-specific counters are updated. @param scope Scope. @param streamName Name of the Stream. @param splits Number of segment splits in the scale operation. @param merges Number of segment merges in the scale operation. """ DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_SPLITS), splits); DYNAMIC_LOGGER.updateCounterValue(SEGMENTS_SPLITS, splits, streamTags(scope, streamName)); DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_MERGES), merges); DYNAMIC_LOGGER.updateCounterValue(SEGMENTS_MERGES, merges, streamTags(scope, streamName)); }
java
public static void reportSegmentSplitsAndMerges(String scope, String streamName, long splits, long merges) { DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_SPLITS), splits); DYNAMIC_LOGGER.updateCounterValue(SEGMENTS_SPLITS, splits, streamTags(scope, streamName)); DYNAMIC_LOGGER.updateCounterValue(globalMetricName(SEGMENTS_MERGES), merges); DYNAMIC_LOGGER.updateCounterValue(SEGMENTS_MERGES, merges, streamTags(scope, streamName)); }
[ "public", "static", "void", "reportSegmentSplitsAndMerges", "(", "String", "scope", ",", "String", "streamName", ",", "long", "splits", ",", "long", "merges", ")", "{", "DYNAMIC_LOGGER", ".", "updateCounterValue", "(", "globalMetricName", "(", "SEGMENTS_SPLITS", ")"...
Reports the number of segment splits and merges related to a particular scale operation on a Stream. Both global and Stream-specific counters are updated. @param scope Scope. @param streamName Name of the Stream. @param splits Number of segment splits in the scale operation. @param merges Number of segment merges in the scale operation.
[ "Reports", "the", "number", "of", "segment", "splits", "and", "merges", "related", "to", "a", "particular", "scale", "operation", "on", "a", "Stream", ".", "Both", "global", "and", "Stream", "-", "specific", "counters", "are", "updated", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/StreamMetrics.java#L213-L218
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/storage/ApptentiveDatabaseHelper.java
ApptentiveDatabaseHelper.onUpgrade
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { """ This method is called when an app is upgraded. Add alter table statements here for each version in a non-breaking switch, so that all the necessary upgrades occur for each older version. """ ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion); try { DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion); if (migrator != null) { migrator.onUpgrade(db, oldVersion, newVersion); } } catch (Exception e) { ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion); logException(e); // if migration failed - create new table db.execSQL(SQL_DELETE_PAYLOAD_TABLE); onCreate(db); } }
java
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion); try { DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion); if (migrator != null) { migrator.onUpgrade(db, oldVersion, newVersion); } } catch (Exception e) { ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion); logException(e); // if migration failed - create new table db.execSQL(SQL_DELETE_PAYLOAD_TABLE); onCreate(db); } }
[ "@", "Override", "public", "void", "onUpgrade", "(", "SQLiteDatabase", "db", ",", "int", "oldVersion", ",", "int", "newVersion", ")", "{", "ApptentiveLog", ".", "d", "(", "DATABASE", ",", "\"Upgrade database from %d to %d\"", ",", "oldVersion", ",", "newVersion", ...
This method is called when an app is upgraded. Add alter table statements here for each version in a non-breaking switch, so that all the necessary upgrades occur for each older version.
[ "This", "method", "is", "called", "when", "an", "app", "is", "upgraded", ".", "Add", "alter", "table", "statements", "here", "for", "each", "version", "in", "a", "non", "-", "breaking", "switch", "so", "that", "all", "the", "necessary", "upgrades", "occur"...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/ApptentiveDatabaseHelper.java#L240-L256
alkacon/opencms-core
src/org/opencms/gwt/CmsCoreService.java
CmsCoreService.internalGetLinkForReturnCode
public static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException { """ Implementation method for getting the link for a given return code.<p> @param cms the CMS context @param returnCode the return code @return the link for the return code @throws CmsException if something goes wrong """ if (CmsUUID.isValidUUID(returnCode)) { try { CmsResource pageRes = cms.readResource(new CmsUUID(returnCode), CmsResourceFilter.IGNORE_EXPIRATION); return new CmsReturnLinkInfo( OpenCms.getLinkManager().substituteLink(cms, pageRes), CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } else { int colonIndex = returnCode.indexOf(':'); if (colonIndex >= 0) { String before = returnCode.substring(0, colonIndex); String after = returnCode.substring(colonIndex + 1); if (CmsUUID.isValidUUID(before) && CmsUUID.isValidUUID(after)) { try { CmsUUID pageId = new CmsUUID(before); CmsUUID detailId = new CmsUUID(after); CmsResource pageRes = cms.readResource(pageId); CmsResource folder = pageRes.isFolder() ? pageRes : cms.readParentFolder(pageRes.getStructureId()); String pageLink = OpenCms.getLinkManager().substituteLink(cms, folder); CmsResource detailRes = cms.readResource(detailId); String detailName = cms.getDetailName( detailRes, cms.getRequestContext().getLocale(), OpenCms.getLocaleManager().getDefaultLocales()); String link = CmsFileUtil.removeTrailingSeparator(pageLink) + "/" + detailName; return new CmsReturnLinkInfo(link, CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } } throw new IllegalArgumentException("return code has wrong format"); } }
java
public static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException { if (CmsUUID.isValidUUID(returnCode)) { try { CmsResource pageRes = cms.readResource(new CmsUUID(returnCode), CmsResourceFilter.IGNORE_EXPIRATION); return new CmsReturnLinkInfo( OpenCms.getLinkManager().substituteLink(cms, pageRes), CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } else { int colonIndex = returnCode.indexOf(':'); if (colonIndex >= 0) { String before = returnCode.substring(0, colonIndex); String after = returnCode.substring(colonIndex + 1); if (CmsUUID.isValidUUID(before) && CmsUUID.isValidUUID(after)) { try { CmsUUID pageId = new CmsUUID(before); CmsUUID detailId = new CmsUUID(after); CmsResource pageRes = cms.readResource(pageId); CmsResource folder = pageRes.isFolder() ? pageRes : cms.readParentFolder(pageRes.getStructureId()); String pageLink = OpenCms.getLinkManager().substituteLink(cms, folder); CmsResource detailRes = cms.readResource(detailId); String detailName = cms.getDetailName( detailRes, cms.getRequestContext().getLocale(), OpenCms.getLocaleManager().getDefaultLocales()); String link = CmsFileUtil.removeTrailingSeparator(pageLink) + "/" + detailName; return new CmsReturnLinkInfo(link, CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } } throw new IllegalArgumentException("return code has wrong format"); } }
[ "public", "static", "CmsReturnLinkInfo", "internalGetLinkForReturnCode", "(", "CmsObject", "cms", ",", "String", "returnCode", ")", "throws", "CmsException", "{", "if", "(", "CmsUUID", ".", "isValidUUID", "(", "returnCode", ")", ")", "{", "try", "{", "CmsResource"...
Implementation method for getting the link for a given return code.<p> @param cms the CMS context @param returnCode the return code @return the link for the return code @throws CmsException if something goes wrong
[ "Implementation", "method", "for", "getting", "the", "link", "for", "a", "given", "return", "code", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsCoreService.java#L568-L611
apache/incubator-heron
heron/statefulstorages/src/java/org/apache/heron/statefulstorage/hdfs/HDFSStorage.java
HDFSStorage.createDir
protected void createDir(String dir) throws StatefulStorageException { """ Creates the directory if it does not exist. @param dir The path of dir to ensure existence """ Path path = new Path(dir); try { fileSystem.mkdirs(path); if (!fileSystem.exists(path)) { throw new StatefulStorageException("Failed to create dir: " + dir); } } catch (IOException e) { throw new StatefulStorageException("Failed to create dir: " + dir, e); } }
java
protected void createDir(String dir) throws StatefulStorageException { Path path = new Path(dir); try { fileSystem.mkdirs(path); if (!fileSystem.exists(path)) { throw new StatefulStorageException("Failed to create dir: " + dir); } } catch (IOException e) { throw new StatefulStorageException("Failed to create dir: " + dir, e); } }
[ "protected", "void", "createDir", "(", "String", "dir", ")", "throws", "StatefulStorageException", "{", "Path", "path", "=", "new", "Path", "(", "dir", ")", ";", "try", "{", "fileSystem", ".", "mkdirs", "(", "path", ")", ";", "if", "(", "!", "fileSystem"...
Creates the directory if it does not exist. @param dir The path of dir to ensure existence
[ "Creates", "the", "directory", "if", "it", "does", "not", "exist", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/statefulstorages/src/java/org/apache/heron/statefulstorage/hdfs/HDFSStorage.java#L183-L194
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDatatypeDefinitionAxiomImpl_CustomFieldSerializer.java
OWLDatatypeDefinitionAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDatatypeDefinitionAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDatatypeDefinitionAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDatatypeDefinitionAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDatatypeDefinitionAxiomImpl_CustomFieldSerializer.java#L76-L79
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.prependIfMissing
public static String prependIfMissing(final String str, final CharSequence prefix, final CharSequence... prefixes) { """ Prepends the prefix to the start of the string if the string does not already start with any of the prefixes. <pre> StringUtils.prependIfMissing(null, null) = null StringUtils.prependIfMissing("abc", null) = "abc" StringUtils.prependIfMissing("", "xyz") = "xyz" StringUtils.prependIfMissing("abc", "xyz") = "xyzabc" StringUtils.prependIfMissing("xyzabc", "xyz") = "xyzabc" StringUtils.prependIfMissing("XYZabc", "xyz") = "xyzXYZabc" </pre> <p>With additional prefixes,</p> <pre> StringUtils.prependIfMissing(null, null, null) = null StringUtils.prependIfMissing("abc", null, null) = "abc" StringUtils.prependIfMissing("", "xyz", null) = "xyz" StringUtils.prependIfMissing("abc", "xyz", new CharSequence[]{null}) = "xyzabc" StringUtils.prependIfMissing("abc", "xyz", "") = "abc" StringUtils.prependIfMissing("abc", "xyz", "mno") = "xyzabc" StringUtils.prependIfMissing("xyzabc", "xyz", "mno") = "xyzabc" StringUtils.prependIfMissing("mnoabc", "xyz", "mno") = "mnoabc" StringUtils.prependIfMissing("XYZabc", "xyz", "mno") = "xyzXYZabc" StringUtils.prependIfMissing("MNOabc", "xyz", "mno") = "xyzMNOabc" </pre> @param str The string. @param prefix The prefix to prepend to the start of the string. @param prefixes Additional prefixes that are valid. @return A new String if prefix was prepended, the same string otherwise. @since 3.2 """ return prependIfMissing(str, prefix, false, prefixes); }
java
public static String prependIfMissing(final String str, final CharSequence prefix, final CharSequence... prefixes) { return prependIfMissing(str, prefix, false, prefixes); }
[ "public", "static", "String", "prependIfMissing", "(", "final", "String", "str", ",", "final", "CharSequence", "prefix", ",", "final", "CharSequence", "...", "prefixes", ")", "{", "return", "prependIfMissing", "(", "str", ",", "prefix", ",", "false", ",", "pre...
Prepends the prefix to the start of the string if the string does not already start with any of the prefixes. <pre> StringUtils.prependIfMissing(null, null) = null StringUtils.prependIfMissing("abc", null) = "abc" StringUtils.prependIfMissing("", "xyz") = "xyz" StringUtils.prependIfMissing("abc", "xyz") = "xyzabc" StringUtils.prependIfMissing("xyzabc", "xyz") = "xyzabc" StringUtils.prependIfMissing("XYZabc", "xyz") = "xyzXYZabc" </pre> <p>With additional prefixes,</p> <pre> StringUtils.prependIfMissing(null, null, null) = null StringUtils.prependIfMissing("abc", null, null) = "abc" StringUtils.prependIfMissing("", "xyz", null) = "xyz" StringUtils.prependIfMissing("abc", "xyz", new CharSequence[]{null}) = "xyzabc" StringUtils.prependIfMissing("abc", "xyz", "") = "abc" StringUtils.prependIfMissing("abc", "xyz", "mno") = "xyzabc" StringUtils.prependIfMissing("xyzabc", "xyz", "mno") = "xyzabc" StringUtils.prependIfMissing("mnoabc", "xyz", "mno") = "mnoabc" StringUtils.prependIfMissing("XYZabc", "xyz", "mno") = "xyzXYZabc" StringUtils.prependIfMissing("MNOabc", "xyz", "mno") = "xyzMNOabc" </pre> @param str The string. @param prefix The prefix to prepend to the start of the string. @param prefixes Additional prefixes that are valid. @return A new String if prefix was prepended, the same string otherwise. @since 3.2
[ "Prepends", "the", "prefix", "to", "the", "start", "of", "the", "string", "if", "the", "string", "does", "not", "already", "start", "with", "any", "of", "the", "prefixes", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8915-L8917
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java
ConditionalFunctions.ifNaN
public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) { """ Returned expression results in first non-MISSING, non-NaN number. Returns MISSING or NULL if a non-number input is encountered first """ return build("IFNAN", expression1, expression2, others); }
java
public static Expression ifNaN(Expression expression1, Expression expression2, Expression... others) { return build("IFNAN", expression1, expression2, others); }
[ "public", "static", "Expression", "ifNaN", "(", "Expression", "expression1", ",", "Expression", "expression2", ",", "Expression", "...", "others", ")", "{", "return", "build", "(", "\"IFNAN\"", ",", "expression1", ",", "expression2", ",", "others", ")", ";", "...
Returned expression results in first non-MISSING, non-NaN number. Returns MISSING or NULL if a non-number input is encountered first
[ "Returned", "expression", "results", "in", "first", "non", "-", "MISSING", "non", "-", "NaN", "number", ".", "Returns", "MISSING", "or", "NULL", "if", "a", "non", "-", "number", "input", "is", "encountered", "first" ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L108-L110
j256/ormlite-core
src/main/java/com/j256/ormlite/table/TableUtils.java
TableUtils.clearTable
public static <T> int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { """ Clear all data out of the table. For certain database types and with large sized tables, which may take a long time. In some configurations, it may be faster to drop and re-create the table. <p> <b>WARNING:</b> This is [obviously] very destructive and is unrecoverable. </p> """ return clearTable(connectionSource, tableConfig.getTableName()); }
java
public static <T> int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig) throws SQLException { return clearTable(connectionSource, tableConfig.getTableName()); }
[ "public", "static", "<", "T", ">", "int", "clearTable", "(", "ConnectionSource", "connectionSource", ",", "DatabaseTableConfig", "<", "T", ">", "tableConfig", ")", "throws", "SQLException", "{", "return", "clearTable", "(", "connectionSource", ",", "tableConfig", ...
Clear all data out of the table. For certain database types and with large sized tables, which may take a long time. In some configurations, it may be faster to drop and re-create the table. <p> <b>WARNING:</b> This is [obviously] very destructive and is unrecoverable. </p>
[ "Clear", "all", "data", "out", "of", "the", "table", ".", "For", "certain", "database", "types", "and", "with", "large", "sized", "tables", "which", "may", "take", "a", "long", "time", ".", "In", "some", "configurations", "it", "may", "be", "faster", "to...
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/table/TableUtils.java#L249-L252
paypal/SeLion
dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/DataProviderHelper.java
DataProviderHelper.parseIndexString
public static int[] parseIndexString(String value) { """ This function will parse the index string into separated individual indexes as needed. Calling the method with a string containing "1, 3, 5-7, 11, 12-14, 8" would return an list of integers {1, 3, 5, 6, 7, 11, 12, 13, 14, 8}. Use ',' to separate values, and use '-' to specify a continuous range. Presence of an invalid character would result in {@link DataProviderException}. @param value the input string represent the indexes to be parse. @return a list of indexes as an integer array """ logger.entering(value); List<Integer> indexes = new ArrayList<>(); int begin; int end; String[] parsed; String[] parsedIndex = value.split(","); for (String index : parsedIndex) { if (index.contains("-")) { parsed = index.split("-"); begin = Integer.parseInt(parsed[0].trim()); end = Integer.parseInt(parsed[1].trim()); for (int i = begin; i <= end; i++) { indexes.add(i); } } else { try { indexes.add(Integer.parseInt(index.trim())); } catch (NumberFormatException e) { String msg = new StringBuilder("Index '").append(index) .append("' is invalid. Please provide either individual numbers or ranges.") .append("\n Range needs to be de-marked by '-'").toString(); throw new DataProviderException(msg, e); } } } int[] indexArray = Ints.toArray(indexes); logger.exiting(indexArray); return indexArray; }
java
public static int[] parseIndexString(String value) { logger.entering(value); List<Integer> indexes = new ArrayList<>(); int begin; int end; String[] parsed; String[] parsedIndex = value.split(","); for (String index : parsedIndex) { if (index.contains("-")) { parsed = index.split("-"); begin = Integer.parseInt(parsed[0].trim()); end = Integer.parseInt(parsed[1].trim()); for (int i = begin; i <= end; i++) { indexes.add(i); } } else { try { indexes.add(Integer.parseInt(index.trim())); } catch (NumberFormatException e) { String msg = new StringBuilder("Index '").append(index) .append("' is invalid. Please provide either individual numbers or ranges.") .append("\n Range needs to be de-marked by '-'").toString(); throw new DataProviderException(msg, e); } } } int[] indexArray = Ints.toArray(indexes); logger.exiting(indexArray); return indexArray; }
[ "public", "static", "int", "[", "]", "parseIndexString", "(", "String", "value", ")", "{", "logger", ".", "entering", "(", "value", ")", ";", "List", "<", "Integer", ">", "indexes", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "begin", ";", "...
This function will parse the index string into separated individual indexes as needed. Calling the method with a string containing "1, 3, 5-7, 11, 12-14, 8" would return an list of integers {1, 3, 5, 6, 7, 11, 12, 13, 14, 8}. Use ',' to separate values, and use '-' to specify a continuous range. Presence of an invalid character would result in {@link DataProviderException}. @param value the input string represent the indexes to be parse. @return a list of indexes as an integer array
[ "This", "function", "will", "parse", "the", "index", "string", "into", "separated", "individual", "indexes", "as", "needed", ".", "Calling", "the", "method", "with", "a", "string", "containing", "1", "3", "5", "-", "7", "11", "12", "-", "14", "8", "would...
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/DataProviderHelper.java#L70-L101
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Color.java
Color.addToCopy
public Color addToCopy(Color c) { """ Add another colour to this one @param c The colour to add @return The copy which has had the color added to it """ Color copy = new Color(r,g,b,a); copy.r += c.r; copy.g += c.g; copy.b += c.b; copy.a += c.a; return copy; }
java
public Color addToCopy(Color c) { Color copy = new Color(r,g,b,a); copy.r += c.r; copy.g += c.g; copy.b += c.b; copy.a += c.a; return copy; }
[ "public", "Color", "addToCopy", "(", "Color", "c", ")", "{", "Color", "copy", "=", "new", "Color", "(", "r", ",", "g", ",", "b", ",", "a", ")", ";", "copy", ".", "r", "+=", "c", ".", "r", ";", "copy", ".", "g", "+=", "c", ".", "g", ";", "...
Add another colour to this one @param c The colour to add @return The copy which has had the color added to it
[ "Add", "another", "colour", "to", "this", "one" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Color.java#L367-L375
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.invokeConnectionSetter
public static void invokeConnectionSetter(Connection conn, String functionName, Object value) throws MjdbcException { """ Invocation of {@link java.sql.Connection} setter functions This function provides flexibility which required to use {@link java.sql.Connection} with different Java versions: 5/6 etc. @param conn SQL Connection @param functionName SQL Connection parameter name @param value value which would be set @throws org.midao.jdbc.core.exception.MjdbcException if property wasn't found """ if (MjdbcConstants.connectionBeanDescription.containsKey(functionName) == true) { MappingUtils.callSetter(conn, MjdbcConstants.connectionBeanDescription.get(functionName), value); } else { throw new MjdbcException(String.format("Property %s wasn't found", functionName)); } }
java
public static void invokeConnectionSetter(Connection conn, String functionName, Object value) throws MjdbcException { if (MjdbcConstants.connectionBeanDescription.containsKey(functionName) == true) { MappingUtils.callSetter(conn, MjdbcConstants.connectionBeanDescription.get(functionName), value); } else { throw new MjdbcException(String.format("Property %s wasn't found", functionName)); } }
[ "public", "static", "void", "invokeConnectionSetter", "(", "Connection", "conn", ",", "String", "functionName", ",", "Object", "value", ")", "throws", "MjdbcException", "{", "if", "(", "MjdbcConstants", ".", "connectionBeanDescription", ".", "containsKey", "(", "fun...
Invocation of {@link java.sql.Connection} setter functions This function provides flexibility which required to use {@link java.sql.Connection} with different Java versions: 5/6 etc. @param conn SQL Connection @param functionName SQL Connection parameter name @param value value which would be set @throws org.midao.jdbc.core.exception.MjdbcException if property wasn't found
[ "Invocation", "of", "{", "@link", "java", ".", "sql", ".", "Connection", "}", "setter", "functions", "This", "function", "provides", "flexibility", "which", "required", "to", "use", "{", "@link", "java", ".", "sql", ".", "Connection", "}", "with", "different...
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L243-L249
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findUniqueBoolean
public boolean findUniqueBoolean(@NotNull @SQL String sql, Object... args) { """ A convenience method for retrieving a single non-null boolean. @throws NonUniqueResultException if there is more then one row @throws EmptyResultException if there are no rows """ return findUniqueBoolean(SqlQuery.query(sql, args)); }
java
public boolean findUniqueBoolean(@NotNull @SQL String sql, Object... args) { return findUniqueBoolean(SqlQuery.query(sql, args)); }
[ "public", "boolean", "findUniqueBoolean", "(", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findUniqueBoolean", "(", "SqlQuery", ".", "query", "(", "sql", ",", "args", ")", ")", ";", "}" ]
A convenience method for retrieving a single non-null boolean. @throws NonUniqueResultException if there is more then one row @throws EmptyResultException if there are no rows
[ "A", "convenience", "method", "for", "retrieving", "a", "single", "non", "-", "null", "boolean", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L513-L515
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java
SSLChannelProvider.updatedSslSupport
protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) { """ This is called if the service is updated. @param ref reference to the service """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updatedSslSupport", props); } sslSupport = service; // If the default pid has changed.. we need to go hunting for who was using the default. String id = (String) props.get(SSL_CFG_REF); if (!defaultId.equals(id)) { for (SSLChannelOptions options : sslOptions.values()) { options.updateRefId(id); options.updateRegistration(bContext, sslConfigs); } defaultId = id; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId); } }
java
protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updatedSslSupport", props); } sslSupport = service; // If the default pid has changed.. we need to go hunting for who was using the default. String id = (String) props.get(SSL_CFG_REF); if (!defaultId.equals(id)) { for (SSLChannelOptions options : sslOptions.values()) { options.updateRefId(id); options.updateRegistration(bContext, sslConfigs); } defaultId = id; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId); } }
[ "protected", "void", "updatedSslSupport", "(", "SSLSupport", "service", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "...
This is called if the service is updated. @param ref reference to the service
[ "This", "is", "called", "if", "the", "service", "is", "updated", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L216-L235
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java
PropertyService.newProperty
private Property newProperty(String propertyName, String instanceName, String entity) { """ Returns an instance of the specified property, observing property aliases. @param propertyName Property name @param instanceName Instance name @param entity Entity list @return Newly created property. """ return new Property(toAlias(propertyName), instanceName, entity); }
java
private Property newProperty(String propertyName, String instanceName, String entity) { return new Property(toAlias(propertyName), instanceName, entity); }
[ "private", "Property", "newProperty", "(", "String", "propertyName", ",", "String", "instanceName", ",", "String", "entity", ")", "{", "return", "new", "Property", "(", "toAlias", "(", "propertyName", ")", ",", "instanceName", ",", "entity", ")", ";", "}" ]
Returns an instance of the specified property, observing property aliases. @param propertyName Property name @param instanceName Instance name @param entity Entity list @return Newly created property.
[ "Returns", "an", "instance", "of", "the", "specified", "property", "observing", "property", "aliases", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyService.java#L75-L77
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.readObjectProperty
private static String readObjectProperty(String ref, TypeDef source, Property property) { """ Returns the string representation of the code that reads an object property from a reference using a getter. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code. """ return ref + "." + getterOf(source, property).getName() + "()"; }
java
private static String readObjectProperty(String ref, TypeDef source, Property property) { return ref + "." + getterOf(source, property).getName() + "()"; }
[ "private", "static", "String", "readObjectProperty", "(", "String", "ref", ",", "TypeDef", "source", ",", "Property", "property", ")", "{", "return", "ref", "+", "\".\"", "+", "getterOf", "(", "source", ",", "property", ")", ".", "getName", "(", ")", "+", ...
Returns the string representation of the code that reads an object property from a reference using a getter. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "Returns", "the", "string", "representation", "of", "the", "code", "that", "reads", "an", "object", "property", "from", "a", "reference", "using", "a", "getter", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L599-L601
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.isInstanceOf
public <T> T isInstanceOf(final Class<?> type, final T obj, final String message, final Object... values) { """ <p>Validate that the argument is an instance of the specified class; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.classs, object, "Wrong class, object is of class %s", object.getClass().getName());</pre> @param <T> the type of the object to check @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the object @throws IllegalArgumentValidationException if argument is not of specified class @see #isInstanceOf(Class, Object) """ if (!type.isInstance(obj)) { fail(String.format(message, values)); } return obj; }
java
public <T> T isInstanceOf(final Class<?> type, final T obj, final String message, final Object... values) { if (!type.isInstance(obj)) { fail(String.format(message, values)); } return obj; }
[ "public", "<", "T", ">", "T", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "T", "obj", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "!", "type", ".", "isInstance", "...
<p>Validate that the argument is an instance of the specified class; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.classs, object, "Wrong class, object is of class %s", object.getClass().getName());</pre> @param <T> the type of the object to check @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the object @throws IllegalArgumentValidationException if argument is not of specified class @see #isInstanceOf(Class, Object)
[ "<p", ">", "Validate", "that", "the", "argument", "is", "an", "instance", "of", "the", "specified", "class", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "This", "method", "is", "useful", "when", "validating", ...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1574-L1579
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java
CrxApi.postPackageUpdateAsync
public com.squareup.okhttp.Call postPackageUpdateAsync(String groupName, String packageName, String version, String path, String filter, String charset_, final ApiCallback<String> callback) throws ApiException { """ (asynchronously) @param groupName (required) @param packageName (required) @param version (required) @param path (required) @param filter (optional) @param charset_ (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageUpdateValidateBeforeCall(groupName, packageName, version, path, filter, charset_, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call postPackageUpdateAsync(String groupName, String packageName, String version, String path, String filter, String charset_, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postPackageUpdateValidateBeforeCall(groupName, packageName, version, path, filter, charset_, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postPackageUpdateAsync", "(", "String", "groupName", ",", "String", "packageName", ",", "String", "version", ",", "String", "path", ",", "String", "filter", ",", "String", "charset_", ",", "final",...
(asynchronously) @param groupName (required) @param packageName (required) @param version (required) @param path (required) @param filter (optional) @param charset_ (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CrxApi.java#L747-L772
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/CentralAnalyzer.java
CentralAnalyzer.prepareFileTypeAnalyzer
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { """ Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization """ LOGGER.debug("Initializing Central analyzer"); LOGGER.debug("Central analyzer enabled: {}", isEnabled()); if (isEnabled()) { try { searcher = new CentralSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to Maven Central is malformed", ex); } } }
java
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { LOGGER.debug("Initializing Central analyzer"); LOGGER.debug("Central analyzer enabled: {}", isEnabled()); if (isEnabled()) { try { searcher = new CentralSearch(getSettings()); } catch (MalformedURLException ex) { setEnabled(false); throw new InitializationException("The configured URL to Maven Central is malformed", ex); } } }
[ "@", "Override", "public", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "LOGGER", ".", "debug", "(", "\"Initializing Central analyzer\"", ")", ";", "LOGGER", ".", "debug", "(", "\"Central analyzer enabled: {}...
Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization
[ "Initializes", "the", "analyzer", "once", "before", "any", "analysis", "is", "performed", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/CentralAnalyzer.java#L161-L173
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java
ParserBase.explodeArtifact
public ArtifactMetadata explodeArtifact(File archiveFile, File metadataFile) throws RepositoryArchiveException { """ This signature of explodeArtifact is called directly if the archive file and the metadata file may not be co-located e.g. when pulling them out of different parts of the build. @param archiveFile - the .jar or .esa file to look for a sibling zip for @param metadataFile - the *.metadata.zip file or null to use one co-located with the archiveFile @return The artifact metadata from the sibling zip or <code>null</code> if none was found @throws IOException @throws RepositoryArchiveException """ String path; try { path = archiveFile.getCanonicalPath(); } catch (IOException e) { throw new RepositoryArchiveException("Failed to get the path for the archive", archiveFile, e); } String zipPath; if (metadataFile != null) { try { zipPath = metadataFile.getCanonicalPath(); } catch (IOException e) { throw new RepositoryArchiveException("Failed to get the path for the metadata file", metadataFile, e); } } else { zipPath = path + ".metadata.zip"; } File zip = new File(zipPath); if (!zip.exists()) { return null; } return explodeZip(zip); }
java
public ArtifactMetadata explodeArtifact(File archiveFile, File metadataFile) throws RepositoryArchiveException { String path; try { path = archiveFile.getCanonicalPath(); } catch (IOException e) { throw new RepositoryArchiveException("Failed to get the path for the archive", archiveFile, e); } String zipPath; if (metadataFile != null) { try { zipPath = metadataFile.getCanonicalPath(); } catch (IOException e) { throw new RepositoryArchiveException("Failed to get the path for the metadata file", metadataFile, e); } } else { zipPath = path + ".metadata.zip"; } File zip = new File(zipPath); if (!zip.exists()) { return null; } return explodeZip(zip); }
[ "public", "ArtifactMetadata", "explodeArtifact", "(", "File", "archiveFile", ",", "File", "metadataFile", ")", "throws", "RepositoryArchiveException", "{", "String", "path", ";", "try", "{", "path", "=", "archiveFile", ".", "getCanonicalPath", "(", ")", ";", "}", ...
This signature of explodeArtifact is called directly if the archive file and the metadata file may not be co-located e.g. when pulling them out of different parts of the build. @param archiveFile - the .jar or .esa file to look for a sibling zip for @param metadataFile - the *.metadata.zip file or null to use one co-located with the archiveFile @return The artifact metadata from the sibling zip or <code>null</code> if none was found @throws IOException @throws RepositoryArchiveException
[ "This", "signature", "of", "explodeArtifact", "is", "called", "directly", "if", "the", "archive", "file", "and", "the", "metadata", "file", "may", "not", "be", "co", "-", "located", "e", ".", "g", ".", "when", "pulling", "them", "out", "of", "different", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L434-L459
apereo/cas
support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java
AbstractServiceValidateController.validateServiceTicket
protected Assertion validateServiceTicket(final WebApplicationService service, final String serviceTicketId) { """ Validate service ticket assertion. @param service the service @param serviceTicketId the service ticket id @return the assertion """ return serviceValidateConfigurationContext.getCentralAuthenticationService().validateServiceTicket(serviceTicketId, service); }
java
protected Assertion validateServiceTicket(final WebApplicationService service, final String serviceTicketId) { return serviceValidateConfigurationContext.getCentralAuthenticationService().validateServiceTicket(serviceTicketId, service); }
[ "protected", "Assertion", "validateServiceTicket", "(", "final", "WebApplicationService", "service", ",", "final", "String", "serviceTicketId", ")", "{", "return", "serviceValidateConfigurationContext", ".", "getCentralAuthenticationService", "(", ")", ".", "validateServiceTi...
Validate service ticket assertion. @param service the service @param serviceTicketId the service ticket id @return the assertion
[ "Validate", "service", "ticket", "assertion", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L225-L227
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesKey
public static void escapePropertiesKey(final Reader reader, final Writer writer, final PropertiesKeyEscapeLevel level) throws IOException { """ <p> Perform a (configurable) Java Properties Key <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.properties.PropertiesKeyEscapeLevel} argument value. </p> <p> All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapePropertiesKey*(...)</tt> methods call this one with preconfigured <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesKeyEscapeLevel}. @throws IOException if an input/output exception occurs """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } PropertiesKeyEscapeUtil.escape(reader, writer, level); }
java
public static void escapePropertiesKey(final Reader reader, final Writer writer, final PropertiesKeyEscapeLevel level) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } PropertiesKeyEscapeUtil.escape(reader, writer, level); }
[ "public", "static", "void", "escapePropertiesKey", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "PropertiesKeyEscapeLevel", "level", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "...
<p> Perform a (configurable) Java Properties Key <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.properties.PropertiesKeyEscapeLevel} argument value. </p> <p> All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapePropertiesKey*(...)</tt> methods call this one with preconfigured <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesKeyEscapeLevel}. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "Java", "Properties", "Key", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Write...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1169-L1181
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/PendingRequestsMap.java
PendingRequestsMap.addRequest
void addRequest(final InstanceType instanceType, final int numberOfInstances) { """ Adds the a pending request for the given number of instances of the given type to this map. @param instanceType the requested instance type @param numberOfInstances the requested number of instances of this type """ Integer numberOfRemainingInstances = this.pendingRequests.get(instanceType); if (numberOfRemainingInstances == null) { numberOfRemainingInstances = Integer.valueOf(numberOfInstances); } else { numberOfRemainingInstances = Integer.valueOf(numberOfRemainingInstances.intValue() + numberOfInstances); } this.pendingRequests.put(instanceType, numberOfRemainingInstances); }
java
void addRequest(final InstanceType instanceType, final int numberOfInstances) { Integer numberOfRemainingInstances = this.pendingRequests.get(instanceType); if (numberOfRemainingInstances == null) { numberOfRemainingInstances = Integer.valueOf(numberOfInstances); } else { numberOfRemainingInstances = Integer.valueOf(numberOfRemainingInstances.intValue() + numberOfInstances); } this.pendingRequests.put(instanceType, numberOfRemainingInstances); }
[ "void", "addRequest", "(", "final", "InstanceType", "instanceType", ",", "final", "int", "numberOfInstances", ")", "{", "Integer", "numberOfRemainingInstances", "=", "this", ".", "pendingRequests", ".", "get", "(", "instanceType", ")", ";", "if", "(", "numberOfRem...
Adds the a pending request for the given number of instances of the given type to this map. @param instanceType the requested instance type @param numberOfInstances the requested number of instances of this type
[ "Adds", "the", "a", "pending", "request", "for", "the", "given", "number", "of", "instances", "of", "the", "given", "type", "to", "this", "map", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/PendingRequestsMap.java#L55-L65
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.getInstance
public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException { """ Returns a Signature object that implements the specified signature algorithm. <p> This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Signature object encapsulating the SignatureSpi implementation from the first Provider that supports the specified algorithm is returned. <p> Note that the list of registered providers may be retrieved via the {@link Security#getProviders() Security.getProviders()} method. @param algorithm the standard name of the algorithm requested. See the Signature section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @return the new Signature object. @exception NoSuchAlgorithmException if no Provider supports a Signature implementation for the specified algorithm. @see Provider """ List<Service> list; if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { list = GetInstance.getServices(rsaIds); } else { list = GetInstance.getServices("Signature", algorithm); } Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " Signature not available"); } // try services until we find an Spi or a working Signature subclass NoSuchAlgorithmException failure; do { Service s = t.next(); if (isSpi(s)) { return new Delegate(algorithm); } else { // must be a subclass of Signature, disable dynamic selection try { Instance instance = GetInstance.getInstance(s, SignatureSpi.class); return getInstance(instance, algorithm); } catch (NoSuchAlgorithmException e) { failure = e; } } } while (t.hasNext()); throw failure; }
java
public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException { List<Service> list; if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { list = GetInstance.getServices(rsaIds); } else { list = GetInstance.getServices("Signature", algorithm); } Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " Signature not available"); } // try services until we find an Spi or a working Signature subclass NoSuchAlgorithmException failure; do { Service s = t.next(); if (isSpi(s)) { return new Delegate(algorithm); } else { // must be a subclass of Signature, disable dynamic selection try { Instance instance = GetInstance.getInstance(s, SignatureSpi.class); return getInstance(instance, algorithm); } catch (NoSuchAlgorithmException e) { failure = e; } } } while (t.hasNext()); throw failure; }
[ "public", "static", "Signature", "getInstance", "(", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "List", "<", "Service", ">", "list", ";", "if", "(", "algorithm", ".", "equalsIgnoreCase", "(", "RSA_SIGNATURE", ")", ")", "{", "list", ...
Returns a Signature object that implements the specified signature algorithm. <p> This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Signature object encapsulating the SignatureSpi implementation from the first Provider that supports the specified algorithm is returned. <p> Note that the list of registered providers may be retrieved via the {@link Security#getProviders() Security.getProviders()} method. @param algorithm the standard name of the algorithm requested. See the Signature section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @return the new Signature object. @exception NoSuchAlgorithmException if no Provider supports a Signature implementation for the specified algorithm. @see Provider
[ "Returns", "a", "Signature", "object", "that", "implements", "the", "specified", "signature", "algorithm", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L353-L384
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseShortObj
@Nullable public static Short parseShortObj (@Nullable final Object aObject) { """ Parse the given {@link Object} as {@link Short} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @return <code>null</code> if the object does not represent a valid value. """ return parseShortObj (aObject, DEFAULT_RADIX, null); }
java
@Nullable public static Short parseShortObj (@Nullable final Object aObject) { return parseShortObj (aObject, DEFAULT_RADIX, null); }
[ "@", "Nullable", "public", "static", "Short", "parseShortObj", "(", "@", "Nullable", "final", "Object", "aObject", ")", "{", "return", "parseShortObj", "(", "aObject", ",", "DEFAULT_RADIX", ",", "null", ")", ";", "}" ]
Parse the given {@link Object} as {@link Short} with radix {@value #DEFAULT_RADIX}. @param aObject The object to parse. May be <code>null</code>. @return <code>null</code> if the object does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "Object", "}", "as", "{", "@link", "Short", "}", "with", "radix", "{", "@value", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1259-L1263
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java
ChaincodeCollectionConfiguration.fromJsonFile
public static ChaincodeCollectionConfiguration fromJsonFile(File configFile) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException { """ Creates a new ChaincodeCollectionConfiguration instance configured with details supplied in a JSON file. @param configFile The file containing the network configuration @return A new ChaincodeCollectionConfiguration instance @throws InvalidArgumentException @throws IOException """ return fromFile(configFile, true); }
java
public static ChaincodeCollectionConfiguration fromJsonFile(File configFile) throws InvalidArgumentException, IOException, ChaincodeCollectionConfigurationException { return fromFile(configFile, true); }
[ "public", "static", "ChaincodeCollectionConfiguration", "fromJsonFile", "(", "File", "configFile", ")", "throws", "InvalidArgumentException", ",", "IOException", ",", "ChaincodeCollectionConfigurationException", "{", "return", "fromFile", "(", "configFile", ",", "true", ")"...
Creates a new ChaincodeCollectionConfiguration instance configured with details supplied in a JSON file. @param configFile The file containing the network configuration @return A new ChaincodeCollectionConfiguration instance @throws InvalidArgumentException @throws IOException
[ "Creates", "a", "new", "ChaincodeCollectionConfiguration", "instance", "configured", "with", "details", "supplied", "in", "a", "JSON", "file", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/ChaincodeCollectionConfiguration.java#L100-L102
plaid/plaid-java
src/main/java/com/plaid/client/internal/gson/Optional.java
Optional.of
public static <T, S extends T> Optional<T> of(S value) { """ Create a new Optional containing value. @param value The value contained. @return The value wrapped in an Optional. """ if (value == null) { throw new IllegalArgumentException("Optional does not support NULL, use Optional.empty() instead."); } return new Optional<T>(value); }
java
public static <T, S extends T> Optional<T> of(S value) { if (value == null) { throw new IllegalArgumentException("Optional does not support NULL, use Optional.empty() instead."); } return new Optional<T>(value); }
[ "public", "static", "<", "T", ",", "S", "extends", "T", ">", "Optional", "<", "T", ">", "of", "(", "S", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Optional does not support NULL, use O...
Create a new Optional containing value. @param value The value contained. @return The value wrapped in an Optional.
[ "Create", "a", "new", "Optional", "containing", "value", "." ]
train
https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/gson/Optional.java#L26-L32
btaz/data-util
src/main/java/com/btaz/util/tf/Template.java
Template.readResource
public static String readResource(String path) { """ This method looks for a file on the provided path and returns it as a string @param path path @return {@code String} text """ try { File file = ResourceUtil.getResourceFile(path); return ResourceUtil.readFromFileIntoString(file); } catch (Exception e) { throw new DataUtilException("Failed to load resource", e); } }
java
public static String readResource(String path) { try { File file = ResourceUtil.getResourceFile(path); return ResourceUtil.readFromFileIntoString(file); } catch (Exception e) { throw new DataUtilException("Failed to load resource", e); } }
[ "public", "static", "String", "readResource", "(", "String", "path", ")", "{", "try", "{", "File", "file", "=", "ResourceUtil", ".", "getResourceFile", "(", "path", ")", ";", "return", "ResourceUtil", ".", "readFromFileIntoString", "(", "file", ")", ";", "}"...
This method looks for a file on the provided path and returns it as a string @param path path @return {@code String} text
[ "This", "method", "looks", "for", "a", "file", "on", "the", "provided", "path", "and", "returns", "it", "as", "a", "string" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Template.java#L61-L68
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.from
public <A> Q from(Path<A> entity, Iterable<? extends A> col) { """ Add a query source @param <A> type of expression @param entity Path for the source @param col content of the source @return current object """ iterables.put(entity, col); getMetadata().addJoin(JoinType.DEFAULT, entity); return queryMixin.getSelf(); }
java
public <A> Q from(Path<A> entity, Iterable<? extends A> col) { iterables.put(entity, col); getMetadata().addJoin(JoinType.DEFAULT, entity); return queryMixin.getSelf(); }
[ "public", "<", "A", ">", "Q", "from", "(", "Path", "<", "A", ">", "entity", ",", "Iterable", "<", "?", "extends", "A", ">", "col", ")", "{", "iterables", ".", "put", "(", "entity", ",", "col", ")", ";", "getMetadata", "(", ")", ".", "addJoin", ...
Add a query source @param <A> type of expression @param entity Path for the source @param col content of the source @return current object
[ "Add", "a", "query", "source" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L76-L80
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/Assert.java
Assert.assertToken
public static void assertToken(int expectedType, String expectedText, LexerResults lexerResults) { """ Asserts the token produced by an ANTLR tester. @param expectedType the expected type of the token. @param expectedText the expected text of the token. @param lexerResults the result of {@link Work#scan(String)} which will produce the token to assert. """ assertToken(expectedType, expectedText, lexerResults.getToken()); }
java
public static void assertToken(int expectedType, String expectedText, LexerResults lexerResults) { assertToken(expectedType, expectedText, lexerResults.getToken()); }
[ "public", "static", "void", "assertToken", "(", "int", "expectedType", ",", "String", "expectedText", ",", "LexerResults", "lexerResults", ")", "{", "assertToken", "(", "expectedType", ",", "expectedText", ",", "lexerResults", ".", "getToken", "(", ")", ")", ";"...
Asserts the token produced by an ANTLR tester. @param expectedType the expected type of the token. @param expectedText the expected text of the token. @param lexerResults the result of {@link Work#scan(String)} which will produce the token to assert.
[ "Asserts", "the", "token", "produced", "by", "an", "ANTLR", "tester", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L74-L77
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.notEmpty
public static void notEmpty(Map<?, ?> map, String message, Object... arguments) { """ Asserts that the {@link Map} is not empty. The assertion holds if and only if the {@link Map} is not {@literal null} and contains at least 1 key/value mapping. @param map {@link Map} to evaluate. @param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Map} is {@literal null} or empty. @see #notEmpty(java.util.Map, RuntimeException) @see java.util.Map#isEmpty() """ notEmpty(map, new IllegalArgumentException(format(message, arguments))); }
java
public static void notEmpty(Map<?, ?> map, String message, Object... arguments) { notEmpty(map, new IllegalArgumentException(format(message, arguments))); }
[ "public", "static", "void", "notEmpty", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "notEmpty", "(", "map", ",", "new", "IllegalArgumentException", "(", "format", "(", "message", ",",...
Asserts that the {@link Map} is not empty. The assertion holds if and only if the {@link Map} is not {@literal null} and contains at least 1 key/value mapping. @param map {@link Map} to evaluate. @param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Map} is {@literal null} or empty. @see #notEmpty(java.util.Map, RuntimeException) @see java.util.Map#isEmpty()
[ "Asserts", "that", "the", "{", "@link", "Map", "}", "is", "not", "empty", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L1113-L1115
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.getDisplayName
public String getDisplayName(TimeZone tz, GenericNameType type, long date) { """ Returns the display name of the time zone for the given name type at the given date, or null if the display name is not available. @param tz the time zone @param type the generic name type - see {@link GenericNameType} @param date the date @return the display name of the time zone for the given name type at the given date, or null. """ String name = null; String tzCanonicalID = null; switch (type) { case LOCATION: tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } break; case LONG: case SHORT: name = formatGenericNonLocationName(tz, type, date); if (name == null) { tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } } break; } return name; }
java
public String getDisplayName(TimeZone tz, GenericNameType type, long date) { String name = null; String tzCanonicalID = null; switch (type) { case LOCATION: tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } break; case LONG: case SHORT: name = formatGenericNonLocationName(tz, type, date); if (name == null) { tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { name = getGenericLocationName(tzCanonicalID); } } break; } return name; }
[ "public", "String", "getDisplayName", "(", "TimeZone", "tz", ",", "GenericNameType", "type", ",", "long", "date", ")", "{", "String", "name", "=", "null", ";", "String", "tzCanonicalID", "=", "null", ";", "switch", "(", "type", ")", "{", "case", "LOCATION"...
Returns the display name of the time zone for the given name type at the given date, or null if the display name is not available. @param tz the time zone @param type the generic name type - see {@link GenericNameType} @param date the date @return the display name of the time zone for the given name type at the given date, or null.
[ "Returns", "the", "display", "name", "of", "the", "time", "zone", "for", "the", "given", "name", "type", "at", "the", "given", "date", "or", "null", "if", "the", "display", "name", "is", "not", "available", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L197-L219
hawkular/hawkular-alerts
engine/src/main/java/org/hawkular/alerts/engine/impl/PartitionManagerImpl.java
PartitionManagerImpl.add
private void add(Map<String, List<String>> partition, PartitionEntry entry) { """ /* Auxiliary function to transform a PartitionEntry object into a plain map representation. """ String tenantId = entry.getTenantId(); String triggerId = entry.getTriggerId(); if (partition.get(tenantId) == null) { partition.put(tenantId, new ArrayList<>()); } partition.get(tenantId).add(triggerId); }
java
private void add(Map<String, List<String>> partition, PartitionEntry entry) { String tenantId = entry.getTenantId(); String triggerId = entry.getTriggerId(); if (partition.get(tenantId) == null) { partition.put(tenantId, new ArrayList<>()); } partition.get(tenantId).add(triggerId); }
[ "private", "void", "add", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "partition", ",", "PartitionEntry", "entry", ")", "{", "String", "tenantId", "=", "entry", ".", "getTenantId", "(", ")", ";", "String", "triggerId", "=", "entry", ...
/* Auxiliary function to transform a PartitionEntry object into a plain map representation.
[ "/", "*", "Auxiliary", "function", "to", "transform", "a", "PartitionEntry", "object", "into", "a", "plain", "map", "representation", "." ]
train
https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/engine/src/main/java/org/hawkular/alerts/engine/impl/PartitionManagerImpl.java#L469-L476
att/AAF
cadi/core/src/main/java/com/att/cadi/Symm.java
Symm.depass
public long depass(final String password, final OutputStream os) throws IOException { """ Decrypt a password Skip Symm.ENC @param password @param os @return @throws IOException """ int offset = password.startsWith(ENC)?4:0; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset); exec(new AESExec() { @Override public void exec(AES aes) throws IOException { CipherOutputStream cos = aes.outputStream(baos, false); decode(bais,cos); cos.close(); // flush } }); byte[] bytes = baos.toByteArray(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); long time; if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization os.write(bytes); time = 0L; } else { int start=0; for(int i=0;i<3;++i) { start+=Math.abs(dis.readByte()); } start%=0x7; for(int i=0;i<start;++i) { dis.readByte(); } time = (dis.readInt() & 0xFFFF)|(System.currentTimeMillis()&0xFFFF0000); int minlength = dis.readByte(); if(minlength<0x9){ DataOutputStream dos = new DataOutputStream(os); for(int i=0;i<minlength;++i) { dis.readByte(); dos.writeByte(dis.readByte()); } } else { int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start; os.write(bytes, pre, bytes.length-pre); } } return time; }
java
public long depass(final String password, final OutputStream os) throws IOException { int offset = password.startsWith(ENC)?4:0; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset); exec(new AESExec() { @Override public void exec(AES aes) throws IOException { CipherOutputStream cos = aes.outputStream(baos, false); decode(bais,cos); cos.close(); // flush } }); byte[] bytes = baos.toByteArray(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); long time; if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization os.write(bytes); time = 0L; } else { int start=0; for(int i=0;i<3;++i) { start+=Math.abs(dis.readByte()); } start%=0x7; for(int i=0;i<start;++i) { dis.readByte(); } time = (dis.readInt() & 0xFFFF)|(System.currentTimeMillis()&0xFFFF0000); int minlength = dis.readByte(); if(minlength<0x9){ DataOutputStream dos = new DataOutputStream(os); for(int i=0;i<minlength;++i) { dis.readByte(); dos.writeByte(dis.readByte()); } } else { int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start; os.write(bytes, pre, bytes.length-pre); } } return time; }
[ "public", "long", "depass", "(", "final", "String", "password", ",", "final", "OutputStream", "os", ")", "throws", "IOException", "{", "int", "offset", "=", "password", ".", "startsWith", "(", "ENC", ")", "?", "4", ":", "0", ";", "final", "ByteArrayOutputS...
Decrypt a password Skip Symm.ENC @param password @param os @return @throws IOException
[ "Decrypt", "a", "password" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L682-L723
zeromq/jeromq
src/main/java/org/zeromq/proto/ZPicture.java
ZPicture.recvPicture
@Draft public Object[] recvPicture(Socket socket, String picture) { """ Receive a 'picture' message to the socket (or actor). @param picture The picture is a string that defines the type of each frame. This makes it easy to recv a complex multiframe message in one call. The picture can contain any of these characters, each corresponding to zero or one elements in the result: <table> <caption> </caption> <tr><td>i = int (stores signed integer)</td></tr> <tr><td>1 = int (stores 8-bit unsigned integer)</td></tr> <tr><td>2 = int (stores 16-bit unsigned integer)</td></tr> <tr><td>4 = long (stores 32-bit unsigned integer)</td></tr> <tr><td>8 = long (stores 64-bit unsigned integer)</td></tr> <tr><td>s = String</td></tr> <tr><td>b = byte[]</td></tr> <tr><td>f = ZFrame (creates zframe)</td></tr> <tr><td>m = ZMsg (creates a zmsg with the remaing frames)</td></tr> <tr><td>z = null, asserts empty frame (0 arguments)</td></tr> </table> Also see {@link #sendPicture(Socket, String, Object...)} how to send a multiframe picture. @return the picture elements as object array """ if (!FORMAT.matcher(picture).matches()) { throw new ZMQException(picture + " is not in expected format " + FORMAT.pattern(), ZError.EPROTO); } Object[] elements = new Object[picture.length()]; for (int index = 0; index < picture.length(); index++) { char pattern = picture.charAt(index); switch (pattern) { case 'i': { elements[index] = Integer.valueOf(socket.recvStr()); break; } case '1': { elements[index] = (0xff) & Integer.valueOf(socket.recvStr()); break; } case '2': { elements[index] = (0xffff) & Integer.valueOf(socket.recvStr()); break; } case '4': { elements[index] = (0xffffffff) & Integer.valueOf(socket.recvStr()); break; } case '8': { elements[index] = Long.valueOf(socket.recvStr()); break; } case 's': { elements[index] = socket.recvStr(); break; } case 'b': case 'c': { elements[index] = socket.recv(); break; } case 'f': { elements[index] = ZFrame.recvFrame(socket); break; } case 'm': { elements[index] = ZMsg.recvMsg(socket); break; } case 'z': { ZFrame zeroFrame = ZFrame.recvFrame(socket); if (zeroFrame == null || zeroFrame.size() > 0) { throw new ZMQException("zero frame is not empty", ZError.EPROTO); } elements[index] = new ZFrame((byte[]) null); break; } default: assert (false) : "invalid picture element '" + pattern + "'"; } } return elements; }
java
@Draft public Object[] recvPicture(Socket socket, String picture) { if (!FORMAT.matcher(picture).matches()) { throw new ZMQException(picture + " is not in expected format " + FORMAT.pattern(), ZError.EPROTO); } Object[] elements = new Object[picture.length()]; for (int index = 0; index < picture.length(); index++) { char pattern = picture.charAt(index); switch (pattern) { case 'i': { elements[index] = Integer.valueOf(socket.recvStr()); break; } case '1': { elements[index] = (0xff) & Integer.valueOf(socket.recvStr()); break; } case '2': { elements[index] = (0xffff) & Integer.valueOf(socket.recvStr()); break; } case '4': { elements[index] = (0xffffffff) & Integer.valueOf(socket.recvStr()); break; } case '8': { elements[index] = Long.valueOf(socket.recvStr()); break; } case 's': { elements[index] = socket.recvStr(); break; } case 'b': case 'c': { elements[index] = socket.recv(); break; } case 'f': { elements[index] = ZFrame.recvFrame(socket); break; } case 'm': { elements[index] = ZMsg.recvMsg(socket); break; } case 'z': { ZFrame zeroFrame = ZFrame.recvFrame(socket); if (zeroFrame == null || zeroFrame.size() > 0) { throw new ZMQException("zero frame is not empty", ZError.EPROTO); } elements[index] = new ZFrame((byte[]) null); break; } default: assert (false) : "invalid picture element '" + pattern + "'"; } } return elements; }
[ "@", "Draft", "public", "Object", "[", "]", "recvPicture", "(", "Socket", "socket", ",", "String", "picture", ")", "{", "if", "(", "!", "FORMAT", ".", "matcher", "(", "picture", ")", ".", "matches", "(", ")", ")", "{", "throw", "new", "ZMQException", ...
Receive a 'picture' message to the socket (or actor). @param picture The picture is a string that defines the type of each frame. This makes it easy to recv a complex multiframe message in one call. The picture can contain any of these characters, each corresponding to zero or one elements in the result: <table> <caption> </caption> <tr><td>i = int (stores signed integer)</td></tr> <tr><td>1 = int (stores 8-bit unsigned integer)</td></tr> <tr><td>2 = int (stores 16-bit unsigned integer)</td></tr> <tr><td>4 = long (stores 32-bit unsigned integer)</td></tr> <tr><td>8 = long (stores 64-bit unsigned integer)</td></tr> <tr><td>s = String</td></tr> <tr><td>b = byte[]</td></tr> <tr><td>f = ZFrame (creates zframe)</td></tr> <tr><td>m = ZMsg (creates a zmsg with the remaing frames)</td></tr> <tr><td>z = null, asserts empty frame (0 arguments)</td></tr> </table> Also see {@link #sendPicture(Socket, String, Object...)} how to send a multiframe picture. @return the picture elements as object array
[ "Receive", "a", "picture", "message", "to", "the", "socket", "(", "or", "actor", ")", "." ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/proto/ZPicture.java#L369-L430
opentelecoms-org/zrtp-java
src/zorg/platform/j2se/DiffieHellmanSuiteImpl.java
DiffieHellmanSuiteImpl.setAlgorithm
public void setAlgorithm(KeyAgreementType dh) { """ DH3K RIM implementation is currently buggy and DOES NOT WORK!!! """ log("DH algorithm set: " + getDHName(dhMode) + " -> " + getDHName(dh)); try { if(dhMode != null && dh.keyType == dhMode.keyType) return; dhMode = dh; switch (dhMode.keyType) { case KeyAgreementType.DH_MODE_DH3K: DHParameterSpec paramSpec = new DHParameterSpec(dhP, dhG, DH_EXP_LENGTH); dhKeyGen = KeyPairGenerator.getInstance(ALGORITHM_DH); dhKeyGen.initialize(paramSpec, sr); dhKeyPair = dhKeyGen.generateKeyPair(); clearEcdh(); break; case KeyAgreementType.DH_MODE_EC25: setupEC(256); break; case KeyAgreementType.DH_MODE_EC38: default: setupEC(384); break; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); throw new RuntimeException("Failed init Diffie-Hellman: " + e.getClass().getName() + ": " + e.getMessage() + ", bitlength p = " + dhP.bitCount()); } }
java
public void setAlgorithm(KeyAgreementType dh) { log("DH algorithm set: " + getDHName(dhMode) + " -> " + getDHName(dh)); try { if(dhMode != null && dh.keyType == dhMode.keyType) return; dhMode = dh; switch (dhMode.keyType) { case KeyAgreementType.DH_MODE_DH3K: DHParameterSpec paramSpec = new DHParameterSpec(dhP, dhG, DH_EXP_LENGTH); dhKeyGen = KeyPairGenerator.getInstance(ALGORITHM_DH); dhKeyGen.initialize(paramSpec, sr); dhKeyPair = dhKeyGen.generateKeyPair(); clearEcdh(); break; case KeyAgreementType.DH_MODE_EC25: setupEC(256); break; case KeyAgreementType.DH_MODE_EC38: default: setupEC(384); break; } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); throw new RuntimeException("Failed init Diffie-Hellman: " + e.getClass().getName() + ": " + e.getMessage() + ", bitlength p = " + dhP.bitCount()); } }
[ "public", "void", "setAlgorithm", "(", "KeyAgreementType", "dh", ")", "{", "log", "(", "\"DH algorithm set: \"", "+", "getDHName", "(", "dhMode", ")", "+", "\" -> \"", "+", "getDHName", "(", "dh", ")", ")", ";", "try", "{", "if", "(", "dhMode", "!=", "nu...
DH3K RIM implementation is currently buggy and DOES NOT WORK!!!
[ "DH3K", "RIM", "implementation", "is", "currently", "buggy", "and", "DOES", "NOT", "WORK!!!" ]
train
https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/j2se/DiffieHellmanSuiteImpl.java#L176-L203
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesManagementApi.java
DevicesManagementApi.updateDeviceTypesInfo
public DeviceTypesInfoEnvelope updateDeviceTypesInfo(String dtid, DeviceTypesInfo deviceTypeInfo) throws ApiException { """ Updates a device type information Updates a device type information @param dtid Device type ID. (required) @param deviceTypeInfo Device type info object to be set (required) @return DeviceTypesInfoEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DeviceTypesInfoEnvelope> resp = updateDeviceTypesInfoWithHttpInfo(dtid, deviceTypeInfo); return resp.getData(); }
java
public DeviceTypesInfoEnvelope updateDeviceTypesInfo(String dtid, DeviceTypesInfo deviceTypeInfo) throws ApiException { ApiResponse<DeviceTypesInfoEnvelope> resp = updateDeviceTypesInfoWithHttpInfo(dtid, deviceTypeInfo); return resp.getData(); }
[ "public", "DeviceTypesInfoEnvelope", "updateDeviceTypesInfo", "(", "String", "dtid", ",", "DeviceTypesInfo", "deviceTypeInfo", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceTypesInfoEnvelope", ">", "resp", "=", "updateDeviceTypesInfoWithHttpInfo", "(", "dti...
Updates a device type information Updates a device type information @param dtid Device type ID. (required) @param deviceTypeInfo Device type info object to be set (required) @return DeviceTypesInfoEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Updates", "a", "device", "type", "information", "Updates", "a", "device", "type", "information" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1554-L1557
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/array/AWUtil.java
AWUtil.safeWrite
public static <T, U extends T> int safeWrite(ArrayWritable<U> aw, T[] array) { """ Writes the complete container data to an array. This method ensures that the array's capacity is not exceeded. @param aw the container. @param array the array @return the number of elements copied """ int num = aw.size(); if (num <= 0) { return 0; } if (num > array.length) { num = array.length; } aw.writeToArray(0, array, 0, num); return num; }
java
public static <T, U extends T> int safeWrite(ArrayWritable<U> aw, T[] array) { int num = aw.size(); if (num <= 0) { return 0; } if (num > array.length) { num = array.length; } aw.writeToArray(0, array, 0, num); return num; }
[ "public", "static", "<", "T", ",", "U", "extends", "T", ">", "int", "safeWrite", "(", "ArrayWritable", "<", "U", ">", "aw", ",", "T", "[", "]", "array", ")", "{", "int", "num", "=", "aw", ".", "size", "(", ")", ";", "if", "(", "num", "<=", "0...
Writes the complete container data to an array. This method ensures that the array's capacity is not exceeded. @param aw the container. @param array the array @return the number of elements copied
[ "Writes", "the", "complete", "container", "data", "to", "an", "array", ".", "This", "method", "ensures", "that", "the", "array", "s", "capacity", "is", "not", "exceeded", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/array/AWUtil.java#L46-L56
netty/netty
common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java
ThreadLocalRandom.nextInt
public int nextInt(int least, int bound) { """ Returns a pseudorandom, uniformly distributed value between the given least value (inclusive) and bound (exclusive). @param least the least value returned @param bound the upper bound (exclusive) @throws IllegalArgumentException if least greater than or equal to bound @return the next value """ if (least >= bound) { throw new IllegalArgumentException(); } return nextInt(bound - least) + least; }
java
public int nextInt(int least, int bound) { if (least >= bound) { throw new IllegalArgumentException(); } return nextInt(bound - least) + least; }
[ "public", "int", "nextInt", "(", "int", "least", ",", "int", "bound", ")", "{", "if", "(", "least", ">=", "bound", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "nextInt", "(", "bound", "-", "least", ")", "+", "l...
Returns a pseudorandom, uniformly distributed value between the given least value (inclusive) and bound (exclusive). @param least the least value returned @param bound the upper bound (exclusive) @throws IllegalArgumentException if least greater than or equal to bound @return the next value
[ "Returns", "a", "pseudorandom", "uniformly", "distributed", "value", "between", "the", "given", "least", "value", "(", "inclusive", ")", "and", "bound", "(", "exclusive", ")", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java#L296-L301
nats-io/java-nats
src/main/java/io/nats/client/NKey.java
NKey.getPublicKey
public char[] getPublicKey() throws GeneralSecurityException, IOException { """ @return the encoded public key for this NKey @throws GeneralSecurityException if there is an encryption problem @throws IOException if there is a problem encoding the public key """ if (publicKey != null) { return publicKey; } KeyPair keys = getKeyPair(); EdDSAPublicKey pubKey = (EdDSAPublicKey) keys.getPublic(); byte[] pubBytes = pubKey.getAbyte(); return encode(this.type, pubBytes); }
java
public char[] getPublicKey() throws GeneralSecurityException, IOException { if (publicKey != null) { return publicKey; } KeyPair keys = getKeyPair(); EdDSAPublicKey pubKey = (EdDSAPublicKey) keys.getPublic(); byte[] pubBytes = pubKey.getAbyte(); return encode(this.type, pubBytes); }
[ "public", "char", "[", "]", "getPublicKey", "(", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "if", "(", "publicKey", "!=", "null", ")", "{", "return", "publicKey", ";", "}", "KeyPair", "keys", "=", "getKeyPair", "(", ")", ";", "EdDS...
@return the encoded public key for this NKey @throws GeneralSecurityException if there is an encryption problem @throws IOException if there is a problem encoding the public key
[ "@return", "the", "encoded", "public", "key", "for", "this", "NKey" ]
train
https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L698-L708
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
TiffITProfile.validateIfdSD
private void validateIfdSD(IFD ifd, int p) { """ Validate Screened Data image. @param ifd the ifd @param p the profile (default = 0, P2 = 2) """ IfdTags metadata = ifd.getMetadata(); if (p == 2) { checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0}); } checkRequiredTag(metadata, "ImageLength", 1); checkRequiredTag(metadata, "ImageWidth", 1); checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1}); checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8}); checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5}); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 0) { checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8}); } else { checkRequiredTag(metadata, "Orientation", 1, new long[]{1}); } if (p == 2) { checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4}); } checkRequiredTag(metadata, "StripBYTECount", 1); checkRequiredTag(metadata, "XResolution", 1); checkRequiredTag(metadata, "YResolution", 1); checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2}); if (p == 2) { checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3}); checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4}); } checkRequiredTag(metadata, "InkSet", 1, new long[]{1}); checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2}); }
java
private void validateIfdSD(IFD ifd, int p) { IfdTags metadata = ifd.getMetadata(); if (p == 2) { checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0}); } checkRequiredTag(metadata, "ImageLength", 1); checkRequiredTag(metadata, "ImageWidth", 1); checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1}); checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8}); checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5}); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 0) { checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8}); } else { checkRequiredTag(metadata, "Orientation", 1, new long[]{1}); } if (p == 2) { checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4}); } checkRequiredTag(metadata, "StripBYTECount", 1); checkRequiredTag(metadata, "XResolution", 1); checkRequiredTag(metadata, "YResolution", 1); checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2}); if (p == 2) { checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3}); checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4}); } checkRequiredTag(metadata, "InkSet", 1, new long[]{1}); checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2}); }
[ "private", "void", "validateIfdSD", "(", "IFD", "ifd", ",", "int", "p", ")", "{", "IfdTags", "metadata", "=", "ifd", ".", "getMetadata", "(", ")", ";", "if", "(", "p", "==", "2", ")", "{", "checkRequiredTag", "(", "metadata", ",", "\"NewSubfileType\"", ...
Validate Screened Data image. @param ifd the ifd @param p the profile (default = 0, P2 = 2)
[ "Validate", "Screened", "Data", "image", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L551-L581
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/crdt/ReplicatedVectorClocks.java
ReplicatedVectorClocks.setReplicatedVectorClocks
public void setReplicatedVectorClocks(String serviceName, String memberUUID, Map<String, VectorClock> vectorClocks) { """ Sets the vector clock map for the given {@code serviceName} and {@code memberUUID}. The vector clock map contains mappings from CRDT name to the last successfully replicated CRDT state version. All CRDTs in this map should be of the same type. @param serviceName the service name @param memberUUID the target member UUID @param vectorClocks the vector clock map to set @see CRDTReplicationAwareService """ replicatedVectorClocks.put(new ReplicatedVectorClockId(serviceName, memberUUID), Collections.unmodifiableMap(vectorClocks)); }
java
public void setReplicatedVectorClocks(String serviceName, String memberUUID, Map<String, VectorClock> vectorClocks) { replicatedVectorClocks.put(new ReplicatedVectorClockId(serviceName, memberUUID), Collections.unmodifiableMap(vectorClocks)); }
[ "public", "void", "setReplicatedVectorClocks", "(", "String", "serviceName", ",", "String", "memberUUID", ",", "Map", "<", "String", ",", "VectorClock", ">", "vectorClocks", ")", "{", "replicatedVectorClocks", ".", "put", "(", "new", "ReplicatedVectorClockId", "(", ...
Sets the vector clock map for the given {@code serviceName} and {@code memberUUID}. The vector clock map contains mappings from CRDT name to the last successfully replicated CRDT state version. All CRDTs in this map should be of the same type. @param serviceName the service name @param memberUUID the target member UUID @param vectorClocks the vector clock map to set @see CRDTReplicationAwareService
[ "Sets", "the", "vector", "clock", "map", "for", "the", "given", "{", "@code", "serviceName", "}", "and", "{", "@code", "memberUUID", "}", ".", "The", "vector", "clock", "map", "contains", "mappings", "from", "CRDT", "name", "to", "the", "last", "successful...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/ReplicatedVectorClocks.java#L81-L84
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java
ManagementChannelReceiver.handlePing
private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException { """ Handle a simple ping request. @param channel the channel @param header the protocol header @throws IOException for any error """ final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion()); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
java
private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException { final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion()); final MessageOutputStream output = channel.writeMessage(); try { writeHeader(response, output); output.close(); } finally { StreamUtils.safeClose(output); } }
[ "private", "static", "void", "handlePing", "(", "final", "Channel", "channel", ",", "final", "ManagementProtocolHeader", "header", ")", "throws", "IOException", "{", "final", "ManagementProtocolHeader", "response", "=", "new", "ManagementPongHeader", "(", "header", "....
Handle a simple ping request. @param channel the channel @param header the protocol header @throws IOException for any error
[ "Handle", "a", "simple", "ping", "request", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java#L142-L151
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/Engine.java
Engine.preload
public void preload(Index index, String sourcesName) throws Exception { """ Loads all of the XSL executables. This is a time consuming operation. @param index @param sourcesName A stylesheet reference. @throws Exception If the stylesheet fail to compile. """ for (String key : index.getTestKeys()) { TestEntry te = index.getTest(key); loadExecutable(te, sourcesName); } for (String key : index.getFunctionKeys()) { List<FunctionEntry> functions = index.getFunctions(key); for (FunctionEntry fe : functions) { if (!fe.isJava()) { loadExecutable(fe, sourcesName); } } } }
java
public void preload(Index index, String sourcesName) throws Exception { for (String key : index.getTestKeys()) { TestEntry te = index.getTest(key); loadExecutable(te, sourcesName); } for (String key : index.getFunctionKeys()) { List<FunctionEntry> functions = index.getFunctions(key); for (FunctionEntry fe : functions) { if (!fe.isJava()) { loadExecutable(fe, sourcesName); } } } }
[ "public", "void", "preload", "(", "Index", "index", ",", "String", "sourcesName", ")", "throws", "Exception", "{", "for", "(", "String", "key", ":", "index", ".", "getTestKeys", "(", ")", ")", "{", "TestEntry", "te", "=", "index", ".", "getTest", "(", ...
Loads all of the XSL executables. This is a time consuming operation. @param index @param sourcesName A stylesheet reference. @throws Exception If the stylesheet fail to compile.
[ "Loads", "all", "of", "the", "XSL", "executables", ".", "This", "is", "a", "time", "consuming", "operation", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/Engine.java#L136-L149
fernandospr/javapns-jdk16
src/main/java/javapns/communication/ProxyManager.java
ProxyManager.setJVMProxy
public static void setJVMProxy(String host, String port) { """ Configure a proxy to use for HTTPS connections created anywhere in the JVM (not recommended). @param host the proxyHost @param port the proxyPort """ System.setProperty(JVM_PROXY_HOST_PROPERTY, host); System.setProperty(JVM_PROXY_PORT_PROPERTY, port); }
java
public static void setJVMProxy(String host, String port) { System.setProperty(JVM_PROXY_HOST_PROPERTY, host); System.setProperty(JVM_PROXY_PORT_PROPERTY, port); }
[ "public", "static", "void", "setJVMProxy", "(", "String", "host", ",", "String", "port", ")", "{", "System", ".", "setProperty", "(", "JVM_PROXY_HOST_PROPERTY", ",", "host", ")", ";", "System", ".", "setProperty", "(", "JVM_PROXY_PORT_PROPERTY", ",", "port", "...
Configure a proxy to use for HTTPS connections created anywhere in the JVM (not recommended). @param host the proxyHost @param port the proxyPort
[ "Configure", "a", "proxy", "to", "use", "for", "HTTPS", "connections", "created", "anywhere", "in", "the", "JVM", "(", "not", "recommended", ")", "." ]
train
https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/communication/ProxyManager.java#L39-L42
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.createVector
public static ImmutableVector2 createVector(final double x, final double y) { """ Creates a new immutable 2D column vector. @param x the x coordinate of the new vector @param y the y coordinate of the new vector @return the new vector """ return new ImmutableVector2(new ImmutableData(2, 1) { @Override public double getQuick(int row, int col) { if (row == 0) return x; else return y; } }); }
java
public static ImmutableVector2 createVector(final double x, final double y) { return new ImmutableVector2(new ImmutableData(2, 1) { @Override public double getQuick(int row, int col) { if (row == 0) return x; else return y; } }); }
[ "public", "static", "ImmutableVector2", "createVector", "(", "final", "double", "x", ",", "final", "double", "y", ")", "{", "return", "new", "ImmutableVector2", "(", "new", "ImmutableData", "(", "2", ",", "1", ")", "{", "@", "Override", "public", "double", ...
Creates a new immutable 2D column vector. @param x the x coordinate of the new vector @param y the y coordinate of the new vector @return the new vector
[ "Creates", "a", "new", "immutable", "2D", "column", "vector", "." ]
train
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L24-L34
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XNElement.java
XNElement.get
public String get(String attributeName) { """ Retrieve the first attribute which has the given local attribute name. @param attributeName the attribute name @return the attribute value or null if no such attribute """ // check first for a namespace-less attribute String attr = attributes.get(new XAttributeName(attributeName, null, null)); if (attr == null) { // find any attribute ignoring namespace for (XAttributeName n : attributes.keySet()) { if (Objects.equals(n.name, attributeName)) { return attributes.get(n); } } } return attr; }
java
public String get(String attributeName) { // check first for a namespace-less attribute String attr = attributes.get(new XAttributeName(attributeName, null, null)); if (attr == null) { // find any attribute ignoring namespace for (XAttributeName n : attributes.keySet()) { if (Objects.equals(n.name, attributeName)) { return attributes.get(n); } } } return attr; }
[ "public", "String", "get", "(", "String", "attributeName", ")", "{", "// check first for a namespace-less attribute", "String", "attr", "=", "attributes", ".", "get", "(", "new", "XAttributeName", "(", "attributeName", ",", "null", ",", "null", ")", ")", ";", "i...
Retrieve the first attribute which has the given local attribute name. @param attributeName the attribute name @return the attribute value or null if no such attribute
[ "Retrieve", "the", "first", "attribute", "which", "has", "the", "given", "local", "attribute", "name", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L667-L679