repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java
GraphBackedTypeStore.createVertices
private List<AtlasVertex> createVertices(List<TypeVertexInfo> infoList) throws AtlasException { """ Finds or creates type vertices with the information specified. @param infoList @return list with the vertices corresponding to the types in the list. @throws AtlasException """ List<AtlasVertex> result = new ArrayList<>(infoList.size()); List<String> typeNames = Lists.transform(infoList, new Function<TypeVertexInfo,String>() { @Override public String apply(TypeVertexInfo input) { return input.getTypeName(); } }); Map<String, AtlasVertex> vertices = findVertices(typeNames); for(TypeVertexInfo info : infoList) { AtlasVertex vertex = vertices.get(info.getTypeName()); if (! GraphHelper.elementExists(vertex)) { LOG.debug("Adding vertex {}{}", PROPERTY_PREFIX, info.getTypeName()); vertex = graph.addVertex(); setProperty(vertex, Constants.VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE); // Mark as type AtlasVertex setProperty(vertex, Constants.TYPE_CATEGORY_PROPERTY_KEY, info.getCategory()); setProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, info.getTypeName()); } String newDescription = info.getTypeDescription(); if (newDescription != null) { String oldDescription = getPropertyKey(Constants.TYPEDESCRIPTION_PROPERTY_KEY); if (!newDescription.equals(oldDescription)) { setProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, newDescription); } } else { LOG.debug(" type description is null "); } result.add(vertex); } return result; }
java
private List<AtlasVertex> createVertices(List<TypeVertexInfo> infoList) throws AtlasException { List<AtlasVertex> result = new ArrayList<>(infoList.size()); List<String> typeNames = Lists.transform(infoList, new Function<TypeVertexInfo,String>() { @Override public String apply(TypeVertexInfo input) { return input.getTypeName(); } }); Map<String, AtlasVertex> vertices = findVertices(typeNames); for(TypeVertexInfo info : infoList) { AtlasVertex vertex = vertices.get(info.getTypeName()); if (! GraphHelper.elementExists(vertex)) { LOG.debug("Adding vertex {}{}", PROPERTY_PREFIX, info.getTypeName()); vertex = graph.addVertex(); setProperty(vertex, Constants.VERTEX_TYPE_PROPERTY_KEY, VERTEX_TYPE); // Mark as type AtlasVertex setProperty(vertex, Constants.TYPE_CATEGORY_PROPERTY_KEY, info.getCategory()); setProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, info.getTypeName()); } String newDescription = info.getTypeDescription(); if (newDescription != null) { String oldDescription = getPropertyKey(Constants.TYPEDESCRIPTION_PROPERTY_KEY); if (!newDescription.equals(oldDescription)) { setProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, newDescription); } } else { LOG.debug(" type description is null "); } result.add(vertex); } return result; }
[ "private", "List", "<", "AtlasVertex", ">", "createVertices", "(", "List", "<", "TypeVertexInfo", ">", "infoList", ")", "throws", "AtlasException", "{", "List", "<", "AtlasVertex", ">", "result", "=", "new", "ArrayList", "<>", "(", "infoList", ".", "size", "(", ")", ")", ";", "List", "<", "String", ">", "typeNames", "=", "Lists", ".", "transform", "(", "infoList", ",", "new", "Function", "<", "TypeVertexInfo", ",", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "apply", "(", "TypeVertexInfo", "input", ")", "{", "return", "input", ".", "getTypeName", "(", ")", ";", "}", "}", ")", ";", "Map", "<", "String", ",", "AtlasVertex", ">", "vertices", "=", "findVertices", "(", "typeNames", ")", ";", "for", "(", "TypeVertexInfo", "info", ":", "infoList", ")", "{", "AtlasVertex", "vertex", "=", "vertices", ".", "get", "(", "info", ".", "getTypeName", "(", ")", ")", ";", "if", "(", "!", "GraphHelper", ".", "elementExists", "(", "vertex", ")", ")", "{", "LOG", ".", "debug", "(", "\"Adding vertex {}{}\"", ",", "PROPERTY_PREFIX", ",", "info", ".", "getTypeName", "(", ")", ")", ";", "vertex", "=", "graph", ".", "addVertex", "(", ")", ";", "setProperty", "(", "vertex", ",", "Constants", ".", "VERTEX_TYPE_PROPERTY_KEY", ",", "VERTEX_TYPE", ")", ";", "// Mark as type AtlasVertex", "setProperty", "(", "vertex", ",", "Constants", ".", "TYPE_CATEGORY_PROPERTY_KEY", ",", "info", ".", "getCategory", "(", ")", ")", ";", "setProperty", "(", "vertex", ",", "Constants", ".", "TYPENAME_PROPERTY_KEY", ",", "info", ".", "getTypeName", "(", ")", ")", ";", "}", "String", "newDescription", "=", "info", ".", "getTypeDescription", "(", ")", ";", "if", "(", "newDescription", "!=", "null", ")", "{", "String", "oldDescription", "=", "getPropertyKey", "(", "Constants", ".", "TYPEDESCRIPTION_PROPERTY_KEY", ")", ";", "if", "(", "!", "newDescription", ".", "equals", "(", "oldDescription", ")", ")", "{", "setProperty", "(", "vertex", ",", "Constants", ".", "TYPEDESCRIPTION_PROPERTY_KEY", ",", "newDescription", ")", ";", "}", "}", "else", "{", "LOG", ".", "debug", "(", "\" type description is null \"", ")", ";", "}", "result", ".", "add", "(", "vertex", ")", ";", "}", "return", "result", ";", "}" ]
Finds or creates type vertices with the information specified. @param infoList @return list with the vertices corresponding to the types in the list. @throws AtlasException
[ "Finds", "or", "creates", "type", "vertices", "with", "the", "information", "specified", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/typestore/GraphBackedTypeStore.java#L361-L393
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.putAt
public static void putAt(DefaultListModel self, int index, Object e) { """ Allow DefaultListModel to work with subscript operators.<p> <b>WARNING:</b> this operation does not replace the element at the specified index, rather it inserts the element at that index, thus increasing the size of of the model by 1. @param self a DefaultListModel @param index an index @param e the element to insert at the given index @since 1.6.4 """ self.set(index, e); }
java
public static void putAt(DefaultListModel self, int index, Object e) { self.set(index, e); }
[ "public", "static", "void", "putAt", "(", "DefaultListModel", "self", ",", "int", "index", ",", "Object", "e", ")", "{", "self", ".", "set", "(", "index", ",", "e", ")", ";", "}" ]
Allow DefaultListModel to work with subscript operators.<p> <b>WARNING:</b> this operation does not replace the element at the specified index, rather it inserts the element at that index, thus increasing the size of of the model by 1. @param self a DefaultListModel @param index an index @param e the element to insert at the given index @since 1.6.4
[ "Allow", "DefaultListModel", "to", "work", "with", "subscript", "operators", ".", "<p", ">", "<b", ">", "WARNING", ":", "<", "/", "b", ">", "this", "operation", "does", "not", "replace", "the", "element", "at", "the", "specified", "index", "rather", "it", "inserts", "the", "element", "at", "that", "index", "thus", "increasing", "the", "size", "of", "of", "the", "model", "by", "1", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L230-L232
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.getFullPathName
private static String getFullPathName(INode[] inodes, int pos) { """ Return the name of the path represented by inodes at [0, pos] """ StringBuilder fullPathName = new StringBuilder(); for (int i=1; i<=pos; i++) { fullPathName.append(Path.SEPARATOR_CHAR).append(inodes[i].getLocalName()); } return fullPathName.toString(); }
java
private static String getFullPathName(INode[] inodes, int pos) { StringBuilder fullPathName = new StringBuilder(); for (int i=1; i<=pos; i++) { fullPathName.append(Path.SEPARATOR_CHAR).append(inodes[i].getLocalName()); } return fullPathName.toString(); }
[ "private", "static", "String", "getFullPathName", "(", "INode", "[", "]", "inodes", ",", "int", "pos", ")", "{", "StringBuilder", "fullPathName", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "pos", ";", "i", "++", ")", "{", "fullPathName", ".", "append", "(", "Path", ".", "SEPARATOR_CHAR", ")", ".", "append", "(", "inodes", "[", "i", "]", ".", "getLocalName", "(", ")", ")", ";", "}", "return", "fullPathName", ".", "toString", "(", ")", ";", "}" ]
Return the name of the path represented by inodes at [0, pos]
[ "Return", "the", "name", "of", "the", "path", "represented", "by", "inodes", "at", "[", "0", "pos", "]" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2184-L2190
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/BitStrings.java
BitStrings.andWith
public static String andWith(final String str, final String boolString) { """ 将一个字符串,按照boolString的形式进行变化. 如果boolString[i]!=0则保留str[i],否则置0 @param str a {@link java.lang.String} object. @param boolString a {@link java.lang.String} object. @return a {@link java.lang.String} object. """ if (Strings.isEmpty(str)) { return null; } if (Strings.isEmpty(boolString)) { return str; } if (str.length() < boolString.length()) { return str; } final StringBuilder buffer = new StringBuilder(str); for (int i = 0; i < buffer.length(); i++) { if (boolString.charAt(i) == '0') { buffer.setCharAt(i, '0'); } } return buffer.toString(); }
java
public static String andWith(final String str, final String boolString) { if (Strings.isEmpty(str)) { return null; } if (Strings.isEmpty(boolString)) { return str; } if (str.length() < boolString.length()) { return str; } final StringBuilder buffer = new StringBuilder(str); for (int i = 0; i < buffer.length(); i++) { if (boolString.charAt(i) == '0') { buffer.setCharAt(i, '0'); } } return buffer.toString(); }
[ "public", "static", "String", "andWith", "(", "final", "String", "str", ",", "final", "String", "boolString", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "null", ";", "}", "if", "(", "Strings", ".", "isEmpty", "(", "boolString", ")", ")", "{", "return", "str", ";", "}", "if", "(", "str", ".", "length", "(", ")", "<", "boolString", ".", "length", "(", ")", ")", "{", "return", "str", ";", "}", "final", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "str", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buffer", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "boolString", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "{", "buffer", ".", "setCharAt", "(", "i", ",", "'", "'", ")", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
将一个字符串,按照boolString的形式进行变化. 如果boolString[i]!=0则保留str[i],否则置0 @param str a {@link java.lang.String} object. @param boolString a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "将一个字符串,按照boolString的形式进行变化", ".", "如果boolString", "[", "i", "]", "!", "=", "0则保留str", "[", "i", "]", "否则置0" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/BitStrings.java#L80-L91
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/file/JavacFileManager.java
JavacFileManager.openArchive
protected Archive openArchive(File zipFilename) throws IOException { """ /* This method looks for a ZipFormatException and takes appropriate evasive action. If there is a failure in the fast mode then we fail over to the platform zip, and allow it to deal with a potentially non compliant zip file. """ try { return openArchive(zipFilename, contextUseOptimizedZip); } catch (IOException ioe) { if (ioe instanceof ZipFileIndex.ZipFormatException) { return openArchive(zipFilename, false); } else { throw ioe; } } }
java
protected Archive openArchive(File zipFilename) throws IOException { try { return openArchive(zipFilename, contextUseOptimizedZip); } catch (IOException ioe) { if (ioe instanceof ZipFileIndex.ZipFormatException) { return openArchive(zipFilename, false); } else { throw ioe; } } }
[ "protected", "Archive", "openArchive", "(", "File", "zipFilename", ")", "throws", "IOException", "{", "try", "{", "return", "openArchive", "(", "zipFilename", ",", "contextUseOptimizedZip", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "if", "(", "ioe", "instanceof", "ZipFileIndex", ".", "ZipFormatException", ")", "{", "return", "openArchive", "(", "zipFilename", ",", "false", ")", ";", "}", "else", "{", "throw", "ioe", ";", "}", "}", "}" ]
/* This method looks for a ZipFormatException and takes appropriate evasive action. If there is a failure in the fast mode then we fail over to the platform zip, and allow it to deal with a potentially non compliant zip file.
[ "/", "*", "This", "method", "looks", "for", "a", "ZipFormatException", "and", "takes", "appropriate", "evasive", "action", ".", "If", "there", "is", "a", "failure", "in", "the", "fast", "mode", "then", "we", "fail", "over", "to", "the", "platform", "zip", "and", "allow", "it", "to", "deal", "with", "a", "potentially", "non", "compliant", "zip", "file", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L460-L470
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.beginCreateOrUpdateAsync
public Observable<VirtualNetworkRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { """ Creates or updates an existing virtual network rule. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param virtualNetworkRuleName The name of the virtual network rule. @param parameters The requested virtual Network Rule Resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkRuleInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "virtualNetworkRuleName", ",", "VirtualNetworkRuleInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "virtualNetworkRuleName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkRuleInner", ">", ",", "VirtualNetworkRuleInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkRuleInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkRuleInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an existing virtual network rule. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param virtualNetworkRuleName The name of the virtual network rule. @param parameters The requested virtual Network Rule Resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object
[ "Creates", "or", "updates", "an", "existing", "virtual", "network", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java#L312-L319
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findIndexValues
public static List<Number> findIndexValues(Object self, Closure condition) { """ Iterates over the elements of an aggregate of items and returns the index values of the items that match the condition specified in the closure. @param self the iteration object over which to iterate @param condition the matching condition @return a list of numbers corresponding to the index values of all matched objects @since 1.5.2 """ return findIndexValues(self, 0, condition); }
java
public static List<Number> findIndexValues(Object self, Closure condition) { return findIndexValues(self, 0, condition); }
[ "public", "static", "List", "<", "Number", ">", "findIndexValues", "(", "Object", "self", ",", "Closure", "condition", ")", "{", "return", "findIndexValues", "(", "self", ",", "0", ",", "condition", ")", ";", "}" ]
Iterates over the elements of an aggregate of items and returns the index values of the items that match the condition specified in the closure. @param self the iteration object over which to iterate @param condition the matching condition @return a list of numbers corresponding to the index values of all matched objects @since 1.5.2
[ "Iterates", "over", "the", "elements", "of", "an", "aggregate", "of", "items", "and", "returns", "the", "index", "values", "of", "the", "items", "that", "match", "the", "condition", "specified", "in", "the", "closure", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16944-L16946
NessComputing/components-ness-config
src/main/java/com/nesscomputing/config/Config.java
Config.getConfig
public static Config getConfig(@Nonnull final URI configLocation, @Nullable final String configName) { """ Load Configuration, using the supplied URI as base. The loaded configuration can be overridden using system properties. """ final ConfigFactory configFactory = new ConfigFactory(configLocation, configName); return new Config(configFactory.load()); }
java
public static Config getConfig(@Nonnull final URI configLocation, @Nullable final String configName) { final ConfigFactory configFactory = new ConfigFactory(configLocation, configName); return new Config(configFactory.load()); }
[ "public", "static", "Config", "getConfig", "(", "@", "Nonnull", "final", "URI", "configLocation", ",", "@", "Nullable", "final", "String", "configName", ")", "{", "final", "ConfigFactory", "configFactory", "=", "new", "ConfigFactory", "(", "configLocation", ",", "configName", ")", ";", "return", "new", "Config", "(", "configFactory", ".", "load", "(", ")", ")", ";", "}" ]
Load Configuration, using the supplied URI as base. The loaded configuration can be overridden using system properties.
[ "Load", "Configuration", "using", "the", "supplied", "URI", "as", "base", ".", "The", "loaded", "configuration", "can", "be", "overridden", "using", "system", "properties", "." ]
train
https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L157-L161
thymeleaf/thymeleaf-spring
thymeleaf-spring4/src/main/java/org/thymeleaf/spring4/expression/SPELContextPropertyAccessor.java
SPELContextPropertyAccessor.checkExecInfo
@Deprecated static Object checkExecInfo(final String propertyName, final EvaluationContext context) { """ Translation from 'execInfo' context variable (${execInfo}) to 'execInfo' expression object (${#execInfo}), needed since 3.0.0. Note this is expressed as a separate method in order to mark this as deprecated and make it easily locatable. @param propertyName the name of the property being accessed (we are looking for 'execInfo'). @param context the expression context, which should contain the expression objects. @deprecated created (and deprecated) in 3.0.0 in order to support automatic conversion of calls to the 'execInfo' context variable (${execInfo}) into the 'execInfo' expression object (${#execInfo}), which is its new only valid form. This method, along with the infrastructure for execInfo conversion in StandardExpressionUtils#mightNeedExpressionObjects(...) will be removed in 3.1. """ if ("execInfo".equals(propertyName)) { if (!(context instanceof IThymeleafEvaluationContext)) { throw new TemplateProcessingException( "Found Thymeleaf Standard Expression containing a call to the context variable " + "\"execInfo\" (e.g. \"${execInfo.templateName}\"), which has been deprecated. The " + "Execution Info should be now accessed as an expression object instead " + "(e.g. \"${#execInfo.templateName}\"). Deprecated use is still allowed (will be removed " + "in future versions of Thymeleaf) when the SpringEL EvaluationContext implements the " + IThymeleafEvaluationContext.class + " interface, but the current evaluation context of " + "class " + context.getClass().getName() + " DOES NOT implement such interface."); } LOGGER.warn( "[THYMELEAF][{}] Found Thymeleaf Standard Expression containing a call to the context variable " + "\"execInfo\" (e.g. \"${execInfo.templateName}\"), which has been deprecated. The " + "Execution Info should be now accessed as an expression object instead " + "(e.g. \"${#execInfo.templateName}\"). Deprecated use is still allowed, but will be removed " + "in future versions of Thymeleaf.", TemplateEngine.threadIndex()); return ((IThymeleafEvaluationContext)context).getExpressionObjects().getObject("execInfo"); } return null; }
java
@Deprecated static Object checkExecInfo(final String propertyName, final EvaluationContext context) { if ("execInfo".equals(propertyName)) { if (!(context instanceof IThymeleafEvaluationContext)) { throw new TemplateProcessingException( "Found Thymeleaf Standard Expression containing a call to the context variable " + "\"execInfo\" (e.g. \"${execInfo.templateName}\"), which has been deprecated. The " + "Execution Info should be now accessed as an expression object instead " + "(e.g. \"${#execInfo.templateName}\"). Deprecated use is still allowed (will be removed " + "in future versions of Thymeleaf) when the SpringEL EvaluationContext implements the " + IThymeleafEvaluationContext.class + " interface, but the current evaluation context of " + "class " + context.getClass().getName() + " DOES NOT implement such interface."); } LOGGER.warn( "[THYMELEAF][{}] Found Thymeleaf Standard Expression containing a call to the context variable " + "\"execInfo\" (e.g. \"${execInfo.templateName}\"), which has been deprecated. The " + "Execution Info should be now accessed as an expression object instead " + "(e.g. \"${#execInfo.templateName}\"). Deprecated use is still allowed, but will be removed " + "in future versions of Thymeleaf.", TemplateEngine.threadIndex()); return ((IThymeleafEvaluationContext)context).getExpressionObjects().getObject("execInfo"); } return null; }
[ "@", "Deprecated", "static", "Object", "checkExecInfo", "(", "final", "String", "propertyName", ",", "final", "EvaluationContext", "context", ")", "{", "if", "(", "\"execInfo\"", ".", "equals", "(", "propertyName", ")", ")", "{", "if", "(", "!", "(", "context", "instanceof", "IThymeleafEvaluationContext", ")", ")", "{", "throw", "new", "TemplateProcessingException", "(", "\"Found Thymeleaf Standard Expression containing a call to the context variable \"", "+", "\"\\\"execInfo\\\" (e.g. \\\"${execInfo.templateName}\\\"), which has been deprecated. The \"", "+", "\"Execution Info should be now accessed as an expression object instead \"", "+", "\"(e.g. \\\"${#execInfo.templateName}\\\"). Deprecated use is still allowed (will be removed \"", "+", "\"in future versions of Thymeleaf) when the SpringEL EvaluationContext implements the \"", "+", "IThymeleafEvaluationContext", ".", "class", "+", "\" interface, but the current evaluation context of \"", "+", "\"class \"", "+", "context", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" DOES NOT implement such interface.\"", ")", ";", "}", "LOGGER", ".", "warn", "(", "\"[THYMELEAF][{}] Found Thymeleaf Standard Expression containing a call to the context variable \"", "+", "\"\\\"execInfo\\\" (e.g. \\\"${execInfo.templateName}\\\"), which has been deprecated. The \"", "+", "\"Execution Info should be now accessed as an expression object instead \"", "+", "\"(e.g. \\\"${#execInfo.templateName}\\\"). Deprecated use is still allowed, but will be removed \"", "+", "\"in future versions of Thymeleaf.\"", ",", "TemplateEngine", ".", "threadIndex", "(", ")", ")", ";", "return", "(", "(", "IThymeleafEvaluationContext", ")", "context", ")", ".", "getExpressionObjects", "(", ")", ".", "getObject", "(", "\"execInfo\"", ")", ";", "}", "return", "null", ";", "}" ]
Translation from 'execInfo' context variable (${execInfo}) to 'execInfo' expression object (${#execInfo}), needed since 3.0.0. Note this is expressed as a separate method in order to mark this as deprecated and make it easily locatable. @param propertyName the name of the property being accessed (we are looking for 'execInfo'). @param context the expression context, which should contain the expression objects. @deprecated created (and deprecated) in 3.0.0 in order to support automatic conversion of calls to the 'execInfo' context variable (${execInfo}) into the 'execInfo' expression object (${#execInfo}), which is its new only valid form. This method, along with the infrastructure for execInfo conversion in StandardExpressionUtils#mightNeedExpressionObjects(...) will be removed in 3.1.
[ "Translation", "from", "execInfo", "context", "variable", "(", "$", "{", "execInfo", "}", ")", "to", "execInfo", "expression", "object", "(", "$", "{", "#execInfo", "}", ")", "needed", "since", "3", ".", "0", ".", "0", "." ]
train
https://github.com/thymeleaf/thymeleaf-spring/blob/9aa15a19017a0938e57646e3deefb8a90ab78dcb/thymeleaf-spring4/src/main/java/org/thymeleaf/spring4/expression/SPELContextPropertyAccessor.java#L144-L167
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java
ThemeSwitcher.setTheme
static void setTheme(Context context, AttributeSet attrs) { """ Called in onCreate() to check the UI Mode (day or night) and set the theme colors accordingly. @param context {@link NavigationView} where the theme will be set @param attrs holding custom styles if any are set """ boolean nightModeEnabled = isNightModeEnabled(context); if (shouldSetThemeFromPreferences(context)) { int prefLightTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_LIGHT_THEME); int prefDarkTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_DARK_THEME); prefLightTheme = prefLightTheme == 0 ? R.style.NavigationViewLight : prefLightTheme; prefDarkTheme = prefLightTheme == 0 ? R.style.NavigationViewDark : prefDarkTheme; context.setTheme(nightModeEnabled ? prefDarkTheme : prefLightTheme); return; } TypedArray styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.NavigationView); int lightTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationLightTheme, R.style.NavigationViewLight); int darkTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationDarkTheme, R.style.NavigationViewDark); styledAttributes.recycle(); context.setTheme(nightModeEnabled ? darkTheme : lightTheme); }
java
static void setTheme(Context context, AttributeSet attrs) { boolean nightModeEnabled = isNightModeEnabled(context); if (shouldSetThemeFromPreferences(context)) { int prefLightTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_LIGHT_THEME); int prefDarkTheme = retrieveThemeResIdFromPreferences(context, NavigationConstants.NAVIGATION_VIEW_DARK_THEME); prefLightTheme = prefLightTheme == 0 ? R.style.NavigationViewLight : prefLightTheme; prefDarkTheme = prefLightTheme == 0 ? R.style.NavigationViewDark : prefDarkTheme; context.setTheme(nightModeEnabled ? prefDarkTheme : prefLightTheme); return; } TypedArray styledAttributes = context.obtainStyledAttributes(attrs, R.styleable.NavigationView); int lightTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationLightTheme, R.style.NavigationViewLight); int darkTheme = styledAttributes.getResourceId(R.styleable.NavigationView_navigationDarkTheme, R.style.NavigationViewDark); styledAttributes.recycle(); context.setTheme(nightModeEnabled ? darkTheme : lightTheme); }
[ "static", "void", "setTheme", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "boolean", "nightModeEnabled", "=", "isNightModeEnabled", "(", "context", ")", ";", "if", "(", "shouldSetThemeFromPreferences", "(", "context", ")", ")", "{", "int", "prefLightTheme", "=", "retrieveThemeResIdFromPreferences", "(", "context", ",", "NavigationConstants", ".", "NAVIGATION_VIEW_LIGHT_THEME", ")", ";", "int", "prefDarkTheme", "=", "retrieveThemeResIdFromPreferences", "(", "context", ",", "NavigationConstants", ".", "NAVIGATION_VIEW_DARK_THEME", ")", ";", "prefLightTheme", "=", "prefLightTheme", "==", "0", "?", "R", ".", "style", ".", "NavigationViewLight", ":", "prefLightTheme", ";", "prefDarkTheme", "=", "prefLightTheme", "==", "0", "?", "R", ".", "style", ".", "NavigationViewDark", ":", "prefDarkTheme", ";", "context", ".", "setTheme", "(", "nightModeEnabled", "?", "prefDarkTheme", ":", "prefLightTheme", ")", ";", "return", ";", "}", "TypedArray", "styledAttributes", "=", "context", ".", "obtainStyledAttributes", "(", "attrs", ",", "R", ".", "styleable", ".", "NavigationView", ")", ";", "int", "lightTheme", "=", "styledAttributes", ".", "getResourceId", "(", "R", ".", "styleable", ".", "NavigationView_navigationLightTheme", ",", "R", ".", "style", ".", "NavigationViewLight", ")", ";", "int", "darkTheme", "=", "styledAttributes", ".", "getResourceId", "(", "R", ".", "styleable", ".", "NavigationView_navigationDarkTheme", ",", "R", ".", "style", ".", "NavigationViewDark", ")", ";", "styledAttributes", ".", "recycle", "(", ")", ";", "context", ".", "setTheme", "(", "nightModeEnabled", "?", "darkTheme", ":", "lightTheme", ")", ";", "}" ]
Called in onCreate() to check the UI Mode (day or night) and set the theme colors accordingly. @param context {@link NavigationView} where the theme will be set @param attrs holding custom styles if any are set
[ "Called", "in", "onCreate", "()", "to", "check", "the", "UI", "Mode", "(", "day", "or", "night", ")", "and", "set", "the", "theme", "colors", "accordingly", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java#L86-L106
xwiki/xwiki-rendering
xwiki-rendering-transformations/xwiki-rendering-transformation-macro/src/main/java/org/xwiki/rendering/internal/macro/DefaultMacroContentParser.java
DefaultMacroContentParser.getSyntaxParser
private Parser getSyntaxParser(Syntax syntax) throws MacroExecutionException { """ Get the parser for the current syntax. @param syntax the current syntax of the title content @return the parser for the current syntax @throws org.xwiki.rendering.macro.MacroExecutionException Failed to find source parser. """ try { return this.componentManager.getInstance(Parser.class, syntax.toIdString()); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to find source parser for syntax [" + syntax + "]", e); } }
java
private Parser getSyntaxParser(Syntax syntax) throws MacroExecutionException { try { return this.componentManager.getInstance(Parser.class, syntax.toIdString()); } catch (ComponentLookupException e) { throw new MacroExecutionException("Failed to find source parser for syntax [" + syntax + "]", e); } }
[ "private", "Parser", "getSyntaxParser", "(", "Syntax", "syntax", ")", "throws", "MacroExecutionException", "{", "try", "{", "return", "this", ".", "componentManager", ".", "getInstance", "(", "Parser", ".", "class", ",", "syntax", ".", "toIdString", "(", ")", ")", ";", "}", "catch", "(", "ComponentLookupException", "e", ")", "{", "throw", "new", "MacroExecutionException", "(", "\"Failed to find source parser for syntax [\"", "+", "syntax", "+", "\"]\"", ",", "e", ")", ";", "}", "}" ]
Get the parser for the current syntax. @param syntax the current syntax of the title content @return the parser for the current syntax @throws org.xwiki.rendering.macro.MacroExecutionException Failed to find source parser.
[ "Get", "the", "parser", "for", "the", "current", "syntax", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-transformations/xwiki-rendering-transformation-macro/src/main/java/org/xwiki/rendering/internal/macro/DefaultMacroContentParser.java#L183-L190
sebastiangraf/treetank
coremodules/core/src/main/java/org/treetank/access/conf/StorageConfiguration.java
StorageConfiguration.deserialize
public static StorageConfiguration deserialize(final File pFile) throws TTIOException { """ Generate a StorageConfiguration out of a file. @param pFile where the StorageConfiguration lies in as json @return a new {@link StorageConfiguration} class @throws TTIOException """ try { FileReader fileReader = new FileReader(new File(pFile, Paths.ConfigBinary.getFile().getName())); JsonReader jsonReader = new JsonReader(fileReader); jsonReader.beginObject(); jsonReader.nextName(); File file = new File(jsonReader.nextString()); jsonReader.endObject(); jsonReader.close(); fileReader.close(); return new StorageConfiguration(file); } catch (IOException ioexc) { throw new TTIOException(ioexc); } }
java
public static StorageConfiguration deserialize(final File pFile) throws TTIOException { try { FileReader fileReader = new FileReader(new File(pFile, Paths.ConfigBinary.getFile().getName())); JsonReader jsonReader = new JsonReader(fileReader); jsonReader.beginObject(); jsonReader.nextName(); File file = new File(jsonReader.nextString()); jsonReader.endObject(); jsonReader.close(); fileReader.close(); return new StorageConfiguration(file); } catch (IOException ioexc) { throw new TTIOException(ioexc); } }
[ "public", "static", "StorageConfiguration", "deserialize", "(", "final", "File", "pFile", ")", "throws", "TTIOException", "{", "try", "{", "FileReader", "fileReader", "=", "new", "FileReader", "(", "new", "File", "(", "pFile", ",", "Paths", ".", "ConfigBinary", ".", "getFile", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "JsonReader", "jsonReader", "=", "new", "JsonReader", "(", "fileReader", ")", ";", "jsonReader", ".", "beginObject", "(", ")", ";", "jsonReader", ".", "nextName", "(", ")", ";", "File", "file", "=", "new", "File", "(", "jsonReader", ".", "nextString", "(", ")", ")", ";", "jsonReader", ".", "endObject", "(", ")", ";", "jsonReader", ".", "close", "(", ")", ";", "fileReader", ".", "close", "(", ")", ";", "return", "new", "StorageConfiguration", "(", "file", ")", ";", "}", "catch", "(", "IOException", "ioexc", ")", "{", "throw", "new", "TTIOException", "(", "ioexc", ")", ";", "}", "}" ]
Generate a StorageConfiguration out of a file. @param pFile where the StorageConfiguration lies in as json @return a new {@link StorageConfiguration} class @throws TTIOException
[ "Generate", "a", "StorageConfiguration", "out", "of", "a", "file", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/conf/StorageConfiguration.java#L172-L186
TrueNight/Utils
safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java
SafeTypeface.createFromAsset
public static Typeface createFromAsset(AssetManager mgr, String path) { """ Create a new typeface from the specified font data. @param mgr The application's asset manager @param path The file name of the font data in the assets directory @return The new typeface. """ Typeface typeface = TYPEFACES.get(path); if (typeface != null) { return typeface; } else { typeface = Typeface.createFromAsset(mgr, path); TYPEFACES.put(path, typeface); return typeface; } }
java
public static Typeface createFromAsset(AssetManager mgr, String path) { Typeface typeface = TYPEFACES.get(path); if (typeface != null) { return typeface; } else { typeface = Typeface.createFromAsset(mgr, path); TYPEFACES.put(path, typeface); return typeface; } }
[ "public", "static", "Typeface", "createFromAsset", "(", "AssetManager", "mgr", ",", "String", "path", ")", "{", "Typeface", "typeface", "=", "TYPEFACES", ".", "get", "(", "path", ")", ";", "if", "(", "typeface", "!=", "null", ")", "{", "return", "typeface", ";", "}", "else", "{", "typeface", "=", "Typeface", ".", "createFromAsset", "(", "mgr", ",", "path", ")", ";", "TYPEFACES", ".", "put", "(", "path", ",", "typeface", ")", ";", "return", "typeface", ";", "}", "}" ]
Create a new typeface from the specified font data. @param mgr The application's asset manager @param path The file name of the font data in the assets directory @return The new typeface.
[ "Create", "a", "new", "typeface", "from", "the", "specified", "font", "data", "." ]
train
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/safe-typeface/src/main/java/xyz/truenight/safetypeface/SafeTypeface.java#L40-L49
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java
ChannelUpdateHandler.handleServerTextChannel
private void handleServerTextChannel(JsonNode jsonChannel) { """ Handles a server text channel update. @param jsonChannel The json channel data. """ long channelId = jsonChannel.get("id").asLong(); api.getTextChannelById(channelId).map(c -> ((ServerTextChannelImpl) c)).ifPresent(channel -> { String oldTopic = channel.getTopic(); String newTopic = jsonChannel.has("topic") && !jsonChannel.get("topic").isNull() ? jsonChannel.get("topic").asText() : ""; if (!oldTopic.equals(newTopic)) { channel.setTopic(newTopic); ServerTextChannelChangeTopicEvent event = new ServerTextChannelChangeTopicEventImpl(channel, newTopic, oldTopic); api.getEventDispatcher().dispatchServerTextChannelChangeTopicEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } boolean oldNsfwFlag = channel.isNsfw(); boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean(); if (oldNsfwFlag != newNsfwFlag) { channel.setNsfwFlag(newNsfwFlag); ServerChannelChangeNsfwFlagEvent event = new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag); api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent( (DispatchQueueSelector) channel.getServer(), null, channel.getServer(), channel, event); } int oldSlowmodeDelay = channel.getSlowmodeDelayInSeconds(); int newSlowmodeDelay = jsonChannel.get("rate_limit_per_user").asInt(0); if (oldSlowmodeDelay != newSlowmodeDelay) { channel.setSlowmodeDelayInSeconds(newSlowmodeDelay); ServerTextChannelChangeSlowmodeEvent event = new ServerTextChannelChangeSlowmodeEventImpl(channel, oldSlowmodeDelay, newSlowmodeDelay); api.getEventDispatcher().dispatchServerTextChannelChangeSlowmodeEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event ); } }); }
java
private void handleServerTextChannel(JsonNode jsonChannel) { long channelId = jsonChannel.get("id").asLong(); api.getTextChannelById(channelId).map(c -> ((ServerTextChannelImpl) c)).ifPresent(channel -> { String oldTopic = channel.getTopic(); String newTopic = jsonChannel.has("topic") && !jsonChannel.get("topic").isNull() ? jsonChannel.get("topic").asText() : ""; if (!oldTopic.equals(newTopic)) { channel.setTopic(newTopic); ServerTextChannelChangeTopicEvent event = new ServerTextChannelChangeTopicEventImpl(channel, newTopic, oldTopic); api.getEventDispatcher().dispatchServerTextChannelChangeTopicEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } boolean oldNsfwFlag = channel.isNsfw(); boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean(); if (oldNsfwFlag != newNsfwFlag) { channel.setNsfwFlag(newNsfwFlag); ServerChannelChangeNsfwFlagEvent event = new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag); api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent( (DispatchQueueSelector) channel.getServer(), null, channel.getServer(), channel, event); } int oldSlowmodeDelay = channel.getSlowmodeDelayInSeconds(); int newSlowmodeDelay = jsonChannel.get("rate_limit_per_user").asInt(0); if (oldSlowmodeDelay != newSlowmodeDelay) { channel.setSlowmodeDelayInSeconds(newSlowmodeDelay); ServerTextChannelChangeSlowmodeEvent event = new ServerTextChannelChangeSlowmodeEventImpl(channel, oldSlowmodeDelay, newSlowmodeDelay); api.getEventDispatcher().dispatchServerTextChannelChangeSlowmodeEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event ); } }); }
[ "private", "void", "handleServerTextChannel", "(", "JsonNode", "jsonChannel", ")", "{", "long", "channelId", "=", "jsonChannel", ".", "get", "(", "\"id\"", ")", ".", "asLong", "(", ")", ";", "api", ".", "getTextChannelById", "(", "channelId", ")", ".", "map", "(", "c", "->", "(", "(", "ServerTextChannelImpl", ")", "c", ")", ")", ".", "ifPresent", "(", "channel", "->", "{", "String", "oldTopic", "=", "channel", ".", "getTopic", "(", ")", ";", "String", "newTopic", "=", "jsonChannel", ".", "has", "(", "\"topic\"", ")", "&&", "!", "jsonChannel", ".", "get", "(", "\"topic\"", ")", ".", "isNull", "(", ")", "?", "jsonChannel", ".", "get", "(", "\"topic\"", ")", ".", "asText", "(", ")", ":", "\"\"", ";", "if", "(", "!", "oldTopic", ".", "equals", "(", "newTopic", ")", ")", "{", "channel", ".", "setTopic", "(", "newTopic", ")", ";", "ServerTextChannelChangeTopicEvent", "event", "=", "new", "ServerTextChannelChangeTopicEventImpl", "(", "channel", ",", "newTopic", ",", "oldTopic", ")", ";", "api", ".", "getEventDispatcher", "(", ")", ".", "dispatchServerTextChannelChangeTopicEvent", "(", "(", "DispatchQueueSelector", ")", "channel", ".", "getServer", "(", ")", ",", "channel", ".", "getServer", "(", ")", ",", "channel", ",", "event", ")", ";", "}", "boolean", "oldNsfwFlag", "=", "channel", ".", "isNsfw", "(", ")", ";", "boolean", "newNsfwFlag", "=", "jsonChannel", ".", "get", "(", "\"nsfw\"", ")", ".", "asBoolean", "(", ")", ";", "if", "(", "oldNsfwFlag", "!=", "newNsfwFlag", ")", "{", "channel", ".", "setNsfwFlag", "(", "newNsfwFlag", ")", ";", "ServerChannelChangeNsfwFlagEvent", "event", "=", "new", "ServerChannelChangeNsfwFlagEventImpl", "(", "channel", ",", "newNsfwFlag", ",", "oldNsfwFlag", ")", ";", "api", ".", "getEventDispatcher", "(", ")", ".", "dispatchServerChannelChangeNsfwFlagEvent", "(", "(", "DispatchQueueSelector", ")", "channel", ".", "getServer", "(", ")", ",", "null", ",", "channel", ".", "getServer", "(", ")", ",", "channel", ",", "event", ")", ";", "}", "int", "oldSlowmodeDelay", "=", "channel", ".", "getSlowmodeDelayInSeconds", "(", ")", ";", "int", "newSlowmodeDelay", "=", "jsonChannel", ".", "get", "(", "\"rate_limit_per_user\"", ")", ".", "asInt", "(", "0", ")", ";", "if", "(", "oldSlowmodeDelay", "!=", "newSlowmodeDelay", ")", "{", "channel", ".", "setSlowmodeDelayInSeconds", "(", "newSlowmodeDelay", ")", ";", "ServerTextChannelChangeSlowmodeEvent", "event", "=", "new", "ServerTextChannelChangeSlowmodeEventImpl", "(", "channel", ",", "oldSlowmodeDelay", ",", "newSlowmodeDelay", ")", ";", "api", ".", "getEventDispatcher", "(", ")", ".", "dispatchServerTextChannelChangeSlowmodeEvent", "(", "(", "DispatchQueueSelector", ")", "channel", ".", "getServer", "(", ")", ",", "channel", ".", "getServer", "(", ")", ",", "channel", ",", "event", ")", ";", "}", "}", ")", ";", "}" ]
Handles a server text channel update. @param jsonChannel The json channel data.
[ "Handles", "a", "server", "text", "channel", "update", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java#L272-L311
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.unprojectInv
public Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest) { """ Unproject the given window coordinates <code>(winX, winY)</code> by <code>this</code> matrix using the specified viewport. <p> This method differs from {@link #unproject(double, double, int[], Vector2d) unproject()} in that it assumes that <code>this</code> is already the inverse matrix of the original projection matrix. It exists to avoid recomputing the matrix inverse with every invocation. @see #unproject(double, double, int[], Vector2d) @param winX the x-coordinate in window coordinates (pixels) @param winY the y-coordinate in window coordinates (pixels) @param viewport the viewport described by <code>[x, y, width, height]</code> @param dest will hold the unprojected position @return dest """ double ndcX = (winX-viewport[0])/viewport[2]*2.0-1.0; double ndcY = (winY-viewport[1])/viewport[3]*2.0-1.0; dest.x = m00 * ndcX + m10 * ndcY + m20; dest.y = m01 * ndcX + m11 * ndcY + m21; return dest; }
java
public Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest) { double ndcX = (winX-viewport[0])/viewport[2]*2.0-1.0; double ndcY = (winY-viewport[1])/viewport[3]*2.0-1.0; dest.x = m00 * ndcX + m10 * ndcY + m20; dest.y = m01 * ndcX + m11 * ndcY + m21; return dest; }
[ "public", "Vector2d", "unprojectInv", "(", "double", "winX", ",", "double", "winY", ",", "int", "[", "]", "viewport", ",", "Vector2d", "dest", ")", "{", "double", "ndcX", "=", "(", "winX", "-", "viewport", "[", "0", "]", ")", "/", "viewport", "[", "2", "]", "*", "2.0", "-", "1.0", ";", "double", "ndcY", "=", "(", "winY", "-", "viewport", "[", "1", "]", ")", "/", "viewport", "[", "3", "]", "*", "2.0", "-", "1.0", ";", "dest", ".", "x", "=", "m00", "*", "ndcX", "+", "m10", "*", "ndcY", "+", "m20", ";", "dest", ".", "y", "=", "m01", "*", "ndcX", "+", "m11", "*", "ndcY", "+", "m21", ";", "return", "dest", ";", "}" ]
Unproject the given window coordinates <code>(winX, winY)</code> by <code>this</code> matrix using the specified viewport. <p> This method differs from {@link #unproject(double, double, int[], Vector2d) unproject()} in that it assumes that <code>this</code> is already the inverse matrix of the original projection matrix. It exists to avoid recomputing the matrix inverse with every invocation. @see #unproject(double, double, int[], Vector2d) @param winX the x-coordinate in window coordinates (pixels) @param winY the y-coordinate in window coordinates (pixels) @param viewport the viewport described by <code>[x, y, width, height]</code> @param dest will hold the unprojected position @return dest
[ "Unproject", "the", "given", "window", "coordinates", "<code", ">", "(", "winX", "winY", ")", "<", "/", "code", ">", "by", "<code", ">", "this<", "/", "code", ">", "matrix", "using", "the", "specified", "viewport", ".", "<p", ">", "This", "method", "differs", "from", "{", "@link", "#unproject", "(", "double", "double", "int", "[]", "Vector2d", ")", "unproject", "()", "}", "in", "that", "it", "assumes", "that", "<code", ">", "this<", "/", "code", ">", "is", "already", "the", "inverse", "matrix", "of", "the", "original", "projection", "matrix", ".", "It", "exists", "to", "avoid", "recomputing", "the", "matrix", "inverse", "with", "every", "invocation", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L2336-L2342
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java
SwapAnnuity.getSwapAnnuity
public static double getSwapAnnuity(ScheduleInterface schedule, ForwardCurveInterface forwardCurve) { """ Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve. The discount curve used to calculate the annuity is calculated from the forward curve using classical single curve interpretations of forwards and a default period length. The may be a crude approximation. Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#getSwapAnnuity(double, ScheduleInterface, DiscountCurveInterface, AnalyticModelInterface)}. @param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period. @param forwardCurve The forward curve. @return The swap annuity. """ DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName()); double evaluationTime = 0.0; // Consider only payment time > 0 return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModel( new CurveInterface[] {forwardCurve, discountCurve} )); }
java
public static double getSwapAnnuity(ScheduleInterface schedule, ForwardCurveInterface forwardCurve) { DiscountCurveInterface discountCurve = new DiscountCurveFromForwardCurve(forwardCurve.getName()); double evaluationTime = 0.0; // Consider only payment time > 0 return getSwapAnnuity(evaluationTime, schedule, discountCurve, new AnalyticModel( new CurveInterface[] {forwardCurve, discountCurve} )); }
[ "public", "static", "double", "getSwapAnnuity", "(", "ScheduleInterface", "schedule", ",", "ForwardCurveInterface", "forwardCurve", ")", "{", "DiscountCurveInterface", "discountCurve", "=", "new", "DiscountCurveFromForwardCurve", "(", "forwardCurve", ".", "getName", "(", ")", ")", ";", "double", "evaluationTime", "=", "0.0", ";", "// Consider only payment time > 0", "return", "getSwapAnnuity", "(", "evaluationTime", ",", "schedule", ",", "discountCurve", ",", "new", "AnalyticModel", "(", "new", "CurveInterface", "[", "]", "{", "forwardCurve", ",", "discountCurve", "}", ")", ")", ";", "}" ]
Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve. The discount curve used to calculate the annuity is calculated from the forward curve using classical single curve interpretations of forwards and a default period length. The may be a crude approximation. Note: This method will consider evaluationTime being 0, see {@link net.finmath.marketdata.products.SwapAnnuity#getSwapAnnuity(double, ScheduleInterface, DiscountCurveInterface, AnalyticModelInterface)}. @param schedule The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period. @param forwardCurve The forward curve. @return The swap annuity.
[ "Function", "to", "calculate", "an", "(", "idealized", ")", "single", "curve", "swap", "annuity", "for", "a", "given", "schedule", "and", "forward", "curve", ".", "The", "discount", "curve", "used", "to", "calculate", "the", "annuity", "is", "calculated", "from", "the", "forward", "curve", "using", "classical", "single", "curve", "interpretations", "of", "forwards", "and", "a", "default", "period", "length", ".", "The", "may", "be", "a", "crude", "approximation", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/products/SwapAnnuity.java#L99-L103
google/error-prone
core/src/main/java/com/google/errorprone/refaster/BlockTemplate.java
BlockTemplate.printStatement
private static String printStatement(Context context, JCStatement statement) { """ Returns a {@code String} representation of a statement, including semicolon. """ StringWriter writer = new StringWriter(); try { pretty(context, writer).printStat(statement); } catch (IOException e) { throw new AssertionError("StringWriter cannot throw IOExceptions"); } return writer.toString(); }
java
private static String printStatement(Context context, JCStatement statement) { StringWriter writer = new StringWriter(); try { pretty(context, writer).printStat(statement); } catch (IOException e) { throw new AssertionError("StringWriter cannot throw IOExceptions"); } return writer.toString(); }
[ "private", "static", "String", "printStatement", "(", "Context", "context", ",", "JCStatement", "statement", ")", "{", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "pretty", "(", "context", ",", "writer", ")", ".", "printStat", "(", "statement", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"StringWriter cannot throw IOExceptions\"", ")", ";", "}", "return", "writer", ".", "toString", "(", ")", ";", "}" ]
Returns a {@code String} representation of a statement, including semicolon.
[ "Returns", "a", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/BlockTemplate.java#L176-L184
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/UsersApi.java
UsersApi.getUserDevicesAsync
public com.squareup.okhttp.Call getUserDevicesAsync(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid, final ApiCallback<DevicesEnvelope> callback) throws ApiException { """ Get User Devices (asynchronously) Retrieve User&#39;s Devices @param userId User ID (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param includeProperties Optional. Boolean (true/false) - If false, only return the user&#39;s device types. If true, also return device types shared by other users. (optional) @param owner Return owned and/or shared devices. Default to ALL. (optional) @param includeShareInfo Include share info (optional) @param dtid Return only devices of this device type. If empty, assumes all device types allowed by the authorization. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getUserDevicesValidateBeforeCall(userId, offset, count, includeProperties, owner, includeShareInfo, dtid, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DevicesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getUserDevicesAsync(String userId, Integer offset, Integer count, Boolean includeProperties, String owner, Boolean includeShareInfo, String dtid, final ApiCallback<DevicesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getUserDevicesValidateBeforeCall(userId, offset, count, includeProperties, owner, includeShareInfo, dtid, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DevicesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getUserDevicesAsync", "(", "String", "userId", ",", "Integer", "offset", ",", "Integer", "count", ",", "Boolean", "includeProperties", ",", "String", "owner", ",", "Boolean", "includeShareInfo", ",", "String", "dtid", ",", "final", "ApiCallback", "<", "DevicesEnvelope", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getUserDevicesValidateBeforeCall", "(", "userId", ",", "offset", ",", "count", ",", "includeProperties", ",", "owner", ",", "includeShareInfo", ",", "dtid", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "DevicesEnvelope", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Get User Devices (asynchronously) Retrieve User&#39;s Devices @param userId User ID (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set (optional) @param includeProperties Optional. Boolean (true/false) - If false, only return the user&#39;s device types. If true, also return device types shared by other users. (optional) @param owner Return owned and/or shared devices. Default to ALL. (optional) @param includeShareInfo Include share info (optional) @param dtid Return only devices of this device type. If empty, assumes all device types allowed by the authorization. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "User", "Devices", "(", "asynchronously", ")", "Retrieve", "User&#39", ";", "s", "Devices" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L686-L711
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputFormat.java
MultipleOutputFormat.getRecordWriter
public RecordWriter<K, V> getRecordWriter(FileSystem fs, JobConf job, String name, Progressable arg3) throws IOException { """ Create a composite record writer that can write key/value data to different output files @param fs the file system to use @param job the job conf for the job @param name the leaf file name for the output file (such as part-00000") @param arg3 a progressable for reporting progress. @return a composite record writer @throws IOException """ final FileSystem myFS = fs; final String myName = generateLeafFileName(name); final JobConf myJob = job; final Progressable myProgressable = arg3; return new RecordWriter<K, V>() { // a cache storing the record writers for different output files. TreeMap<String, RecordWriter<K, V>> recordWriters = new TreeMap<String, RecordWriter<K, V>>(); public void write(K key, V value) throws IOException { // get the file name based on the key String keyBasedPath = generateFileNameForKeyValue(key, value, myName); // get the file name based on the input file name String finalPath = getInputFileBasedOutputFileName(myJob, keyBasedPath); // get the actual key K actualKey = generateActualKey(key, value); V actualValue = generateActualValue(key, value); RecordWriter<K, V> rw = this.recordWriters.get(finalPath); if (rw == null) { // if we don't have the record writer yet for the final path, create // one // and add it to the cache rw = getBaseRecordWriter(myFS, myJob, finalPath, myProgressable); this.recordWriters.put(finalPath, rw); } rw.write(actualKey, actualValue); }; public void close(Reporter reporter) throws IOException { Iterator<String> keys = this.recordWriters.keySet().iterator(); while (keys.hasNext()) { RecordWriter<K, V> rw = this.recordWriters.get(keys.next()); rw.close(reporter); } this.recordWriters.clear(); }; }; }
java
public RecordWriter<K, V> getRecordWriter(FileSystem fs, JobConf job, String name, Progressable arg3) throws IOException { final FileSystem myFS = fs; final String myName = generateLeafFileName(name); final JobConf myJob = job; final Progressable myProgressable = arg3; return new RecordWriter<K, V>() { // a cache storing the record writers for different output files. TreeMap<String, RecordWriter<K, V>> recordWriters = new TreeMap<String, RecordWriter<K, V>>(); public void write(K key, V value) throws IOException { // get the file name based on the key String keyBasedPath = generateFileNameForKeyValue(key, value, myName); // get the file name based on the input file name String finalPath = getInputFileBasedOutputFileName(myJob, keyBasedPath); // get the actual key K actualKey = generateActualKey(key, value); V actualValue = generateActualValue(key, value); RecordWriter<K, V> rw = this.recordWriters.get(finalPath); if (rw == null) { // if we don't have the record writer yet for the final path, create // one // and add it to the cache rw = getBaseRecordWriter(myFS, myJob, finalPath, myProgressable); this.recordWriters.put(finalPath, rw); } rw.write(actualKey, actualValue); }; public void close(Reporter reporter) throws IOException { Iterator<String> keys = this.recordWriters.keySet().iterator(); while (keys.hasNext()) { RecordWriter<K, V> rw = this.recordWriters.get(keys.next()); rw.close(reporter); } this.recordWriters.clear(); }; }; }
[ "public", "RecordWriter", "<", "K", ",", "V", ">", "getRecordWriter", "(", "FileSystem", "fs", ",", "JobConf", "job", ",", "String", "name", ",", "Progressable", "arg3", ")", "throws", "IOException", "{", "final", "FileSystem", "myFS", "=", "fs", ";", "final", "String", "myName", "=", "generateLeafFileName", "(", "name", ")", ";", "final", "JobConf", "myJob", "=", "job", ";", "final", "Progressable", "myProgressable", "=", "arg3", ";", "return", "new", "RecordWriter", "<", "K", ",", "V", ">", "(", ")", "{", "// a cache storing the record writers for different output files.", "TreeMap", "<", "String", ",", "RecordWriter", "<", "K", ",", "V", ">", ">", "recordWriters", "=", "new", "TreeMap", "<", "String", ",", "RecordWriter", "<", "K", ",", "V", ">", ">", "(", ")", ";", "public", "void", "write", "(", "K", "key", ",", "V", "value", ")", "throws", "IOException", "{", "// get the file name based on the key", "String", "keyBasedPath", "=", "generateFileNameForKeyValue", "(", "key", ",", "value", ",", "myName", ")", ";", "// get the file name based on the input file name", "String", "finalPath", "=", "getInputFileBasedOutputFileName", "(", "myJob", ",", "keyBasedPath", ")", ";", "// get the actual key", "K", "actualKey", "=", "generateActualKey", "(", "key", ",", "value", ")", ";", "V", "actualValue", "=", "generateActualValue", "(", "key", ",", "value", ")", ";", "RecordWriter", "<", "K", ",", "V", ">", "rw", "=", "this", ".", "recordWriters", ".", "get", "(", "finalPath", ")", ";", "if", "(", "rw", "==", "null", ")", "{", "// if we don't have the record writer yet for the final path, create", "// one", "// and add it to the cache", "rw", "=", "getBaseRecordWriter", "(", "myFS", ",", "myJob", ",", "finalPath", ",", "myProgressable", ")", ";", "this", ".", "recordWriters", ".", "put", "(", "finalPath", ",", "rw", ")", ";", "}", "rw", ".", "write", "(", "actualKey", ",", "actualValue", ")", ";", "}", ";", "public", "void", "close", "(", "Reporter", "reporter", ")", "throws", "IOException", "{", "Iterator", "<", "String", ">", "keys", "=", "this", ".", "recordWriters", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "keys", ".", "hasNext", "(", ")", ")", "{", "RecordWriter", "<", "K", ",", "V", ">", "rw", "=", "this", ".", "recordWriters", ".", "get", "(", "keys", ".", "next", "(", ")", ")", ";", "rw", ".", "close", "(", "reporter", ")", ";", "}", "this", ".", "recordWriters", ".", "clear", "(", ")", ";", "}", ";", "}", ";", "}" ]
Create a composite record writer that can write key/value data to different output files @param fs the file system to use @param job the job conf for the job @param name the leaf file name for the output file (such as part-00000") @param arg3 a progressable for reporting progress. @return a composite record writer @throws IOException
[ "Create", "a", "composite", "record", "writer", "that", "can", "write", "key", "/", "value", "data", "to", "different", "output", "files" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputFormat.java#L69-L114
javagl/Common
src/main/java/de/javagl/common/xml/XmlUtils.java
XmlUtils.readEnum
static <E extends Enum<E>> E readEnum(Node node, Class<E> enumClass) { """ Parse an enum value from the first child of the given node. @param <E> The enum type @param node The node @param enumClass The enum class @return The enum value @throws XmlException If the given node was <code>null</code>, or no enum value could be parsed """ if (node == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null node"); } String value = node.getFirstChild().getNodeValue(); if (value == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null value"); } try { return Enum.valueOf(enumClass, value); } catch (IllegalArgumentException e) { throw new XmlException( "No valid "+enumClass.getSimpleName()+ ": \""+value+"\""); } }
java
static <E extends Enum<E>> E readEnum(Node node, Class<E> enumClass) { if (node == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null node"); } String value = node.getFirstChild().getNodeValue(); if (value == null) { throw new XmlException( "Tried to read "+enumClass.getSimpleName()+ " value from null value"); } try { return Enum.valueOf(enumClass, value); } catch (IllegalArgumentException e) { throw new XmlException( "No valid "+enumClass.getSimpleName()+ ": \""+value+"\""); } }
[ "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "readEnum", "(", "Node", "node", ",", "Class", "<", "E", ">", "enumClass", ")", "{", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\" value from null node\"", ")", ";", "}", "String", "value", "=", "node", ".", "getFirstChild", "(", ")", ".", "getNodeValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "XmlException", "(", "\"Tried to read \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\" value from null value\"", ")", ";", "}", "try", "{", "return", "Enum", ".", "valueOf", "(", "enumClass", ",", "value", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "XmlException", "(", "\"No valid \"", "+", "enumClass", ".", "getSimpleName", "(", ")", "+", "\": \\\"\"", "+", "value", "+", "\"\\\"\"", ")", ";", "}", "}" ]
Parse an enum value from the first child of the given node. @param <E> The enum type @param node The node @param enumClass The enum class @return The enum value @throws XmlException If the given node was <code>null</code>, or no enum value could be parsed
[ "Parse", "an", "enum", "value", "from", "the", "first", "child", "of", "the", "given", "node", "." ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/xml/XmlUtils.java#L581-L606
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java
DataGridStateFactory.attachDataGridState
public final void attachDataGridState(String name, DataGridState state) { """ <p> Convenience method that allows a {@link DataGridState} object from a client to be attached to the factory. This allows subsequent calls to retrieve this same {@link DataGridState} instance. </p> @param name the name of the data grid @param state the {@link DataGridState} object to attach """ DataGridStateCodec codec = lookupCodec(name, DEFAULT_DATA_GRID_CONFIG); codec.setDataGridState(state); }
java
public final void attachDataGridState(String name, DataGridState state) { DataGridStateCodec codec = lookupCodec(name, DEFAULT_DATA_GRID_CONFIG); codec.setDataGridState(state); }
[ "public", "final", "void", "attachDataGridState", "(", "String", "name", ",", "DataGridState", "state", ")", "{", "DataGridStateCodec", "codec", "=", "lookupCodec", "(", "name", ",", "DEFAULT_DATA_GRID_CONFIG", ")", ";", "codec", ".", "setDataGridState", "(", "state", ")", ";", "}" ]
<p> Convenience method that allows a {@link DataGridState} object from a client to be attached to the factory. This allows subsequent calls to retrieve this same {@link DataGridState} instance. </p> @param name the name of the data grid @param state the {@link DataGridState} object to attach
[ "<p", ">", "Convenience", "method", "that", "allows", "a", "{", "@link", "DataGridState", "}", "object", "from", "a", "client", "to", "be", "attached", "to", "the", "factory", ".", "This", "allows", "subsequent", "calls", "to", "retrieve", "this", "same", "{", "@link", "DataGridState", "}", "instance", ".", "<", "/", "p", ">" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridStateFactory.java#L172-L175
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java
Dater.of
public static Dater of(Date date, String pattern) { """ Returns a new Dater instance with the given date and pattern @param date @return """ return of(date).with(pattern); }
java
public static Dater of(Date date, String pattern) { return of(date).with(pattern); }
[ "public", "static", "Dater", "of", "(", "Date", "date", ",", "String", "pattern", ")", "{", "return", "of", "(", "date", ")", ".", "with", "(", "pattern", ")", ";", "}" ]
Returns a new Dater instance with the given date and pattern @param date @return
[ "Returns", "a", "new", "Dater", "instance", "with", "the", "given", "date", "and", "pattern" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Dater.java#L244-L246
eyp/serfj
src/main/java/net/sf/serfj/ServletHelper.java
ServletHelper.signatureStrategy
private Object signatureStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException { """ Invokes URL's action using SIGNATURE strategy. It means that controller's method could have these signatures: - action(ResponseHelper, Map<String,Object>). - action(ResponseHelper). - action(Map<String,Object>). - action(). @param urlInfo Information of REST's URL. @param responseHelper ResponseHelper object to inject into the controller. @throws ClassNotFoundException if controller's class doesn't exist. @throws NoSuchMethodException if doesn't exist a method for action required in the URL. @throws IllegalArgumentException if controller's method has different arguments that this method tries to pass to it. @throws IllegalAccessException if the controller or its method are not accessibles- @throws InvocationTargetException if the controller's method raise an exception. @throws InstantiationException if it isn't possible to instantiate the controller. """ Class<?> clazz = Class.forName(urlInfo.getController()); Object result = null; // action(ResponseHelper, Map<String,Object>) Method method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class, Map.class }); if (method != null) { LOGGER.debug("Calling {}.{}(ResponseHelper, Map<String,Object>)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper, responseHelper.getParams()); } else { // action(ResponseHelper) method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class }); if (method != null) { LOGGER.debug("Calling {}.{}(ResponseHelper)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper); } else { // action(Map<String,Object>) method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { Map.class }); if (method != null) { LOGGER.debug("Calling {}.{}(Map<String,Object>)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper.getParams()); } else { // action() method = clazz.getMethod(urlInfo.getAction(), new Class[] {}); LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo); } } } return result; }
java
private Object signatureStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException { Class<?> clazz = Class.forName(urlInfo.getController()); Object result = null; // action(ResponseHelper, Map<String,Object>) Method method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class, Map.class }); if (method != null) { LOGGER.debug("Calling {}.{}(ResponseHelper, Map<String,Object>)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper, responseHelper.getParams()); } else { // action(ResponseHelper) method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { ResponseHelper.class }); if (method != null) { LOGGER.debug("Calling {}.{}(ResponseHelper)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper); } else { // action(Map<String,Object>) method = this.methodExists(clazz, urlInfo.getAction(), new Class[] { Map.class }); if (method != null) { LOGGER.debug("Calling {}.{}(Map<String,Object>)", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo, responseHelper.getParams()); } else { // action() method = clazz.getMethod(urlInfo.getAction(), new Class[] {}); LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(method); result = this.invokeAction(clazz.newInstance(), method, urlInfo); } } } return result; }
[ "private", "Object", "signatureStrategy", "(", "UrlInfo", "urlInfo", ",", "ResponseHelper", "responseHelper", ")", "throws", "ClassNotFoundException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", "InstantiationException", ",", "NoSuchMethodException", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "urlInfo", ".", "getController", "(", ")", ")", ";", "Object", "result", "=", "null", ";", "// action(ResponseHelper, Map<String,Object>)", "Method", "method", "=", "this", ".", "methodExists", "(", "clazz", ",", "urlInfo", ".", "getAction", "(", ")", ",", "new", "Class", "[", "]", "{", "ResponseHelper", ".", "class", ",", "Map", ".", "class", "}", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Calling {}.{}(ResponseHelper, Map<String,Object>)\"", ",", "urlInfo", ".", "getController", "(", ")", ",", "urlInfo", ".", "getAction", "(", ")", ")", ";", "responseHelper", ".", "notRenderPage", "(", "method", ")", ";", "result", "=", "this", ".", "invokeAction", "(", "clazz", ".", "newInstance", "(", ")", ",", "method", ",", "urlInfo", ",", "responseHelper", ",", "responseHelper", ".", "getParams", "(", ")", ")", ";", "}", "else", "{", "// action(ResponseHelper)", "method", "=", "this", ".", "methodExists", "(", "clazz", ",", "urlInfo", ".", "getAction", "(", ")", ",", "new", "Class", "[", "]", "{", "ResponseHelper", ".", "class", "}", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Calling {}.{}(ResponseHelper)\"", ",", "urlInfo", ".", "getController", "(", ")", ",", "urlInfo", ".", "getAction", "(", ")", ")", ";", "responseHelper", ".", "notRenderPage", "(", "method", ")", ";", "result", "=", "this", ".", "invokeAction", "(", "clazz", ".", "newInstance", "(", ")", ",", "method", ",", "urlInfo", ",", "responseHelper", ")", ";", "}", "else", "{", "// action(Map<String,Object>)", "method", "=", "this", ".", "methodExists", "(", "clazz", ",", "urlInfo", ".", "getAction", "(", ")", ",", "new", "Class", "[", "]", "{", "Map", ".", "class", "}", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Calling {}.{}(Map<String,Object>)\"", ",", "urlInfo", ".", "getController", "(", ")", ",", "urlInfo", ".", "getAction", "(", ")", ")", ";", "responseHelper", ".", "notRenderPage", "(", "method", ")", ";", "result", "=", "this", ".", "invokeAction", "(", "clazz", ".", "newInstance", "(", ")", ",", "method", ",", "urlInfo", ",", "responseHelper", ".", "getParams", "(", ")", ")", ";", "}", "else", "{", "// action()", "method", "=", "clazz", ".", "getMethod", "(", "urlInfo", ".", "getAction", "(", ")", ",", "new", "Class", "[", "]", "{", "}", ")", ";", "LOGGER", ".", "debug", "(", "\"Calling {}.{}()\"", ",", "urlInfo", ".", "getController", "(", ")", ",", "urlInfo", ".", "getAction", "(", ")", ")", ";", "responseHelper", ".", "notRenderPage", "(", "method", ")", ";", "result", "=", "this", ".", "invokeAction", "(", "clazz", ".", "newInstance", "(", ")", ",", "method", ",", "urlInfo", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Invokes URL's action using SIGNATURE strategy. It means that controller's method could have these signatures: - action(ResponseHelper, Map<String,Object>). - action(ResponseHelper). - action(Map<String,Object>). - action(). @param urlInfo Information of REST's URL. @param responseHelper ResponseHelper object to inject into the controller. @throws ClassNotFoundException if controller's class doesn't exist. @throws NoSuchMethodException if doesn't exist a method for action required in the URL. @throws IllegalArgumentException if controller's method has different arguments that this method tries to pass to it. @throws IllegalAccessException if the controller or its method are not accessibles- @throws InvocationTargetException if the controller's method raise an exception. @throws InstantiationException if it isn't possible to instantiate the controller.
[ "Invokes", "URL", "s", "action", "using", "SIGNATURE", "strategy", ".", "It", "means", "that", "controller", "s", "method", "could", "have", "these", "signatures", ":" ]
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L211-L245
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java
SessionManager.getSession
public Object getSession(String id, int version, boolean isSessionAccess, Object xdCorrelator) { """ This method is invoked by the HttpSessionManagerImpl to get at the session or related session information. If the getSession is a result of a request.getSession call from the application, then the isSessionAccess boolean is set to true. Also if the version number is available, then it is provided. If not, then a value of -1 is passed in. This can happen either in the case of an incoming request that provides the session id via URL rewriting but does not provide the version/clone info or in the case of a isRequestedSessionIDValid call. <p> @param id @param version @param isSessionAccess tells us if the request came from a session access (user request) @return Object """ return getSession(id, version, isSessionAccess, false, xdCorrelator); }
java
public Object getSession(String id, int version, boolean isSessionAccess, Object xdCorrelator) { return getSession(id, version, isSessionAccess, false, xdCorrelator); }
[ "public", "Object", "getSession", "(", "String", "id", ",", "int", "version", ",", "boolean", "isSessionAccess", ",", "Object", "xdCorrelator", ")", "{", "return", "getSession", "(", "id", ",", "version", ",", "isSessionAccess", ",", "false", ",", "xdCorrelator", ")", ";", "}" ]
This method is invoked by the HttpSessionManagerImpl to get at the session or related session information. If the getSession is a result of a request.getSession call from the application, then the isSessionAccess boolean is set to true. Also if the version number is available, then it is provided. If not, then a value of -1 is passed in. This can happen either in the case of an incoming request that provides the session id via URL rewriting but does not provide the version/clone info or in the case of a isRequestedSessionIDValid call. <p> @param id @param version @param isSessionAccess tells us if the request came from a session access (user request) @return Object
[ "This", "method", "is", "invoked", "by", "the", "HttpSessionManagerImpl", "to", "get", "at", "the", "session", "or", "related", "session", "information", ".", "If", "the", "getSession", "is", "a", "result", "of", "a", "request", ".", "getSession", "call", "from", "the", "application", "then", "the", "isSessionAccess", "boolean", "is", "set", "to", "true", ".", "Also", "if", "the", "version", "number", "is", "available", "then", "it", "is", "provided", ".", "If", "not", "then", "a", "value", "of", "-", "1", "is", "passed", "in", ".", "This", "can", "happen", "either", "in", "the", "case", "of", "an", "incoming", "request", "that", "provides", "the", "session", "id", "via", "URL", "rewriting", "but", "does", "not", "provide", "the", "version", "/", "clone", "info", "or", "in", "the", "case", "of", "a", "isRequestedSessionIDValid", "call", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java#L433-L435
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createGroup
public GitlabGroup createGroup(String name, String path, String ldapCn, GitlabAccessLevel ldapAccess, GitlabUser sudoUser, Integer parentId) throws IOException { """ Creates a Group @param name The name of the group @param path The path for the group @param ldapCn LDAP Group Name to sync with, null otherwise @param ldapAccess Access level for LDAP group members, null otherwise @param sudoUser The user to create the group on behalf of @param parentId The id of a parent group; the new group will be its subgroup @return The GitLab Group @throws IOException on gitlab api call error """ Query query = new Query() .append("name", name) .append("path", path) .appendIf("ldap_cn", ldapCn) .appendIf("ldap_access", ldapAccess) .appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null) .appendIf("parent_id", parentId); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
java
public GitlabGroup createGroup(String name, String path, String ldapCn, GitlabAccessLevel ldapAccess, GitlabUser sudoUser, Integer parentId) throws IOException { Query query = new Query() .append("name", name) .append("path", path) .appendIf("ldap_cn", ldapCn) .appendIf("ldap_access", ldapAccess) .appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null) .appendIf("parent_id", parentId); String tailUrl = GitlabGroup.URL + query.toString(); return dispatch().to(tailUrl, GitlabGroup.class); }
[ "public", "GitlabGroup", "createGroup", "(", "String", "name", ",", "String", "path", ",", "String", "ldapCn", ",", "GitlabAccessLevel", "ldapAccess", ",", "GitlabUser", "sudoUser", ",", "Integer", "parentId", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "append", "(", "\"name\"", ",", "name", ")", ".", "append", "(", "\"path\"", ",", "path", ")", ".", "appendIf", "(", "\"ldap_cn\"", ",", "ldapCn", ")", ".", "appendIf", "(", "\"ldap_access\"", ",", "ldapAccess", ")", ".", "appendIf", "(", "PARAM_SUDO", ",", "sudoUser", "!=", "null", "?", "sudoUser", ".", "getId", "(", ")", ":", "null", ")", ".", "appendIf", "(", "\"parent_id\"", ",", "parentId", ")", ";", "String", "tailUrl", "=", "GitlabGroup", ".", "URL", "+", "query", ".", "toString", "(", ")", ";", "return", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabGroup", ".", "class", ")", ";", "}" ]
Creates a Group @param name The name of the group @param path The path for the group @param ldapCn LDAP Group Name to sync with, null otherwise @param ldapAccess Access level for LDAP group members, null otherwise @param sudoUser The user to create the group on behalf of @param parentId The id of a parent group; the new group will be its subgroup @return The GitLab Group @throws IOException on gitlab api call error
[ "Creates", "a", "Group" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L636-L649
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/FieldMap.java
FieldMap.createEnterpriseCustomFieldMap
public void createEnterpriseCustomFieldMap(Props props, Class<?> c) { """ Create a field map for enterprise custom fields. @param props props data @param c target class """ byte[] fieldMapData = null; for (Integer key : ENTERPRISE_CUSTOM_KEYS) { fieldMapData = props.getByteArray(key); if (fieldMapData != null) { break; } } if (fieldMapData != null) { int index = 4; while (index < fieldMapData.length) { //Looks like the custom fields have varying types, it may be that the last byte of the four represents the type? //System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false)); int typeValue = MPPUtility.getInt(fieldMapData, index); FieldType type = getFieldType(typeValue); if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field")) { int varDataKey = (typeValue & 0xFFFF); FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0); m_map.put(type, item); //System.out.println(item); } //System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue)); index += 4; } } }
java
public void createEnterpriseCustomFieldMap(Props props, Class<?> c) { byte[] fieldMapData = null; for (Integer key : ENTERPRISE_CUSTOM_KEYS) { fieldMapData = props.getByteArray(key); if (fieldMapData != null) { break; } } if (fieldMapData != null) { int index = 4; while (index < fieldMapData.length) { //Looks like the custom fields have varying types, it may be that the last byte of the four represents the type? //System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false)); int typeValue = MPPUtility.getInt(fieldMapData, index); FieldType type = getFieldType(typeValue); if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field")) { int varDataKey = (typeValue & 0xFFFF); FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0); m_map.put(type, item); //System.out.println(item); } //System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue)); index += 4; } } }
[ "public", "void", "createEnterpriseCustomFieldMap", "(", "Props", "props", ",", "Class", "<", "?", ">", "c", ")", "{", "byte", "[", "]", "fieldMapData", "=", "null", ";", "for", "(", "Integer", "key", ":", "ENTERPRISE_CUSTOM_KEYS", ")", "{", "fieldMapData", "=", "props", ".", "getByteArray", "(", "key", ")", ";", "if", "(", "fieldMapData", "!=", "null", ")", "{", "break", ";", "}", "}", "if", "(", "fieldMapData", "!=", "null", ")", "{", "int", "index", "=", "4", ";", "while", "(", "index", "<", "fieldMapData", ".", "length", ")", "{", "//Looks like the custom fields have varying types, it may be that the last byte of the four represents the type?", "//System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false));", "int", "typeValue", "=", "MPPUtility", ".", "getInt", "(", "fieldMapData", ",", "index", ")", ";", "FieldType", "type", "=", "getFieldType", "(", "typeValue", ")", ";", "if", "(", "type", "!=", "null", "&&", "type", ".", "getClass", "(", ")", "==", "c", "&&", "type", ".", "toString", "(", ")", ".", "startsWith", "(", "\"Enterprise Custom Field\"", ")", ")", "{", "int", "varDataKey", "=", "(", "typeValue", "&", "0xFFFF", ")", ";", "FieldItem", "item", "=", "new", "FieldItem", "(", "type", ",", "FieldLocation", ".", "VAR_DATA", ",", "0", ",", "0", ",", "varDataKey", ",", "0", ",", "0", ")", ";", "m_map", ".", "put", "(", "type", ",", "item", ")", ";", "//System.out.println(item);", "}", "//System.out.println((type == null ? \"?\" : type.getClass().getSimpleName() + \".\" + type) + \" \" + Integer.toHexString(typeValue));", "index", "+=", "4", ";", "}", "}", "}" ]
Create a field map for enterprise custom fields. @param props props data @param c target class
[ "Create", "a", "field", "map", "for", "enterprise", "custom", "fields", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L316-L349
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java
SessionManagerUtil.parseHaSipSessionKey
public static SipSessionKey parseHaSipSessionKey( String sipSessionKey, String sipAppSessionId, String sipApplicationName) throws ParseException { """ Parse a sip application key that was previously generated and put as an http request param through the encodeURL method of SipApplicationSession @param sipSessionKey the stringified version of the sip application key @return the corresponding sip application session key @throws ParseException if the stringfied key cannot be parse to a valid key """ if(logger.isDebugEnabled()) { logger.debug("parseHaSipSessionKey - sipSessionKey=" + sipSessionKey + ", sipAppSessionId=" + sipAppSessionId + ", sipApplicationName=" + sipApplicationName); } StringTokenizer stringTokenizer = new StringTokenizer(sipSessionKey, SESSION_KEY_SEPARATOR); String fromTag = stringTokenizer.nextToken(); String callId = stringTokenizer.nextToken(); return new SipSessionKey(fromTag, null, callId, sipAppSessionId, sipApplicationName); }
java
public static SipSessionKey parseHaSipSessionKey( String sipSessionKey, String sipAppSessionId, String sipApplicationName) throws ParseException { if(logger.isDebugEnabled()) { logger.debug("parseHaSipSessionKey - sipSessionKey=" + sipSessionKey + ", sipAppSessionId=" + sipAppSessionId + ", sipApplicationName=" + sipApplicationName); } StringTokenizer stringTokenizer = new StringTokenizer(sipSessionKey, SESSION_KEY_SEPARATOR); String fromTag = stringTokenizer.nextToken(); String callId = stringTokenizer.nextToken(); return new SipSessionKey(fromTag, null, callId, sipAppSessionId, sipApplicationName); }
[ "public", "static", "SipSessionKey", "parseHaSipSessionKey", "(", "String", "sipSessionKey", ",", "String", "sipAppSessionId", ",", "String", "sipApplicationName", ")", "throws", "ParseException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"parseHaSipSessionKey - sipSessionKey=\"", "+", "sipSessionKey", "+", "\", sipAppSessionId=\"", "+", "sipAppSessionId", "+", "\", sipApplicationName=\"", "+", "sipApplicationName", ")", ";", "}", "StringTokenizer", "stringTokenizer", "=", "new", "StringTokenizer", "(", "sipSessionKey", ",", "SESSION_KEY_SEPARATOR", ")", ";", "String", "fromTag", "=", "stringTokenizer", ".", "nextToken", "(", ")", ";", "String", "callId", "=", "stringTokenizer", ".", "nextToken", "(", ")", ";", "return", "new", "SipSessionKey", "(", "fromTag", ",", "null", ",", "callId", ",", "sipAppSessionId", ",", "sipApplicationName", ")", ";", "}" ]
Parse a sip application key that was previously generated and put as an http request param through the encodeURL method of SipApplicationSession @param sipSessionKey the stringified version of the sip application key @return the corresponding sip application session key @throws ParseException if the stringfied key cannot be parse to a valid key
[ "Parse", "a", "sip", "application", "key", "that", "was", "previously", "generated", "and", "put", "as", "an", "http", "request", "param", "through", "the", "encodeURL", "method", "of", "SipApplicationSession" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java#L208-L219
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/util/SolutionListUtils.java
SolutionListUtils.selectNRandomDifferentSolutions
public static <S> List<S> selectNRandomDifferentSolutions( int numberOfSolutionsToBeReturned, List<S> solutionList) { """ This method receives a normalized list of non-dominated solutions and return the inverted one. This operation is needed for minimization problem @param solutionList The front to invert @return The inverted front """ JMetalRandom random = JMetalRandom.getInstance(); return selectNRandomDifferentSolutions(numberOfSolutionsToBeReturned, solutionList, (low, up) -> random.nextInt(low, up)); }
java
public static <S> List<S> selectNRandomDifferentSolutions( int numberOfSolutionsToBeReturned, List<S> solutionList) { JMetalRandom random = JMetalRandom.getInstance(); return selectNRandomDifferentSolutions(numberOfSolutionsToBeReturned, solutionList, (low, up) -> random.nextInt(low, up)); }
[ "public", "static", "<", "S", ">", "List", "<", "S", ">", "selectNRandomDifferentSolutions", "(", "int", "numberOfSolutionsToBeReturned", ",", "List", "<", "S", ">", "solutionList", ")", "{", "JMetalRandom", "random", "=", "JMetalRandom", ".", "getInstance", "(", ")", ";", "return", "selectNRandomDifferentSolutions", "(", "numberOfSolutionsToBeReturned", ",", "solutionList", ",", "(", "low", ",", "up", ")", "->", "random", ".", "nextInt", "(", "low", ",", "up", ")", ")", ";", "}" ]
This method receives a normalized list of non-dominated solutions and return the inverted one. This operation is needed for minimization problem @param solutionList The front to invert @return The inverted front
[ "This", "method", "receives", "a", "normalized", "list", "of", "non", "-", "dominated", "solutions", "and", "return", "the", "inverted", "one", ".", "This", "operation", "is", "needed", "for", "minimization", "problem" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionListUtils.java#L198-L202
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/TableFormBuilder.java
TableFormBuilder.addBinding
public JComponent[] addBinding(Binding binding, JComponent wrappedControl, String attributes) { """ adds a field binding to the form @param binding the binding of the field @param wrappedControl the optional wrapped component. If null the component of the binding is used. This Parameter should be used if the component of the binding is being wrapped inside this component @param attributes optional layout attributes for the label. If null no layout attributes will be applied to the label. See {@link TableLayoutBuilder} for syntax details @return an array containing the label, the component of the field binding and the wrapped component """ return addBinding(binding, wrappedControl, attributes, getLabelAttributes()); }
java
public JComponent[] addBinding(Binding binding, JComponent wrappedControl, String attributes) { return addBinding(binding, wrappedControl, attributes, getLabelAttributes()); }
[ "public", "JComponent", "[", "]", "addBinding", "(", "Binding", "binding", ",", "JComponent", "wrappedControl", ",", "String", "attributes", ")", "{", "return", "addBinding", "(", "binding", ",", "wrappedControl", ",", "attributes", ",", "getLabelAttributes", "(", ")", ")", ";", "}" ]
adds a field binding to the form @param binding the binding of the field @param wrappedControl the optional wrapped component. If null the component of the binding is used. This Parameter should be used if the component of the binding is being wrapped inside this component @param attributes optional layout attributes for the label. If null no layout attributes will be applied to the label. See {@link TableLayoutBuilder} for syntax details @return an array containing the label, the component of the field binding and the wrapped component
[ "adds", "a", "field", "binding", "to", "the", "form" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/TableFormBuilder.java#L411-L413
networknt/light-4j
consul/src/main/java/com/networknt/consul/ConsulUtils.java
ConsulUtils.isSame
public static boolean isSame(List<URL> urls1, List<URL> urls2) { """ Check if two lists have the same urls. If any list is empty, return false @param urls1 first url list @param urls2 second url list @return boolean true when they are the same """ if (urls1 == null || urls2 == null) { return false; } if (urls1.size() != urls2.size()) { return false; } return urls1.containsAll(urls2); }
java
public static boolean isSame(List<URL> urls1, List<URL> urls2) { if (urls1 == null || urls2 == null) { return false; } if (urls1.size() != urls2.size()) { return false; } return urls1.containsAll(urls2); }
[ "public", "static", "boolean", "isSame", "(", "List", "<", "URL", ">", "urls1", ",", "List", "<", "URL", ">", "urls2", ")", "{", "if", "(", "urls1", "==", "null", "||", "urls2", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "urls1", ".", "size", "(", ")", "!=", "urls2", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "return", "urls1", ".", "containsAll", "(", "urls2", ")", ";", "}" ]
Check if two lists have the same urls. If any list is empty, return false @param urls1 first url list @param urls2 second url list @return boolean true when they are the same
[ "Check", "if", "two", "lists", "have", "the", "same", "urls", ".", "If", "any", "list", "is", "empty", "return", "false" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L38-L46
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java
ToStream.startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { """ Begin the scope of a prefix-URI Namespace mapping just before another element is about to start. This call will close any open tags so that the prefix mapping will not apply to the current element, but the up comming child. @see org.xml.sax.ContentHandler#startPrefixMapping @param prefix The Namespace prefix being declared. @param uri The Namespace URI the prefix is mapped to. @throws org.xml.sax.SAXException The client may throw an exception during processing. """ // the "true" causes the flush of any open tags startPrefixMapping(prefix, uri, true); }
java
public void startPrefixMapping(String prefix, String uri) throws org.xml.sax.SAXException { // the "true" causes the flush of any open tags startPrefixMapping(prefix, uri, true); }
[ "public", "void", "startPrefixMapping", "(", "String", "prefix", ",", "String", "uri", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "// the \"true\" causes the flush of any open tags", "startPrefixMapping", "(", "prefix", ",", "uri", ",", "true", ")", ";", "}" ]
Begin the scope of a prefix-URI Namespace mapping just before another element is about to start. This call will close any open tags so that the prefix mapping will not apply to the current element, but the up comming child. @see org.xml.sax.ContentHandler#startPrefixMapping @param prefix The Namespace prefix being declared. @param uri The Namespace URI the prefix is mapped to. @throws org.xml.sax.SAXException The client may throw an exception during processing.
[ "Begin", "the", "scope", "of", "a", "prefix", "-", "URI", "Namespace", "mapping", "just", "before", "another", "element", "is", "about", "to", "start", ".", "This", "call", "will", "close", "any", "open", "tags", "so", "that", "the", "prefix", "mapping", "will", "not", "apply", "to", "the", "current", "element", "but", "the", "up", "comming", "child", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2295-L2300
kiswanij/jk-util
src/main/java/com/jk/util/JKHttpUtil.java
JKHttpUtil.requestUrl
public static String requestUrl(final String url, final String method, final Properties header, final String body) { """ Send http request. @param url the url @param method the method @param header the header @param body the body @return the string """ try { final URL siteUrl = new URL(url); final HttpURLConnection connection = (HttpURLConnection) siteUrl.openConnection(); connection.setRequestMethod(method); final Enumeration<?> keys = header.keys(); while (keys.hasMoreElements()) { final String key = (String) keys.nextElement(); connection.addRequestProperty(key, header.getProperty(key)); } connection.setDoOutput(true); final OutputStream out = connection.getOutputStream(); out.write(body.getBytes()); connection.connect(); final int errorCode = connection.getResponseCode(); if (errorCode != HttpURLConnection.HTTP_OK) { throw new JKHttpException(connection.getResponseMessage(), errorCode); } final String response = JKIOUtil.convertToString(connection.getInputStream()); return response; } catch (IOException e) { throw new JKHttpException(e); } }
java
public static String requestUrl(final String url, final String method, final Properties header, final String body) { try { final URL siteUrl = new URL(url); final HttpURLConnection connection = (HttpURLConnection) siteUrl.openConnection(); connection.setRequestMethod(method); final Enumeration<?> keys = header.keys(); while (keys.hasMoreElements()) { final String key = (String) keys.nextElement(); connection.addRequestProperty(key, header.getProperty(key)); } connection.setDoOutput(true); final OutputStream out = connection.getOutputStream(); out.write(body.getBytes()); connection.connect(); final int errorCode = connection.getResponseCode(); if (errorCode != HttpURLConnection.HTTP_OK) { throw new JKHttpException(connection.getResponseMessage(), errorCode); } final String response = JKIOUtil.convertToString(connection.getInputStream()); return response; } catch (IOException e) { throw new JKHttpException(e); } }
[ "public", "static", "String", "requestUrl", "(", "final", "String", "url", ",", "final", "String", "method", ",", "final", "Properties", "header", ",", "final", "String", "body", ")", "{", "try", "{", "final", "URL", "siteUrl", "=", "new", "URL", "(", "url", ")", ";", "final", "HttpURLConnection", "connection", "=", "(", "HttpURLConnection", ")", "siteUrl", ".", "openConnection", "(", ")", ";", "connection", ".", "setRequestMethod", "(", "method", ")", ";", "final", "Enumeration", "<", "?", ">", "keys", "=", "header", ".", "keys", "(", ")", ";", "while", "(", "keys", ".", "hasMoreElements", "(", ")", ")", "{", "final", "String", "key", "=", "(", "String", ")", "keys", ".", "nextElement", "(", ")", ";", "connection", ".", "addRequestProperty", "(", "key", ",", "header", ".", "getProperty", "(", "key", ")", ")", ";", "}", "connection", ".", "setDoOutput", "(", "true", ")", ";", "final", "OutputStream", "out", "=", "connection", ".", "getOutputStream", "(", ")", ";", "out", ".", "write", "(", "body", ".", "getBytes", "(", ")", ")", ";", "connection", ".", "connect", "(", ")", ";", "final", "int", "errorCode", "=", "connection", ".", "getResponseCode", "(", ")", ";", "if", "(", "errorCode", "!=", "HttpURLConnection", ".", "HTTP_OK", ")", "{", "throw", "new", "JKHttpException", "(", "connection", ".", "getResponseMessage", "(", ")", ",", "errorCode", ")", ";", "}", "final", "String", "response", "=", "JKIOUtil", ".", "convertToString", "(", "connection", ".", "getInputStream", "(", ")", ")", ";", "return", "response", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JKHttpException", "(", "e", ")", ";", "}", "}" ]
Send http request. @param url the url @param method the method @param header the header @param body the body @return the string
[ "Send", "http", "request", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L98-L124
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java
CliUtils.executeCommandLine
public static CliOutput executeCommandLine(final Commandline cli, final String loggerName, final String logMessagePrefix, final InputStream inputStream, final int timeoutInSeconds) { """ Executes the specified command line and blocks until the process has finished or till the timeout is reached. The output of the process is captured, returned, as well as logged with info (stdout) and error (stderr) level, respectively. @param cli the command line @param loggerName the name of the logger to use (passed to {@link LoggerFactory#getLogger(String)}); if {@code null} this class' name is used @param logMessagePrefix if non-{@code null} consumed lines are prefix with this string @param inputStream the process input to read from, must be thread safe @param timeoutInSeconds a positive integer to specify timeout, zero and negative integers for no timeout @return the process' output """ try { String cliString = CommandLineUtils.toString(cli.getShellCommandline()); LOGGER.info("Executing command-line: {}", cliString); LoggingStreamConsumer stdOut = new LoggingStreamConsumer(loggerName, logMessagePrefix, false); LoggingStreamConsumer stdErr = new LoggingStreamConsumer(loggerName, logMessagePrefix, true); int exitCode = CommandLineUtils.executeCommandLine(cli, inputStream, stdOut, stdErr, timeoutInSeconds); return new CliOutput(stdOut.getOutput(), stdErr.getOutput(), exitCode); } catch (CommandLineException ex) { throw new CliException("Error executing command-line process.", ex); } }
java
public static CliOutput executeCommandLine(final Commandline cli, final String loggerName, final String logMessagePrefix, final InputStream inputStream, final int timeoutInSeconds) { try { String cliString = CommandLineUtils.toString(cli.getShellCommandline()); LOGGER.info("Executing command-line: {}", cliString); LoggingStreamConsumer stdOut = new LoggingStreamConsumer(loggerName, logMessagePrefix, false); LoggingStreamConsumer stdErr = new LoggingStreamConsumer(loggerName, logMessagePrefix, true); int exitCode = CommandLineUtils.executeCommandLine(cli, inputStream, stdOut, stdErr, timeoutInSeconds); return new CliOutput(stdOut.getOutput(), stdErr.getOutput(), exitCode); } catch (CommandLineException ex) { throw new CliException("Error executing command-line process.", ex); } }
[ "public", "static", "CliOutput", "executeCommandLine", "(", "final", "Commandline", "cli", ",", "final", "String", "loggerName", ",", "final", "String", "logMessagePrefix", ",", "final", "InputStream", "inputStream", ",", "final", "int", "timeoutInSeconds", ")", "{", "try", "{", "String", "cliString", "=", "CommandLineUtils", ".", "toString", "(", "cli", ".", "getShellCommandline", "(", ")", ")", ";", "LOGGER", ".", "info", "(", "\"Executing command-line: {}\"", ",", "cliString", ")", ";", "LoggingStreamConsumer", "stdOut", "=", "new", "LoggingStreamConsumer", "(", "loggerName", ",", "logMessagePrefix", ",", "false", ")", ";", "LoggingStreamConsumer", "stdErr", "=", "new", "LoggingStreamConsumer", "(", "loggerName", ",", "logMessagePrefix", ",", "true", ")", ";", "int", "exitCode", "=", "CommandLineUtils", ".", "executeCommandLine", "(", "cli", ",", "inputStream", ",", "stdOut", ",", "stdErr", ",", "timeoutInSeconds", ")", ";", "return", "new", "CliOutput", "(", "stdOut", ".", "getOutput", "(", ")", ",", "stdErr", ".", "getOutput", "(", ")", ",", "exitCode", ")", ";", "}", "catch", "(", "CommandLineException", "ex", ")", "{", "throw", "new", "CliException", "(", "\"Error executing command-line process.\"", ",", "ex", ")", ";", "}", "}" ]
Executes the specified command line and blocks until the process has finished or till the timeout is reached. The output of the process is captured, returned, as well as logged with info (stdout) and error (stderr) level, respectively. @param cli the command line @param loggerName the name of the logger to use (passed to {@link LoggerFactory#getLogger(String)}); if {@code null} this class' name is used @param logMessagePrefix if non-{@code null} consumed lines are prefix with this string @param inputStream the process input to read from, must be thread safe @param timeoutInSeconds a positive integer to specify timeout, zero and negative integers for no timeout @return the process' output
[ "Executes", "the", "specified", "command", "line", "and", "blocks", "until", "the", "process", "has", "finished", "or", "till", "the", "timeout", "is", "reached", ".", "The", "output", "of", "the", "process", "is", "captured", "returned", "as", "well", "as", "logged", "with", "info", "(", "stdout", ")", "and", "error", "(", "stderr", ")", "level", "respectively", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java#L153-L167
mojohaus/mrm
mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/DiskFileSystem.java
DiskFileSystem.toFile
private File toFile( Entry entry ) { """ Convert an entry into the corresponding file path. @param entry the entry. @return the corresponding file. @since 1.0 """ Stack<String> stack = new Stack<String>(); Entry entryRoot = entry.getFileSystem().getRoot(); while ( entry != null && !entryRoot.equals( entry ) ) { String name = entry.getName(); if ( "..".equals( name ) ) { if ( !stack.isEmpty() ) { stack.pop(); } } else if ( !".".equals( name ) ) { stack.push( name ); } entry = entry.getParent(); } File file = this.root; while ( !stack.empty() ) { file = new File( file, (String) stack.pop() ); } return file; }
java
private File toFile( Entry entry ) { Stack<String> stack = new Stack<String>(); Entry entryRoot = entry.getFileSystem().getRoot(); while ( entry != null && !entryRoot.equals( entry ) ) { String name = entry.getName(); if ( "..".equals( name ) ) { if ( !stack.isEmpty() ) { stack.pop(); } } else if ( !".".equals( name ) ) { stack.push( name ); } entry = entry.getParent(); } File file = this.root; while ( !stack.empty() ) { file = new File( file, (String) stack.pop() ); } return file; }
[ "private", "File", "toFile", "(", "Entry", "entry", ")", "{", "Stack", "<", "String", ">", "stack", "=", "new", "Stack", "<", "String", ">", "(", ")", ";", "Entry", "entryRoot", "=", "entry", ".", "getFileSystem", "(", ")", ".", "getRoot", "(", ")", ";", "while", "(", "entry", "!=", "null", "&&", "!", "entryRoot", ".", "equals", "(", "entry", ")", ")", "{", "String", "name", "=", "entry", ".", "getName", "(", ")", ";", "if", "(", "\"..\"", ".", "equals", "(", "name", ")", ")", "{", "if", "(", "!", "stack", ".", "isEmpty", "(", ")", ")", "{", "stack", ".", "pop", "(", ")", ";", "}", "}", "else", "if", "(", "!", "\".\"", ".", "equals", "(", "name", ")", ")", "{", "stack", ".", "push", "(", "name", ")", ";", "}", "entry", "=", "entry", ".", "getParent", "(", ")", ";", "}", "File", "file", "=", "this", ".", "root", ";", "while", "(", "!", "stack", ".", "empty", "(", ")", ")", "{", "file", "=", "new", "File", "(", "file", ",", "(", "String", ")", "stack", ".", "pop", "(", ")", ")", ";", "}", "return", "file", ";", "}" ]
Convert an entry into the corresponding file path. @param entry the entry. @return the corresponding file. @since 1.0
[ "Convert", "an", "entry", "into", "the", "corresponding", "file", "path", "." ]
train
https://github.com/mojohaus/mrm/blob/ecbe54a1866f210c10bf2e9274b63d4804d6a151/mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/DiskFileSystem.java#L120-L146
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupDb.java
CmsSetupDb.updateDatabase
public void updateDatabase(String updateScript, Map<String, String> replacers) { """ Calls an update script.<p> @param updateScript the update script code @param replacers the replacers to use in the script code """ StringReader reader = new StringReader(updateScript); executeSql(reader, replacers, true); }
java
public void updateDatabase(String updateScript, Map<String, String> replacers) { StringReader reader = new StringReader(updateScript); executeSql(reader, replacers, true); }
[ "public", "void", "updateDatabase", "(", "String", "updateScript", ",", "Map", "<", "String", ",", "String", ">", "replacers", ")", "{", "StringReader", "reader", "=", "new", "StringReader", "(", "updateScript", ")", ";", "executeSql", "(", "reader", ",", "replacers", ",", "true", ")", ";", "}" ]
Calls an update script.<p> @param updateScript the update script code @param replacers the replacers to use in the script code
[ "Calls", "an", "update", "script", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L540-L544
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.getValue
public static <T> T getValue(Object target, String dPath, Class<T> clazz) { """ Extract a value from the target object using DPath expression (generic version). @param target @param dPath @param clazz @return """ if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } Object temp = getValue(target, dPath); return ValueUtils.convertValue(temp, clazz); }
java
public static <T> T getValue(Object target, String dPath, Class<T> clazz) { if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } Object temp = getValue(target, dPath); return ValueUtils.convertValue(temp, clazz); }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "Object", "target", ",", "String", "dPath", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Class parameter is null!\"", ")", ";", "}", "Object", "temp", "=", "getValue", "(", "target", ",", "dPath", ")", ";", "return", "ValueUtils", ".", "convertValue", "(", "temp", ",", "clazz", ")", ";", "}" ]
Extract a value from the target object using DPath expression (generic version). @param target @param dPath @param clazz @return
[ "Extract", "a", "value", "from", "the", "target", "object", "using", "DPath", "expression", "(", "generic", "version", ")", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L383-L389
pressgang-ccms/PressGangCCMSDatasourceProviders
rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTDataProvider.java
RESTDataProvider.getExpansion
protected ExpandDataTrunk getExpansion(final String expansionName, final Map<String, Collection<String>> subExpansionNames) { """ Create an expansion with sub expansions. @param expansionName The name of the root expansion. @param subExpansionNames The list of names to create the branches from. @return The expansion with the branches set. """ final ExpandDataTrunk expandData = new ExpandDataTrunk(new ExpandDataDetails(expansionName)); // Add the sub expansions expandData.setBranches(getExpansionBranches(subExpansionNames)); return expandData; }
java
protected ExpandDataTrunk getExpansion(final String expansionName, final Map<String, Collection<String>> subExpansionNames) { final ExpandDataTrunk expandData = new ExpandDataTrunk(new ExpandDataDetails(expansionName)); // Add the sub expansions expandData.setBranches(getExpansionBranches(subExpansionNames)); return expandData; }
[ "protected", "ExpandDataTrunk", "getExpansion", "(", "final", "String", "expansionName", ",", "final", "Map", "<", "String", ",", "Collection", "<", "String", ">", ">", "subExpansionNames", ")", "{", "final", "ExpandDataTrunk", "expandData", "=", "new", "ExpandDataTrunk", "(", "new", "ExpandDataDetails", "(", "expansionName", ")", ")", ";", "// Add the sub expansions", "expandData", ".", "setBranches", "(", "getExpansionBranches", "(", "subExpansionNames", ")", ")", ";", "return", "expandData", ";", "}" ]
Create an expansion with sub expansions. @param expansionName The name of the root expansion. @param subExpansionNames The list of names to create the branches from. @return The expansion with the branches set.
[ "Create", "an", "expansion", "with", "sub", "expansions", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSDatasourceProviders/blob/e47588adad0dcd55608b197b37825a512bc8fd25/rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTDataProvider.java#L241-L246
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.readResponse
@SuppressWarnings("unchecked") public <T> T readResponse(Class<T> clazz, InputStream input) throws Throwable { """ Reads a JSON-PRC response from the server. This blocks until a response is received. @param clazz the expected return type @param input the {@link InputStream} to read from @param <T> the expected return type @return the object returned by the JSON-RPC response @throws Throwable on error """ return (T) readResponse((Type) clazz, input); }
java
@SuppressWarnings("unchecked") public <T> T readResponse(Class<T> clazz, InputStream input) throws Throwable { return (T) readResponse((Type) clazz, input); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "readResponse", "(", "Class", "<", "T", ">", "clazz", ",", "InputStream", "input", ")", "throws", "Throwable", "{", "return", "(", "T", ")", "readResponse", "(", "(", "Type", ")", "clazz", ",", "input", ")", ";", "}" ]
Reads a JSON-PRC response from the server. This blocks until a response is received. @param clazz the expected return type @param input the {@link InputStream} to read from @param <T> the expected return type @return the object returned by the JSON-RPC response @throws Throwable on error
[ "Reads", "a", "JSON", "-", "PRC", "response", "from", "the", "server", ".", "This", "blocks", "until", "a", "response", "is", "received", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L516-L519
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java
CmsEntityWrapper.insertAttributeValueEntity
public void insertAttributeValueEntity(String attributeName, CmsEntityWrapper value, int index) { """ Wrapper method.<p> @param attributeName parameter for the wrapped method @param value parameter for the wrapped method @param index parameter for the wrapped method """ m_entity.insertAttributeValue(attributeName, value.getEntity(), index); }
java
public void insertAttributeValueEntity(String attributeName, CmsEntityWrapper value, int index) { m_entity.insertAttributeValue(attributeName, value.getEntity(), index); }
[ "public", "void", "insertAttributeValueEntity", "(", "String", "attributeName", ",", "CmsEntityWrapper", "value", ",", "int", "index", ")", "{", "m_entity", ".", "insertAttributeValue", "(", "attributeName", ",", "value", ".", "getEntity", "(", ")", ",", "index", ")", ";", "}" ]
Wrapper method.<p> @param attributeName parameter for the wrapped method @param value parameter for the wrapped method @param index parameter for the wrapped method
[ "Wrapper", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/export/CmsEntityWrapper.java#L154-L157
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/RawCursor.java
RawCursor.compareKeysPartially
protected int compareKeysPartially(byte[] key1, byte[] key2) { """ Returns {@literal <0} if key1 is less, 0 if equal (at least partially), {@literal >0} if key1 is greater. """ int length = Math.min(key1.length, key2.length); for (int i=0; i<length; i++) { int a1 = key1[i]; int a2 = key2[i]; if (a1 != a2) { return (a1 & 0xff) - (a2 & 0xff); } } return 0; }
java
protected int compareKeysPartially(byte[] key1, byte[] key2) { int length = Math.min(key1.length, key2.length); for (int i=0; i<length; i++) { int a1 = key1[i]; int a2 = key2[i]; if (a1 != a2) { return (a1 & 0xff) - (a2 & 0xff); } } return 0; }
[ "protected", "int", "compareKeysPartially", "(", "byte", "[", "]", "key1", ",", "byte", "[", "]", "key2", ")", "{", "int", "length", "=", "Math", ".", "min", "(", "key1", ".", "length", ",", "key2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "int", "a1", "=", "key1", "[", "i", "]", ";", "int", "a2", "=", "key2", "[", "i", "]", ";", "if", "(", "a1", "!=", "a2", ")", "{", "return", "(", "a1", "&", "0xff", ")", "-", "(", "a2", "&", "0xff", ")", ";", "}", "}", "return", "0", ";", "}" ]
Returns {@literal <0} if key1 is less, 0 if equal (at least partially), {@literal >0} if key1 is greater.
[ "Returns", "{" ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/RawCursor.java#L502-L512
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listKeyVersions
public PagedList<KeyItem> listKeyVersions(final String vaultBaseUrl, final String keyName) { """ Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. Authorization: Requires the keys/list permission. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param keyName The name of the key @return the PagedList&lt;KeyItem&gt; if successful. """ return getKeyVersions(vaultBaseUrl, keyName); }
java
public PagedList<KeyItem> listKeyVersions(final String vaultBaseUrl, final String keyName) { return getKeyVersions(vaultBaseUrl, keyName); }
[ "public", "PagedList", "<", "KeyItem", ">", "listKeyVersions", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "keyName", ")", "{", "return", "getKeyVersions", "(", "vaultBaseUrl", ",", "keyName", ")", ";", "}" ]
Retrieves a list of individual key versions with the same key name. The full key identifier, attributes, and tags are provided in the response. Authorization: Requires the keys/list permission. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param keyName The name of the key @return the PagedList&lt;KeyItem&gt; if successful.
[ "Retrieves", "a", "list", "of", "individual", "key", "versions", "with", "the", "same", "key", "name", ".", "The", "full", "key", "identifier", "attributes", "and", "tags", "are", "provided", "in", "the", "response", ".", "Authorization", ":", "Requires", "the", "keys", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L687-L689
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeInVertexLabel
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { """ remove a vertex label from the in collection @param lbl the vertex label @param preserveData should we keep the sql data? """ this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
java
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
[ "void", "removeInVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedInVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", "getFullName", "(", ")", "+", "Topology", ".", "IN_VERTEX_COLUMN_END", ")", ";", "}", "}" ]
remove a vertex label from the in collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "in", "collection" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1245-L1250
ontop/ontop
core/model/src/main/java/it/unibz/inf/ontop/dbschema/QuotedID.java
QuotedID.createIdFromDatabaseRecord
public static QuotedID createIdFromDatabaseRecord(QuotedIDFactory idfac, String s) { """ creates attribute ID from the database record (as though it is a quoted name) @param s @return """ // ID is as though it is quoted -- DB stores names as is return new QuotedID(s, idfac.getIDQuotationString()); }
java
public static QuotedID createIdFromDatabaseRecord(QuotedIDFactory idfac, String s) { // ID is as though it is quoted -- DB stores names as is return new QuotedID(s, idfac.getIDQuotationString()); }
[ "public", "static", "QuotedID", "createIdFromDatabaseRecord", "(", "QuotedIDFactory", "idfac", ",", "String", "s", ")", "{", "// ID is as though it is quoted -- DB stores names as is ", "return", "new", "QuotedID", "(", "s", ",", "idfac", ".", "getIDQuotationString", "(", ")", ")", ";", "}" ]
creates attribute ID from the database record (as though it is a quoted name) @param s @return
[ "creates", "attribute", "ID", "from", "the", "database", "record", "(", "as", "though", "it", "is", "a", "quoted", "name", ")" ]
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/dbschema/QuotedID.java#L74-L77
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java
SVGIcon.startForegroundIconRotateAnimation
public void startForegroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) { """ Method starts the rotate animation of the foreground icon. @param fromAngle the rotation angle where the transition should start. @param toAngle the rotation angle where the transition should end. @param cycleCount the number of times the animation should be played (use Animation.INDEFINITE for endless). @param duration the duration which one animation cycle should take. @param interpolator defines the rotation value interpolation between {@code fromAngle} and {@code toAngle}. @param autoReverse defines if the animation should be reversed at the end. """ stopForegroundIconRotateAnimation(); foregroundRotateAnimation = Animations.createRotateTransition(foregroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse); foregroundRotateAnimation.setOnFinished(event -> foregroundIcon.setRotate(0)); foregroundRotateAnimation.play(); }
java
public void startForegroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) { stopForegroundIconRotateAnimation(); foregroundRotateAnimation = Animations.createRotateTransition(foregroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse); foregroundRotateAnimation.setOnFinished(event -> foregroundIcon.setRotate(0)); foregroundRotateAnimation.play(); }
[ "public", "void", "startForegroundIconRotateAnimation", "(", "final", "double", "fromAngle", ",", "final", "double", "toAngle", ",", "final", "int", "cycleCount", ",", "final", "double", "duration", ",", "final", "Interpolator", "interpolator", ",", "final", "boolean", "autoReverse", ")", "{", "stopForegroundIconRotateAnimation", "(", ")", ";", "foregroundRotateAnimation", "=", "Animations", ".", "createRotateTransition", "(", "foregroundIcon", ",", "fromAngle", ",", "toAngle", ",", "cycleCount", ",", "duration", ",", "interpolator", ",", "autoReverse", ")", ";", "foregroundRotateAnimation", ".", "setOnFinished", "(", "event", "->", "foregroundIcon", ".", "setRotate", "(", "0", ")", ")", ";", "foregroundRotateAnimation", ".", "play", "(", ")", ";", "}" ]
Method starts the rotate animation of the foreground icon. @param fromAngle the rotation angle where the transition should start. @param toAngle the rotation angle where the transition should end. @param cycleCount the number of times the animation should be played (use Animation.INDEFINITE for endless). @param duration the duration which one animation cycle should take. @param interpolator defines the rotation value interpolation between {@code fromAngle} and {@code toAngle}. @param autoReverse defines if the animation should be reversed at the end.
[ "Method", "starts", "the", "rotate", "animation", "of", "the", "foreground", "icon", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L359-L364
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/utils/DateUtil.java
DateUtil.parseXmlDate
public static Calendar parseXmlDate(String xsDate) throws ParseException { """ Parses an XML xs:date into a calendar object. @param xsDate an xs:date string @return a calendar object @throws ParseException thrown if the date cannot be converted to a calendar """ try { DatatypeFactory df = DatatypeFactory.newInstance(); XMLGregorianCalendar dateTime = df.newXMLGregorianCalendar(xsDate); return dateTime.toGregorianCalendar(); } catch (DatatypeConfigurationException ex) { throw new ParseException("Unable to parse " + xsDate, ex); } }
java
public static Calendar parseXmlDate(String xsDate) throws ParseException { try { DatatypeFactory df = DatatypeFactory.newInstance(); XMLGregorianCalendar dateTime = df.newXMLGregorianCalendar(xsDate); return dateTime.toGregorianCalendar(); } catch (DatatypeConfigurationException ex) { throw new ParseException("Unable to parse " + xsDate, ex); } }
[ "public", "static", "Calendar", "parseXmlDate", "(", "String", "xsDate", ")", "throws", "ParseException", "{", "try", "{", "DatatypeFactory", "df", "=", "DatatypeFactory", ".", "newInstance", "(", ")", ";", "XMLGregorianCalendar", "dateTime", "=", "df", ".", "newXMLGregorianCalendar", "(", "xsDate", ")", ";", "return", "dateTime", ".", "toGregorianCalendar", "(", ")", ";", "}", "catch", "(", "DatatypeConfigurationException", "ex", ")", "{", "throw", "new", "ParseException", "(", "\"Unable to parse \"", "+", "xsDate", ",", "ex", ")", ";", "}", "}" ]
Parses an XML xs:date into a calendar object. @param xsDate an xs:date string @return a calendar object @throws ParseException thrown if the date cannot be converted to a calendar
[ "Parses", "an", "XML", "xs", ":", "date", "into", "a", "calendar", "object", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/DateUtil.java#L47-L55
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.listContentKeysAsync
public Observable<ListContentKeysResponseInner> listContentKeysAsync(String resourceGroupName, String accountName, String streamingLocatorName) { """ List Content Keys. List Content Keys used by this Streaming Locator. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ListContentKeysResponseInner object """ return listContentKeysWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListContentKeysResponseInner>, ListContentKeysResponseInner>() { @Override public ListContentKeysResponseInner call(ServiceResponse<ListContentKeysResponseInner> response) { return response.body(); } }); }
java
public Observable<ListContentKeysResponseInner> listContentKeysAsync(String resourceGroupName, String accountName, String streamingLocatorName) { return listContentKeysWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<ListContentKeysResponseInner>, ListContentKeysResponseInner>() { @Override public ListContentKeysResponseInner call(ServiceResponse<ListContentKeysResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ListContentKeysResponseInner", ">", "listContentKeysAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingLocatorName", ")", "{", "return", "listContentKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "streamingLocatorName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ListContentKeysResponseInner", ">", ",", "ListContentKeysResponseInner", ">", "(", ")", "{", "@", "Override", "public", "ListContentKeysResponseInner", "call", "(", "ServiceResponse", "<", "ListContentKeysResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List Content Keys. List Content Keys used by this Streaming Locator. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingLocatorName The Streaming Locator name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ListContentKeysResponseInner object
[ "List", "Content", "Keys", ".", "List", "Content", "Keys", "used", "by", "this", "Streaming", "Locator", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L703-L710
aws/aws-sdk-java
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/SearchResult.java
SearchResult.withStats
public SearchResult withStats(java.util.Map<String, FieldStats> stats) { """ <p> The requested field statistics information. </p> @param stats The requested field statistics information. @return Returns a reference to this object so that method calls can be chained together. """ setStats(stats); return this; }
java
public SearchResult withStats(java.util.Map<String, FieldStats> stats) { setStats(stats); return this; }
[ "public", "SearchResult", "withStats", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "FieldStats", ">", "stats", ")", "{", "setStats", "(", "stats", ")", ";", "return", "this", ";", "}" ]
<p> The requested field statistics information. </p> @param stats The requested field statistics information. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "requested", "field", "statistics", "information", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/SearchResult.java#L234-L237
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadReuseExact
public static ReuseResult loadReuseExact(byte[] data, Bitmap dest) throws ImageLoadException { """ Loading bitmap with using reuse bitmap with the same size of source image. If it is unable to load with reuse method tries to load without it. Reuse works only in 3.0+ @param data image file contents @param dest reuse bitmap @return result of loading @throws ImageLoadException if it is unable to load file """ return loadBitmapReuseExact(new MemorySource(data), dest); }
java
public static ReuseResult loadReuseExact(byte[] data, Bitmap dest) throws ImageLoadException { return loadBitmapReuseExact(new MemorySource(data), dest); }
[ "public", "static", "ReuseResult", "loadReuseExact", "(", "byte", "[", "]", "data", ",", "Bitmap", "dest", ")", "throws", "ImageLoadException", "{", "return", "loadBitmapReuseExact", "(", "new", "MemorySource", "(", "data", ")", ",", "dest", ")", ";", "}" ]
Loading bitmap with using reuse bitmap with the same size of source image. If it is unable to load with reuse method tries to load without it. Reuse works only in 3.0+ @param data image file contents @param dest reuse bitmap @return result of loading @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "using", "reuse", "bitmap", "with", "the", "same", "size", "of", "source", "image", ".", "If", "it", "is", "unable", "to", "load", "with", "reuse", "method", "tries", "to", "load", "without", "it", ".", "Reuse", "works", "only", "in", "3", ".", "0", "+" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L173-L175
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/MergedClass.java
MergedClass.buildClassFile
public static ClassFile buildClassFile(String className, Class<?>[] classes, String[] prefixes) { """ Just create the bytecode for the merged class, but don't load it. Since no ClassInjector is provided to resolve name conflicts, the class name must be manually provided. @param className name to give to merged class @param classes Source classes used to derive merged class @param prefixes Optional prefixes to apply to methods of each generated class to eliminate duplicate method names """ return buildClassFile(className, classes, prefixes, null, OBSERVER_DISABLED); }
java
public static ClassFile buildClassFile(String className, Class<?>[] classes, String[] prefixes) { return buildClassFile(className, classes, prefixes, null, OBSERVER_DISABLED); }
[ "public", "static", "ClassFile", "buildClassFile", "(", "String", "className", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "String", "[", "]", "prefixes", ")", "{", "return", "buildClassFile", "(", "className", ",", "classes", ",", "prefixes", ",", "null", ",", "OBSERVER_DISABLED", ")", ";", "}" ]
Just create the bytecode for the merged class, but don't load it. Since no ClassInjector is provided to resolve name conflicts, the class name must be manually provided. @param className name to give to merged class @param classes Source classes used to derive merged class @param prefixes Optional prefixes to apply to methods of each generated class to eliminate duplicate method names
[ "Just", "create", "the", "bytecode", "for", "the", "merged", "class", "but", "don", "t", "load", "it", ".", "Since", "no", "ClassInjector", "is", "provided", "to", "resolve", "name", "conflicts", "the", "class", "name", "must", "be", "manually", "provided", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/MergedClass.java#L443-L447
gallandarakhneorg/afc
core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/BinaryTreeNode.java
BinaryTreeNode.setChildAt
public final boolean setChildAt(BinaryTreeZone zone, N newChild) { """ Set the child for the specified zone. @param zone is the zone to set @param newChild is the child to insert @return <code>true</code> if the child was added, otherwise <code>false</code> """ switch (zone) { case LEFT: return setLeftChild(newChild); case RIGHT: return setRightChild(newChild); default: throw new IndexOutOfBoundsException(); } }
java
public final boolean setChildAt(BinaryTreeZone zone, N newChild) { switch (zone) { case LEFT: return setLeftChild(newChild); case RIGHT: return setRightChild(newChild); default: throw new IndexOutOfBoundsException(); } }
[ "public", "final", "boolean", "setChildAt", "(", "BinaryTreeZone", "zone", ",", "N", "newChild", ")", "{", "switch", "(", "zone", ")", "{", "case", "LEFT", ":", "return", "setLeftChild", "(", "newChild", ")", ";", "case", "RIGHT", ":", "return", "setRightChild", "(", "newChild", ")", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}" ]
Set the child for the specified zone. @param zone is the zone to set @param newChild is the child to insert @return <code>true</code> if the child was added, otherwise <code>false</code>
[ "Set", "the", "child", "for", "the", "specified", "zone", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/BinaryTreeNode.java#L318-L327
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java
Text.getRelativeParent
public static String getRelativeParent(String path, int level, boolean ignoreTrailingSlash) { """ Same as {@link #getRelativeParent(String, int)} but adding the possibility to pass paths that end with a trailing '/'. @see #getRelativeParent(String, int) @param path path @param level level @param ignoreTrailingSlash ignore trailing slash @return String relative parent """ if (ignoreTrailingSlash && path.endsWith("/") && path.length() > 1) { path = path.substring(0, path.length() - 1); } return getRelativeParent(path, level); }
java
public static String getRelativeParent(String path, int level, boolean ignoreTrailingSlash) { if (ignoreTrailingSlash && path.endsWith("/") && path.length() > 1) { path = path.substring(0, path.length() - 1); } return getRelativeParent(path, level); }
[ "public", "static", "String", "getRelativeParent", "(", "String", "path", ",", "int", "level", ",", "boolean", "ignoreTrailingSlash", ")", "{", "if", "(", "ignoreTrailingSlash", "&&", "path", ".", "endsWith", "(", "\"/\"", ")", "&&", "path", ".", "length", "(", ")", ">", "1", ")", "{", "path", "=", "path", ".", "substring", "(", "0", ",", "path", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "getRelativeParent", "(", "path", ",", "level", ")", ";", "}" ]
Same as {@link #getRelativeParent(String, int)} but adding the possibility to pass paths that end with a trailing '/'. @see #getRelativeParent(String, int) @param path path @param level level @param ignoreTrailingSlash ignore trailing slash @return String relative parent
[ "Same", "as", "{", "@link", "#getRelativeParent", "(", "String", "int", ")", "}", "but", "adding", "the", "possibility", "to", "pass", "paths", "that", "end", "with", "a", "trailing", "/", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L788-L795
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java
ImageIOGreyScale.createImageInputStream
public static ImageInputStream createImageInputStream(Object input) throws IOException { """ Returns an <code>ImageInputStream</code> that will take its input from the given <code>Object</code>. The set of <code>ImageInputStreamSpi</code>s registered with the <code>IIORegistry</code> class is queried and the first one that is able to take input from the supplied object is used to create the returned <code>ImageInputStream</code>. If no suitable <code>ImageInputStreamSpi</code> exists, <code>null</code> is returned. <p> The current cache settings from <code>getUseCache</code>and <code>getCacheDirectory</code> will be used to control caching. @param input an <code>Object</code> to be used as an input source, such as a <code>File</code>, readable <code>RandomAccessFile</code>, or <code>InputStream</code>. @return an <code>ImageInputStream</code>, or <code>null</code>. @exception IllegalArgumentException if <code>input</code> is <code>null</code>. @exception IOException if a cache file is needed but cannot be created. @see javax.imageio.spi.ImageInputStreamSpi """ if (input == null) { throw new IllegalArgumentException("input == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageInputStreamSpi.class, true); } catch (IllegalArgumentException e) { return null; } boolean usecache = getUseCache() && hasCachePermission(); while (iter.hasNext()) { ImageInputStreamSpi spi = (ImageInputStreamSpi) iter.next(); if (spi.getInputClass().isInstance(input)) { try { return spi.createInputStreamInstance(input, usecache, getCacheDirectory()); } catch (IOException e) { throw new IIOException("Can't create cache file!", e); } } } return null; }
java
public static ImageInputStream createImageInputStream(Object input) throws IOException { if (input == null) { throw new IllegalArgumentException("input == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageInputStreamSpi.class, true); } catch (IllegalArgumentException e) { return null; } boolean usecache = getUseCache() && hasCachePermission(); while (iter.hasNext()) { ImageInputStreamSpi spi = (ImageInputStreamSpi) iter.next(); if (spi.getInputClass().isInstance(input)) { try { return spi.createInputStreamInstance(input, usecache, getCacheDirectory()); } catch (IOException e) { throw new IIOException("Can't create cache file!", e); } } } return null; }
[ "public", "static", "ImageInputStream", "createImageInputStream", "(", "Object", "input", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"input == null!\"", ")", ";", "}", "Iterator", "iter", ";", "// Ensure category is present\r", "try", "{", "iter", "=", "theRegistry", ".", "getServiceProviders", "(", "ImageInputStreamSpi", ".", "class", ",", "true", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "null", ";", "}", "boolean", "usecache", "=", "getUseCache", "(", ")", "&&", "hasCachePermission", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "ImageInputStreamSpi", "spi", "=", "(", "ImageInputStreamSpi", ")", "iter", ".", "next", "(", ")", ";", "if", "(", "spi", ".", "getInputClass", "(", ")", ".", "isInstance", "(", "input", ")", ")", "{", "try", "{", "return", "spi", ".", "createInputStreamInstance", "(", "input", ",", "usecache", ",", "getCacheDirectory", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IIOException", "(", "\"Can't create cache file!\"", ",", "e", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Returns an <code>ImageInputStream</code> that will take its input from the given <code>Object</code>. The set of <code>ImageInputStreamSpi</code>s registered with the <code>IIORegistry</code> class is queried and the first one that is able to take input from the supplied object is used to create the returned <code>ImageInputStream</code>. If no suitable <code>ImageInputStreamSpi</code> exists, <code>null</code> is returned. <p> The current cache settings from <code>getUseCache</code>and <code>getCacheDirectory</code> will be used to control caching. @param input an <code>Object</code> to be used as an input source, such as a <code>File</code>, readable <code>RandomAccessFile</code>, or <code>InputStream</code>. @return an <code>ImageInputStream</code>, or <code>null</code>. @exception IllegalArgumentException if <code>input</code> is <code>null</code>. @exception IOException if a cache file is needed but cannot be created. @see javax.imageio.spi.ImageInputStreamSpi
[ "Returns", "an", "<code", ">", "ImageInputStream<", "/", "code", ">", "that", "will", "take", "its", "input", "from", "the", "given", "<code", ">", "Object<", "/", "code", ">", ".", "The", "set", "of", "<code", ">", "ImageInputStreamSpi<", "/", "code", ">", "s", "registered", "with", "the", "<code", ">", "IIORegistry<", "/", "code", ">", "class", "is", "queried", "and", "the", "first", "one", "that", "is", "able", "to", "take", "input", "from", "the", "supplied", "object", "is", "used", "to", "create", "the", "returned", "<code", ">", "ImageInputStream<", "/", "code", ">", ".", "If", "no", "suitable", "<code", ">", "ImageInputStreamSpi<", "/", "code", ">", "exists", "<code", ">", "null<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L296-L323
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java
Configuration.getBoolean
public boolean getBoolean(String category, String key) { """ Same as {@link Configuration#getProperty(String, String)}, but a boolean is parsed. @param category The category of the property @param key The key (identifier) of the property @return {@code true} if the property can be parsed to boolean, or equals (ignoring case) {@code "on"} """ String value = this.getProperty(category, key); return Boolean.parseBoolean(value) || "on".equalsIgnoreCase(value); }
java
public boolean getBoolean(String category, String key) { String value = this.getProperty(category, key); return Boolean.parseBoolean(value) || "on".equalsIgnoreCase(value); }
[ "public", "boolean", "getBoolean", "(", "String", "category", ",", "String", "key", ")", "{", "String", "value", "=", "this", ".", "getProperty", "(", "category", ",", "key", ")", ";", "return", "Boolean", ".", "parseBoolean", "(", "value", ")", "||", "\"on\"", ".", "equalsIgnoreCase", "(", "value", ")", ";", "}" ]
Same as {@link Configuration#getProperty(String, String)}, but a boolean is parsed. @param category The category of the property @param key The key (identifier) of the property @return {@code true} if the property can be parsed to boolean, or equals (ignoring case) {@code "on"}
[ "Same", "as", "{", "@link", "Configuration#getProperty", "(", "String", "String", ")", "}", "but", "a", "boolean", "is", "parsed", "." ]
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L273-L276
voldemort/voldemort
src/java/voldemort/utils/ReflectUtils.java
ReflectUtils.callConstructor
public static <T> T callConstructor(Class<T> klass) { """ Call the no-arg constructor for the given class @param <T> The type of the thing to construct @param klass The class @return The constructed thing """ return callConstructor(klass, new Class<?>[0], new Object[0]); }
java
public static <T> T callConstructor(Class<T> klass) { return callConstructor(klass, new Class<?>[0], new Object[0]); }
[ "public", "static", "<", "T", ">", "T", "callConstructor", "(", "Class", "<", "T", ">", "klass", ")", "{", "return", "callConstructor", "(", "klass", ",", "new", "Class", "<", "?", ">", "[", "0", "]", ",", "new", "Object", "[", "0", "]", ")", ";", "}" ]
Call the no-arg constructor for the given class @param <T> The type of the thing to construct @param klass The class @return The constructed thing
[ "Call", "the", "no", "-", "arg", "constructor", "for", "the", "given", "class" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L85-L87
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.clearEvidence
public static void clearEvidence(Network bn, String nodeName) throws ShanksException { """ Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException """ int node = bn.getNode(nodeName); if (bn.isEvidence(node)) { bn.clearEvidence(nodeName); bn.updateBeliefs(); } }
java
public static void clearEvidence(Network bn, String nodeName) throws ShanksException { int node = bn.getNode(nodeName); if (bn.isEvidence(node)) { bn.clearEvidence(nodeName); bn.updateBeliefs(); } }
[ "public", "static", "void", "clearEvidence", "(", "Network", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "int", "node", "=", "bn", ".", "getNode", "(", "nodeName", ")", ";", "if", "(", "bn", ".", "isEvidence", "(", "node", ")", ")", "{", "bn", ".", "clearEvidence", "(", "nodeName", ")", ";", "bn", ".", "updateBeliefs", "(", ")", ";", "}", "}" ]
Clear a hard evidence fixed in a given node /** @param bn @param nodeName @throws ShanksException
[ "Clear", "a", "hard", "evidence", "fixed", "in", "a", "given", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L315-L322
sockeqwe/sqlbrite-dao
objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java
ObjectMappableAnnotatedClass.isSetterForField
private boolean isSetterForField(ExecutableElement setter, VariableElement field) { """ Checks if the setter method is valid for the given field @param setter The setter method @param field The field @return true if setter works for given field, otherwise false """ return setter.getParameters() != null && setter.getParameters().size() == 1 && setter.getParameters().get(0).asType().equals(field.asType()); // TODO inheritance? TypeUtils is applicable? }
java
private boolean isSetterForField(ExecutableElement setter, VariableElement field) { return setter.getParameters() != null && setter.getParameters().size() == 1 && setter.getParameters().get(0).asType().equals(field.asType()); // TODO inheritance? TypeUtils is applicable? }
[ "private", "boolean", "isSetterForField", "(", "ExecutableElement", "setter", ",", "VariableElement", "field", ")", "{", "return", "setter", ".", "getParameters", "(", ")", "!=", "null", "&&", "setter", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "1", "&&", "setter", ".", "getParameters", "(", ")", ".", "get", "(", "0", ")", ".", "asType", "(", ")", ".", "equals", "(", "field", ".", "asType", "(", ")", ")", ";", "// TODO inheritance? TypeUtils is applicable?", "}" ]
Checks if the setter method is valid for the given field @param setter The setter method @param field The field @return true if setter works for given field, otherwise false
[ "Checks", "if", "the", "setter", "method", "is", "valid", "for", "the", "given", "field" ]
train
https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableAnnotatedClass.java#L262-L267
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.validateLocalFileRecord
private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException { """ Checks that the data starting at startLocRecord looks like a local file record header. @param channel the channel @param startLocRecord offset into channel of the start of the local record @param compressedSize expected compressed size of the file, or -1 to indicate this isn't known """ ByteBuffer lfhBuffer = getByteBuffer(LOCLEN); read(lfhBuffer, channel, startLocRecord); if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) { return false; } if (compressedSize == -1) { // We can't further evaluate return true; } int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN); int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN); long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen; read(lfhBuffer, channel, nextSigPos); long header = getUnsignedInt(lfhBuffer, 0); return header == LOCSIG || header == EXTSIG || header == CENSIG; }
java
private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException { ByteBuffer lfhBuffer = getByteBuffer(LOCLEN); read(lfhBuffer, channel, startLocRecord); if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) { return false; } if (compressedSize == -1) { // We can't further evaluate return true; } int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN); int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN); long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen; read(lfhBuffer, channel, nextSigPos); long header = getUnsignedInt(lfhBuffer, 0); return header == LOCSIG || header == EXTSIG || header == CENSIG; }
[ "private", "static", "boolean", "validateLocalFileRecord", "(", "FileChannel", "channel", ",", "long", "startLocRecord", ",", "long", "compressedSize", ")", "throws", "IOException", "{", "ByteBuffer", "lfhBuffer", "=", "getByteBuffer", "(", "LOCLEN", ")", ";", "read", "(", "lfhBuffer", ",", "channel", ",", "startLocRecord", ")", ";", "if", "(", "lfhBuffer", ".", "limit", "(", ")", "<", "LOCLEN", "||", "getUnsignedInt", "(", "lfhBuffer", ",", "0", ")", "!=", "LOCSIG", ")", "{", "return", "false", ";", "}", "if", "(", "compressedSize", "==", "-", "1", ")", "{", "// We can't further evaluate", "return", "true", ";", "}", "int", "fnLen", "=", "getUnsignedShort", "(", "lfhBuffer", ",", "LOC_FILENAMELEN", ")", ";", "int", "extFieldLen", "=", "getUnsignedShort", "(", "lfhBuffer", ",", "LOC_EXTFLDLEN", ")", ";", "long", "nextSigPos", "=", "startLocRecord", "+", "LOCLEN", "+", "compressedSize", "+", "fnLen", "+", "extFieldLen", ";", "read", "(", "lfhBuffer", ",", "channel", ",", "nextSigPos", ")", ";", "long", "header", "=", "getUnsignedInt", "(", "lfhBuffer", ",", "0", ")", ";", "return", "header", "==", "LOCSIG", "||", "header", "==", "EXTSIG", "||", "header", "==", "CENSIG", ";", "}" ]
Checks that the data starting at startLocRecord looks like a local file record header. @param channel the channel @param startLocRecord offset into channel of the start of the local record @param compressedSize expected compressed size of the file, or -1 to indicate this isn't known
[ "Checks", "that", "the", "data", "starting", "at", "startLocRecord", "looks", "like", "a", "local", "file", "record", "header", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L469-L489
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getMaterialCategoryInfo
public void getMaterialCategoryInfo(int[] ids, Callback<List<MaterialCategory>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on Material MaterialCategory API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of category id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see MaterialCategory material category info """ isParamValid(new ParamChecker(ids)); gw2API.getMaterialBankInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getMaterialCategoryInfo(int[] ids, Callback<List<MaterialCategory>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getMaterialBankInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getMaterialCategoryInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "MaterialCategory", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getMaterialBankInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on Material MaterialCategory API go <a href="https://wiki.guildwars2.com/wiki/API:2/materials">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of category id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see MaterialCategory material category info
[ "For", "more", "info", "on", "Material", "MaterialCategory", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "materials", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1863-L1866
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ConnectionDescriptorImpl.java
ConnectionDescriptorImpl.setAll
public void setAll(String _rhn, String _rha, String _lhn, String _lha) { """ Set all of the stored information based on the input strings. @param _rhn @param _rha @param _lhn @param _lha """ this.remoteHostName = _rhn; this.remoteHostAddress = _rha; this.localHostName = _lhn; this.localHostAddress = _lha; this.addrLocal = null; this.addrRemote = null; }
java
public void setAll(String _rhn, String _rha, String _lhn, String _lha) { this.remoteHostName = _rhn; this.remoteHostAddress = _rha; this.localHostName = _lhn; this.localHostAddress = _lha; this.addrLocal = null; this.addrRemote = null; }
[ "public", "void", "setAll", "(", "String", "_rhn", ",", "String", "_rha", ",", "String", "_lhn", ",", "String", "_lha", ")", "{", "this", ".", "remoteHostName", "=", "_rhn", ";", "this", ".", "remoteHostAddress", "=", "_rha", ";", "this", ".", "localHostName", "=", "_lhn", ";", "this", ".", "localHostAddress", "=", "_lha", ";", "this", ".", "addrLocal", "=", "null", ";", "this", ".", "addrRemote", "=", "null", ";", "}" ]
Set all of the stored information based on the input strings. @param _rhn @param _rha @param _lhn @param _lha
[ "Set", "all", "of", "the", "stored", "information", "based", "on", "the", "input", "strings", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ConnectionDescriptorImpl.java#L140-L147
Samsung/GearVRf
GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java
OvrViewManager.onSurfaceChanged
void onSurfaceChanged(int width, int height) { """ Called when the surface is created or recreated. Avoided because this can be called twice at the beginning. """ Log.v(TAG, "onSurfaceChanged"); final VrAppSettings.EyeBufferParams.DepthFormat depthFormat = mApplication.getAppSettings().getEyeBufferParams().getDepthFormat(); mApplication.getConfigurationManager().configureRendering(VrAppSettings.EyeBufferParams.DepthFormat.DEPTH_24_STENCIL_8 == depthFormat); }
java
void onSurfaceChanged(int width, int height) { Log.v(TAG, "onSurfaceChanged"); final VrAppSettings.EyeBufferParams.DepthFormat depthFormat = mApplication.getAppSettings().getEyeBufferParams().getDepthFormat(); mApplication.getConfigurationManager().configureRendering(VrAppSettings.EyeBufferParams.DepthFormat.DEPTH_24_STENCIL_8 == depthFormat); }
[ "void", "onSurfaceChanged", "(", "int", "width", ",", "int", "height", ")", "{", "Log", ".", "v", "(", "TAG", ",", "\"onSurfaceChanged\"", ")", ";", "final", "VrAppSettings", ".", "EyeBufferParams", ".", "DepthFormat", "depthFormat", "=", "mApplication", ".", "getAppSettings", "(", ")", ".", "getEyeBufferParams", "(", ")", ".", "getDepthFormat", "(", ")", ";", "mApplication", ".", "getConfigurationManager", "(", ")", ".", "configureRendering", "(", "VrAppSettings", ".", "EyeBufferParams", ".", "DepthFormat", ".", "DEPTH_24_STENCIL_8", "==", "depthFormat", ")", ";", "}" ]
Called when the surface is created or recreated. Avoided because this can be called twice at the beginning.
[ "Called", "when", "the", "surface", "is", "created", "or", "recreated", ".", "Avoided", "because", "this", "can", "be", "called", "twice", "at", "the", "beginning", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java#L145-L150
elki-project/elki
elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/OutputStreamLogger.java
OutputStreamLogger.tailingNonNewline
private int tailingNonNewline(char[] cbuf, int off, int len) { """ Count the tailing non-newline characters. @param cbuf Character buffer @param off Offset @param len Range @return number of tailing non-newline character """ for(int cnt = 0; cnt < len; cnt++) { final int pos = off + (len - 1) - cnt; if(cbuf[pos] == UNIX_NEWLINE) { return cnt; } if(cbuf[pos] == CARRIAGE_RETURN) { return cnt; } // TODO: need to compare to NEWLINEC, too? } return len; }
java
private int tailingNonNewline(char[] cbuf, int off, int len) { for(int cnt = 0; cnt < len; cnt++) { final int pos = off + (len - 1) - cnt; if(cbuf[pos] == UNIX_NEWLINE) { return cnt; } if(cbuf[pos] == CARRIAGE_RETURN) { return cnt; } // TODO: need to compare to NEWLINEC, too? } return len; }
[ "private", "int", "tailingNonNewline", "(", "char", "[", "]", "cbuf", ",", "int", "off", ",", "int", "len", ")", "{", "for", "(", "int", "cnt", "=", "0", ";", "cnt", "<", "len", ";", "cnt", "++", ")", "{", "final", "int", "pos", "=", "off", "+", "(", "len", "-", "1", ")", "-", "cnt", ";", "if", "(", "cbuf", "[", "pos", "]", "==", "UNIX_NEWLINE", ")", "{", "return", "cnt", ";", "}", "if", "(", "cbuf", "[", "pos", "]", "==", "CARRIAGE_RETURN", ")", "{", "return", "cnt", ";", "}", "// TODO: need to compare to NEWLINEC, too?", "}", "return", "len", ";", "}" ]
Count the tailing non-newline characters. @param cbuf Character buffer @param off Offset @param len Range @return number of tailing non-newline character
[ "Count", "the", "tailing", "non", "-", "newline", "characters", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/OutputStreamLogger.java#L126-L138
knowm/Sundial
src/main/java/org/knowm/sundial/SundialJobScheduler.java
SundialJobScheduler.getAllJobsAndTriggers
public static Map<String, List<Trigger>> getAllJobsAndTriggers() throws SundialSchedulerException { """ Generates a Map of all Job names with corresponding Triggers @return """ Map<String, List<Trigger>> allJobsMap = new TreeMap<String, List<Trigger>>(); try { Set<String> allJobKeys = getScheduler().getJobKeys(); for (String jobKey : allJobKeys) { List<Trigger> triggers = getScheduler().getTriggersOfJob(jobKey); allJobsMap.put(jobKey, triggers); } } catch (SchedulerException e) { throw new SundialSchedulerException("COULD NOT GET JOB NAMES!!!", e); } return allJobsMap; }
java
public static Map<String, List<Trigger>> getAllJobsAndTriggers() throws SundialSchedulerException { Map<String, List<Trigger>> allJobsMap = new TreeMap<String, List<Trigger>>(); try { Set<String> allJobKeys = getScheduler().getJobKeys(); for (String jobKey : allJobKeys) { List<Trigger> triggers = getScheduler().getTriggersOfJob(jobKey); allJobsMap.put(jobKey, triggers); } } catch (SchedulerException e) { throw new SundialSchedulerException("COULD NOT GET JOB NAMES!!!", e); } return allJobsMap; }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "Trigger", ">", ">", "getAllJobsAndTriggers", "(", ")", "throws", "SundialSchedulerException", "{", "Map", "<", "String", ",", "List", "<", "Trigger", ">", ">", "allJobsMap", "=", "new", "TreeMap", "<", "String", ",", "List", "<", "Trigger", ">", ">", "(", ")", ";", "try", "{", "Set", "<", "String", ">", "allJobKeys", "=", "getScheduler", "(", ")", ".", "getJobKeys", "(", ")", ";", "for", "(", "String", "jobKey", ":", "allJobKeys", ")", "{", "List", "<", "Trigger", ">", "triggers", "=", "getScheduler", "(", ")", ".", "getTriggersOfJob", "(", "jobKey", ")", ";", "allJobsMap", ".", "put", "(", "jobKey", ",", "triggers", ")", ";", "}", "}", "catch", "(", "SchedulerException", "e", ")", "{", "throw", "new", "SundialSchedulerException", "(", "\"COULD NOT GET JOB NAMES!!!\"", ",", "e", ")", ";", "}", "return", "allJobsMap", ";", "}" ]
Generates a Map of all Job names with corresponding Triggers @return
[ "Generates", "a", "Map", "of", "all", "Job", "names", "with", "corresponding", "Triggers" ]
train
https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L525-L540
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByImageUrl
public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) { """ query-by method for field imageUrl @param imageUrl the specified attribute @return an Iterable of DConnections for the specified imageUrl """ return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl); }
java
public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) { return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByImageUrl", "(", "java", ".", "lang", ".", "String", "imageUrl", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "IMAGEURL", ".", "getFieldName", "(", ")", ",", "imageUrl", ")", ";", "}" ]
query-by method for field imageUrl @param imageUrl the specified attribute @return an Iterable of DConnections for the specified imageUrl
[ "query", "-", "by", "method", "for", "field", "imageUrl" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L97-L99
op4j/op4j
src/main/java/org/op4j/functions/FnDate.java
FnDate.toStr
public static final Function<Date,String> toStr(final String pattern, final Locale locale) { """ <p> Converts the target Date into a String using the specified <tt>pattern</tt>. The pattern has to be written in the <tt>java.text.SimpleDateFormat</tt> format, and the specified locale will be used for text-based pattern components (like month names or week days). </p> @param pattern the pattern to be used, as specified by <tt>java.text.SimpleDateFormat</tt>. @param locale the locale to be used for text-based pattern components @return the String representation of the target Date. """ return new ToString(pattern, locale); }
java
public static final Function<Date,String> toStr(final String pattern, final Locale locale) { return new ToString(pattern, locale); }
[ "public", "static", "final", "Function", "<", "Date", ",", "String", ">", "toStr", "(", "final", "String", "pattern", ",", "final", "Locale", "locale", ")", "{", "return", "new", "ToString", "(", "pattern", ",", "locale", ")", ";", "}" ]
<p> Converts the target Date into a String using the specified <tt>pattern</tt>. The pattern has to be written in the <tt>java.text.SimpleDateFormat</tt> format, and the specified locale will be used for text-based pattern components (like month names or week days). </p> @param pattern the pattern to be used, as specified by <tt>java.text.SimpleDateFormat</tt>. @param locale the locale to be used for text-based pattern components @return the String representation of the target Date.
[ "<p", ">", "Converts", "the", "target", "Date", "into", "a", "String", "using", "the", "specified", "<tt", ">", "pattern<", "/", "tt", ">", ".", "The", "pattern", "has", "to", "be", "written", "in", "the", "<tt", ">", "java", ".", "text", ".", "SimpleDateFormat<", "/", "tt", ">", "format", "and", "the", "specified", "locale", "will", "be", "used", "for", "text", "-", "based", "pattern", "components", "(", "like", "month", "names", "or", "week", "days", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnDate.java#L408-L410
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java
ShipmentUrl.getShipmentUrl
public static MozuUrl getShipmentUrl(String orderId, String responseFields, String shipmentId) { """ Get Resource Url for GetShipment @param orderId Unique identifier of the order. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param shipmentId Unique identifier of the shipment to retrieve. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getShipmentUrl(String orderId, String responseFields, String shipmentId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getShipmentUrl", "(", "String", "orderId", ",", "String", "responseFields", ",", "String", "shipmentId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/shipments/{shipmentId}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"orderId\"", ",", "orderId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"shipmentId\"", ",", "shipmentId", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetShipment @param orderId Unique identifier of the order. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param shipmentId Unique identifier of the shipment to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetShipment" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java#L23-L30
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Truncatewords.java
Truncatewords.apply
@Override public Object apply(Object value, Object... params) { """ /* truncatewords(input, words = 15, truncate_string = "...") Truncate a string down to x words """ if (value == null) { return ""; } String text = super.asString(value); String[] words = text.split("\\s++"); int length = 15; String truncateString = "..."; if (params.length >= 1) { length = super.asNumber(super.get(0, params)).intValue(); } if (params.length >= 2) { truncateString = super.asString(super.get(1, params)); } if (length >= words.length) { return text; } return join(words, length) + truncateString; }
java
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } String text = super.asString(value); String[] words = text.split("\\s++"); int length = 15; String truncateString = "..."; if (params.length >= 1) { length = super.asNumber(super.get(0, params)).intValue(); } if (params.length >= 2) { truncateString = super.asString(super.get(1, params)); } if (length >= words.length) { return text; } return join(words, length) + truncateString; }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "text", "=", "super", ".", "asString", "(", "value", ")", ";", "String", "[", "]", "words", "=", "text", ".", "split", "(", "\"\\\\s++\"", ")", ";", "int", "length", "=", "15", ";", "String", "truncateString", "=", "\"...\"", ";", "if", "(", "params", ".", "length", ">=", "1", ")", "{", "length", "=", "super", ".", "asNumber", "(", "super", ".", "get", "(", "0", ",", "params", ")", ")", ".", "intValue", "(", ")", ";", "}", "if", "(", "params", ".", "length", ">=", "2", ")", "{", "truncateString", "=", "super", ".", "asString", "(", "super", ".", "get", "(", "1", ",", "params", ")", ")", ";", "}", "if", "(", "length", ">=", "words", ".", "length", ")", "{", "return", "text", ";", "}", "return", "join", "(", "words", ",", "length", ")", "+", "truncateString", ";", "}" ]
/* truncatewords(input, words = 15, truncate_string = "...") Truncate a string down to x words
[ "/", "*", "truncatewords", "(", "input", "words", "=", "15", "truncate_string", "=", "...", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Truncatewords.java#L10-L35
susom/database
src/main/java/com/github/susom/database/DatabaseProviderVertx.java
DatabaseProviderVertx.transactAsync
public <T> void transactAsync(final DbCodeTyped<T> code, Handler<AsyncResult<T>> resultHandler) { """ Execute a transaction on a Vert.x worker thread, with default semantics (commit if the code completes successfully, or rollback if it throws an error). The provided result handler will be call after the commit or rollback, and will run on the event loop thread (the same thread that is calling this method). """ VertxUtil.executeBlocking(executor, future -> { try { T returnValue; boolean complete = false; try { returnValue = code.run(this); complete = true; } catch (ThreadDeath | DatabaseException t) { throw t; } catch (Throwable t) { throw new DatabaseException("Error during transaction", t); } finally { if (!complete) { rollbackAndClose(); } else { commitAndClose(); } } future.complete(returnValue); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { future.fail(t); } }, resultHandler); }
java
public <T> void transactAsync(final DbCodeTyped<T> code, Handler<AsyncResult<T>> resultHandler) { VertxUtil.executeBlocking(executor, future -> { try { T returnValue; boolean complete = false; try { returnValue = code.run(this); complete = true; } catch (ThreadDeath | DatabaseException t) { throw t; } catch (Throwable t) { throw new DatabaseException("Error during transaction", t); } finally { if (!complete) { rollbackAndClose(); } else { commitAndClose(); } } future.complete(returnValue); } catch (ThreadDeath t) { throw t; } catch (Throwable t) { future.fail(t); } }, resultHandler); }
[ "public", "<", "T", ">", "void", "transactAsync", "(", "final", "DbCodeTyped", "<", "T", ">", "code", ",", "Handler", "<", "AsyncResult", "<", "T", ">", ">", "resultHandler", ")", "{", "VertxUtil", ".", "executeBlocking", "(", "executor", ",", "future", "->", "{", "try", "{", "T", "returnValue", ";", "boolean", "complete", "=", "false", ";", "try", "{", "returnValue", "=", "code", ".", "run", "(", "this", ")", ";", "complete", "=", "true", ";", "}", "catch", "(", "ThreadDeath", "|", "DatabaseException", "t", ")", "{", "throw", "t", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "DatabaseException", "(", "\"Error during transaction\"", ",", "t", ")", ";", "}", "finally", "{", "if", "(", "!", "complete", ")", "{", "rollbackAndClose", "(", ")", ";", "}", "else", "{", "commitAndClose", "(", ")", ";", "}", "}", "future", ".", "complete", "(", "returnValue", ")", ";", "}", "catch", "(", "ThreadDeath", "t", ")", "{", "throw", "t", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "future", ".", "fail", "(", "t", ")", ";", "}", "}", ",", "resultHandler", ")", ";", "}" ]
Execute a transaction on a Vert.x worker thread, with default semantics (commit if the code completes successfully, or rollback if it throws an error). The provided result handler will be call after the commit or rollback, and will run on the event loop thread (the same thread that is calling this method).
[ "Execute", "a", "transaction", "on", "a", "Vert", ".", "x", "worker", "thread", "with", "default", "semantics", "(", "commit", "if", "the", "code", "completes", "successfully", "or", "rollback", "if", "it", "throws", "an", "error", ")", ".", "The", "provided", "result", "handler", "will", "be", "call", "after", "the", "commit", "or", "rollback", "and", "will", "run", "on", "the", "event", "loop", "thread", "(", "the", "same", "thread", "that", "is", "calling", "this", "method", ")", "." ]
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L191-L217
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/DirMaker.java
DirMaker.ensureDir
public static File ensureDir(String path, String name) throws IOException { """ Ensure that the path pointed to by 'path' is a directory, if possible @param path @param name @return File that is a created directory @throws IOException """ if((path == null) || (path.length() == 0)) { throw new IOException("No configuration for (" + name + ")"); } File dir = new File(path); if(dir.exists()) { if(!dir.isDirectory()) { throw new IOException("Dir(" + name + ") at (" + path + ") exists but is not a directory!"); } } else { if(!dir.mkdirs()) { throw new IOException("Unable to create dir(" + name +") at (" + path + ")"); } } return dir; }
java
public static File ensureDir(String path, String name) throws IOException { if((path == null) || (path.length() == 0)) { throw new IOException("No configuration for (" + name + ")"); } File dir = new File(path); if(dir.exists()) { if(!dir.isDirectory()) { throw new IOException("Dir(" + name + ") at (" + path + ") exists but is not a directory!"); } } else { if(!dir.mkdirs()) { throw new IOException("Unable to create dir(" + name +") at (" + path + ")"); } } return dir; }
[ "public", "static", "File", "ensureDir", "(", "String", "path", ",", "String", "name", ")", "throws", "IOException", "{", "if", "(", "(", "path", "==", "null", ")", "||", "(", "path", ".", "length", "(", ")", "==", "0", ")", ")", "{", "throw", "new", "IOException", "(", "\"No configuration for (\"", "+", "name", "+", "\")\"", ")", ";", "}", "File", "dir", "=", "new", "File", "(", "path", ")", ";", "if", "(", "dir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "dir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Dir(\"", "+", "name", "+", "\") at (\"", "+", "path", "+", "\") exists but is not a directory!\"", ")", ";", "}", "}", "else", "{", "if", "(", "!", "dir", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Unable to create dir(\"", "+", "name", "+", "\") at (\"", "+", "path", "+", "\")\"", ")", ";", "}", "}", "return", "dir", ";", "}" ]
Ensure that the path pointed to by 'path' is a directory, if possible @param path @param name @return File that is a created directory @throws IOException
[ "Ensure", "that", "the", "path", "pointed", "to", "by", "path", "is", "a", "directory", "if", "possible" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/DirMaker.java#L40-L57
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/ExpressionBuilder.java
ExpressionBuilder.greaterThan
public ExpressionBuilder greaterThan(final SubordinateTrigger trigger, final Object compare) { """ Appends a greater than test to the condition. @param trigger the trigger field. @param compare the value to use in the compare. @return this ExpressionBuilder. """ BooleanExpression exp = new CompareExpression(CompareType.GREATER_THAN, trigger, compare); appendExpression(exp); return this; }
java
public ExpressionBuilder greaterThan(final SubordinateTrigger trigger, final Object compare) { BooleanExpression exp = new CompareExpression(CompareType.GREATER_THAN, trigger, compare); appendExpression(exp); return this; }
[ "public", "ExpressionBuilder", "greaterThan", "(", "final", "SubordinateTrigger", "trigger", ",", "final", "Object", "compare", ")", "{", "BooleanExpression", "exp", "=", "new", "CompareExpression", "(", "CompareType", ".", "GREATER_THAN", ",", "trigger", ",", "compare", ")", ";", "appendExpression", "(", "exp", ")", ";", "return", "this", ";", "}" ]
Appends a greater than test to the condition. @param trigger the trigger field. @param compare the value to use in the compare. @return this ExpressionBuilder.
[ "Appends", "a", "greater", "than", "test", "to", "the", "condition", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/builder/ExpressionBuilder.java#L120-L125
netty/netty-tcnative
openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java
SSL.setKeyMaterialServerSide
@Deprecated public static void setKeyMaterialServerSide(long ssl, long chain, long key) throws Exception { """ Sets the keymaterial to be used for the server side. The passed in chain and key needs to be generated via {@link #parseX509Chain(long)} and {@link #parsePrivateKey(long, String)}. It's important to note that the caller of the method is responsible to free the passed in chain and key in any case as this method will increment the reference count of the chain and key. @deprecated use {@link #setKeyMaterial(long, long, long)} """ setKeyMaterial(ssl, chain, key); }
java
@Deprecated public static void setKeyMaterialServerSide(long ssl, long chain, long key) throws Exception { setKeyMaterial(ssl, chain, key); }
[ "@", "Deprecated", "public", "static", "void", "setKeyMaterialServerSide", "(", "long", "ssl", ",", "long", "chain", ",", "long", "key", ")", "throws", "Exception", "{", "setKeyMaterial", "(", "ssl", ",", "chain", ",", "key", ")", ";", "}" ]
Sets the keymaterial to be used for the server side. The passed in chain and key needs to be generated via {@link #parseX509Chain(long)} and {@link #parsePrivateKey(long, String)}. It's important to note that the caller of the method is responsible to free the passed in chain and key in any case as this method will increment the reference count of the chain and key. @deprecated use {@link #setKeyMaterial(long, long, long)}
[ "Sets", "the", "keymaterial", "to", "be", "used", "for", "the", "server", "side", ".", "The", "passed", "in", "chain", "and", "key", "needs", "to", "be", "generated", "via", "{", "@link", "#parseX509Chain", "(", "long", ")", "}", "and", "{", "@link", "#parsePrivateKey", "(", "long", "String", ")", "}", ".", "It", "s", "important", "to", "note", "that", "the", "caller", "of", "the", "method", "is", "responsible", "to", "free", "the", "passed", "in", "chain", "and", "key", "in", "any", "case", "as", "this", "method", "will", "increment", "the", "reference", "count", "of", "the", "chain", "and", "key", "." ]
train
https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSL.java#L729-L732
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java
MiniTemplatorParser.skipBlanks
private static int skipBlanks(String s, int p) { """ Skips blanks (white space) in string s starting at position p. """ while (p < s.length() && Character.isWhitespace(s.charAt(p))) p++; return p; }
java
private static int skipBlanks(String s, int p) { while (p < s.length() && Character.isWhitespace(s.charAt(p))) p++; return p; }
[ "private", "static", "int", "skipBlanks", "(", "String", "s", ",", "int", "p", ")", "{", "while", "(", "p", "<", "s", ".", "length", "(", ")", "&&", "Character", ".", "isWhitespace", "(", "s", ".", "charAt", "(", "p", ")", ")", ")", "p", "++", ";", "return", "p", ";", "}" ]
Skips blanks (white space) in string s starting at position p.
[ "Skips", "blanks", "(", "white", "space", ")", "in", "string", "s", "starting", "at", "position", "p", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java#L1561-L1565
JDBDT/jdbdt
src/main/java/org/jdbdt/JDBDT.java
JDBDT.assertInserted
@SafeVarargs public static void assertInserted(String message, DataSet... dataSets) throws DBAssertionError { """ Assert that database changed only by insertion of given data sets (error message variant). @param message Assertion error message. @param dataSets Data sets. @throws DBAssertionError if the assertion fails. @see #assertInserted(String,DataSet) @since 1.2 """ multipleInsertAssertions(CallInfo.create(message), dataSets); }
java
@SafeVarargs public static void assertInserted(String message, DataSet... dataSets) throws DBAssertionError { multipleInsertAssertions(CallInfo.create(message), dataSets); }
[ "@", "SafeVarargs", "public", "static", "void", "assertInserted", "(", "String", "message", ",", "DataSet", "...", "dataSets", ")", "throws", "DBAssertionError", "{", "multipleInsertAssertions", "(", "CallInfo", ".", "create", "(", "message", ")", ",", "dataSets", ")", ";", "}" ]
Assert that database changed only by insertion of given data sets (error message variant). @param message Assertion error message. @param dataSets Data sets. @throws DBAssertionError if the assertion fails. @see #assertInserted(String,DataSet) @since 1.2
[ "Assert", "that", "database", "changed", "only", "by", "insertion", "of", "given", "data", "sets", "(", "error", "message", "variant", ")", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L546-L549
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java
StartSearchFilter.fakeTheDate
public void fakeTheDate() { """ If the current key starts with a date, convert the search field to a date and compare. """ int ecErrorCode; BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed if (m_fldToCompare.isNull()) return; // Don't convert the date if this is NULL! if (m_fldFakeDate == null) m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate); m_fldToCompare = m_fldFakeDate; ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0)) fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date else { fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field } fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second }
java
public void fakeTheDate() { int ecErrorCode; BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed if (m_fldToCompare.isNull()) return; // Don't convert the date if this is NULL! if (m_fldFakeDate == null) m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate); m_fldToCompare = m_fldFakeDate; ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0)) fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date else { fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field } fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second }
[ "public", "void", "fakeTheDate", "(", ")", "{", "int", "ecErrorCode", ";", "BaseField", "fldToCompare", "=", "m_fldToCompare", ";", "// Cache this in case it is changed", "if", "(", "m_fldToCompare", ".", "isNull", "(", ")", ")", "return", ";", "// Don't convert the date if this is NULL!", "if", "(", "m_fldFakeDate", "==", "null", ")", "m_fldFakeDate", "=", "new", "DateField", "(", "null", ",", "FAKE_DATE", ",", "DBConstants", ".", "DEFAULT_FIELD_LENGTH", ",", "FAKE_DATE", ",", "null", ")", ";", "//m_FieldToCompare->GetFile()->GetField(kBkFakeDate);", "m_fldToCompare", "=", "m_fldFakeDate", ";", "ecErrorCode", "=", "m_fldToCompare", ".", "moveFieldToThis", "(", "fldToCompare", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// Convert the date", "boolean", "bOldState", "=", "fldToCompare", ".", "getListener", "(", "FieldReSelectHandler", ".", "class", ".", "getName", "(", ")", ")", ".", "setEnabledListener", "(", "false", ")", ";", "// Disable the reselect listener for a second", "if", "(", "(", "ecErrorCode", "==", "DBConstants", ".", "NORMAL_RETURN", ")", "&&", "(", "(", "(", "NumberField", ")", "m_fldToCompare", ")", ".", "getValue", "(", ")", "!=", "0", ")", ")", "fldToCompare", ".", "moveFieldToThis", "(", "m_fldToCompare", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// Reformat and display the date", "else", "{", "fldToCompare", ".", "initField", "(", "DBConstants", ".", "DISPLAY", ")", ";", "// Clear this wierd field", "m_fldToCompare", ".", "initField", "(", "DBConstants", ".", "DISPLAY", ")", ";", "// Clear this wierd field", "}", "fldToCompare", ".", "getListener", "(", "FieldReSelectHandler", ".", "class", ".", "getName", "(", ")", ")", ".", "setEnabledListener", "(", "bOldState", ")", ";", "// Reenable the reselect listener for a second", "}" ]
If the current key starts with a date, convert the search field to a date and compare.
[ "If", "the", "current", "key", "starts", "with", "a", "date", "convert", "the", "search", "field", "to", "a", "date", "and", "compare", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java#L126-L145
threerings/narya
core/src/main/java/com/threerings/presents/client/InvocationDirector.java
InvocationDirector.sendRequest
public void sendRequest (int invOid, int invCode, int methodId, Object[] args) { """ Requests that the specified invocation request be packaged up and sent to the supplied invocation oid. """ sendRequest(invOid, invCode, methodId, args, Transport.DEFAULT); }
java
public void sendRequest (int invOid, int invCode, int methodId, Object[] args) { sendRequest(invOid, invCode, methodId, args, Transport.DEFAULT); }
[ "public", "void", "sendRequest", "(", "int", "invOid", ",", "int", "invCode", ",", "int", "methodId", ",", "Object", "[", "]", "args", ")", "{", "sendRequest", "(", "invOid", ",", "invCode", ",", "methodId", ",", "args", ",", "Transport", ".", "DEFAULT", ")", ";", "}" ]
Requests that the specified invocation request be packaged up and sent to the supplied invocation oid.
[ "Requests", "that", "the", "specified", "invocation", "request", "be", "packaged", "up", "and", "sent", "to", "the", "supplied", "invocation", "oid", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/InvocationDirector.java#L207-L210
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java
KryoUtils.applyRegistrations
public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) { """ Apply a list of {@link KryoRegistration} to a Kryo instance. The list of registrations is assumed to already be a final resolution of all possible registration overwrites. <p>The registrations are applied in the given order and always specify the registration id as the next available id in the Kryo instance (providing the id just extra ensures nothing is overwritten, and isn't strictly required); @param kryo the Kryo instance to apply the registrations @param resolvedRegistrations the registrations, which should already be resolved of all possible registration overwrites """ Serializer<?> serializer; for (KryoRegistration registration : resolvedRegistrations) { serializer = registration.getSerializer(kryo); if (serializer != null) { kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId()); } else { kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId()); } } }
java
public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) { Serializer<?> serializer; for (KryoRegistration registration : resolvedRegistrations) { serializer = registration.getSerializer(kryo); if (serializer != null) { kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId()); } else { kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId()); } } }
[ "public", "static", "void", "applyRegistrations", "(", "Kryo", "kryo", ",", "Collection", "<", "KryoRegistration", ">", "resolvedRegistrations", ")", "{", "Serializer", "<", "?", ">", "serializer", ";", "for", "(", "KryoRegistration", "registration", ":", "resolvedRegistrations", ")", "{", "serializer", "=", "registration", ".", "getSerializer", "(", "kryo", ")", ";", "if", "(", "serializer", "!=", "null", ")", "{", "kryo", ".", "register", "(", "registration", ".", "getRegisteredClass", "(", ")", ",", "serializer", ",", "kryo", ".", "getNextRegistrationId", "(", ")", ")", ";", "}", "else", "{", "kryo", ".", "register", "(", "registration", ".", "getRegisteredClass", "(", ")", ",", "kryo", ".", "getNextRegistrationId", "(", ")", ")", ";", "}", "}", "}" ]
Apply a list of {@link KryoRegistration} to a Kryo instance. The list of registrations is assumed to already be a final resolution of all possible registration overwrites. <p>The registrations are applied in the given order and always specify the registration id as the next available id in the Kryo instance (providing the id just extra ensures nothing is overwritten, and isn't strictly required); @param kryo the Kryo instance to apply the registrations @param resolvedRegistrations the registrations, which should already be resolved of all possible registration overwrites
[ "Apply", "a", "list", "of", "{", "@link", "KryoRegistration", "}", "to", "a", "Kryo", "instance", ".", "The", "list", "of", "registrations", "is", "assumed", "to", "already", "be", "a", "final", "resolution", "of", "all", "possible", "registration", "overwrites", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java#L103-L115
lucidworks/spark-solr
src/main/java/com/lucidworks/spark/query/SolrStreamIterator.java
SolrStreamIterator.getStreamContext
protected StreamContext getStreamContext() { """ We have to set the streaming context so that we can pass our own cloud client with authentication """ StreamContext context = new StreamContext(); solrClientCache = new SparkSolrClientCache(cloudSolrClient, httpSolrClient); context.setSolrClientCache(solrClientCache); context.numWorkers = numWorkers; context.workerID = workerId; return context; }
java
protected StreamContext getStreamContext() { StreamContext context = new StreamContext(); solrClientCache = new SparkSolrClientCache(cloudSolrClient, httpSolrClient); context.setSolrClientCache(solrClientCache); context.numWorkers = numWorkers; context.workerID = workerId; return context; }
[ "protected", "StreamContext", "getStreamContext", "(", ")", "{", "StreamContext", "context", "=", "new", "StreamContext", "(", ")", ";", "solrClientCache", "=", "new", "SparkSolrClientCache", "(", "cloudSolrClient", ",", "httpSolrClient", ")", ";", "context", ".", "setSolrClientCache", "(", "solrClientCache", ")", ";", "context", ".", "numWorkers", "=", "numWorkers", ";", "context", ".", "workerID", "=", "workerId", ";", "return", "context", ";", "}" ]
We have to set the streaming context so that we can pass our own cloud client with authentication
[ "We", "have", "to", "set", "the", "streaming", "context", "so", "that", "we", "can", "pass", "our", "own", "cloud", "client", "with", "authentication" ]
train
https://github.com/lucidworks/spark-solr/blob/8ff1b3cdd99041be6070077c18ec9c1cd7257cc3/src/main/java/com/lucidworks/spark/query/SolrStreamIterator.java#L67-L74
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java
XmlRuleParserPlugin.getSeverity
private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException { """ Get the severity. @param severityType The severity type. @param defaultSeverity The default severity. @return The severity. """ return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value()); }
java
private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException { return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value()); }
[ "private", "Severity", "getSeverity", "(", "SeverityEnumType", "severityType", ",", "Severity", "defaultSeverity", ")", "throws", "RuleException", "{", "return", "severityType", "==", "null", "?", "defaultSeverity", ":", "Severity", ".", "fromValue", "(", "severityType", ".", "value", "(", ")", ")", ";", "}" ]
Get the severity. @param severityType The severity type. @param defaultSeverity The default severity. @return The severity.
[ "Get", "the", "severity", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java#L274-L276
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java
NCBIQBlastService.getAlignmentResults
@Override public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws Exception { """ Extracts the actual Blast report for given request id according to options provided in {@code outputProperties} argument. <p/> If the results are not ready yet, sleeps until they are available. If sleeping is not desired, call this method after {@code isReady} returns true @param id : request id, which was returned by {@code sendAlignmentRequest} method @param outputProperties : an object specifying output formatting options @return an {@code InputStream} of results @throws Exception if it is not possible to recover the results """ Map<String, String> params = new HashMap<String, String>(); for (String key : outputProperties.getOutputOptions()) { params.put(key, outputProperties.getOutputOption(key)); } OutputStreamWriter writer = null; while (!isReady(id)) { Thread.sleep(WAIT_INCREMENT + 100); } params.put(CMD.name(), "Get"); params.put(RID.name(), id); params.put(TOOL.name(), getTool()); params.put(EMAIL.name(), getEmail()); String getCmd = MAP_TO_STRING_TRANSFORMER.transform(params); try { URLConnection serviceConnection = setQBlastServiceProperties(serviceUrl.openConnection()); writer = new OutputStreamWriter(serviceConnection.getOutputStream()); writer.write(getCmd); writer.flush(); return serviceConnection.getInputStream(); } catch (IOException ioe) { throw new Exception("It is not possible to fetch Blast report from NCBI at this time. Cause: " + ioe.getMessage(), ioe); } finally { IOUtils.close(writer); } }
java
@Override public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws Exception { Map<String, String> params = new HashMap<String, String>(); for (String key : outputProperties.getOutputOptions()) { params.put(key, outputProperties.getOutputOption(key)); } OutputStreamWriter writer = null; while (!isReady(id)) { Thread.sleep(WAIT_INCREMENT + 100); } params.put(CMD.name(), "Get"); params.put(RID.name(), id); params.put(TOOL.name(), getTool()); params.put(EMAIL.name(), getEmail()); String getCmd = MAP_TO_STRING_TRANSFORMER.transform(params); try { URLConnection serviceConnection = setQBlastServiceProperties(serviceUrl.openConnection()); writer = new OutputStreamWriter(serviceConnection.getOutputStream()); writer.write(getCmd); writer.flush(); return serviceConnection.getInputStream(); } catch (IOException ioe) { throw new Exception("It is not possible to fetch Blast report from NCBI at this time. Cause: " + ioe.getMessage(), ioe); } finally { IOUtils.close(writer); } }
[ "@", "Override", "public", "InputStream", "getAlignmentResults", "(", "String", "id", ",", "RemotePairwiseAlignmentOutputProperties", "outputProperties", ")", "throws", "Exception", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "String", "key", ":", "outputProperties", ".", "getOutputOptions", "(", ")", ")", "{", "params", ".", "put", "(", "key", ",", "outputProperties", ".", "getOutputOption", "(", "key", ")", ")", ";", "}", "OutputStreamWriter", "writer", "=", "null", ";", "while", "(", "!", "isReady", "(", "id", ")", ")", "{", "Thread", ".", "sleep", "(", "WAIT_INCREMENT", "+", "100", ")", ";", "}", "params", ".", "put", "(", "CMD", ".", "name", "(", ")", ",", "\"Get\"", ")", ";", "params", ".", "put", "(", "RID", ".", "name", "(", ")", ",", "id", ")", ";", "params", ".", "put", "(", "TOOL", ".", "name", "(", ")", ",", "getTool", "(", ")", ")", ";", "params", ".", "put", "(", "EMAIL", ".", "name", "(", ")", ",", "getEmail", "(", ")", ")", ";", "String", "getCmd", "=", "MAP_TO_STRING_TRANSFORMER", ".", "transform", "(", "params", ")", ";", "try", "{", "URLConnection", "serviceConnection", "=", "setQBlastServiceProperties", "(", "serviceUrl", ".", "openConnection", "(", ")", ")", ";", "writer", "=", "new", "OutputStreamWriter", "(", "serviceConnection", ".", "getOutputStream", "(", ")", ")", ";", "writer", ".", "write", "(", "getCmd", ")", ";", "writer", ".", "flush", "(", ")", ";", "return", "serviceConnection", ".", "getInputStream", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "Exception", "(", "\"It is not possible to fetch Blast report from NCBI at this time. Cause: \"", "+", "ioe", ".", "getMessage", "(", ")", ",", "ioe", ")", ";", "}", "finally", "{", "IOUtils", ".", "close", "(", "writer", ")", ";", "}", "}" ]
Extracts the actual Blast report for given request id according to options provided in {@code outputProperties} argument. <p/> If the results are not ready yet, sleeps until they are available. If sleeping is not desired, call this method after {@code isReady} returns true @param id : request id, which was returned by {@code sendAlignmentRequest} method @param outputProperties : an object specifying output formatting options @return an {@code InputStream} of results @throws Exception if it is not possible to recover the results
[ "Extracts", "the", "actual", "Blast", "report", "for", "given", "request", "id", "according", "to", "options", "provided", "in", "{", "@code", "outputProperties", "}", "argument", ".", "<p", "/", ">", "If", "the", "results", "are", "not", "ready", "yet", "sleeps", "until", "they", "are", "available", ".", "If", "sleeping", "is", "not", "desired", "call", "this", "method", "after", "{", "@code", "isReady", "}", "returns", "true" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java#L319-L348
box/box-java-sdk
src/main/java/com/box/sdk/BoxUser.java
BoxUser.addEmailAlias
public EmailAlias addEmailAlias(String email, boolean isConfirmed) { """ Adds a new email alias to this user's account and confirms it without user interaction. This functionality is only available for enterprise admins. @param email the email address to add as an alias. @param isConfirmed whether or not the email alias should be automatically confirmed. @return the newly created email alias. """ URL url = EMAIL_ALIASES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "POST"); JsonObject requestJSON = new JsonObject() .add("email", email); if (isConfirmed) { requestJSON.add("is_confirmed", isConfirmed); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); return new EmailAlias(responseJSON); }
java
public EmailAlias addEmailAlias(String email, boolean isConfirmed) { URL url = EMAIL_ALIASES_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "POST"); JsonObject requestJSON = new JsonObject() .add("email", email); if (isConfirmed) { requestJSON.add("is_confirmed", isConfirmed); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); return new EmailAlias(responseJSON); }
[ "public", "EmailAlias", "addEmailAlias", "(", "String", "email", ",", "boolean", "isConfirmed", ")", "{", "URL", "url", "=", "EMAIL_ALIASES_URL_TEMPLATE", ".", "build", "(", "this", ".", "getAPI", "(", ")", ".", "getBaseURL", "(", ")", ",", "this", ".", "getID", "(", ")", ")", ";", "BoxJSONRequest", "request", "=", "new", "BoxJSONRequest", "(", "this", ".", "getAPI", "(", ")", ",", "url", ",", "\"POST\"", ")", ";", "JsonObject", "requestJSON", "=", "new", "JsonObject", "(", ")", ".", "add", "(", "\"email\"", ",", "email", ")", ";", "if", "(", "isConfirmed", ")", "{", "requestJSON", ".", "add", "(", "\"is_confirmed\"", ",", "isConfirmed", ")", ";", "}", "request", ".", "setBody", "(", "requestJSON", ".", "toString", "(", ")", ")", ";", "BoxJSONResponse", "response", "=", "(", "BoxJSONResponse", ")", "request", ".", "send", "(", ")", ";", "JsonObject", "responseJSON", "=", "JsonObject", ".", "readFrom", "(", "response", ".", "getJSON", "(", ")", ")", ";", "return", "new", "EmailAlias", "(", "responseJSON", ")", ";", "}" ]
Adds a new email alias to this user's account and confirms it without user interaction. This functionality is only available for enterprise admins. @param email the email address to add as an alias. @param isConfirmed whether or not the email alias should be automatically confirmed. @return the newly created email alias.
[ "Adds", "a", "new", "email", "alias", "to", "this", "user", "s", "account", "and", "confirms", "it", "without", "user", "interaction", ".", "This", "functionality", "is", "only", "available", "for", "enterprise", "admins", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L357-L372
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
WriteOnlyCollection.doesStaticFactoryReturnNeedToBeWatched
@Override protected boolean doesStaticFactoryReturnNeedToBeWatched(String clsName, String methodName, String signature) { """ implements the MissingMethodsDetector to determine whether this factory-like method returns a collection @param clsName the clsName the class name of the factory @param methodName the method name of the factory @param signature the signature of the factory method @return whether this class is a collection """ return collectionFactoryMethods.contains(new FQMethod(clsName, methodName, signature)); }
java
@Override protected boolean doesStaticFactoryReturnNeedToBeWatched(String clsName, String methodName, String signature) { return collectionFactoryMethods.contains(new FQMethod(clsName, methodName, signature)); }
[ "@", "Override", "protected", "boolean", "doesStaticFactoryReturnNeedToBeWatched", "(", "String", "clsName", ",", "String", "methodName", ",", "String", "signature", ")", "{", "return", "collectionFactoryMethods", ".", "contains", "(", "new", "FQMethod", "(", "clsName", ",", "methodName", ",", "signature", ")", ")", ";", "}" ]
implements the MissingMethodsDetector to determine whether this factory-like method returns a collection @param clsName the clsName the class name of the factory @param methodName the method name of the factory @param signature the signature of the factory method @return whether this class is a collection
[ "implements", "the", "MissingMethodsDetector", "to", "determine", "whether", "this", "factory", "-", "like", "method", "returns", "a", "collection" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java#L270-L273
alkacon/opencms-core
src/org/opencms/ui/dataview/CmsColumnValueConverter.java
CmsColumnValueConverter.getColumnValue
public static Object getColumnValue(Object value, CmsDataViewColumn.Type type) { """ Gets the actual column value for the given data value.<p> @param value the data value @param type the column type enum @return the actual column value to use """ if (type == Type.imageType) { Image image = new Image("", new ExternalResource((String)value)); image.addStyleName("o-table-image"); return image; } else { return value; } }
java
public static Object getColumnValue(Object value, CmsDataViewColumn.Type type) { if (type == Type.imageType) { Image image = new Image("", new ExternalResource((String)value)); image.addStyleName("o-table-image"); return image; } else { return value; } }
[ "public", "static", "Object", "getColumnValue", "(", "Object", "value", ",", "CmsDataViewColumn", ".", "Type", "type", ")", "{", "if", "(", "type", "==", "Type", ".", "imageType", ")", "{", "Image", "image", "=", "new", "Image", "(", "\"\"", ",", "new", "ExternalResource", "(", "(", "String", ")", "value", ")", ")", ";", "image", ".", "addStyleName", "(", "\"o-table-image\"", ")", ";", "return", "image", ";", "}", "else", "{", "return", "value", ";", "}", "}" ]
Gets the actual column value for the given data value.<p> @param value the data value @param type the column type enum @return the actual column value to use
[ "Gets", "the", "actual", "column", "value", "for", "the", "given", "data", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dataview/CmsColumnValueConverter.java#L72-L81
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java
DataSourceWrapper.getConnection
public Connection getConnection(String username, String password) throws SQLException { """ Always throws a SQLException. Username and password are set in the constructor and can not be changed. """ throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); }
java
public Connection getConnection(String username, String password) throws SQLException { throw new SQLException(Resources.getMessage("NOT_SUPPORTED")); }
[ "public", "Connection", "getConnection", "(", "String", "username", ",", "String", "password", ")", "throws", "SQLException", "{", "throw", "new", "SQLException", "(", "Resources", ".", "getMessage", "(", "\"NOT_SUPPORTED\"", ")", ")", ";", "}" ]
Always throws a SQLException. Username and password are set in the constructor and can not be changed.
[ "Always", "throws", "a", "SQLException", ".", "Username", "and", "password", "are", "set", "in", "the", "constructor", "and", "can", "not", "be", "changed", "." ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java#L111-L114
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrIndex.java
CmsSolrIndex.select
public void select(ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows) throws Exception { """ Writes the response into the writer.<p> NOTE: Currently not available for HTTP server.<p> @param response the servlet response @param cms the CMS object to use for search @param query the Solr query @param ignoreMaxRows if to return unlimited results @throws Exception if there is no embedded server """ throwExceptionIfSafetyRestrictionsAreViolated(cms, query, false); boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject(); CmsResourceFilter filter = isOnline ? null : CmsResourceFilter.IGNORE_EXPIRATION; search(cms, query, ignoreMaxRows, response, false, filter); }
java
public void select(ServletResponse response, CmsObject cms, CmsSolrQuery query, boolean ignoreMaxRows) throws Exception { throwExceptionIfSafetyRestrictionsAreViolated(cms, query, false); boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject(); CmsResourceFilter filter = isOnline ? null : CmsResourceFilter.IGNORE_EXPIRATION; search(cms, query, ignoreMaxRows, response, false, filter); }
[ "public", "void", "select", "(", "ServletResponse", "response", ",", "CmsObject", "cms", ",", "CmsSolrQuery", "query", ",", "boolean", "ignoreMaxRows", ")", "throws", "Exception", "{", "throwExceptionIfSafetyRestrictionsAreViolated", "(", "cms", ",", "query", ",", "false", ")", ";", "boolean", "isOnline", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentProject", "(", ")", ".", "isOnlineProject", "(", ")", ";", "CmsResourceFilter", "filter", "=", "isOnline", "?", "null", ":", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ";", "search", "(", "cms", ",", "query", ",", "ignoreMaxRows", ",", "response", ",", "false", ",", "filter", ")", ";", "}" ]
Writes the response into the writer.<p> NOTE: Currently not available for HTTP server.<p> @param response the servlet response @param cms the CMS object to use for search @param query the Solr query @param ignoreMaxRows if to return unlimited results @throws Exception if there is no embedded server
[ "Writes", "the", "response", "into", "the", "writer", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L1329-L1337
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource.java
WSJdbcDataSource.replaceObject
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) { """ Returns a replacement object that can be serialized instead of WSJdbcDataSource. @param resRefConfigFactory factory for resource ref config. @return a replacement object that can be serialized instead of WSJdbcDataSource. """ DSConfig config = dsConfig.get(); String filter = config.jndiName == null || config.jndiName.startsWith("java:") ? FilterUtils.createPropertyFilter("config.displayId", config.id) : FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName); ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName()); if (resRefInfo != null) { resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling()); resRefConfig.setCommitPriority(resRefInfo.getCommitPriority()); resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel()); resRefConfig.setJNDIName(resRefInfo.getJNDIName()); resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName()); resRefConfig.setResAuthType(resRefInfo.getAuth()); resRefConfig.setSharingScope(resRefInfo.getSharingScope()); } return new SerializedDataSourceWrapper(filter, resRefConfig); }
java
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) { DSConfig config = dsConfig.get(); String filter = config.jndiName == null || config.jndiName.startsWith("java:") ? FilterUtils.createPropertyFilter("config.displayId", config.id) : FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName); ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName()); if (resRefInfo != null) { resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling()); resRefConfig.setCommitPriority(resRefInfo.getCommitPriority()); resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel()); resRefConfig.setJNDIName(resRefInfo.getJNDIName()); resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName()); resRefConfig.setResAuthType(resRefInfo.getAuth()); resRefConfig.setSharingScope(resRefInfo.getSharingScope()); } return new SerializedDataSourceWrapper(filter, resRefConfig); }
[ "Object", "replaceObject", "(", "ResourceRefConfigFactory", "resRefConfigFactory", ")", "{", "DSConfig", "config", "=", "dsConfig", ".", "get", "(", ")", ";", "String", "filter", "=", "config", ".", "jndiName", "==", "null", "||", "config", ".", "jndiName", ".", "startsWith", "(", "\"java:\"", ")", "?", "FilterUtils", ".", "createPropertyFilter", "(", "\"config.displayId\"", ",", "config", ".", "id", ")", ":", "FilterUtils", ".", "createPropertyFilter", "(", "ResourceFactory", ".", "JNDI_NAME", ",", "config", ".", "jndiName", ")", ";", "ResourceRefConfig", "resRefConfig", "=", "resRefInfo", "==", "null", "?", "null", ":", "resRefConfigFactory", ".", "createResourceRefConfig", "(", "DataSource", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "resRefInfo", "!=", "null", ")", "{", "resRefConfig", ".", "setBranchCoupling", "(", "resRefInfo", ".", "getBranchCoupling", "(", ")", ")", ";", "resRefConfig", ".", "setCommitPriority", "(", "resRefInfo", ".", "getCommitPriority", "(", ")", ")", ";", "resRefConfig", ".", "setIsolationLevel", "(", "resRefInfo", ".", "getIsolationLevel", "(", ")", ")", ";", "resRefConfig", ".", "setJNDIName", "(", "resRefInfo", ".", "getJNDIName", "(", ")", ")", ";", "resRefConfig", ".", "setLoginConfigurationName", "(", "resRefInfo", ".", "getLoginConfigurationName", "(", ")", ")", ";", "resRefConfig", ".", "setResAuthType", "(", "resRefInfo", ".", "getAuth", "(", ")", ")", ";", "resRefConfig", ".", "setSharingScope", "(", "resRefInfo", ".", "getSharingScope", "(", ")", ")", ";", "}", "return", "new", "SerializedDataSourceWrapper", "(", "filter", ",", "resRefConfig", ")", ";", "}" ]
Returns a replacement object that can be serialized instead of WSJdbcDataSource. @param resRefConfigFactory factory for resource ref config. @return a replacement object that can be serialized instead of WSJdbcDataSource.
[ "Returns", "a", "replacement", "object", "that", "can", "be", "serialized", "instead", "of", "WSJdbcDataSource", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource.java#L341-L357
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
AbstractTagLibrary.addUserTag
protected final void addUserTag(String name, URL source) { """ Add a UserTagHandler specified a the URL source. @see UserTagHandler @param name name to use, "foo" would be &lt;my:foo /> @param source source where the Facelet (Tag) source is """ if (_strictJsf2FaceletsCompatibility == null) { MyfacesConfig config = MyfacesConfig.getCurrentInstance( FacesContext.getCurrentInstance().getExternalContext()); _strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility(); } if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility)) { _factories.put(name, new LegacyUserTagFactory(source)); } else { _factories.put(name, new UserTagFactory(source)); } }
java
protected final void addUserTag(String name, URL source) { if (_strictJsf2FaceletsCompatibility == null) { MyfacesConfig config = MyfacesConfig.getCurrentInstance( FacesContext.getCurrentInstance().getExternalContext()); _strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility(); } if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility)) { _factories.put(name, new LegacyUserTagFactory(source)); } else { _factories.put(name, new UserTagFactory(source)); } }
[ "protected", "final", "void", "addUserTag", "(", "String", "name", ",", "URL", "source", ")", "{", "if", "(", "_strictJsf2FaceletsCompatibility", "==", "null", ")", "{", "MyfacesConfig", "config", "=", "MyfacesConfig", ".", "getCurrentInstance", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ")", ";", "_strictJsf2FaceletsCompatibility", "=", "config", ".", "isStrictJsf2FaceletsCompatibility", "(", ")", ";", "}", "if", "(", "Boolean", ".", "TRUE", ".", "equals", "(", "_strictJsf2FaceletsCompatibility", ")", ")", "{", "_factories", ".", "put", "(", "name", ",", "new", "LegacyUserTagFactory", "(", "source", ")", ")", ";", "}", "else", "{", "_factories", ".", "put", "(", "name", ",", "new", "UserTagFactory", "(", "source", ")", ")", ";", "}", "}" ]
Add a UserTagHandler specified a the URL source. @see UserTagHandler @param name name to use, "foo" would be &lt;my:foo /> @param source source where the Facelet (Tag) source is
[ "Add", "a", "UserTagHandler", "specified", "a", "the", "URL", "source", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L276-L293
drinkjava2/jDialects
core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java
TableModel.sequenceGenerator
public void sequenceGenerator(String name, String sequenceName, Integer initialValue, Integer allocationSize) { """ Add a sequence definition DDL, note: some dialects do not support sequence @param name The name of sequence Java object itself @param sequenceName the name of the sequence will created in database @param initialValue The initial value @param allocationSize The allocationSize """ checkReadOnly(); this.addGenerator(new SequenceIdGenerator(name, sequenceName, initialValue, allocationSize)); }
java
public void sequenceGenerator(String name, String sequenceName, Integer initialValue, Integer allocationSize) { checkReadOnly(); this.addGenerator(new SequenceIdGenerator(name, sequenceName, initialValue, allocationSize)); }
[ "public", "void", "sequenceGenerator", "(", "String", "name", ",", "String", "sequenceName", ",", "Integer", "initialValue", ",", "Integer", "allocationSize", ")", "{", "checkReadOnly", "(", ")", ";", "this", ".", "addGenerator", "(", "new", "SequenceIdGenerator", "(", "name", ",", "sequenceName", ",", "initialValue", ",", "allocationSize", ")", ")", ";", "}" ]
Add a sequence definition DDL, note: some dialects do not support sequence @param name The name of sequence Java object itself @param sequenceName the name of the sequence will created in database @param initialValue The initial value @param allocationSize The allocationSize
[ "Add", "a", "sequence", "definition", "DDL", "note", ":", "some", "dialects", "do", "not", "support", "sequence" ]
train
https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/model/TableModel.java#L164-L167
aoindustries/aocode-public
src/main/java/com/aoindustries/servlet/http/ServletUtil.java
ServletUtil.resourceExists
@Deprecated public static boolean resourceExists(ServletContext servletContext, String path) throws MalformedURLException { """ Checks if a resource with the possibly-relative path exists. @deprecated Use regular methods directly @see ServletContext#getResource(java.lang.String) @see ServletContextCache#getResource(java.lang.String) @see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String) """ return getResource(servletContext, path)!=null; }
java
@Deprecated public static boolean resourceExists(ServletContext servletContext, String path) throws MalformedURLException { return getResource(servletContext, path)!=null; }
[ "@", "Deprecated", "public", "static", "boolean", "resourceExists", "(", "ServletContext", "servletContext", ",", "String", "path", ")", "throws", "MalformedURLException", "{", "return", "getResource", "(", "servletContext", ",", "path", ")", "!=", "null", ";", "}" ]
Checks if a resource with the possibly-relative path exists. @deprecated Use regular methods directly @see ServletContext#getResource(java.lang.String) @see ServletContextCache#getResource(java.lang.String) @see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String)
[ "Checks", "if", "a", "resource", "with", "the", "possibly", "-", "relative", "path", "exists", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L189-L192
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java
DomainsInner.createOrUpdate
public DomainInner createOrUpdate(String resourceGroupName, String domainName, DomainInner domainInfo) { """ Create a domain. Asynchronously creates a new domain with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @param domainInfo Domain information @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DomainInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, domainName, domainInfo).toBlocking().last().body(); }
java
public DomainInner createOrUpdate(String resourceGroupName, String domainName, DomainInner domainInfo) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, domainName, domainInfo).toBlocking().last().body(); }
[ "public", "DomainInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "DomainInner", "domainInfo", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "domainInfo", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create a domain. Asynchronously creates a new domain with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @param domainInfo Domain information @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DomainInner object if successful.
[ "Create", "a", "domain", ".", "Asynchronously", "creates", "a", "new", "domain", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L217-L219
redisson/redisson
redisson/src/main/java/org/redisson/executor/TasksRunnerService.java
TasksRunnerService.finish
private void finish(String requestId, boolean removeTask) { """ Check shutdown state. If tasksCounter equals <code>0</code> and executor in <code>shutdown</code> state, then set <code>terminated</code> state and notify terminationTopicName <p> If <code>scheduledRequestId</code> is not null then delete scheduled task @param requestId """ String script = ""; if (removeTask) { script += "local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);" + "if scheduled == false then " + "redis.call('hdel', KEYS[4], ARGV[3]); " + "end;"; } script += "redis.call('zrem', KEYS[5], 'ff' .. ARGV[3]);" + "if redis.call('decr', KEYS[1]) == 0 then " + "redis.call('del', KEYS[1]);" + "if redis.call('get', KEYS[2]) == ARGV[1] then " + "redis.call('del', KEYS[6]);" + "redis.call('set', KEYS[2], ARGV[2]);" + "redis.call('publish', KEYS[3], ARGV[2]);" + "end;" + "end;"; commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID, script, Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName), RedissonExecutorService.SHUTDOWN_STATE, RedissonExecutorService.TERMINATED_STATE, requestId); }
java
private void finish(String requestId, boolean removeTask) { String script = ""; if (removeTask) { script += "local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);" + "if scheduled == false then " + "redis.call('hdel', KEYS[4], ARGV[3]); " + "end;"; } script += "redis.call('zrem', KEYS[5], 'ff' .. ARGV[3]);" + "if redis.call('decr', KEYS[1]) == 0 then " + "redis.call('del', KEYS[1]);" + "if redis.call('get', KEYS[2]) == ARGV[1] then " + "redis.call('del', KEYS[6]);" + "redis.call('set', KEYS[2], ARGV[2]);" + "redis.call('publish', KEYS[3], ARGV[2]);" + "end;" + "end;"; commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID, script, Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName), RedissonExecutorService.SHUTDOWN_STATE, RedissonExecutorService.TERMINATED_STATE, requestId); }
[ "private", "void", "finish", "(", "String", "requestId", ",", "boolean", "removeTask", ")", "{", "String", "script", "=", "\"\"", ";", "if", "(", "removeTask", ")", "{", "script", "+=", "\"local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);\"", "+", "\"if scheduled == false then \"", "+", "\"redis.call('hdel', KEYS[4], ARGV[3]); \"", "+", "\"end;\"", ";", "}", "script", "+=", "\"redis.call('zrem', KEYS[5], 'ff' .. ARGV[3]);\"", "+", "\"if redis.call('decr', KEYS[1]) == 0 then \"", "+", "\"redis.call('del', KEYS[1]);\"", "+", "\"if redis.call('get', KEYS[2]) == ARGV[1] then \"", "+", "\"redis.call('del', KEYS[6]);\"", "+", "\"redis.call('set', KEYS[2], ARGV[2]);\"", "+", "\"redis.call('publish', KEYS[3], ARGV[2]);\"", "+", "\"end;\"", "+", "\"end;\"", ";", "commandExecutor", ".", "evalWrite", "(", "name", ",", "StringCodec", ".", "INSTANCE", ",", "RedisCommands", ".", "EVAL_VOID", ",", "script", ",", "Arrays", ".", "<", "Object", ">", "asList", "(", "tasksCounterName", ",", "statusName", ",", "terminationTopicName", ",", "tasksName", ",", "schedulerQueueName", ",", "tasksRetryIntervalName", ")", ",", "RedissonExecutorService", ".", "SHUTDOWN_STATE", ",", "RedissonExecutorService", ".", "TERMINATED_STATE", ",", "requestId", ")", ";", "}" ]
Check shutdown state. If tasksCounter equals <code>0</code> and executor in <code>shutdown</code> state, then set <code>terminated</code> state and notify terminationTopicName <p> If <code>scheduledRequestId</code> is not null then delete scheduled task @param requestId
[ "Check", "shutdown", "state", ".", "If", "tasksCounter", "equals", "<code", ">", "0<", "/", "code", ">", "and", "executor", "in", "<code", ">", "shutdown<", "/", "code", ">", "state", "then", "set", "<code", ">", "terminated<", "/", "code", ">", "state", "and", "notify", "terminationTopicName", "<p", ">", "If", "<code", ">", "scheduledRequestId<", "/", "code", ">", "is", "not", "null", "then", "delete", "scheduled", "task" ]
train
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/executor/TasksRunnerService.java#L329-L351
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/resource/Delay.java
Delay.fullJitter
public static Delay fullJitter(Duration lower, Duration upper, long base, TimeUnit targetTimeUnit) { """ Creates a new {@link FullJitterDelay}. @param lower the lower boundary, must be non-negative @param upper the upper boundary, must be greater than the lower boundary @param base the base, must be greater or equal to 1 @param targetTimeUnit the unit of the delay. @return a created {@link FullJitterDelay}. @since 5.0 """ LettuceAssert.notNull(lower, "Lower boundary must not be null"); LettuceAssert.isTrue(lower.toNanos() >= 0, "Lower boundary must be greater or equal to 0"); LettuceAssert.notNull(upper, "Upper boundary must not be null"); LettuceAssert.isTrue(upper.toNanos() > lower.toNanos(), "Upper boundary must be greater than the lower boundary"); LettuceAssert.isTrue(base >= 1, "Base must be greater or equal to 1"); LettuceAssert.notNull(targetTimeUnit, "Target TimeUnit must not be null"); return new FullJitterDelay(lower, upper, base, targetTimeUnit); }
java
public static Delay fullJitter(Duration lower, Duration upper, long base, TimeUnit targetTimeUnit) { LettuceAssert.notNull(lower, "Lower boundary must not be null"); LettuceAssert.isTrue(lower.toNanos() >= 0, "Lower boundary must be greater or equal to 0"); LettuceAssert.notNull(upper, "Upper boundary must not be null"); LettuceAssert.isTrue(upper.toNanos() > lower.toNanos(), "Upper boundary must be greater than the lower boundary"); LettuceAssert.isTrue(base >= 1, "Base must be greater or equal to 1"); LettuceAssert.notNull(targetTimeUnit, "Target TimeUnit must not be null"); return new FullJitterDelay(lower, upper, base, targetTimeUnit); }
[ "public", "static", "Delay", "fullJitter", "(", "Duration", "lower", ",", "Duration", "upper", ",", "long", "base", ",", "TimeUnit", "targetTimeUnit", ")", "{", "LettuceAssert", ".", "notNull", "(", "lower", ",", "\"Lower boundary must not be null\"", ")", ";", "LettuceAssert", ".", "isTrue", "(", "lower", ".", "toNanos", "(", ")", ">=", "0", ",", "\"Lower boundary must be greater or equal to 0\"", ")", ";", "LettuceAssert", ".", "notNull", "(", "upper", ",", "\"Upper boundary must not be null\"", ")", ";", "LettuceAssert", ".", "isTrue", "(", "upper", ".", "toNanos", "(", ")", ">", "lower", ".", "toNanos", "(", ")", ",", "\"Upper boundary must be greater than the lower boundary\"", ")", ";", "LettuceAssert", ".", "isTrue", "(", "base", ">=", "1", ",", "\"Base must be greater or equal to 1\"", ")", ";", "LettuceAssert", ".", "notNull", "(", "targetTimeUnit", ",", "\"Target TimeUnit must not be null\"", ")", ";", "return", "new", "FullJitterDelay", "(", "lower", ",", "upper", ",", "base", ",", "targetTimeUnit", ")", ";", "}" ]
Creates a new {@link FullJitterDelay}. @param lower the lower boundary, must be non-negative @param upper the upper boundary, must be greater than the lower boundary @param base the base, must be greater or equal to 1 @param targetTimeUnit the unit of the delay. @return a created {@link FullJitterDelay}. @since 5.0
[ "Creates", "a", "new", "{", "@link", "FullJitterDelay", "}", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/resource/Delay.java#L232-L242
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/custom/CustomManifest.java
CustomManifest.getFeatureId
protected static String getFeatureId(File featureManifest) throws IOException { """ Find corresponding feature id (i.e., user or myExt1 from the location of feature manifest file. The logic is that since the location of the feature manifest file is .../lib/features/<feature manifest> find the parent of lib directory, and compare the location information of the ProductionExtension objects, and if they match, get the corresponding feature id from the ProductExtension object and return it. If there is no matching id, return null. @throws IOException """ String rootDir = CustomUtils.getCanonicalPath(featureManifest.getParentFile().getParentFile().getParentFile()); // go up two directories. String output = null; // check with user feature dir. if (rootDir.equals(CustomUtils.getCanonicalPath(new File(CustomUtils.getInstallRoot(), CustomUtils.USER_FEATURE_DIR)))) { output = "usr"; } else { for (ProductExtensionInfo info : ProductExtension.getProductExtensions()) { File extensionDir = new File(info.getLocation()); if (!CustomUtils.isAbsolute(extensionDir)) { File parentDir = new File(CustomUtils.getInstallRoot()).getParentFile(); extensionDir = new File(parentDir, info.getLocation()); } if (rootDir.equals(CustomUtils.getCanonicalPath(extensionDir))) { output = info.getProductID(); break; } } } return output; }
java
protected static String getFeatureId(File featureManifest) throws IOException { String rootDir = CustomUtils.getCanonicalPath(featureManifest.getParentFile().getParentFile().getParentFile()); // go up two directories. String output = null; // check with user feature dir. if (rootDir.equals(CustomUtils.getCanonicalPath(new File(CustomUtils.getInstallRoot(), CustomUtils.USER_FEATURE_DIR)))) { output = "usr"; } else { for (ProductExtensionInfo info : ProductExtension.getProductExtensions()) { File extensionDir = new File(info.getLocation()); if (!CustomUtils.isAbsolute(extensionDir)) { File parentDir = new File(CustomUtils.getInstallRoot()).getParentFile(); extensionDir = new File(parentDir, info.getLocation()); } if (rootDir.equals(CustomUtils.getCanonicalPath(extensionDir))) { output = info.getProductID(); break; } } } return output; }
[ "protected", "static", "String", "getFeatureId", "(", "File", "featureManifest", ")", "throws", "IOException", "{", "String", "rootDir", "=", "CustomUtils", ".", "getCanonicalPath", "(", "featureManifest", ".", "getParentFile", "(", ")", ".", "getParentFile", "(", ")", ".", "getParentFile", "(", ")", ")", ";", "// go up two directories.", "String", "output", "=", "null", ";", "// check with user feature dir.", "if", "(", "rootDir", ".", "equals", "(", "CustomUtils", ".", "getCanonicalPath", "(", "new", "File", "(", "CustomUtils", ".", "getInstallRoot", "(", ")", ",", "CustomUtils", ".", "USER_FEATURE_DIR", ")", ")", ")", ")", "{", "output", "=", "\"usr\"", ";", "}", "else", "{", "for", "(", "ProductExtensionInfo", "info", ":", "ProductExtension", ".", "getProductExtensions", "(", ")", ")", "{", "File", "extensionDir", "=", "new", "File", "(", "info", ".", "getLocation", "(", ")", ")", ";", "if", "(", "!", "CustomUtils", ".", "isAbsolute", "(", "extensionDir", ")", ")", "{", "File", "parentDir", "=", "new", "File", "(", "CustomUtils", ".", "getInstallRoot", "(", ")", ")", ".", "getParentFile", "(", ")", ";", "extensionDir", "=", "new", "File", "(", "parentDir", ",", "info", ".", "getLocation", "(", ")", ")", ";", "}", "if", "(", "rootDir", ".", "equals", "(", "CustomUtils", ".", "getCanonicalPath", "(", "extensionDir", ")", ")", ")", "{", "output", "=", "info", ".", "getProductID", "(", ")", ";", "break", ";", "}", "}", "}", "return", "output", ";", "}" ]
Find corresponding feature id (i.e., user or myExt1 from the location of feature manifest file. The logic is that since the location of the feature manifest file is .../lib/features/<feature manifest> find the parent of lib directory, and compare the location information of the ProductionExtension objects, and if they match, get the corresponding feature id from the ProductExtension object and return it. If there is no matching id, return null. @throws IOException
[ "Find", "corresponding", "feature", "id", "(", "i", ".", "e", ".", "user", "or", "myExt1", "from", "the", "location", "of", "feature", "manifest", "file", ".", "The", "logic", "is", "that", "since", "the", "location", "of", "the", "feature", "manifest", "file", "is", "...", "/", "lib", "/", "features", "/", "<feature", "manifest", ">", "find", "the", "parent", "of", "lib", "directory", "and", "compare", "the", "location", "information", "of", "the", "ProductionExtension", "objects", "and", "if", "they", "match", "get", "the", "corresponding", "feature", "id", "from", "the", "ProductExtension", "object", "and", "return", "it", ".", "If", "there", "is", "no", "matching", "id", "return", "null", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/ws/crypto/util/custom/CustomManifest.java#L288-L308
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareImage.java
DetectFiducialSquareImage.addPattern
public int addPattern(GrayU8 inputBinary, double lengthSide) { """ Adds a new image to the detector. Image must be gray-scale and is converted into a binary image using the specified threshold. All input images are rescaled to be square and of the appropriate size. Thus the original shape of the image doesn't matter. Square shapes are highly recommended since that's what the target looks like. @param inputBinary Binary input image pattern. 0 = black, 1 = white. @param lengthSide How long one of the sides of the target is in world units. @return The ID of the provided image """ if( inputBinary == null ) { throw new IllegalArgumentException("Input image is null."); } else if( lengthSide <= 0 ) { throw new IllegalArgumentException("Parameter lengthSide must be more than zero"); } else if(ImageStatistics.max(inputBinary) > 1 ) throw new IllegalArgumentException("A binary image is composed on 0 and 1 pixels. This isn't binary!"); // see if it needs to be resized if ( inputBinary.width != squareLength || inputBinary.height != squareLength ) { // need to create a new image and rescale it to better handle the resizing GrayF32 inputGray = new GrayF32(inputBinary.width,inputBinary.height); ConvertImage.convert(inputBinary,inputGray); PixelMath.multiply(inputGray,255,inputGray); GrayF32 scaled = new GrayF32(squareLength,squareLength); // See if it can use the better algorithm for scaling down the image if( inputBinary.width > squareLength && inputBinary.height > squareLength ) { AverageDownSampleOps.down(inputGray,scaled); } else { new FDistort(inputGray,scaled).scaleExt().apply(); } GThresholdImageOps.threshold(scaled,binary,255/2.0,false); } else { binary.setTo(inputBinary); } // describe it in 4 different orientations FiducialDef def = new FiducialDef(); def.lengthSide = lengthSide; // CCW rotation so that the index refers to how many CW rotation it takes to put it into the nominal pose binaryToDef(binary, def.desc[0]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[1]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[2]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[3]); int index = targets.size(); targets.add( def ); return index; }
java
public int addPattern(GrayU8 inputBinary, double lengthSide) { if( inputBinary == null ) { throw new IllegalArgumentException("Input image is null."); } else if( lengthSide <= 0 ) { throw new IllegalArgumentException("Parameter lengthSide must be more than zero"); } else if(ImageStatistics.max(inputBinary) > 1 ) throw new IllegalArgumentException("A binary image is composed on 0 and 1 pixels. This isn't binary!"); // see if it needs to be resized if ( inputBinary.width != squareLength || inputBinary.height != squareLength ) { // need to create a new image and rescale it to better handle the resizing GrayF32 inputGray = new GrayF32(inputBinary.width,inputBinary.height); ConvertImage.convert(inputBinary,inputGray); PixelMath.multiply(inputGray,255,inputGray); GrayF32 scaled = new GrayF32(squareLength,squareLength); // See if it can use the better algorithm for scaling down the image if( inputBinary.width > squareLength && inputBinary.height > squareLength ) { AverageDownSampleOps.down(inputGray,scaled); } else { new FDistort(inputGray,scaled).scaleExt().apply(); } GThresholdImageOps.threshold(scaled,binary,255/2.0,false); } else { binary.setTo(inputBinary); } // describe it in 4 different orientations FiducialDef def = new FiducialDef(); def.lengthSide = lengthSide; // CCW rotation so that the index refers to how many CW rotation it takes to put it into the nominal pose binaryToDef(binary, def.desc[0]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[1]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[2]); ImageMiscOps.rotateCCW(binary); binaryToDef(binary, def.desc[3]); int index = targets.size(); targets.add( def ); return index; }
[ "public", "int", "addPattern", "(", "GrayU8", "inputBinary", ",", "double", "lengthSide", ")", "{", "if", "(", "inputBinary", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input image is null.\"", ")", ";", "}", "else", "if", "(", "lengthSide", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter lengthSide must be more than zero\"", ")", ";", "}", "else", "if", "(", "ImageStatistics", ".", "max", "(", "inputBinary", ")", ">", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"A binary image is composed on 0 and 1 pixels. This isn't binary!\"", ")", ";", "// see if it needs to be resized", "if", "(", "inputBinary", ".", "width", "!=", "squareLength", "||", "inputBinary", ".", "height", "!=", "squareLength", ")", "{", "// need to create a new image and rescale it to better handle the resizing", "GrayF32", "inputGray", "=", "new", "GrayF32", "(", "inputBinary", ".", "width", ",", "inputBinary", ".", "height", ")", ";", "ConvertImage", ".", "convert", "(", "inputBinary", ",", "inputGray", ")", ";", "PixelMath", ".", "multiply", "(", "inputGray", ",", "255", ",", "inputGray", ")", ";", "GrayF32", "scaled", "=", "new", "GrayF32", "(", "squareLength", ",", "squareLength", ")", ";", "// See if it can use the better algorithm for scaling down the image", "if", "(", "inputBinary", ".", "width", ">", "squareLength", "&&", "inputBinary", ".", "height", ">", "squareLength", ")", "{", "AverageDownSampleOps", ".", "down", "(", "inputGray", ",", "scaled", ")", ";", "}", "else", "{", "new", "FDistort", "(", "inputGray", ",", "scaled", ")", ".", "scaleExt", "(", ")", ".", "apply", "(", ")", ";", "}", "GThresholdImageOps", ".", "threshold", "(", "scaled", ",", "binary", ",", "255", "/", "2.0", ",", "false", ")", ";", "}", "else", "{", "binary", ".", "setTo", "(", "inputBinary", ")", ";", "}", "// describe it in 4 different orientations", "FiducialDef", "def", "=", "new", "FiducialDef", "(", ")", ";", "def", ".", "lengthSide", "=", "lengthSide", ";", "// CCW rotation so that the index refers to how many CW rotation it takes to put it into the nominal pose", "binaryToDef", "(", "binary", ",", "def", ".", "desc", "[", "0", "]", ")", ";", "ImageMiscOps", ".", "rotateCCW", "(", "binary", ")", ";", "binaryToDef", "(", "binary", ",", "def", ".", "desc", "[", "1", "]", ")", ";", "ImageMiscOps", ".", "rotateCCW", "(", "binary", ")", ";", "binaryToDef", "(", "binary", ",", "def", ".", "desc", "[", "2", "]", ")", ";", "ImageMiscOps", ".", "rotateCCW", "(", "binary", ")", ";", "binaryToDef", "(", "binary", ",", "def", ".", "desc", "[", "3", "]", ")", ";", "int", "index", "=", "targets", ".", "size", "(", ")", ";", "targets", ".", "add", "(", "def", ")", ";", "return", "index", ";", "}" ]
Adds a new image to the detector. Image must be gray-scale and is converted into a binary image using the specified threshold. All input images are rescaled to be square and of the appropriate size. Thus the original shape of the image doesn't matter. Square shapes are highly recommended since that's what the target looks like. @param inputBinary Binary input image pattern. 0 = black, 1 = white. @param lengthSide How long one of the sides of the target is in world units. @return The ID of the provided image
[ "Adds", "a", "new", "image", "to", "the", "detector", ".", "Image", "must", "be", "gray", "-", "scale", "and", "is", "converted", "into", "a", "binary", "image", "using", "the", "specified", "threshold", ".", "All", "input", "images", "are", "rescaled", "to", "be", "square", "and", "of", "the", "appropriate", "size", ".", "Thus", "the", "original", "shape", "of", "the", "image", "doesn", "t", "matter", ".", "Square", "shapes", "are", "highly", "recommended", "since", "that", "s", "what", "the", "target", "looks", "like", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareImage.java#L114-L158
googlemaps/google-maps-services-java
src/main/java/com/google/maps/GeocodingApiRequest.java
GeocodingApiRequest.bounds
public GeocodingApiRequest bounds(LatLng southWestBound, LatLng northEastBound) { """ Sets the bounding box of the viewport within which to bias geocode results more prominently. This parameter will only influence, not fully restrict, results from the geocoder. <p>For more information see <a href="https://developers.google.com/maps/documentation/geocoding/intro?hl=pl#Viewports"> Viewport Biasing</a>. @param southWestBound The South West bound of the bounding box. @param northEastBound The North East bound of the bounding box. @return Returns this {@code GeocodingApiRequest} for call chaining. """ return param("bounds", join('|', southWestBound, northEastBound)); }
java
public GeocodingApiRequest bounds(LatLng southWestBound, LatLng northEastBound) { return param("bounds", join('|', southWestBound, northEastBound)); }
[ "public", "GeocodingApiRequest", "bounds", "(", "LatLng", "southWestBound", ",", "LatLng", "northEastBound", ")", "{", "return", "param", "(", "\"bounds\"", ",", "join", "(", "'", "'", ",", "southWestBound", ",", "northEastBound", ")", ")", ";", "}" ]
Sets the bounding box of the viewport within which to bias geocode results more prominently. This parameter will only influence, not fully restrict, results from the geocoder. <p>For more information see <a href="https://developers.google.com/maps/documentation/geocoding/intro?hl=pl#Viewports"> Viewport Biasing</a>. @param southWestBound The South West bound of the bounding box. @param northEastBound The North East bound of the bounding box. @return Returns this {@code GeocodingApiRequest} for call chaining.
[ "Sets", "the", "bounding", "box", "of", "the", "viewport", "within", "which", "to", "bias", "geocode", "results", "more", "prominently", ".", "This", "parameter", "will", "only", "influence", "not", "fully", "restrict", "results", "from", "the", "geocoder", "." ]
train
https://github.com/googlemaps/google-maps-services-java/blob/23d20d1930f80e310d856d2da51d72ee0db4476b/src/main/java/com/google/maps/GeocodingApiRequest.java#L99-L101
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java
PathAlterationObserver.createPathEntry
private FileStatusEntry createPathEntry(final FileStatusEntry parent, final Path childPath) throws IOException { """ Create a new FileStatusEntry for the specified file. @param parent The parent file entry @param childPath The file to create an entry for @return A new file entry """ final FileStatusEntry entry = parent.newChildInstance(childPath); entry.refresh(childPath); final FileStatusEntry[] children = doListPathsEntry(childPath, entry); entry.setChildren(children); return entry; }
java
private FileStatusEntry createPathEntry(final FileStatusEntry parent, final Path childPath) throws IOException { final FileStatusEntry entry = parent.newChildInstance(childPath); entry.refresh(childPath); final FileStatusEntry[] children = doListPathsEntry(childPath, entry); entry.setChildren(children); return entry; }
[ "private", "FileStatusEntry", "createPathEntry", "(", "final", "FileStatusEntry", "parent", ",", "final", "Path", "childPath", ")", "throws", "IOException", "{", "final", "FileStatusEntry", "entry", "=", "parent", ".", "newChildInstance", "(", "childPath", ")", ";", "entry", ".", "refresh", "(", "childPath", ")", ";", "final", "FileStatusEntry", "[", "]", "children", "=", "doListPathsEntry", "(", "childPath", ",", "entry", ")", ";", "entry", ".", "setChildren", "(", "children", ")", ";", "return", "entry", ";", "}" ]
Create a new FileStatusEntry for the specified file. @param parent The parent file entry @param childPath The file to create an entry for @return A new file entry
[ "Create", "a", "new", "FileStatusEntry", "for", "the", "specified", "file", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java#L238-L245
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
HawkbitCommonUtil.getSoftwareModuleName
public static String getSoftwareModuleName(final String caption, final String name) { """ Get Label for Artifact Details. @param caption as caption of the details @param name as name @return SoftwareModuleName """ return new StringBuilder() .append(DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText(getFormattedName(name))) .append(DIV_DESCRIPTION_END).toString(); }
java
public static String getSoftwareModuleName(final String caption, final String name) { return new StringBuilder() .append(DIV_DESCRIPTION_START + caption + " : " + getBoldHTMLText(getFormattedName(name))) .append(DIV_DESCRIPTION_END).toString(); }
[ "public", "static", "String", "getSoftwareModuleName", "(", "final", "String", "caption", ",", "final", "String", "name", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "DIV_DESCRIPTION_START", "+", "caption", "+", "\" : \"", "+", "getBoldHTMLText", "(", "getFormattedName", "(", "name", ")", ")", ")", ".", "append", "(", "DIV_DESCRIPTION_END", ")", ".", "toString", "(", ")", ";", "}" ]
Get Label for Artifact Details. @param caption as caption of the details @param name as name @return SoftwareModuleName
[ "Get", "Label", "for", "Artifact", "Details", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java#L152-L156
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/ComapiClient.java
ComapiClient.copyLogs
public void copyLogs(@NonNull File file, Callback<File> callback) { """ Gets the content of internal log files merged into provided file. @param file File to merge internal logs into. @param callback Callback with a same file this time containing all the internal logs merged into. """ adapter.adapt(super.copyLogs(file), callback); }
java
public void copyLogs(@NonNull File file, Callback<File> callback) { adapter.adapt(super.copyLogs(file), callback); }
[ "public", "void", "copyLogs", "(", "@", "NonNull", "File", "file", ",", "Callback", "<", "File", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "super", ".", "copyLogs", "(", "file", ")", ",", "callback", ")", ";", "}" ]
Gets the content of internal log files merged into provided file. @param file File to merge internal logs into. @param callback Callback with a same file this time containing all the internal logs merged into.
[ "Gets", "the", "content", "of", "internal", "log", "files", "merged", "into", "provided", "file", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/ComapiClient.java#L105-L107
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java
LockTable.ixLock
void ixLock(Object obj, long txNum) { """ Grants an ixlock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a transaction number """ Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIxLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!ixLockable(lks, txNum) && !waitingTooLong(timestamp)) { avoidDeadlock(lks, txNum, IX_LOCK); lks.requestSet.add(txNum); anchor.wait(MAX_TIME); lks.requestSet.remove(txNum); } if (!ixLockable(lks, txNum)) throw new LockAbortException(); lks.ixLockers.add(txNum); getObjectSet(txNum).add(obj); } catch (InterruptedException e) { throw new LockAbortException(); } } txWaitMap.remove(txNum); }
java
void ixLock(Object obj, long txNum) { Object anchor = getAnchor(obj); txWaitMap.put(txNum, anchor); synchronized (anchor) { Lockers lks = prepareLockers(obj); if (hasIxLock(lks, txNum)) return; try { long timestamp = System.currentTimeMillis(); while (!ixLockable(lks, txNum) && !waitingTooLong(timestamp)) { avoidDeadlock(lks, txNum, IX_LOCK); lks.requestSet.add(txNum); anchor.wait(MAX_TIME); lks.requestSet.remove(txNum); } if (!ixLockable(lks, txNum)) throw new LockAbortException(); lks.ixLockers.add(txNum); getObjectSet(txNum).add(obj); } catch (InterruptedException e) { throw new LockAbortException(); } } txWaitMap.remove(txNum); }
[ "void", "ixLock", "(", "Object", "obj", ",", "long", "txNum", ")", "{", "Object", "anchor", "=", "getAnchor", "(", "obj", ")", ";", "txWaitMap", ".", "put", "(", "txNum", ",", "anchor", ")", ";", "synchronized", "(", "anchor", ")", "{", "Lockers", "lks", "=", "prepareLockers", "(", "obj", ")", ";", "if", "(", "hasIxLock", "(", "lks", ",", "txNum", ")", ")", "return", ";", "try", "{", "long", "timestamp", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "while", "(", "!", "ixLockable", "(", "lks", ",", "txNum", ")", "&&", "!", "waitingTooLong", "(", "timestamp", ")", ")", "{", "avoidDeadlock", "(", "lks", ",", "txNum", ",", "IX_LOCK", ")", ";", "lks", ".", "requestSet", ".", "add", "(", "txNum", ")", ";", "anchor", ".", "wait", "(", "MAX_TIME", ")", ";", "lks", ".", "requestSet", ".", "remove", "(", "txNum", ")", ";", "}", "if", "(", "!", "ixLockable", "(", "lks", ",", "txNum", ")", ")", "throw", "new", "LockAbortException", "(", ")", ";", "lks", ".", "ixLockers", ".", "add", "(", "txNum", ")", ";", "getObjectSet", "(", "txNum", ")", ".", "add", "(", "obj", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "LockAbortException", "(", ")", ";", "}", "}", "txWaitMap", ".", "remove", "(", "txNum", ")", ";", "}" ]
Grants an ixlock on the specified item. If any conflict lock exists when the method is called, then the calling thread will be placed on a wait list until the lock is released. If the thread remains on the wait list for a certain amount of time, then an exception is thrown. @param obj a lockable item @param txNum a transaction number
[ "Grants", "an", "ixlock", "on", "the", "specified", "item", ".", "If", "any", "conflict", "lock", "exists", "when", "the", "method", "is", "called", "then", "the", "calling", "thread", "will", "be", "placed", "on", "a", "wait", "list", "until", "the", "lock", "is", "released", ".", "If", "the", "thread", "remains", "on", "the", "wait", "list", "for", "a", "certain", "amount", "of", "time", "then", "an", "exception", "is", "thrown", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L346-L373
sagiegurari/fax4j
src/main/java/org/fax4j/spi/windows/WindowsFaxClientSpiHelper.java
WindowsFaxClientSpiHelper.extractNativeResources
public static void extractNativeResources() { """ This function extracts the native resources (the fax4j.exe and fax4j.dll) and pushes them to the fax4j temporary directory. """ synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { //get target directory File directory=IOHelper.getFax4jInternalTemporaryDirectory(); //extract resources String[] names=new String[]{"fax4j.dll","fax4j.exe"}; int amount=names.length; String name=null; File file=null; InputStream inputStream=null; OutputStream outputStream=null; for(int index=0;index<amount;index++) { //get next resource name=names[index]; //get file file=new File(directory,name); if(!file.exists()) { //get input stream inputStream=WindowsFaxClientSpiHelper.class.getResourceAsStream(name); if(inputStream!=null) { try { //create output stream outputStream=new FileOutputStream(file); //write data to file IOHelper.readAndWriteStreams(inputStream,outputStream); } catch(IOException exception) { throw new FaxException("Unable to extract resource: "+name,exception); } } } } } }
java
public static void extractNativeResources() { synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { //get target directory File directory=IOHelper.getFax4jInternalTemporaryDirectory(); //extract resources String[] names=new String[]{"fax4j.dll","fax4j.exe"}; int amount=names.length; String name=null; File file=null; InputStream inputStream=null; OutputStream outputStream=null; for(int index=0;index<amount;index++) { //get next resource name=names[index]; //get file file=new File(directory,name); if(!file.exists()) { //get input stream inputStream=WindowsFaxClientSpiHelper.class.getResourceAsStream(name); if(inputStream!=null) { try { //create output stream outputStream=new FileOutputStream(file); //write data to file IOHelper.readAndWriteStreams(inputStream,outputStream); } catch(IOException exception) { throw new FaxException("Unable to extract resource: "+name,exception); } } } } } }
[ "public", "static", "void", "extractNativeResources", "(", ")", "{", "synchronized", "(", "WindowsFaxClientSpiHelper", ".", "NATIVE_LOCK", ")", "{", "//get target directory", "File", "directory", "=", "IOHelper", ".", "getFax4jInternalTemporaryDirectory", "(", ")", ";", "//extract resources", "String", "[", "]", "names", "=", "new", "String", "[", "]", "{", "\"fax4j.dll\"", ",", "\"fax4j.exe\"", "}", ";", "int", "amount", "=", "names", ".", "length", ";", "String", "name", "=", "null", ";", "File", "file", "=", "null", ";", "InputStream", "inputStream", "=", "null", ";", "OutputStream", "outputStream", "=", "null", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "amount", ";", "index", "++", ")", "{", "//get next resource", "name", "=", "names", "[", "index", "]", ";", "//get file", "file", "=", "new", "File", "(", "directory", ",", "name", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", ")", "{", "//get input stream", "inputStream", "=", "WindowsFaxClientSpiHelper", ".", "class", ".", "getResourceAsStream", "(", "name", ")", ";", "if", "(", "inputStream", "!=", "null", ")", "{", "try", "{", "//create output stream", "outputStream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "//write data to file", "IOHelper", ".", "readAndWriteStreams", "(", "inputStream", ",", "outputStream", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Unable to extract resource: \"", "+", "name", ",", "exception", ")", ";", "}", "}", "}", "}", "}", "}" ]
This function extracts the native resources (the fax4j.exe and fax4j.dll) and pushes them to the fax4j temporary directory.
[ "This", "function", "extracts", "the", "native", "resources", "(", "the", "fax4j", ".", "exe", "and", "fax4j", ".", "dll", ")", "and", "pushes", "them", "to", "the", "fax4j", "temporary", "directory", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsFaxClientSpiHelper.java#L43-L87
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.findMarshaller
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target) { """ Resolve a Marshaller with the given source and target class. The marshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class """ return findMarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class)); }
java
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target) { return findMarshaller(new ConverterKey<S,T>(source, target, DefaultBinding.class)); }
[ "public", "<", "S", ",", "T", ">", "ToMarshaller", "<", "S", ",", "T", ">", "findMarshaller", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ")", "{", "return", "findMarshaller", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "source", ",", "target", ",", "DefaultBinding", ".", "class", ")", ")", ";", "}" ]
Resolve a Marshaller with the given source and target class. The marshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class
[ "Resolve", "a", "Marshaller", "with", "the", "given", "source", "and", "target", "class", ".", "The", "marshaller", "is", "used", "as", "follows", ":", "Instances", "of", "the", "source", "can", "be", "marshalled", "into", "the", "target", "class", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L857-L859
albfernandez/javadbf
src/main/java/com/linuxense/javadbf/DBFUtils.java
DBFUtils.textPadding
public static byte[] textPadding(String text, Charset charset, int length, DBFAlignment alignment, byte paddingByte) { """ pad a string and convert it to byte[] to write to a dbf file @param text The text to be padded @param charset Charset to use to encode the string @param length Size of the padded string @param alignment alignment to use to padd @param paddingByte the byte used to pad the string @return bytes to write to the dbf file """ byte response[] = new byte[length]; Arrays.fill(response, paddingByte); byte[] stringBytes = text.getBytes(charset); if (stringBytes.length > length) { return textPadding(text.substring(0, text.length() - 1), charset, length, alignment, paddingByte); } int t_offset = 0; switch (alignment) { case RIGHT: t_offset = length - stringBytes.length; break; case LEFT: default: t_offset = 0; break; } System.arraycopy(stringBytes, 0, response, t_offset, stringBytes.length); return response; }
java
public static byte[] textPadding(String text, Charset charset, int length, DBFAlignment alignment, byte paddingByte) { byte response[] = new byte[length]; Arrays.fill(response, paddingByte); byte[] stringBytes = text.getBytes(charset); if (stringBytes.length > length) { return textPadding(text.substring(0, text.length() - 1), charset, length, alignment, paddingByte); } int t_offset = 0; switch (alignment) { case RIGHT: t_offset = length - stringBytes.length; break; case LEFT: default: t_offset = 0; break; } System.arraycopy(stringBytes, 0, response, t_offset, stringBytes.length); return response; }
[ "public", "static", "byte", "[", "]", "textPadding", "(", "String", "text", ",", "Charset", "charset", ",", "int", "length", ",", "DBFAlignment", "alignment", ",", "byte", "paddingByte", ")", "{", "byte", "response", "[", "]", "=", "new", "byte", "[", "length", "]", ";", "Arrays", ".", "fill", "(", "response", ",", "paddingByte", ")", ";", "byte", "[", "]", "stringBytes", "=", "text", ".", "getBytes", "(", "charset", ")", ";", "if", "(", "stringBytes", ".", "length", ">", "length", ")", "{", "return", "textPadding", "(", "text", ".", "substring", "(", "0", ",", "text", ".", "length", "(", ")", "-", "1", ")", ",", "charset", ",", "length", ",", "alignment", ",", "paddingByte", ")", ";", "}", "int", "t_offset", "=", "0", ";", "switch", "(", "alignment", ")", "{", "case", "RIGHT", ":", "t_offset", "=", "length", "-", "stringBytes", ".", "length", ";", "break", ";", "case", "LEFT", ":", "default", ":", "t_offset", "=", "0", ";", "break", ";", "}", "System", ".", "arraycopy", "(", "stringBytes", ",", "0", ",", "response", ",", "t_offset", ",", "stringBytes", ".", "length", ")", ";", "return", "response", ";", "}" ]
pad a string and convert it to byte[] to write to a dbf file @param text The text to be padded @param charset Charset to use to encode the string @param length Size of the padded string @param alignment alignment to use to padd @param paddingByte the byte used to pad the string @return bytes to write to the dbf file
[ "pad", "a", "string", "and", "convert", "it", "to", "byte", "[]", "to", "write", "to", "a", "dbf", "file" ]
train
https://github.com/albfernandez/javadbf/blob/ac9867b46786cb055bce9323e2cf074365207693/src/main/java/com/linuxense/javadbf/DBFUtils.java#L203-L226