repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsPropertyTypeFloat
public FessMessages addErrorsPropertyTypeFloat(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_property_type_float, arg0)); return this; }
java
public FessMessages addErrorsPropertyTypeFloat(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_property_type_float, arg0)); return this; }
[ "public", "FessMessages", "addErrorsPropertyTypeFloat", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_property_type_float", ",", "arg0",...
Add the created action message for the key 'errors.property_type_float' with parameters. <pre> message: {0} should be numeric. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "property_type_float", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "0", "}", "should", "be", "numeric", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2230-L2234
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java
DFSAdmin.getBlockInfo
private int getBlockInfo(String[] argv, int i) throws IOException { long blockId = Long.valueOf(argv[i++]); LocatedBlockWithFileName locatedBlock = getDFS().getClient().getBlockInfo(blockId); if (null == locatedBlock) { System.err.println("Could not find the block with id : " + blockId); return -1; } StringBuilder sb = new StringBuilder(); sb.append("block: ") .append(locatedBlock.getBlock()).append("\n") .append("filename: ") .append(locatedBlock.getFileName()).append("\n") .append("locations: "); DatanodeInfo[] locs = locatedBlock.getLocations(); for (int k=0; k<locs.length; k++) { if (k > 0) { sb.append(" , "); } sb.append(locs[k].getHostName()); } System.out.println(sb.toString()); return 0; }
java
private int getBlockInfo(String[] argv, int i) throws IOException { long blockId = Long.valueOf(argv[i++]); LocatedBlockWithFileName locatedBlock = getDFS().getClient().getBlockInfo(blockId); if (null == locatedBlock) { System.err.println("Could not find the block with id : " + blockId); return -1; } StringBuilder sb = new StringBuilder(); sb.append("block: ") .append(locatedBlock.getBlock()).append("\n") .append("filename: ") .append(locatedBlock.getFileName()).append("\n") .append("locations: "); DatanodeInfo[] locs = locatedBlock.getLocations(); for (int k=0; k<locs.length; k++) { if (k > 0) { sb.append(" , "); } sb.append(locs[k].getHostName()); } System.out.println(sb.toString()); return 0; }
[ "private", "int", "getBlockInfo", "(", "String", "[", "]", "argv", ",", "int", "i", ")", "throws", "IOException", "{", "long", "blockId", "=", "Long", ".", "valueOf", "(", "argv", "[", "i", "++", "]", ")", ";", "LocatedBlockWithFileName", "locatedBlock", ...
Display the filename the block belongs to and its locations. @throws IOException
[ "Display", "the", "filename", "the", "block", "belongs", "to", "and", "its", "locations", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L1009-L1036
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.relativePath
public static String relativePath(File self, File to) throws IOException { String fromPath = self.getCanonicalPath(); String toPath = to.getCanonicalPath(); // build the path stack info to compare String[] fromPathStack = getPathStack(fromPath); String[] toPathStack = getPathStack(toPath); if (0 < toPathStack.length && 0 < fromPathStack.length) { if (!fromPathStack[0].equals(toPathStack[0])) { // not the same device (would be "" on Linux/Unix) return getPath(Arrays.asList(toPathStack)); } } else { // no comparison possible return getPath(Arrays.asList(toPathStack)); } int minLength = Math.min(fromPathStack.length, toPathStack.length); int same = 1; // Used outside the for loop // get index of parts which are equal while (same < minLength && fromPathStack[same].equals(toPathStack[same])) { same++; } List<String> relativePathStack = new ArrayList<String>(); // if "from" part is longer, fill it up with ".." // to reach path which is equal to both paths for (int i = same; i < fromPathStack.length; i++) { relativePathStack.add(".."); } // fill it up path with parts which were not equal relativePathStack.addAll(Arrays.asList(toPathStack).subList(same, toPathStack.length)); return getPath(relativePathStack); }
java
public static String relativePath(File self, File to) throws IOException { String fromPath = self.getCanonicalPath(); String toPath = to.getCanonicalPath(); // build the path stack info to compare String[] fromPathStack = getPathStack(fromPath); String[] toPathStack = getPathStack(toPath); if (0 < toPathStack.length && 0 < fromPathStack.length) { if (!fromPathStack[0].equals(toPathStack[0])) { // not the same device (would be "" on Linux/Unix) return getPath(Arrays.asList(toPathStack)); } } else { // no comparison possible return getPath(Arrays.asList(toPathStack)); } int minLength = Math.min(fromPathStack.length, toPathStack.length); int same = 1; // Used outside the for loop // get index of parts which are equal while (same < minLength && fromPathStack[same].equals(toPathStack[same])) { same++; } List<String> relativePathStack = new ArrayList<String>(); // if "from" part is longer, fill it up with ".." // to reach path which is equal to both paths for (int i = same; i < fromPathStack.length; i++) { relativePathStack.add(".."); } // fill it up path with parts which were not equal relativePathStack.addAll(Arrays.asList(toPathStack).subList(same, toPathStack.length)); return getPath(relativePathStack); }
[ "public", "static", "String", "relativePath", "(", "File", "self", ",", "File", "to", ")", "throws", "IOException", "{", "String", "fromPath", "=", "self", ".", "getCanonicalPath", "(", ")", ";", "String", "toPath", "=", "to", ".", "getCanonicalPath", "(", ...
Relative path to file. @param self the <code>File</code> to calculate the path from @param to the <code>File</code> to calculate the path to @return the relative path between the files
[ "Relative", "path", "to", "file", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1650-L1689
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putDouble
public static void putDouble(final String key, final double value) { final Editor editor = getPreferences().edit(); editor.putLong(key, Double.doubleToRawLongBits(value)); editor.apply(); }
java
public static void putDouble(final String key, final double value) { final Editor editor = getPreferences().edit(); editor.putLong(key, Double.doubleToRawLongBits(value)); editor.apply(); }
[ "public", "static", "void", "putDouble", "(", "final", "String", "key", ",", "final", "double", "value", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ";", "editor", ".", "putLong", "(", "key", ",", "Dou...
Stores a double value as a long raw bits value. @param key The name of the preference to modify. @param value The double value to be save in the preferences. @see android.content.SharedPreferences.Editor#putLong(String, long)
[ "Stores", "a", "double", "value", "as", "a", "long", "raw", "bits", "value", "." ]
train
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L303-L307
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.copyFile
public static File copyFile(String src, String dest, StandardCopyOption... options) throws IORuntimeException { Assert.notBlank(src, "Source File path is blank !"); Assert.notNull(src, "Destination File path is null !"); return copyFile(Paths.get(src), Paths.get(dest), options).toFile(); }
java
public static File copyFile(String src, String dest, StandardCopyOption... options) throws IORuntimeException { Assert.notBlank(src, "Source File path is blank !"); Assert.notNull(src, "Destination File path is null !"); return copyFile(Paths.get(src), Paths.get(dest), options).toFile(); }
[ "public", "static", "File", "copyFile", "(", "String", "src", ",", "String", "dest", ",", "StandardCopyOption", "...", "options", ")", "throws", "IORuntimeException", "{", "Assert", ".", "notBlank", "(", "src", ",", "\"Source File path is blank !\"", ")", ";", "...
通过JDK7+的 {@link Files#copy(Path, Path, CopyOption...)} 方法拷贝文件 @param src 源文件路径 @param dest 目标文件或目录路径,如果为目录使用与源文件相同的文件名 @param options {@link StandardCopyOption} @return File @throws IORuntimeException IO异常
[ "通过JDK7", "+", "的", "{", "@link", "Files#copy", "(", "Path", "Path", "CopyOption", "...", ")", "}", "方法拷贝文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L924-L928
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.optPoint
public static <P extends Enum<P>> Point optPoint(final JSONObject json, P e, boolean emptyForNull) { Point p = optPoint(json, e); if (p == null && emptyForNull) { p = new Point(); } return p; }
java
public static <P extends Enum<P>> Point optPoint(final JSONObject json, P e, boolean emptyForNull) { Point p = optPoint(json, e); if (p == null && emptyForNull) { p = new Point(); } return p; }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "Point", "optPoint", "(", "final", "JSONObject", "json", ",", "P", "e", ",", "boolean", "emptyForNull", ")", "{", "Point", "p", "=", "optPoint", "(", "json", ",", "e", ")", ";", "...
Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link Point}. If the value does not exist by that enum, and {@code emptyForNull} is {@code true}, returns a default constructed {@code Point}. Otherwise, returns {@code null}. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @param emptyForNull {@code True} to return a default constructed {@code Point} if there is no mapped data, {@code false} to return {@code null} in that case @return A {@code Point} if the mapping exists or {@code emptyForNull} is {@code true}; {@code null} otherwise
[ "Return", "the", "value", "mapped", "by", "enum", "if", "it", "exists", "and", "is", "a", "{", "@link", "JSONObject", "}", "by", "mapping", "x", "and", "y", "members", "into", "a", "{", "@link", "Point", "}", ".", "If", "the", "value", "does", "not",...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L541-L547
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java
RolloutStatusCache.getRolloutStatus
public List<TotalTargetCountActionStatus> getRolloutStatus(final Long rolloutId) { final Cache cache = cacheManager.getCache(CACHE_RO_NAME); return retrieveFromCache(rolloutId, cache); }
java
public List<TotalTargetCountActionStatus> getRolloutStatus(final Long rolloutId) { final Cache cache = cacheManager.getCache(CACHE_RO_NAME); return retrieveFromCache(rolloutId, cache); }
[ "public", "List", "<", "TotalTargetCountActionStatus", ">", "getRolloutStatus", "(", "final", "Long", "rolloutId", ")", "{", "final", "Cache", "cache", "=", "cacheManager", ".", "getCache", "(", "CACHE_RO_NAME", ")", ";", "return", "retrieveFromCache", "(", "rollo...
Retrieves cached list of {@link TotalTargetCountActionStatus} of {@link Rollout}s. @param rolloutId to retrieve cache entries for @return map of cached entries
[ "Retrieves", "cached", "list", "of", "{", "@link", "TotalTargetCountActionStatus", "}", "of", "{", "@link", "Rollout", "}", "s", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L89-L93
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.notEmptyNoNullValue
@CodingStyleguideUnaware public static <T extends Map <?, ?>> T notEmptyNoNullValue (final T aValue, final String sName) { if (isEnabled ()) return notEmptyNoNullValue (aValue, () -> sName); return aValue; }
java
@CodingStyleguideUnaware public static <T extends Map <?, ?>> T notEmptyNoNullValue (final T aValue, final String sName) { if (isEnabled ()) return notEmptyNoNullValue (aValue, () -> sName); return aValue; }
[ "@", "CodingStyleguideUnaware", "public", "static", "<", "T", "extends", "Map", "<", "?", ",", "?", ">", ">", "T", "notEmptyNoNullValue", "(", "final", "T", "aValue", ",", "final", "String", "sName", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "re...
Check that the passed map is neither <code>null</code> nor empty and that no <code>null</code> value is contained. @param <T> Type to be checked and returned @param aValue The map to check. @param sName The name of the value (e.g. the parameter name) @return The passed value. @throws IllegalArgumentException if the passed value is empty or a <code>null</code> value is contained
[ "Check", "that", "the", "passed", "map", "is", "neither", "<code", ">", "null<", "/", "code", ">", "nor", "empty", "and", "that", "no", "<code", ">", "null<", "/", "code", ">", "value", "is", "contained", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1269-L1275
googleapis/google-cloud-java
google-cloud-clients/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java
LanguageServiceClient.analyzeSyntax
public final AnalyzeSyntaxResponse analyzeSyntax(Document document, EncodingType encodingType) { AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder() .setDocument(document) .setEncodingType(encodingType) .build(); return analyzeSyntax(request); }
java
public final AnalyzeSyntaxResponse analyzeSyntax(Document document, EncodingType encodingType) { AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder() .setDocument(document) .setEncodingType(encodingType) .build(); return analyzeSyntax(request); }
[ "public", "final", "AnalyzeSyntaxResponse", "analyzeSyntax", "(", "Document", "document", ",", "EncodingType", "encodingType", ")", "{", "AnalyzeSyntaxRequest", "request", "=", "AnalyzeSyntaxRequest", ".", "newBuilder", "(", ")", ".", "setDocument", "(", "document", "...
Analyzes the syntax of the text and provides sentence boundaries and tokenization along with part of speech tags, dependency trees, and other properties. <p>Sample code: <pre><code> try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) { Document document = Document.newBuilder().build(); EncodingType encodingType = EncodingType.NONE; AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document, encodingType); } </code></pre> @param document Input document. @param encodingType The encoding type used by the API to calculate offsets. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Analyzes", "the", "syntax", "of", "the", "text", "and", "provides", "sentence", "boundaries", "and", "tokenization", "along", "with", "part", "of", "speech", "tags", "dependency", "trees", "and", "other", "properties", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java#L397-L405
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java
BottomSheet.setItem
public final void setItem(final int index, final int id, @StringRes final int titleId) { Item item = new Item(getContext(), id, titleId); adapter.set(index, item); adaptGridViewHeight(); }
java
public final void setItem(final int index, final int id, @StringRes final int titleId) { Item item = new Item(getContext(), id, titleId); adapter.set(index, item); adaptGridViewHeight(); }
[ "public", "final", "void", "setItem", "(", "final", "int", "index", ",", "final", "int", "id", ",", "@", "StringRes", "final", "int", "titleId", ")", "{", "Item", "item", "=", "new", "Item", "(", "getContext", "(", ")", ",", "id", ",", "titleId", ")"...
Replaces the item at a specific index with another item. @param index The index of the item, which should be replaced, as an {@link Integer} value @param id The id of the item, which should be added, as an {@link Integer} value. The id must be at least 0 @param titleId The resource id of the title of the item, which should be added, as an {@link Integer} value. The resource id must correspond to a valid string resource
[ "Replaces", "the", "item", "at", "a", "specific", "index", "with", "another", "item", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2099-L2103
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java
AbstractGeneratorConfigurationBlock.createOutputSectionItems
protected void createOutputSectionItems(Composite composite, OutputConfiguration outputConfiguration) { final Text defaultDirectoryField = addTextField(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_Directory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY), 0, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreateDirectory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_OverrideExistingResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreatesDerivedResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_DERIVED), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanupDerivedResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanDirectory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY), BOOLEAN_VALUES, 0); final Button installAsPrimaryButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_InstallDslAsPrimarySource, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.INSTALL_DSL_AS_PRIMARY_SOURCE), BOOLEAN_VALUES, 0); final Button hideLocalButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_hideSyntheticLocalVariables, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.HIDE_LOCAL_SYNTHETIC_VARIABLES), BOOLEAN_VALUES, 0); hideLocalButton.setEnabled(installAsPrimaryButton.getSelection()); installAsPrimaryButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent exception) { hideLocalButton.setEnabled(installAsPrimaryButton.getSelection()); } }); final GridData hideLocalButtonData = new GridData(); hideLocalButtonData.horizontalIndent = INDENT_AMOUNT; hideLocalButton.setLayoutData(hideLocalButtonData); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_KeepLocalHistory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_KEEP_LOCAL_HISTORY), BOOLEAN_VALUES, 0); if (getProject() != null && !outputConfiguration.getSourceFolders().isEmpty()) { final Button outputPerSourceButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_UseOutputPerSourceFolder, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.USE_OUTPUT_PER_SOURCE_FOLDER), BOOLEAN_VALUES, 0); final Table table = createOutputFolderTable(composite, outputConfiguration, defaultDirectoryField); table.setVisible(outputPerSourceButton.getSelection()); outputPerSourceButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent exception) { table.setVisible(outputPerSourceButton.getSelection()); } }); } }
java
protected void createOutputSectionItems(Composite composite, OutputConfiguration outputConfiguration) { final Text defaultDirectoryField = addTextField(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_Directory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY), 0, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreateDirectory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_OverrideExistingResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreatesDerivedResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_DERIVED), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanupDerivedResources, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED), BOOLEAN_VALUES, 0); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanDirectory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY), BOOLEAN_VALUES, 0); final Button installAsPrimaryButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_InstallDslAsPrimarySource, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.INSTALL_DSL_AS_PRIMARY_SOURCE), BOOLEAN_VALUES, 0); final Button hideLocalButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_hideSyntheticLocalVariables, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.HIDE_LOCAL_SYNTHETIC_VARIABLES), BOOLEAN_VALUES, 0); hideLocalButton.setEnabled(installAsPrimaryButton.getSelection()); installAsPrimaryButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent exception) { hideLocalButton.setEnabled(installAsPrimaryButton.getSelection()); } }); final GridData hideLocalButtonData = new GridData(); hideLocalButtonData.horizontalIndent = INDENT_AMOUNT; hideLocalButton.setLayoutData(hideLocalButtonData); addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_KeepLocalHistory, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.OUTPUT_KEEP_LOCAL_HISTORY), BOOLEAN_VALUES, 0); if (getProject() != null && !outputConfiguration.getSourceFolders().isEmpty()) { final Button outputPerSourceButton = addCheckBox(composite, org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_UseOutputPerSourceFolder, BuilderPreferenceAccess.getKey(outputConfiguration, EclipseOutputConfigurationProvider.USE_OUTPUT_PER_SOURCE_FOLDER), BOOLEAN_VALUES, 0); final Table table = createOutputFolderTable(composite, outputConfiguration, defaultDirectoryField); table.setVisible(outputPerSourceButton.getSelection()); outputPerSourceButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent exception) { table.setVisible(outputPerSourceButton.getSelection()); } }); } }
[ "protected", "void", "createOutputSectionItems", "(", "Composite", "composite", ",", "OutputConfiguration", "outputConfiguration", ")", "{", "final", "Text", "defaultDirectoryField", "=", "addTextField", "(", "composite", ",", "org", ".", "eclipse", ".", "xtext", ".",...
Create the items for the "Output" section. @param composite the parent. @param outputConfiguration the output configuration.
[ "Create", "the", "items", "for", "the", "Output", "section", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L494-L556
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.listSkusWithServiceResponseAsync
public Observable<ServiceResponse<Page<AvailableServiceSkuInner>>> listSkusWithServiceResponseAsync(final String groupName, final String serviceName) { return listSkusSinglePageAsync(groupName, serviceName) .concatMap(new Func1<ServiceResponse<Page<AvailableServiceSkuInner>>, Observable<ServiceResponse<Page<AvailableServiceSkuInner>>>>() { @Override public Observable<ServiceResponse<Page<AvailableServiceSkuInner>>> call(ServiceResponse<Page<AvailableServiceSkuInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSkusNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<AvailableServiceSkuInner>>> listSkusWithServiceResponseAsync(final String groupName, final String serviceName) { return listSkusSinglePageAsync(groupName, serviceName) .concatMap(new Func1<ServiceResponse<Page<AvailableServiceSkuInner>>, Observable<ServiceResponse<Page<AvailableServiceSkuInner>>>>() { @Override public Observable<ServiceResponse<Page<AvailableServiceSkuInner>>> call(ServiceResponse<Page<AvailableServiceSkuInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSkusNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "AvailableServiceSkuInner", ">", ">", ">", "listSkusWithServiceResponseAsync", "(", "final", "String", "groupName", ",", "final", "String", "serviceName", ")", "{", "return", "listSkusSinglePageAsync", ...
Get compatible SKUs. The services resource is the top-level resource that represents the Data Migration Service. The skus action returns the list of SKUs that a service resource can be updated to. @param groupName Name of the resource group @param serviceName Name of the service @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;AvailableServiceSkuInner&gt; object
[ "Get", "compatible", "SKUs", ".", "The", "services", "resource", "is", "the", "top", "-", "level", "resource", "that", "represents", "the", "Data", "Migration", "Service", ".", "The", "skus", "action", "returns", "the", "list", "of", "SKUs", "that", "a", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1414-L1426
line/armeria
core/src/main/java/com/linecorp/armeria/common/stream/EmptyFixedStreamMessage.java
EmptyFixedStreamMessage.doRequest
@Override final void doRequest(SubscriptionImpl subscription, long unused) { if (requested() != 0) { // Already have demand so don't need to do anything. return; } setRequested(1); notifySubscriberOfCloseEvent(subscription, SUCCESSFUL_CLOSE); }
java
@Override final void doRequest(SubscriptionImpl subscription, long unused) { if (requested() != 0) { // Already have demand so don't need to do anything. return; } setRequested(1); notifySubscriberOfCloseEvent(subscription, SUCCESSFUL_CLOSE); }
[ "@", "Override", "final", "void", "doRequest", "(", "SubscriptionImpl", "subscription", ",", "long", "unused", ")", "{", "if", "(", "requested", "(", ")", "!=", "0", ")", "{", "// Already have demand so don't need to do anything.", "return", ";", "}", "setRequeste...
No objects, so just notify of close as soon as there is demand.
[ "No", "objects", "so", "just", "notify", "of", "close", "as", "soon", "as", "there", "is", "demand", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/stream/EmptyFixedStreamMessage.java#L25-L33
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java
GVRFrustumPicker.doPick
public void doPick() { GVRSceneObject owner = getOwnerObject(); GVRPickedObject[] picked = pickVisible(mScene); if (mProjection != null) { Matrix4f view_matrix; if (owner != null) { view_matrix = owner.getTransform().getModelMatrix4f(); } else { view_matrix = mScene.getMainCameraRig().getHeadTransform().getModelMatrix4f(); } view_matrix.invert(); for (int i = 0; i < picked.length; ++i) { GVRPickedObject hit = picked[i]; if (hit != null) { GVRSceneObject sceneObj = hit.hitObject; GVRSceneObject.BoundingVolume bv = sceneObj.getBoundingVolume(); Vector4f center = new Vector4f(bv.center.x, bv.center.y, bv.center.z, 1); Vector4f p = new Vector4f(bv.center.x, bv.center.y, bv.center.z + bv.radius, 1); float radius; center.mul(view_matrix); p.mul(view_matrix); p.sub(center, p); p.w = 0; radius = p.length(); if (!mCuller.testSphere(center.x, center.y, center.z, radius)) { picked[i] = null; } } } } generatePickEvents(picked); }
java
public void doPick() { GVRSceneObject owner = getOwnerObject(); GVRPickedObject[] picked = pickVisible(mScene); if (mProjection != null) { Matrix4f view_matrix; if (owner != null) { view_matrix = owner.getTransform().getModelMatrix4f(); } else { view_matrix = mScene.getMainCameraRig().getHeadTransform().getModelMatrix4f(); } view_matrix.invert(); for (int i = 0; i < picked.length; ++i) { GVRPickedObject hit = picked[i]; if (hit != null) { GVRSceneObject sceneObj = hit.hitObject; GVRSceneObject.BoundingVolume bv = sceneObj.getBoundingVolume(); Vector4f center = new Vector4f(bv.center.x, bv.center.y, bv.center.z, 1); Vector4f p = new Vector4f(bv.center.x, bv.center.y, bv.center.z + bv.radius, 1); float radius; center.mul(view_matrix); p.mul(view_matrix); p.sub(center, p); p.w = 0; radius = p.length(); if (!mCuller.testSphere(center.x, center.y, center.z, radius)) { picked[i] = null; } } } } generatePickEvents(picked); }
[ "public", "void", "doPick", "(", ")", "{", "GVRSceneObject", "owner", "=", "getOwnerObject", "(", ")", ";", "GVRPickedObject", "[", "]", "picked", "=", "pickVisible", "(", "mScene", ")", ";", "if", "(", "mProjection", "!=", "null", ")", "{", "Matrix4f", ...
Scans the scene graph to collect picked items and generates appropriate pick events. This function is called automatically by the picker if it is attached to a scene object. You can instantiate the picker and not attach it to a scene object. In this case you must manually set the pick ray and call doPick() to generate the pick events. @see IPickEvents @see GVRFrustumPicker#pickVisible(GVRScene)
[ "Scans", "the", "scene", "graph", "to", "collect", "picked", "items", "and", "generates", "appropriate", "pick", "events", ".", "This", "function", "is", "called", "automatically", "by", "the", "picker", "if", "it", "is", "attached", "to", "a", "scene", "obj...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRFrustumPicker.java#L172-L215
VoltDB/voltdb
src/frontend/org/voltcore/utils/CoreUtils.java
CoreUtils.sortKeyValuePairByValue
public static <K extends Comparable< ? super K>,V extends Comparable< ? super V>> List<Entry<K,V>> sortKeyValuePairByValue(Map<K,V> map) { List<Map.Entry<K,V>> entries = new ArrayList<Map.Entry<K,V>>(map.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<K,V>>() { @Override public int compare(Entry<K,V> o1, Entry<K,V> o2) { if (!o1.getValue().equals(o2.getValue())) { return (o1.getValue()).compareTo(o2.getValue()); } return o1.getKey().compareTo(o2.getKey()); } } ); return entries; }
java
public static <K extends Comparable< ? super K>,V extends Comparable< ? super V>> List<Entry<K,V>> sortKeyValuePairByValue(Map<K,V> map) { List<Map.Entry<K,V>> entries = new ArrayList<Map.Entry<K,V>>(map.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<K,V>>() { @Override public int compare(Entry<K,V> o1, Entry<K,V> o2) { if (!o1.getValue().equals(o2.getValue())) { return (o1.getValue()).compareTo(o2.getValue()); } return o1.getKey().compareTo(o2.getKey()); } } ); return entries; }
[ "public", "static", "<", "K", "extends", "Comparable", "<", "?", "super", "K", ">", ",", "V", "extends", "Comparable", "<", "?", "super", "V", ">", ">", "List", "<", "Entry", "<", "K", ",", "V", ">", ">", "sortKeyValuePairByValue", "(", "Map", "<", ...
Utility method to sort the keys and values of a map by their value.
[ "Utility", "method", "to", "sort", "the", "keys", "and", "values", "of", "a", "map", "by", "their", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/utils/CoreUtils.java#L1163-L1176
RuedigerMoeller/kontraktor
modules/kontraktor-http/src/main/java/org/nustaq/kontraktor/remoting/http/undertow/Http4K.java
Http4K.publishFileSystem
public Http4K publishFileSystem( String hostName, String urlPath, int port, File root ) { if ( ! root.exists() ) root.mkdirs(); if ( ! root.isDirectory() ) { throw new RuntimeException("root must be an existing direcory:"+root.getAbsolutePath()); } Pair<PathHandler, Undertow> server = getServer(port, hostName); server.car().addPrefixPath(urlPath, new ResourceHandler(new FileResourceManager(root,100))); return this; }
java
public Http4K publishFileSystem( String hostName, String urlPath, int port, File root ) { if ( ! root.exists() ) root.mkdirs(); if ( ! root.isDirectory() ) { throw new RuntimeException("root must be an existing direcory:"+root.getAbsolutePath()); } Pair<PathHandler, Undertow> server = getServer(port, hostName); server.car().addPrefixPath(urlPath, new ResourceHandler(new FileResourceManager(root,100))); return this; }
[ "public", "Http4K", "publishFileSystem", "(", "String", "hostName", ",", "String", "urlPath", ",", "int", "port", ",", "File", "root", ")", "{", "if", "(", "!", "root", ".", "exists", "(", ")", ")", "root", ".", "mkdirs", "(", ")", ";", "if", "(", ...
publishes given file root @param hostName @param urlPath - prefixPath (e.g. /myapp/resource) @param port @param root - directory to be published
[ "publishes", "given", "file", "root" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/kontraktor-http/src/main/java/org/nustaq/kontraktor/remoting/http/undertow/Http4K.java#L139-L148
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeDouble
public static double decodeDouble(byte[] src, int srcOffset) throws CorruptEncodingException { long bits = decodeDoubleBits(src, srcOffset); bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL; return Double.longBitsToDouble(bits); }
java
public static double decodeDouble(byte[] src, int srcOffset) throws CorruptEncodingException { long bits = decodeDoubleBits(src, srcOffset); bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL; return Double.longBitsToDouble(bits); }
[ "public", "static", "double", "decodeDouble", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "long", "bits", "=", "decodeDoubleBits", "(", "src", ",", "srcOffset", ")", ";", "bits", "^=", "(", "bits", ...
Decodes a double from exactly 8 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return double value
[ "Decodes", "a", "double", "from", "exactly", "8", "bytes", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L334-L340
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.loadImage
public void loadImage(String uri, ImageLoadingListener listener) { loadImage(uri, null, null, listener, null); }
java
public void loadImage(String uri, ImageLoadingListener listener) { loadImage(uri, null, null, listener, null); }
[ "public", "void", "loadImage", "(", "String", "uri", ",", "ImageLoadingListener", "listener", ")", "{", "loadImage", "(", "uri", ",", "null", ",", "null", ",", "listener", ",", "null", ")", ";", "}" ]
Adds load image task to execution pool. Image will be returned with {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}. <br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires events on UI thread if this method is called on UI thread. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
[ "Adds", "load", "image", "task", "to", "execution", "pool", ".", "Image", "will", "be", "returned", "with", "{", "@link", "ImageLoadingListener#onLoadingComplete", "(", "String", "android", ".", "view", ".", "View", "android", ".", "graphics", ".", "Bitmap", "...
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L424-L426
alkacon/opencms-core
src/org/opencms/db/CmsLoginManager.java
CmsLoginManager.createStorageKey
private static String createStorageKey(String userName, String remoteAddress) { StringBuffer result = new StringBuffer(); result.append(userName); result.append(KEY_SEPARATOR); result.append(remoteAddress); return result.toString(); }
java
private static String createStorageKey(String userName, String remoteAddress) { StringBuffer result = new StringBuffer(); result.append(userName); result.append(KEY_SEPARATOR); result.append(remoteAddress); return result.toString(); }
[ "private", "static", "String", "createStorageKey", "(", "String", "userName", ",", "String", "remoteAddress", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "result", ".", "append", "(", "userName", ")", ";", "result", ".", "a...
Returns the key to use for looking up the user in the invalid login storage.<p> @param userName the name of the user @param remoteAddress the remore address (IP) from which the login attempt was made @return the key to use for looking up the user in the invalid login storage
[ "Returns", "the", "key", "to", "use", "for", "looking", "up", "the", "user", "in", "the", "invalid", "login", "storage", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L249-L256
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java
CompressionFactory.getFloatSupplier
public static Supplier<ColumnarFloats> getFloatSupplier( int totalSize, int sizePer, ByteBuffer fromBuffer, ByteOrder order, CompressionStrategy strategy ) { if (strategy == CompressionStrategy.NONE) { return new EntireLayoutColumnarFloatsSupplier(totalSize, fromBuffer, order); } else { return new BlockLayoutColumnarFloatsSupplier(totalSize, sizePer, fromBuffer, order, strategy); } }
java
public static Supplier<ColumnarFloats> getFloatSupplier( int totalSize, int sizePer, ByteBuffer fromBuffer, ByteOrder order, CompressionStrategy strategy ) { if (strategy == CompressionStrategy.NONE) { return new EntireLayoutColumnarFloatsSupplier(totalSize, fromBuffer, order); } else { return new BlockLayoutColumnarFloatsSupplier(totalSize, sizePer, fromBuffer, order, strategy); } }
[ "public", "static", "Supplier", "<", "ColumnarFloats", ">", "getFloatSupplier", "(", "int", "totalSize", ",", "int", "sizePer", ",", "ByteBuffer", "fromBuffer", ",", "ByteOrder", "order", ",", "CompressionStrategy", "strategy", ")", "{", "if", "(", "strategy", "...
Float currently does not support any encoding types, and stores values as 4 byte float
[ "Float", "currently", "does", "not", "support", "any", "encoding", "types", "and", "stores", "values", "as", "4", "byte", "float" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/data/CompressionFactory.java#L341-L354
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java
JSONWorldDataHelper.buildPositionStats
public static void buildPositionStats(JsonObject json, EntityPlayerMP player) { json.addProperty("XPos", player.posX); json.addProperty("YPos", player.posY); json.addProperty("ZPos", player.posZ); json.addProperty("Pitch", player.rotationPitch); json.addProperty("Yaw", player.rotationYaw); }
java
public static void buildPositionStats(JsonObject json, EntityPlayerMP player) { json.addProperty("XPos", player.posX); json.addProperty("YPos", player.posY); json.addProperty("ZPos", player.posZ); json.addProperty("Pitch", player.rotationPitch); json.addProperty("Yaw", player.rotationYaw); }
[ "public", "static", "void", "buildPositionStats", "(", "JsonObject", "json", ",", "EntityPlayerMP", "player", ")", "{", "json", ".", "addProperty", "(", "\"XPos\"", ",", "player", ".", "posX", ")", ";", "json", ".", "addProperty", "(", "\"YPos\"", ",", "play...
Builds the player position data to be used as observation signals by the listener. @param json a JSON object into which the positional information will be added.
[ "Builds", "the", "player", "position", "data", "to", "be", "used", "as", "observation", "signals", "by", "the", "listener", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java#L138-L145
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/AsyncTimeout.java
AsyncTimeout.awaitTimeout
private static synchronized AsyncTimeout awaitTimeout() throws InterruptedException { // Get the next eligible node. AsyncTimeout node = head.next; // The queue is empty. Wait for something to be enqueued. if (node == null) { AsyncTimeout.class.wait(); return null; } long waitNanos = node.remainingNanos(System.nanoTime()); // The head of the queue hasn't timed out yet. Await that. if (waitNanos > 0) { // Waiting is made complicated by the fact that we work in nanoseconds, // but the API wants (millis, nanos) in two arguments. long waitMillis = waitNanos / 1000000L; waitNanos -= (waitMillis * 1000000L); AsyncTimeout.class.wait(waitMillis, (int) waitNanos); return null; } // The head of the queue has timed out. Remove it. head.next = node.next; node.next = null; return node; }
java
private static synchronized AsyncTimeout awaitTimeout() throws InterruptedException { // Get the next eligible node. AsyncTimeout node = head.next; // The queue is empty. Wait for something to be enqueued. if (node == null) { AsyncTimeout.class.wait(); return null; } long waitNanos = node.remainingNanos(System.nanoTime()); // The head of the queue hasn't timed out yet. Await that. if (waitNanos > 0) { // Waiting is made complicated by the fact that we work in nanoseconds, // but the API wants (millis, nanos) in two arguments. long waitMillis = waitNanos / 1000000L; waitNanos -= (waitMillis * 1000000L); AsyncTimeout.class.wait(waitMillis, (int) waitNanos); return null; } // The head of the queue has timed out. Remove it. head.next = node.next; node.next = null; return node; }
[ "private", "static", "synchronized", "AsyncTimeout", "awaitTimeout", "(", ")", "throws", "InterruptedException", "{", "// Get the next eligible node.", "AsyncTimeout", "node", "=", "head", ".", "next", ";", "// The queue is empty. Wait for something to be enqueued.", "if", "(...
Removes and returns the node at the head of the list, waiting for it to time out if necessary. Returns null if the situation changes while waiting: either a newer node is inserted at the head, or the node being waited on has been removed.
[ "Removes", "and", "returns", "the", "node", "at", "the", "head", "of", "the", "list", "waiting", "for", "it", "to", "time", "out", "if", "necessary", ".", "Returns", "null", "if", "the", "situation", "changes", "while", "waiting", ":", "either", "a", "ne...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/AsyncTimeout.java#L305-L331
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteSecret
public DeletedSecretBundle deleteSecret(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body(); }
java
public DeletedSecretBundle deleteSecret(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body(); }
[ "public", "DeletedSecretBundle", "deleteSecret", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ")", "{", "return", "deleteSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")"...
Deletes a secret from a specified key vault. The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an individual version of a secret. This operation requires the secrets/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DeletedSecretBundle object if successful.
[ "Deletes", "a", "secret", "from", "a", "specified", "key", "vault", ".", "The", "DELETE", "operation", "applies", "to", "any", "secret", "stored", "in", "Azure", "Key", "Vault", ".", "DELETE", "cannot", "be", "applied", "to", "an", "individual", "version", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3531-L3533
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Touches.java
ST_Touches.geomTouches
public static Boolean geomTouches(Geometry a,Geometry b) { if(a==null || b==null) { return null; } return a.touches(b); }
java
public static Boolean geomTouches(Geometry a,Geometry b) { if(a==null || b==null) { return null; } return a.touches(b); }
[ "public", "static", "Boolean", "geomTouches", "(", "Geometry", "a", ",", "Geometry", "b", ")", "{", "if", "(", "a", "==", "null", "||", "b", "==", "null", ")", "{", "return", "null", ";", "}", "return", "a", ".", "touches", "(", "b", ")", ";", "}...
Return true if the geometry A touches the geometry B @param a Geometry Geometry. @param b Geometry instance @return true if the geometry A touches the geometry B
[ "Return", "true", "if", "the", "geometry", "A", "touches", "the", "geometry", "B" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_Touches.java#L50-L55
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java
PathfindableModel.moveTo
private void moveTo(double extrp, int dx, int dy) { final Force force = getMovementForce(transformable.getX(), transformable.getY(), dx, dy); final double sx = force.getDirectionHorizontal(); final double sy = force.getDirectionVertical(); // Move object moveX = sx; moveY = sy; transformable.moveLocation(extrp, force); moving = true; // Object arrived, next step final boolean arrivedX = checkArrivedX(extrp, sx, dx); final boolean arrivedY = checkArrivedY(extrp, sy, dy); if (arrivedX && arrivedY) { // When object arrived on next step, we place it on step location, in order to avoid bug // (to be sure object location is correct) setLocation(path.getX(currentStep), path.getY(currentStep)); // Go to next step final int next = currentStep + 1; if (currentStep < getMaxStep() - 1) { updateObjectId(currentStep, next); } if (!pathStoppedRequested && !skip) { currentStep = next; } // Check if a new path has been assigned (this allow the object to change its path before finishing it) if (currentStep > 0 && !skip) { checkPathfinderChanges(); } } }
java
private void moveTo(double extrp, int dx, int dy) { final Force force = getMovementForce(transformable.getX(), transformable.getY(), dx, dy); final double sx = force.getDirectionHorizontal(); final double sy = force.getDirectionVertical(); // Move object moveX = sx; moveY = sy; transformable.moveLocation(extrp, force); moving = true; // Object arrived, next step final boolean arrivedX = checkArrivedX(extrp, sx, dx); final boolean arrivedY = checkArrivedY(extrp, sy, dy); if (arrivedX && arrivedY) { // When object arrived on next step, we place it on step location, in order to avoid bug // (to be sure object location is correct) setLocation(path.getX(currentStep), path.getY(currentStep)); // Go to next step final int next = currentStep + 1; if (currentStep < getMaxStep() - 1) { updateObjectId(currentStep, next); } if (!pathStoppedRequested && !skip) { currentStep = next; } // Check if a new path has been assigned (this allow the object to change its path before finishing it) if (currentStep > 0 && !skip) { checkPathfinderChanges(); } } }
[ "private", "void", "moveTo", "(", "double", "extrp", ",", "int", "dx", ",", "int", "dy", ")", "{", "final", "Force", "force", "=", "getMovementForce", "(", "transformable", ".", "getX", "(", ")", ",", "transformable", ".", "getY", "(", ")", ",", "dx", ...
Move to destination. @param extrp The extrapolation value. @param dx The destination horizontal location. @param dy The destination vertical location.
[ "Move", "to", "destination", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L315-L353
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java
WCheckBoxSelectExample.addInsideAFieldLayoutExamples
private void addInsideAFieldLayoutExamples() { add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect inside a WFieldLayout")); add(new ExplanatoryText("When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular " + "HTML label. This allows WCheckBoxSelects to be used in a layout with simple form controls (such as WTextField) and produce a " + "consistent and predicatable interface. The third example in this set uses a null label and a toolTip to hide the labelling " + "element. This can lead to user confusion and is not recommended.")); WFieldLayout layout = new WFieldLayout(); layout.setLabelWidth(25); add(layout); String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"}; WCheckBoxSelect select = new WCheckBoxSelect(options); layout.addField("Select some animals", select); String[] options2 = new String[]{"Parrot", "Galah", "Cockatoo", "Lyre"}; select = new WCheckBoxSelect(options2); layout.addField("Select some birds", select); select.setFrameless(true); // a tooltip can be used as a label stand-in even in a WField String[] options3 = new String[]{"Carrot", "Beet", "Brocolli", "Bacon - the perfect vegetable"}; select = new WCheckBoxSelect(options3); layout.addField((WLabel) null, select); select.setToolTip("Veggies"); select = new WCheckBoxSelect("australian_state"); layout.addField("Select a state", select).getLabel().setHint("This is an ajax trigger"); add(new WAjaxControl(select, layout)); }
java
private void addInsideAFieldLayoutExamples() { add(new WHeading(HeadingLevel.H3, "WCheckBoxSelect inside a WFieldLayout")); add(new ExplanatoryText("When a WCheckBoxSelect is inside a WField its label is exposed in a way which appears and behaves like a regular " + "HTML label. This allows WCheckBoxSelects to be used in a layout with simple form controls (such as WTextField) and produce a " + "consistent and predicatable interface. The third example in this set uses a null label and a toolTip to hide the labelling " + "element. This can lead to user confusion and is not recommended.")); WFieldLayout layout = new WFieldLayout(); layout.setLabelWidth(25); add(layout); String[] options = new String[]{"Dog", "Cat", "Bird", "Turtle"}; WCheckBoxSelect select = new WCheckBoxSelect(options); layout.addField("Select some animals", select); String[] options2 = new String[]{"Parrot", "Galah", "Cockatoo", "Lyre"}; select = new WCheckBoxSelect(options2); layout.addField("Select some birds", select); select.setFrameless(true); // a tooltip can be used as a label stand-in even in a WField String[] options3 = new String[]{"Carrot", "Beet", "Brocolli", "Bacon - the perfect vegetable"}; select = new WCheckBoxSelect(options3); layout.addField((WLabel) null, select); select.setToolTip("Veggies"); select = new WCheckBoxSelect("australian_state"); layout.addField("Select a state", select).getLabel().setHint("This is an ajax trigger"); add(new WAjaxControl(select, layout)); }
[ "private", "void", "addInsideAFieldLayoutExamples", "(", ")", "{", "add", "(", "new", "WHeading", "(", "HeadingLevel", ".", "H3", ",", "\"WCheckBoxSelect inside a WFieldLayout\"", ")", ")", ";", "add", "(", "new", "ExplanatoryText", "(", "\"When a WCheckBoxSelect is i...
When a WCheckBoxSelect is added to a WFieldLayout the legend is moved. The first CheckBoxSelect has a frame, the second doesn't
[ "When", "a", "WCheckBoxSelect", "is", "added", "to", "a", "WFieldLayout", "the", "legend", "is", "moved", ".", "The", "first", "CheckBoxSelect", "has", "a", "frame", "the", "second", "doesn", "t" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WCheckBoxSelectExample.java#L177-L204
geomajas/geomajas-project-server
command/src/main/java/org/geomajas/command/geometry/GeometryAreaCommand.java
GeometryAreaCommand.execute
@Override public void execute(GeometryAreaRequest request, GeometryAreaResponse response) throws Exception { List<Double> areas = new ArrayList<Double>(request.getGeometries().size()); for (org.geomajas.geometry.Geometry g : request.getGeometries()) { Geometry geometry = converter.toInternal(g); double area = 0; if (geometry instanceof Polygonal) { if (request.getCrs() != null) { if (!EPSG_4326.equals(request.getCrs())) { geometry = geoService.transform(geometry, request.getCrs(), EPSG_4326); } // applying global sinusoidal projection (equal-area) geometry.apply(new CoordinateFilter() { public void filter(Coordinate coord) { double newX = coord.x * Math.PI / 180.0 * Math.cos(coord.y * Math.PI / 180.0); double newY = coord.y * Math.PI / 180.0; coord.x = newX; coord.y = newY; } }); area = geometry.getArea() * RADIUS * RADIUS; } else { area = geometry.getArea(); } } areas.add(area); } response.setAreas(areas); }
java
@Override public void execute(GeometryAreaRequest request, GeometryAreaResponse response) throws Exception { List<Double> areas = new ArrayList<Double>(request.getGeometries().size()); for (org.geomajas.geometry.Geometry g : request.getGeometries()) { Geometry geometry = converter.toInternal(g); double area = 0; if (geometry instanceof Polygonal) { if (request.getCrs() != null) { if (!EPSG_4326.equals(request.getCrs())) { geometry = geoService.transform(geometry, request.getCrs(), EPSG_4326); } // applying global sinusoidal projection (equal-area) geometry.apply(new CoordinateFilter() { public void filter(Coordinate coord) { double newX = coord.x * Math.PI / 180.0 * Math.cos(coord.y * Math.PI / 180.0); double newY = coord.y * Math.PI / 180.0; coord.x = newX; coord.y = newY; } }); area = geometry.getArea() * RADIUS * RADIUS; } else { area = geometry.getArea(); } } areas.add(area); } response.setAreas(areas); }
[ "@", "Override", "public", "void", "execute", "(", "GeometryAreaRequest", "request", ",", "GeometryAreaResponse", "response", ")", "throws", "Exception", "{", "List", "<", "Double", ">", "areas", "=", "new", "ArrayList", "<", "Double", ">", "(", "request", "."...
Calculate the geographical area for each of the requested geometries. The current algorithm uses the global sinusoidal projection (a so-called equal-area projection) and assumes a spherical earth. More accurate projections exist (Albers, Mollweide, ...) but they are more complicated and cause tolerance problems when directly applied with Geotools transformations. @param request request parameters @param response response object @throws Exception in case of problems
[ "Calculate", "the", "geographical", "area", "for", "each", "of", "the", "requested", "geometries", ".", "The", "current", "algorithm", "uses", "the", "global", "sinusoidal", "projection", "(", "a", "so", "-", "called", "equal", "-", "area", "projection", ")", ...
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/command/src/main/java/org/geomajas/command/geometry/GeometryAreaCommand.java#L72-L102
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ModulesInner.java
ModulesInner.get
public ModuleInner get(String resourceGroupName, String automationAccountName, String moduleName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName).toBlocking().single().body(); }
java
public ModuleInner get(String resourceGroupName, String automationAccountName, String moduleName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName).toBlocking().single().body(); }
[ "public", "ModuleInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "moduleName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "moduleName", ")", "....
Retrieve the module identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The module name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ModuleInner object if successful.
[ "Retrieve", "the", "module", "identified", "by", "module", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ModulesInner.java#L194-L196
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java
SimpleTimeZone.setEndRule
private void setEndRule(int month, int dayOfWeekInMonth, int dayOfWeek, int time, int mode){ assert (!isFrozen()); endMonth = month; endDay = dayOfWeekInMonth; endDayOfWeek = dayOfWeek; endTime = time; endTimeMode = mode; decodeEndRule(); transitionRulesInitialized = false; }
java
private void setEndRule(int month, int dayOfWeekInMonth, int dayOfWeek, int time, int mode){ assert (!isFrozen()); endMonth = month; endDay = dayOfWeekInMonth; endDayOfWeek = dayOfWeek; endTime = time; endTimeMode = mode; decodeEndRule(); transitionRulesInitialized = false; }
[ "private", "void", "setEndRule", "(", "int", "month", ",", "int", "dayOfWeekInMonth", ",", "int", "dayOfWeek", ",", "int", "time", ",", "int", "mode", ")", "{", "assert", "(", "!", "isFrozen", "(", ")", ")", ";", "endMonth", "=", "month", ";", "endDay"...
Sets the daylight savings ending rule. For example, in the U.S., Daylight Savings Time ends at the first Sunday in November, at 2 AM in standard time. Therefore, you can set the end rule by calling: setEndRule(Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2*60*60*1000); Various other types of rules can be specified by manipulating the dayOfWeek and dayOfWeekInMonth parameters. For complete details, see the documentation for setStartRule(). @param month the daylight savings ending month. Month is 0-based. eg, 0 for January. @param dayOfWeekInMonth the daylight savings ending day-of-week-in-month. See setStartRule() for a complete explanation. @param dayOfWeek the daylight savings ending day-of-week. See setStartRule() for a complete explanation. @param time the daylight savings ending time. Please see the member description for an example.
[ "Sets", "the", "daylight", "savings", "ending", "rule", ".", "For", "example", "in", "the", "U", ".", "S", ".", "Daylight", "Savings", "Time", "ends", "at", "the", "first", "Sunday", "in", "November", "at", "2", "AM", "in", "standard", "time", ".", "Th...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/SimpleTimeZone.java#L509-L520
pf4j/pf4j
pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java
DefaultPluginLoader.loadClasses
protected void loadClasses(Path pluginPath, PluginClassLoader pluginClassLoader) { for (String directory : pluginClasspath.getClassesDirectories()) { File file = pluginPath.resolve(directory).toFile(); if (file.exists() && file.isDirectory()) { pluginClassLoader.addFile(file); } } }
java
protected void loadClasses(Path pluginPath, PluginClassLoader pluginClassLoader) { for (String directory : pluginClasspath.getClassesDirectories()) { File file = pluginPath.resolve(directory).toFile(); if (file.exists() && file.isDirectory()) { pluginClassLoader.addFile(file); } } }
[ "protected", "void", "loadClasses", "(", "Path", "pluginPath", ",", "PluginClassLoader", "pluginClassLoader", ")", "{", "for", "(", "String", "directory", ":", "pluginClasspath", ".", "getClassesDirectories", "(", ")", ")", "{", "File", "file", "=", "pluginPath", ...
Add all {@code *.class} files from {@code classes} directories to plugin class loader.
[ "Add", "all", "{" ]
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java#L64-L71
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Observable.java
Observable.takeUntil
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Observable<T> takeUntil(Predicate<? super T> stopPredicate) { ObjectHelper.requireNonNull(stopPredicate, "predicate is null"); return RxJavaPlugins.onAssembly(new ObservableTakeUntilPredicate<T>(this, stopPredicate)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final Observable<T> takeUntil(Predicate<? super T> stopPredicate) { ObjectHelper.requireNonNull(stopPredicate, "predicate is null"); return RxJavaPlugins.onAssembly(new ObservableTakeUntilPredicate<T>(this, stopPredicate)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Observable", "<", "T", ">", "takeUntil", "(", "Predicate", "<", "?", "super", "T", ">", "stopPredicate", ")", "{", "ObjectHelper", ".", "requireNon...
Returns an Observable that emits items emitted by the source Observable, checks the specified predicate for each item, and then completes when the condition is satisfied. <p> <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/takeUntil.p.png" alt=""> <p> The difference between this operator and {@link #takeWhile(Predicate)} is that here, the condition is evaluated <em>after</em> the item is emitted. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code takeUntil} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param stopPredicate a function that evaluates an item emitted by the source Observable and returns a Boolean @return an Observable that first emits items emitted by the source Observable, checks the specified condition after each item, and then completes when the condition is satisfied. @see <a href="http://reactivex.io/documentation/operators/takeuntil.html">ReactiveX operators documentation: TakeUntil</a> @see Observable#takeWhile(Predicate) @since 1.1.0
[ "Returns", "an", "Observable", "that", "emits", "items", "emitted", "by", "the", "source", "Observable", "checks", "the", "specified", "predicate", "for", "each", "item", "and", "then", "completes", "when", "the", "condition", "is", "satisfied", ".", "<p", ">"...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Observable.java#L12945-L12950
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/live/internal/QueueManager.java
QueueManager.handleQueueMemberEvent
private void handleQueueMemberEvent(QueueMemberEvent event) { final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue()); if (queue == null) { logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue()); return; } AsteriskQueueMemberImpl member = queue.getMember(event.getLocation()); if (member == null) { member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event .getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(), event.getLastCall()); queue.addMember(member); } else { manageQueueMemberChange(queue, member, event); } }
java
private void handleQueueMemberEvent(QueueMemberEvent event) { final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue()); if (queue == null) { logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue()); return; } AsteriskQueueMemberImpl member = queue.getMember(event.getLocation()); if (member == null) { member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event .getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(), event.getLastCall()); queue.addMember(member); } else { manageQueueMemberChange(queue, member, event); } }
[ "private", "void", "handleQueueMemberEvent", "(", "QueueMemberEvent", "event", ")", "{", "final", "AsteriskQueueImpl", "queue", "=", "getInternalQueueByName", "(", "event", ".", "getQueue", "(", ")", ")", ";", "if", "(", "queue", "==", "null", ")", "{", "logge...
Called during initialization to populate the members of the queues. @param event the QueueMemberEvent received
[ "Called", "during", "initialization", "to", "populate", "the", "members", "of", "the", "queues", "." ]
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/live/internal/QueueManager.java#L300-L323
abel533/Mapper
core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java
SqlHelper.notAllNullParameterCheck
public static String notAllNullParameterCheck(String parameterName, Set<EntityColumn> columnSet) { StringBuilder sql = new StringBuilder(); sql.append("<bind name=\"notAllNullParameterCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notAllNullParameterCheck("); sql.append(parameterName).append(", '"); StringBuilder fields = new StringBuilder(); for (EntityColumn column : columnSet) { if (fields.length() > 0) { fields.append(","); } fields.append(column.getProperty()); } sql.append(fields); sql.append("')\"/>"); return sql.toString(); }
java
public static String notAllNullParameterCheck(String parameterName, Set<EntityColumn> columnSet) { StringBuilder sql = new StringBuilder(); sql.append("<bind name=\"notAllNullParameterCheck\" value=\"@tk.mybatis.mapper.util.OGNL@notAllNullParameterCheck("); sql.append(parameterName).append(", '"); StringBuilder fields = new StringBuilder(); for (EntityColumn column : columnSet) { if (fields.length() > 0) { fields.append(","); } fields.append(column.getProperty()); } sql.append(fields); sql.append("')\"/>"); return sql.toString(); }
[ "public", "static", "String", "notAllNullParameterCheck", "(", "String", "parameterName", ",", "Set", "<", "EntityColumn", ">", "columnSet", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"<bind name=\\...
不是所有参数都是 null 的检查 @param parameterName 参数名 @param columnSet 需要检查的列 @return
[ "不是所有参数都是", "null", "的检查" ]
train
https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L562-L576
selendroid/selendroid
selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java
SelendroidStandaloneDriver.augmentApp
private AndroidApp augmentApp(AndroidApp app, SelendroidCapabilities desiredCapabilities) { if (desiredCapabilities.getLaunchActivity() != null) { app.setMainActivity(desiredCapabilities.getLaunchActivity()); } return app; }
java
private AndroidApp augmentApp(AndroidApp app, SelendroidCapabilities desiredCapabilities) { if (desiredCapabilities.getLaunchActivity() != null) { app.setMainActivity(desiredCapabilities.getLaunchActivity()); } return app; }
[ "private", "AndroidApp", "augmentApp", "(", "AndroidApp", "app", ",", "SelendroidCapabilities", "desiredCapabilities", ")", "{", "if", "(", "desiredCapabilities", ".", "getLaunchActivity", "(", ")", "!=", "null", ")", "{", "app", ".", "setMainActivity", "(", "desi...
Augment the application with parameters from {@code desiredCapabilities} @param app to be augmented @param desiredCapabilities configuration requested for this session
[ "Augment", "the", "application", "with", "parameters", "from", "{", "@code", "desiredCapabilities", "}" ]
train
https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java#L503-L508
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/math/NoiseInstance.java
NoiseInstance.turbulence3
public float turbulence3(float x, float y, float z, float octaves) { float t = 0.0f; for (float f = 1.0f; f <= octaves; f *= 2) t += Math.abs(noise3(f * x, f * y, f * z)) / f; return t; }
java
public float turbulence3(float x, float y, float z, float octaves) { float t = 0.0f; for (float f = 1.0f; f <= octaves; f *= 2) t += Math.abs(noise3(f * x, f * y, f * z)) / f; return t; }
[ "public", "float", "turbulence3", "(", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "octaves", ")", "{", "float", "t", "=", "0.0f", ";", "for", "(", "float", "f", "=", "1.0f", ";", "f", "<=", "octaves", ";", "f", "*=", "2", ...
Compute turbulence using Perlin noise. @param x the x value @param y the y value @param octaves number of octaves of turbulence @return turbulence value at (x,y)
[ "Compute", "turbulence", "using", "Perlin", "noise", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/math/NoiseInstance.java#L68-L74
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.removeString
public void removeString(String str) { if (sourceNode != null) { //Split the _transition path corresponding to str to ensure that //any other _transition paths sharing nodes with it are not affected splitTransitionPath(sourceNode, str); //Remove from equivalenceClassMDAGNodeHashMap, the entries of all the nodes in the _transition path corresponding to str. removeTransitionPathRegisterEntries(str); //Get the last node in the _transition path corresponding to str MDAGNode strEndNode = sourceNode.transition(str); if (strEndNode == null) return; if (!strEndNode.hasTransitions()) { int soleInternalTransitionPathLength = calculateSoleTransitionPathLength(str); int internalTransitionPathLength = str.length() - 1; if (soleInternalTransitionPathLength == internalTransitionPathLength) { sourceNode.removeOutgoingTransition(str.charAt(0)); transitionCount -= str.length(); } else { //Remove the sub-path in str's _transition path that is only used by str int toBeRemovedTransitionLabelCharIndex = (internalTransitionPathLength - soleInternalTransitionPathLength); MDAGNode latestNonSoloTransitionPathNode = sourceNode.transition(str.substring(0, toBeRemovedTransitionLabelCharIndex)); latestNonSoloTransitionPathNode.removeOutgoingTransition(str.charAt(toBeRemovedTransitionLabelCharIndex)); transitionCount -= str.substring(toBeRemovedTransitionLabelCharIndex).length(); ///// replaceOrRegister(sourceNode, str.substring(0, toBeRemovedTransitionLabelCharIndex)); } } else { strEndNode.setAcceptStateStatus(false); replaceOrRegister(sourceNode, str); } } else { unSimplify(); } }
java
public void removeString(String str) { if (sourceNode != null) { //Split the _transition path corresponding to str to ensure that //any other _transition paths sharing nodes with it are not affected splitTransitionPath(sourceNode, str); //Remove from equivalenceClassMDAGNodeHashMap, the entries of all the nodes in the _transition path corresponding to str. removeTransitionPathRegisterEntries(str); //Get the last node in the _transition path corresponding to str MDAGNode strEndNode = sourceNode.transition(str); if (strEndNode == null) return; if (!strEndNode.hasTransitions()) { int soleInternalTransitionPathLength = calculateSoleTransitionPathLength(str); int internalTransitionPathLength = str.length() - 1; if (soleInternalTransitionPathLength == internalTransitionPathLength) { sourceNode.removeOutgoingTransition(str.charAt(0)); transitionCount -= str.length(); } else { //Remove the sub-path in str's _transition path that is only used by str int toBeRemovedTransitionLabelCharIndex = (internalTransitionPathLength - soleInternalTransitionPathLength); MDAGNode latestNonSoloTransitionPathNode = sourceNode.transition(str.substring(0, toBeRemovedTransitionLabelCharIndex)); latestNonSoloTransitionPathNode.removeOutgoingTransition(str.charAt(toBeRemovedTransitionLabelCharIndex)); transitionCount -= str.substring(toBeRemovedTransitionLabelCharIndex).length(); ///// replaceOrRegister(sourceNode, str.substring(0, toBeRemovedTransitionLabelCharIndex)); } } else { strEndNode.setAcceptStateStatus(false); replaceOrRegister(sourceNode, str); } } else { unSimplify(); } }
[ "public", "void", "removeString", "(", "String", "str", ")", "{", "if", "(", "sourceNode", "!=", "null", ")", "{", "//Split the _transition path corresponding to str to ensure that", "//any other _transition paths sharing nodes with it are not affected", "splitTransitionPath", "(...
Removes a String from the MDAG. @param str the String to be removed from the MDAG
[ "Removes", "a", "String", "from", "the", "MDAG", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L364-L412
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java
JenkinsHttpClient.addAuthentication
protected static HttpClientBuilder addAuthentication(final HttpClientBuilder builder, final URI uri, final String username, String password) { if (isNotBlank(username)) { CredentialsProvider provider = new BasicCredentialsProvider(); AuthScope scope = new AuthScope(uri.getHost(), uri.getPort(), "realm"); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); provider.setCredentials(scope, credentials); builder.setDefaultCredentialsProvider(provider); builder.addInterceptorFirst(new PreemptiveAuth()); } return builder; }
java
protected static HttpClientBuilder addAuthentication(final HttpClientBuilder builder, final URI uri, final String username, String password) { if (isNotBlank(username)) { CredentialsProvider provider = new BasicCredentialsProvider(); AuthScope scope = new AuthScope(uri.getHost(), uri.getPort(), "realm"); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); provider.setCredentials(scope, credentials); builder.setDefaultCredentialsProvider(provider); builder.addInterceptorFirst(new PreemptiveAuth()); } return builder; }
[ "protected", "static", "HttpClientBuilder", "addAuthentication", "(", "final", "HttpClientBuilder", "builder", ",", "final", "URI", "uri", ",", "final", "String", "username", ",", "String", "password", ")", "{", "if", "(", "isNotBlank", "(", "username", ")", ")"...
Add authentication to supplied builder. @param builder the builder to configure @param uri the server URI @param username the username @param password the password @return the passed in builder
[ "Add", "authentication", "to", "supplied", "builder", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java#L457-L470
buschmais/extended-objects
spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java
ClassHelper.getType
public static <T> Class<T> getType(String name) { Class<T> type; try { type = (Class<T>) Class.forName(name); } catch (ClassNotFoundException e) { throw new XOException("Cannot find class with name '" + name + "'", e); } return type; }
java
public static <T> Class<T> getType(String name) { Class<T> type; try { type = (Class<T>) Class.forName(name); } catch (ClassNotFoundException e) { throw new XOException("Cannot find class with name '" + name + "'", e); } return type; }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "getType", "(", "String", "name", ")", "{", "Class", "<", "T", ">", "type", ";", "try", "{", "type", "=", "(", "Class", "<", "T", ">", ")", "Class", ".", "forName", "(", "name", ")", ...
Load a class. @param name The class name. @param <T> The expected class type. @return The class.
[ "Load", "a", "class", "." ]
train
https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java#L31-L39
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/DataModelUtil.java
DataModelUtil.getWriterSchema
public static <E> Schema getWriterSchema(Class<E> type, Schema schema) { Schema writerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof AllowNulls) { // assume fields are non-null by default to avoid schema conflicts dataModel = ReflectData.get(); } if (dataModel instanceof SpecificData) { writerSchema = ((SpecificData)dataModel).getSchema(type); } return writerSchema; }
java
public static <E> Schema getWriterSchema(Class<E> type, Schema schema) { Schema writerSchema = schema; GenericData dataModel = getDataModelForType(type); if (dataModel instanceof AllowNulls) { // assume fields are non-null by default to avoid schema conflicts dataModel = ReflectData.get(); } if (dataModel instanceof SpecificData) { writerSchema = ((SpecificData)dataModel).getSchema(type); } return writerSchema; }
[ "public", "static", "<", "E", ">", "Schema", "getWriterSchema", "(", "Class", "<", "E", ">", "type", ",", "Schema", "schema", ")", "{", "Schema", "writerSchema", "=", "schema", ";", "GenericData", "dataModel", "=", "getDataModelForType", "(", "type", ")", ...
Get the writer schema based on the given type and dataset schema. @param <E> The entity type @param type The Java class of the entity type @param schema The {@link Schema} for the entity @return The reader schema based on the given type and writer schema
[ "Get", "the", "writer", "schema", "based", "on", "the", "given", "type", "and", "dataset", "schema", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/DataModelUtil.java#L192-L205
hdecarne/java-default
src/main/java/de/carne/io/IOUtil.java
IOUtil.copyBuffer
public static int copyBuffer(OutputStream dst, ByteBuffer buffer) throws IOException { int remaining = buffer.remaining(); int copied = 0; if (remaining > 0) { if (buffer.hasArray()) { byte[] bufferArray = buffer.array(); int bufferArrayOffset = buffer.arrayOffset(); int bufferPosition = buffer.position(); dst.write(bufferArray, bufferArrayOffset + bufferPosition, remaining); buffer.position(bufferPosition + remaining); } else { byte[] bufferBytes = new byte[remaining]; buffer.get(bufferBytes); dst.write(bufferBytes); } copied = remaining; } return copied; }
java
public static int copyBuffer(OutputStream dst, ByteBuffer buffer) throws IOException { int remaining = buffer.remaining(); int copied = 0; if (remaining > 0) { if (buffer.hasArray()) { byte[] bufferArray = buffer.array(); int bufferArrayOffset = buffer.arrayOffset(); int bufferPosition = buffer.position(); dst.write(bufferArray, bufferArrayOffset + bufferPosition, remaining); buffer.position(bufferPosition + remaining); } else { byte[] bufferBytes = new byte[remaining]; buffer.get(bufferBytes); dst.write(bufferBytes); } copied = remaining; } return copied; }
[ "public", "static", "int", "copyBuffer", "(", "OutputStream", "dst", ",", "ByteBuffer", "buffer", ")", "throws", "IOException", "{", "int", "remaining", "=", "buffer", ".", "remaining", "(", ")", ";", "int", "copied", "=", "0", ";", "if", "(", "remaining",...
Copies all available bytes from a {@linkplain ByteBuffer} to a {@linkplain OutputStream}. @param dst the {@linkplain OutputStream} to copy to. @param buffer the {@linkplain ByteBuffer} to copy from. @return the number of copied bytes. @throws IOException if an I/O error occurs.
[ "Copies", "all", "available", "bytes", "from", "a", "{", "@linkplain", "ByteBuffer", "}", "to", "a", "{", "@linkplain", "OutputStream", "}", "." ]
train
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/io/IOUtil.java#L208-L229
Nexmo/nexmo-java
src/main/java/com/nexmo/client/insight/InsightClient.java
InsightClient.getAdvancedNumberInsight
@Deprecated public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country, String ipAddress) throws IOException, NexmoClientException { return getAdvancedNumberInsight(AdvancedInsightRequest.builder(number) .country(country) .ipAddress(ipAddress) .build()); }
java
@Deprecated public AdvancedInsightResponse getAdvancedNumberInsight(String number, String country, String ipAddress) throws IOException, NexmoClientException { return getAdvancedNumberInsight(AdvancedInsightRequest.builder(number) .country(country) .ipAddress(ipAddress) .build()); }
[ "@", "Deprecated", "public", "AdvancedInsightResponse", "getAdvancedNumberInsight", "(", "String", "number", ",", "String", "country", ",", "String", "ipAddress", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "getAdvancedNumberInsight", "(", ...
Perform an Advanced Insight Request with a number, country, and ipAddress. @param number A single phone number that you need insight about in national or international format. @param country If a number does not have a country code or it is uncertain, set the two-character country code. @param ipAddress The IP address of the user. If supplied, we will compare this to the country the user's phone is located in and return an error if it does not match. @return A {@link AdvancedInsightResponse} representing the response from the Nexmo Number Insight API. @throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects. @deprecated Create a {@link AdvancedInsightRequest} and use {@link InsightClient#getAdvancedNumberInsight(AdvancedInsightRequest)}
[ "Perform", "an", "Advanced", "Insight", "Request", "with", "a", "number", "country", "and", "ipAddress", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/InsightClient.java#L202-L208
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/restartstrategy/RestartStrategies.java
RestartStrategies.fixedDelayRestart
public static RestartStrategyConfiguration fixedDelayRestart(int restartAttempts, long delayBetweenAttempts) { return fixedDelayRestart(restartAttempts, Time.of(delayBetweenAttempts, TimeUnit.MILLISECONDS)); }
java
public static RestartStrategyConfiguration fixedDelayRestart(int restartAttempts, long delayBetweenAttempts) { return fixedDelayRestart(restartAttempts, Time.of(delayBetweenAttempts, TimeUnit.MILLISECONDS)); }
[ "public", "static", "RestartStrategyConfiguration", "fixedDelayRestart", "(", "int", "restartAttempts", ",", "long", "delayBetweenAttempts", ")", "{", "return", "fixedDelayRestart", "(", "restartAttempts", ",", "Time", ".", "of", "(", "delayBetweenAttempts", ",", "TimeU...
Generates a FixedDelayRestartStrategyConfiguration. @param restartAttempts Number of restart attempts for the FixedDelayRestartStrategy @param delayBetweenAttempts Delay in-between restart attempts for the FixedDelayRestartStrategy @return FixedDelayRestartStrategy
[ "Generates", "a", "FixedDelayRestartStrategyConfiguration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/restartstrategy/RestartStrategies.java#L57-L59
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java
Util.sqlRS
public static void sqlRS(Connection conn, String sql, Consumer<ResultSet> consumer) { try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql)) { consumer.accept(rs); } catch (SQLException e) { logger.error(e.getMessage(), e); } }
java
public static void sqlRS(Connection conn, String sql, Consumer<ResultSet> consumer) { try (Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql)) { consumer.accept(rs); } catch (SQLException e) { logger.error(e.getMessage(), e); } }
[ "public", "static", "void", "sqlRS", "(", "Connection", "conn", ",", "String", "sql", ",", "Consumer", "<", "ResultSet", ">", "consumer", ")", "{", "try", "(", "Statement", "stmt", "=", "conn", ".", "createStatement", "(", ")", ";", "ResultSet", "rs", "=...
sql执行获取resultSet @param conn sql connection @param sql sql @param consumer 回调方法
[ "sql执行获取resultSet" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java#L76-L82
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/AbstractCodeGenerator.java
AbstractCodeGenerator.getMismatchTypeErroMessage
private String getMismatchTypeErroMessage(FieldType type, Field field) { return "Type mismatch. @Protobuf required type '" + type.getJavaType() + "' but field type is '" + field.getType().getSimpleName() + "' of field name '" + field.getName() + "' on class " + field.getDeclaringClass().getCanonicalName(); }
java
private String getMismatchTypeErroMessage(FieldType type, Field field) { return "Type mismatch. @Protobuf required type '" + type.getJavaType() + "' but field type is '" + field.getType().getSimpleName() + "' of field name '" + field.getName() + "' on class " + field.getDeclaringClass().getCanonicalName(); }
[ "private", "String", "getMismatchTypeErroMessage", "(", "FieldType", "type", ",", "Field", "field", ")", "{", "return", "\"Type mismatch. @Protobuf required type '\"", "+", "type", ".", "getJavaType", "(", ")", "+", "\"' but field type is '\"", "+", "field", ".", "get...
get error message info by type not matched. @param type the type @param field the field @return error message for mismatch type
[ "get", "error", "message", "info", "by", "type", "not", "matched", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/AbstractCodeGenerator.java#L177-L181
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java
AbstractGenericHandler.onKeepAliveResponse
protected void onKeepAliveResponse(ChannelHandlerContext ctx, CouchbaseResponse keepAliveResponse) { if (traceEnabled) { LOGGER.trace(logIdent(ctx, endpoint) + "keepAlive was answered, status " + keepAliveResponse.status()); } }
java
protected void onKeepAliveResponse(ChannelHandlerContext ctx, CouchbaseResponse keepAliveResponse) { if (traceEnabled) { LOGGER.trace(logIdent(ctx, endpoint) + "keepAlive was answered, status " + keepAliveResponse.status()); } }
[ "protected", "void", "onKeepAliveResponse", "(", "ChannelHandlerContext", "ctx", ",", "CouchbaseResponse", "keepAliveResponse", ")", "{", "if", "(", "traceEnabled", ")", "{", "LOGGER", ".", "trace", "(", "logIdent", "(", "ctx", ",", "endpoint", ")", "+", "\"keep...
Override to customize the behavior when a keep alive has been responded to. The default behavior is to log the event and the response status at trace level. @param ctx the channel context. @param keepAliveResponse the keep alive request that was sent when keep alive was triggered
[ "Override", "to", "customize", "the", "behavior", "when", "a", "keep", "alive", "has", "been", "responded", "to", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L804-L809
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactorJobPropCreator.java
MRCompactorJobPropCreator.getNewDataInFolder
private Set<Path> getNewDataInFolder(Path inputFolder, Path outputFolder) throws IOException { Set<Path> newFiles = Sets.newHashSet(); if (!this.fs.exists(inputFolder) || !this.fs.exists(outputFolder)) { return newFiles; } DateTime lastCompactionTime = new DateTime(MRCompactor.readCompactionTimestamp(this.fs, outputFolder)); for (FileStatus fstat : FileListUtils.listFilesRecursively(this.fs, inputFolder)) { DateTime fileModificationTime = new DateTime(fstat.getModificationTime()); if (fileModificationTime.isAfter(lastCompactionTime)) { LOG.info ("[" + fileModificationTime.getMillis() + "] " + fstat.getPath() + " is after " + lastCompactionTime.getMillis()); newFiles.add(fstat.getPath()); } } if (!newFiles.isEmpty()) { LOG.info(String.format("Found %d new files within folder %s which are more recent than the previous " + "compaction start time of %s.", newFiles.size(), inputFolder, lastCompactionTime)); } return newFiles; }
java
private Set<Path> getNewDataInFolder(Path inputFolder, Path outputFolder) throws IOException { Set<Path> newFiles = Sets.newHashSet(); if (!this.fs.exists(inputFolder) || !this.fs.exists(outputFolder)) { return newFiles; } DateTime lastCompactionTime = new DateTime(MRCompactor.readCompactionTimestamp(this.fs, outputFolder)); for (FileStatus fstat : FileListUtils.listFilesRecursively(this.fs, inputFolder)) { DateTime fileModificationTime = new DateTime(fstat.getModificationTime()); if (fileModificationTime.isAfter(lastCompactionTime)) { LOG.info ("[" + fileModificationTime.getMillis() + "] " + fstat.getPath() + " is after " + lastCompactionTime.getMillis()); newFiles.add(fstat.getPath()); } } if (!newFiles.isEmpty()) { LOG.info(String.format("Found %d new files within folder %s which are more recent than the previous " + "compaction start time of %s.", newFiles.size(), inputFolder, lastCompactionTime)); } return newFiles; }
[ "private", "Set", "<", "Path", ">", "getNewDataInFolder", "(", "Path", "inputFolder", ",", "Path", "outputFolder", ")", "throws", "IOException", "{", "Set", "<", "Path", ">", "newFiles", "=", "Sets", ".", "newHashSet", "(", ")", ";", "if", "(", "!", "thi...
Check if inputFolder contains any files which have modification times which are more recent than the last compaction time as stored within outputFolder; return any files which do. An empty list will be returned if all files are older than the last compaction time.
[ "Check", "if", "inputFolder", "contains", "any", "files", "which", "have", "modification", "times", "which", "are", "more", "recent", "than", "the", "last", "compaction", "time", "as", "stored", "within", "outputFolder", ";", "return", "any", "files", "which", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactorJobPropCreator.java#L314-L335
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeClassFileTransformer.java
ProbeClassFileTransformer.transformWithProbes
@Sensitive byte[] transformWithProbes(Class<?> clazz, @Sensitive byte[] classfileBuffer) { Set<ProbeListener> listeners = probeManagerImpl.getInterestedByClass(clazz); if (listeners.isEmpty()) { return null; } // reader --> serial version uid adder --> process candidate hook adapter --> tracing --> writer ClassReader reader = new ClassReader(classfileBuffer); int majorVersion = reader.readShort(6); int writerFlags = majorVersion >= V1_6 ? ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS; ClassWriter writer = new RedefineClassWriter(clazz, reader, writerFlags); ClassVisitor visitor = writer; //Below Commented IF statement is causing change in StackSize of class resulting in exception when trace is enabled.Temporarily commenting out //will investigate further what is causing the below statement to change the stack size. // if (tc.isDumpEnabled()) { // visitor = new CheckClassAdapter(visitor); // } ProbeInjectionClassAdapter probeAdapter = new ProbeInjectionClassAdapter(visitor, probeManagerImpl, clazz); visitor = probeAdapter; // Process the class int readerFlags = majorVersion >= V1_6 ? ClassReader.EXPAND_FRAMES : ClassReader.SKIP_FRAMES; reader.accept(visitor, readerFlags); if (probeAdapter.isModifiedClass()) { if (tc.isDumpEnabled()) { StringWriter stringWriter = new StringWriter(); stringWriter.write("=== Original Code ===\n"); dumpClass(stringWriter, classfileBuffer); stringWriter.write("\n"); stringWriter.write("=== Modified Code ===\n"); dumpClass(stringWriter, writer.toByteArray()); Tr.dump(tc, "Bytecode", stringWriter); } return writer.toByteArray(); } return null; }
java
@Sensitive byte[] transformWithProbes(Class<?> clazz, @Sensitive byte[] classfileBuffer) { Set<ProbeListener> listeners = probeManagerImpl.getInterestedByClass(clazz); if (listeners.isEmpty()) { return null; } // reader --> serial version uid adder --> process candidate hook adapter --> tracing --> writer ClassReader reader = new ClassReader(classfileBuffer); int majorVersion = reader.readShort(6); int writerFlags = majorVersion >= V1_6 ? ClassWriter.COMPUTE_FRAMES : ClassWriter.COMPUTE_MAXS; ClassWriter writer = new RedefineClassWriter(clazz, reader, writerFlags); ClassVisitor visitor = writer; //Below Commented IF statement is causing change in StackSize of class resulting in exception when trace is enabled.Temporarily commenting out //will investigate further what is causing the below statement to change the stack size. // if (tc.isDumpEnabled()) { // visitor = new CheckClassAdapter(visitor); // } ProbeInjectionClassAdapter probeAdapter = new ProbeInjectionClassAdapter(visitor, probeManagerImpl, clazz); visitor = probeAdapter; // Process the class int readerFlags = majorVersion >= V1_6 ? ClassReader.EXPAND_FRAMES : ClassReader.SKIP_FRAMES; reader.accept(visitor, readerFlags); if (probeAdapter.isModifiedClass()) { if (tc.isDumpEnabled()) { StringWriter stringWriter = new StringWriter(); stringWriter.write("=== Original Code ===\n"); dumpClass(stringWriter, classfileBuffer); stringWriter.write("\n"); stringWriter.write("=== Modified Code ===\n"); dumpClass(stringWriter, writer.toByteArray()); Tr.dump(tc, "Bytecode", stringWriter); } return writer.toByteArray(); } return null; }
[ "@", "Sensitive", "byte", "[", "]", "transformWithProbes", "(", "Class", "<", "?", ">", "clazz", ",", "@", "Sensitive", "byte", "[", "]", "classfileBuffer", ")", "{", "Set", "<", "ProbeListener", ">", "listeners", "=", "probeManagerImpl", ".", "getInterested...
Inject the byte code required to fire probes. @param classfileBuffer the source class file @param probes the probe sites to activate @return the modified class file
[ "Inject", "the", "byte", "code", "required", "to", "fire", "probes", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeClassFileTransformer.java#L132-L172
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.addOperationParameterDescription
public ModelNode addOperationParameterDescription(final ResourceBundle bundle, final String prefix, final ModelNode operationDescription) { final ModelNode param = getNoTextDescription(true); param.get(ModelDescriptionConstants.DESCRIPTION).set(getAttributeTextDescription(bundle, prefix)); final ModelNode result = operationDescription.get(ModelDescriptionConstants.REQUEST_PROPERTIES, getName()).set(param); ModelNode deprecated = addDeprecatedInfo(result); if (deprecated != null) { deprecated.get(ModelDescriptionConstants.REASON).set(getAttributeDeprecatedDescription(bundle, prefix)); } return result; }
java
public ModelNode addOperationParameterDescription(final ResourceBundle bundle, final String prefix, final ModelNode operationDescription) { final ModelNode param = getNoTextDescription(true); param.get(ModelDescriptionConstants.DESCRIPTION).set(getAttributeTextDescription(bundle, prefix)); final ModelNode result = operationDescription.get(ModelDescriptionConstants.REQUEST_PROPERTIES, getName()).set(param); ModelNode deprecated = addDeprecatedInfo(result); if (deprecated != null) { deprecated.get(ModelDescriptionConstants.REASON).set(getAttributeDeprecatedDescription(bundle, prefix)); } return result; }
[ "public", "ModelNode", "addOperationParameterDescription", "(", "final", "ResourceBundle", "bundle", ",", "final", "String", "prefix", ",", "final", "ModelNode", "operationDescription", ")", "{", "final", "ModelNode", "param", "=", "getNoTextDescription", "(", "true", ...
Creates a returns a basic model node describing a parameter that sets this attribute, after attaching it to the given overall operation description model node. The node describing the parameter is returned to make it easy to perform further modification. @param bundle resource bundle to use for text descriptions @param prefix prefix to prepend to the attribute name key when looking up descriptions @param operationDescription the overall resource description @return the attribute description node
[ "Creates", "a", "returns", "a", "basic", "model", "node", "describing", "a", "parameter", "that", "sets", "this", "attribute", "after", "attaching", "it", "to", "the", "given", "overall", "operation", "description", "model", "node", ".", "The", "node", "descri...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L821-L830
elki-project/elki
elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/tree/AbstractNode.java
AbstractNode.splitByMask
public final void splitByMask(AbstractNode<E> newNode, long[] assignment) { assert (isLeaf() == newNode.isLeaf()); int dest = BitsUtil.nextSetBit(assignment, 0); if(dest < 0) { throw new AbortException("No bits set in splitting mask."); } // FIXME: use faster iteration/testing int pos = dest; while(pos < numEntries) { if(BitsUtil.get(assignment, pos)) { // Move to new node newNode.addEntry(getEntry(pos)); } else { // Move to new position entries[dest] = entries[pos]; dest++; } pos++; } final int rm = numEntries - dest; while(dest < numEntries) { entries[dest] = null; dest++; } numEntries -= rm; }
java
public final void splitByMask(AbstractNode<E> newNode, long[] assignment) { assert (isLeaf() == newNode.isLeaf()); int dest = BitsUtil.nextSetBit(assignment, 0); if(dest < 0) { throw new AbortException("No bits set in splitting mask."); } // FIXME: use faster iteration/testing int pos = dest; while(pos < numEntries) { if(BitsUtil.get(assignment, pos)) { // Move to new node newNode.addEntry(getEntry(pos)); } else { // Move to new position entries[dest] = entries[pos]; dest++; } pos++; } final int rm = numEntries - dest; while(dest < numEntries) { entries[dest] = null; dest++; } numEntries -= rm; }
[ "public", "final", "void", "splitByMask", "(", "AbstractNode", "<", "E", ">", "newNode", ",", "long", "[", "]", "assignment", ")", "{", "assert", "(", "isLeaf", "(", ")", "==", "newNode", ".", "isLeaf", "(", ")", ")", ";", "int", "dest", "=", "BitsUt...
Splits the entries of this node into a new node using the given assignments @param newNode Node to split to @param assignment Assignment mask
[ "Splits", "the", "entries", "of", "this", "node", "into", "a", "new", "node", "using", "the", "given", "assignments" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/tree/AbstractNode.java#L363-L389
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.billboardCylindrical
public Matrix4x3d billboardCylindrical(Vector3dc objPos, Vector3dc targetPos, Vector3dc up) { double dirX = targetPos.x() - objPos.x(); double dirY = targetPos.y() - objPos.y(); double dirZ = targetPos.z() - objPos.z(); // left = up x dir double leftX = up.y() * dirZ - up.z() * dirY; double leftY = up.z() * dirX - up.x() * dirZ; double leftZ = up.x() * dirY - up.y() * dirX; // normalize left double invLeftLen = 1.0 / Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ); leftX *= invLeftLen; leftY *= invLeftLen; leftZ *= invLeftLen; // recompute dir by constraining rotation around 'up' // dir = left x up dirX = leftY * up.z() - leftZ * up.y(); dirY = leftZ * up.x() - leftX * up.z(); dirZ = leftX * up.y() - leftY * up.x(); // normalize dir double invDirLen = 1.0 / Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); dirX *= invDirLen; dirY *= invDirLen; dirZ *= invDirLen; // set matrix elements m00 = leftX; m01 = leftY; m02 = leftZ; m10 = up.x(); m11 = up.y(); m12 = up.z(); m20 = dirX; m21 = dirY; m22 = dirZ; m30 = objPos.x(); m31 = objPos.y(); m32 = objPos.z(); properties = PROPERTY_ORTHONORMAL; return this; }
java
public Matrix4x3d billboardCylindrical(Vector3dc objPos, Vector3dc targetPos, Vector3dc up) { double dirX = targetPos.x() - objPos.x(); double dirY = targetPos.y() - objPos.y(); double dirZ = targetPos.z() - objPos.z(); // left = up x dir double leftX = up.y() * dirZ - up.z() * dirY; double leftY = up.z() * dirX - up.x() * dirZ; double leftZ = up.x() * dirY - up.y() * dirX; // normalize left double invLeftLen = 1.0 / Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ); leftX *= invLeftLen; leftY *= invLeftLen; leftZ *= invLeftLen; // recompute dir by constraining rotation around 'up' // dir = left x up dirX = leftY * up.z() - leftZ * up.y(); dirY = leftZ * up.x() - leftX * up.z(); dirZ = leftX * up.y() - leftY * up.x(); // normalize dir double invDirLen = 1.0 / Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); dirX *= invDirLen; dirY *= invDirLen; dirZ *= invDirLen; // set matrix elements m00 = leftX; m01 = leftY; m02 = leftZ; m10 = up.x(); m11 = up.y(); m12 = up.z(); m20 = dirX; m21 = dirY; m22 = dirZ; m30 = objPos.x(); m31 = objPos.y(); m32 = objPos.z(); properties = PROPERTY_ORTHONORMAL; return this; }
[ "public", "Matrix4x3d", "billboardCylindrical", "(", "Vector3dc", "objPos", ",", "Vector3dc", "targetPos", ",", "Vector3dc", "up", ")", "{", "double", "dirX", "=", "targetPos", ".", "x", "(", ")", "-", "objPos", ".", "x", "(", ")", ";", "double", "dirY", ...
Set this matrix to a cylindrical billboard transformation that rotates the local +Z axis of a given object with position <code>objPos</code> towards a target position at <code>targetPos</code> while constraining a cylindrical rotation around the given <code>up</code> vector. <p> This method can be used to create the complete model transformation for a given object, including the translation of the object to its position <code>objPos</code>. @param objPos the position of the object to rotate towards <code>targetPos</code> @param targetPos the position of the target (for example the camera) towards which to rotate the object @param up the rotation axis (must be {@link Vector3d#normalize() normalized}) @return this
[ "Set", "this", "matrix", "to", "a", "cylindrical", "billboard", "transformation", "that", "rotates", "the", "local", "+", "Z", "axis", "of", "a", "given", "object", "with", "position", "<code", ">", "objPos<", "/", "code", ">", "towards", "a", "target", "p...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L9001-L9039
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildFieldHeader
public void buildFieldHeader(XMLNode node, Content classContentTree) { if (currentClass.serializableFields().length > 0) { buildFieldSerializationOverview(currentClass, classContentTree); } }
java
public void buildFieldHeader(XMLNode node, Content classContentTree) { if (currentClass.serializableFields().length > 0) { buildFieldSerializationOverview(currentClass, classContentTree); } }
[ "public", "void", "buildFieldHeader", "(", "XMLNode", "node", ",", "Content", "classContentTree", ")", "{", "if", "(", "currentClass", ".", "serializableFields", "(", ")", ".", "length", ">", "0", ")", "{", "buildFieldSerializationOverview", "(", "currentClass", ...
Build the field header. @param node the XML element that specifies which components to document @param classContentTree content tree to which the documentation will be added
[ "Build", "the", "field", "header", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L370-L374
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/ecm/OwlValidator.java
OwlValidator.countRelations
private int countRelations(String relationName, Set<RelationshipTuple> objectRelations) { int count = 0; if (objectRelations == null) { return 0; } for (RelationshipTuple objectRelation : objectRelations) { if (objectRelation.predicate.equals(relationName)) {//This is one of the restricted relations count++; } } return count; }
java
private int countRelations(String relationName, Set<RelationshipTuple> objectRelations) { int count = 0; if (objectRelations == null) { return 0; } for (RelationshipTuple objectRelation : objectRelations) { if (objectRelation.predicate.equals(relationName)) {//This is one of the restricted relations count++; } } return count; }
[ "private", "int", "countRelations", "(", "String", "relationName", ",", "Set", "<", "RelationshipTuple", ">", "objectRelations", ")", "{", "int", "count", "=", "0", ";", "if", "(", "objectRelations", "==", "null", ")", "{", "return", "0", ";", "}", "for", ...
Private utility method. Counts the number of relations with a given name in a list of relatiosn @param relationName the relation name @param objectRelations the list of relations @return the number of relations with relationName in the list
[ "Private", "utility", "method", ".", "Counts", "the", "number", "of", "relations", "with", "a", "given", "name", "in", "a", "list", "of", "relatiosn" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/ecm/OwlValidator.java#L367-L380
ZieIony/Carbon
carbon/src/main/java/carbon/shadow/ShapePath.java
ShapePath.applyToPath
public void applyToPath(Matrix transform, Path path) { for (int i = 0, size = operations.size(); i < size; i++) { PathOperation operation = operations.get(i); operation.applyToPath(transform, path); } }
java
public void applyToPath(Matrix transform, Path path) { for (int i = 0, size = operations.size(); i < size; i++) { PathOperation operation = operations.get(i); operation.applyToPath(transform, path); } }
[ "public", "void", "applyToPath", "(", "Matrix", "transform", ",", "Path", "path", ")", "{", "for", "(", "int", "i", "=", "0", ",", "size", "=", "operations", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "PathOperation", ...
Apply the ShapePath sequence to a {@link Path} under a matrix transform. @param transform the matrix transform under which this ShapePath is applied @param path the path to which this ShapePath is applied
[ "Apply", "the", "ShapePath", "sequence", "to", "a", "{", "@link", "Path", "}", "under", "a", "matrix", "transform", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShapePath.java#L159-L164
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java
S3Manager.downloadLog
public byte[] downloadLog(CloudTrailLog ctLog, CloudTrailSource source) { boolean success = false; ProgressStatus downloadLogStatus = new ProgressStatus(ProgressState.downloadLog, new BasicProcessLogInfo(source, ctLog, success)); final Object downloadSourceReportObject = progressReporter.reportStart(downloadLogStatus); byte[] s3ObjectBytes = null; // start to download CloudTrail log try { S3Object s3Object = this.getObject(ctLog.getS3Bucket(), ctLog.getS3ObjectKey()); try (S3ObjectInputStream s3InputStream = s3Object.getObjectContent()){ s3ObjectBytes = LibraryUtils.toByteArray(s3InputStream); } ctLog.setLogFileSize(s3Object.getObjectMetadata().getContentLength()); success = true; logger.info("Downloaded log file " + ctLog.getS3ObjectKey() + " from " + ctLog.getS3Bucket()); } catch (AmazonServiceException | IOException e) { String exceptionMessage = String.format("Fail to download log file %s/%s.", ctLog.getS3Bucket(), ctLog.getS3ObjectKey()); LibraryUtils.handleException(exceptionHandler, downloadLogStatus, e, exceptionMessage); } finally { LibraryUtils.endToProcess(progressReporter, success, downloadLogStatus, downloadSourceReportObject); } return s3ObjectBytes; }
java
public byte[] downloadLog(CloudTrailLog ctLog, CloudTrailSource source) { boolean success = false; ProgressStatus downloadLogStatus = new ProgressStatus(ProgressState.downloadLog, new BasicProcessLogInfo(source, ctLog, success)); final Object downloadSourceReportObject = progressReporter.reportStart(downloadLogStatus); byte[] s3ObjectBytes = null; // start to download CloudTrail log try { S3Object s3Object = this.getObject(ctLog.getS3Bucket(), ctLog.getS3ObjectKey()); try (S3ObjectInputStream s3InputStream = s3Object.getObjectContent()){ s3ObjectBytes = LibraryUtils.toByteArray(s3InputStream); } ctLog.setLogFileSize(s3Object.getObjectMetadata().getContentLength()); success = true; logger.info("Downloaded log file " + ctLog.getS3ObjectKey() + " from " + ctLog.getS3Bucket()); } catch (AmazonServiceException | IOException e) { String exceptionMessage = String.format("Fail to download log file %s/%s.", ctLog.getS3Bucket(), ctLog.getS3ObjectKey()); LibraryUtils.handleException(exceptionHandler, downloadLogStatus, e, exceptionMessage); } finally { LibraryUtils.endToProcess(progressReporter, success, downloadLogStatus, downloadSourceReportObject); } return s3ObjectBytes; }
[ "public", "byte", "[", "]", "downloadLog", "(", "CloudTrailLog", "ctLog", ",", "CloudTrailSource", "source", ")", "{", "boolean", "success", "=", "false", ";", "ProgressStatus", "downloadLogStatus", "=", "new", "ProgressStatus", "(", "ProgressState", ".", "downloa...
Downloads an AWS CloudTrail log from the specified source. @param ctLog The {@link CloudTrailLog} to download @param source The {@link CloudTrailSource} to download the log from. @return A byte array containing the log data.
[ "Downloads", "an", "AWS", "CloudTrail", "log", "from", "the", "specified", "source", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/S3Manager.java#L74-L100
wisdom-framework/wisdom-jcr
wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java
JcromBundleContext.registerCrud
private ServiceRegistration registerCrud(BundleContext context, JcrCrudService crud) { Dictionary prop = jcromConfiguration.toDictionary(); prop.put(Crud.ENTITY_CLASS_PROPERTY, crud.getEntityClass()); prop.put(Crud.ENTITY_CLASSNAME_PROPERTY, crud.getEntityClass().getName()); ServiceRegistration serviceRegistration = context.registerService(new String[]{Crud.class.getName(), JcrCrud.class.getName()}, crud, prop); return serviceRegistration; }
java
private ServiceRegistration registerCrud(BundleContext context, JcrCrudService crud) { Dictionary prop = jcromConfiguration.toDictionary(); prop.put(Crud.ENTITY_CLASS_PROPERTY, crud.getEntityClass()); prop.put(Crud.ENTITY_CLASSNAME_PROPERTY, crud.getEntityClass().getName()); ServiceRegistration serviceRegistration = context.registerService(new String[]{Crud.class.getName(), JcrCrud.class.getName()}, crud, prop); return serviceRegistration; }
[ "private", "ServiceRegistration", "registerCrud", "(", "BundleContext", "context", ",", "JcrCrudService", "crud", ")", "{", "Dictionary", "prop", "=", "jcromConfiguration", ".", "toDictionary", "(", ")", ";", "prop", ".", "put", "(", "Crud", ".", "ENTITY_CLASS_PRO...
Register the given Crud service in OSGi registry @param context @param crud @return
[ "Register", "the", "given", "Crud", "service", "in", "OSGi", "registry" ]
train
https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java#L73-L79
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.endDocument
@Override public void endDocument() throws SAXException { LOG.info("Content Processing finished, saving..."); try { this.session.save(); } catch (final RepositoryException e) { throw new AssertionError("Saving failed", e); } if (LOG.isInfoEnabled()) { LOG.info("Content imported in {} ms", (System.nanoTime() - this.startTime) / 1_000_000); LOG.info("END ContentImport"); } }
java
@Override public void endDocument() throws SAXException { LOG.info("Content Processing finished, saving..."); try { this.session.save(); } catch (final RepositoryException e) { throw new AssertionError("Saving failed", e); } if (LOG.isInfoEnabled()) { LOG.info("Content imported in {} ms", (System.nanoTime() - this.startTime) / 1_000_000); LOG.info("END ContentImport"); } }
[ "@", "Override", "public", "void", "endDocument", "(", ")", "throws", "SAXException", "{", "LOG", ".", "info", "(", "\"Content Processing finished, saving...\"", ")", ";", "try", "{", "this", ".", "session", ".", "save", "(", ")", ";", "}", "catch", "(", "...
Persists the changes in the repository and prints out information such as processing time.
[ "Persists", "the", "changes", "in", "the", "repository", "and", "prints", "out", "information", "such", "as", "processing", "time", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L144-L157
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/PublishingScopeUrl.java
PublishingScopeUrl.deletePublishSetUrl
public static MozuUrl deletePublishSetUrl(Boolean discardDrafts, String publishSetCode) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?discardDrafts={discardDrafts}"); formatter.formatUrl("discardDrafts", discardDrafts); formatter.formatUrl("publishSetCode", publishSetCode); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deletePublishSetUrl(Boolean discardDrafts, String publishSetCode) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?discardDrafts={discardDrafts}"); formatter.formatUrl("discardDrafts", discardDrafts); formatter.formatUrl("publishSetCode", publishSetCode); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deletePublishSetUrl", "(", "Boolean", "discardDrafts", ",", "String", "publishSetCode", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?discardDrafts={di...
Get Resource Url for DeletePublishSet @param discardDrafts Specifies whether to discard all the drafts assigned to the publish set when the publish set is deleted. @param publishSetCode The unique identifier of the publish set. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeletePublishSet" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/PublishingScopeUrl.java#L80-L86
Netflix/karyon
karyon2-governator/src/main/java/netflix/karyon/Karyon.java
Karyon.forTcpServer
public static KaryonServer forTcpServer(RxServer<?, ?> server, Module... modules) { return forTcpServer(server, toBootstrapModule(modules)); }
java
public static KaryonServer forTcpServer(RxServer<?, ?> server, Module... modules) { return forTcpServer(server, toBootstrapModule(modules)); }
[ "public", "static", "KaryonServer", "forTcpServer", "(", "RxServer", "<", "?", ",", "?", ">", "server", ",", "Module", "...", "modules", ")", "{", "return", "forTcpServer", "(", "server", ",", "toBootstrapModule", "(", "modules", ")", ")", ";", "}" ]
Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link RxServer} with it's own lifecycle. @param server TCP server @param modules Additional modules if any. @return {@link KaryonServer} which is to be used to start the created server.
[ "Creates", "a", "new", "{", "@link", "KaryonServer", "}", "which", "combines", "lifecycle", "of", "the", "passed", "{", "@link", "RxServer", "}", "with", "it", "s", "own", "lifecycle", "." ]
train
https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L151-L153
facebookarchive/hadoop-20
src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorJobTracker.java
SimulatorJobTracker.startTracker
public static SimulatorJobTracker startTracker(JobConf conf, long startTime, SimulatorEngine engine) throws IOException { SimulatorJobTracker result = null; try { SimulatorClock simClock = new SimulatorClock(startTime); result = new SimulatorJobTracker(conf, simClock, engine); result.taskScheduler.setTaskTrackerManager(result); } catch (IOException e) { LOG.warn("Error starting tracker: " + StringUtils.stringifyException(e)); } catch (InterruptedException e) { LOG.warn("Error starting tracker: " + StringUtils.stringifyException(e)); } if (result != null) { JobEndNotifier.startNotifier(); } return result; }
java
public static SimulatorJobTracker startTracker(JobConf conf, long startTime, SimulatorEngine engine) throws IOException { SimulatorJobTracker result = null; try { SimulatorClock simClock = new SimulatorClock(startTime); result = new SimulatorJobTracker(conf, simClock, engine); result.taskScheduler.setTaskTrackerManager(result); } catch (IOException e) { LOG.warn("Error starting tracker: " + StringUtils.stringifyException(e)); } catch (InterruptedException e) { LOG.warn("Error starting tracker: " + StringUtils.stringifyException(e)); } if (result != null) { JobEndNotifier.startNotifier(); } return result; }
[ "public", "static", "SimulatorJobTracker", "startTracker", "(", "JobConf", "conf", ",", "long", "startTime", ",", "SimulatorEngine", "engine", ")", "throws", "IOException", "{", "SimulatorJobTracker", "result", "=", "null", ";", "try", "{", "SimulatorClock", "simClo...
Starts the JobTracker with given configuration and a given time. It also starts the JobNotifier thread. @param conf the starting configuration of the SimulatorJobTracker. @param startTime the starting time of simulation -- this is used to initialize the clock. @param engine the SimulatorEngine that we talk to. @throws IOException
[ "Starts", "the", "JobTracker", "with", "given", "configuration", "and", "a", "given", "time", ".", "It", "also", "starts", "the", "JobNotifier", "thread", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorJobTracker.java#L94-L113
akquinet/androlog
androlog/src/main/java/de/akquinet/android/androlog/Log.java
Log.wtf
public static int wtf(Object object, String msg, Throwable tr) { if (object != null) { return wtf(object.getClass().getName(), msg, tr); } return 0; }
java
public static int wtf(Object object, String msg, Throwable tr) { if (object != null) { return wtf(object.getClass().getName(), msg, tr); } return 0; }
[ "public", "static", "int", "wtf", "(", "Object", "object", ",", "String", "msg", ",", "Throwable", "tr", ")", "{", "if", "(", "object", "!=", "null", ")", "{", "return", "wtf", "(", "object", ".", "getClass", "(", ")", ".", "getName", "(", ")", ","...
What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level Constants.ASSERT despite the logging is disabled. Depending on system configuration, and on Android 2.2+, a report may be added to the DropBoxManager and/or the process may be terminated immediately with an error dialog. On older Android version (before 2.2), the message is logged with the Assert level. Those log messages will always be logged. @param object Used to compute the tag. @param msg The message you would like logged. @param tr The exception to log
[ "What", "a", "Terrible", "Failure", ":", "Report", "a", "condition", "that", "should", "never", "happen", ".", "The", "error", "will", "always", "be", "logged", "at", "level", "Constants", ".", "ASSERT", "despite", "the", "logging", "is", "disabled", ".", ...
train
https://github.com/akquinet/androlog/blob/82fa81354c01c9b1d1928062b634ba21f14be560/androlog/src/main/java/de/akquinet/android/androlog/Log.java#L1080-L1085
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.parseCurrency
@Nullable public static BigDecimal parseCurrency (@Nullable final String sStr, @Nonnull final DecimalFormat aFormat, @Nullable final BigDecimal aDefault) { return parseCurrency (sStr, aFormat, aDefault, DEFAULT_ROUNDING_MODE); }
java
@Nullable public static BigDecimal parseCurrency (@Nullable final String sStr, @Nonnull final DecimalFormat aFormat, @Nullable final BigDecimal aDefault) { return parseCurrency (sStr, aFormat, aDefault, DEFAULT_ROUNDING_MODE); }
[ "@", "Nullable", "public", "static", "BigDecimal", "parseCurrency", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nonnull", "final", "DecimalFormat", "aFormat", ",", "@", "Nullable", "final", "BigDecimal", "aDefault", ")", "{", "return", "parseCurr...
Parse a currency value from string using the currency default rounding mode.<br> Source: <code>http://wheelworkshop.blogspot.com/2006/02/parsing-currency-into-bigdecimal.html</code> @param sStr The string to be parsed. @param aFormat The formatting object to be used. May not be <code>null</code>. @param aDefault The default value to be returned, if parsing failed. @return Either default value or the {@link BigDecimal} value with the correct scaling.
[ "Parse", "a", "currency", "value", "from", "string", "using", "the", "currency", "default", "rounding", "mode", ".", "<br", ">", "Source", ":", "<code", ">", "http", ":", "//", "wheelworkshop", ".", "blogspot", ".", "com", "/", "2006", "/", "02", "/", ...
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L199-L205
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/MessagesApi.java
MessagesApi.getNormalizedMessages
public NormalizedMessagesEnvelope getNormalizedMessages(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { ApiResponse<NormalizedMessagesEnvelope> resp = getNormalizedMessagesWithHttpInfo(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order); return resp.getData(); }
java
public NormalizedMessagesEnvelope getNormalizedMessages(String uid, String sdid, String mid, String fieldPresence, String filter, String offset, Integer count, Long startDate, Long endDate, String order) throws ApiException { ApiResponse<NormalizedMessagesEnvelope> resp = getNormalizedMessagesWithHttpInfo(uid, sdid, mid, fieldPresence, filter, offset, count, startDate, endDate, order); return resp.getData(); }
[ "public", "NormalizedMessagesEnvelope", "getNormalizedMessages", "(", "String", "uid", ",", "String", "sdid", ",", "String", "mid", ",", "String", "fieldPresence", ",", "String", "filter", ",", "String", "offset", ",", "Integer", "count", ",", "Long", "startDate",...
Get Normalized Messages Get the messages normalized @param uid User ID. If not specified, assume that of the current authenticated user. If specified, it must be that of a user for which the current authenticated user has read access to. (optional) @param sdid Source device ID of the messages being searched. (optional) @param mid The message ID being searched. (optional) @param fieldPresence String representing a field from the specified device ID. (optional) @param filter Filter. (optional) @param offset A string that represents the starting item, should be the value of &#39;next&#39; field received in the last response. (required for pagination) (optional) @param count count (optional) @param startDate startDate (optional) @param endDate endDate (optional) @param order Desired sort order: &#39;asc&#39; or &#39;desc&#39; (optional) @return NormalizedMessagesEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Normalized", "Messages", "Get", "the", "messages", "normalized" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L1000-L1003
Harium/keel
src/main/java/com/harium/keel/catalano/math/TaylorSeries.java
TaylorSeries.Cosh
public static double Cosh(double x, int nTerms) { if (nTerms < 2) return x; if (nTerms == 2) { return 1 + (x * x) / 2D; } else { double mult = x * x; double fact = 2; int factS = 4; double result = 1 + mult / fact; for (int i = 3; i <= nTerms; i++) { mult *= x * x; fact *= factS * (factS - 1); factS += 2; result += mult / fact; } return result; } }
java
public static double Cosh(double x, int nTerms) { if (nTerms < 2) return x; if (nTerms == 2) { return 1 + (x * x) / 2D; } else { double mult = x * x; double fact = 2; int factS = 4; double result = 1 + mult / fact; for (int i = 3; i <= nTerms; i++) { mult *= x * x; fact *= factS * (factS - 1); factS += 2; result += mult / fact; } return result; } }
[ "public", "static", "double", "Cosh", "(", "double", "x", ",", "int", "nTerms", ")", "{", "if", "(", "nTerms", "<", "2", ")", "return", "x", ";", "if", "(", "nTerms", "==", "2", ")", "{", "return", "1", "+", "(", "x", "*", "x", ")", "/", "2D"...
compute Cosh using Taylor Series. @param x An angle, in radians. @param nTerms Number of terms. @return Result.
[ "compute", "Cosh", "using", "Taylor", "Series", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/TaylorSeries.java#L135-L154
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java
TransposePathElement.innerParse
private static TransposePathElement innerParse( String originalKey, String meat ) { char first = meat.charAt( 0 ); if ( Character.isDigit( first ) ) { // loop until we find a comma or end of string StringBuilder sb = new StringBuilder().append( first ); for ( int index = 1; index < meat.length(); index++ ) { char c = meat.charAt( index ); // when we find a / the first comma, stop looking for integers, and just assume the rest is a String path if( ',' == c ) { int upLevel; try { upLevel = Integer.valueOf( sb.toString() ); } catch ( NumberFormatException nfe ) { // I don't know how this exception would get thrown, as all the chars were checked by isDigit, but oh well throw new SpecException( "@ path element with non/mixed numeric key is not valid, key=" + originalKey ); } return new TransposePathElement( originalKey, upLevel, meat.substring( index + 1 ) ); } else if ( Character.isDigit( c ) ) { sb.append( c ); } else { throw new SpecException( "@ path element with non/mixed numeric key is not valid, key=" + originalKey ); } } // if we got out of the for loop, then the whole thing was a number. return new TransposePathElement( originalKey, Integer.valueOf( sb.toString() ), null ); } else { return new TransposePathElement( originalKey, 0, meat ); } }
java
private static TransposePathElement innerParse( String originalKey, String meat ) { char first = meat.charAt( 0 ); if ( Character.isDigit( first ) ) { // loop until we find a comma or end of string StringBuilder sb = new StringBuilder().append( first ); for ( int index = 1; index < meat.length(); index++ ) { char c = meat.charAt( index ); // when we find a / the first comma, stop looking for integers, and just assume the rest is a String path if( ',' == c ) { int upLevel; try { upLevel = Integer.valueOf( sb.toString() ); } catch ( NumberFormatException nfe ) { // I don't know how this exception would get thrown, as all the chars were checked by isDigit, but oh well throw new SpecException( "@ path element with non/mixed numeric key is not valid, key=" + originalKey ); } return new TransposePathElement( originalKey, upLevel, meat.substring( index + 1 ) ); } else if ( Character.isDigit( c ) ) { sb.append( c ); } else { throw new SpecException( "@ path element with non/mixed numeric key is not valid, key=" + originalKey ); } } // if we got out of the for loop, then the whole thing was a number. return new TransposePathElement( originalKey, Integer.valueOf( sb.toString() ), null ); } else { return new TransposePathElement( originalKey, 0, meat ); } }
[ "private", "static", "TransposePathElement", "innerParse", "(", "String", "originalKey", ",", "String", "meat", ")", "{", "char", "first", "=", "meat", ".", "charAt", "(", "0", ")", ";", "if", "(", "Character", ".", "isDigit", "(", "first", ")", ")", "{"...
Parse the core of the TransposePathElement key, once basic errors have been checked and syntax has been handled. @param originalKey The original text for reference. @param meat The string to actually parse into a TransposePathElement @return TransposePathElement
[ "Parse", "the", "core", "of", "the", "TransposePathElement", "key", "once", "basic", "errors", "have", "been", "checked", "and", "syntax", "has", "been", "handled", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java#L120-L157
line/line-bot-sdk-java
line-bot-api-client/src/main/java/com/linecorp/bot/client/LineSignatureValidator.java
LineSignatureValidator.validateSignature
public boolean validateSignature(@NonNull byte[] content, @NonNull String headerSignature) { final byte[] signature = generateSignature(content); final byte[] decodeHeaderSignature = Base64.getDecoder().decode(headerSignature); return MessageDigest.isEqual(decodeHeaderSignature, signature); }
java
public boolean validateSignature(@NonNull byte[] content, @NonNull String headerSignature) { final byte[] signature = generateSignature(content); final byte[] decodeHeaderSignature = Base64.getDecoder().decode(headerSignature); return MessageDigest.isEqual(decodeHeaderSignature, signature); }
[ "public", "boolean", "validateSignature", "(", "@", "NonNull", "byte", "[", "]", "content", ",", "@", "NonNull", "String", "headerSignature", ")", "{", "final", "byte", "[", "]", "signature", "=", "generateSignature", "(", "content", ")", ";", "final", "byte...
Validate signature. @param content Body of the http request in byte array. @param headerSignature Signature value from `X-LINE-Signature` HTTP header @return True if headerSignature matches signature of the content. False otherwise.
[ "Validate", "signature", "." ]
train
https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-api-client/src/main/java/com/linecorp/bot/client/LineSignatureValidator.java#L51-L55
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectReportType
public String buildSelectReportType(String htmlAttributes) { List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_LABEL_SIMPLE_0)); options.add(key(Messages.GUI_LABEL_EXTENDED_0)); String[] vals = new String[] {I_CmsReport.REPORT_TYPE_SIMPLE, I_CmsReport.REPORT_TYPE_EXTENDED}; List<String> values = new ArrayList<String>(java.util.Arrays.asList(vals)); int selectedIndex = 0; if (I_CmsReport.REPORT_TYPE_EXTENDED.equals(getParamTabWpReportType())) { selectedIndex = 1; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
java
public String buildSelectReportType(String htmlAttributes) { List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_LABEL_SIMPLE_0)); options.add(key(Messages.GUI_LABEL_EXTENDED_0)); String[] vals = new String[] {I_CmsReport.REPORT_TYPE_SIMPLE, I_CmsReport.REPORT_TYPE_EXTENDED}; List<String> values = new ArrayList<String>(java.util.Arrays.asList(vals)); int selectedIndex = 0; if (I_CmsReport.REPORT_TYPE_EXTENDED.equals(getParamTabWpReportType())) { selectedIndex = 1; } return buildSelect(htmlAttributes, options, values, selectedIndex); }
[ "public", "String", "buildSelectReportType", "(", "String", "htmlAttributes", ")", "{", "List", "<", "String", ">", "options", "=", "new", "ArrayList", "<", "String", ">", "(", "2", ")", ";", "options", ".", "add", "(", "key", "(", "Messages", ".", "GUI_...
Builds the html for the workplace report type select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the workplace report type select box
[ "Builds", "the", "html", "for", "the", "workplace", "report", "type", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L828-L840
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/ContextManager.java
ContextManager.generateIdentifier
private StepIdentifier generateIdentifier(List<Pair<StepContextId, INodeEntry>> stack) { List<StepContextId> ctxs = new ArrayList<>(); int i = 0; for (Pair<StepContextId, INodeEntry> pair : stack) { Map<String, String> params = null; if (null != pair.getSecond() && i < stack.size() - 1) { //include node as a parameter to the context only when it is an intermediate step, // i.e. a parent in the sequence params = new HashMap<>(); params.put("node", pair.getSecond().getNodename()); } ctxs.add(StateUtils.stepContextId(pair.getFirst().getStep(), !pair.getFirst().getAspect().isMain(), params )); i++; } return StateUtils.stepIdentifier(ctxs); }
java
private StepIdentifier generateIdentifier(List<Pair<StepContextId, INodeEntry>> stack) { List<StepContextId> ctxs = new ArrayList<>(); int i = 0; for (Pair<StepContextId, INodeEntry> pair : stack) { Map<String, String> params = null; if (null != pair.getSecond() && i < stack.size() - 1) { //include node as a parameter to the context only when it is an intermediate step, // i.e. a parent in the sequence params = new HashMap<>(); params.put("node", pair.getSecond().getNodename()); } ctxs.add(StateUtils.stepContextId(pair.getFirst().getStep(), !pair.getFirst().getAspect().isMain(), params )); i++; } return StateUtils.stepIdentifier(ctxs); }
[ "private", "StepIdentifier", "generateIdentifier", "(", "List", "<", "Pair", "<", "StepContextId", ",", "INodeEntry", ">", ">", "stack", ")", "{", "List", "<", "StepContextId", ">", "ctxs", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "i", "=", "...
@param stack stack @return Convert stack of context data into a StepIdentifier
[ "@param", "stack", "stack" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/ContextManager.java#L101-L118
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java
ConsumerUtil.validateIatAndExp
void validateIatAndExp(JwtClaims jwtClaims, long clockSkewInMilliseconds) throws InvalidClaimException { if (jwtClaims == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Missing JwtClaims object"); } return; } NumericDate issueAtClaim = getIssuedAtClaim(jwtClaims); NumericDate expirationClaim = getExpirationClaim(jwtClaims); debugCurrentTimes(clockSkewInMilliseconds, issueAtClaim, expirationClaim); validateIssuedAtClaim(issueAtClaim, expirationClaim, clockSkewInMilliseconds); validateExpirationClaim(expirationClaim, clockSkewInMilliseconds); }
java
void validateIatAndExp(JwtClaims jwtClaims, long clockSkewInMilliseconds) throws InvalidClaimException { if (jwtClaims == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Missing JwtClaims object"); } return; } NumericDate issueAtClaim = getIssuedAtClaim(jwtClaims); NumericDate expirationClaim = getExpirationClaim(jwtClaims); debugCurrentTimes(clockSkewInMilliseconds, issueAtClaim, expirationClaim); validateIssuedAtClaim(issueAtClaim, expirationClaim, clockSkewInMilliseconds); validateExpirationClaim(expirationClaim, clockSkewInMilliseconds); }
[ "void", "validateIatAndExp", "(", "JwtClaims", "jwtClaims", ",", "long", "clockSkewInMilliseconds", ")", "throws", "InvalidClaimException", "{", "if", "(", "jwtClaims", "==", "null", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ...
Validates the the {@value Claims#ISSUED_AT} and {@value Claims#EXPIRATION} claims are present and properly formed. Also verifies that the {@value Claims#ISSUED_AT} time is after the {@value Claims#EXPIRATION} time.
[ "Validates", "the", "the", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L465-L480
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/ColumnText.java
ColumnText.setColumns
public void setColumns(float leftLine[], float rightLine[]) { maxY = -10e20f; minY = 10e20f; setYLine(Math.max(leftLine[1], leftLine[leftLine.length - 1])); rightWall = convertColumn(rightLine); leftWall = convertColumn(leftLine); rectangularWidth = -1; rectangularMode = false; }
java
public void setColumns(float leftLine[], float rightLine[]) { maxY = -10e20f; minY = 10e20f; setYLine(Math.max(leftLine[1], leftLine[leftLine.length - 1])); rightWall = convertColumn(rightLine); leftWall = convertColumn(leftLine); rectangularWidth = -1; rectangularMode = false; }
[ "public", "void", "setColumns", "(", "float", "leftLine", "[", "]", ",", "float", "rightLine", "[", "]", ")", "{", "maxY", "=", "-", "10e20f", ";", "minY", "=", "10e20f", ";", "setYLine", "(", "Math", ".", "max", "(", "leftLine", "[", "1", "]", ","...
Sets the columns bounds. Each column bound is described by a <CODE>float[]</CODE> with the line points [x1,y1,x2,y2,...]. The array must have at least 4 elements. @param leftLine the left column bound @param rightLine the right column bound
[ "Sets", "the", "columns", "bounds", ".", "Each", "column", "bound", "is", "described", "by", "a", "<CODE", ">", "float", "[]", "<", "/", "CODE", ">", "with", "the", "line", "points", "[", "x1", "y1", "x2", "y2", "...", "]", ".", "The", "array", "mu...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/ColumnText.java#L588-L596
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.getMappedFieldName
protected String getMappedFieldName(Field field, @Nullable Class<?> domainType) { return getMappedFieldName(field.getName(), domainType); }
java
protected String getMappedFieldName(Field field, @Nullable Class<?> domainType) { return getMappedFieldName(field.getName(), domainType); }
[ "protected", "String", "getMappedFieldName", "(", "Field", "field", ",", "@", "Nullable", "Class", "<", "?", ">", "domainType", ")", "{", "return", "getMappedFieldName", "(", "field", ".", "getName", "(", ")", ",", "domainType", ")", ";", "}" ]
Get the mapped field name using meta information derived from the given domain type. @param field @param domainType @return @since 4.0
[ "Get", "the", "mapped", "field", "name", "using", "meta", "information", "derived", "from", "the", "given", "domain", "type", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L315-L317
networknt/light-4j
dump/src/main/java/com/networknt/dump/StatusCodeDumper.java
StatusCodeDumper.dumpResponse
@Override public void dumpResponse(Map<String, Object> result) { this.statusCodeResult = String.valueOf(exchange.getStatusCode()); this.putDumpInfoTo(result); }
java
@Override public void dumpResponse(Map<String, Object> result) { this.statusCodeResult = String.valueOf(exchange.getStatusCode()); this.putDumpInfoTo(result); }
[ "@", "Override", "public", "void", "dumpResponse", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "this", ".", "statusCodeResult", "=", "String", ".", "valueOf", "(", "exchange", ".", "getStatusCode", "(", ")", ")", ";", "this", ".", ...
impl of dumping response status code to result @param result A map you want to put dump information to
[ "impl", "of", "dumping", "response", "status", "code", "to", "result" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L38-L42
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java
Polyline.setDefaultInfoWindowLocation
protected void setDefaultInfoWindowLocation(){ int s = mOriginalPoints.size(); if (s > 0) mInfoWindowLocation = mOriginalPoints.get(s/2); else mInfoWindowLocation = new GeoPoint(0.0, 0.0); }
java
protected void setDefaultInfoWindowLocation(){ int s = mOriginalPoints.size(); if (s > 0) mInfoWindowLocation = mOriginalPoints.get(s/2); else mInfoWindowLocation = new GeoPoint(0.0, 0.0); }
[ "protected", "void", "setDefaultInfoWindowLocation", "(", ")", "{", "int", "s", "=", "mOriginalPoints", ".", "size", "(", ")", ";", "if", "(", "s", ">", "0", ")", "mInfoWindowLocation", "=", "mOriginalPoints", ".", "get", "(", "s", "/", "2", ")", ";", ...
Internal method used to ensure that the infowindow will have a default position in all cases, so that the user can call showInfoWindow even if no tap occured before. Currently, set the position on the "middle" point of the polyline.
[ "Internal", "method", "used", "to", "ensure", "that", "the", "infowindow", "will", "have", "a", "default", "position", "in", "all", "cases", "so", "that", "the", "user", "can", "call", "showInfoWindow", "even", "if", "no", "tap", "occured", "before", ".", ...
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/Polyline.java#L245-L251
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/stats/MeasureMap.java
MeasureMap.putAttachment
@Deprecated public MeasureMap putAttachment(String key, String value) { return putAttachment(key, AttachmentValueString.create(value)); }
java
@Deprecated public MeasureMap putAttachment(String key, String value) { return putAttachment(key, AttachmentValueString.create(value)); }
[ "@", "Deprecated", "public", "MeasureMap", "putAttachment", "(", "String", "key", ",", "String", "value", ")", "{", "return", "putAttachment", "(", "key", ",", "AttachmentValueString", ".", "create", "(", "value", ")", ")", ";", "}" ]
Associate the contextual information of an {@code Exemplar} to this {@link MeasureMap}. Contextual information is represented as {@code String} key-value pairs. <p>If this method is called multiple times with the same key, only the last value will be kept. @param key the key of contextual information of an {@code Exemplar}. @param value the string representation of contextual information of an {@code Exemplar}. @return this @since 0.16 @deprecated in favor of {@link #putAttachment(String, AttachmentValue)}.
[ "Associate", "the", "contextual", "information", "of", "an", "{", "@code", "Exemplar", "}", "to", "this", "{", "@link", "MeasureMap", "}", ".", "Contextual", "information", "is", "represented", "as", "{", "@code", "String", "}", "key", "-", "value", "pairs",...
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/stats/MeasureMap.java#L69-L72
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java
LocaleMatcher.processMapping
private void processMapping() { for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) { String desired = desiredToMatchingLanguages.getKey(); Set<String> supported = desiredToMatchingLanguages.getValue(); for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) { final ULocale key = localeToMaxAndWeight.get0(); String lang = key.getLanguage(); if (supported.contains(lang)) { addFiltered(desired, localeToMaxAndWeight); } } } // now put in the values directly, since languages always map to themselves for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) { final ULocale key = localeToMaxAndWeight.get0(); String lang = key.getLanguage(); addFiltered(lang, localeToMaxAndWeight); } }
java
private void processMapping() { for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) { String desired = desiredToMatchingLanguages.getKey(); Set<String> supported = desiredToMatchingLanguages.getValue(); for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) { final ULocale key = localeToMaxAndWeight.get0(); String lang = key.getLanguage(); if (supported.contains(lang)) { addFiltered(desired, localeToMaxAndWeight); } } } // now put in the values directly, since languages always map to themselves for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) { final ULocale key = localeToMaxAndWeight.get0(); String lang = key.getLanguage(); addFiltered(lang, localeToMaxAndWeight); } }
[ "private", "void", "processMapping", "(", ")", "{", "for", "(", "Entry", "<", "String", ",", "Set", "<", "String", ">", ">", "desiredToMatchingLanguages", ":", "matcherData", ".", "matchingLanguages", "(", ")", ".", "keyValuesSet", "(", ")", ")", "{", "Str...
We preprocess the data to get just the possible matches for each desired base language.
[ "We", "preprocess", "the", "data", "to", "get", "just", "the", "possible", "matches", "for", "each", "desired", "base", "language", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L307-L325
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java
ReferrerURLCookieHandler.createReferrerURLCookie
public Cookie createReferrerURLCookie(String cookieName, @Sensitive String url, HttpServletRequest req) { if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) url = removeHostNameFromURL(url); return createCookie(cookieName, url, req); }
java
public Cookie createReferrerURLCookie(String cookieName, @Sensitive String url, HttpServletRequest req) { if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) url = removeHostNameFromURL(url); return createCookie(cookieName, url, req); }
[ "public", "Cookie", "createReferrerURLCookie", "(", "String", "cookieName", ",", "@", "Sensitive", "String", "url", ",", "HttpServletRequest", "req", ")", "{", "if", "(", "!", "webAppSecConfig", ".", "getPreserveFullyQualifiedReferrerUrl", "(", ")", ")", "url", "=...
Create the referrer URL cookie. This cookie should be session length (age == -1). @param authResult @param url
[ "Create", "the", "referrer", "URL", "cookie", ".", "This", "cookie", "should", "be", "session", "length", "(", "age", "==", "-", "1", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L69-L74
zaproxy/zaproxy
src/org/zaproxy/zap/network/ZapPutMethod.java
ZapPutMethod.readResponseHeaders
@Override protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { getResponseHeaderGroup().clear(); Header[] headers = ZapHttpParser.parseHeaders(conn.getResponseInputStream(), getParams().getHttpElementCharset()); // Wire logging moved to HttpParser getResponseHeaderGroup().setHeaders(headers); }
java
@Override protected void readResponseHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { getResponseHeaderGroup().clear(); Header[] headers = ZapHttpParser.parseHeaders(conn.getResponseInputStream(), getParams().getHttpElementCharset()); // Wire logging moved to HttpParser getResponseHeaderGroup().setHeaders(headers); }
[ "@", "Override", "protected", "void", "readResponseHeaders", "(", "HttpState", "state", ",", "HttpConnection", "conn", ")", "throws", "IOException", ",", "HttpException", "{", "getResponseHeaderGroup", "(", ")", ".", "clear", "(", ")", ";", "Header", "[", "]", ...
/* Implementation copied from HttpMethodBase#readResponseHeaders(HttpState, HttpConnection) but changed to use a custom header parser (ZapHttpParser#parseHeaders(InputStream, String)).
[ "/", "*", "Implementation", "copied", "from", "HttpMethodBase#readResponseHeaders", "(", "HttpState", "HttpConnection", ")", "but", "changed", "to", "use", "a", "custom", "header", "parser", "(", "ZapHttpParser#parseHeaders", "(", "InputStream", "String", "))", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/network/ZapPutMethod.java#L54-L61
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.createFileWalkState
private static FileWalkState createFileWalkState(File file) { File[] contents = file.listFiles(); List<File> dirs = new ArrayList<File>(); List<File> files = new ArrayList<File>(); for (File subFile : contents) { if (subFile.isDirectory()) { dirs.add(subFile); } else { files.add(subFile); } } return new FileWalkState(file, dirs, files); }
java
private static FileWalkState createFileWalkState(File file) { File[] contents = file.listFiles(); List<File> dirs = new ArrayList<File>(); List<File> files = new ArrayList<File>(); for (File subFile : contents) { if (subFile.isDirectory()) { dirs.add(subFile); } else { files.add(subFile); } } return new FileWalkState(file, dirs, files); }
[ "private", "static", "FileWalkState", "createFileWalkState", "(", "File", "file", ")", "{", "File", "[", "]", "contents", "=", "file", ".", "listFiles", "(", ")", ";", "List", "<", "File", ">", "dirs", "=", "new", "ArrayList", "<", "File", ">", "(", ")...
Helper method for creating a FileWalkState object from a File object.<p> @param file the file @return the file walk state
[ "Helper", "method", "for", "creating", "a", "FileWalkState", "object", "from", "a", "File", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L964-L977
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/Circle.java
Circle.prepare
@Override protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) { final double r = attr.getRadius(); if (r > 0) { context.beginPath(); context.arc(0, 0, r, 0, Math.PI * 2, true); context.closePath(); return true; } return false; }
java
@Override protected boolean prepare(final Context2D context, final Attributes attr, final double alpha) { final double r = attr.getRadius(); if (r > 0) { context.beginPath(); context.arc(0, 0, r, 0, Math.PI * 2, true); context.closePath(); return true; } return false; }
[ "@", "Override", "protected", "boolean", "prepare", "(", "final", "Context2D", "context", ",", "final", "Attributes", "attr", ",", "final", "double", "alpha", ")", "{", "final", "double", "r", "=", "attr", ".", "getRadius", "(", ")", ";", "if", "(", "r",...
Draws this circle @param context the {@link Context2D} used to draw this circle.
[ "Draws", "this", "circle" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Circle.java#L64-L80
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.addEntry
public static void addEntry(File zip, String path, byte[] bytes, File destZip) { addEntry(zip, new ByteSource(path, bytes), destZip); }
java
public static void addEntry(File zip, String path, byte[] bytes, File destZip) { addEntry(zip, new ByteSource(path, bytes), destZip); }
[ "public", "static", "void", "addEntry", "(", "File", "zip", ",", "String", "path", ",", "byte", "[", "]", "bytes", ",", "File", "destZip", ")", "{", "addEntry", "(", "zip", ",", "new", "ByteSource", "(", "path", ",", "bytes", ")", ",", "destZip", ")"...
Copies an existing ZIP file and appends it with one new entry. @param zip an existing ZIP file (only read). @param path new ZIP entry path. @param bytes new entry bytes (or <code>null</code> if directory). @param destZip new ZIP file created.
[ "Copies", "an", "existing", "ZIP", "file", "and", "appends", "it", "with", "one", "new", "entry", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2061-L2063
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.getLast
public static <T> T getLast(T[] array, T defaultValue) { return getElementAt(array, Math.max(0, nullSafeLength(array) - 1), defaultValue); }
java
public static <T> T getLast(T[] array, T defaultValue) { return getElementAt(array, Math.max(0, nullSafeLength(array) - 1), defaultValue); }
[ "public", "static", "<", "T", ">", "T", "getLast", "(", "T", "[", "]", "array", ",", "T", "defaultValue", ")", "{", "return", "getElementAt", "(", "array", ",", "Math", ".", "max", "(", "0", ",", "nullSafeLength", "(", "array", ")", "-", "1", ")", ...
Returns the last element (at index 0) in the {@code array}. @param <T> {@link Class} type of elements in the array. @param array array from which to extract the last element. @param defaultValue default value to return if the given array is {@literal null} or empty. @return the last element in the array or return the {@code defaultValue} if the {@code array} is {@literal null} or empty. @see #getElementAt(Object[], int, Object)
[ "Returns", "the", "last", "element", "(", "at", "index", "0", ")", "in", "the", "{", "@code", "array", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L497-L499
abel533/ECharts
src/main/java/com/github/abel533/echarts/series/Pie.java
Pie.radius
public Pie radius(Object width, Object height) { radius = new Object[]{width, height}; return this; }
java
public Pie radius(Object width, Object height) { radius = new Object[]{width, height}; return this; }
[ "public", "Pie", "radius", "(", "Object", "width", ",", "Object", "height", ")", "{", "radius", "=", "new", "Object", "[", "]", "{", "width", ",", "height", "}", ";", "return", "this", ";", "}" ]
半径,支持绝对值(px)和百分比,百分比计算比,min(width, height) / 2 * 75%, 传数组实现环形图,[内半径,外半径] @param width 内半径 @param height 外半径 @return
[ "半径,支持绝对值(px)和百分比,百分比计算比,min", "(", "width", "height", ")", "/", "2", "*", "75%,", "传数组实现环形图,", "[", "内半径,外半径", "]" ]
train
https://github.com/abel533/ECharts/blob/73e031e51b75e67480701404ccf16e76fd5aa278/src/main/java/com/github/abel533/echarts/series/Pie.java#L157-L160
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.addAlias
public String addAlias(String indice,String alias){ String aliasJson = new StringBuilder().append("{\"actions\": [{\"add\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString(); return this.client.executeHttp("_aliases",aliasJson,ClientUtil.HTTP_POST); }
java
public String addAlias(String indice,String alias){ String aliasJson = new StringBuilder().append("{\"actions\": [{\"add\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString(); return this.client.executeHttp("_aliases",aliasJson,ClientUtil.HTTP_POST); }
[ "public", "String", "addAlias", "(", "String", "indice", ",", "String", "alias", ")", "{", "String", "aliasJson", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"{\\\"actions\\\": [{\\\"add\\\": {\\\"index\\\":\\\"\"", ")", ".", "append", "(", "indic...
Associating the alias alias with index indice more detail see : https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html @param indice @param alias @return
[ "Associating", "the", "alias", "alias", "with", "index", "indice", "more", "detail", "see", ":", "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "indices", "-", ...
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L3500-L3503
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/core/encoding/impl/ImplConvertNV21.java
ImplConvertNV21.nv21ToGray
public static void nv21ToGray(byte[] dataNV, GrayU8 output) { final int yStride = output.width; // see if the whole thing can be copied as one big block to maximize speed if( yStride == output.width && !output.isSubimage() ) { System.arraycopy(dataNV,0,output.data,0,output.width*output.height); } else { //CONCURRENT_BELOW BoofConcurrency.loopFor(0, output.height, y -> { for( int y = 0; y < output.height; y++ ) { int indexOut = output.startIndex + y*output.stride; System.arraycopy(dataNV,y*yStride,output.data,indexOut,output.width); } //CONCURRENT_ABOVE }); } }
java
public static void nv21ToGray(byte[] dataNV, GrayU8 output) { final int yStride = output.width; // see if the whole thing can be copied as one big block to maximize speed if( yStride == output.width && !output.isSubimage() ) { System.arraycopy(dataNV,0,output.data,0,output.width*output.height); } else { //CONCURRENT_BELOW BoofConcurrency.loopFor(0, output.height, y -> { for( int y = 0; y < output.height; y++ ) { int indexOut = output.startIndex + y*output.stride; System.arraycopy(dataNV,y*yStride,output.data,indexOut,output.width); } //CONCURRENT_ABOVE }); } }
[ "public", "static", "void", "nv21ToGray", "(", "byte", "[", "]", "dataNV", ",", "GrayU8", "output", ")", "{", "final", "int", "yStride", "=", "output", ".", "width", ";", "// see if the whole thing can be copied as one big block to maximize speed", "if", "(", "yStri...
First block contains gray-scale information and UV data can be ignored.
[ "First", "block", "contains", "gray", "-", "scale", "information", "and", "UV", "data", "can", "be", "ignored", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/impl/ImplConvertNV21.java#L36-L52
alipay/sofa-rpc
extension-impl/metrics-lookout/src/main/java/com/alipay/sofa/rpc/metrics/lookout/RpcLookout.java
RpcLookout.recordSize
private void recordSize(MixinMetric mixinMetric, RpcClientLookoutModel model) { Long requestSize = model.getRequestSize(); Long responseSize = model.getResponseSize(); if (requestSize != null) { DistributionSummary requestSizeDS = mixinMetric.distributionSummary("request_size"); requestSizeDS.record(model.getRequestSize()); } if (responseSize != null) { DistributionSummary responseSizeDS = mixinMetric.distributionSummary("response_size"); responseSizeDS.record(model.getResponseSize()); } }
java
private void recordSize(MixinMetric mixinMetric, RpcClientLookoutModel model) { Long requestSize = model.getRequestSize(); Long responseSize = model.getResponseSize(); if (requestSize != null) { DistributionSummary requestSizeDS = mixinMetric.distributionSummary("request_size"); requestSizeDS.record(model.getRequestSize()); } if (responseSize != null) { DistributionSummary responseSizeDS = mixinMetric.distributionSummary("response_size"); responseSizeDS.record(model.getResponseSize()); } }
[ "private", "void", "recordSize", "(", "MixinMetric", "mixinMetric", ",", "RpcClientLookoutModel", "model", ")", "{", "Long", "requestSize", "=", "model", ".", "getRequestSize", "(", ")", ";", "Long", "responseSize", "=", "model", ".", "getResponseSize", "(", ")"...
Record request size and response size @param mixinMetric MixinMetric @param model information model
[ "Record", "request", "size", "and", "response", "size" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/metrics-lookout/src/main/java/com/alipay/sofa/rpc/metrics/lookout/RpcLookout.java#L190-L204
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java
BaseProfile.generatePackageInfo
void generatePackageInfo(Definition def, String outputDir, String subDir) { try { FileWriter fw; PackageInfoGen phGen; if (outputDir.equals("test")) { fw = Utils.createTestFile("package-info.java", def.getRaPackage(), def.getOutputDir()); phGen = new PackageInfoGen(); } else { if (subDir == null) { fw = Utils.createSrcFile("package-info.java", def.getRaPackage(), def.getOutputDir()); phGen = new PackageInfoGen(); } else { fw = Utils.createSrcFile("package-info.java", def.getRaPackage() + "." + subDir, def.getOutputDir()); phGen = new PackageInfoGen(subDir); } } phGen.generate(def, fw); fw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
void generatePackageInfo(Definition def, String outputDir, String subDir) { try { FileWriter fw; PackageInfoGen phGen; if (outputDir.equals("test")) { fw = Utils.createTestFile("package-info.java", def.getRaPackage(), def.getOutputDir()); phGen = new PackageInfoGen(); } else { if (subDir == null) { fw = Utils.createSrcFile("package-info.java", def.getRaPackage(), def.getOutputDir()); phGen = new PackageInfoGen(); } else { fw = Utils.createSrcFile("package-info.java", def.getRaPackage() + "." + subDir, def.getOutputDir()); phGen = new PackageInfoGen(subDir); } } phGen.generate(def, fw); fw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "void", "generatePackageInfo", "(", "Definition", "def", ",", "String", "outputDir", ",", "String", "subDir", ")", "{", "try", "{", "FileWriter", "fw", ";", "PackageInfoGen", "phGen", ";", "if", "(", "outputDir", ".", "equals", "(", "\"test\"", ")", ")", "...
generate package.html @param def Definition @param outputDir main or test @param subDir sub-directory
[ "generate", "package", ".", "html" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L545-L578
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java
AbstractFallbackRequestAndResponseControlDirContextProcessor.invokeMethod
protected Object invokeMethod(String method, Class<?> clazz, Object control) { Method actualMethod = ReflectionUtils.findMethod(clazz, method); return ReflectionUtils.invokeMethod(actualMethod, control); }
java
protected Object invokeMethod(String method, Class<?> clazz, Object control) { Method actualMethod = ReflectionUtils.findMethod(clazz, method); return ReflectionUtils.invokeMethod(actualMethod, control); }
[ "protected", "Object", "invokeMethod", "(", "String", "method", ",", "Class", "<", "?", ">", "clazz", ",", "Object", "control", ")", "{", "Method", "actualMethod", "=", "ReflectionUtils", ".", "findMethod", "(", "clazz", ",", "method", ")", ";", "return", ...
Utility method for invoking a method on a Control. @param method name of method to invoke @param clazz Class of the object that the method should be invoked on @param control Instance that the method should be invoked on @return the invocation result, if any
[ "Utility", "method", "for", "invoking", "a", "method", "on", "a", "Control", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java#L147-L150
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java
ConfigurationContext.getOrRegisterExtension
public ExtensionItemInfoImpl getOrRegisterExtension(final Class<?> extension, final boolean fromScan) { final ExtensionItemInfoImpl info; if (fromScan) { setScope(ConfigScope.ClasspathScan.getType()); info = register(ConfigItem.Extension, extension); closeScope(); } else { // info will be available for sure because such type was stored before (during manual registration) info = getInfo(extension); } return info; }
java
public ExtensionItemInfoImpl getOrRegisterExtension(final Class<?> extension, final boolean fromScan) { final ExtensionItemInfoImpl info; if (fromScan) { setScope(ConfigScope.ClasspathScan.getType()); info = register(ConfigItem.Extension, extension); closeScope(); } else { // info will be available for sure because such type was stored before (during manual registration) info = getInfo(extension); } return info; }
[ "public", "ExtensionItemInfoImpl", "getOrRegisterExtension", "(", "final", "Class", "<", "?", ">", "extension", ",", "final", "boolean", "fromScan", ")", "{", "final", "ExtensionItemInfoImpl", "info", ";", "if", "(", "fromScan", ")", "{", "setScope", "(", "Confi...
Extensions classpath scan requires testing with all installers to recognize actual extensions. To avoid duplicate installers recognition, extensions resolved by classpath scan are registered immediately. It's required because of not obvious method used for both manually registered extensions (to obtain container) and to create container from extensions from classpath scan. @param extension found extension @param fromScan true when called for extension found in classpath scan, false for manually registered extension @return extension info container
[ "Extensions", "classpath", "scan", "requires", "testing", "with", "all", "installers", "to", "recognize", "actual", "extensions", ".", "To", "avoid", "duplicate", "installers", "recognition", "extensions", "resolved", "by", "classpath", "scan", "are", "registered", ...
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L382-L394
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/CocoaPodsAnalyzer.java
CocoaPodsAnalyzer.determineEvidence
private String determineEvidence(String contents, String blockVariable, String fieldPattern) { String value = ""; //capture array value between [ ] final Matcher arrayMatcher = Pattern.compile( String.format("\\s*?%s\\.%s\\s*?=\\s*?\\{\\s*?(.*?)\\s*?\\}", blockVariable, fieldPattern), Pattern.CASE_INSENSITIVE).matcher(contents); if (arrayMatcher.find()) { value = arrayMatcher.group(1); } else { //capture single value between quotes final Matcher matcher = Pattern.compile( String.format("\\s*?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, fieldPattern), Pattern.CASE_INSENSITIVE).matcher(contents); if (matcher.find()) { value = matcher.group(2); } } return value; }
java
private String determineEvidence(String contents, String blockVariable, String fieldPattern) { String value = ""; //capture array value between [ ] final Matcher arrayMatcher = Pattern.compile( String.format("\\s*?%s\\.%s\\s*?=\\s*?\\{\\s*?(.*?)\\s*?\\}", blockVariable, fieldPattern), Pattern.CASE_INSENSITIVE).matcher(contents); if (arrayMatcher.find()) { value = arrayMatcher.group(1); } else { //capture single value between quotes final Matcher matcher = Pattern.compile( String.format("\\s*?%s\\.%s\\s*?=\\s*?(['\"])(.*?)\\1", blockVariable, fieldPattern), Pattern.CASE_INSENSITIVE).matcher(contents); if (matcher.find()) { value = matcher.group(2); } } return value; }
[ "private", "String", "determineEvidence", "(", "String", "contents", ",", "String", "blockVariable", ",", "String", "fieldPattern", ")", "{", "String", "value", "=", "\"\"", ";", "//capture array value between [ ]", "final", "Matcher", "arrayMatcher", "=", "Pattern", ...
Extracts evidence from the contents and adds it to the given evidence collection. @param contents the text to extract evidence from @param blockVariable the block variable within the content to search for @param fieldPattern the field pattern within the contents to search for @return the evidence
[ "Extracts", "evidence", "from", "the", "contents", "and", "adds", "it", "to", "the", "given", "evidence", "collection", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/CocoaPodsAnalyzer.java#L290-L308
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java
MultiTable.setHandle
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { if ((iHandleType == DBConstants.OBJECT_ID_HANDLE) || (iHandleType == DBConstants.BOOKMARK_HANDLE)) { BaseTable table = null; Object strTable = this.getInfoFromHandle(bookmark, true, iHandleType); Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { table = iterator.next(); if (strTable.equals(table.getRecord().getHandle(DBConstants.OBJECT_SOURCE_HANDLE))) break; } bookmark = this.getInfoFromHandle(bookmark, false, iHandleType); this.setCurrentTable(table); } else if (iHandleType == DBConstants.DATA_SOURCE_HANDLE) { BaseTable table = ((FullDataSource)bookmark).getTable(); bookmark = ((FullDataSource)bookmark).getDataSource(); this.setCurrentTable(table); } FieldList record = null; BaseTable table = this.getCurrentTable(); if (table != null) record = table.setHandle(bookmark, iHandleType); else record = null; this.syncCurrentToBase(); return record; }
java
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { if ((iHandleType == DBConstants.OBJECT_ID_HANDLE) || (iHandleType == DBConstants.BOOKMARK_HANDLE)) { BaseTable table = null; Object strTable = this.getInfoFromHandle(bookmark, true, iHandleType); Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { table = iterator.next(); if (strTable.equals(table.getRecord().getHandle(DBConstants.OBJECT_SOURCE_HANDLE))) break; } bookmark = this.getInfoFromHandle(bookmark, false, iHandleType); this.setCurrentTable(table); } else if (iHandleType == DBConstants.DATA_SOURCE_HANDLE) { BaseTable table = ((FullDataSource)bookmark).getTable(); bookmark = ((FullDataSource)bookmark).getDataSource(); this.setCurrentTable(table); } FieldList record = null; BaseTable table = this.getCurrentTable(); if (table != null) record = table.setHandle(bookmark, iHandleType); else record = null; this.syncCurrentToBase(); return record; }
[ "public", "FieldList", "setHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "if", "(", "(", "iHandleType", "==", "DBConstants", ".", "OBJECT_ID_HANDLE", ")", "||", "(", "iHandleType", "==", "DBConstants", ".", "...
Reposition to this record Using this bookmark. @exception DBException File exception.
[ "Reposition", "to", "this", "record", "Using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/MultiTable.java#L142-L172
jenkinsci/jenkins
core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java
DomainValidator.updateTLDOverride
public static synchronized void updateTLDOverride(DomainValidator.ArrayType table, String [] tlds) { if (inUse) { throw new IllegalStateException("Can only invoke this method before calling getInstance"); } String [] copy = new String[tlds.length]; // Comparisons are always done with lower-case entries for (int i = 0; i < tlds.length; i++) { copy[i] = tlds[i].toLowerCase(Locale.ENGLISH); } Arrays.sort(copy); switch(table) { case COUNTRY_CODE_MINUS: countryCodeTLDsMinus = copy; break; case COUNTRY_CODE_PLUS: countryCodeTLDsPlus = copy; break; case GENERIC_MINUS: genericTLDsMinus = copy; break; case GENERIC_PLUS: genericTLDsPlus = copy; break; case COUNTRY_CODE_RO: case GENERIC_RO: case INFRASTRUCTURE_RO: case LOCAL_RO: throw new IllegalArgumentException("Cannot update the table: " + table); default: throw new IllegalArgumentException("Unexpected enum value: " + table); } }
java
public static synchronized void updateTLDOverride(DomainValidator.ArrayType table, String [] tlds) { if (inUse) { throw new IllegalStateException("Can only invoke this method before calling getInstance"); } String [] copy = new String[tlds.length]; // Comparisons are always done with lower-case entries for (int i = 0; i < tlds.length; i++) { copy[i] = tlds[i].toLowerCase(Locale.ENGLISH); } Arrays.sort(copy); switch(table) { case COUNTRY_CODE_MINUS: countryCodeTLDsMinus = copy; break; case COUNTRY_CODE_PLUS: countryCodeTLDsPlus = copy; break; case GENERIC_MINUS: genericTLDsMinus = copy; break; case GENERIC_PLUS: genericTLDsPlus = copy; break; case COUNTRY_CODE_RO: case GENERIC_RO: case INFRASTRUCTURE_RO: case LOCAL_RO: throw new IllegalArgumentException("Cannot update the table: " + table); default: throw new IllegalArgumentException("Unexpected enum value: " + table); } }
[ "public", "static", "synchronized", "void", "updateTLDOverride", "(", "DomainValidator", ".", "ArrayType", "table", ",", "String", "[", "]", "tlds", ")", "{", "if", "(", "inUse", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can only invoke this metho...
Update one of the TLD override arrays. This must only be done at program startup, before any instances are accessed using getInstance. <p> For example: <p> {@code DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"apache"})} <p> To clear an override array, provide an empty array. @param table the table to update, see {@link DomainValidator.ArrayType} Must be one of the following <ul> <li>COUNTRY_CODE_MINUS</li> <li>COUNTRY_CODE_PLUS</li> <li>GENERIC_MINUS</li> <li>GENERIC_PLUS</li> </ul> @param tlds the array of TLDs, must not be null @throws IllegalStateException if the method is called after getInstance @throws IllegalArgumentException if one of the read-only tables is requested @since 1.5.0
[ "Update", "one", "of", "the", "TLD", "override", "arrays", ".", "This", "must", "only", "be", "done", "at", "program", "startup", "before", "any", "instances", "are", "accessed", "using", "getInstance", ".", "<p", ">", "For", "example", ":", "<p", ">", "...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/org/apache/commons/validator/routines/DomainValidator.java#L1922-L1953
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java
BioPAXIOHandlerAdapter.bindValue
protected void bindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model) { if (log.isDebugEnabled()) { log.debug("Binding: " + bpe + '(' + bpe.getModelInterface() + " has " + editor + ' ' + valueString); } Object value = (valueString==null)?null:valueString.trim(); if (editor instanceof ObjectPropertyEditor) { value = model.getByID(valueString); value = resourceFixes(bpe, value); if (value == null) { throw new IllegalBioPAXArgumentException( "Illegal or Dangling Value/Reference: " + valueString + " (element: " + bpe.getUri() + " property: " + editor.getProperty() + ")"); } } if (editor == null) { log.error("Editor is null. This probably means an invalid BioPAX property. Failed to set " + valueString); } else //is either EnumeratedPropertyEditor or DataPropertyEditor { editor.setValueToBean(value, bpe); } }
java
protected void bindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model) { if (log.isDebugEnabled()) { log.debug("Binding: " + bpe + '(' + bpe.getModelInterface() + " has " + editor + ' ' + valueString); } Object value = (valueString==null)?null:valueString.trim(); if (editor instanceof ObjectPropertyEditor) { value = model.getByID(valueString); value = resourceFixes(bpe, value); if (value == null) { throw new IllegalBioPAXArgumentException( "Illegal or Dangling Value/Reference: " + valueString + " (element: " + bpe.getUri() + " property: " + editor.getProperty() + ")"); } } if (editor == null) { log.error("Editor is null. This probably means an invalid BioPAX property. Failed to set " + valueString); } else //is either EnumeratedPropertyEditor or DataPropertyEditor { editor.setValueToBean(value, bpe); } }
[ "protected", "void", "bindValue", "(", "String", "valueString", ",", "PropertyEditor", "editor", ",", "BioPAXElement", "bpe", ",", "Model", "model", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Binding...
This method binds the value to the bpe. Actual assignment is handled by the editor - but this method performs most of the workarounds and also error handling due to invalid parameters. @param valueString to be assigned @param editor that maps to the property @param bpe to be bound @param model to be populated.
[ "This", "method", "binds", "the", "value", "to", "the", "bpe", ".", "Actual", "assignment", "is", "handled", "by", "the", "editor", "-", "but", "this", "method", "performs", "most", "of", "the", "workarounds", "and", "also", "error", "handling", "due", "to...
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java#L312-L339
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/auth/AuthInterface.java
AuthInterface.getAuthorizationUrl
public String getAuthorizationUrl(OAuth1RequestToken oAuthRequestToken, Permission permission) { OAuth10aService service = new ServiceBuilder(apiKey) .apiSecret(sharedSecret) .build(FlickrApi.instance()); String authorizationUrl = service.getAuthorizationUrl(oAuthRequestToken); return String.format("%s&perms=%s", authorizationUrl, permission.toString()); }
java
public String getAuthorizationUrl(OAuth1RequestToken oAuthRequestToken, Permission permission) { OAuth10aService service = new ServiceBuilder(apiKey) .apiSecret(sharedSecret) .build(FlickrApi.instance()); String authorizationUrl = service.getAuthorizationUrl(oAuthRequestToken); return String.format("%s&perms=%s", authorizationUrl, permission.toString()); }
[ "public", "String", "getAuthorizationUrl", "(", "OAuth1RequestToken", "oAuthRequestToken", ",", "Permission", "permission", ")", "{", "OAuth10aService", "service", "=", "new", "ServiceBuilder", "(", "apiKey", ")", ".", "apiSecret", "(", "sharedSecret", ")", ".", "bu...
Get the auth URL, this is step two of authorization. @param oAuthRequestToken the token from a {@link AuthInterface#getRequestToken} call.
[ "Get", "the", "auth", "URL", "this", "is", "step", "two", "of", "authorization", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/auth/AuthInterface.java#L109-L116
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/download/DownloadPanel.java
DownloadPanel.newFileNameLabel
protected Component newFileNameLabel(final String id, final IModel<String> model) { return ComponentFactory.newLabel(id, model); }
java
protected Component newFileNameLabel(final String id, final IModel<String> model) { return ComponentFactory.newLabel(id, model); }
[ "protected", "Component", "newFileNameLabel", "(", "final", "String", "id", ",", "final", "IModel", "<", "String", ">", "model", ")", "{", "return", "ComponentFactory", ".", "newLabel", "(", "id", ",", "model", ")", ";", "}" ]
Factory method for creating the new {@link Label} for the file name. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Label} for the file name. @param id the id @param model the model @return the new {@link Label} for the file name
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Label", "}", "for", "the", "file", "name", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so",...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/download/DownloadPanel.java#L145-L148
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToLong
public static final long bytesToLong( byte[] data, int[] offset ) { long result = 0; for( int i = 0; i < SIZE_LONG; ++i ) { result <<= 8; int res = byteToUnsignedInt(data[offset[0]++]); result = result | res; } return result; }
java
public static final long bytesToLong( byte[] data, int[] offset ) { long result = 0; for( int i = 0; i < SIZE_LONG; ++i ) { result <<= 8; int res = byteToUnsignedInt(data[offset[0]++]); result = result | res; } return result; }
[ "public", "static", "final", "long", "bytesToLong", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "long", "result", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "SIZE_LONG", ";", "++", "i", ")", "{"...
Return the <code>long</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>long</code> decoded
[ "Return", "the", "<code", ">", "long<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L162-L173
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls, RequestOptions requestOptions) throws AlgoliaException { return updateApiKey(key, acls, 0, 0, 0, null, requestOptions); }
java
public JSONObject updateApiKey(String key, List<String> acls, RequestOptions requestOptions) throws AlgoliaException { return updateApiKey(key, acls, 0, 0, 0, null, requestOptions); }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "return", "updateApiKey", "(", "key", ",", "acls", ",", "0", ",", "0", ","...
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only) @param requestOptions Options to pass to this request
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L752-L754
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.getProjectsViaSudoWithPagination
public List<GitlabProject> getProjectsViaSudoWithPagination(GitlabUser user, int page, int perPage) throws IOException { Pagination pagination = new Pagination() .withPage(page) .withPerPage(perPage); return getProjectsViaSudoWithPagination(user, pagination); }
java
public List<GitlabProject> getProjectsViaSudoWithPagination(GitlabUser user, int page, int perPage) throws IOException { Pagination pagination = new Pagination() .withPage(page) .withPerPage(perPage); return getProjectsViaSudoWithPagination(user, pagination); }
[ "public", "List", "<", "GitlabProject", ">", "getProjectsViaSudoWithPagination", "(", "GitlabUser", "user", ",", "int", "page", ",", "int", "perPage", ")", "throws", "IOException", "{", "Pagination", "pagination", "=", "new", "Pagination", "(", ")", ".", "withPa...
Get a list of projects of perPage elements accessible by the authenticated user given page offset @param user Gitlab User to invoke sudo with @param page Page offset @param perPage Number of elements to get after page offset @return A list of gitlab projects @throws IOException Gitlab API call error
[ "Get", "a", "list", "of", "projects", "of", "perPage", "elements", "accessible", "by", "the", "authenticated", "user", "given", "page", "offset" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L926-L931
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthAPI.java
AuthAPI.resetPassword
public Request resetPassword(String email, String connection) { Asserts.assertNotNull(email, "email"); Asserts.assertNotNull(connection, "connection"); String url = baseUrl .newBuilder() .addPathSegment(PATH_DBCONNECTIONS) .addPathSegment("change_password") .build() .toString(); VoidRequest request = new VoidRequest(client, url, "POST"); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_EMAIL, email); request.addParameter(KEY_CONNECTION, connection); return request; }
java
public Request resetPassword(String email, String connection) { Asserts.assertNotNull(email, "email"); Asserts.assertNotNull(connection, "connection"); String url = baseUrl .newBuilder() .addPathSegment(PATH_DBCONNECTIONS) .addPathSegment("change_password") .build() .toString(); VoidRequest request = new VoidRequest(client, url, "POST"); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_EMAIL, email); request.addParameter(KEY_CONNECTION, connection); return request; }
[ "public", "Request", "resetPassword", "(", "String", "email", ",", "String", "connection", ")", "{", "Asserts", ".", "assertNotNull", "(", "email", ",", "\"email\"", ")", ";", "Asserts", ".", "assertNotNull", "(", "connection", ",", "\"connection\"", ")", ";",...
Request a password reset for the given email and database connection. The response will always be successful even if there's no user associated to the given email for that database connection. i.e.: <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { auth.resetPassword("me@auth0.com", "db-connection").execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param email the email associated to the database user. @param connection the database connection where the user was created. @return a Request to execute.
[ "Request", "a", "password", "reset", "for", "the", "given", "email", "and", "database", "connection", ".", "The", "response", "will", "always", "be", "successful", "even", "if", "there", "s", "no", "user", "associated", "to", "the", "given", "email", "for", ...
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L210-L225
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotation
public static <A extends Annotation> A findAnnotation(final AnnotatedElement source, final Class<A> targetAnnotationClass) { Objects.requireNonNull(source, "incoming 'source' is not valid"); Objects.requireNonNull(targetAnnotationClass, "incoming 'targetAnnotationClass' is not valid"); final A result = source.getAnnotation(targetAnnotationClass); if (result != null) return result; return findAnnotationInAnnotations(source, targetAnnotationClass); }
java
public static <A extends Annotation> A findAnnotation(final AnnotatedElement source, final Class<A> targetAnnotationClass) { Objects.requireNonNull(source, "incoming 'source' is not valid"); Objects.requireNonNull(targetAnnotationClass, "incoming 'targetAnnotationClass' is not valid"); final A result = source.getAnnotation(targetAnnotationClass); if (result != null) return result; return findAnnotationInAnnotations(source, targetAnnotationClass); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "findAnnotation", "(", "final", "AnnotatedElement", "source", ",", "final", "Class", "<", "A", ">", "targetAnnotationClass", ")", "{", "Objects", ".", "requireNonNull", "(", "source", ",", "\"inc...
Deep search of specified annotation considering "annotation as meta annotation" case (annotation annotated with specified annotation). @param source specified annotated element @param targetAnnotationClass specified annotation class @param <A> the type of the annotation to query for and return if present @return specified element's annotation for the specified annotation type if deeply present on this element, else null
[ "Deep", "search", "of", "specified", "annotation", "considering", "annotation", "as", "meta", "annotation", "case", "(", "annotation", "annotated", "with", "specified", "annotation", ")", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java#L32-L41
Metatavu/paytrail-rest-api-sdk
src/main/java/fi/metatavu/paytrail/PaytrailService.java
PaytrailService.confirmPayment
public boolean confirmPayment(String orderNumber, String timestamp, String paid, String method, String authCode) { String base = new StringBuilder() .append(orderNumber) .append('|') .append(timestamp) .append('|') .append(paid) .append('|') .append(method) .append('|') .append(merchantSecret) .toString(); return StringUtils.equals( StringUtils.upperCase(DigestUtils.md5Hex(base)), authCode ); }
java
public boolean confirmPayment(String orderNumber, String timestamp, String paid, String method, String authCode) { String base = new StringBuilder() .append(orderNumber) .append('|') .append(timestamp) .append('|') .append(paid) .append('|') .append(method) .append('|') .append(merchantSecret) .toString(); return StringUtils.equals( StringUtils.upperCase(DigestUtils.md5Hex(base)), authCode ); }
[ "public", "boolean", "confirmPayment", "(", "String", "orderNumber", ",", "String", "timestamp", ",", "String", "paid", ",", "String", "method", ",", "String", "authCode", ")", "{", "String", "base", "=", "new", "StringBuilder", "(", ")", ".", "append", "(",...
This function can be used to validate parameters returned by return and notify requests. Parameters must be validated in order to avoid hacking of payment confirmation.
[ "This", "function", "can", "be", "used", "to", "validate", "parameters", "returned", "by", "return", "and", "notify", "requests", ".", "Parameters", "must", "be", "validated", "in", "order", "to", "avoid", "hacking", "of", "payment", "confirmation", "." ]
train
https://github.com/Metatavu/paytrail-rest-api-sdk/blob/16fb16f89dae3523e836ac4ef0ab5dc0f96e9f05/src/main/java/fi/metatavu/paytrail/PaytrailService.java#L93-L111
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java
Utility.getId
public static int getId(Context context, String id, String defType) { String type = "R." + defType + "."; if (id.startsWith(type)) { id = id.substring(type.length()); } Resources r = context.getResources(); int resId = r.getIdentifier(id, defType, context.getPackageName()); if (resId > 0) { return resId; } else { throw new RuntimeAssertion("Specified resource '%s' could not be found", id); } }
java
public static int getId(Context context, String id, String defType) { String type = "R." + defType + "."; if (id.startsWith(type)) { id = id.substring(type.length()); } Resources r = context.getResources(); int resId = r.getIdentifier(id, defType, context.getPackageName()); if (resId > 0) { return resId; } else { throw new RuntimeAssertion("Specified resource '%s' could not be found", id); } }
[ "public", "static", "int", "getId", "(", "Context", "context", ",", "String", "id", ",", "String", "defType", ")", "{", "String", "type", "=", "\"R.\"", "+", "defType", "+", "\".\"", ";", "if", "(", "id", ".", "startsWith", "(", "type", ")", ")", "{"...
Get the int resource id with specified type definition @param context @param id String resource id @return int resource id
[ "Get", "the", "int", "resource", "id", "with", "specified", "type", "definition" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/Utility.java#L119-L133