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
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsChacc.java
CmsChacc.getConnectedResource
protected String getConnectedResource(CmsAccessControlEntry entry, Map<CmsUUID, String> parents) { """ Returns the resource on which the specified access control entry was set.<p> @param entry the current access control entry @param parents the parent resources to determine the connected resource @return the resource name of the corresponding resource """ CmsUUID resId = entry.getResource(); String resName = parents.get(resId); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(resName)) { return resName; } return resId.toString(); }
java
protected String getConnectedResource(CmsAccessControlEntry entry, Map<CmsUUID, String> parents) { CmsUUID resId = entry.getResource(); String resName = parents.get(resId); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(resName)) { return resName; } return resId.toString(); }
[ "protected", "String", "getConnectedResource", "(", "CmsAccessControlEntry", "entry", ",", "Map", "<", "CmsUUID", ",", "String", ">", "parents", ")", "{", "CmsUUID", "resId", "=", "entry", ".", "getResource", "(", ")", ";", "String", "resName", "=", "parents", ".", "get", "(", "resId", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "resName", ")", ")", "{", "return", "resName", ";", "}", "return", "resId", ".", "toString", "(", ")", ";", "}" ]
Returns the resource on which the specified access control entry was set.<p> @param entry the current access control entry @param parents the parent resources to determine the connected resource @return the resource name of the corresponding resource
[ "Returns", "the", "resource", "on", "which", "the", "specified", "access", "control", "entry", "was", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsChacc.java#L1038-L1046
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.cc
public PBConstraint cc(final CType comparator, final int rhs, final Collection<Variable> variables) { """ Creates a new cardinality constraint. @param variables the variables of the constraint @param comparator the comparator of the constraint @param rhs the right-hand side of the constraint @return the cardinality constraint @throws IllegalArgumentException if there are negative variables """ final int[] coefficients = new int[variables.size()]; Arrays.fill(coefficients, 1); final Variable[] vars = new Variable[variables.size()]; int count = 0; for (final Variable var : variables) vars[count++] = var; return this.constructPBC(comparator, rhs, vars, coefficients); }
java
public PBConstraint cc(final CType comparator, final int rhs, final Collection<Variable> variables) { final int[] coefficients = new int[variables.size()]; Arrays.fill(coefficients, 1); final Variable[] vars = new Variable[variables.size()]; int count = 0; for (final Variable var : variables) vars[count++] = var; return this.constructPBC(comparator, rhs, vars, coefficients); }
[ "public", "PBConstraint", "cc", "(", "final", "CType", "comparator", ",", "final", "int", "rhs", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "final", "int", "[", "]", "coefficients", "=", "new", "int", "[", "variables", ".", "size", "(", ")", "]", ";", "Arrays", ".", "fill", "(", "coefficients", ",", "1", ")", ";", "final", "Variable", "[", "]", "vars", "=", "new", "Variable", "[", "variables", ".", "size", "(", ")", "]", ";", "int", "count", "=", "0", ";", "for", "(", "final", "Variable", "var", ":", "variables", ")", "vars", "[", "count", "++", "]", "=", "var", ";", "return", "this", ".", "constructPBC", "(", "comparator", ",", "rhs", ",", "vars", ",", "coefficients", ")", ";", "}" ]
Creates a new cardinality constraint. @param variables the variables of the constraint @param comparator the comparator of the constraint @param rhs the right-hand side of the constraint @return the cardinality constraint @throws IllegalArgumentException if there are negative variables
[ "Creates", "a", "new", "cardinality", "constraint", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L759-L767
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
Site.addCookie
public Site addCookie(String domain, String name, String value) { """ Add a cookie with specific domain. @param domain domain @param name name @param value value @return this """ if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); } cookies.get(domain).put(name, value); return this; }
java
public Site addCookie(String domain, String name, String value) { if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); } cookies.get(domain).put(name, value); return this; }
[ "public", "Site", "addCookie", "(", "String", "domain", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "!", "cookies", ".", "containsKey", "(", "domain", ")", ")", "{", "cookies", ".", "put", "(", "domain", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}", "cookies", ".", "get", "(", "domain", ")", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a cookie with specific domain. @param domain domain @param name name @param value value @return this
[ "Add", "a", "cookie", "with", "specific", "domain", "." ]
train
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java#L79-L85
highsource/maven-jaxb2-plugin
plugin-core/src/main/java/org/jvnet/jaxb2/maven2/util/IOUtils.java
IOUtils.scanDirectoryForFiles
public static List<File> scanDirectoryForFiles(BuildContext buildContext, final File directory, final String[] includes, final String[] excludes, boolean defaultExcludes) throws IOException { """ Scans given directory for files satisfying given inclusion/exclusion patterns. @param buildContext Build context provided by the environment, used to scan for files. @param directory Directory to scan. @param includes inclusion pattern. @param excludes exclusion pattern. @param defaultExcludes default exclusion flag. @return Files from the given directory which satisfy given patterns. The files are {@link File#getCanonicalFile() canonical}. @throws IOException If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries. """ if (!directory.exists()) { return Collections.emptyList(); } final Scanner scanner; if (buildContext != null) { scanner = buildContext.newScanner(directory, true); } else { final DirectoryScanner directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(directory.getAbsoluteFile()); scanner = directoryScanner; } scanner.setIncludes(includes); scanner.setExcludes(excludes); if (defaultExcludes) { scanner.addDefaultExcludes(); } scanner.scan(); final List<File> files = new ArrayList<File>(); for (final String name : scanner.getIncludedFiles()) { files.add(new File(directory, name).getCanonicalFile()); } return files; }
java
public static List<File> scanDirectoryForFiles(BuildContext buildContext, final File directory, final String[] includes, final String[] excludes, boolean defaultExcludes) throws IOException { if (!directory.exists()) { return Collections.emptyList(); } final Scanner scanner; if (buildContext != null) { scanner = buildContext.newScanner(directory, true); } else { final DirectoryScanner directoryScanner = new DirectoryScanner(); directoryScanner.setBasedir(directory.getAbsoluteFile()); scanner = directoryScanner; } scanner.setIncludes(includes); scanner.setExcludes(excludes); if (defaultExcludes) { scanner.addDefaultExcludes(); } scanner.scan(); final List<File> files = new ArrayList<File>(); for (final String name : scanner.getIncludedFiles()) { files.add(new File(directory, name).getCanonicalFile()); } return files; }
[ "public", "static", "List", "<", "File", ">", "scanDirectoryForFiles", "(", "BuildContext", "buildContext", ",", "final", "File", "directory", ",", "final", "String", "[", "]", "includes", ",", "final", "String", "[", "]", "excludes", ",", "boolean", "defaultExcludes", ")", "throws", "IOException", "{", "if", "(", "!", "directory", ".", "exists", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "final", "Scanner", "scanner", ";", "if", "(", "buildContext", "!=", "null", ")", "{", "scanner", "=", "buildContext", ".", "newScanner", "(", "directory", ",", "true", ")", ";", "}", "else", "{", "final", "DirectoryScanner", "directoryScanner", "=", "new", "DirectoryScanner", "(", ")", ";", "directoryScanner", ".", "setBasedir", "(", "directory", ".", "getAbsoluteFile", "(", ")", ")", ";", "scanner", "=", "directoryScanner", ";", "}", "scanner", ".", "setIncludes", "(", "includes", ")", ";", "scanner", ".", "setExcludes", "(", "excludes", ")", ";", "if", "(", "defaultExcludes", ")", "{", "scanner", ".", "addDefaultExcludes", "(", ")", ";", "}", "scanner", ".", "scan", "(", ")", ";", "final", "List", "<", "File", ">", "files", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "for", "(", "final", "String", "name", ":", "scanner", ".", "getIncludedFiles", "(", ")", ")", "{", "files", ".", "add", "(", "new", "File", "(", "directory", ",", "name", ")", ".", "getCanonicalFile", "(", ")", ")", ";", "}", "return", "files", ";", "}" ]
Scans given directory for files satisfying given inclusion/exclusion patterns. @param buildContext Build context provided by the environment, used to scan for files. @param directory Directory to scan. @param includes inclusion pattern. @param excludes exclusion pattern. @param defaultExcludes default exclusion flag. @return Files from the given directory which satisfy given patterns. The files are {@link File#getCanonicalFile() canonical}. @throws IOException If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries.
[ "Scans", "given", "directory", "for", "files", "satisfying", "given", "inclusion", "/", "exclusion", "patterns", "." ]
train
https://github.com/highsource/maven-jaxb2-plugin/blob/a4d3955be5a8c2a5f6137c0f436798c95ef95176/plugin-core/src/main/java/org/jvnet/jaxb2/maven2/util/IOUtils.java#L76-L104
sporniket/core
sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java
FunctorFactory.instanciateFunctorWithParameterAsAClassMethodWrapper
public static FunctorWithParameter instanciateFunctorWithParameterAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { """ Create a functor with parameter, wrapping a call to another method. @param instanceClass class containing the method. @param methodName Name of the method, it must exist. @return a Functor with parameter that call the specified method on the specified instance. @throws Exception if there is a problem to deal with. """ if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorWithParameterAsAMethodWrapper(null, _method); }
java
public static FunctorWithParameter instanciateFunctorWithParameterAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorWithParameterAsAMethodWrapper(null, _method); }
[ "public", "static", "FunctorWithParameter", "instanciateFunctorWithParameterAsAClassMethodWrapper", "(", "Class", "<", "?", ">", "instanceClass", ",", "String", "methodName", ")", "throws", "Exception", "{", "if", "(", "null", "==", "instanceClass", ")", "{", "throw", "new", "NullPointerException", "(", "\"instanceClass is null\"", ")", ";", "}", "Method", "_method", "=", "instanceClass", ".", "getMethod", "(", "methodName", ",", "(", "Class", "<", "?", ">", "[", "]", ")", "null", ")", ";", "return", "instanciateFunctorWithParameterAsAMethodWrapper", "(", "null", ",", "_method", ")", ";", "}" ]
Create a functor with parameter, wrapping a call to another method. @param instanceClass class containing the method. @param methodName Name of the method, it must exist. @return a Functor with parameter that call the specified method on the specified instance. @throws Exception if there is a problem to deal with.
[ "Create", "a", "functor", "with", "parameter", "wrapping", "a", "call", "to", "another", "method", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L119-L128
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/model/Divider.java
Divider.setTitle
public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) { """ Sets the divider's title. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the title, which should be set, as an {@link Integer} value. The resource id must correspond to a valid string resource """ setTitle(context.getText(resourceId)); }
java
public final void setTitle(@NonNull final Context context, @StringRes final int resourceId) { setTitle(context.getText(resourceId)); }
[ "public", "final", "void", "setTitle", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "setTitle", "(", "context", ".", "getText", "(", "resourceId", ")", ")", ";", "}" ]
Sets the divider's title. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the title, which should be set, as an {@link Integer} value. The resource id must correspond to a valid string resource
[ "Sets", "the", "divider", "s", "title", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/model/Divider.java#L55-L57
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java
ServiceEndpointPolicyDefinitionsInner.getAsync
public Observable<ServiceEndpointPolicyDefinitionInner> getAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName) { """ Get the specified service endpoint policy definitions from service endpoint policy. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy name. @param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServiceEndpointPolicyDefinitionInner object """ return getWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() { @Override public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) { return response.body(); } }); }
java
public Observable<ServiceEndpointPolicyDefinitionInner> getAsync(String resourceGroupName, String serviceEndpointPolicyName, String serviceEndpointPolicyDefinitionName) { return getWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName).map(new Func1<ServiceResponse<ServiceEndpointPolicyDefinitionInner>, ServiceEndpointPolicyDefinitionInner>() { @Override public ServiceEndpointPolicyDefinitionInner call(ServiceResponse<ServiceEndpointPolicyDefinitionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServiceEndpointPolicyDefinitionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serviceEndpointPolicyName", ",", "String", "serviceEndpointPolicyDefinitionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serviceEndpointPolicyName", ",", "serviceEndpointPolicyDefinitionName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ServiceEndpointPolicyDefinitionInner", ">", ",", "ServiceEndpointPolicyDefinitionInner", ">", "(", ")", "{", "@", "Override", "public", "ServiceEndpointPolicyDefinitionInner", "call", "(", "ServiceResponse", "<", "ServiceEndpointPolicyDefinitionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the specified service endpoint policy definitions from service endpoint policy. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy name. @param serviceEndpointPolicyDefinitionName The name of the service endpoint policy definition name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServiceEndpointPolicyDefinitionInner object
[ "Get", "the", "specified", "service", "endpoint", "policy", "definitions", "from", "service", "endpoint", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L297-L304
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/ChannelAccess.java
ChannelAccess.handleProcessedBuffer
final void handleProcessedBuffer(T buffer, IOException ex) { """ Handles a processed <tt>Buffer</tt>. This method is invoked by the asynchronous IO worker threads upon completion of the IO request with the provided buffer and/or an exception that occurred while processing the request for that buffer. @param buffer The buffer to be processed. @param ex The exception that occurred in the I/O threads when processing the buffer's request. """ if (ex != null && this.exception == null) { this.exception = ex; } returnBuffer(buffer); }
java
final void handleProcessedBuffer(T buffer, IOException ex) { if (ex != null && this.exception == null) { this.exception = ex; } returnBuffer(buffer); }
[ "final", "void", "handleProcessedBuffer", "(", "T", "buffer", ",", "IOException", "ex", ")", "{", "if", "(", "ex", "!=", "null", "&&", "this", ".", "exception", "==", "null", ")", "{", "this", ".", "exception", "=", "ex", ";", "}", "returnBuffer", "(", "buffer", ")", ";", "}" ]
Handles a processed <tt>Buffer</tt>. This method is invoked by the asynchronous IO worker threads upon completion of the IO request with the provided buffer and/or an exception that occurred while processing the request for that buffer. @param buffer The buffer to be processed. @param ex The exception that occurred in the I/O threads when processing the buffer's request.
[ "Handles", "a", "processed", "<tt", ">", "Buffer<", "/", "tt", ">", ".", "This", "method", "is", "invoked", "by", "the", "asynchronous", "IO", "worker", "threads", "upon", "completion", "of", "the", "IO", "request", "with", "the", "provided", "buffer", "and", "/", "or", "an", "exception", "that", "occurred", "while", "processing", "the", "request", "for", "that", "buffer", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/ChannelAccess.java#L157-L164
deeplearning4j/deeplearning4j
datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java
ArrowConverter.toArrowWritablesSingle
public static List<Writable> toArrowWritablesSingle(List<FieldVector> fieldVectors,Schema schema) { """ Return a singular record based on the converted writables result. @param fieldVectors the field vectors to use @param schema the schema to use for input @return """ return toArrowWritables(fieldVectors,schema).get(0); }
java
public static List<Writable> toArrowWritablesSingle(List<FieldVector> fieldVectors,Schema schema) { return toArrowWritables(fieldVectors,schema).get(0); }
[ "public", "static", "List", "<", "Writable", ">", "toArrowWritablesSingle", "(", "List", "<", "FieldVector", ">", "fieldVectors", ",", "Schema", "schema", ")", "{", "return", "toArrowWritables", "(", "fieldVectors", ",", "schema", ")", ".", "get", "(", "0", ")", ";", "}" ]
Return a singular record based on the converted writables result. @param fieldVectors the field vectors to use @param schema the schema to use for input @return
[ "Return", "a", "singular", "record", "based", "on", "the", "converted", "writables", "result", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L349-L351
jenkinsci/jenkins
core/src/main/java/hudson/model/ParameterDefinition.java
ParameterDefinition.createValue
@CheckForNull public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { """ Create a parameter value from the string given in the CLI. @param command This is the command that got the parameter. @throws AbortException If the CLI processing should be aborted. Hudson will report the error message without stack trace, and then exits this command. Useful for graceful termination. @throws RuntimeException All the other exceptions cause the stack trace to be dumped, and then the command exits with an error code. @since 1.334 """ throw new AbortException("CLI parameter submission is not supported for the "+getClass()+" type. Please file a bug report for this"); }
java
@CheckForNull public ParameterValue createValue(CLICommand command, String value) throws IOException, InterruptedException { throw new AbortException("CLI parameter submission is not supported for the "+getClass()+" type. Please file a bug report for this"); }
[ "@", "CheckForNull", "public", "ParameterValue", "createValue", "(", "CLICommand", "command", ",", "String", "value", ")", "throws", "IOException", ",", "InterruptedException", "{", "throw", "new", "AbortException", "(", "\"CLI parameter submission is not supported for the \"", "+", "getClass", "(", ")", "+", "\" type. Please file a bug report for this\"", ")", ";", "}" ]
Create a parameter value from the string given in the CLI. @param command This is the command that got the parameter. @throws AbortException If the CLI processing should be aborted. Hudson will report the error message without stack trace, and then exits this command. Useful for graceful termination. @throws RuntimeException All the other exceptions cause the stack trace to be dumped, and then the command exits with an error code. @since 1.334
[ "Create", "a", "parameter", "value", "from", "the", "string", "given", "in", "the", "CLI", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParameterDefinition.java#L205-L208
graknlabs/grakn
server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java
FibonacciHeap.add
public Entry add(V value, P priority) { """ Inserts a new entry into the heap and returns the entry if heap is not full. Returns absent otherwise. No heap consolidation is performed. Runtime: O(1) """ Preconditions.checkNotNull(value); Preconditions.checkNotNull(priority); if (size >= MAX_CAPACITY) return null; final Entry result = new Entry(value, priority); // add as a root oMinEntry = mergeLists(result, oMinEntry); size++; return result; }
java
public Entry add(V value, P priority) { Preconditions.checkNotNull(value); Preconditions.checkNotNull(priority); if (size >= MAX_CAPACITY) return null; final Entry result = new Entry(value, priority); // add as a root oMinEntry = mergeLists(result, oMinEntry); size++; return result; }
[ "public", "Entry", "add", "(", "V", "value", ",", "P", "priority", ")", "{", "Preconditions", ".", "checkNotNull", "(", "value", ")", ";", "Preconditions", ".", "checkNotNull", "(", "priority", ")", ";", "if", "(", "size", ">=", "MAX_CAPACITY", ")", "return", "null", ";", "final", "Entry", "result", "=", "new", "Entry", "(", "value", ",", "priority", ")", ";", "// add as a root", "oMinEntry", "=", "mergeLists", "(", "result", ",", "oMinEntry", ")", ";", "size", "++", ";", "return", "result", ";", "}" ]
Inserts a new entry into the heap and returns the entry if heap is not full. Returns absent otherwise. No heap consolidation is performed. Runtime: O(1)
[ "Inserts", "a", "new", "entry", "into", "the", "heap", "and", "returns", "the", "entry", "if", "heap", "is", "not", "full", ".", "Returns", "absent", "otherwise", ".", "No", "heap", "consolidation", "is", "performed", ".", "Runtime", ":", "O", "(", "1", ")" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/spanningtree/datastructure/FibonacciHeap.java#L146-L158
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java
OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDifferentIndividualsAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java#L74-L77
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java
BigRational.valueOf
public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) { """ Creates a rational number of the specified numerator/denominator BigDecimal values. @param numerator the numerator {@link BigDecimal} value @param denominator the denominator {@link BigDecimal} value (0 not allowed) @return the rational number @throws ArithmeticException if the denominator is 0 (division by zero) """ return valueOf(numerator).divide(valueOf(denominator)); }
java
public static BigRational valueOf(BigDecimal numerator, BigDecimal denominator) { return valueOf(numerator).divide(valueOf(denominator)); }
[ "public", "static", "BigRational", "valueOf", "(", "BigDecimal", "numerator", ",", "BigDecimal", "denominator", ")", "{", "return", "valueOf", "(", "numerator", ")", ".", "divide", "(", "valueOf", "(", "denominator", ")", ")", ";", "}" ]
Creates a rational number of the specified numerator/denominator BigDecimal values. @param numerator the numerator {@link BigDecimal} value @param denominator the denominator {@link BigDecimal} value (0 not allowed) @return the rational number @throws ArithmeticException if the denominator is 0 (division by zero)
[ "Creates", "a", "rational", "number", "of", "the", "specified", "numerator", "/", "denominator", "BigDecimal", "values", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java#L999-L1001
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java
JoblogUtil.logToJoblogIfNotTraceLoggable
@Trivial private static void logToJoblogIfNotTraceLoggable(Level level, String msg, Logger traceLogger) { """ if property includeServerLogging = true (default) in the server.xml, then all the messages logged to trace.log are also logged to the joblog. So logging to trace is enough for the message to be in both trace.log and the joblog. if property includeServerLogging = false in the server.xml, then none of the messages logged to trace.log are logged to the joblog. So printing to trace.log and joblogs has to be done separately. """ if(includeServerLogging){ if(!traceLogger.isLoggable(level)){ jobLogger.log(level,msg); } } else{ jobLogger.log(level, msg); } }
java
@Trivial private static void logToJoblogIfNotTraceLoggable(Level level, String msg, Logger traceLogger){ if(includeServerLogging){ if(!traceLogger.isLoggable(level)){ jobLogger.log(level,msg); } } else{ jobLogger.log(level, msg); } }
[ "@", "Trivial", "private", "static", "void", "logToJoblogIfNotTraceLoggable", "(", "Level", "level", ",", "String", "msg", ",", "Logger", "traceLogger", ")", "{", "if", "(", "includeServerLogging", ")", "{", "if", "(", "!", "traceLogger", ".", "isLoggable", "(", "level", ")", ")", "{", "jobLogger", ".", "log", "(", "level", ",", "msg", ")", ";", "}", "}", "else", "{", "jobLogger", ".", "log", "(", "level", ",", "msg", ")", ";", "}", "}" ]
if property includeServerLogging = true (default) in the server.xml, then all the messages logged to trace.log are also logged to the joblog. So logging to trace is enough for the message to be in both trace.log and the joblog. if property includeServerLogging = false in the server.xml, then none of the messages logged to trace.log are logged to the joblog. So printing to trace.log and joblogs has to be done separately.
[ "if", "property", "includeServerLogging", "=", "true", "(", "default", ")", "in", "the", "server", ".", "xml", "then", "all", "the", "messages", "logged", "to", "trace", ".", "log", "are", "also", "logged", "to", "the", "joblog", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/ws/JoblogUtil.java#L137-L147
spotify/scio
scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java
PatchedBigQueryTableRowIterator.deleteTable
private void deleteTable(String datasetId, String tableId) throws IOException, InterruptedException { """ Delete the given table that is available in the given dataset. """ executeWithBackOff( client.tables().delete(projectId, datasetId, tableId), String.format( "Error when trying to delete the temporary table %s in dataset %s of project %s. " + "Manual deletion may be required.", tableId, datasetId, projectId)); }
java
private void deleteTable(String datasetId, String tableId) throws IOException, InterruptedException { executeWithBackOff( client.tables().delete(projectId, datasetId, tableId), String.format( "Error when trying to delete the temporary table %s in dataset %s of project %s. " + "Manual deletion may be required.", tableId, datasetId, projectId)); }
[ "private", "void", "deleteTable", "(", "String", "datasetId", ",", "String", "tableId", ")", "throws", "IOException", ",", "InterruptedException", "{", "executeWithBackOff", "(", "client", ".", "tables", "(", ")", ".", "delete", "(", "projectId", ",", "datasetId", ",", "tableId", ")", ",", "String", ".", "format", "(", "\"Error when trying to delete the temporary table %s in dataset %s of project %s. \"", "+", "\"Manual deletion may be required.\"", ",", "tableId", ",", "datasetId", ",", "projectId", ")", ")", ";", "}" ]
Delete the given table that is available in the given dataset.
[ "Delete", "the", "given", "table", "that", "is", "available", "in", "the", "given", "dataset", "." ]
train
https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L360-L368
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.createWithServiceResponseAsync
public Observable<ServiceResponse<Void>> createWithServiceResponseAsync(String faceListId, CreateFaceListsOptionalParameter createOptionalParameter) { """ Create an empty face list. Up to 64 face lists are allowed to exist in one subscription. @param faceListId Id referencing a particular face list. @param createOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } final String name = createOptionalParameter != null ? createOptionalParameter.name() : null; final String userData = createOptionalParameter != null ? createOptionalParameter.userData() : null; return createWithServiceResponseAsync(faceListId, name, userData); }
java
public Observable<ServiceResponse<Void>> createWithServiceResponseAsync(String faceListId, CreateFaceListsOptionalParameter createOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } final String name = createOptionalParameter != null ? createOptionalParameter.name() : null; final String userData = createOptionalParameter != null ? createOptionalParameter.userData() : null; return createWithServiceResponseAsync(faceListId, name, userData); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Void", ">", ">", "createWithServiceResponseAsync", "(", "String", "faceListId", ",", "CreateFaceListsOptionalParameter", "createOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "azureRegion", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.azureRegion() is required and cannot be null.\"", ")", ";", "}", "if", "(", "faceListId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter faceListId is required and cannot be null.\"", ")", ";", "}", "final", "String", "name", "=", "createOptionalParameter", "!=", "null", "?", "createOptionalParameter", ".", "name", "(", ")", ":", "null", ";", "final", "String", "userData", "=", "createOptionalParameter", "!=", "null", "?", "createOptionalParameter", ".", "userData", "(", ")", ":", "null", ";", "return", "createWithServiceResponseAsync", "(", "faceListId", ",", "name", ",", "userData", ")", ";", "}" ]
Create an empty face list. Up to 64 face lists are allowed to exist in one subscription. @param faceListId Id referencing a particular face list. @param createOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Create", "an", "empty", "face", "list", ".", "Up", "to", "64", "face", "lists", "are", "allowed", "to", "exist", "in", "one", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L161-L172
sagiegurari/fax4j
src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java
AbstractFaxClientSpi.fireFaxEvent
protected void fireFaxEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus) { """ This function fires a new fax event. @param id The fax event ID @param faxJob The fax job @param faxJobStatus The fax job status """ //create new fax event FaxMonitorEvent event=new FaxMonitorEvent(id,faxJob,faxJobStatus); //get listeners FaxMonitorEventListener[] listeners=null; synchronized(this.faxClientActionEventListeners) { listeners=this.faxMonitorEventListeners.toArray(new FaxMonitorEventListener[this.faxMonitorEventListeners.size()]); } int amount=listeners.length; FaxMonitorEventListener listener=null; for(int index=0;index<amount;index++) { //get next element listener=listeners[index]; //fire event if(listener!=null) { switch(id) { case FAX_JOB_STATUS_CHANGE: listener.faxJobStatusChanged(event); break; default: throw new FaxException("Unable to support fax event, for event ID: "+id); } } } }
java
protected void fireFaxEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus) { //create new fax event FaxMonitorEvent event=new FaxMonitorEvent(id,faxJob,faxJobStatus); //get listeners FaxMonitorEventListener[] listeners=null; synchronized(this.faxClientActionEventListeners) { listeners=this.faxMonitorEventListeners.toArray(new FaxMonitorEventListener[this.faxMonitorEventListeners.size()]); } int amount=listeners.length; FaxMonitorEventListener listener=null; for(int index=0;index<amount;index++) { //get next element listener=listeners[index]; //fire event if(listener!=null) { switch(id) { case FAX_JOB_STATUS_CHANGE: listener.faxJobStatusChanged(event); break; default: throw new FaxException("Unable to support fax event, for event ID: "+id); } } } }
[ "protected", "void", "fireFaxEvent", "(", "FaxMonitorEventID", "id", ",", "FaxJob", "faxJob", ",", "FaxJobStatus", "faxJobStatus", ")", "{", "//create new fax event", "FaxMonitorEvent", "event", "=", "new", "FaxMonitorEvent", "(", "id", ",", "faxJob", ",", "faxJobStatus", ")", ";", "//get listeners", "FaxMonitorEventListener", "[", "]", "listeners", "=", "null", ";", "synchronized", "(", "this", ".", "faxClientActionEventListeners", ")", "{", "listeners", "=", "this", ".", "faxMonitorEventListeners", ".", "toArray", "(", "new", "FaxMonitorEventListener", "[", "this", ".", "faxMonitorEventListeners", ".", "size", "(", ")", "]", ")", ";", "}", "int", "amount", "=", "listeners", ".", "length", ";", "FaxMonitorEventListener", "listener", "=", "null", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "amount", ";", "index", "++", ")", "{", "//get next element", "listener", "=", "listeners", "[", "index", "]", ";", "//fire event", "if", "(", "listener", "!=", "null", ")", "{", "switch", "(", "id", ")", "{", "case", "FAX_JOB_STATUS_CHANGE", ":", "listener", ".", "faxJobStatusChanged", "(", "event", ")", ";", "break", ";", "default", ":", "throw", "new", "FaxException", "(", "\"Unable to support fax event, for event ID: \"", "+", "id", ")", ";", "}", "}", "}", "}" ]
This function fires a new fax event. @param id The fax event ID @param faxJob The fax job @param faxJobStatus The fax job status
[ "This", "function", "fires", "a", "new", "fax", "event", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java#L585-L617
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java
UnImplNode.createElementNS
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { """ Unimplemented. See org.w3c.dom.Document @param namespaceURI Namespace URI for the element @param qualifiedName Qualified name of the element @return null @throws DOMException """ error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; }
java
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); return null; }
[ "public", "Element", "createElementNS", "(", "String", "namespaceURI", ",", "String", "qualifiedName", ")", "throws", "DOMException", "{", "error", "(", "XMLErrorResources", ".", "ER_FUNCTION_NOT_SUPPORTED", ")", ";", "return", "null", ";", "}" ]
Unimplemented. See org.w3c.dom.Document @param namespaceURI Namespace URI for the element @param qualifiedName Qualified name of the element @return null @throws DOMException
[ "Unimplemented", ".", "See", "org", ".", "w3c", ".", "dom", ".", "Document" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java#L970-L977
Azure/azure-sdk-for-java
privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java
VirtualNetworkLinksInner.getAsync
public Observable<VirtualNetworkLinkInner> getAsync(String resourceGroupName, String privateZoneName, String virtualNetworkLinkName) { """ Gets a virtual network link to the specified Private DNS zone. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param virtualNetworkLinkName The name of the virtual network link. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkLinkInner object """ return getWithServiceResponseAsync(resourceGroupName, privateZoneName, virtualNetworkLinkName).map(new Func1<ServiceResponse<VirtualNetworkLinkInner>, VirtualNetworkLinkInner>() { @Override public VirtualNetworkLinkInner call(ServiceResponse<VirtualNetworkLinkInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkLinkInner> getAsync(String resourceGroupName, String privateZoneName, String virtualNetworkLinkName) { return getWithServiceResponseAsync(resourceGroupName, privateZoneName, virtualNetworkLinkName).map(new Func1<ServiceResponse<VirtualNetworkLinkInner>, VirtualNetworkLinkInner>() { @Override public VirtualNetworkLinkInner call(ServiceResponse<VirtualNetworkLinkInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkLinkInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "privateZoneName", ",", "String", "virtualNetworkLinkName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "privateZoneName", ",", "virtualNetworkLinkName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkLinkInner", ">", ",", "VirtualNetworkLinkInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkLinkInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkLinkInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a virtual network link to the specified Private DNS zone. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param virtualNetworkLinkName The name of the virtual network link. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkLinkInner object
[ "Gets", "a", "virtual", "network", "link", "to", "the", "specified", "Private", "DNS", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java#L1236-L1243
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/PackedBits8.java
PackedBits8.growArray
public void growArray( int amountBits , boolean saveValue ) { """ Increases the size of the data array so that it can store an addition number of bits @param amountBits Number of bits beyond 'size' that you wish the array to be able to store @param saveValue if true it will save the value of the array. If false it will not copy it """ size = size+amountBits; int N = size/8 + (size%8==0?0:1); if( N > data.length ) { // add in some buffer to avoid lots of calls to new int extra = Math.min(1024,N+10); byte[] tmp = new byte[N+extra]; if( saveValue ) System.arraycopy(data,0,tmp,0,data.length); this.data = tmp; } }
java
public void growArray( int amountBits , boolean saveValue ) { size = size+amountBits; int N = size/8 + (size%8==0?0:1); if( N > data.length ) { // add in some buffer to avoid lots of calls to new int extra = Math.min(1024,N+10); byte[] tmp = new byte[N+extra]; if( saveValue ) System.arraycopy(data,0,tmp,0,data.length); this.data = tmp; } }
[ "public", "void", "growArray", "(", "int", "amountBits", ",", "boolean", "saveValue", ")", "{", "size", "=", "size", "+", "amountBits", ";", "int", "N", "=", "size", "/", "8", "+", "(", "size", "%", "8", "==", "0", "?", "0", ":", "1", ")", ";", "if", "(", "N", ">", "data", ".", "length", ")", "{", "// add in some buffer to avoid lots of calls to new", "int", "extra", "=", "Math", ".", "min", "(", "1024", ",", "N", "+", "10", ")", ";", "byte", "[", "]", "tmp", "=", "new", "byte", "[", "N", "+", "extra", "]", ";", "if", "(", "saveValue", ")", "System", ".", "arraycopy", "(", "data", ",", "0", ",", "tmp", ",", "0", ",", "data", ".", "length", ")", ";", "this", ".", "data", "=", "tmp", ";", "}", "}" ]
Increases the size of the data array so that it can store an addition number of bits @param amountBits Number of bits beyond 'size' that you wish the array to be able to store @param saveValue if true it will save the value of the array. If false it will not copy it
[ "Increases", "the", "size", "of", "the", "data", "array", "so", "that", "it", "can", "store", "an", "addition", "number", "of", "bits" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/PackedBits8.java#L133-L146
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkRoleForResource
public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource) throws CmsRoleViolationException { """ Checks if the user of the current context has permissions to impersonate the given role for the given resource.<p> @param context the current request context @param role the role to check @param resource the resource to check the role for @throws CmsRoleViolationException if the user does not have the required role permissions """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRoleForResource(dbc, role, resource); } finally { dbc.clear(); } }
java
public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRoleForResource(dbc, role, resource); } finally { dbc.clear(); } }
[ "public", "void", "checkRoleForResource", "(", "CmsRequestContext", "context", ",", "CmsRole", "role", ",", "CmsResource", "resource", ")", "throws", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkRoleForResource", "(", "dbc", ",", "role", ",", "resource", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Checks if the user of the current context has permissions to impersonate the given role for the given resource.<p> @param context the current request context @param role the role to check @param resource the resource to check the role for @throws CmsRoleViolationException if the user does not have the required role permissions
[ "Checks", "if", "the", "user", "of", "the", "current", "context", "has", "permissions", "to", "impersonate", "the", "given", "role", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L624-L633
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java
StringUtils.earliestIndexOfAny
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) { """ Just like {@link java.lang.String#indexOf(String, int)}, except it searches for all strings in {@code probes}. If none are found, returns -1. If any are found, returns the earliest index of a match. The current implementation naively searches for each string separately. If speed is important, consider an alternative approach. """ int earliestIdx = -1; for (final String probe : probes) { final int probeIdx = s.indexOf(probe, from); // if we found something for this probe if (probeIdx >= 0 // and either we haven't found anything else yet or // this is earlier than anything we've found yet && (earliestIdx == -1 || probeIdx < earliestIdx)) { // then this is our new earliest match earliestIdx = probeIdx; } } return earliestIdx; }
java
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) { int earliestIdx = -1; for (final String probe : probes) { final int probeIdx = s.indexOf(probe, from); // if we found something for this probe if (probeIdx >= 0 // and either we haven't found anything else yet or // this is earlier than anything we've found yet && (earliestIdx == -1 || probeIdx < earliestIdx)) { // then this is our new earliest match earliestIdx = probeIdx; } } return earliestIdx; }
[ "public", "static", "int", "earliestIndexOfAny", "(", "String", "s", ",", "Iterable", "<", "String", ">", "probes", ",", "int", "from", ")", "{", "int", "earliestIdx", "=", "-", "1", ";", "for", "(", "final", "String", "probe", ":", "probes", ")", "{", "final", "int", "probeIdx", "=", "s", ".", "indexOf", "(", "probe", ",", "from", ")", ";", "// if we found something for this probe", "if", "(", "probeIdx", ">=", "0", "// and either we haven't found anything else yet or", "// this is earlier than anything we've found yet", "&&", "(", "earliestIdx", "==", "-", "1", "||", "probeIdx", "<", "earliestIdx", ")", ")", "{", "// then this is our new earliest match", "earliestIdx", "=", "probeIdx", ";", "}", "}", "return", "earliestIdx", ";", "}" ]
Just like {@link java.lang.String#indexOf(String, int)}, except it searches for all strings in {@code probes}. If none are found, returns -1. If any are found, returns the earliest index of a match. The current implementation naively searches for each string separately. If speed is important, consider an alternative approach.
[ "Just", "like", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L461-L477
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/util/IOHelper.java
IOHelper.httpGet
public static InputStream httpGet(final String httpurl, final Map<String, String>... requestProperties) throws IOException { """ Simple http get imlementation. Supports HTTP Basic authentication via request properties. You may want to use {@link #createBasicAuthenticationProperty} to add authentication. @param httpurl get url @param requestProperties optional http header fields (key-&gt;value) @return input stream of response @throws IOException """ HttpURLConnection connection = (HttpURLConnection) new URL(httpurl).openConnection(); for (Map<String, String> props : requestProperties) { addRequestProperties(props, connection); } return connection.getInputStream(); }
java
public static InputStream httpGet(final String httpurl, final Map<String, String>... requestProperties) throws IOException { HttpURLConnection connection = (HttpURLConnection) new URL(httpurl).openConnection(); for (Map<String, String> props : requestProperties) { addRequestProperties(props, connection); } return connection.getInputStream(); }
[ "public", "static", "InputStream", "httpGet", "(", "final", "String", "httpurl", ",", "final", "Map", "<", "String", ",", "String", ">", "...", "requestProperties", ")", "throws", "IOException", "{", "HttpURLConnection", "connection", "=", "(", "HttpURLConnection", ")", "new", "URL", "(", "httpurl", ")", ".", "openConnection", "(", ")", ";", "for", "(", "Map", "<", "String", ",", "String", ">", "props", ":", "requestProperties", ")", "{", "addRequestProperties", "(", "props", ",", "connection", ")", ";", "}", "return", "connection", ".", "getInputStream", "(", ")", ";", "}" ]
Simple http get imlementation. Supports HTTP Basic authentication via request properties. You may want to use {@link #createBasicAuthenticationProperty} to add authentication. @param httpurl get url @param requestProperties optional http header fields (key-&gt;value) @return input stream of response @throws IOException
[ "Simple", "http", "get", "imlementation", ".", "Supports", "HTTP", "Basic", "authentication", "via", "request", "properties", ".", "You", "may", "want", "to", "use", "{", "@link", "#createBasicAuthenticationProperty", "}", "to", "add", "authentication", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/IOHelper.java#L97-L103
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java
ProductExtraUrl.getExtraValueLocalizedDeltaPriceUrl
public static MozuUrl getExtraValueLocalizedDeltaPriceUrl(String attributeFQN, String currencyCode, String productCode, String responseFields, String value) { """ Get Resource Url for GetExtraValueLocalizedDeltaPrice @param attributeFQN Fully qualified name for an attribute. @param currencyCode The three character ISO currency code, such as USD for US Dollars. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @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 value The value string to create. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("value", value); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getExtraValueLocalizedDeltaPriceUrl(String attributeFQN, String currencyCode, String productCode, String responseFields, String value) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("value", value); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getExtraValueLocalizedDeltaPriceUrl", "(", "String", "attributeFQN", ",", "String", "currencyCode", ",", "String", "productCode", ",", "String", "responseFields", ",", "String", "value", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"attributeFQN\"", ",", "attributeFQN", ")", ";", "formatter", ".", "formatUrl", "(", "\"currencyCode\"", ",", "currencyCode", ")", ";", "formatter", ".", "formatUrl", "(", "\"productCode\"", ",", "productCode", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"value\"", ",", "value", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetExtraValueLocalizedDeltaPrice @param attributeFQN Fully qualified name for an attribute. @param currencyCode The three character ISO currency code, such as USD for US Dollars. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @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 value The value string to create. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetExtraValueLocalizedDeltaPrice" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java#L53-L62
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java
JDBCBackendDataSource.getConnections
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { """ Get connections. @param connectionMode connection mode @param dataSourceName data source name @param connectionSize size of connections to get @return connections @throws SQLException SQL exception """ return getConnections(connectionMode, dataSourceName, connectionSize, TransactionType.LOCAL); }
java
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { return getConnections(connectionMode, dataSourceName, connectionSize, TransactionType.LOCAL); }
[ "public", "List", "<", "Connection", ">", "getConnections", "(", "final", "ConnectionMode", "connectionMode", ",", "final", "String", "dataSourceName", ",", "final", "int", "connectionSize", ")", "throws", "SQLException", "{", "return", "getConnections", "(", "connectionMode", ",", "dataSourceName", ",", "connectionSize", ",", "TransactionType", ".", "LOCAL", ")", ";", "}" ]
Get connections. @param connectionMode connection mode @param dataSourceName data source name @param connectionSize size of connections to get @return connections @throws SQLException SQL exception
[ "Get", "connections", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java#L97-L99
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/BrokerHelper.java
BrokerHelper.getKeyValues
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy) throws PersistenceBrokerException { """ returns an Array with an Objects PK VALUES, with any java-to-sql FieldConversion applied. If the Object is a Proxy or a VirtualProxy NO conversion is necessary. @param objectOrProxy @return Object[] @throws PersistenceBrokerException """ return getKeyValues(cld, objectOrProxy, true); }
java
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy) throws PersistenceBrokerException { return getKeyValues(cld, objectOrProxy, true); }
[ "public", "ValueContainer", "[", "]", "getKeyValues", "(", "ClassDescriptor", "cld", ",", "Object", "objectOrProxy", ")", "throws", "PersistenceBrokerException", "{", "return", "getKeyValues", "(", "cld", ",", "objectOrProxy", ",", "true", ")", ";", "}" ]
returns an Array with an Objects PK VALUES, with any java-to-sql FieldConversion applied. If the Object is a Proxy or a VirtualProxy NO conversion is necessary. @param objectOrProxy @return Object[] @throws PersistenceBrokerException
[ "returns", "an", "Array", "with", "an", "Objects", "PK", "VALUES", "with", "any", "java", "-", "to", "-", "sql", "FieldConversion", "applied", ".", "If", "the", "Object", "is", "a", "Proxy", "or", "a", "VirtualProxy", "NO", "conversion", "is", "necessary", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L239-L242
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java
RelationCollisionUtil.getOneToOneNamer
public Namer getOneToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) { """ Compute the namer for the Java field marked by @OneToOne @param fromAttribute the fk column config @param targetEntityNamer """ // configuration Namer result = getOneToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer); // fall back if (result == null) { result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer); } return result; }
java
public Namer getOneToOneNamer(Attribute fromAttribute, Namer targetEntityNamer) { // configuration Namer result = getOneToOneNamerFromConf(fromAttribute.getColumnConfig(), targetEntityNamer); // fall back if (result == null) { result = getXToOneNamerFallBack(fromAttribute, targetEntityNamer); } return result; }
[ "public", "Namer", "getOneToOneNamer", "(", "Attribute", "fromAttribute", ",", "Namer", "targetEntityNamer", ")", "{", "// configuration", "Namer", "result", "=", "getOneToOneNamerFromConf", "(", "fromAttribute", ".", "getColumnConfig", "(", ")", ",", "targetEntityNamer", ")", ";", "// fall back", "if", "(", "result", "==", "null", ")", "{", "result", "=", "getXToOneNamerFallBack", "(", "fromAttribute", ",", "targetEntityNamer", ")", ";", "}", "return", "result", ";", "}" ]
Compute the namer for the Java field marked by @OneToOne @param fromAttribute the fk column config @param targetEntityNamer
[ "Compute", "the", "namer", "for", "the", "Java", "field", "marked", "by", "@OneToOne" ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java#L141-L151
Harium/keel
src/main/java/com/harium/keel/catalano/statistics/HistogramStatistics.java
HistogramStatistics.Kurtosis
public static double Kurtosis(int[] values, double mean, double stdDeviation) { """ Calculate Kurtosis value. @param values Values. @param mean Specified mean. @param stdDeviation Specified standard deviation. @return Returns kurtosis value of the specified histogram array. """ double n = 0; for (int i = 0; i < values.length; i++) n += values[i]; double part1 = n * (n + 1); part1 /= ((n - 1) * (n - 2) * (n - 3)); double part2 = 0; for (int i = 0; i < values.length; i++) { part2 += Math.pow((i - mean) / stdDeviation, 4) * values[i]; } double part3 = 3 * Math.pow((n - 1), 2); part3 /= (n - 2) * (n - 3); return part1 * part2 - part3; }
java
public static double Kurtosis(int[] values, double mean, double stdDeviation){ double n = 0; for (int i = 0; i < values.length; i++) n += values[i]; double part1 = n * (n + 1); part1 /= ((n - 1) * (n - 2) * (n - 3)); double part2 = 0; for (int i = 0; i < values.length; i++) { part2 += Math.pow((i - mean) / stdDeviation, 4) * values[i]; } double part3 = 3 * Math.pow((n - 1), 2); part3 /= (n - 2) * (n - 3); return part1 * part2 - part3; }
[ "public", "static", "double", "Kurtosis", "(", "int", "[", "]", "values", ",", "double", "mean", ",", "double", "stdDeviation", ")", "{", "double", "n", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "n", "+=", "values", "[", "i", "]", ";", "double", "part1", "=", "n", "*", "(", "n", "+", "1", ")", ";", "part1", "/=", "(", "(", "n", "-", "1", ")", "*", "(", "n", "-", "2", ")", "*", "(", "n", "-", "3", ")", ")", ";", "double", "part2", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "part2", "+=", "Math", ".", "pow", "(", "(", "i", "-", "mean", ")", "/", "stdDeviation", ",", "4", ")", "*", "values", "[", "i", "]", ";", "}", "double", "part3", "=", "3", "*", "Math", ".", "pow", "(", "(", "n", "-", "1", ")", ",", "2", ")", ";", "part3", "/=", "(", "n", "-", "2", ")", "*", "(", "n", "-", "3", ")", ";", "return", "part1", "*", "part2", "-", "part3", ";", "}" ]
Calculate Kurtosis value. @param values Values. @param mean Specified mean. @param stdDeviation Specified standard deviation. @return Returns kurtosis value of the specified histogram array.
[ "Calculate", "Kurtosis", "value", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/statistics/HistogramStatistics.java#L127-L144
davidmoten/rxjava2-extras
src/main/java/com/github/davidmoten/rx2/internal/flowable/buffertofile/MemoryMappedFile.java
MemoryMappedFile.mapAndSetOffset
private void mapAndSetOffset() { """ for the given length and set this.addr to the returned offset """ try { final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw"); backingFile.setLength(this.size); final FileChannel ch = backingFile.getChannel(); this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size); ch.close(); backingFile.close(); } catch (Exception e) { throw new RuntimeException(e); } }
java
private void mapAndSetOffset() { try { final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw"); backingFile.setLength(this.size); final FileChannel ch = backingFile.getChannel(); this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size); ch.close(); backingFile.close(); } catch (Exception e) { throw new RuntimeException(e); } }
[ "private", "void", "mapAndSetOffset", "(", ")", "{", "try", "{", "final", "RandomAccessFile", "backingFile", "=", "new", "RandomAccessFile", "(", "this", ".", "file", ",", "\"rw\"", ")", ";", "backingFile", ".", "setLength", "(", "this", ".", "size", ")", ";", "final", "FileChannel", "ch", "=", "backingFile", ".", "getChannel", "(", ")", ";", "this", ".", "addr", "=", "(", "Long", ")", "mmap", ".", "invoke", "(", "ch", ",", "1", ",", "0L", ",", "this", ".", "size", ")", ";", "ch", ".", "close", "(", ")", ";", "backingFile", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
for the given length and set this.addr to the returned offset
[ "for", "the", "given", "length", "and", "set", "this", ".", "addr", "to", "the", "returned", "offset" ]
train
https://github.com/davidmoten/rxjava2-extras/blob/bf5ece3f97191f29a81957a6529bc3cfa4d7b328/src/main/java/com/github/davidmoten/rx2/internal/flowable/buffertofile/MemoryMappedFile.java#L59-L71
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.getCorrectedParameterData
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException { """ Corrects the parameter bits using Reed-Solomon algorithm. @param parameterData parameter bits @param compact true if this is a compact Aztec code @throws NotFoundException if the array contains too many errors """ int numCodewords; int numDataCodewords; if (compact) { numCodewords = 7; numDataCodewords = 2; } else { numCodewords = 10; numDataCodewords = 4; } int numECCodewords = numCodewords - numDataCodewords; int[] parameterWords = new int[numCodewords]; for (int i = numCodewords - 1; i >= 0; --i) { parameterWords[i] = (int) parameterData & 0xF; parameterData >>= 4; } try { ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM); rsDecoder.decode(parameterWords, numECCodewords); } catch (ReedSolomonException ignored) { throw NotFoundException.getNotFoundInstance(); } // Toss the error correction. Just return the data as an integer int result = 0; for (int i = 0; i < numDataCodewords; i++) { result = (result << 4) + parameterWords[i]; } return result; }
java
private static int getCorrectedParameterData(long parameterData, boolean compact) throws NotFoundException { int numCodewords; int numDataCodewords; if (compact) { numCodewords = 7; numDataCodewords = 2; } else { numCodewords = 10; numDataCodewords = 4; } int numECCodewords = numCodewords - numDataCodewords; int[] parameterWords = new int[numCodewords]; for (int i = numCodewords - 1; i >= 0; --i) { parameterWords[i] = (int) parameterData & 0xF; parameterData >>= 4; } try { ReedSolomonDecoder rsDecoder = new ReedSolomonDecoder(GenericGF.AZTEC_PARAM); rsDecoder.decode(parameterWords, numECCodewords); } catch (ReedSolomonException ignored) { throw NotFoundException.getNotFoundInstance(); } // Toss the error correction. Just return the data as an integer int result = 0; for (int i = 0; i < numDataCodewords; i++) { result = (result << 4) + parameterWords[i]; } return result; }
[ "private", "static", "int", "getCorrectedParameterData", "(", "long", "parameterData", ",", "boolean", "compact", ")", "throws", "NotFoundException", "{", "int", "numCodewords", ";", "int", "numDataCodewords", ";", "if", "(", "compact", ")", "{", "numCodewords", "=", "7", ";", "numDataCodewords", "=", "2", ";", "}", "else", "{", "numCodewords", "=", "10", ";", "numDataCodewords", "=", "4", ";", "}", "int", "numECCodewords", "=", "numCodewords", "-", "numDataCodewords", ";", "int", "[", "]", "parameterWords", "=", "new", "int", "[", "numCodewords", "]", ";", "for", "(", "int", "i", "=", "numCodewords", "-", "1", ";", "i", ">=", "0", ";", "--", "i", ")", "{", "parameterWords", "[", "i", "]", "=", "(", "int", ")", "parameterData", "&", "0xF", ";", "parameterData", ">>=", "4", ";", "}", "try", "{", "ReedSolomonDecoder", "rsDecoder", "=", "new", "ReedSolomonDecoder", "(", "GenericGF", ".", "AZTEC_PARAM", ")", ";", "rsDecoder", ".", "decode", "(", "parameterWords", ",", "numECCodewords", ")", ";", "}", "catch", "(", "ReedSolomonException", "ignored", ")", "{", "throw", "NotFoundException", ".", "getNotFoundInstance", "(", ")", ";", "}", "// Toss the error correction. Just return the data as an integer", "int", "result", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numDataCodewords", ";", "i", "++", ")", "{", "result", "=", "(", "result", "<<", "4", ")", "+", "parameterWords", "[", "i", "]", ";", "}", "return", "result", ";", "}" ]
Corrects the parameter bits using Reed-Solomon algorithm. @param parameterData parameter bits @param compact true if this is a compact Aztec code @throws NotFoundException if the array contains too many errors
[ "Corrects", "the", "parameter", "bits", "using", "Reed", "-", "Solomon", "algorithm", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L194-L224
sniggle/simple-pgp
simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java
BasePGPCommon.findPrivateKey
protected PGPPrivateKey findPrivateKey(PGPSecretKey pgpSecretKey, String password) throws PGPException { """ read the private key from the given secret key @param pgpSecretKey the secret key @param password the password to unlock the private key @return the unlocked private key @throws PGPException """ LOGGER.trace("findPrivateKey(PGPSecretKey, String)"); LOGGER.trace("Secret Key: {}, Password: {}", pgpSecretKey == null ? "not set" : "set", password == null ? "not set" : "********"); PGPPrivateKey result = null; PBESecretKeyDecryptor pbeSecretKeyDecryptor = new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(password.toCharArray()); LOGGER.info("Extracting private key"); result = pgpSecretKey.extractPrivateKey(pbeSecretKeyDecryptor); if( result == null && LOGGER.isErrorEnabled() ) { LOGGER.error("No private key could be extracted"); } return result; }
java
protected PGPPrivateKey findPrivateKey(PGPSecretKey pgpSecretKey, String password) throws PGPException { LOGGER.trace("findPrivateKey(PGPSecretKey, String)"); LOGGER.trace("Secret Key: {}, Password: {}", pgpSecretKey == null ? "not set" : "set", password == null ? "not set" : "********"); PGPPrivateKey result = null; PBESecretKeyDecryptor pbeSecretKeyDecryptor = new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()).build(password.toCharArray()); LOGGER.info("Extracting private key"); result = pgpSecretKey.extractPrivateKey(pbeSecretKeyDecryptor); if( result == null && LOGGER.isErrorEnabled() ) { LOGGER.error("No private key could be extracted"); } return result; }
[ "protected", "PGPPrivateKey", "findPrivateKey", "(", "PGPSecretKey", "pgpSecretKey", ",", "String", "password", ")", "throws", "PGPException", "{", "LOGGER", ".", "trace", "(", "\"findPrivateKey(PGPSecretKey, String)\"", ")", ";", "LOGGER", ".", "trace", "(", "\"Secret Key: {}, Password: {}\"", ",", "pgpSecretKey", "==", "null", "?", "\"not set\"", ":", "\"set\"", ",", "password", "==", "null", "?", "\"not set\"", ":", "\"********\"", ")", ";", "PGPPrivateKey", "result", "=", "null", ";", "PBESecretKeyDecryptor", "pbeSecretKeyDecryptor", "=", "new", "BcPBESecretKeyDecryptorBuilder", "(", "new", "BcPGPDigestCalculatorProvider", "(", ")", ")", ".", "build", "(", "password", ".", "toCharArray", "(", ")", ")", ";", "LOGGER", ".", "info", "(", "\"Extracting private key\"", ")", ";", "result", "=", "pgpSecretKey", ".", "extractPrivateKey", "(", "pbeSecretKeyDecryptor", ")", ";", "if", "(", "result", "==", "null", "&&", "LOGGER", ".", "isErrorEnabled", "(", ")", ")", "{", "LOGGER", ".", "error", "(", "\"No private key could be extracted\"", ")", ";", "}", "return", "result", ";", "}" ]
read the private key from the given secret key @param pgpSecretKey the secret key @param password the password to unlock the private key @return the unlocked private key @throws PGPException
[ "read", "the", "private", "key", "from", "the", "given", "secret", "key" ]
train
https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-java/src/main/java/me/sniggle/pgp/crypt/internal/BasePGPCommon.java#L261-L272
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeProvider.java
AbstractAttributeProvider.protectNull
protected static Object protectNull(Object rawAttributeValue, AttributeType type) { """ Ensure that the <code>null</code> value for {@code rawAttributeValue} is catched and replaced by a dedicated representant object. This function permits to keep the type of a value even if it is <code>null</code>. @param rawAttributeValue is the value to protect. @param type is the type of the attribute to preserve over time. @return the value, or the representant of the java <code>null</code> value. @see #unprotectNull(Object) """ if (rawAttributeValue == null) { if (type.isNullAllowed()) { return new NullAttribute(type); } throw new NullPointerException(); } return rawAttributeValue; }
java
protected static Object protectNull(Object rawAttributeValue, AttributeType type) { if (rawAttributeValue == null) { if (type.isNullAllowed()) { return new NullAttribute(type); } throw new NullPointerException(); } return rawAttributeValue; }
[ "protected", "static", "Object", "protectNull", "(", "Object", "rawAttributeValue", ",", "AttributeType", "type", ")", "{", "if", "(", "rawAttributeValue", "==", "null", ")", "{", "if", "(", "type", ".", "isNullAllowed", "(", ")", ")", "{", "return", "new", "NullAttribute", "(", "type", ")", ";", "}", "throw", "new", "NullPointerException", "(", ")", ";", "}", "return", "rawAttributeValue", ";", "}" ]
Ensure that the <code>null</code> value for {@code rawAttributeValue} is catched and replaced by a dedicated representant object. This function permits to keep the type of a value even if it is <code>null</code>. @param rawAttributeValue is the value to protect. @param type is the type of the attribute to preserve over time. @return the value, or the representant of the java <code>null</code> value. @see #unprotectNull(Object)
[ "Ensure", "that", "the", "<code", ">", "null<", "/", "code", ">", "value", "for", "{", "@code", "rawAttributeValue", "}", "is", "catched", "and", "replaced", "by", "a", "dedicated", "representant", "object", ".", "This", "function", "permits", "to", "keep", "the", "type", "of", "a", "value", "even", "if", "it", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeProvider.java#L62-L70
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlChecker.java
JdbcControlChecker.check
public void check(Declaration decl, AnnotationProcessorEnvironment env) { """ Invoked by the control build-time infrastructure to process a declaration of a control extension (ie, an interface annotated with @ControlExtension), or a field instance of a control type. """ _locale = Locale.getDefault(); if (decl instanceof TypeDeclaration) { // // Check method annotations // Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods(); for (MethodDeclaration method : methods) { checkSQL(method, env); } } else if (decl instanceof FieldDeclaration) { // // NOOP // } else { // // NOOP // } }
java
public void check(Declaration decl, AnnotationProcessorEnvironment env) { _locale = Locale.getDefault(); if (decl instanceof TypeDeclaration) { // // Check method annotations // Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods(); for (MethodDeclaration method : methods) { checkSQL(method, env); } } else if (decl instanceof FieldDeclaration) { // // NOOP // } else { // // NOOP // } }
[ "public", "void", "check", "(", "Declaration", "decl", ",", "AnnotationProcessorEnvironment", "env", ")", "{", "_locale", "=", "Locale", ".", "getDefault", "(", ")", ";", "if", "(", "decl", "instanceof", "TypeDeclaration", ")", "{", "//", "// Check method annotations", "//", "Collection", "<", "?", "extends", "MethodDeclaration", ">", "methods", "=", "(", "(", "TypeDeclaration", ")", "decl", ")", ".", "getMethods", "(", ")", ";", "for", "(", "MethodDeclaration", "method", ":", "methods", ")", "{", "checkSQL", "(", "method", ",", "env", ")", ";", "}", "}", "else", "if", "(", "decl", "instanceof", "FieldDeclaration", ")", "{", "//", "// NOOP", "//", "}", "else", "{", "//", "// NOOP", "//", "}", "}" ]
Invoked by the control build-time infrastructure to process a declaration of a control extension (ie, an interface annotated with @ControlExtension), or a field instance of a control type.
[ "Invoked", "by", "the", "control", "build", "-", "time", "infrastructure", "to", "process", "a", "declaration", "of", "a", "control", "extension", "(", "ie", "an", "interface", "annotated", "with" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlChecker.java#L57-L82
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsImpl.java
TextAnalyticsImpl.entitiesAsync
public ServiceFuture<EntitiesBatchResult> entitiesAsync(EntitiesOptionalParameter entitiesOptionalParameter, final ServiceCallback<EntitiesBatchResult> serviceCallback) { """ The API returns a list of recognized entities in a given document. To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the &lt;a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages"&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. @param entitiesOptionalParameter the object representing the optional parameters to be set before calling this API @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(entitiesOptionalParameter), serviceCallback); }
java
public ServiceFuture<EntitiesBatchResult> entitiesAsync(EntitiesOptionalParameter entitiesOptionalParameter, final ServiceCallback<EntitiesBatchResult> serviceCallback) { return ServiceFuture.fromResponse(entitiesWithServiceResponseAsync(entitiesOptionalParameter), serviceCallback); }
[ "public", "ServiceFuture", "<", "EntitiesBatchResult", ">", "entitiesAsync", "(", "EntitiesOptionalParameter", "entitiesOptionalParameter", ",", "final", "ServiceCallback", "<", "EntitiesBatchResult", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "entitiesWithServiceResponseAsync", "(", "entitiesOptionalParameter", ")", ",", "serviceCallback", ")", ";", "}" ]
The API returns a list of recognized entities in a given document. To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the &lt;a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/text-analytics-supported-languages"&gt;Supported languages in Text Analytics API&lt;/a&gt; for the list of enabled languages. @param entitiesOptionalParameter the object representing the optional parameters to be set before calling this API @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "The", "API", "returns", "a", "list", "of", "recognized", "entities", "in", "a", "given", "document", ".", "To", "get", "even", "more", "information", "on", "each", "recognized", "entity", "we", "recommend", "using", "the", "Bing", "Entity", "Search", "API", "by", "querying", "for", "the", "recognized", "entities", "names", ".", "See", "the", "&lt", ";", "a", "href", "=", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "azure", "/", "cognitive", "-", "services", "/", "text", "-", "analytics", "/", "text", "-", "analytics", "-", "supported", "-", "languages", "&gt", ";", "Supported", "languages", "in", "Text", "Analytics", "API&lt", ";", "/", "a&gt", ";", "for", "the", "list", "of", "enabled", "languages", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/textanalytics/src/main/java/com/microsoft/azure/cognitiveservices/language/textanalytics/implementation/TextAnalyticsImpl.java#L111-L113
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java
CharOperation.indexOf
public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start) { """ Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start. Answers -1 if no match is found. <br> <br> For example: <ol> <li> <pre> toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result =&gt; 2 </pre> </li> <li> <pre> toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result =&gt; -1 </pre> </li> </ol> @param toBeFound the subarray to search @param array the array to be searched @param isCaseSensitive flag to know if the matching should be case sensitive @param start the starting index @return the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start, -1 otherwise @throws NullPointerException if array is null or toBeFound is null """ return indexOf(toBeFound, array, isCaseSensitive, start, array.length); }
java
public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start) { return indexOf(toBeFound, array, isCaseSensitive, start, array.length); }
[ "public", "static", "final", "int", "indexOf", "(", "final", "char", "[", "]", "toBeFound", ",", "final", "char", "[", "]", "array", ",", "final", "boolean", "isCaseSensitive", ",", "final", "int", "start", ")", "{", "return", "indexOf", "(", "toBeFound", ",", "array", ",", "isCaseSensitive", ",", "start", ",", "array", ".", "length", ")", ";", "}" ]
Answers the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start. Answers -1 if no match is found. <br> <br> For example: <ol> <li> <pre> toBeFound = { 'c' } array = { ' a', 'b', 'c', 'd' } result =&gt; 2 </pre> </li> <li> <pre> toBeFound = { 'e' } array = { ' a', 'b', 'c', 'd' } result =&gt; -1 </pre> </li> </ol> @param toBeFound the subarray to search @param array the array to be searched @param isCaseSensitive flag to know if the matching should be case sensitive @param start the starting index @return the first index in the array for which the toBeFound array is a matching subarray following the case rule starting at the index start, -1 otherwise @throws NullPointerException if array is null or toBeFound is null
[ "Answers", "the", "first", "index", "in", "the", "array", "for", "which", "the", "toBeFound", "array", "is", "a", "matching", "subarray", "following", "the", "case", "rule", "starting", "at", "the", "index", "start", ".", "Answers", "-", "1", "if", "no", "match", "is", "found", ".", "<br", ">", "<br", ">", "For", "example", ":", "<ol", ">", "<li", ">" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L2135-L2139
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ReplaceInListRepairer.java
ReplaceInListRepairer.repairCommand
public ListCommand repairCommand(final ReplaceInList toRepair, final RemoveFromList repairAgainst) { """ Repairs a {@link ReplaceInList} in relation to an {@link RemoveFromList} command. <p> Repairing a {@link ReplaceInList} command can result in an {@link AddToList} command in the case that the element that should be replaced was removed. Therefore this methods return a {@link ListCommand} which is either a {@link ReplaceInList} or {@link AddToList}. </p> @param toRepair The command to repair. @param repairAgainst The command to repair against. @return The repaired command. """ final int indicesBefore = toRepair.getPosition() - repairAgainst.getStartPosition(); if (indicesBefore <= 0) { return toRepair; } final int indicesToDecrese = indicesBefore < repairAgainst.getRemoveCount() ? indicesBefore : repairAgainst .getRemoveCount(); if (repairAgainst.getStartPosition() + repairAgainst.getRemoveCount() <= toRepair.getPosition()) { return new ReplaceInList(toRepair.getListId(), toRepair.getListVersionChange(), toRepair.getValue(), toRepair.getPosition() - indicesToDecrese); } return new AddToList(toRepair.getListId(), toRepair.getListVersionChange(), toRepair.getValue(), toRepair.getPosition() - indicesToDecrese); }
java
public ListCommand repairCommand(final ReplaceInList toRepair, final RemoveFromList repairAgainst) { final int indicesBefore = toRepair.getPosition() - repairAgainst.getStartPosition(); if (indicesBefore <= 0) { return toRepair; } final int indicesToDecrese = indicesBefore < repairAgainst.getRemoveCount() ? indicesBefore : repairAgainst .getRemoveCount(); if (repairAgainst.getStartPosition() + repairAgainst.getRemoveCount() <= toRepair.getPosition()) { return new ReplaceInList(toRepair.getListId(), toRepair.getListVersionChange(), toRepair.getValue(), toRepair.getPosition() - indicesToDecrese); } return new AddToList(toRepair.getListId(), toRepair.getListVersionChange(), toRepair.getValue(), toRepair.getPosition() - indicesToDecrese); }
[ "public", "ListCommand", "repairCommand", "(", "final", "ReplaceInList", "toRepair", ",", "final", "RemoveFromList", "repairAgainst", ")", "{", "final", "int", "indicesBefore", "=", "toRepair", ".", "getPosition", "(", ")", "-", "repairAgainst", ".", "getStartPosition", "(", ")", ";", "if", "(", "indicesBefore", "<=", "0", ")", "{", "return", "toRepair", ";", "}", "final", "int", "indicesToDecrese", "=", "indicesBefore", "<", "repairAgainst", ".", "getRemoveCount", "(", ")", "?", "indicesBefore", ":", "repairAgainst", ".", "getRemoveCount", "(", ")", ";", "if", "(", "repairAgainst", ".", "getStartPosition", "(", ")", "+", "repairAgainst", ".", "getRemoveCount", "(", ")", "<=", "toRepair", ".", "getPosition", "(", ")", ")", "{", "return", "new", "ReplaceInList", "(", "toRepair", ".", "getListId", "(", ")", ",", "toRepair", ".", "getListVersionChange", "(", ")", ",", "toRepair", ".", "getValue", "(", ")", ",", "toRepair", ".", "getPosition", "(", ")", "-", "indicesToDecrese", ")", ";", "}", "return", "new", "AddToList", "(", "toRepair", ".", "getListId", "(", ")", ",", "toRepair", ".", "getListVersionChange", "(", ")", ",", "toRepair", ".", "getValue", "(", ")", ",", "toRepair", ".", "getPosition", "(", ")", "-", "indicesToDecrese", ")", ";", "}" ]
Repairs a {@link ReplaceInList} in relation to an {@link RemoveFromList} command. <p> Repairing a {@link ReplaceInList} command can result in an {@link AddToList} command in the case that the element that should be replaced was removed. Therefore this methods return a {@link ListCommand} which is either a {@link ReplaceInList} or {@link AddToList}. </p> @param toRepair The command to repair. @param repairAgainst The command to repair against. @return The repaired command.
[ "Repairs", "a", "{", "@link", "ReplaceInList", "}", "in", "relation", "to", "an", "{", "@link", "RemoveFromList", "}", "command", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/ReplaceInListRepairer.java#L69-L83
jtrfp/javamod
src/main/java/de/quippy/jflac/util/CRC8.java
CRC8.updateBlock
public static byte updateBlock(byte[] data, int len, byte crc) { """ Update the CRC value with data from a byte array. @param data The byte array @param len The byte array length @param crc The starting CRC value @return The updated CRC value """ for (int i = 0; i < len; i++) crc = CRC8_TABLE[crc ^ data[i]]; return crc; }
java
public static byte updateBlock(byte[] data, int len, byte crc) { for (int i = 0; i < len; i++) crc = CRC8_TABLE[crc ^ data[i]]; return crc; }
[ "public", "static", "byte", "updateBlock", "(", "byte", "[", "]", "data", ",", "int", "len", ",", "byte", "crc", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "crc", "=", "CRC8_TABLE", "[", "crc", "^", "data", "[", "i", "]", "]", ";", "return", "crc", ";", "}" ]
Update the CRC value with data from a byte array. @param data The byte array @param len The byte array length @param crc The starting CRC value @return The updated CRC value
[ "Update", "the", "CRC", "value", "with", "data", "from", "a", "byte", "array", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/util/CRC8.java#L308-L312
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/BinaryContentServlet.java
BinaryContentServlet.processRequest
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { """ Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. @param request servlet request @param response servlet response @throws ServletException if a servlet-specific error occurs @throws IOException if an I/O error occurs """ log.severe("Binary content has been requested"); String repository = request.getParameter("repository"); String workspace = request.getParameter("workspace"); String path = request.getParameter("path"); String property = request.getParameter("property"); Connector connector = (Connector) request.getSession().getAttribute("connector"); try { Session session = connector.find(repository).session(workspace); Node node = session.getNode(path); Property p; try { p = node.getProperty(property); } catch (PathNotFoundException e) { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.write("<html>"); writer.write("<p>Content not found or recently removed</p>"); writer.write("</html>"); return; } Binary binary = p.getBinary(); InputStream in = binary.getStream(); String contentType = node.getProperty("jcr:mimeType").getString(); response.setContentType(contentType); int b; while ((b = in.read()) != -1) { response.getOutputStream().write(b); } log.severe("Sent binary content"); binary.dispose(); } catch (Exception e) { throw new ServletException(e); } }
java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.severe("Binary content has been requested"); String repository = request.getParameter("repository"); String workspace = request.getParameter("workspace"); String path = request.getParameter("path"); String property = request.getParameter("property"); Connector connector = (Connector) request.getSession().getAttribute("connector"); try { Session session = connector.find(repository).session(workspace); Node node = session.getNode(path); Property p; try { p = node.getProperty(property); } catch (PathNotFoundException e) { response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.write("<html>"); writer.write("<p>Content not found or recently removed</p>"); writer.write("</html>"); return; } Binary binary = p.getBinary(); InputStream in = binary.getStream(); String contentType = node.getProperty("jcr:mimeType").getString(); response.setContentType(contentType); int b; while ((b = in.read()) != -1) { response.getOutputStream().write(b); } log.severe("Sent binary content"); binary.dispose(); } catch (Exception e) { throw new ServletException(e); } }
[ "protected", "void", "processRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "log", ".", "severe", "(", "\"Binary content has been requested\"", ")", ";", "String", "repository", "=", "request", ".", "getParameter", "(", "\"repository\"", ")", ";", "String", "workspace", "=", "request", ".", "getParameter", "(", "\"workspace\"", ")", ";", "String", "path", "=", "request", ".", "getParameter", "(", "\"path\"", ")", ";", "String", "property", "=", "request", ".", "getParameter", "(", "\"property\"", ")", ";", "Connector", "connector", "=", "(", "Connector", ")", "request", ".", "getSession", "(", ")", ".", "getAttribute", "(", "\"connector\"", ")", ";", "try", "{", "Session", "session", "=", "connector", ".", "find", "(", "repository", ")", ".", "session", "(", "workspace", ")", ";", "Node", "node", "=", "session", ".", "getNode", "(", "path", ")", ";", "Property", "p", ";", "try", "{", "p", "=", "node", ".", "getProperty", "(", "property", ")", ";", "}", "catch", "(", "PathNotFoundException", "e", ")", "{", "response", ".", "setContentType", "(", "\"text/html\"", ")", ";", "PrintWriter", "writer", "=", "response", ".", "getWriter", "(", ")", ";", "writer", ".", "write", "(", "\"<html>\"", ")", ";", "writer", ".", "write", "(", "\"<p>Content not found or recently removed</p>\"", ")", ";", "writer", ".", "write", "(", "\"</html>\"", ")", ";", "return", ";", "}", "Binary", "binary", "=", "p", ".", "getBinary", "(", ")", ";", "InputStream", "in", "=", "binary", ".", "getStream", "(", ")", ";", "String", "contentType", "=", "node", ".", "getProperty", "(", "\"jcr:mimeType\"", ")", ".", "getString", "(", ")", ";", "response", ".", "setContentType", "(", "contentType", ")", ";", "int", "b", ";", "while", "(", "(", "b", "=", "in", ".", "read", "(", ")", ")", "!=", "-", "1", ")", "{", "response", ".", "getOutputStream", "(", ")", ".", "write", "(", "b", ")", ";", "}", "log", ".", "severe", "(", "\"Sent binary content\"", ")", ";", "binary", ".", "dispose", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ServletException", "(", "e", ")", ";", "}", "}" ]
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. @param request servlet request @param response servlet response @throws ServletException if a servlet-specific error occurs @throws IOException if an I/O error occurs
[ "Processes", "requests", "for", "both", "HTTP", "<code", ">", "GET<", "/", "code", ">", "and", "<code", ">", "POST<", "/", "code", ">", "methods", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/BinaryContentServlet.java#L52-L97
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/validation/CmsValidationController.java
CmsValidationController.onReceiveValidationResults
protected void onReceiveValidationResults(Map<String, CmsValidationResult> results) { """ Internal method which is executed when the results of the asynchronous validation are received from the server.<p> @param results the validation results """ try { for (Map.Entry<String, CmsValidationResult> resultEntry : results.entrySet()) { String fieldName = resultEntry.getKey(); CmsValidationResult result = resultEntry.getValue(); provideValidationResult(fieldName, result); } m_handler.onValidationFinished(m_validationOk); } finally { CmsValidationScheduler.get().executeNext(); } }
java
protected void onReceiveValidationResults(Map<String, CmsValidationResult> results) { try { for (Map.Entry<String, CmsValidationResult> resultEntry : results.entrySet()) { String fieldName = resultEntry.getKey(); CmsValidationResult result = resultEntry.getValue(); provideValidationResult(fieldName, result); } m_handler.onValidationFinished(m_validationOk); } finally { CmsValidationScheduler.get().executeNext(); } }
[ "protected", "void", "onReceiveValidationResults", "(", "Map", "<", "String", ",", "CmsValidationResult", ">", "results", ")", "{", "try", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "CmsValidationResult", ">", "resultEntry", ":", "results", ".", "entrySet", "(", ")", ")", "{", "String", "fieldName", "=", "resultEntry", ".", "getKey", "(", ")", ";", "CmsValidationResult", "result", "=", "resultEntry", ".", "getValue", "(", ")", ";", "provideValidationResult", "(", "fieldName", ",", "result", ")", ";", "}", "m_handler", ".", "onValidationFinished", "(", "m_validationOk", ")", ";", "}", "finally", "{", "CmsValidationScheduler", ".", "get", "(", ")", ".", "executeNext", "(", ")", ";", "}", "}" ]
Internal method which is executed when the results of the asynchronous validation are received from the server.<p> @param results the validation results
[ "Internal", "method", "which", "is", "executed", "when", "the", "results", "of", "the", "asynchronous", "validation", "are", "received", "from", "the", "server", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/validation/CmsValidationController.java#L216-L228
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractCellIconFeedback.java
AbstractCellIconFeedback.getAbsoluteAnchorLinkWithCell
private AnchorLink getAbsoluteAnchorLinkWithCell(int dragOffsetX) { """ Retrieves the absolute anchor link to attach the decoration to the cell. @param dragOffsetX Dragged distance in case the column is being dragged, 0 otherwise. @return Absolute anchor link to attach the decoration to the cell. """ AnchorLink absoluteAnchorLink; TableModel tableModel = table.getModel(); if ((0 <= modelRowIndex) && (modelRowIndex < tableModel.getRowCount()) && (0 <= modelColumnIndex) && (modelColumnIndex < tableModel.getColumnCount())) { int viewRowIndex = table.convertRowIndexToView(modelRowIndex); int viewColumnIndex = table.convertColumnIndexToView(modelColumnIndex); Rectangle cellBounds = table.getCellRect(viewRowIndex, viewColumnIndex, true); Anchor relativeCellAnchor = anchorLinkWithCell.getMasterAnchor(); Anchor absoluteCellAnchor = new Anchor(0.0f, cellBounds.x + dragOffsetX + (int) (cellBounds.width * relativeCellAnchor.getRelativeX()) + relativeCellAnchor.getOffsetX(), 0.0f, cellBounds.y + (int) (cellBounds.height * relativeCellAnchor.getRelativeY()) + relativeCellAnchor.getOffsetY()); absoluteAnchorLink = new AnchorLink(absoluteCellAnchor, anchorLinkWithCell.getSlaveAnchor()); } else { // Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index? LOGGER.debug("Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," + modelColumnIndex + ") for table dimensions (" + tableModel.getRowCount() + "," + tableModel.getColumnCount() + ")"); // Decoration will not be shown absoluteAnchorLink = null; } return absoluteAnchorLink; }
java
private AnchorLink getAbsoluteAnchorLinkWithCell(int dragOffsetX) { AnchorLink absoluteAnchorLink; TableModel tableModel = table.getModel(); if ((0 <= modelRowIndex) && (modelRowIndex < tableModel.getRowCount()) && (0 <= modelColumnIndex) && (modelColumnIndex < tableModel.getColumnCount())) { int viewRowIndex = table.convertRowIndexToView(modelRowIndex); int viewColumnIndex = table.convertColumnIndexToView(modelColumnIndex); Rectangle cellBounds = table.getCellRect(viewRowIndex, viewColumnIndex, true); Anchor relativeCellAnchor = anchorLinkWithCell.getMasterAnchor(); Anchor absoluteCellAnchor = new Anchor(0.0f, cellBounds.x + dragOffsetX + (int) (cellBounds.width * relativeCellAnchor.getRelativeX()) + relativeCellAnchor.getOffsetX(), 0.0f, cellBounds.y + (int) (cellBounds.height * relativeCellAnchor.getRelativeY()) + relativeCellAnchor.getOffsetY()); absoluteAnchorLink = new AnchorLink(absoluteCellAnchor, anchorLinkWithCell.getSlaveAnchor()); } else { // Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index? LOGGER.debug("Cell at model row and/or column indices is not visible: (" + modelRowIndex + "," + modelColumnIndex + ") for table dimensions (" + tableModel.getRowCount() + "," + tableModel.getColumnCount() + ")"); // Decoration will not be shown absoluteAnchorLink = null; } return absoluteAnchorLink; }
[ "private", "AnchorLink", "getAbsoluteAnchorLinkWithCell", "(", "int", "dragOffsetX", ")", "{", "AnchorLink", "absoluteAnchorLink", ";", "TableModel", "tableModel", "=", "table", ".", "getModel", "(", ")", ";", "if", "(", "(", "0", "<=", "modelRowIndex", ")", "&&", "(", "modelRowIndex", "<", "tableModel", ".", "getRowCount", "(", ")", ")", "&&", "(", "0", "<=", "modelColumnIndex", ")", "&&", "(", "modelColumnIndex", "<", "tableModel", ".", "getColumnCount", "(", ")", ")", ")", "{", "int", "viewRowIndex", "=", "table", ".", "convertRowIndexToView", "(", "modelRowIndex", ")", ";", "int", "viewColumnIndex", "=", "table", ".", "convertColumnIndexToView", "(", "modelColumnIndex", ")", ";", "Rectangle", "cellBounds", "=", "table", ".", "getCellRect", "(", "viewRowIndex", ",", "viewColumnIndex", ",", "true", ")", ";", "Anchor", "relativeCellAnchor", "=", "anchorLinkWithCell", ".", "getMasterAnchor", "(", ")", ";", "Anchor", "absoluteCellAnchor", "=", "new", "Anchor", "(", "0.0f", ",", "cellBounds", ".", "x", "+", "dragOffsetX", "+", "(", "int", ")", "(", "cellBounds", ".", "width", "*", "relativeCellAnchor", ".", "getRelativeX", "(", ")", ")", "+", "relativeCellAnchor", ".", "getOffsetX", "(", ")", ",", "0.0f", ",", "cellBounds", ".", "y", "+", "(", "int", ")", "(", "cellBounds", ".", "height", "*", "relativeCellAnchor", ".", "getRelativeY", "(", ")", ")", "+", "relativeCellAnchor", ".", "getOffsetY", "(", ")", ")", ";", "absoluteAnchorLink", "=", "new", "AnchorLink", "(", "absoluteCellAnchor", ",", "anchorLinkWithCell", ".", "getSlaveAnchor", "(", ")", ")", ";", "}", "else", "{", "// Maybe the table has been emptied? or the row has been filtered out? or invalid row/column index?", "LOGGER", ".", "debug", "(", "\"Cell at model row and/or column indices is not visible: (\"", "+", "modelRowIndex", "+", "\",\"", "+", "modelColumnIndex", "+", "\") for table dimensions (\"", "+", "tableModel", ".", "getRowCount", "(", ")", "+", "\",\"", "+", "tableModel", ".", "getColumnCount", "(", ")", "+", "\")\"", ")", ";", "// Decoration will not be shown", "absoluteAnchorLink", "=", "null", ";", "}", "return", "absoluteAnchorLink", ";", "}" ]
Retrieves the absolute anchor link to attach the decoration to the cell. @param dragOffsetX Dragged distance in case the column is being dragged, 0 otherwise. @return Absolute anchor link to attach the decoration to the cell.
[ "Retrieves", "the", "absolute", "anchor", "link", "to", "attach", "the", "decoration", "to", "the", "cell", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/resulthandler/AbstractCellIconFeedback.java#L371-L397
aws/aws-sdk-java
aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java
EntityFilter.withTags
public EntityFilter withTags(java.util.Collection<java.util.Map<String, String>> tags) { """ <p> A map of entity tags attached to the affected entity. </p> @param tags A map of entity tags attached to the affected entity. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public EntityFilter withTags(java.util.Collection<java.util.Map<String, String>> tags) { setTags(tags); return this; }
[ "public", "EntityFilter", "withTags", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> A map of entity tags attached to the affected entity. </p> @param tags A map of entity tags attached to the affected entity. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "entity", "tags", "attached", "to", "the", "affected", "entity", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java#L422-L425
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java
TasksImpl.listAsync
public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { """ Lists all of the tasks that are associated with the specified job. For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. @param jobId The ID of the job. @param taskListOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "CloudTask", ">", ">", "listAsync", "(", "final", "String", "jobId", ",", "final", "TaskListOptions", "taskListOptions", ",", "final", "ListOperationCallback", "<", "CloudTask", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listSinglePageAsync", "(", "jobId", ",", "taskListOptions", ")", ",", "new", "Func1", "<", "String", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudTask", ">", ",", "TaskListHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudTask", ">", ",", "TaskListHeaders", ">", ">", "call", "(", "String", "nextPageLink", ")", "{", "TaskListNextOptions", "taskListNextOptions", "=", "null", ";", "if", "(", "taskListOptions", "!=", "null", ")", "{", "taskListNextOptions", "=", "new", "TaskListNextOptions", "(", ")", ";", "taskListNextOptions", ".", "withClientRequestId", "(", "taskListOptions", ".", "clientRequestId", "(", ")", ")", ";", "taskListNextOptions", ".", "withReturnClientRequestId", "(", "taskListOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "taskListNextOptions", ".", "withOcpDate", "(", "taskListOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "listNextSinglePageAsync", "(", "nextPageLink", ",", "taskListNextOptions", ")", ";", "}", "}", ",", "serviceCallback", ")", ";", "}" ]
Lists all of the tasks that are associated with the specified job. For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. @param jobId The ID of the job. @param taskListOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "all", "of", "the", "tasks", "that", "are", "associated", "with", "the", "specified", "job", ".", "For", "multi", "-", "instance", "tasks", "information", "such", "as", "affinityId", "executionInfo", "and", "nodeInfo", "refer", "to", "the", "primary", "task", ".", "Use", "the", "list", "subtasks", "API", "to", "retrieve", "information", "about", "subtasks", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L509-L526
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/knopflerfish/service/log/LogUtil.java
LogUtil.toLevel
static public int toLevel(String level, int def) { """ * Converts a string representing a log severity level to an int. * * @param level The string to convert. * @param def Default value to use if the string is not * recognized as a log level. * @return the log level, or the default value if the string can * not be recognized. """ if (level.equalsIgnoreCase("INFO")) { return LogService.LOG_INFO; } else if (level.equalsIgnoreCase("DEBUG")) { return LogService.LOG_DEBUG; } else if (level.equalsIgnoreCase("WARNING")) { return LogService.LOG_WARNING; } else if (level.equalsIgnoreCase("ERROR")) { return LogService.LOG_ERROR; } else if (level.equalsIgnoreCase("DEFAULT")) { return 0; } return def; }
java
static public int toLevel(String level, int def) { if (level.equalsIgnoreCase("INFO")) { return LogService.LOG_INFO; } else if (level.equalsIgnoreCase("DEBUG")) { return LogService.LOG_DEBUG; } else if (level.equalsIgnoreCase("WARNING")) { return LogService.LOG_WARNING; } else if (level.equalsIgnoreCase("ERROR")) { return LogService.LOG_ERROR; } else if (level.equalsIgnoreCase("DEFAULT")) { return 0; } return def; }
[ "static", "public", "int", "toLevel", "(", "String", "level", ",", "int", "def", ")", "{", "if", "(", "level", ".", "equalsIgnoreCase", "(", "\"INFO\"", ")", ")", "{", "return", "LogService", ".", "LOG_INFO", ";", "}", "else", "if", "(", "level", ".", "equalsIgnoreCase", "(", "\"DEBUG\"", ")", ")", "{", "return", "LogService", ".", "LOG_DEBUG", ";", "}", "else", "if", "(", "level", ".", "equalsIgnoreCase", "(", "\"WARNING\"", ")", ")", "{", "return", "LogService", ".", "LOG_WARNING", ";", "}", "else", "if", "(", "level", ".", "equalsIgnoreCase", "(", "\"ERROR\"", ")", ")", "{", "return", "LogService", ".", "LOG_ERROR", ";", "}", "else", "if", "(", "level", ".", "equalsIgnoreCase", "(", "\"DEFAULT\"", ")", ")", "{", "return", "0", ";", "}", "return", "def", ";", "}" ]
* Converts a string representing a log severity level to an int. * * @param level The string to convert. * @param def Default value to use if the string is not * recognized as a log level. * @return the log level, or the default value if the string can * not be recognized.
[ "*", "Converts", "a", "string", "representing", "a", "log", "severity", "level", "to", "an", "int", ".", "*", "*" ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/knopflerfish/service/log/LogUtil.java#L107-L120
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateAssign
private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) { """ Translate an individual assignment from one rval to one or more lvals. If there are multiple lvals, then a tuple is created to represent the left-hand side. @param lval One or more expressions representing the left-hand side @param rval A single expression representing the right-hand side @param context @return @throws ResolutionError """ Expr[] ls = new Expr[lval.length]; for (int i = 0; i != ls.length; ++i) { WyilFile.LVal lhs = lval[i]; generateTypeInvariantCheck(lhs.getType(), rval[i], context); context = translateSingleAssignment(lval[i], rval[i], context); } return context; }
java
private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) { Expr[] ls = new Expr[lval.length]; for (int i = 0; i != ls.length; ++i) { WyilFile.LVal lhs = lval[i]; generateTypeInvariantCheck(lhs.getType(), rval[i], context); context = translateSingleAssignment(lval[i], rval[i], context); } return context; }
[ "private", "Context", "translateAssign", "(", "WyilFile", ".", "LVal", "[", "]", "lval", ",", "Expr", "[", "]", "rval", ",", "Context", "context", ")", "{", "Expr", "[", "]", "ls", "=", "new", "Expr", "[", "lval", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "ls", ".", "length", ";", "++", "i", ")", "{", "WyilFile", ".", "LVal", "lhs", "=", "lval", "[", "i", "]", ";", "generateTypeInvariantCheck", "(", "lhs", ".", "getType", "(", ")", ",", "rval", "[", "i", "]", ",", "context", ")", ";", "context", "=", "translateSingleAssignment", "(", "lval", "[", "i", "]", ",", "rval", "[", "i", "]", ",", "context", ")", ";", "}", "return", "context", ";", "}" ]
Translate an individual assignment from one rval to one or more lvals. If there are multiple lvals, then a tuple is created to represent the left-hand side. @param lval One or more expressions representing the left-hand side @param rval A single expression representing the right-hand side @param context @return @throws ResolutionError
[ "Translate", "an", "individual", "assignment", "from", "one", "rval", "to", "one", "or", "more", "lvals", ".", "If", "there", "are", "multiple", "lvals", "then", "a", "tuple", "is", "created", "to", "represent", "the", "left", "-", "hand", "side", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L565-L573
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Join.java
Join.apply
@Override public Object apply(Object value, Object... params) { """ /* join(input, glue = ' ') Join elements of the array with certain character between them """ if (value == null) { return ""; } StringBuilder builder = new StringBuilder(); Object[] array = super.asArray(value); String glue = params.length == 0 ? " " : super.asString(super.get(0, params)); for (int i = 0; i < array.length; i++) { builder.append(super.asString(array[i])); if (i < array.length - 1) { builder.append(glue); } } return builder.toString(); }
java
@Override public Object apply(Object value, Object... params) { if (value == null) { return ""; } StringBuilder builder = new StringBuilder(); Object[] array = super.asArray(value); String glue = params.length == 0 ? " " : super.asString(super.get(0, params)); for (int i = 0; i < array.length; i++) { builder.append(super.asString(array[i])); if (i < array.length - 1) { builder.append(glue); } } return builder.toString(); }
[ "@", "Override", "public", "Object", "apply", "(", "Object", "value", ",", "Object", "...", "params", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "Object", "[", "]", "array", "=", "super", ".", "asArray", "(", "value", ")", ";", "String", "glue", "=", "params", ".", "length", "==", "0", "?", "\" \"", ":", "super", ".", "asString", "(", "super", ".", "get", "(", "0", ",", "params", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "builder", ".", "append", "(", "super", ".", "asString", "(", "array", "[", "i", "]", ")", ")", ";", "if", "(", "i", "<", "array", ".", "length", "-", "1", ")", "{", "builder", ".", "append", "(", "glue", ")", ";", "}", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
/* join(input, glue = ' ') Join elements of the array with certain character between them
[ "/", "*", "join", "(", "input", "glue", "=", ")" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Join.java#L12-L34
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java
A_CmsListTab.createUploadButtonForTarget
protected CmsUploadButton createUploadButtonForTarget(String target, boolean isRootPath) { """ Creates an upload button for the given target.<p> @param target the upload target folder @param isRootPath true if target is a root path @return the upload button """ CmsDialogUploadButtonHandler buttonHandler = new CmsDialogUploadButtonHandler( new Supplier<I_CmsUploadContext>() { public I_CmsUploadContext get() { return new I_CmsUploadContext() { public void onUploadFinished(List<String> uploadedFiles) { getTabHandler().updateIndex(); } }; } }); buttonHandler.setTargetFolder(target); buttonHandler.setIsTargetRootPath(isRootPath); CmsUploadButton uploadButton = new CmsUploadButton(buttonHandler); uploadButton.setText(null); uploadButton.setTitle(Messages.get().key(Messages.GUI_GALLERY_UPLOAD_TITLE_1, target)); uploadButton.setButtonStyle(ButtonStyle.FONT_ICON, null); uploadButton.setImageClass(I_CmsButton.UPLOAD_SMALL); return uploadButton; }
java
protected CmsUploadButton createUploadButtonForTarget(String target, boolean isRootPath) { CmsDialogUploadButtonHandler buttonHandler = new CmsDialogUploadButtonHandler( new Supplier<I_CmsUploadContext>() { public I_CmsUploadContext get() { return new I_CmsUploadContext() { public void onUploadFinished(List<String> uploadedFiles) { getTabHandler().updateIndex(); } }; } }); buttonHandler.setTargetFolder(target); buttonHandler.setIsTargetRootPath(isRootPath); CmsUploadButton uploadButton = new CmsUploadButton(buttonHandler); uploadButton.setText(null); uploadButton.setTitle(Messages.get().key(Messages.GUI_GALLERY_UPLOAD_TITLE_1, target)); uploadButton.setButtonStyle(ButtonStyle.FONT_ICON, null); uploadButton.setImageClass(I_CmsButton.UPLOAD_SMALL); return uploadButton; }
[ "protected", "CmsUploadButton", "createUploadButtonForTarget", "(", "String", "target", ",", "boolean", "isRootPath", ")", "{", "CmsDialogUploadButtonHandler", "buttonHandler", "=", "new", "CmsDialogUploadButtonHandler", "(", "new", "Supplier", "<", "I_CmsUploadContext", ">", "(", ")", "{", "public", "I_CmsUploadContext", "get", "(", ")", "{", "return", "new", "I_CmsUploadContext", "(", ")", "{", "public", "void", "onUploadFinished", "(", "List", "<", "String", ">", "uploadedFiles", ")", "{", "getTabHandler", "(", ")", ".", "updateIndex", "(", ")", ";", "}", "}", ";", "}", "}", ")", ";", "buttonHandler", ".", "setTargetFolder", "(", "target", ")", ";", "buttonHandler", ".", "setIsTargetRootPath", "(", "isRootPath", ")", ";", "CmsUploadButton", "uploadButton", "=", "new", "CmsUploadButton", "(", "buttonHandler", ")", ";", "uploadButton", ".", "setText", "(", "null", ")", ";", "uploadButton", ".", "setTitle", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_GALLERY_UPLOAD_TITLE_1", ",", "target", ")", ")", ";", "uploadButton", ".", "setButtonStyle", "(", "ButtonStyle", ".", "FONT_ICON", ",", "null", ")", ";", "uploadButton", ".", "setImageClass", "(", "I_CmsButton", ".", "UPLOAD_SMALL", ")", ";", "return", "uploadButton", ";", "}" ]
Creates an upload button for the given target.<p> @param target the upload target folder @param isRootPath true if target is a root path @return the upload button
[ "Creates", "an", "upload", "button", "for", "the", "given", "target", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java#L572-L599
blackducksoftware/hub-common-rest
src/main/java/com/synopsys/integration/blackduck/rest/ApiTokenRestConnection.java
ApiTokenRestConnection.authenticateWithBlackduck
@Override public void authenticateWithBlackduck() throws IntegrationException { """ Gets the cookie for the Authorized connection to the Hub server. Returns the response code from the connection. """ final URL authenticationUrl; try { authenticationUrl = new URL(getBaseUrl(), "api/tokens/authenticate"); } catch (final MalformedURLException e) { throw new IntegrationException("Error constructing the authentication URL: " + e.getMessage(), e); } if (StringUtils.isNotBlank(hubApiToken)) { final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, getRequestHeaders()); requestBuilder.setCharset(Charsets.UTF_8); requestBuilder.setUri(authenticationUrl.toString()); final HttpUriRequest request = requestBuilder.build(); logRequestHeaders(request); try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) { logResponseHeaders(closeableHttpResponse); final Response response = new Response(closeableHttpResponse); final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase(); if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) { final String httpResponseContent = response.getContentString(); throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage)); } else { addCommonRequestHeader(AUTHORIZATION_HEADER, "Bearer " + readBearerToken(closeableHttpResponse)); // get the CSRF token final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN); if (csrfToken != null) { addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue()); } else { logger.error("No CSRF token found when authenticating"); } } } catch (final IOException e) { throw new IntegrationException(e.getMessage(), e); } } }
java
@Override public void authenticateWithBlackduck() throws IntegrationException { final URL authenticationUrl; try { authenticationUrl = new URL(getBaseUrl(), "api/tokens/authenticate"); } catch (final MalformedURLException e) { throw new IntegrationException("Error constructing the authentication URL: " + e.getMessage(), e); } if (StringUtils.isNotBlank(hubApiToken)) { final RequestBuilder requestBuilder = createRequestBuilder(HttpMethod.POST, getRequestHeaders()); requestBuilder.setCharset(Charsets.UTF_8); requestBuilder.setUri(authenticationUrl.toString()); final HttpUriRequest request = requestBuilder.build(); logRequestHeaders(request); try (final CloseableHttpResponse closeableHttpResponse = getClient().execute(request)) { logResponseHeaders(closeableHttpResponse); final Response response = new Response(closeableHttpResponse); final int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); final String statusMessage = closeableHttpResponse.getStatusLine().getReasonPhrase(); if (statusCode < RestConstants.OK_200 || statusCode >= RestConstants.MULT_CHOICE_300) { final String httpResponseContent = response.getContentString(); throw new IntegrationRestException(statusCode, statusMessage, httpResponseContent, String.format("Connection Error: %s %s", statusCode, statusMessage)); } else { addCommonRequestHeader(AUTHORIZATION_HEADER, "Bearer " + readBearerToken(closeableHttpResponse)); // get the CSRF token final Header csrfToken = closeableHttpResponse.getFirstHeader(RestConstants.X_CSRF_TOKEN); if (csrfToken != null) { addCommonRequestHeader(RestConstants.X_CSRF_TOKEN, csrfToken.getValue()); } else { logger.error("No CSRF token found when authenticating"); } } } catch (final IOException e) { throw new IntegrationException(e.getMessage(), e); } } }
[ "@", "Override", "public", "void", "authenticateWithBlackduck", "(", ")", "throws", "IntegrationException", "{", "final", "URL", "authenticationUrl", ";", "try", "{", "authenticationUrl", "=", "new", "URL", "(", "getBaseUrl", "(", ")", ",", "\"api/tokens/authenticate\"", ")", ";", "}", "catch", "(", "final", "MalformedURLException", "e", ")", "{", "throw", "new", "IntegrationException", "(", "\"Error constructing the authentication URL: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "if", "(", "StringUtils", ".", "isNotBlank", "(", "hubApiToken", ")", ")", "{", "final", "RequestBuilder", "requestBuilder", "=", "createRequestBuilder", "(", "HttpMethod", ".", "POST", ",", "getRequestHeaders", "(", ")", ")", ";", "requestBuilder", ".", "setCharset", "(", "Charsets", ".", "UTF_8", ")", ";", "requestBuilder", ".", "setUri", "(", "authenticationUrl", ".", "toString", "(", ")", ")", ";", "final", "HttpUriRequest", "request", "=", "requestBuilder", ".", "build", "(", ")", ";", "logRequestHeaders", "(", "request", ")", ";", "try", "(", "final", "CloseableHttpResponse", "closeableHttpResponse", "=", "getClient", "(", ")", ".", "execute", "(", "request", ")", ")", "{", "logResponseHeaders", "(", "closeableHttpResponse", ")", ";", "final", "Response", "response", "=", "new", "Response", "(", "closeableHttpResponse", ")", ";", "final", "int", "statusCode", "=", "closeableHttpResponse", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "final", "String", "statusMessage", "=", "closeableHttpResponse", ".", "getStatusLine", "(", ")", ".", "getReasonPhrase", "(", ")", ";", "if", "(", "statusCode", "<", "RestConstants", ".", "OK_200", "||", "statusCode", ">=", "RestConstants", ".", "MULT_CHOICE_300", ")", "{", "final", "String", "httpResponseContent", "=", "response", ".", "getContentString", "(", ")", ";", "throw", "new", "IntegrationRestException", "(", "statusCode", ",", "statusMessage", ",", "httpResponseContent", ",", "String", ".", "format", "(", "\"Connection Error: %s %s\"", ",", "statusCode", ",", "statusMessage", ")", ")", ";", "}", "else", "{", "addCommonRequestHeader", "(", "AUTHORIZATION_HEADER", ",", "\"Bearer \"", "+", "readBearerToken", "(", "closeableHttpResponse", ")", ")", ";", "// get the CSRF token", "final", "Header", "csrfToken", "=", "closeableHttpResponse", ".", "getFirstHeader", "(", "RestConstants", ".", "X_CSRF_TOKEN", ")", ";", "if", "(", "csrfToken", "!=", "null", ")", "{", "addCommonRequestHeader", "(", "RestConstants", ".", "X_CSRF_TOKEN", ",", "csrfToken", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "logger", ".", "error", "(", "\"No CSRF token found when authenticating\"", ")", ";", "}", "}", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "IntegrationException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}" ]
Gets the cookie for the Authorized connection to the Hub server. Returns the response code from the connection.
[ "Gets", "the", "cookie", "for", "the", "Authorized", "connection", "to", "the", "Hub", "server", ".", "Returns", "the", "response", "code", "from", "the", "connection", "." ]
train
https://github.com/blackducksoftware/hub-common-rest/blob/7df7ec1f421dca0fb35d8679f6fcb494cee08a2a/src/main/java/com/synopsys/integration/blackduck/rest/ApiTokenRestConnection.java#L80-L118
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/vat/VATINSyntaxChecker.java
VATINSyntaxChecker.isValidVATIN
public static boolean isValidVATIN (@Nonnull final String sVATIN, final boolean bIfNoValidator) { """ Check if the provided VATIN is valid. This method handles VATINs for all countries. This check uses only the checksum algorithm and does not call any webservice etc. @param sVATIN VATIN to check. May not be <code>null</code>. @param bIfNoValidator What to return if no validator was found? @return <code>true</code> if the VATIN is valid (or unknown). @since 6.0.1 """ ValueEnforcer.notNull (sVATIN, "VATIN"); if (sVATIN.length () > 2) { final String sCountryCode = sVATIN.substring (0, 2).toUpperCase (Locale.US); final IToBooleanFunction <String> aValidator = s_aMap.get (sCountryCode); if (aValidator != null) return aValidator.applyAsBoolean (sVATIN.substring (2)); } // No validator return bIfNoValidator; }
java
public static boolean isValidVATIN (@Nonnull final String sVATIN, final boolean bIfNoValidator) { ValueEnforcer.notNull (sVATIN, "VATIN"); if (sVATIN.length () > 2) { final String sCountryCode = sVATIN.substring (0, 2).toUpperCase (Locale.US); final IToBooleanFunction <String> aValidator = s_aMap.get (sCountryCode); if (aValidator != null) return aValidator.applyAsBoolean (sVATIN.substring (2)); } // No validator return bIfNoValidator; }
[ "public", "static", "boolean", "isValidVATIN", "(", "@", "Nonnull", "final", "String", "sVATIN", ",", "final", "boolean", "bIfNoValidator", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sVATIN", ",", "\"VATIN\"", ")", ";", "if", "(", "sVATIN", ".", "length", "(", ")", ">", "2", ")", "{", "final", "String", "sCountryCode", "=", "sVATIN", ".", "substring", "(", "0", ",", "2", ")", ".", "toUpperCase", "(", "Locale", ".", "US", ")", ";", "final", "IToBooleanFunction", "<", "String", ">", "aValidator", "=", "s_aMap", ".", "get", "(", "sCountryCode", ")", ";", "if", "(", "aValidator", "!=", "null", ")", "return", "aValidator", ".", "applyAsBoolean", "(", "sVATIN", ".", "substring", "(", "2", ")", ")", ";", "}", "// No validator", "return", "bIfNoValidator", ";", "}" ]
Check if the provided VATIN is valid. This method handles VATINs for all countries. This check uses only the checksum algorithm and does not call any webservice etc. @param sVATIN VATIN to check. May not be <code>null</code>. @param bIfNoValidator What to return if no validator was found? @return <code>true</code> if the VATIN is valid (or unknown). @since 6.0.1
[ "Check", "if", "the", "provided", "VATIN", "is", "valid", ".", "This", "method", "handles", "VATINs", "for", "all", "countries", ".", "This", "check", "uses", "only", "the", "checksum", "algorithm", "and", "does", "not", "call", "any", "webservice", "etc", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/vat/VATINSyntaxChecker.java#L105-L118
EsotericSoftware/jsonbeans
src/com/esotericsoftware/jsonbeans/Json.java
Json.setElementType
public void setElementType (Class type, String fieldName, Class elementType) { """ Sets the type of elements in a collection. When the element type is known, the class for each element in the collection does not need to be written unless different from the element type. """ ObjectMap<String, FieldMetadata> fields = getFields(type); FieldMetadata metadata = fields.get(fieldName); if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")"); metadata.elementType = elementType; }
java
public void setElementType (Class type, String fieldName, Class elementType) { ObjectMap<String, FieldMetadata> fields = getFields(type); FieldMetadata metadata = fields.get(fieldName); if (metadata == null) throw new JsonException("Field not found: " + fieldName + " (" + type.getName() + ")"); metadata.elementType = elementType; }
[ "public", "void", "setElementType", "(", "Class", "type", ",", "String", "fieldName", ",", "Class", "elementType", ")", "{", "ObjectMap", "<", "String", ",", "FieldMetadata", ">", "fields", "=", "getFields", "(", "type", ")", ";", "FieldMetadata", "metadata", "=", "fields", ".", "get", "(", "fieldName", ")", ";", "if", "(", "metadata", "==", "null", ")", "throw", "new", "JsonException", "(", "\"Field not found: \"", "+", "fieldName", "+", "\" (\"", "+", "type", ".", "getName", "(", ")", "+", "\")\"", ")", ";", "metadata", ".", "elementType", "=", "elementType", ";", "}" ]
Sets the type of elements in a collection. When the element type is known, the class for each element in the collection does not need to be written unless different from the element type.
[ "Sets", "the", "type", "of", "elements", "in", "a", "collection", ".", "When", "the", "element", "type", "is", "known", "the", "class", "for", "each", "element", "in", "the", "collection", "does", "not", "need", "to", "be", "written", "unless", "different", "from", "the", "element", "type", "." ]
train
https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L141-L146
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.getSQLFromField
public int getSQLFromField(PreparedStatement statement, int iType, int iParamColumn, int iAreaDesc, boolean bAddOnlyMods, boolean bIncludeTempFields) throws SQLException { """ Move the physical binary data to this SQL parameter row. This is overidden to move the physical data type. @param statement The SQL prepared statement. @param iParamColumn Starting param column @param iAreaDesc The key field area to get the values from. @param bAddOnlyMods Add only modified fields? @return Next param column. @exception SQLException From SQL calls. """ boolean bForceUniqueKey = false; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, bIncludeTempFields); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField fieldParam = keyField.getField(iAreaDesc); if (bAddOnlyMods) if (!fieldParam.isModified()) continue; // Skip this one fieldParam.getSQLFromField(statement, iType, iParamColumn++); } return iParamColumn; }
java
public int getSQLFromField(PreparedStatement statement, int iType, int iParamColumn, int iAreaDesc, boolean bAddOnlyMods, boolean bIncludeTempFields) throws SQLException { boolean bForceUniqueKey = false; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, bIncludeTempFields); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField fieldParam = keyField.getField(iAreaDesc); if (bAddOnlyMods) if (!fieldParam.isModified()) continue; // Skip this one fieldParam.getSQLFromField(statement, iType, iParamColumn++); } return iParamColumn; }
[ "public", "int", "getSQLFromField", "(", "PreparedStatement", "statement", ",", "int", "iType", ",", "int", "iParamColumn", ",", "int", "iAreaDesc", ",", "boolean", "bAddOnlyMods", ",", "boolean", "bIncludeTempFields", ")", "throws", "SQLException", "{", "boolean", "bForceUniqueKey", "=", "false", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "bIncludeTempFields", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "BaseField", "fieldParam", "=", "keyField", ".", "getField", "(", "iAreaDesc", ")", ";", "if", "(", "bAddOnlyMods", ")", "if", "(", "!", "fieldParam", ".", "isModified", "(", ")", ")", "continue", ";", "// Skip this one", "fieldParam", ".", "getSQLFromField", "(", "statement", ",", "iType", ",", "iParamColumn", "++", ")", ";", "}", "return", "iParamColumn", ";", "}" ]
Move the physical binary data to this SQL parameter row. This is overidden to move the physical data type. @param statement The SQL prepared statement. @param iParamColumn Starting param column @param iAreaDesc The key field area to get the values from. @param bAddOnlyMods Add only modified fields? @return Next param column. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", ".", "This", "is", "overidden", "to", "move", "the", "physical", "data", "type", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L354-L367
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.getOptionallyThrottledFileSystem
public static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state) throws IOException { """ Calls {@link #getOptionallyThrottledFileSystem(FileSystem, int)} parsing the qps from the input {@link State} at key {@link #MAX_FILESYSTEM_QPS}. @throws IOException """ DeprecationUtils.renameDeprecatedKeys(state, MAX_FILESYSTEM_QPS, DEPRECATED_KEYS); if (state.contains(MAX_FILESYSTEM_QPS)) { return getOptionallyThrottledFileSystem(fs, state.getPropAsInt(MAX_FILESYSTEM_QPS)); } return fs; }
java
public static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state) throws IOException { DeprecationUtils.renameDeprecatedKeys(state, MAX_FILESYSTEM_QPS, DEPRECATED_KEYS); if (state.contains(MAX_FILESYSTEM_QPS)) { return getOptionallyThrottledFileSystem(fs, state.getPropAsInt(MAX_FILESYSTEM_QPS)); } return fs; }
[ "public", "static", "FileSystem", "getOptionallyThrottledFileSystem", "(", "FileSystem", "fs", ",", "State", "state", ")", "throws", "IOException", "{", "DeprecationUtils", ".", "renameDeprecatedKeys", "(", "state", ",", "MAX_FILESYSTEM_QPS", ",", "DEPRECATED_KEYS", ")", ";", "if", "(", "state", ".", "contains", "(", "MAX_FILESYSTEM_QPS", ")", ")", "{", "return", "getOptionallyThrottledFileSystem", "(", "fs", ",", "state", ".", "getPropAsInt", "(", "MAX_FILESYSTEM_QPS", ")", ")", ";", "}", "return", "fs", ";", "}" ]
Calls {@link #getOptionallyThrottledFileSystem(FileSystem, int)} parsing the qps from the input {@link State} at key {@link #MAX_FILESYSTEM_QPS}. @throws IOException
[ "Calls", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L544-L551
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java
ColorConverter.parseHtml
protected Color parseHtml(String value) { """ Parsers a String in the form "#xxxxxx" into an SWT RGB class. @param value the color as String @return RGB """ if (value.length() != 7) { throw new ConversionException(USAGE); } int colorValue = 0; try { colorValue = Integer.parseInt(value.substring(1), 16); return new Color(colorValue); } catch (NumberFormatException ex) { throw new ConversionException(value + "is not a valid Html color", ex); } }
java
protected Color parseHtml(String value) { if (value.length() != 7) { throw new ConversionException(USAGE); } int colorValue = 0; try { colorValue = Integer.parseInt(value.substring(1), 16); return new Color(colorValue); } catch (NumberFormatException ex) { throw new ConversionException(value + "is not a valid Html color", ex); } }
[ "protected", "Color", "parseHtml", "(", "String", "value", ")", "{", "if", "(", "value", ".", "length", "(", ")", "!=", "7", ")", "{", "throw", "new", "ConversionException", "(", "USAGE", ")", ";", "}", "int", "colorValue", "=", "0", ";", "try", "{", "colorValue", "=", "Integer", ".", "parseInt", "(", "value", ".", "substring", "(", "1", ")", ",", "16", ")", ";", "return", "new", "Color", "(", "colorValue", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "throw", "new", "ConversionException", "(", "value", "+", "\"is not a valid Html color\"", ",", "ex", ")", ";", "}", "}" ]
Parsers a String in the form "#xxxxxx" into an SWT RGB class. @param value the color as String @return RGB
[ "Parsers", "a", "String", "in", "the", "form", "#xxxxxx", "into", "an", "SWT", "RGB", "class", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java#L105-L118
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java
ImagePipeline.prefetchToDiskCache
public DataSource<Void> prefetchToDiskCache( ImageRequest imageRequest, Object callerContext) { """ Submits a request for prefetching to the disk cache with a default priority. <p> Beware that if your network fetcher doesn't support priorities prefetch requests may slow down images which are immediately required on screen. @param imageRequest the request to submit @return a DataSource that can safely be ignored. """ return prefetchToDiskCache(imageRequest, callerContext, Priority.MEDIUM); }
java
public DataSource<Void> prefetchToDiskCache( ImageRequest imageRequest, Object callerContext) { return prefetchToDiskCache(imageRequest, callerContext, Priority.MEDIUM); }
[ "public", "DataSource", "<", "Void", ">", "prefetchToDiskCache", "(", "ImageRequest", "imageRequest", ",", "Object", "callerContext", ")", "{", "return", "prefetchToDiskCache", "(", "imageRequest", ",", "callerContext", ",", "Priority", ".", "MEDIUM", ")", ";", "}" ]
Submits a request for prefetching to the disk cache with a default priority. <p> Beware that if your network fetcher doesn't support priorities prefetch requests may slow down images which are immediately required on screen. @param imageRequest the request to submit @return a DataSource that can safely be ignored.
[ "Submits", "a", "request", "for", "prefetching", "to", "the", "disk", "cache", "with", "a", "default", "priority", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L387-L391
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.forAllColumns
public void forAllColumns(String template, Properties attributes) throws XDocletException { """ Processes the template for all column definitions of the current table. @param template The template @param attributes The attributes of the tag @exception XDocletException if an error occurs @doc.tag type="block" """ for (Iterator it = _curTableDef.getColumns(); it.hasNext(); ) { _curColumnDef = (ColumnDef)it.next(); generate(template); } _curColumnDef = null; }
java
public void forAllColumns(String template, Properties attributes) throws XDocletException { for (Iterator it = _curTableDef.getColumns(); it.hasNext(); ) { _curColumnDef = (ColumnDef)it.next(); generate(template); } _curColumnDef = null; }
[ "public", "void", "forAllColumns", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "for", "(", "Iterator", "it", "=", "_curTableDef", ".", "getColumns", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "_curColumnDef", "=", "(", "ColumnDef", ")", "it", ".", "next", "(", ")", ";", "generate", "(", "template", ")", ";", "}", "_curColumnDef", "=", "null", ";", "}" ]
Processes the template for all column definitions of the current table. @param template The template @param attributes The attributes of the tag @exception XDocletException if an error occurs @doc.tag type="block"
[ "Processes", "the", "template", "for", "all", "column", "definitions", "of", "the", "current", "table", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1344-L1352
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java
AbstractHeaderFile.checkRegions
protected long checkRegions(long offset, int length) throws IOException { """ checks if the accessed region is accessible @param offset the byte-offset where to start @param length the length of the region to access @return the offset, if the region is accessible @throws IOException """ if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
java
protected long checkRegions(long offset, int length) throws IOException { if (offset + length > filledUpTo) throw new IOException("Can't access memory outside the file size (" + filledUpTo + " bytes). You've requested portion " + offset + "-" + (offset + length) + " bytes. File: " + osFile.getAbsolutePath() + "\n" + "actual Filesize: " + size + "\n" + "actual filledUpTo: " + filledUpTo); return offset; }
[ "protected", "long", "checkRegions", "(", "long", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "offset", "+", "length", ">", "filledUpTo", ")", "throw", "new", "IOException", "(", "\"Can't access memory outside the file size (\"", "+", "filledUpTo", "+", "\" bytes). You've requested portion \"", "+", "offset", "+", "\"-\"", "+", "(", "offset", "+", "length", ")", "+", "\" bytes. File: \"", "+", "osFile", ".", "getAbsolutePath", "(", ")", "+", "\"\\n\"", "+", "\"actual Filesize: \"", "+", "size", "+", "\"\\n\"", "+", "\"actual filledUpTo: \"", "+", "filledUpTo", ")", ";", "return", "offset", ";", "}" ]
checks if the accessed region is accessible @param offset the byte-offset where to start @param length the length of the region to access @return the offset, if the region is accessible @throws IOException
[ "checks", "if", "the", "accessed", "region", "is", "accessible" ]
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L314-L321
jbundle/jbundle
thin/opt/chat/src/main/java/org/jbundle/thin/opt/chat/ChatScreen.java
ChatScreen.init
public void init(Object parent, Object obj) { """ Chat Screen Constructor. @param parent Typically, you pass the BaseApplet as the parent. @param @record and the record or GridTableModel as the parent. """ super.init(parent, obj); BaseApplet baseApplet = (BaseApplet)parent; this.addSubPanels(this); MessageManager messageManager = baseApplet.getApplication().getMessageManager(); BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(CHAT_TYPE, MessageConstants.INTRANET_QUEUE).getMessageReceiver(); new BaseMessageListener(receiver) // Listener automatically added to receiver { public int handleMessage(BaseMessage message) { String strMessage = (String)message.get(MESSAGE_PARAM); addText(strMessage); return Constants.NORMAL_RETURN; } }; }
java
public void init(Object parent, Object obj) { super.init(parent, obj); BaseApplet baseApplet = (BaseApplet)parent; this.addSubPanels(this); MessageManager messageManager = baseApplet.getApplication().getMessageManager(); BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(CHAT_TYPE, MessageConstants.INTRANET_QUEUE).getMessageReceiver(); new BaseMessageListener(receiver) // Listener automatically added to receiver { public int handleMessage(BaseMessage message) { String strMessage = (String)message.get(MESSAGE_PARAM); addText(strMessage); return Constants.NORMAL_RETURN; } }; }
[ "public", "void", "init", "(", "Object", "parent", ",", "Object", "obj", ")", "{", "super", ".", "init", "(", "parent", ",", "obj", ")", ";", "BaseApplet", "baseApplet", "=", "(", "BaseApplet", ")", "parent", ";", "this", ".", "addSubPanels", "(", "this", ")", ";", "MessageManager", "messageManager", "=", "baseApplet", ".", "getApplication", "(", ")", ".", "getMessageManager", "(", ")", ";", "BaseMessageReceiver", "receiver", "=", "(", "BaseMessageReceiver", ")", "messageManager", ".", "getMessageQueue", "(", "CHAT_TYPE", ",", "MessageConstants", ".", "INTRANET_QUEUE", ")", ".", "getMessageReceiver", "(", ")", ";", "new", "BaseMessageListener", "(", "receiver", ")", "// Listener automatically added to receiver", "{", "public", "int", "handleMessage", "(", "BaseMessage", "message", ")", "{", "String", "strMessage", "=", "(", "String", ")", "message", ".", "get", "(", "MESSAGE_PARAM", ")", ";", "addText", "(", "strMessage", ")", ";", "return", "Constants", ".", "NORMAL_RETURN", ";", "}", "}", ";", "}" ]
Chat Screen Constructor. @param parent Typically, you pass the BaseApplet as the parent. @param @record and the record or GridTableModel as the parent.
[ "Chat", "Screen", "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/chat/src/main/java/org/jbundle/thin/opt/chat/ChatScreen.java#L92-L111
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java
InstanceGroupClient.insertInstanceGroup
@BetaApi public final Operation insertInstanceGroup(String zone, InstanceGroup instanceGroupResource) { """ Creates an instance group in the specified project using the parameters that are included in the request. <p>Sample code: <pre><code> try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build(); Operation response = instanceGroupClient.insertInstanceGroup(zone.toString(), instanceGroupResource); } </code></pre> @param zone The name of the zone where you want to create the instance group. @param instanceGroupResource InstanceGroups (== resource_for beta.instanceGroups ==) (== resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== resource_for v1.regionInstanceGroups ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails """ InsertInstanceGroupHttpRequest request = InsertInstanceGroupHttpRequest.newBuilder() .setZone(zone) .setInstanceGroupResource(instanceGroupResource) .build(); return insertInstanceGroup(request); }
java
@BetaApi public final Operation insertInstanceGroup(String zone, InstanceGroup instanceGroupResource) { InsertInstanceGroupHttpRequest request = InsertInstanceGroupHttpRequest.newBuilder() .setZone(zone) .setInstanceGroupResource(instanceGroupResource) .build(); return insertInstanceGroup(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertInstanceGroup", "(", "String", "zone", ",", "InstanceGroup", "instanceGroupResource", ")", "{", "InsertInstanceGroupHttpRequest", "request", "=", "InsertInstanceGroupHttpRequest", ".", "newBuilder", "(", ")", ".", "setZone", "(", "zone", ")", ".", "setInstanceGroupResource", "(", "instanceGroupResource", ")", ".", "build", "(", ")", ";", "return", "insertInstanceGroup", "(", "request", ")", ";", "}" ]
Creates an instance group in the specified project using the parameters that are included in the request. <p>Sample code: <pre><code> try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build(); Operation response = instanceGroupClient.insertInstanceGroup(zone.toString(), instanceGroupResource); } </code></pre> @param zone The name of the zone where you want to create the instance group. @param instanceGroupResource InstanceGroups (== resource_for beta.instanceGroups ==) (== resource_for v1.instanceGroups ==) (== resource_for beta.regionInstanceGroups ==) (== resource_for v1.regionInstanceGroups ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "instance", "group", "in", "the", "specified", "project", "using", "the", "parameters", "that", "are", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupClient.java#L678-L687
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/stylers/SimpleColumns.java
SimpleColumns.prepareColumns
protected ColumnText prepareColumns() throws VectorPrintException { """ calls {@link #getPreparedCanvas() } to create a new {@link ColumnText#ColumnText(com.itextpdf.text.pdf.PdfContentByte) } and calculates column Rectangles based on parameters. @return @throws VectorPrintException """ ct = new ColumnText(getPreparedCanvas()); float width = getRight() - getLeft(); float colWidth = (width - (getNumColumns() - 1) * getSpacing()) / getNumColumns(); for (int i = 0; i < getNumColumns(); i++) { float left = (i == 0) ? getLeft() : getLeft() + colWidth * i + getSpacing() * i; float right = (i == 0) ? getLeft() + colWidth : getLeft() + colWidth * i + getSpacing() * i + colWidth; int shift = i * 4; columns.add(new Rectangle(left, getValue(BOTTOM, Float.class), right, getValue(TOP, Float.class))); } return ct; }
java
protected ColumnText prepareColumns() throws VectorPrintException { ct = new ColumnText(getPreparedCanvas()); float width = getRight() - getLeft(); float colWidth = (width - (getNumColumns() - 1) * getSpacing()) / getNumColumns(); for (int i = 0; i < getNumColumns(); i++) { float left = (i == 0) ? getLeft() : getLeft() + colWidth * i + getSpacing() * i; float right = (i == 0) ? getLeft() + colWidth : getLeft() + colWidth * i + getSpacing() * i + colWidth; int shift = i * 4; columns.add(new Rectangle(left, getValue(BOTTOM, Float.class), right, getValue(TOP, Float.class))); } return ct; }
[ "protected", "ColumnText", "prepareColumns", "(", ")", "throws", "VectorPrintException", "{", "ct", "=", "new", "ColumnText", "(", "getPreparedCanvas", "(", ")", ")", ";", "float", "width", "=", "getRight", "(", ")", "-", "getLeft", "(", ")", ";", "float", "colWidth", "=", "(", "width", "-", "(", "getNumColumns", "(", ")", "-", "1", ")", "*", "getSpacing", "(", ")", ")", "/", "getNumColumns", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getNumColumns", "(", ")", ";", "i", "++", ")", "{", "float", "left", "=", "(", "i", "==", "0", ")", "?", "getLeft", "(", ")", ":", "getLeft", "(", ")", "+", "colWidth", "*", "i", "+", "getSpacing", "(", ")", "*", "i", ";", "float", "right", "=", "(", "i", "==", "0", ")", "?", "getLeft", "(", ")", "+", "colWidth", ":", "getLeft", "(", ")", "+", "colWidth", "*", "i", "+", "getSpacing", "(", ")", "*", "i", "+", "colWidth", ";", "int", "shift", "=", "i", "*", "4", ";", "columns", ".", "add", "(", "new", "Rectangle", "(", "left", ",", "getValue", "(", "BOTTOM", ",", "Float", ".", "class", ")", ",", "right", ",", "getValue", "(", "TOP", ",", "Float", ".", "class", ")", ")", ")", ";", "}", "return", "ct", ";", "}" ]
calls {@link #getPreparedCanvas() } to create a new {@link ColumnText#ColumnText(com.itextpdf.text.pdf.PdfContentByte) } and calculates column Rectangles based on parameters. @return @throws VectorPrintException
[ "calls", "{", "@link", "#getPreparedCanvas", "()", "}", "to", "create", "a", "new", "{", "@link", "ColumnText#ColumnText", "(", "com", ".", "itextpdf", ".", "text", ".", "pdf", ".", "PdfContentByte", ")", "}", "and", "calculates", "column", "Rectangles", "based", "on", "parameters", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/SimpleColumns.java#L128-L139
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.computeGregorianMonthStart
protected int computeGregorianMonthStart(int year, int month) { """ Compute the Julian day of a month of the Gregorian calendar. Subclasses may call this method to perform a Gregorian calendar fields-&gt;millis computation. To perform a Gregorian calendar millis-&gt;fields computation, call computeGregorianFields(). @param year extended Gregorian year @param month zero-based Gregorian month @return the Julian day number of the day before the first day of the given month in the given extended year @see #computeGregorianFields """ // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { int[] rem = new int[1]; year += floorDivide(month, 12, rem); month = rem[0]; } boolean isLeap = (year%4 == 0) && ((year%100 != 0) || (year%400 == 0)); int y = year - 1; // This computation is actually ... + (JAN_1_1_JULIAN_DAY - 3) + 2. // Add 2 because Gregorian calendar starts 2 days after Julian // calendar. int julianDay = 365*y + floorDivide(y, 4) - floorDivide(y, 100) + floorDivide(y, 400) + JAN_1_1_JULIAN_DAY - 1; // At this point julianDay indicates the day BEFORE the first day // of January 1, <eyear> of the Gregorian calendar. if (month != 0) { julianDay += GREGORIAN_MONTH_COUNT[month][isLeap?3:2]; } return julianDay; }
java
protected int computeGregorianMonthStart(int year, int month) { // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { int[] rem = new int[1]; year += floorDivide(month, 12, rem); month = rem[0]; } boolean isLeap = (year%4 == 0) && ((year%100 != 0) || (year%400 == 0)); int y = year - 1; // This computation is actually ... + (JAN_1_1_JULIAN_DAY - 3) + 2. // Add 2 because Gregorian calendar starts 2 days after Julian // calendar. int julianDay = 365*y + floorDivide(y, 4) - floorDivide(y, 100) + floorDivide(y, 400) + JAN_1_1_JULIAN_DAY - 1; // At this point julianDay indicates the day BEFORE the first day // of January 1, <eyear> of the Gregorian calendar. if (month != 0) { julianDay += GREGORIAN_MONTH_COUNT[month][isLeap?3:2]; } return julianDay; }
[ "protected", "int", "computeGregorianMonthStart", "(", "int", "year", ",", "int", "month", ")", "{", "// If the month is out of range, adjust it into range, and", "// modify the extended year value accordingly.", "if", "(", "month", "<", "0", "||", "month", ">", "11", ")", "{", "int", "[", "]", "rem", "=", "new", "int", "[", "1", "]", ";", "year", "+=", "floorDivide", "(", "month", ",", "12", ",", "rem", ")", ";", "month", "=", "rem", "[", "0", "]", ";", "}", "boolean", "isLeap", "=", "(", "year", "%", "4", "==", "0", ")", "&&", "(", "(", "year", "%", "100", "!=", "0", ")", "||", "(", "year", "%", "400", "==", "0", ")", ")", ";", "int", "y", "=", "year", "-", "1", ";", "// This computation is actually ... + (JAN_1_1_JULIAN_DAY - 3) + 2.", "// Add 2 because Gregorian calendar starts 2 days after Julian", "// calendar.", "int", "julianDay", "=", "365", "*", "y", "+", "floorDivide", "(", "y", ",", "4", ")", "-", "floorDivide", "(", "y", ",", "100", ")", "+", "floorDivide", "(", "y", ",", "400", ")", "+", "JAN_1_1_JULIAN_DAY", "-", "1", ";", "// At this point julianDay indicates the day BEFORE the first day", "// of January 1, <eyear> of the Gregorian calendar.", "if", "(", "month", "!=", "0", ")", "{", "julianDay", "+=", "GREGORIAN_MONTH_COUNT", "[", "month", "]", "[", "isLeap", "?", "3", ":", "2", "]", ";", "}", "return", "julianDay", ";", "}" ]
Compute the Julian day of a month of the Gregorian calendar. Subclasses may call this method to perform a Gregorian calendar fields-&gt;millis computation. To perform a Gregorian calendar millis-&gt;fields computation, call computeGregorianFields(). @param year extended Gregorian year @param month zero-based Gregorian month @return the Julian day number of the day before the first day of the given month in the given extended year @see #computeGregorianFields
[ "Compute", "the", "Julian", "day", "of", "a", "month", "of", "the", "Gregorian", "calendar", ".", "Subclasses", "may", "call", "this", "method", "to", "perform", "a", "Gregorian", "calendar", "fields", "-", "&gt", ";", "millis", "computation", ".", "To", "perform", "a", "Gregorian", "calendar", "millis", "-", "&gt", ";", "fields", "computation", "call", "computeGregorianFields", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5837-L5862
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java
AbstractIndentationTokenSource.doSplitTokenImpl
protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { """ The token was previously determined as potentially to-be-splitted thus we emit additional indentation or dedenting tokens. """ String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { // no change of indentation level detected simply process the token result.accept(token); } else if (indentation > currentIndentation) { // indentation level increased splitIntoBeginToken(token, indentation, result); } else if (indentation < currentIndentation) { // indentation level decreased int charCount = computeIndentationRelevantCharCount(text); if (charCount > 0) { // emit whitespace including newline splitWithText(token, text.substring(0, charCount), result); } // emit end tokens at the beginning of the line decreaseIndentation(indentation, result); if (charCount != text.length()) { handleRemainingText(token, text.substring(charCount), indentation, result); } } else { throw new IllegalStateException(String.valueOf(indentation)); } }
java
protected void doSplitTokenImpl(Token token, ITokenAcceptor result) { String text = token.getText(); int indentation = computeIndentation(text); if (indentation == -1 || indentation == currentIndentation) { // no change of indentation level detected simply process the token result.accept(token); } else if (indentation > currentIndentation) { // indentation level increased splitIntoBeginToken(token, indentation, result); } else if (indentation < currentIndentation) { // indentation level decreased int charCount = computeIndentationRelevantCharCount(text); if (charCount > 0) { // emit whitespace including newline splitWithText(token, text.substring(0, charCount), result); } // emit end tokens at the beginning of the line decreaseIndentation(indentation, result); if (charCount != text.length()) { handleRemainingText(token, text.substring(charCount), indentation, result); } } else { throw new IllegalStateException(String.valueOf(indentation)); } }
[ "protected", "void", "doSplitTokenImpl", "(", "Token", "token", ",", "ITokenAcceptor", "result", ")", "{", "String", "text", "=", "token", ".", "getText", "(", ")", ";", "int", "indentation", "=", "computeIndentation", "(", "text", ")", ";", "if", "(", "indentation", "==", "-", "1", "||", "indentation", "==", "currentIndentation", ")", "{", "// no change of indentation level detected simply process the token", "result", ".", "accept", "(", "token", ")", ";", "}", "else", "if", "(", "indentation", ">", "currentIndentation", ")", "{", "// indentation level increased", "splitIntoBeginToken", "(", "token", ",", "indentation", ",", "result", ")", ";", "}", "else", "if", "(", "indentation", "<", "currentIndentation", ")", "{", "// indentation level decreased", "int", "charCount", "=", "computeIndentationRelevantCharCount", "(", "text", ")", ";", "if", "(", "charCount", ">", "0", ")", "{", "// emit whitespace including newline", "splitWithText", "(", "token", ",", "text", ".", "substring", "(", "0", ",", "charCount", ")", ",", "result", ")", ";", "}", "// emit end tokens at the beginning of the line", "decreaseIndentation", "(", "indentation", ",", "result", ")", ";", "if", "(", "charCount", "!=", "text", ".", "length", "(", ")", ")", "{", "handleRemainingText", "(", "token", ",", "text", ".", "substring", "(", "charCount", ")", ",", "indentation", ",", "result", ")", ";", "}", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "valueOf", "(", "indentation", ")", ")", ";", "}", "}" ]
The token was previously determined as potentially to-be-splitted thus we emit additional indentation or dedenting tokens.
[ "The", "token", "was", "previously", "determined", "as", "potentially", "to", "-", "be", "-", "splitted", "thus", "we", "emit", "additional", "indentation", "or", "dedenting", "tokens", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/parser/antlr/AbstractIndentationTokenSource.java#L97-L121
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_orderId_debt_pay_POST
public OvhOrder order_orderId_debt_pay_POST(Long orderId) throws IOException { """ Create an order in order to pay this order's debt REST: POST /me/order/{orderId}/debt/pay @param orderId [required] """ String qPath = "/me/order/{orderId}/debt/pay"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder order_orderId_debt_pay_POST(Long orderId) throws IOException { String qPath = "/me/order/{orderId}/debt/pay"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "order_orderId_debt_pay_POST", "(", "Long", "orderId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order/{orderId}/debt/pay\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "orderId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Create an order in order to pay this order's debt REST: POST /me/order/{orderId}/debt/pay @param orderId [required]
[ "Create", "an", "order", "in", "order", "to", "pay", "this", "order", "s", "debt" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2041-L2046
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java
PluginManager.callFunction
public void callFunction(String className, String methodName, PluginArguments pluginArgs, Object... args) throws Exception { """ Calls the specified function with the specified arguments. This is used for v2 response overrides @param className name of class @param methodName name of method @param pluginArgs plugin arguments @param args arguments to supply to function @throws Exception exception """ Class<?> cls = getClass(className); ArrayList<Object> newArgs = new ArrayList<>(); newArgs.add(pluginArgs); com.groupon.odo.proxylib.models.Method m = preparePluginMethod(newArgs, className, methodName, args); m.getMethod().invoke(cls, newArgs.toArray(new Object[0])); }
java
public void callFunction(String className, String methodName, PluginArguments pluginArgs, Object... args) throws Exception { Class<?> cls = getClass(className); ArrayList<Object> newArgs = new ArrayList<>(); newArgs.add(pluginArgs); com.groupon.odo.proxylib.models.Method m = preparePluginMethod(newArgs, className, methodName, args); m.getMethod().invoke(cls, newArgs.toArray(new Object[0])); }
[ "public", "void", "callFunction", "(", "String", "className", ",", "String", "methodName", ",", "PluginArguments", "pluginArgs", ",", "Object", "...", "args", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "cls", "=", "getClass", "(", "className", ")", ";", "ArrayList", "<", "Object", ">", "newArgs", "=", "new", "ArrayList", "<>", "(", ")", ";", "newArgs", ".", "add", "(", "pluginArgs", ")", ";", "com", ".", "groupon", ".", "odo", ".", "proxylib", ".", "models", ".", "Method", "m", "=", "preparePluginMethod", "(", "newArgs", ",", "className", ",", "methodName", ",", "args", ")", ";", "m", ".", "getMethod", "(", ")", ".", "invoke", "(", "cls", ",", "newArgs", ".", "toArray", "(", "new", "Object", "[", "0", "]", ")", ")", ";", "}" ]
Calls the specified function with the specified arguments. This is used for v2 response overrides @param className name of class @param methodName name of method @param pluginArgs plugin arguments @param args arguments to supply to function @throws Exception exception
[ "Calls", "the", "specified", "function", "with", "the", "specified", "arguments", ".", "This", "is", "used", "for", "v2", "response", "overrides" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java#L259-L267
stevespringett/Alpine
alpine/src/main/java/alpine/resources/Pagination.java
Pagination.parseIntegerFromParam
private Integer parseIntegerFromParam(final String value, final int defaultValue) { """ Parses a parameter to an Integer, defaulting to 0 upon any errors encountered. @param value the value to parse @param defaultValue the default value to use @return an Integer """ try { return Integer.valueOf(value); } catch (NumberFormatException | NullPointerException e) { return defaultValue; } }
java
private Integer parseIntegerFromParam(final String value, final int defaultValue) { try { return Integer.valueOf(value); } catch (NumberFormatException | NullPointerException e) { return defaultValue; } }
[ "private", "Integer", "parseIntegerFromParam", "(", "final", "String", "value", ",", "final", "int", "defaultValue", ")", "{", "try", "{", "return", "Integer", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "|", "NullPointerException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Parses a parameter to an Integer, defaulting to 0 upon any errors encountered. @param value the value to parse @param defaultValue the default value to use @return an Integer
[ "Parses", "a", "parameter", "to", "an", "Integer", "defaulting", "to", "0", "upon", "any", "errors", "encountered", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/Pagination.java#L121-L127
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.getMirage
public Mirage getMirage (String rsrcPath) { """ Creates a mirage which is an image optimized for display on our current display device and which will be stored into video memory if possible. """ return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null); }
java
public Mirage getMirage (String rsrcPath) { return getMirage(getImageKey(_defaultProvider, rsrcPath), null, null); }
[ "public", "Mirage", "getMirage", "(", "String", "rsrcPath", ")", "{", "return", "getMirage", "(", "getImageKey", "(", "_defaultProvider", ",", "rsrcPath", ")", ",", "null", ",", "null", ")", ";", "}" ]
Creates a mirage which is an image optimized for display on our current display device and which will be stored into video memory if possible.
[ "Creates", "a", "mirage", "which", "is", "an", "image", "optimized", "for", "display", "on", "our", "current", "display", "device", "and", "which", "will", "be", "stored", "into", "video", "memory", "if", "possible", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L320-L323
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.deleteSSHKey
public void deleteSSHKey(Integer targetUserId, Integer targetKeyId) throws IOException { """ Delete user's ssh key @param targetUserId The id of the Gitlab user @param targetKeyId The id of the Gitlab ssh key @throws IOException on gitlab api call error """ String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + "/" + targetKeyId; retrieve().method(DELETE).to(tailUrl, Void.class); }
java
public void deleteSSHKey(Integer targetUserId, Integer targetKeyId) throws IOException { String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + "/" + targetKeyId; retrieve().method(DELETE).to(tailUrl, Void.class); }
[ "public", "void", "deleteSSHKey", "(", "Integer", "targetUserId", ",", "Integer", "targetKeyId", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabUser", ".", "USERS_URL", "+", "\"/\"", "+", "targetUserId", "+", "GitlabSSHKey", ".", "KEYS_URL", "+", "\"/\"", "+", "targetKeyId", ";", "retrieve", "(", ")", ".", "method", "(", "DELETE", ")", ".", "to", "(", "tailUrl", ",", "Void", ".", "class", ")", ";", "}" ]
Delete user's ssh key @param targetUserId The id of the Gitlab user @param targetKeyId The id of the Gitlab ssh key @throws IOException on gitlab api call error
[ "Delete", "user", "s", "ssh", "key" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L422-L425
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.containsUnpackedBootstrap
public static boolean containsUnpackedBootstrap(File directory) { """ Replies if the given directory contains a SRE bootstrap. <p>The SRE bootstrap detection is based on the service definition within META-INF folder. @param directory the directory. @return <code>true</code> if the given directory contains a SRE. Otherwise <code>false</code>.= @since 0.7 @see #containsPackedBootstrap(File) """ final String[] elements = SREConstants.SERVICE_SRE_BOOTSTRAP.split("/"); //$NON-NLS-1$ File serviceFile = directory; for (final String element : elements) { serviceFile = new File(serviceFile, element); } if (serviceFile.isFile() && serviceFile.canRead()) { try (InputStream is = new FileInputStream(serviceFile)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String line = reader.readLine(); if (line != null) { line = line.trim(); if (!line.isEmpty()) { return true; } } } } catch (Throwable exception) { // } } return false; }
java
public static boolean containsUnpackedBootstrap(File directory) { final String[] elements = SREConstants.SERVICE_SRE_BOOTSTRAP.split("/"); //$NON-NLS-1$ File serviceFile = directory; for (final String element : elements) { serviceFile = new File(serviceFile, element); } if (serviceFile.isFile() && serviceFile.canRead()) { try (InputStream is = new FileInputStream(serviceFile)) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { String line = reader.readLine(); if (line != null) { line = line.trim(); if (!line.isEmpty()) { return true; } } } } catch (Throwable exception) { // } } return false; }
[ "public", "static", "boolean", "containsUnpackedBootstrap", "(", "File", "directory", ")", "{", "final", "String", "[", "]", "elements", "=", "SREConstants", ".", "SERVICE_SRE_BOOTSTRAP", ".", "split", "(", "\"/\"", ")", ";", "//$NON-NLS-1$", "File", "serviceFile", "=", "directory", ";", "for", "(", "final", "String", "element", ":", "elements", ")", "{", "serviceFile", "=", "new", "File", "(", "serviceFile", ",", "element", ")", ";", "}", "if", "(", "serviceFile", ".", "isFile", "(", ")", "&&", "serviceFile", ".", "canRead", "(", ")", ")", "{", "try", "(", "InputStream", "is", "=", "new", "FileInputStream", "(", "serviceFile", ")", ")", "{", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "is", ")", ")", ")", "{", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "if", "(", "line", "!=", "null", ")", "{", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "!", "line", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "catch", "(", "Throwable", "exception", ")", "{", "//", "}", "}", "return", "false", ";", "}" ]
Replies if the given directory contains a SRE bootstrap. <p>The SRE bootstrap detection is based on the service definition within META-INF folder. @param directory the directory. @return <code>true</code> if the given directory contains a SRE. Otherwise <code>false</code>.= @since 0.7 @see #containsPackedBootstrap(File)
[ "Replies", "if", "the", "given", "directory", "contains", "a", "SRE", "bootstrap", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L987-L1009
d-michail/jheaps
src/main/java/org/jheaps/array/BinaryArrayWeakHeap.java
BinaryArrayWeakHeap.joinWithComparator
protected boolean joinWithComparator(int i, int j) { """ Join two weak heaps into one. @param i root of the first weak heap @param j root of the second weak heap @return true if already a weak heap, false if a flip was needed """ if (comparator.compare(array[j], array[i]) < 0) { K tmp = array[i]; array[i] = array[j]; array[j] = tmp; reverse.flip(j); return false; } return true; }
java
protected boolean joinWithComparator(int i, int j) { if (comparator.compare(array[j], array[i]) < 0) { K tmp = array[i]; array[i] = array[j]; array[j] = tmp; reverse.flip(j); return false; } return true; }
[ "protected", "boolean", "joinWithComparator", "(", "int", "i", ",", "int", "j", ")", "{", "if", "(", "comparator", ".", "compare", "(", "array", "[", "j", "]", ",", "array", "[", "i", "]", ")", "<", "0", ")", "{", "K", "tmp", "=", "array", "[", "i", "]", ";", "array", "[", "i", "]", "=", "array", "[", "j", "]", ";", "array", "[", "j", "]", "=", "tmp", ";", "reverse", ".", "flip", "(", "j", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Join two weak heaps into one. @param i root of the first weak heap @param j root of the second weak heap @return true if already a weak heap, false if a flip was needed
[ "Join", "two", "weak", "heaps", "into", "one", "." ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/array/BinaryArrayWeakHeap.java#L409-L418
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java
RendererRequestUtils.isIEVersionInferiorOrEqualTo
private static boolean isIEVersionInferiorOrEqualTo(HttpServletRequest req, int ieVersion) { """ Checks if the user agent is IE and the version is equal or less than the one passed in parameter @param req the request @param the IE version to check @return true if the user agent is IE and the version is equal or less than the one passed in parameter """ boolean result = false; String agent = req.getHeader("User-Agent"); if (LOGGER.isDebugEnabled()) { LOGGER.debug("User-Agent for this request:" + agent); } if (agent != null) { Matcher matcher = IE_USER_AGENT_PATTERN.matcher(agent); if (matcher.find()) { int version = Integer.parseInt(matcher.group(1)); if (version <= ieVersion) { result = true; } } } return result; }
java
private static boolean isIEVersionInferiorOrEqualTo(HttpServletRequest req, int ieVersion) { boolean result = false; String agent = req.getHeader("User-Agent"); if (LOGGER.isDebugEnabled()) { LOGGER.debug("User-Agent for this request:" + agent); } if (agent != null) { Matcher matcher = IE_USER_AGENT_PATTERN.matcher(agent); if (matcher.find()) { int version = Integer.parseInt(matcher.group(1)); if (version <= ieVersion) { result = true; } } } return result; }
[ "private", "static", "boolean", "isIEVersionInferiorOrEqualTo", "(", "HttpServletRequest", "req", ",", "int", "ieVersion", ")", "{", "boolean", "result", "=", "false", ";", "String", "agent", "=", "req", ".", "getHeader", "(", "\"User-Agent\"", ")", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"User-Agent for this request:\"", "+", "agent", ")", ";", "}", "if", "(", "agent", "!=", "null", ")", "{", "Matcher", "matcher", "=", "IE_USER_AGENT_PATTERN", ".", "matcher", "(", "agent", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "int", "version", "=", "Integer", ".", "parseInt", "(", "matcher", ".", "group", "(", "1", ")", ")", ";", "if", "(", "version", "<=", "ieVersion", ")", "{", "result", "=", "true", ";", "}", "}", "}", "return", "result", ";", "}" ]
Checks if the user agent is IE and the version is equal or less than the one passed in parameter @param req the request @param the IE version to check @return true if the user agent is IE and the version is equal or less than the one passed in parameter
[ "Checks", "if", "the", "user", "agent", "is", "IE", "and", "the", "version", "is", "equal", "or", "less", "than", "the", "one", "passed", "in", "parameter" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java#L226-L245
real-logic/agrona
agrona/src/main/java/org/agrona/BitUtil.java
BitUtil.toHex
public static String toHex(final byte[] buffer, final int offset, final int length) { """ Generate a string that is the hex representation of a given byte array. @param buffer to convert to a hex representation. @param offset the offset into the buffer. @param length the number of bytes to convert. @return new String holding the hex representation (in Big Endian) of the passed array. """ return new String(toHexByteArray(buffer, offset, length), UTF_8); }
java
public static String toHex(final byte[] buffer, final int offset, final int length) { return new String(toHexByteArray(buffer, offset, length), UTF_8); }
[ "public", "static", "String", "toHex", "(", "final", "byte", "[", "]", "buffer", ",", "final", "int", "offset", ",", "final", "int", "length", ")", "{", "return", "new", "String", "(", "toHexByteArray", "(", "buffer", ",", "offset", ",", "length", ")", ",", "UTF_8", ")", ";", "}" ]
Generate a string that is the hex representation of a given byte array. @param buffer to convert to a hex representation. @param offset the offset into the buffer. @param length the number of bytes to convert. @return new String holding the hex representation (in Big Endian) of the passed array.
[ "Generate", "a", "string", "that", "is", "the", "hex", "representation", "of", "a", "given", "byte", "array", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/BitUtil.java#L214-L217
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java
Statistics.columnDistinctCount
public Statistics columnDistinctCount(String columnName, Long ndv) { """ Sets the number of distinct values statistic for the given column. """ this.columnStats .computeIfAbsent(columnName, column -> new HashMap<>()) .put(DISTINCT_COUNT, String.valueOf(ndv)); return this; }
java
public Statistics columnDistinctCount(String columnName, Long ndv) { this.columnStats .computeIfAbsent(columnName, column -> new HashMap<>()) .put(DISTINCT_COUNT, String.valueOf(ndv)); return this; }
[ "public", "Statistics", "columnDistinctCount", "(", "String", "columnName", ",", "Long", "ndv", ")", "{", "this", ".", "columnStats", ".", "computeIfAbsent", "(", "columnName", ",", "column", "->", "new", "HashMap", "<>", "(", ")", ")", ".", "put", "(", "DISTINCT_COUNT", ",", "String", ".", "valueOf", "(", "ndv", ")", ")", ";", "return", "this", ";", "}" ]
Sets the number of distinct values statistic for the given column.
[ "Sets", "the", "number", "of", "distinct", "values", "statistic", "for", "the", "given", "column", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L91-L96
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogUtils.java
LogUtils.newLogEvent
public static LogEvent newLogEvent(Marker marker, LogLevel level, String message, Object[] argumentArray, Throwable throwable, long timeStamp) { """ Create and return a new {@link LogEvent} instance based on the passed parameters. @param marker the log marker @param level the log level @param message the log message @param argumentArray the event arguments to insert in the message @param throwable the throwable associated to the event @param timeStamp the number of milliseconds elapsed from 1/1/1970 until logging event was created. @return the {@link LogEvent} @since 6.4M1 """ if (marker != null) { if (marker.contains(LogEvent.MARKER_BEGIN)) { return new BeginLogEvent(marker, level, message, argumentArray, throwable, timeStamp); } else if (marker.contains(LogEvent.MARKER_END)) { return new EndLogEvent(marker, level, message, argumentArray, throwable, timeStamp); } } return new LogEvent(marker, level, message, argumentArray, throwable, timeStamp); }
java
public static LogEvent newLogEvent(Marker marker, LogLevel level, String message, Object[] argumentArray, Throwable throwable, long timeStamp) { if (marker != null) { if (marker.contains(LogEvent.MARKER_BEGIN)) { return new BeginLogEvent(marker, level, message, argumentArray, throwable, timeStamp); } else if (marker.contains(LogEvent.MARKER_END)) { return new EndLogEvent(marker, level, message, argumentArray, throwable, timeStamp); } } return new LogEvent(marker, level, message, argumentArray, throwable, timeStamp); }
[ "public", "static", "LogEvent", "newLogEvent", "(", "Marker", "marker", ",", "LogLevel", "level", ",", "String", "message", ",", "Object", "[", "]", "argumentArray", ",", "Throwable", "throwable", ",", "long", "timeStamp", ")", "{", "if", "(", "marker", "!=", "null", ")", "{", "if", "(", "marker", ".", "contains", "(", "LogEvent", ".", "MARKER_BEGIN", ")", ")", "{", "return", "new", "BeginLogEvent", "(", "marker", ",", "level", ",", "message", ",", "argumentArray", ",", "throwable", ",", "timeStamp", ")", ";", "}", "else", "if", "(", "marker", ".", "contains", "(", "LogEvent", ".", "MARKER_END", ")", ")", "{", "return", "new", "EndLogEvent", "(", "marker", ",", "level", ",", "message", ",", "argumentArray", ",", "throwable", ",", "timeStamp", ")", ";", "}", "}", "return", "new", "LogEvent", "(", "marker", ",", "level", ",", "message", ",", "argumentArray", ",", "throwable", ",", "timeStamp", ")", ";", "}" ]
Create and return a new {@link LogEvent} instance based on the passed parameters. @param marker the log marker @param level the log level @param message the log message @param argumentArray the event arguments to insert in the message @param throwable the throwable associated to the event @param timeStamp the number of milliseconds elapsed from 1/1/1970 until logging event was created. @return the {@link LogEvent} @since 6.4M1
[ "Create", "and", "return", "a", "new", "{", "@link", "LogEvent", "}", "instance", "based", "on", "the", "passed", "parameters", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-logging/xwiki-commons-logging-api/src/main/java/org/xwiki/logging/LogUtils.java#L69-L81
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/GeoIntents.java
GeoIntents.newStreetViewIntent
public static Intent newStreetViewIntent(float latitude, float longitude) { """ Opens the Street View application to the given location. The URI scheme is based on the syntax used for Street View panorama information in Google Maps URLs. @param latitude Latitude @param longitude Longitude """ return newStreetViewIntent(latitude, longitude, null, null, null, null); }
java
public static Intent newStreetViewIntent(float latitude, float longitude) { return newStreetViewIntent(latitude, longitude, null, null, null, null); }
[ "public", "static", "Intent", "newStreetViewIntent", "(", "float", "latitude", ",", "float", "longitude", ")", "{", "return", "newStreetViewIntent", "(", "latitude", ",", "longitude", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Opens the Street View application to the given location. The URI scheme is based on the syntax used for Street View panorama information in Google Maps URLs. @param latitude Latitude @param longitude Longitude
[ "Opens", "the", "Street", "View", "application", "to", "the", "given", "location", ".", "The", "URI", "scheme", "is", "based", "on", "the", "syntax", "used", "for", "Street", "View", "panorama", "information", "in", "Google", "Maps", "URLs", "." ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/GeoIntents.java#L133-L135
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java
Tuple12.setFields
public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) { """ Sets new values to all fields of the tuple. @param value0 The value for field 0 @param value1 The value for field 1 @param value2 The value for field 2 @param value3 The value for field 3 @param value4 The value for field 4 @param value5 The value for field 5 @param value6 The value for field 6 @param value7 The value for field 7 @param value8 The value for field 8 @param value9 The value for field 9 @param value10 The value for field 10 @param value11 The value for field 11 """ this.f0 = value0; this.f1 = value1; this.f2 = value2; this.f3 = value3; this.f4 = value4; this.f5 = value5; this.f6 = value6; this.f7 = value7; this.f8 = value8; this.f9 = value9; this.f10 = value10; this.f11 = value11; }
java
public void setFields(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10, T11 value11) { this.f0 = value0; this.f1 = value1; this.f2 = value2; this.f3 = value3; this.f4 = value4; this.f5 = value5; this.f6 = value6; this.f7 = value7; this.f8 = value8; this.f9 = value9; this.f10 = value10; this.f11 = value11; }
[ "public", "void", "setFields", "(", "T0", "value0", ",", "T1", "value1", ",", "T2", "value2", ",", "T3", "value3", ",", "T4", "value4", ",", "T5", "value5", ",", "T6", "value6", ",", "T7", "value7", ",", "T8", "value8", ",", "T9", "value9", ",", "T10", "value10", ",", "T11", "value11", ")", "{", "this", ".", "f0", "=", "value0", ";", "this", ".", "f1", "=", "value1", ";", "this", ".", "f2", "=", "value2", ";", "this", ".", "f3", "=", "value3", ";", "this", ".", "f4", "=", "value4", ";", "this", ".", "f5", "=", "value5", ";", "this", ".", "f6", "=", "value6", ";", "this", ".", "f7", "=", "value7", ";", "this", ".", "f8", "=", "value8", ";", "this", ".", "f9", "=", "value9", ";", "this", ".", "f10", "=", "value10", ";", "this", ".", "f11", "=", "value11", ";", "}" ]
Sets new values to all fields of the tuple. @param value0 The value for field 0 @param value1 The value for field 1 @param value2 The value for field 2 @param value3 The value for field 3 @param value4 The value for field 4 @param value5 The value for field 5 @param value6 The value for field 6 @param value7 The value for field 7 @param value8 The value for field 8 @param value9 The value for field 9 @param value10 The value for field 10 @param value11 The value for field 11
[ "Sets", "new", "values", "to", "all", "fields", "of", "the", "tuple", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java#L210-L223
google/flatbuffers
java/com/google/flatbuffers/Utf8Safe.java
Utf8Safe.encodeUtf8
@Override public void encodeUtf8(CharSequence in, ByteBuffer out) { """ Encodes the given characters to the target {@link ByteBuffer} using UTF-8 encoding. <p>Selects an optimal algorithm based on the type of {@link ByteBuffer} (i.e. heap or direct) and the capabilities of the platform. @param in the source string to be encoded @param out the target buffer to receive the encoded string. """ if (out.hasArray()) { int start = out.arrayOffset(); int end = encodeUtf8Array(in, out.array(), start + out.position(), out.remaining()); out.position(end - start); } else { encodeUtf8Buffer(in, out); } }
java
@Override public void encodeUtf8(CharSequence in, ByteBuffer out) { if (out.hasArray()) { int start = out.arrayOffset(); int end = encodeUtf8Array(in, out.array(), start + out.position(), out.remaining()); out.position(end - start); } else { encodeUtf8Buffer(in, out); } }
[ "@", "Override", "public", "void", "encodeUtf8", "(", "CharSequence", "in", ",", "ByteBuffer", "out", ")", "{", "if", "(", "out", ".", "hasArray", "(", ")", ")", "{", "int", "start", "=", "out", ".", "arrayOffset", "(", ")", ";", "int", "end", "=", "encodeUtf8Array", "(", "in", ",", "out", ".", "array", "(", ")", ",", "start", "+", "out", ".", "position", "(", ")", ",", "out", ".", "remaining", "(", ")", ")", ";", "out", ".", "position", "(", "end", "-", "start", ")", ";", "}", "else", "{", "encodeUtf8Buffer", "(", "in", ",", "out", ")", ";", "}", "}" ]
Encodes the given characters to the target {@link ByteBuffer} using UTF-8 encoding. <p>Selects an optimal algorithm based on the type of {@link ByteBuffer} (i.e. heap or direct) and the capabilities of the platform. @param in the source string to be encoded @param out the target buffer to receive the encoded string.
[ "Encodes", "the", "given", "characters", "to", "the", "target", "{", "@link", "ByteBuffer", "}", "using", "UTF", "-", "8", "encoding", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Utf8Safe.java#L431-L441
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java
OpenSSLPKCS12.PEMtoP12
public static void PEMtoP12(File pem, String pemPassword, File toP12, String p12Password) throws IOException { """ @param pem the PEM file containing the keys & certificates to put in a P12 @param pemPassword The password for any encrypted keys in the PEM @param toP12 The PKCS12 file @param p12Password the password to put on the PKCS12 keystore @throws IOException if a catastrophic unexpected failure occurs during execution @throws IllegalArgumentException if the PEM keystore doesn't exist @throws IllegalStateException if openssl exits with a failure condition """ if (!pem.exists()) throw new IllegalArgumentException("pem file does not exist: " + pem.getPath()); Execed openssl = Exec.utilityAs(null, OPENSSL, "pkcs12", "-nodes", "-in", pem.getPath(), "-out", toP12.getPath(), "-export", "-passin", "pass:" + pemPassword, "-passout", "pass:" + p12Password); int returnCode = openssl.waitForExit(); if (returnCode != 0) throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" + openssl.getStandardOut()); }
java
public static void PEMtoP12(File pem, String pemPassword, File toP12, String p12Password) throws IOException { if (!pem.exists()) throw new IllegalArgumentException("pem file does not exist: " + pem.getPath()); Execed openssl = Exec.utilityAs(null, OPENSSL, "pkcs12", "-nodes", "-in", pem.getPath(), "-out", toP12.getPath(), "-export", "-passin", "pass:" + pemPassword, "-passout", "pass:" + p12Password); int returnCode = openssl.waitForExit(); if (returnCode != 0) throw new IllegalStateException("Unexpected openssl exit code " + returnCode + "; output:\n" + openssl.getStandardOut()); }
[ "public", "static", "void", "PEMtoP12", "(", "File", "pem", ",", "String", "pemPassword", ",", "File", "toP12", ",", "String", "p12Password", ")", "throws", "IOException", "{", "if", "(", "!", "pem", ".", "exists", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"pem file does not exist: \"", "+", "pem", ".", "getPath", "(", ")", ")", ";", "Execed", "openssl", "=", "Exec", ".", "utilityAs", "(", "null", ",", "OPENSSL", ",", "\"pkcs12\"", ",", "\"-nodes\"", ",", "\"-in\"", ",", "pem", ".", "getPath", "(", ")", ",", "\"-out\"", ",", "toP12", ".", "getPath", "(", ")", ",", "\"-export\"", ",", "\"-passin\"", ",", "\"pass:\"", "+", "pemPassword", ",", "\"-passout\"", ",", "\"pass:\"", "+", "p12Password", ")", ";", "int", "returnCode", "=", "openssl", ".", "waitForExit", "(", ")", ";", "if", "(", "returnCode", "!=", "0", ")", "throw", "new", "IllegalStateException", "(", "\"Unexpected openssl exit code \"", "+", "returnCode", "+", "\"; output:\\n\"", "+", "openssl", ".", "getStandardOut", "(", ")", ")", ";", "}" ]
@param pem the PEM file containing the keys & certificates to put in a P12 @param pemPassword The password for any encrypted keys in the PEM @param toP12 The PKCS12 file @param p12Password the password to put on the PKCS12 keystore @throws IOException if a catastrophic unexpected failure occurs during execution @throws IllegalArgumentException if the PEM keystore doesn't exist @throws IllegalStateException if openssl exits with a failure condition
[ "@param", "pem", "the", "PEM", "file", "containing", "the", "keys", "&", "certificates", "to", "put", "in", "a", "P12", "@param", "pemPassword", "The", "password", "for", "any", "encrypted", "keys", "in", "the", "PEM", "@param", "toP12", "The", "PKCS12", "file", "@param", "p12Password", "the", "password", "to", "put", "on", "the", "PKCS12", "keystore" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/openssl/OpenSSLPKCS12.java#L116-L139
Scout24/appmon4j
core/src/main/java/de/is24/util/monitoring/CorePlugin.java
CorePlugin.addHistorizable
public void addHistorizable(String name, Historizable historizable) { """ add a {@link de.is24.util.monitoring.Historizable} instance to the list identified by historizable.getName() @param name key of the historizbale metric @param historizable the historizable to add """ HistorizableList listToAddTo = getHistorizableList(name); listToAddTo.add(historizable); }
java
public void addHistorizable(String name, Historizable historizable) { HistorizableList listToAddTo = getHistorizableList(name); listToAddTo.add(historizable); }
[ "public", "void", "addHistorizable", "(", "String", "name", ",", "Historizable", "historizable", ")", "{", "HistorizableList", "listToAddTo", "=", "getHistorizableList", "(", "name", ")", ";", "listToAddTo", ".", "add", "(", "historizable", ")", ";", "}" ]
add a {@link de.is24.util.monitoring.Historizable} instance to the list identified by historizable.getName() @param name key of the historizbale metric @param historizable the historizable to add
[ "add", "a", "{", "@link", "de", ".", "is24", ".", "util", ".", "monitoring", ".", "Historizable", "}", "instance", "to", "the", "list", "identified", "by", "historizable", ".", "getName", "()" ]
train
https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/CorePlugin.java#L375-L378
Pkmmte/PkRSS
pkrss/src/main/java/com/pkmmte/pkrss/Article.java
Article.putExtra
public Article putExtra(String key, String value) { """ Inserts a given value into a Bundle associated with this Article instance. @param key A String key. @param value Value to insert. """ this.extras.putString(key, value); return this; }
java
public Article putExtra(String key, String value) { this.extras.putString(key, value); return this; }
[ "public", "Article", "putExtra", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "extras", ".", "putString", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a given value into a Bundle associated with this Article instance. @param key A String key. @param value Value to insert.
[ "Inserts", "a", "given", "value", "into", "a", "Bundle", "associated", "with", "this", "Article", "instance", "." ]
train
https://github.com/Pkmmte/PkRSS/blob/0bc536d3bad1dade4538616f71c3a8f068eac89a/pkrss/src/main/java/com/pkmmte/pkrss/Article.java#L118-L121
vkostyukov/la4j
src/main/java/org/la4j/matrix/dense/Basic1DMatrix.java
Basic1DMatrix.from2DArray
public static Basic1DMatrix from2DArray(double[][] array) { """ Creates a {@link Basic1DMatrix} of the given 2D {@code array} with copying the underlying array. """ int rows = array.length; int columns = array[0].length; double[] array1D = new double[rows * columns]; int offset = 0; for (int i = 0; i < rows; i++) { System.arraycopy(array[i], 0, array1D, offset, columns); offset += columns; } return new Basic1DMatrix(rows, columns, array1D); }
java
public static Basic1DMatrix from2DArray(double[][] array) { int rows = array.length; int columns = array[0].length; double[] array1D = new double[rows * columns]; int offset = 0; for (int i = 0; i < rows; i++) { System.arraycopy(array[i], 0, array1D, offset, columns); offset += columns; } return new Basic1DMatrix(rows, columns, array1D); }
[ "public", "static", "Basic1DMatrix", "from2DArray", "(", "double", "[", "]", "[", "]", "array", ")", "{", "int", "rows", "=", "array", ".", "length", ";", "int", "columns", "=", "array", "[", "0", "]", ".", "length", ";", "double", "[", "]", "array1D", "=", "new", "double", "[", "rows", "*", "columns", "]", ";", "int", "offset", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rows", ";", "i", "++", ")", "{", "System", ".", "arraycopy", "(", "array", "[", "i", "]", ",", "0", ",", "array1D", ",", "offset", ",", "columns", ")", ";", "offset", "+=", "columns", ";", "}", "return", "new", "Basic1DMatrix", "(", "rows", ",", "columns", ",", "array1D", ")", ";", "}" ]
Creates a {@link Basic1DMatrix} of the given 2D {@code array} with copying the underlying array.
[ "Creates", "a", "{" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/dense/Basic1DMatrix.java#L146-L158
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java
CellUtil.getCellValue
public static Object getCellValue(Cell cell, CellType cellType, final boolean isTrimCellValue) { """ 获取单元格值 @param cell {@link Cell}单元格 @param cellType 单元格值类型{@link CellType}枚举 @param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符 @return 值,类型可能为:Date、Double、Boolean、String """ return getCellValue(cell, cellType, isTrimCellValue ? new TrimEditor() : null); }
java
public static Object getCellValue(Cell cell, CellType cellType, final boolean isTrimCellValue) { return getCellValue(cell, cellType, isTrimCellValue ? new TrimEditor() : null); }
[ "public", "static", "Object", "getCellValue", "(", "Cell", "cell", ",", "CellType", "cellType", ",", "final", "boolean", "isTrimCellValue", ")", "{", "return", "getCellValue", "(", "cell", ",", "cellType", ",", "isTrimCellValue", "?", "new", "TrimEditor", "(", ")", ":", "null", ")", ";", "}" ]
获取单元格值 @param cell {@link Cell}单元格 @param cellType 单元格值类型{@link CellType}枚举 @param isTrimCellValue 如果单元格类型为字符串,是否去掉两边空白符 @return 值,类型可能为:Date、Double、Boolean、String
[ "获取单元格值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L65-L67
tvesalainen/util
util/src/main/java/org/vesalainen/util/CollectionHelp.java
CollectionHelp.print
public static final String print(String start, String delim, String quotStart, String quotEnd, String end, Collection<?> collection) { """ Returns collection items delimited with given strings. If any of delimiters is null, it is ignored. @param start Start @param delim Delimiter @param quotStart Start of quotation @param quotEnd End of quotation @param end End @param collection @return @deprecated Use java.util.stream.Collectors.joining @see java.util.stream.Collectors#joining(java.lang.CharSequence, java.lang.CharSequence, java.lang.CharSequence) """ try { StringBuilder out = new StringBuilder(); print(out, start, delim, quotStart, quotEnd, end, collection); return out.toString(); } catch (IOException ex) { throw new IllegalArgumentException(ex); } }
java
public static final String print(String start, String delim, String quotStart, String quotEnd, String end, Collection<?> collection) { try { StringBuilder out = new StringBuilder(); print(out, start, delim, quotStart, quotEnd, end, collection); return out.toString(); } catch (IOException ex) { throw new IllegalArgumentException(ex); } }
[ "public", "static", "final", "String", "print", "(", "String", "start", ",", "String", "delim", ",", "String", "quotStart", ",", "String", "quotEnd", ",", "String", "end", ",", "Collection", "<", "?", ">", "collection", ")", "{", "try", "{", "StringBuilder", "out", "=", "new", "StringBuilder", "(", ")", ";", "print", "(", "out", ",", "start", ",", "delim", ",", "quotStart", ",", "quotEnd", ",", "end", ",", "collection", ")", ";", "return", "out", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "IllegalArgumentException", "(", "ex", ")", ";", "}", "}" ]
Returns collection items delimited with given strings. If any of delimiters is null, it is ignored. @param start Start @param delim Delimiter @param quotStart Start of quotation @param quotEnd End of quotation @param end End @param collection @return @deprecated Use java.util.stream.Collectors.joining @see java.util.stream.Collectors#joining(java.lang.CharSequence, java.lang.CharSequence, java.lang.CharSequence)
[ "Returns", "collection", "items", "delimited", "with", "given", "strings", ".", "If", "any", "of", "delimiters", "is", "null", "it", "is", "ignored", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CollectionHelp.java#L187-L199
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java
SoapParser.validateSoapMessage
private void validateSoapMessage(Document soapMessage, ErrorHandler eh) throws Exception { """ A method to validate the SOAP message received. The message is validated against the propoer SOAP Schema (1.1 or 1.2 depending on the namespace of the incoming message) @param soapMessage the SOAP message to validate. @param eh the error handler. @author Simone Gianfranceschi """ String namespace = soapMessage.getDocumentElement().getNamespaceURI(); if (namespace == null) { throw new Exception( "Error: SOAP message cannot be validated. The returned response may be an HTML response: " + DomUtils.serializeNode(soapMessage)); } // Create SOAP validator SchemaFactory sf = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema soap_schema = null; if (namespace.equals(SOAP_12_NAMESPACE)) { soap_schema = sf.newSchema(Misc .getResourceAsFile("com/occamlab/te/schemas/soap12.xsd")); } else /* if (namespace.equals(SOAP_11_NAMESPACE)) */{ soap_schema = sf.newSchema(Misc .getResourceAsFile("com/occamlab/te/schemas/soap11.xsd")); } Validator soap_validator = soap_schema.newValidator(); soap_validator.setErrorHandler(eh); soap_validator.validate(new DOMSource(soapMessage)); }
java
private void validateSoapMessage(Document soapMessage, ErrorHandler eh) throws Exception { String namespace = soapMessage.getDocumentElement().getNamespaceURI(); if (namespace == null) { throw new Exception( "Error: SOAP message cannot be validated. The returned response may be an HTML response: " + DomUtils.serializeNode(soapMessage)); } // Create SOAP validator SchemaFactory sf = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema soap_schema = null; if (namespace.equals(SOAP_12_NAMESPACE)) { soap_schema = sf.newSchema(Misc .getResourceAsFile("com/occamlab/te/schemas/soap12.xsd")); } else /* if (namespace.equals(SOAP_11_NAMESPACE)) */{ soap_schema = sf.newSchema(Misc .getResourceAsFile("com/occamlab/te/schemas/soap11.xsd")); } Validator soap_validator = soap_schema.newValidator(); soap_validator.setErrorHandler(eh); soap_validator.validate(new DOMSource(soapMessage)); }
[ "private", "void", "validateSoapMessage", "(", "Document", "soapMessage", ",", "ErrorHandler", "eh", ")", "throws", "Exception", "{", "String", "namespace", "=", "soapMessage", ".", "getDocumentElement", "(", ")", ".", "getNamespaceURI", "(", ")", ";", "if", "(", "namespace", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"Error: SOAP message cannot be validated. The returned response may be an HTML response: \"", "+", "DomUtils", ".", "serializeNode", "(", "soapMessage", ")", ")", ";", "}", "// Create SOAP validator", "SchemaFactory", "sf", "=", "SchemaFactory", ".", "newInstance", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ")", ";", "Schema", "soap_schema", "=", "null", ";", "if", "(", "namespace", ".", "equals", "(", "SOAP_12_NAMESPACE", ")", ")", "{", "soap_schema", "=", "sf", ".", "newSchema", "(", "Misc", ".", "getResourceAsFile", "(", "\"com/occamlab/te/schemas/soap12.xsd\"", ")", ")", ";", "}", "else", "/* if (namespace.equals(SOAP_11_NAMESPACE)) */", "{", "soap_schema", "=", "sf", ".", "newSchema", "(", "Misc", ".", "getResourceAsFile", "(", "\"com/occamlab/te/schemas/soap11.xsd\"", ")", ")", ";", "}", "Validator", "soap_validator", "=", "soap_schema", ".", "newValidator", "(", ")", ";", "soap_validator", ".", "setErrorHandler", "(", "eh", ")", ";", "soap_validator", ".", "validate", "(", "new", "DOMSource", "(", "soapMessage", ")", ")", ";", "}" ]
A method to validate the SOAP message received. The message is validated against the propoer SOAP Schema (1.1 or 1.2 depending on the namespace of the incoming message) @param soapMessage the SOAP message to validate. @param eh the error handler. @author Simone Gianfranceschi
[ "A", "method", "to", "validate", "the", "SOAP", "message", "received", ".", "The", "message", "is", "validated", "against", "the", "propoer", "SOAP", "Schema", "(", "1", ".", "1", "or", "1", ".", "2", "depending", "on", "the", "namespace", "of", "the", "incoming", "message", ")" ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java#L192-L217
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/FedoraObjectTripleGenerator_3_0.java
FedoraObjectTripleGenerator_3_0.addCommonTriples
private URIReference addCommonTriples(DOReader reader, Set<Triple> set) throws ResourceIndexException { """ Add the common core and datastream triples for the given object. """ try { URIReference objURI = new SimpleURIReference( new URI(PID.toURI(reader.GetObjectPID()))); addCoreObjectTriples(reader, objURI, set); Datastream[] datastreams = reader.GetDatastreams(null, null); for (Datastream ds : datastreams) { addCoreDatastreamTriples(ds, objURI, set); if (ds.DatastreamID.equals("DC")) { addDCTriples(ds, objURI, set); } } addRelationshipTriples(reader, objURI, set); return objURI; } catch (ResourceIndexException e) { throw e; } catch (Exception e) { throw new ResourceIndexException("Error generating triples", e); } }
java
private URIReference addCommonTriples(DOReader reader, Set<Triple> set) throws ResourceIndexException { try { URIReference objURI = new SimpleURIReference( new URI(PID.toURI(reader.GetObjectPID()))); addCoreObjectTriples(reader, objURI, set); Datastream[] datastreams = reader.GetDatastreams(null, null); for (Datastream ds : datastreams) { addCoreDatastreamTriples(ds, objURI, set); if (ds.DatastreamID.equals("DC")) { addDCTriples(ds, objURI, set); } } addRelationshipTriples(reader, objURI, set); return objURI; } catch (ResourceIndexException e) { throw e; } catch (Exception e) { throw new ResourceIndexException("Error generating triples", e); } }
[ "private", "URIReference", "addCommonTriples", "(", "DOReader", "reader", ",", "Set", "<", "Triple", ">", "set", ")", "throws", "ResourceIndexException", "{", "try", "{", "URIReference", "objURI", "=", "new", "SimpleURIReference", "(", "new", "URI", "(", "PID", ".", "toURI", "(", "reader", ".", "GetObjectPID", "(", ")", ")", ")", ")", ";", "addCoreObjectTriples", "(", "reader", ",", "objURI", ",", "set", ")", ";", "Datastream", "[", "]", "datastreams", "=", "reader", ".", "GetDatastreams", "(", "null", ",", "null", ")", ";", "for", "(", "Datastream", "ds", ":", "datastreams", ")", "{", "addCoreDatastreamTriples", "(", "ds", ",", "objURI", ",", "set", ")", ";", "if", "(", "ds", ".", "DatastreamID", ".", "equals", "(", "\"DC\"", ")", ")", "{", "addDCTriples", "(", "ds", ",", "objURI", ",", "set", ")", ";", "}", "}", "addRelationshipTriples", "(", "reader", ",", "objURI", ",", "set", ")", ";", "return", "objURI", ";", "}", "catch", "(", "ResourceIndexException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ResourceIndexException", "(", "\"Error generating triples\"", ",", "e", ")", ";", "}", "}" ]
Add the common core and datastream triples for the given object.
[ "Add", "the", "common", "core", "and", "datastream", "triples", "for", "the", "given", "object", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/FedoraObjectTripleGenerator_3_0.java#L56-L82
jenkinsci/jenkins
core/src/main/java/jenkins/security/UpdateSiteWarningsMonitor.java
UpdateSiteWarningsMonitor.doForward
@RequirePOST public HttpResponse doForward(@QueryParameter String fix, @QueryParameter String configure) { """ Redirects the user to the plugin manager or security configuration """ if (fix != null) { return HttpResponses.redirectViaContextPath("pluginManager"); } if (configure != null) { return HttpResponses.redirectViaContextPath("configureSecurity"); } // shouldn't happen return HttpResponses.redirectViaContextPath("/"); }
java
@RequirePOST public HttpResponse doForward(@QueryParameter String fix, @QueryParameter String configure) { if (fix != null) { return HttpResponses.redirectViaContextPath("pluginManager"); } if (configure != null) { return HttpResponses.redirectViaContextPath("configureSecurity"); } // shouldn't happen return HttpResponses.redirectViaContextPath("/"); }
[ "@", "RequirePOST", "public", "HttpResponse", "doForward", "(", "@", "QueryParameter", "String", "fix", ",", "@", "QueryParameter", "String", "configure", ")", "{", "if", "(", "fix", "!=", "null", ")", "{", "return", "HttpResponses", ".", "redirectViaContextPath", "(", "\"pluginManager\"", ")", ";", "}", "if", "(", "configure", "!=", "null", ")", "{", "return", "HttpResponses", ".", "redirectViaContextPath", "(", "\"configureSecurity\"", ")", ";", "}", "// shouldn't happen", "return", "HttpResponses", ".", "redirectViaContextPath", "(", "\"/\"", ")", ";", "}" ]
Redirects the user to the plugin manager or security configuration
[ "Redirects", "the", "user", "to", "the", "plugin", "manager", "or", "security", "configuration" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/UpdateSiteWarningsMonitor.java#L139-L150
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.ortho2D
public Matrix4x3f ortho2D(float left, float right, float bottom, float top) { """ Apply an orthographic projection transformation for a right-handed coordinate system to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float) ortho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2D(float, float, float, float) setOrtho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #ortho(float, float, float, float, float, float) @see #setOrtho2D(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this """ return ortho2D(left, right, bottom, top, this); }
java
public Matrix4x3f ortho2D(float left, float right, float bottom, float top) { return ortho2D(left, right, bottom, top, this); }
[ "public", "Matrix4x3f", "ortho2D", "(", "float", "left", ",", "float", "right", ",", "float", "bottom", ",", "float", "top", ")", "{", "return", "ortho2D", "(", "left", ",", "right", ",", "bottom", ",", "top", ",", "this", ")", ";", "}" ]
Apply an orthographic projection transformation for a right-handed coordinate system to this matrix. <p> This method is equivalent to calling {@link #ortho(float, float, float, float, float, float) ortho()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2D(float, float, float, float) setOrtho2D()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #ortho(float, float, float, float, float, float) @see #setOrtho2D(float, float, float, float) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Apply", "an", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#ortho", "(", "float", "float", "float", "float", "float", "float", ")", "ortho", "()", "}", "with", "<code", ">", "zNear", "=", "-", "1<", "/", "code", ">", "and", "<code", ">", "zFar", "=", "+", "1<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "orthographic", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "orthographic", "projection", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "an", "orthographic", "projection", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#setOrtho2D", "(", "float", "float", "float", "float", ")", "setOrtho2D", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5739-L5741
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java
TimePicker.initComponents
private void initComponents() { """ initComponents, This initializes the components of the JFormDesigner panel. This function is automatically generated by JFormDesigner from the JFD form design file, and should not be modified by hand. This function can be modified, if needed, by using JFormDesigner. """ // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents timeTextField = new JTextField(); toggleTimeMenuButton = new JButton(); spinnerPanel = new JPanel(); increaseButton = new JButton(); decreaseButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, 3*(pref)", "fill:pref:grow")); //---- timeTextField ---- timeTextField.setMargin(new Insets(1, 3, 2, 2)); timeTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); timeTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(timeTextField, CC.xy(1, 1)); //---- toggleTimeMenuButton ---- toggleTimeMenuButton.setText("v"); toggleTimeMenuButton.setFocusPainted(false); toggleTimeMenuButton.setFocusable(false); toggleTimeMenuButton.setFont(new Font("Segoe UI", Font.PLAIN, 8)); toggleTimeMenuButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleTimeMenuButtonMousePressed(e); } }); add(toggleTimeMenuButton, CC.xy(3, 1)); //======== spinnerPanel ======== { spinnerPanel.setLayout(new FormLayout( "default", "fill:pref:grow, fill:default:grow")); ((FormLayout) spinnerPanel.getLayout()).setRowGroups(new int[][]{{1, 2}}); //---- increaseButton ---- increaseButton.setFocusPainted(false); increaseButton.setFocusable(false); increaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); increaseButton.setText("+"); spinnerPanel.add(increaseButton, CC.xy(1, 1)); //---- decreaseButton ---- decreaseButton.setFocusPainted(false); decreaseButton.setFocusable(false); decreaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); decreaseButton.setText("-"); spinnerPanel.add(decreaseButton, CC.xy(1, 2)); } add(spinnerPanel, CC.xy(4, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents timeTextField = new JTextField(); toggleTimeMenuButton = new JButton(); spinnerPanel = new JPanel(); increaseButton = new JButton(); decreaseButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, 3*(pref)", "fill:pref:grow")); //---- timeTextField ---- timeTextField.setMargin(new Insets(1, 3, 2, 2)); timeTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); timeTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(timeTextField, CC.xy(1, 1)); //---- toggleTimeMenuButton ---- toggleTimeMenuButton.setText("v"); toggleTimeMenuButton.setFocusPainted(false); toggleTimeMenuButton.setFocusable(false); toggleTimeMenuButton.setFont(new Font("Segoe UI", Font.PLAIN, 8)); toggleTimeMenuButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleTimeMenuButtonMousePressed(e); } }); add(toggleTimeMenuButton, CC.xy(3, 1)); //======== spinnerPanel ======== { spinnerPanel.setLayout(new FormLayout( "default", "fill:pref:grow, fill:default:grow")); ((FormLayout) spinnerPanel.getLayout()).setRowGroups(new int[][]{{1, 2}}); //---- increaseButton ---- increaseButton.setFocusPainted(false); increaseButton.setFocusable(false); increaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); increaseButton.setText("+"); spinnerPanel.add(increaseButton, CC.xy(1, 1)); //---- decreaseButton ---- decreaseButton.setFocusPainted(false); decreaseButton.setFocusable(false); decreaseButton.setFont(new Font("Arial", Font.PLAIN, 8)); decreaseButton.setText("-"); spinnerPanel.add(decreaseButton, CC.xy(1, 2)); } add(spinnerPanel, CC.xy(4, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
[ "private", "void", "initComponents", "(", ")", "{", "// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents", "timeTextField", "=", "new", "JTextField", "(", ")", ";", "toggleTimeMenuButton", "=", "new", "JButton", "(", ")", ";", "spinnerPanel", "=", "new", "JPanel", "(", ")", ";", "increaseButton", "=", "new", "JButton", "(", ")", ";", "decreaseButton", "=", "new", "JButton", "(", ")", ";", "//======== this ========", "setLayout", "(", "new", "FormLayout", "(", "\"pref:grow, 3*(pref)\"", ",", "\"fill:pref:grow\"", ")", ")", ";", "//---- timeTextField ----", "timeTextField", ".", "setMargin", "(", "new", "Insets", "(", "1", ",", "3", ",", "2", ",", "2", ")", ")", ";", "timeTextField", ".", "setBorder", "(", "new", "CompoundBorder", "(", "new", "MatteBorder", "(", "1", ",", "1", ",", "1", ",", "1", ",", "new", "Color", "(", "122", ",", "138", ",", "153", ")", ")", ",", "new", "EmptyBorder", "(", "1", ",", "3", ",", "2", ",", "2", ")", ")", ")", ";", "timeTextField", ".", "addFocusListener", "(", "new", "FocusAdapter", "(", ")", "{", "@", "Override", "public", "void", "focusLost", "(", "FocusEvent", "e", ")", "{", "setTextFieldToValidStateIfNeeded", "(", ")", ";", "}", "}", ")", ";", "add", "(", "timeTextField", ",", "CC", ".", "xy", "(", "1", ",", "1", ")", ")", ";", "//---- toggleTimeMenuButton ----", "toggleTimeMenuButton", ".", "setText", "(", "\"v\"", ")", ";", "toggleTimeMenuButton", ".", "setFocusPainted", "(", "false", ")", ";", "toggleTimeMenuButton", ".", "setFocusable", "(", "false", ")", ";", "toggleTimeMenuButton", ".", "setFont", "(", "new", "Font", "(", "\"Segoe UI\"", ",", "Font", ".", "PLAIN", ",", "8", ")", ")", ";", "toggleTimeMenuButton", ".", "addMouseListener", "(", "new", "MouseAdapter", "(", ")", "{", "@", "Override", "public", "void", "mousePressed", "(", "MouseEvent", "e", ")", "{", "zEventToggleTimeMenuButtonMousePressed", "(", "e", ")", ";", "}", "}", ")", ";", "add", "(", "toggleTimeMenuButton", ",", "CC", ".", "xy", "(", "3", ",", "1", ")", ")", ";", "//======== spinnerPanel ========", "{", "spinnerPanel", ".", "setLayout", "(", "new", "FormLayout", "(", "\"default\"", ",", "\"fill:pref:grow, fill:default:grow\"", ")", ")", ";", "(", "(", "FormLayout", ")", "spinnerPanel", ".", "getLayout", "(", ")", ")", ".", "setRowGroups", "(", "new", "int", "[", "]", "[", "]", "{", "{", "1", ",", "2", "}", "}", ")", ";", "//---- increaseButton ----", "increaseButton", ".", "setFocusPainted", "(", "false", ")", ";", "increaseButton", ".", "setFocusable", "(", "false", ")", ";", "increaseButton", ".", "setFont", "(", "new", "Font", "(", "\"Arial\"", ",", "Font", ".", "PLAIN", ",", "8", ")", ")", ";", "increaseButton", ".", "setText", "(", "\"+\"", ")", ";", "spinnerPanel", ".", "add", "(", "increaseButton", ",", "CC", ".", "xy", "(", "1", ",", "1", ")", ")", ";", "//---- decreaseButton ----", "decreaseButton", ".", "setFocusPainted", "(", "false", ")", ";", "decreaseButton", ".", "setFocusable", "(", "false", ")", ";", "decreaseButton", ".", "setFont", "(", "new", "Font", "(", "\"Arial\"", ",", "Font", ".", "PLAIN", ",", "8", ")", ")", ";", "decreaseButton", ".", "setText", "(", "\"-\"", ")", ";", "spinnerPanel", ".", "add", "(", "decreaseButton", ",", "CC", ".", "xy", "(", "1", ",", "2", ")", ")", ";", "}", "add", "(", "spinnerPanel", ",", "CC", ".", "xy", "(", "4", ",", "1", ")", ")", ";", "// JFormDesigner - End of component initialization //GEN-END:initComponents", "}" ]
initComponents, This initializes the components of the JFormDesigner panel. This function is automatically generated by JFormDesigner from the JFD form design file, and should not be modified by hand. This function can be modified, if needed, by using JFormDesigner.
[ "initComponents", "This", "initializes", "the", "components", "of", "the", "JFormDesigner", "panel", ".", "This", "function", "is", "automatically", "generated", "by", "JFormDesigner", "from", "the", "JFD", "form", "design", "file", "and", "should", "not", "be", "modified", "by", "hand", ".", "This", "function", "can", "be", "modified", "if", "needed", "by", "using", "JFormDesigner", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java#L1114-L1176
geomajas/geomajas-project-client-gwt2
common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java
Dom.setElementAttributeNS
public static void setElementAttributeNS(String ns, Element element, String attr, String value) { """ <p> Adds a new attribute in the given name-space to an element. </p> <p> There is an exception when using Internet Explorer! For Internet Explorer the attribute of type "namespace:attr" will be set. </p> @param ns The name-space to be used in the element creation. @param element The element to which the attribute is to be set. @param attr The name of the attribute. @param value The new value for the attribute. """ IMPL.setElementAttributeNS(ns, element, attr, value); }
java
public static void setElementAttributeNS(String ns, Element element, String attr, String value) { IMPL.setElementAttributeNS(ns, element, attr, value); }
[ "public", "static", "void", "setElementAttributeNS", "(", "String", "ns", ",", "Element", "element", ",", "String", "attr", ",", "String", "value", ")", "{", "IMPL", ".", "setElementAttributeNS", "(", "ns", ",", "element", ",", "attr", ",", "value", ")", ";", "}" ]
<p> Adds a new attribute in the given name-space to an element. </p> <p> There is an exception when using Internet Explorer! For Internet Explorer the attribute of type "namespace:attr" will be set. </p> @param ns The name-space to be used in the element creation. @param element The element to which the attribute is to be set. @param attr The name of the attribute. @param value The new value for the attribute.
[ "<p", ">", "Adds", "a", "new", "attribute", "in", "the", "given", "name", "-", "space", "to", "an", "element", ".", "<", "/", "p", ">", "<p", ">", "There", "is", "an", "exception", "when", "using", "Internet", "Explorer!", "For", "Internet", "Explorer", "the", "attribute", "of", "type", "namespace", ":", "attr", "will", "be", "set", ".", "<", "/", "p", ">" ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/Dom.java#L139-L141
micronaut-projects/micronaut-core
multitenancy/src/main/java/io/micronaut/multitenancy/writer/CookieTenantWriter.java
CookieTenantWriter.writeTenant
@Override public void writeTenant(MutableHttpRequest<?> request, Serializable tenant) { """ Writes the Tenant Id in a cookie of the request. @param request The {@link MutableHttpRequest} instance @param tenant Tenant Id """ if (tenant instanceof String) { Cookie cookie = Cookie.of( cookieTenantWriterConfiguration.getCookiename(), (String) tenant ); cookie.configure(cookieTenantWriterConfiguration, request.isSecure()); if (cookieTenantWriterConfiguration.getCookieMaxAge().isPresent()) { cookie.maxAge(cookieTenantWriterConfiguration.getCookieMaxAge().get()); } else { cookie.maxAge(Integer.MAX_VALUE); } request.cookie(cookie); } }
java
@Override public void writeTenant(MutableHttpRequest<?> request, Serializable tenant) { if (tenant instanceof String) { Cookie cookie = Cookie.of( cookieTenantWriterConfiguration.getCookiename(), (String) tenant ); cookie.configure(cookieTenantWriterConfiguration, request.isSecure()); if (cookieTenantWriterConfiguration.getCookieMaxAge().isPresent()) { cookie.maxAge(cookieTenantWriterConfiguration.getCookieMaxAge().get()); } else { cookie.maxAge(Integer.MAX_VALUE); } request.cookie(cookie); } }
[ "@", "Override", "public", "void", "writeTenant", "(", "MutableHttpRequest", "<", "?", ">", "request", ",", "Serializable", "tenant", ")", "{", "if", "(", "tenant", "instanceof", "String", ")", "{", "Cookie", "cookie", "=", "Cookie", ".", "of", "(", "cookieTenantWriterConfiguration", ".", "getCookiename", "(", ")", ",", "(", "String", ")", "tenant", ")", ";", "cookie", ".", "configure", "(", "cookieTenantWriterConfiguration", ",", "request", ".", "isSecure", "(", ")", ")", ";", "if", "(", "cookieTenantWriterConfiguration", ".", "getCookieMaxAge", "(", ")", ".", "isPresent", "(", ")", ")", "{", "cookie", ".", "maxAge", "(", "cookieTenantWriterConfiguration", ".", "getCookieMaxAge", "(", ")", ".", "get", "(", ")", ")", ";", "}", "else", "{", "cookie", ".", "maxAge", "(", "Integer", ".", "MAX_VALUE", ")", ";", "}", "request", ".", "cookie", "(", "cookie", ")", ";", "}", "}" ]
Writes the Tenant Id in a cookie of the request. @param request The {@link MutableHttpRequest} instance @param tenant Tenant Id
[ "Writes", "the", "Tenant", "Id", "in", "a", "cookie", "of", "the", "request", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/multitenancy/src/main/java/io/micronaut/multitenancy/writer/CookieTenantWriter.java#L50-L66
junit-team/junit4
src/main/java/org/junit/runner/Description.java
Description.createSuiteDescription
public static Description createSuiteDescription(String name, Annotation... annotations) { """ Create a <code>Description</code> named <code>name</code>. Generally, you will add children to this <code>Description</code>. @param name the name of the <code>Description</code> @param annotations meta-data about the test, for downstream interpreters @return a <code>Description</code> named <code>name</code> """ return new Description(null, name, annotations); }
java
public static Description createSuiteDescription(String name, Annotation... annotations) { return new Description(null, name, annotations); }
[ "public", "static", "Description", "createSuiteDescription", "(", "String", "name", ",", "Annotation", "...", "annotations", ")", "{", "return", "new", "Description", "(", "null", ",", "name", ",", "annotations", ")", ";", "}" ]
Create a <code>Description</code> named <code>name</code>. Generally, you will add children to this <code>Description</code>. @param name the name of the <code>Description</code> @param annotations meta-data about the test, for downstream interpreters @return a <code>Description</code> named <code>name</code>
[ "Create", "a", "<code", ">", "Description<", "/", "code", ">", "named", "<code", ">", "name<", "/", "code", ">", ".", "Generally", "you", "will", "add", "children", "to", "this", "<code", ">", "Description<", "/", "code", ">", "." ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Description.java#L44-L46
nielsbasjes/logparser
parser-core/src/main/java/nl/basjes/parse/core/Parser.java
Parser.addParseTarget
public Parser<RECORD> addParseTarget(final Method method, final SetterPolicy setterPolicy, final String fieldValue) { """ /* When there is a need to add a target callback manually use this method. """ return addParseTarget(method, setterPolicy, Collections.singletonList(fieldValue)); }
java
public Parser<RECORD> addParseTarget(final Method method, final SetterPolicy setterPolicy, final String fieldValue) { return addParseTarget(method, setterPolicy, Collections.singletonList(fieldValue)); }
[ "public", "Parser", "<", "RECORD", ">", "addParseTarget", "(", "final", "Method", "method", ",", "final", "SetterPolicy", "setterPolicy", ",", "final", "String", "fieldValue", ")", "{", "return", "addParseTarget", "(", "method", ",", "setterPolicy", ",", "Collections", ".", "singletonList", "(", "fieldValue", ")", ")", ";", "}" ]
/* When there is a need to add a target callback manually use this method.
[ "/", "*", "When", "there", "is", "a", "need", "to", "add", "a", "target", "callback", "manually", "use", "this", "method", "." ]
train
https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L567-L571
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(String fileName, Class<?>[] classes) throws SQLException, IOException { """ Writes a configuration fileName in the raw directory with the configuration for classes. """ writeConfigFile(fileName, classes, false); }
java
public static void writeConfigFile(String fileName, Class<?>[] classes) throws SQLException, IOException { writeConfigFile(fileName, classes, false); }
[ "public", "static", "void", "writeConfigFile", "(", "String", "fileName", ",", "Class", "<", "?", ">", "[", "]", "classes", ")", "throws", "SQLException", ",", "IOException", "{", "writeConfigFile", "(", "fileName", ",", "classes", ",", "false", ")", ";", "}" ]
Writes a configuration fileName in the raw directory with the configuration for classes.
[ "Writes", "a", "configuration", "fileName", "in", "the", "raw", "directory", "with", "the", "configuration", "for", "classes", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L124-L126
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierAnnotation.java
TypeQualifierAnnotation.combineReturnTypeAnnotations
public static @CheckForNull TypeQualifierAnnotation combineReturnTypeAnnotations(TypeQualifierAnnotation a, TypeQualifierAnnotation b) { """ Combine return type annotations. @param a a TypeQualifierAnnotation used on a return value @param b another TypeQualifierAnnotation used on a return value @return combined return type annotation that is at least as narrow as both <code>a</code> or <code>b</code>, or null if no such TypeQualifierAnnotation exists """ return combineAnnotations(a, b, combineReturnValueMatrix); }
java
public static @CheckForNull TypeQualifierAnnotation combineReturnTypeAnnotations(TypeQualifierAnnotation a, TypeQualifierAnnotation b) { return combineAnnotations(a, b, combineReturnValueMatrix); }
[ "public", "static", "@", "CheckForNull", "TypeQualifierAnnotation", "combineReturnTypeAnnotations", "(", "TypeQualifierAnnotation", "a", ",", "TypeQualifierAnnotation", "b", ")", "{", "return", "combineAnnotations", "(", "a", ",", "b", ",", "combineReturnValueMatrix", ")", ";", "}" ]
Combine return type annotations. @param a a TypeQualifierAnnotation used on a return value @param b another TypeQualifierAnnotation used on a return value @return combined return type annotation that is at least as narrow as both <code>a</code> or <code>b</code>, or null if no such TypeQualifierAnnotation exists
[ "Combine", "return", "type", "annotations", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierAnnotation.java#L120-L123
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/util/WsUtils.java
WsUtils.computeHash
public static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3) throws WsDigestException, NoSuchAlgorithmException { """ /* Compute the MD5 sum of the three WebSocket keys (draft Hixie-76) @param key1 Sec-WebSocket-Key1 value @param key2 Sec-WebSocket-Key2 value @param key3 8 bytes immediately following WebSocket upgrade request @return @throws NoSuchAlgorithmException """ MessageDigest md5 = MessageDigest.getInstance("MD5"); ByteBuffer buf = ByteBuffer.allocate(DIGEST_LENGTH); buf.putInt(parseIntKey(key1)); buf.putInt(parseIntKey(key2)); // key3 must be exactly 8 bytes if (key3.remaining() != 8) { throw new WsDigestException("WebSocket key3 must be exactly 8 bytes"); } buf.put(key3); buf.flip(); byte[] input = new byte[DIGEST_LENGTH]; buf.get(input, 0, DIGEST_LENGTH); byte[] digest = md5.digest(input); return ByteBuffer.wrap(digest); }
java
public static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3) throws WsDigestException, NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); ByteBuffer buf = ByteBuffer.allocate(DIGEST_LENGTH); buf.putInt(parseIntKey(key1)); buf.putInt(parseIntKey(key2)); // key3 must be exactly 8 bytes if (key3.remaining() != 8) { throw new WsDigestException("WebSocket key3 must be exactly 8 bytes"); } buf.put(key3); buf.flip(); byte[] input = new byte[DIGEST_LENGTH]; buf.get(input, 0, DIGEST_LENGTH); byte[] digest = md5.digest(input); return ByteBuffer.wrap(digest); }
[ "public", "static", "ByteBuffer", "computeHash", "(", "CharSequence", "key1", ",", "CharSequence", "key2", ",", "ByteBuffer", "key3", ")", "throws", "WsDigestException", ",", "NoSuchAlgorithmException", "{", "MessageDigest", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "allocate", "(", "DIGEST_LENGTH", ")", ";", "buf", ".", "putInt", "(", "parseIntKey", "(", "key1", ")", ")", ";", "buf", ".", "putInt", "(", "parseIntKey", "(", "key2", ")", ")", ";", "// key3 must be exactly 8 bytes", "if", "(", "key3", ".", "remaining", "(", ")", "!=", "8", ")", "{", "throw", "new", "WsDigestException", "(", "\"WebSocket key3 must be exactly 8 bytes\"", ")", ";", "}", "buf", ".", "put", "(", "key3", ")", ";", "buf", ".", "flip", "(", ")", ";", "byte", "[", "]", "input", "=", "new", "byte", "[", "DIGEST_LENGTH", "]", ";", "buf", ".", "get", "(", "input", ",", "0", ",", "DIGEST_LENGTH", ")", ";", "byte", "[", "]", "digest", "=", "md5", ".", "digest", "(", "input", ")", ";", "return", "ByteBuffer", ".", "wrap", "(", "digest", ")", ";", "}" ]
/* Compute the MD5 sum of the three WebSocket keys (draft Hixie-76) @param key1 Sec-WebSocket-Key1 value @param key2 Sec-WebSocket-Key2 value @param key3 8 bytes immediately following WebSocket upgrade request @return @throws NoSuchAlgorithmException
[ "/", "*", "Compute", "the", "MD5", "sum", "of", "the", "three", "WebSocket", "keys", "(", "draft", "Hixie", "-", "76", ")" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/util/WsUtils.java#L156-L177
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficaction.java
vpntrafficaction.get
public static vpntrafficaction get(nitro_service service, String name) throws Exception { """ Use this API to fetch vpntrafficaction resource of given name . """ vpntrafficaction obj = new vpntrafficaction(); obj.set_name(name); vpntrafficaction response = (vpntrafficaction) obj.get_resource(service); return response; }
java
public static vpntrafficaction get(nitro_service service, String name) throws Exception{ vpntrafficaction obj = new vpntrafficaction(); obj.set_name(name); vpntrafficaction response = (vpntrafficaction) obj.get_resource(service); return response; }
[ "public", "static", "vpntrafficaction", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpntrafficaction", "obj", "=", "new", "vpntrafficaction", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "vpntrafficaction", "response", "=", "(", "vpntrafficaction", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch vpntrafficaction resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpntrafficaction", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficaction.java#L450-L455
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcEditService.java
CmsUgcEditService.readContent
private CmsUgcContent readContent(CmsUgcSession session, CmsResource resource) throws CmsException { """ Reads the form content information.<p> @param session the editing session @param resource the edited resource @return the form content @throws CmsException if reading the info fails """ CmsUgcContent formContent = new CmsUgcContent(); Map<String, String> contentValues = session.getValues(); formContent.setContentValues(contentValues); formContent.setSessionId(session.getId()); formContent.setResourceType(OpenCms.getResourceManager().getResourceType(resource).getTypeName()); formContent.setSitePath(getCmsObject().getSitePath(resource)); formContent.setStrucureId(resource.getStructureId()); return formContent; }
java
private CmsUgcContent readContent(CmsUgcSession session, CmsResource resource) throws CmsException { CmsUgcContent formContent = new CmsUgcContent(); Map<String, String> contentValues = session.getValues(); formContent.setContentValues(contentValues); formContent.setSessionId(session.getId()); formContent.setResourceType(OpenCms.getResourceManager().getResourceType(resource).getTypeName()); formContent.setSitePath(getCmsObject().getSitePath(resource)); formContent.setStrucureId(resource.getStructureId()); return formContent; }
[ "private", "CmsUgcContent", "readContent", "(", "CmsUgcSession", "session", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsUgcContent", "formContent", "=", "new", "CmsUgcContent", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "contentValues", "=", "session", ".", "getValues", "(", ")", ";", "formContent", ".", "setContentValues", "(", "contentValues", ")", ";", "formContent", ".", "setSessionId", "(", "session", ".", "getId", "(", ")", ")", ";", "formContent", ".", "setResourceType", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "resource", ")", ".", "getTypeName", "(", ")", ")", ";", "formContent", ".", "setSitePath", "(", "getCmsObject", "(", ")", ".", "getSitePath", "(", "resource", ")", ")", ";", "formContent", ".", "setStrucureId", "(", "resource", ".", "getStructureId", "(", ")", ")", ";", "return", "formContent", ";", "}" ]
Reads the form content information.<p> @param session the editing session @param resource the edited resource @return the form content @throws CmsException if reading the info fails
[ "Reads", "the", "form", "content", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcEditService.java#L277-L287
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java
AbstractAzkabanServlet.setErrorMessageInCookie
protected void setErrorMessageInCookie(final HttpServletResponse response, final String errorMsg) { """ Sets an error message in azkaban.failure.message in the cookie. This will be used by the web client javascript to somehow display the message """ final Cookie cookie = new Cookie(AZKABAN_FAILURE_MESSAGE, errorMsg); cookie.setPath("/"); response.addCookie(cookie); }
java
protected void setErrorMessageInCookie(final HttpServletResponse response, final String errorMsg) { final Cookie cookie = new Cookie(AZKABAN_FAILURE_MESSAGE, errorMsg); cookie.setPath("/"); response.addCookie(cookie); }
[ "protected", "void", "setErrorMessageInCookie", "(", "final", "HttpServletResponse", "response", ",", "final", "String", "errorMsg", ")", "{", "final", "Cookie", "cookie", "=", "new", "Cookie", "(", "AZKABAN_FAILURE_MESSAGE", ",", "errorMsg", ")", ";", "cookie", ".", "setPath", "(", "\"/\"", ")", ";", "response", ".", "addCookie", "(", "cookie", ")", ";", "}" ]
Sets an error message in azkaban.failure.message in the cookie. This will be used by the web client javascript to somehow display the message
[ "Sets", "an", "error", "message", "in", "azkaban", ".", "failure", ".", "message", "in", "the", "cookie", ".", "This", "will", "be", "used", "by", "the", "web", "client", "javascript", "to", "somehow", "display", "the", "message" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java#L197-L202
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java
AvailabilitySetsInner.listAvailableSizesAsync
public Observable<List<VirtualMachineSizeInner>> listAvailableSizesAsync(String resourceGroupName, String availabilitySetName) { """ Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @param resourceGroupName The name of the resource group. @param availabilitySetName The name of the availability set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VirtualMachineSizeInner&gt; object """ return listAvailableSizesWithServiceResponseAsync(resourceGroupName, availabilitySetName).map(new Func1<ServiceResponse<List<VirtualMachineSizeInner>>, List<VirtualMachineSizeInner>>() { @Override public List<VirtualMachineSizeInner> call(ServiceResponse<List<VirtualMachineSizeInner>> response) { return response.body(); } }); }
java
public Observable<List<VirtualMachineSizeInner>> listAvailableSizesAsync(String resourceGroupName, String availabilitySetName) { return listAvailableSizesWithServiceResponseAsync(resourceGroupName, availabilitySetName).map(new Func1<ServiceResponse<List<VirtualMachineSizeInner>>, List<VirtualMachineSizeInner>>() { @Override public List<VirtualMachineSizeInner> call(ServiceResponse<List<VirtualMachineSizeInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "VirtualMachineSizeInner", ">", ">", "listAvailableSizesAsync", "(", "String", "resourceGroupName", ",", "String", "availabilitySetName", ")", "{", "return", "listAvailableSizesWithServiceResponseAsync", "(", "resourceGroupName", ",", "availabilitySetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "VirtualMachineSizeInner", ">", ">", ",", "List", "<", "VirtualMachineSizeInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "VirtualMachineSizeInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "VirtualMachineSizeInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. @param resourceGroupName The name of the resource group. @param availabilitySetName The name of the availability set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VirtualMachineSizeInner&gt; object
[ "Lists", "all", "available", "virtual", "machine", "sizes", "that", "can", "be", "used", "to", "create", "a", "new", "virtual", "machine", "in", "an", "existing", "availability", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java#L475-L482
aws/aws-sdk-java
aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/DescribeDimensionKeysRequest.java
DescribeDimensionKeysRequest.withFilter
public DescribeDimensionKeysRequest withFilter(java.util.Map<String, String> filter) { """ <p> One or more filters to apply in the request. Restrictions: </p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or <code>Partition</code> parameters. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> </ul> @param filter One or more filters to apply in the request. Restrictions:</p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or <code>Partition</code> parameters. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> @return Returns a reference to this object so that method calls can be chained together. """ setFilter(filter); return this; }
java
public DescribeDimensionKeysRequest withFilter(java.util.Map<String, String> filter) { setFilter(filter); return this; }
[ "public", "DescribeDimensionKeysRequest", "withFilter", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "filter", ")", "{", "setFilter", "(", "filter", ")", ";", "return", "this", ";", "}" ]
<p> One or more filters to apply in the request. Restrictions: </p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or <code>Partition</code> parameters. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> </ul> @param filter One or more filters to apply in the request. Restrictions:</p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or <code>Partition</code> parameters. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "One", "or", "more", "filters", "to", "apply", "in", "the", "request", ".", "Restrictions", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<p", ">", "Any", "number", "of", "filters", "by", "the", "same", "dimension", "as", "specified", "in", "the", "<code", ">", "GroupBy<", "/", "code", ">", "or", "<code", ">", "Partition<", "/", "code", ">", "parameters", ".", "<", "/", "p", ">", "<", "/", "li", ">", "<li", ">", "<p", ">", "A", "single", "filter", "for", "any", "other", "dimension", "in", "this", "dimension", "group", ".", "<", "/", "p", ">", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/DescribeDimensionKeysRequest.java#L1012-L1015
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/BundleRepositoryRegistry.java
BundleRepositoryRegistry.initializeDefaults
public static synchronized void initializeDefaults(String processName, boolean useMsgs, boolean isClient) { """ Add the default repositories for the product @param processName If set to a processName, a cache will be created in that process's workarea. A null value disables caching. @param useMsgs This setting is passed on to the held ContentLocalBundleRepositories. @param isClient This is true when the current process is client. """ BundleRepositoryRegistry.isClient = isClient; BundleRepositoryRegistry.initializeDefaults(processName, useMsgs); }
java
public static synchronized void initializeDefaults(String processName, boolean useMsgs, boolean isClient) { BundleRepositoryRegistry.isClient = isClient; BundleRepositoryRegistry.initializeDefaults(processName, useMsgs); }
[ "public", "static", "synchronized", "void", "initializeDefaults", "(", "String", "processName", ",", "boolean", "useMsgs", ",", "boolean", "isClient", ")", "{", "BundleRepositoryRegistry", ".", "isClient", "=", "isClient", ";", "BundleRepositoryRegistry", ".", "initializeDefaults", "(", "processName", ",", "useMsgs", ")", ";", "}" ]
Add the default repositories for the product @param processName If set to a processName, a cache will be created in that process's workarea. A null value disables caching. @param useMsgs This setting is passed on to the held ContentLocalBundleRepositories. @param isClient This is true when the current process is client.
[ "Add", "the", "default", "repositories", "for", "the", "product" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/provisioning/BundleRepositoryRegistry.java#L56-L59
apache/groovy
src/main/java/org/codehaus/groovy/tools/Utilities.java
Utilities.repeatString
public static String repeatString( String pattern, int repeats ) { """ Returns a string made up of repetitions of the specified string. """ StringBuilder buffer = new StringBuilder( pattern.length() * repeats ); for( int i = 0; i < repeats; i++ ) { buffer.append( pattern ); } return new String( buffer ); }
java
public static String repeatString( String pattern, int repeats ) { StringBuilder buffer = new StringBuilder( pattern.length() * repeats ); for( int i = 0; i < repeats; i++ ) { buffer.append( pattern ); } return new String( buffer ); }
[ "public", "static", "String", "repeatString", "(", "String", "pattern", ",", "int", "repeats", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "pattern", ".", "length", "(", ")", "*", "repeats", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "repeats", ";", "i", "++", ")", "{", "buffer", ".", "append", "(", "pattern", ")", ";", "}", "return", "new", "String", "(", "buffer", ")", ";", "}" ]
Returns a string made up of repetitions of the specified string.
[ "Returns", "a", "string", "made", "up", "of", "repetitions", "of", "the", "specified", "string", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/tools/Utilities.java#L41-L50
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java
ResourceTracker.getResourceUsage
public ResourceUsage getResourceUsage() { """ Get a snapshot of the resource usage. @return Snapshot of resource usage """ int totalMapperGrants = 0; int totalReducerGrants = 0; synchronized (lockObject) { for (Map.Entry<Integer, ResourceGrant> entry : grantedResources.entrySet()) { switch(entry.getValue().getType()) { case MAP: ++totalMapperGrants; break; case REDUCE: ++totalReducerGrants; break; case JOBTRACKER: // Ignore for now break; default: throw new RuntimeException("Illegal type " + entry.getValue().getType()); } } } return new ResourceUsage(totalMapperGrants, totalReducerGrants); }
java
public ResourceUsage getResourceUsage() { int totalMapperGrants = 0; int totalReducerGrants = 0; synchronized (lockObject) { for (Map.Entry<Integer, ResourceGrant> entry : grantedResources.entrySet()) { switch(entry.getValue().getType()) { case MAP: ++totalMapperGrants; break; case REDUCE: ++totalReducerGrants; break; case JOBTRACKER: // Ignore for now break; default: throw new RuntimeException("Illegal type " + entry.getValue().getType()); } } } return new ResourceUsage(totalMapperGrants, totalReducerGrants); }
[ "public", "ResourceUsage", "getResourceUsage", "(", ")", "{", "int", "totalMapperGrants", "=", "0", ";", "int", "totalReducerGrants", "=", "0", ";", "synchronized", "(", "lockObject", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Integer", ",", "ResourceGrant", ">", "entry", ":", "grantedResources", ".", "entrySet", "(", ")", ")", "{", "switch", "(", "entry", ".", "getValue", "(", ")", ".", "getType", "(", ")", ")", "{", "case", "MAP", ":", "++", "totalMapperGrants", ";", "break", ";", "case", "REDUCE", ":", "++", "totalReducerGrants", ";", "break", ";", "case", "JOBTRACKER", ":", "// Ignore for now", "break", ";", "default", ":", "throw", "new", "RuntimeException", "(", "\"Illegal type \"", "+", "entry", ".", "getValue", "(", ")", ".", "getType", "(", ")", ")", ";", "}", "}", "}", "return", "new", "ResourceUsage", "(", "totalMapperGrants", ",", "totalReducerGrants", ")", ";", "}" ]
Get a snapshot of the resource usage. @return Snapshot of resource usage
[ "Get", "a", "snapshot", "of", "the", "resource", "usage", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L120-L143