repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
zamrokk/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Chain.java
Chain.setMemberServicesUrl
public void setMemberServicesUrl(String url, String pem) throws CertificateException { this.setMemberServices(new MemberServicesImpl(url,pem)); }
java
public void setMemberServicesUrl(String url, String pem) throws CertificateException { this.setMemberServices(new MemberServicesImpl(url,pem)); }
[ "public", "void", "setMemberServicesUrl", "(", "String", "url", ",", "String", "pem", ")", "throws", "CertificateException", "{", "this", ".", "setMemberServices", "(", "new", "MemberServicesImpl", "(", "url", ",", "pem", ")", ")", ";", "}" ]
Set the member services URL @param url Member services URL of the form: "grpc://host:port" or "grpcs://host:port" @param pem permission @throws CertificateException exception
[ "Set", "the", "member", "services", "URL" ]
train
https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Chain.java#L135-L137
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createBullet
public Shape createBullet(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
java
public Shape createBullet(int x, int y, int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
[ "public", "Shape", "createBullet", "(", "int", "x", ",", "int", "y", ",", "int", "diameter", ")", "{", "return", "createEllipseInternal", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Return a path for a simple bullet. @param x the X coordinate of the upper-left corner of the bullet @param y the Y coordinate of the upper-left corner of the bullet @param diameter the diameter of the bullet @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "simple", "bullet", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L486-L488
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java
ConnectionMonitorsInner.getAsync
public Observable<ConnectionMonitorResultInner> getAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) { return getWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorResultInner>, ConnectionMonitorResultInner>() { @Override public ConnectionMonitorResultInner call(ServiceResponse<ConnectionMonitorResultInner> response) { return response.body(); } }); }
java
public Observable<ConnectionMonitorResultInner> getAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) { return getWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorResultInner>, ConnectionMonitorResultInner>() { @Override public ConnectionMonitorResultInner call(ServiceResponse<ConnectionMonitorResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionMonitorResultInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "connectionMonitorName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Gets a connection monitor by name. @param resourceGroupName The name of the resource group containing Network Watcher. @param networkWatcherName The name of the Network Watcher resource. @param connectionMonitorName The name of the connection monitor. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectionMonitorResultInner object
[ "Gets", "a", "connection", "monitor", "by", "name", "." ]
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/ConnectionMonitorsInner.java#L330-L337
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java
XmlPrintStream.openElement
public void openElement(String name, String... attributes) { elementStack.push(name); startElement(name, attributes); println(">"); }
java
public void openElement(String name, String... attributes) { elementStack.push(name); startElement(name, attributes); println(">"); }
[ "public", "void", "openElement", "(", "String", "name", ",", "String", "...", "attributes", ")", "{", "elementStack", ".", "push", "(", "name", ")", ";", "startElement", "(", "name", ",", "attributes", ")", ";", "println", "(", "\">\"", ")", ";", "}" ]
Open an XML element with the given name, and attributes. A call to closeElement() will output the appropriate XML closing tag. This class remembers the tag names. The String parameters are taken to be alternatively names and values. Any odd value at the end of the list is added as a valueless attribute. @param name Name of the element. @param attributes Attributes in name value pairs.
[ "Open", "an", "XML", "element", "with", "the", "given", "name", "and", "attributes", ".", "A", "call", "to", "closeElement", "()", "will", "output", "the", "appropriate", "XML", "closing", "tag", ".", "This", "class", "remembers", "the", "tag", "names", "....
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L85-L90
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/ops/transforms/Transforms.java
Transforms.greaterThanOrEqual
public static INDArray greaterThanOrEqual(INDArray first, INDArray ndArray) { return greaterThanOrEqual(first, ndArray, true); }
java
public static INDArray greaterThanOrEqual(INDArray first, INDArray ndArray) { return greaterThanOrEqual(first, ndArray, true); }
[ "public", "static", "INDArray", "greaterThanOrEqual", "(", "INDArray", "first", ",", "INDArray", "ndArray", ")", "{", "return", "greaterThanOrEqual", "(", "first", ",", "ndArray", ",", "true", ")", ";", "}" ]
1 if greater than or equal to 0 otherwise (at each element) @param first @param ndArray @return
[ "1", "if", "greater", "than", "or", "equal", "to", "0", "otherwise", "(", "at", "each", "element", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/ops/transforms/Transforms.java#L761-L763
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java
BuildStepsInner.createAsync
public Observable<BuildStepInner> createAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepProperties properties) { return createWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, properties).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() { @Override public BuildStepInner call(ServiceResponse<BuildStepInner> response) { return response.body(); } }); }
java
public Observable<BuildStepInner> createAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepProperties properties) { return createWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, properties).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() { @Override public BuildStepInner call(ServiceResponse<BuildStepInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BuildStepInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "String", "stepName", ",", "BuildStepProperties", "properties", ")", "{", "return", "createWithSe...
Creates a build step for a build task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param stepName The name of a build step for a container registry build task. @param properties The properties of a build step. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "build", "step", "for", "a", "build", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L468-L475
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java
FastDateFormat.getDateTimeInstance
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) { return cache.getDateTimeInstance(dateStyle, timeStyle, null, null); }
java
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) { return cache.getDateTimeInstance(dateStyle, timeStyle, null, null); }
[ "public", "static", "FastDateFormat", "getDateTimeInstance", "(", "final", "int", "dateStyle", ",", "final", "int", "timeStyle", ")", "{", "return", "cache", ".", "getDateTimeInstance", "(", "dateStyle", ",", "timeStyle", ",", "null", ",", "null", ")", ";", "}...
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L220-L222
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java
AipKnowledgeGraphic.startTask
public JSONObject startTask(int id, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("id", id); if (options != null) { request.addBody(options); } request.setUri(KnowledgeGraphicConsts.TASK_START); postOperation(request); return requestServer(request); }
java
public JSONObject startTask(int id, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("id", id); if (options != null) { request.addBody(options); } request.setUri(KnowledgeGraphicConsts.TASK_START); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "startTask", "(", "int", "id", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "ad...
启动任务接口 启动一个已经创建的信息抽取任务 @param id - 任务ID @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "启动任务接口", "启动一个已经创建的信息抽取任务" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java#L145-L156
Netflix/servo
servo-core/src/main/java/com/netflix/servo/tag/Tags.java
Tags.parseTag
public static Tag parseTag(String tagString) { String k; String v; int eqIndex = tagString.indexOf("="); if (eqIndex < 0) { throw new IllegalArgumentException("key and value must be separated by '='"); } k = tagString.substring(0, eqIndex).trim(); v = tagString.substring(eqIndex + 1, tagString.length()).trim(); return newTag(k, v); }
java
public static Tag parseTag(String tagString) { String k; String v; int eqIndex = tagString.indexOf("="); if (eqIndex < 0) { throw new IllegalArgumentException("key and value must be separated by '='"); } k = tagString.substring(0, eqIndex).trim(); v = tagString.substring(eqIndex + 1, tagString.length()).trim(); return newTag(k, v); }
[ "public", "static", "Tag", "parseTag", "(", "String", "tagString", ")", "{", "String", "k", ";", "String", "v", ";", "int", "eqIndex", "=", "tagString", ".", "indexOf", "(", "\"=\"", ")", ";", "if", "(", "eqIndex", "<", "0", ")", "{", "throw", "new",...
Parse a string representing a tag. A tag string should have the format {@code key=value}. Whitespace at the ends of the key and value will be removed. Both the key and value must have at least one character. @param tagString string with encoded tag @return tag parsed from the string
[ "Parse", "a", "string", "representing", "a", "tag", ".", "A", "tag", "string", "should", "have", "the", "format", "{", "@code", "key", "=", "value", "}", ".", "Whitespace", "at", "the", "ends", "of", "the", "key", "and", "value", "will", "be", "removed...
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/tag/Tags.java#L75-L87
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/ProxyServlet.java
ProxyServlet.copyHeadersFromClient
private void copyHeadersFromClient(HttpServletRequest pRequest, HttpURLConnection pRemoteConnection) { Enumeration headerNames = pRequest.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = (String) headerNames.nextElement(); Enumeration headerValues = pRequest.getHeaders(headerName); // Skip the "host" header, as we want something else if (HTTP_REQUEST_HEADER_HOST.equalsIgnoreCase(headerName)) { // Skip this header headerName = null; } // Set the the header to the remoteConnection if (headerName != null) { // Convert from multiple line to single line, comma separated, as // there seems to be a shortcoming in the URLConneciton API... StringBuilder headerValue = new StringBuilder(); while (headerValues.hasMoreElements()) { String value = (String) headerValues.nextElement(); headerValue.append(value); if (headerValues.hasMoreElements()) { headerValue.append(", "); } } //System.out.println("client -->>> remote: " + headerName + ": " + headerValue); pRemoteConnection.setRequestProperty(headerName, headerValue.toString()); } } }
java
private void copyHeadersFromClient(HttpServletRequest pRequest, HttpURLConnection pRemoteConnection) { Enumeration headerNames = pRequest.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = (String) headerNames.nextElement(); Enumeration headerValues = pRequest.getHeaders(headerName); // Skip the "host" header, as we want something else if (HTTP_REQUEST_HEADER_HOST.equalsIgnoreCase(headerName)) { // Skip this header headerName = null; } // Set the the header to the remoteConnection if (headerName != null) { // Convert from multiple line to single line, comma separated, as // there seems to be a shortcoming in the URLConneciton API... StringBuilder headerValue = new StringBuilder(); while (headerValues.hasMoreElements()) { String value = (String) headerValues.nextElement(); headerValue.append(value); if (headerValues.hasMoreElements()) { headerValue.append(", "); } } //System.out.println("client -->>> remote: " + headerName + ": " + headerValue); pRemoteConnection.setRequestProperty(headerName, headerValue.toString()); } } }
[ "private", "void", "copyHeadersFromClient", "(", "HttpServletRequest", "pRequest", ",", "HttpURLConnection", "pRemoteConnection", ")", "{", "Enumeration", "headerNames", "=", "pRequest", ".", "getHeaderNames", "(", ")", ";", "while", "(", "headerNames", ".", "hasMoreE...
Copies headers from the client (the incoming {@code HttpServletRequest}) to the outgoing connection. All headers except the "Host" header are copied. @param pRequest @param pRemoteConnection
[ "Copies", "headers", "from", "the", "client", "(", "the", "incoming", "{", "@code", "HttpServletRequest", "}", ")", "to", "the", "outgoing", "connection", ".", "All", "headers", "except", "the", "Host", "header", "are", "copied", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ProxyServlet.java#L407-L436
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java
FunctionUtils.replaceFunctionsInString
public static String replaceFunctionsInString(String str, TestContext context) { return replaceFunctionsInString(str, context, false); }
java
public static String replaceFunctionsInString(String str, TestContext context) { return replaceFunctionsInString(str, context, false); }
[ "public", "static", "String", "replaceFunctionsInString", "(", "String", "str", ",", "TestContext", "context", ")", "{", "return", "replaceFunctionsInString", "(", "str", ",", "context", ",", "false", ")", ";", "}" ]
Search for functions in string and replace with respective function result. @param str to parse @return parsed string result
[ "Search", "for", "functions", "in", "string", "and", "replace", "with", "respective", "function", "result", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java#L41-L43
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Invoker.java
Invoker.callMethod
public static Object callMethod(Object object, String methodName, Object[] parameters) throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { MethodParameterPair pair = getMethodParameterPairIgnoreCase(object.getClass(), methodName, parameters); return pair.getMethod().invoke(object, pair.getParameters()); }
java
public static Object callMethod(Object object, String methodName, Object[] parameters) throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { MethodParameterPair pair = getMethodParameterPairIgnoreCase(object.getClass(), methodName, parameters); return pair.getMethod().invoke(object, pair.getParameters()); }
[ "public", "static", "Object", "callMethod", "(", "Object", "object", ",", "String", "methodName", ",", "Object", "[", "]", "parameters", ")", "throws", "NoSuchMethodException", ",", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetExcepti...
call of a method from given object @param object object to call method from @param methodName name of the method to call @param parameters parameter for method @return return value of the method @throws SecurityException @throws NoSuchMethodException @throws IllegalArgumentException @throws IllegalAccessException @throws InvocationTargetException
[ "call", "of", "a", "method", "from", "given", "object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L126-L131
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendTimeZoneName
public DateTimeFormatterBuilder appendTimeZoneName(Map<String, DateTimeZone> parseLookup) { TimeZoneName pp = new TimeZoneName(TimeZoneName.LONG_NAME, parseLookup); return append0(pp, pp); }
java
public DateTimeFormatterBuilder appendTimeZoneName(Map<String, DateTimeZone> parseLookup) { TimeZoneName pp = new TimeZoneName(TimeZoneName.LONG_NAME, parseLookup); return append0(pp, pp); }
[ "public", "DateTimeFormatterBuilder", "appendTimeZoneName", "(", "Map", "<", "String", ",", "DateTimeZone", ">", "parseLookup", ")", "{", "TimeZoneName", "pp", "=", "new", "TimeZoneName", "(", "TimeZoneName", ".", "LONG_NAME", ",", "parseLookup", ")", ";", "return...
Instructs the printer to emit a locale-specific time zone name, providing a lookup for parsing. Time zone names are not unique, thus the API forces you to supply the lookup. The names are searched in the order of the map, thus it is strongly recommended to use a {@code LinkedHashMap} or similar. @param parseLookup the table of names, not null @return this DateTimeFormatterBuilder, for chaining
[ "Instructs", "the", "printer", "to", "emit", "a", "locale", "-", "specific", "time", "zone", "name", "providing", "a", "lookup", "for", "parsing", ".", "Time", "zone", "names", "are", "not", "unique", "thus", "the", "API", "forces", "you", "to", "supply", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L1031-L1034
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLTypeComputer.java
SARLTypeComputer._computeTypes
protected void _computeTypes(SarlBreakExpression object, ITypeComputationState state) { final LightweightTypeReference primitiveVoid = getPrimitiveVoid(state); state.acceptActualType(primitiveVoid); }
java
protected void _computeTypes(SarlBreakExpression object, ITypeComputationState state) { final LightweightTypeReference primitiveVoid = getPrimitiveVoid(state); state.acceptActualType(primitiveVoid); }
[ "protected", "void", "_computeTypes", "(", "SarlBreakExpression", "object", ",", "ITypeComputationState", "state", ")", "{", "final", "LightweightTypeReference", "primitiveVoid", "=", "getPrimitiveVoid", "(", "state", ")", ";", "state", ".", "acceptActualType", "(", "...
Compute the type of a break expression. @param object the expression. @param state the state of the type resolver.
[ "Compute", "the", "type", "of", "a", "break", "expression", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLTypeComputer.java#L170-L173
graphql-java/graphql-java
src/main/java/graphql/schema/idl/SchemaGenerator.java
SchemaGenerator.makeExecutableSchema
public GraphQLSchema makeExecutableSchema(TypeDefinitionRegistry typeRegistry, RuntimeWiring wiring) throws SchemaProblem { return makeExecutableSchema(Options.defaultOptions(), typeRegistry, wiring); }
java
public GraphQLSchema makeExecutableSchema(TypeDefinitionRegistry typeRegistry, RuntimeWiring wiring) throws SchemaProblem { return makeExecutableSchema(Options.defaultOptions(), typeRegistry, wiring); }
[ "public", "GraphQLSchema", "makeExecutableSchema", "(", "TypeDefinitionRegistry", "typeRegistry", ",", "RuntimeWiring", "wiring", ")", "throws", "SchemaProblem", "{", "return", "makeExecutableSchema", "(", "Options", ".", "defaultOptions", "(", ")", ",", "typeRegistry", ...
This will take a {@link TypeDefinitionRegistry} and a {@link RuntimeWiring} and put them together to create a executable schema @param typeRegistry this can be obtained via {@link SchemaParser#parse(String)} @param wiring this can be built using {@link RuntimeWiring#newRuntimeWiring()} @return an executable schema @throws SchemaProblem if there are problems in assembling a schema such as missing type resolvers or no operations defined
[ "This", "will", "take", "a", "{", "@link", "TypeDefinitionRegistry", "}", "and", "a", "{", "@link", "RuntimeWiring", "}", "and", "put", "them", "together", "to", "create", "a", "executable", "schema" ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/SchemaGenerator.java#L236-L238
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.printDebug
public static void printDebug(final Object pObject, final String pMethodName, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } if (pObject == null) { pPrintStream.println(OBJECT_IS_NULL_ERROR_MESSAGE); return; } if (!StringUtil.isEmpty(pMethodName)) { try { Method objectMethod = pObject.getClass().getMethod(pMethodName, null); Object retVal = objectMethod.invoke(pObject, null); if (retVal != null) { printDebug(retVal, null, pPrintStream); } else { throw new Exception(); } } catch (Exception e) { // Default pPrintStream.println(pObject.toString()); } } else { // Ultimate default pPrintStream.println(pObject.toString()); } }
java
public static void printDebug(final Object pObject, final String pMethodName, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } if (pObject == null) { pPrintStream.println(OBJECT_IS_NULL_ERROR_MESSAGE); return; } if (!StringUtil.isEmpty(pMethodName)) { try { Method objectMethod = pObject.getClass().getMethod(pMethodName, null); Object retVal = objectMethod.invoke(pObject, null); if (retVal != null) { printDebug(retVal, null, pPrintStream); } else { throw new Exception(); } } catch (Exception e) { // Default pPrintStream.println(pObject.toString()); } } else { // Ultimate default pPrintStream.println(pObject.toString()); } }
[ "public", "static", "void", "printDebug", "(", "final", "Object", "pObject", ",", "final", "String", "pMethodName", ",", "final", "PrintStream", "pPrintStream", ")", "{", "if", "(", "pPrintStream", "==", "null", ")", "{", "System", ".", "err", ".", "println"...
The "default" method that invokes a given method of an object and prints the results to a {@code java.io.PrintStream}.<br> The method for invocation must have no formal parameters. If the invoking method does not exist, the {@code toString()} method is called. The {@code toString()} method of the returning object is called. <p> @param pObject the {@code java.lang.Object} to be printed. @param pMethodName a {@code java.lang.String} holding the name of the method to be invoked. @param pPrintStream the {@code java.io.PrintStream} for flushing the results.
[ "The", "default", "method", "that", "invokes", "a", "given", "method", "of", "an", "object", "and", "prints", "the", "results", "to", "a", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L236-L264
forge/core
javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/dto/DTOCollection.java
DTOCollection.containsDTOFor
public boolean containsDTOFor(JavaClass<?> entity, boolean root) { if (dtos.get(entity) == null) { return false; } return (root ? (dtos.get(entity).rootDTO != null) : (dtos.get(entity).nestedDTO != null)); }
java
public boolean containsDTOFor(JavaClass<?> entity, boolean root) { if (dtos.get(entity) == null) { return false; } return (root ? (dtos.get(entity).rootDTO != null) : (dtos.get(entity).nestedDTO != null)); }
[ "public", "boolean", "containsDTOFor", "(", "JavaClass", "<", "?", ">", "entity", ",", "boolean", "root", ")", "{", "if", "(", "dtos", ".", "get", "(", "entity", ")", "==", "null", ")", "{", "return", "false", ";", "}", "return", "(", "root", "?", ...
Indicates whether a DTO is found in the underlying collection or not. @param entity The JPA entity for which DTOs may have been created @param root Toplevel/Root or nested DTO? @return <code>true</code> if a DTO at the desired level (root/nested) for the provided entity was found in the collection
[ "Indicates", "whether", "a", "DTO", "is", "found", "in", "the", "underlying", "collection", "or", "not", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/dto/DTOCollection.java#L84-L91
UrielCh/ovh-java-sdk
ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java
ApiOvhCdndedicated.serviceName_domains_domain_cacheRules_cacheRuleId_GET
public OvhCacheRule serviceName_domains_domain_cacheRules_cacheRuleId_GET(String serviceName, String domain, Long cacheRuleId) throws IOException { String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}"; StringBuilder sb = path(qPath, serviceName, domain, cacheRuleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCacheRule.class); }
java
public OvhCacheRule serviceName_domains_domain_cacheRules_cacheRuleId_GET(String serviceName, String domain, Long cacheRuleId) throws IOException { String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId}"; StringBuilder sb = path(qPath, serviceName, domain, cacheRuleId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCacheRule.class); }
[ "public", "OvhCacheRule", "serviceName_domains_domain_cacheRules_cacheRuleId_GET", "(", "String", "serviceName", ",", "String", "domain", ",", "Long", "cacheRuleId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cdn/dedicated/{serviceName}/domains/{domain}/cach...
Get this object properties REST: GET /cdn/dedicated/{serviceName}/domains/{domain}/cacheRules/{cacheRuleId} @param serviceName [required] The internal name of your CDN offer @param domain [required] Domain of this object @param cacheRuleId [required] Id for this cache rule
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L289-L294
damnhandy/Handy-URI-Templates
src/main/java/com/damnhandy/uri/template/UriTemplate.java
UriTemplate.set
public UriTemplate set(Map<String, Object> values) { if (values != null && !values.isEmpty()) { this.values.putAll(values); } return this; }
java
public UriTemplate set(Map<String, Object> values) { if (values != null && !values.isEmpty()) { this.values.putAll(values); } return this; }
[ "public", "UriTemplate", "set", "(", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "if", "(", "values", "!=", "null", "&&", "!", "values", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "values", ".", "putAll", "(", "values", ")",...
Adds the name/value pairs in the supplied {@link Map} to the collection of values within this URI template instance. @param values @return @since 1.0
[ "Adds", "the", "name", "/", "value", "pairs", "in", "the", "supplied", "{", "@link", "Map", "}", "to", "the", "collection", "of", "values", "within", "this", "URI", "template", "instance", "." ]
train
https://github.com/damnhandy/Handy-URI-Templates/blob/0896e13828e3d8a93dd19a8e148c3d0740201c3d/src/main/java/com/damnhandy/uri/template/UriTemplate.java#L558-L565
stapler/stapler
jelly/src/main/java/org/kohsuke/stapler/jelly/JellyClassTearOff.java
JellyClassTearOff.createDispatcher
public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException { try { // backward compatible behavior that expects full file name including ".jelly" Script script = findScript(viewName); if(script!=null) return new JellyRequestDispatcher(it,script); // this is what the look up was really supposed to be. script = findScript(viewName+".jelly"); if(script!=null) return new JellyRequestDispatcher(it,script); return null; } catch (JellyException e) { IOException io = new IOException(e.getMessage()); io.initCause(e); throw io; } }
java
public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException { try { // backward compatible behavior that expects full file name including ".jelly" Script script = findScript(viewName); if(script!=null) return new JellyRequestDispatcher(it,script); // this is what the look up was really supposed to be. script = findScript(viewName+".jelly"); if(script!=null) return new JellyRequestDispatcher(it,script); return null; } catch (JellyException e) { IOException io = new IOException(e.getMessage()); io.initCause(e); throw io; } }
[ "public", "RequestDispatcher", "createDispatcher", "(", "Object", "it", ",", "String", "viewName", ")", "throws", "IOException", "{", "try", "{", "// backward compatible behavior that expects full file name including \".jelly\"", "Script", "script", "=", "findScript", "(", ...
Creates a {@link RequestDispatcher} that forwards to the jelly view, if available.
[ "Creates", "a", "{" ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/jelly/src/main/java/org/kohsuke/stapler/jelly/JellyClassTearOff.java#L126-L143
networknt/light-4j
metrics/src/main/java/io/dropwizard/metrics/MetricName.java
MetricName.tagged
public MetricName tagged(Map<String, String> add) { final Map<String, String> tags = new HashMap<>(add); tags.putAll(this.tags); return new MetricName(key, tags); }
java
public MetricName tagged(Map<String, String> add) { final Map<String, String> tags = new HashMap<>(add); tags.putAll(this.tags); return new MetricName(key, tags); }
[ "public", "MetricName", "tagged", "(", "Map", "<", "String", ",", "String", ">", "add", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "tags", "=", "new", "HashMap", "<>", "(", "add", ")", ";", "tags", ".", "putAll", "(", "this", ".",...
Add tags to a metric name and return the newly created MetricName. @param add Tags to add. @return A newly created metric name with the specified tags associated with it.
[ "Add", "tags", "to", "a", "metric", "name", "and", "return", "the", "newly", "created", "MetricName", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricName.java#L104-L108
seam/faces
impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java
SecurityPhaseListener.performObservation
private void performObservation(PhaseEvent event, PhaseIdType phaseIdType) { UIViewRoot viewRoot = (UIViewRoot) event.getFacesContext().getViewRoot(); List<? extends Annotation> restrictionsForPhase = getRestrictionsForPhase(phaseIdType, viewRoot.getViewId()); if (restrictionsForPhase != null) { log.debugf("Enforcing on phase %s", phaseIdType); enforce(event.getFacesContext(), viewRoot, restrictionsForPhase); } }
java
private void performObservation(PhaseEvent event, PhaseIdType phaseIdType) { UIViewRoot viewRoot = (UIViewRoot) event.getFacesContext().getViewRoot(); List<? extends Annotation> restrictionsForPhase = getRestrictionsForPhase(phaseIdType, viewRoot.getViewId()); if (restrictionsForPhase != null) { log.debugf("Enforcing on phase %s", phaseIdType); enforce(event.getFacesContext(), viewRoot, restrictionsForPhase); } }
[ "private", "void", "performObservation", "(", "PhaseEvent", "event", ",", "PhaseIdType", "phaseIdType", ")", "{", "UIViewRoot", "viewRoot", "=", "(", "UIViewRoot", ")", "event", ".", "getFacesContext", "(", ")", ".", "getViewRoot", "(", ")", ";", "List", "<", ...
Inspect the annotations in the ViewConfigStore, enforcing any restrictions applicable to this phase @param event @param phaseIdType
[ "Inspect", "the", "annotations", "in", "the", "ViewConfigStore", "enforcing", "any", "restrictions", "applicable", "to", "this", "phase" ]
train
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/impl/src/main/java/org/jboss/seam/faces/security/SecurityPhaseListener.java#L150-L157
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuMipmappedArrayGetLevel
public static int cuMipmappedArrayGetLevel(CUarray pLevelArray, CUmipmappedArray hMipmappedArray, int level) { return checkResult(cuMipmappedArrayGetLevelNative(pLevelArray, hMipmappedArray, level)); }
java
public static int cuMipmappedArrayGetLevel(CUarray pLevelArray, CUmipmappedArray hMipmappedArray, int level) { return checkResult(cuMipmappedArrayGetLevelNative(pLevelArray, hMipmappedArray, level)); }
[ "public", "static", "int", "cuMipmappedArrayGetLevel", "(", "CUarray", "pLevelArray", ",", "CUmipmappedArray", "hMipmappedArray", ",", "int", "level", ")", "{", "return", "checkResult", "(", "cuMipmappedArrayGetLevelNative", "(", "pLevelArray", ",", "hMipmappedArray", "...
Gets a mipmap level of a CUDA mipmapped array. <pre> CUresult cuMipmappedArrayGetLevel ( CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level ) </pre> <div> <p>Gets a mipmap level of a CUDA mipmapped array. Returns in <tt>*pLevelArray</tt> a CUDA array that represents a single mipmap level of the CUDA mipmapped array <tt>hMipmappedArray</tt>. </p> <p>If <tt>level</tt> is greater than the maximum number of levels in this mipmapped array, CUDA_ERROR_INVALID_VALUE is returned. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param pLevelArray Returned mipmap level CUDA array @param hMipmappedArray CUDA mipmapped array @param level Mipmap level @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_HANDLE @see JCudaDriver#cuMipmappedArrayCreate @see JCudaDriver#cuMipmappedArrayDestroy @see JCudaDriver#cuArrayCreate
[ "Gets", "a", "mipmap", "level", "of", "a", "CUDA", "mipmapped", "array", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L9567-L9570
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.expandSquare
private static ResultPoint[] expandSquare(ResultPoint[] cornerPoints, int oldSide, int newSide) { float ratio = newSide / (2.0f * oldSide); float dx = cornerPoints[0].getX() - cornerPoints[2].getX(); float dy = cornerPoints[0].getY() - cornerPoints[2].getY(); float centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0f; float centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0f; ResultPoint result0 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy); ResultPoint result2 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy); dx = cornerPoints[1].getX() - cornerPoints[3].getX(); dy = cornerPoints[1].getY() - cornerPoints[3].getY(); centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0f; centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0f; ResultPoint result1 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy); ResultPoint result3 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy); return new ResultPoint[]{result0, result1, result2, result3}; }
java
private static ResultPoint[] expandSquare(ResultPoint[] cornerPoints, int oldSide, int newSide) { float ratio = newSide / (2.0f * oldSide); float dx = cornerPoints[0].getX() - cornerPoints[2].getX(); float dy = cornerPoints[0].getY() - cornerPoints[2].getY(); float centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0f; float centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0f; ResultPoint result0 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy); ResultPoint result2 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy); dx = cornerPoints[1].getX() - cornerPoints[3].getX(); dy = cornerPoints[1].getY() - cornerPoints[3].getY(); centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0f; centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0f; ResultPoint result1 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy); ResultPoint result3 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy); return new ResultPoint[]{result0, result1, result2, result3}; }
[ "private", "static", "ResultPoint", "[", "]", "expandSquare", "(", "ResultPoint", "[", "]", "cornerPoints", ",", "int", "oldSide", ",", "int", "newSide", ")", "{", "float", "ratio", "=", "newSide", "/", "(", "2.0f", "*", "oldSide", ")", ";", "float", "dx...
Expand the square represented by the corner points by pushing out equally in all directions @param cornerPoints the corners of the square, which has the bull's eye at its center @param oldSide the original length of the side of the square in the target bit matrix @param newSide the new length of the size of the square in the target bit matrix @return the corners of the expanded square
[ "Expand", "the", "square", "represented", "by", "the", "corner", "points", "by", "pushing", "out", "equally", "in", "all", "directions" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L527-L545
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.decodePassword
public static final String decodePassword(byte[] data, byte encryptionCode) { String result; if (data.length < MINIMUM_PASSWORD_DATA_LENGTH) { result = null; } else { MPPUtility.decodeBuffer(data, encryptionCode); StringBuilder buffer = new StringBuilder(); char c; for (int i = 0; i < PASSWORD_MASK.length; i++) { int index = PASSWORD_MASK[i]; c = (char) data[index]; if (c == 0) { break; } buffer.append(c); } result = buffer.toString(); } return (result); }
java
public static final String decodePassword(byte[] data, byte encryptionCode) { String result; if (data.length < MINIMUM_PASSWORD_DATA_LENGTH) { result = null; } else { MPPUtility.decodeBuffer(data, encryptionCode); StringBuilder buffer = new StringBuilder(); char c; for (int i = 0; i < PASSWORD_MASK.length; i++) { int index = PASSWORD_MASK[i]; c = (char) data[index]; if (c == 0) { break; } buffer.append(c); } result = buffer.toString(); } return (result); }
[ "public", "static", "final", "String", "decodePassword", "(", "byte", "[", "]", "data", ",", "byte", "encryptionCode", ")", "{", "String", "result", ";", "if", "(", "data", ".", "length", "<", "MINIMUM_PASSWORD_DATA_LENGTH", ")", "{", "result", "=", "null", ...
Decode the password from the given data. Will decode the data block as well. @param data encrypted data block @param encryptionCode encryption code @return password
[ "Decode", "the", "password", "from", "the", "given", "data", ".", "Will", "decode", "the", "data", "block", "as", "well", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L112-L143
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UISelectMany.java
UISelectMany.setValueExpression
public void setValueExpression(String name, ValueExpression binding) { if ("selectedValues".equals(name)) { super.setValueExpression("value", binding); } else { super.setValueExpression(name, binding); } }
java
public void setValueExpression(String name, ValueExpression binding) { if ("selectedValues".equals(name)) { super.setValueExpression("value", binding); } else { super.setValueExpression(name, binding); } }
[ "public", "void", "setValueExpression", "(", "String", "name", ",", "ValueExpression", "binding", ")", "{", "if", "(", "\"selectedValues\"", ".", "equals", "(", "name", ")", ")", "{", "super", ".", "setValueExpression", "(", "\"value\"", ",", "binding", ")", ...
<p>Store any {@link ValueExpression} specified for <code>selectedValues</code> under <code>value</code> instead; otherwise, perform the default superclass processing for this method.</p> @param name Name of the attribute or property for which to set a {@link ValueExpression} @param binding The {@link ValueExpression} to set, or <code>null</code> to remove any currently set {@link ValueExpression} @throws NullPointerException if <code>name</code> is <code>null</code> @since 1.2
[ "<p", ">", "Store", "any", "{", "@link", "ValueExpression", "}", "specified", "for", "<code", ">", "selectedValues<", "/", "code", ">", "under", "<code", ">", "value<", "/", "code", ">", "instead", ";", "otherwise", "perform", "the", "default", "superclass",...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UISelectMany.java#L407-L415
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java
GeneralStorable.setValue
public void setValue(String field, byte[] value) throws IOException { int hash = Arrays.hashCode(field.getBytes()); if (!structure.valueHash2Index.containsKey(hash)) { throw new IOException("The field " + field + " is unknown."); } setValue(structure.valueHash2Index.get(hash), value); }
java
public void setValue(String field, byte[] value) throws IOException { int hash = Arrays.hashCode(field.getBytes()); if (!structure.valueHash2Index.containsKey(hash)) { throw new IOException("The field " + field + " is unknown."); } setValue(structure.valueHash2Index.get(hash), value); }
[ "public", "void", "setValue", "(", "String", "field", ",", "byte", "[", "]", "value", ")", "throws", "IOException", "{", "int", "hash", "=", "Arrays", ".", "hashCode", "(", "field", ".", "getBytes", "(", ")", ")", ";", "if", "(", "!", "structure", "....
Sets the value belonging to the given field. @param field the name of the field @param value the value to set @throws IOException
[ "Sets", "the", "value", "belonging", "to", "the", "given", "field", "." ]
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStorable.java#L120-L126
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java
SmUtil.rsPlainToAsn1
public static byte[] rsPlainToAsn1(byte[] sign) { if (sign.length != RS_LEN * 2) { throw new CryptoException("err rs. "); } BigInteger r = new BigInteger(1, Arrays.copyOfRange(sign, 0, RS_LEN)); BigInteger s = new BigInteger(1, Arrays.copyOfRange(sign, RS_LEN, RS_LEN * 2)); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1Integer(r)); v.add(new ASN1Integer(s)); try { return new DERSequence(v).getEncoded("DER"); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static byte[] rsPlainToAsn1(byte[] sign) { if (sign.length != RS_LEN * 2) { throw new CryptoException("err rs. "); } BigInteger r = new BigInteger(1, Arrays.copyOfRange(sign, 0, RS_LEN)); BigInteger s = new BigInteger(1, Arrays.copyOfRange(sign, RS_LEN, RS_LEN * 2)); ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new ASN1Integer(r)); v.add(new ASN1Integer(s)); try { return new DERSequence(v).getEncoded("DER"); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "byte", "[", "]", "rsPlainToAsn1", "(", "byte", "[", "]", "sign", ")", "{", "if", "(", "sign", ".", "length", "!=", "RS_LEN", "*", "2", ")", "{", "throw", "new", "CryptoException", "(", "\"err rs. \"", ")", ";", "}", "BigInteger", ...
BC的SM3withSM2验签需要的rs是asn1格式的,这个方法将直接拼接r||s的字节数组转化成asn1格式<br> 来自:https://blog.csdn.net/pridas/article/details/86118774 @param sign in plain byte array @return rs result in asn1 format @since 4.5.0
[ "BC的SM3withSM2验签需要的rs是asn1格式的,这个方法将直接拼接r||s的字节数组转化成asn1格式<br", ">", "来自:https", ":", "//", "blog", ".", "csdn", ".", "net", "/", "pridas", "/", "article", "/", "details", "/", "86118774" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java#L206-L220
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java
CmsSolrSpellchecker.getSpellcheckingResult
public void getSpellcheckingResult( final HttpServletResponse res, final ServletRequest servletRequest, final CmsObject cms) throws CmsPermissionViolationException, IOException { // Perform a permission check performPermissionCheck(cms); // Set the appropriate response headers setResponeHeaders(res); // Figure out whether a JSON or HTTP request has been sent CmsSpellcheckingRequest cmsSpellcheckingRequest = null; try { String requestBody = getRequestBody(servletRequest); final JSONObject jsonRequest = new JSONObject(requestBody); cmsSpellcheckingRequest = parseJsonRequest(jsonRequest); } catch (Exception e) { LOG.debug(e.getMessage(), e); cmsSpellcheckingRequest = parseHttpRequest(servletRequest, cms); } if ((null != cmsSpellcheckingRequest) && cmsSpellcheckingRequest.isInitialized()) { // Perform the actual spellchecking final SpellCheckResponse spellCheckResponse = performSpellcheckQuery(cmsSpellcheckingRequest); /* * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker. * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise, * convert the spellchecker response into a new JSON formatted map. */ if (null == spellCheckResponse) { cmsSpellcheckingRequest.m_wordSuggestions = new JSONObject(); } else { cmsSpellcheckingRequest.m_wordSuggestions = getConvertedResponseAsJson(spellCheckResponse); } } // Send response back to the client sendResponse(res, cmsSpellcheckingRequest); }
java
public void getSpellcheckingResult( final HttpServletResponse res, final ServletRequest servletRequest, final CmsObject cms) throws CmsPermissionViolationException, IOException { // Perform a permission check performPermissionCheck(cms); // Set the appropriate response headers setResponeHeaders(res); // Figure out whether a JSON or HTTP request has been sent CmsSpellcheckingRequest cmsSpellcheckingRequest = null; try { String requestBody = getRequestBody(servletRequest); final JSONObject jsonRequest = new JSONObject(requestBody); cmsSpellcheckingRequest = parseJsonRequest(jsonRequest); } catch (Exception e) { LOG.debug(e.getMessage(), e); cmsSpellcheckingRequest = parseHttpRequest(servletRequest, cms); } if ((null != cmsSpellcheckingRequest) && cmsSpellcheckingRequest.isInitialized()) { // Perform the actual spellchecking final SpellCheckResponse spellCheckResponse = performSpellcheckQuery(cmsSpellcheckingRequest); /* * The field spellCheckResponse is null when exactly one correctly spelled word is passed to the spellchecker. * In this case it's safe to return an empty JSON formatted map, as the passed word is correct. Otherwise, * convert the spellchecker response into a new JSON formatted map. */ if (null == spellCheckResponse) { cmsSpellcheckingRequest.m_wordSuggestions = new JSONObject(); } else { cmsSpellcheckingRequest.m_wordSuggestions = getConvertedResponseAsJson(spellCheckResponse); } } // Send response back to the client sendResponse(res, cmsSpellcheckingRequest); }
[ "public", "void", "getSpellcheckingResult", "(", "final", "HttpServletResponse", "res", ",", "final", "ServletRequest", "servletRequest", ",", "final", "CmsObject", "cms", ")", "throws", "CmsPermissionViolationException", ",", "IOException", "{", "// Perform a permission ch...
Performs spellchecking using Solr and returns the spellchecking results using JSON. @param res The HttpServletResponse object. @param servletRequest The ServletRequest object. @param cms The CmsObject object. @throws CmsPermissionViolationException in case of the anonymous guest user @throws IOException if writing the response fails
[ "Performs", "spellchecking", "using", "Solr", "and", "returns", "the", "spellchecking", "results", "using", "JSON", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSolrSpellchecker.java#L187-L228
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java
RobustLoaderWriterResilienceStrategy.getFailure
@Override public V getFailure(K key, StoreAccessException e) { try { return loaderWriter.load(key); } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } finally { cleanup(key, e); } }
java
@Override public V getFailure(K key, StoreAccessException e) { try { return loaderWriter.load(key); } catch (Exception e1) { throw ExceptionFactory.newCacheLoadingException(e1, e); } finally { cleanup(key, e); } }
[ "@", "Override", "public", "V", "getFailure", "(", "K", "key", ",", "StoreAccessException", "e", ")", "{", "try", "{", "return", "loaderWriter", ".", "load", "(", "key", ")", ";", "}", "catch", "(", "Exception", "e1", ")", "{", "throw", "ExceptionFactory...
Get the value from the loader-writer. @param key the key being retrieved @param e the triggered failure @return value as loaded from the loader-writer
[ "Get", "the", "value", "from", "the", "loader", "-", "writer", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L55-L64
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java
SharedResourcesBrokerUtils.isScopeTypeAncestor
public static <S extends ScopeType<S>> boolean isScopeTypeAncestor(S scopeType, S possibleAncestor) { Queue<S> ancestors = new LinkedList<>(); ancestors.add(scopeType); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } Collection<S> parentScopes = ancestors.poll().parentScopes(); if (parentScopes != null) { ancestors.addAll(parentScopes); } } }
java
public static <S extends ScopeType<S>> boolean isScopeTypeAncestor(S scopeType, S possibleAncestor) { Queue<S> ancestors = new LinkedList<>(); ancestors.add(scopeType); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } Collection<S> parentScopes = ancestors.poll().parentScopes(); if (parentScopes != null) { ancestors.addAll(parentScopes); } } }
[ "public", "static", "<", "S", "extends", "ScopeType", "<", "S", ">", ">", "boolean", "isScopeTypeAncestor", "(", "S", "scopeType", ",", "S", "possibleAncestor", ")", "{", "Queue", "<", "S", ">", "ancestors", "=", "new", "LinkedList", "<>", "(", ")", ";",...
Determine if a {@link ScopeType} is an ancestor of another {@link ScopeType}.
[ "Determine", "if", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java#L41-L56
UrielCh/ovh-java-sdk
ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java
ApiOvhOverTheBox.serviceName_migration_offers_GET
public ArrayList<OvhAvailableMigrationOffer> serviceName_migration_offers_GET(String serviceName) throws IOException { String qPath = "/overTheBox/{serviceName}/migration/offers"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<OvhAvailableMigrationOffer> serviceName_migration_offers_GET(String serviceName) throws IOException { String qPath = "/overTheBox/{serviceName}/migration/offers"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "OvhAvailableMigrationOffer", ">", "serviceName_migration_offers_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/overTheBox/{serviceName}/migration/offers\"", ";", "StringBuilder", "sb", "=", "pa...
List all available offers one can migrate to REST: GET /overTheBox/{serviceName}/migration/offers @param serviceName [required] The internal name of your overTheBox offer API beta
[ "List", "all", "available", "offers", "one", "can", "migrate", "to" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java#L363-L368
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/beans/Permission.java
Permission.addAllUsersToRole
protected void addAllUsersToRole(Set<String> users, String role) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "addAllUsersToRole", new Object[] { users, role }); } Set<String> usersForTheRole = roleToUserMap.get(role); if (usersForTheRole != null) { usersForTheRole.addAll(users); } else { usersForTheRole = users; } roleToUserMap.put(role, usersForTheRole); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "addAllUsersToRole"); } }
java
protected void addAllUsersToRole(Set<String> users, String role) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "addAllUsersToRole", new Object[] { users, role }); } Set<String> usersForTheRole = roleToUserMap.get(role); if (usersForTheRole != null) { usersForTheRole.addAll(users); } else { usersForTheRole = users; } roleToUserMap.put(role, usersForTheRole); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "addAllUsersToRole"); } }
[ "protected", "void", "addAllUsersToRole", "(", "Set", "<", "String", ">", "users", ",", "String", "role", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "e...
Add all the users to a particular role @param users @param role
[ "Add", "all", "the", "users", "to", "a", "particular", "role" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/beans/Permission.java#L126-L140
Cleveroad/AdaptiveTableLayout
library/src/main/java/com/cleveroad/adaptivetablelayout/BaseDataAdaptiveTableLayoutAdapter.java
BaseDataAdaptiveTableLayoutAdapter.switchTwoColumns
void switchTwoColumns(int columnIndex, int columnToIndex) { for (int i = 0; i < getRowCount() - 1; i++) { Object cellData = getItems()[i][columnToIndex]; getItems()[i][columnToIndex] = getItems()[i][columnIndex]; getItems()[i][columnIndex] = cellData; } }
java
void switchTwoColumns(int columnIndex, int columnToIndex) { for (int i = 0; i < getRowCount() - 1; i++) { Object cellData = getItems()[i][columnToIndex]; getItems()[i][columnToIndex] = getItems()[i][columnIndex]; getItems()[i][columnIndex] = cellData; } }
[ "void", "switchTwoColumns", "(", "int", "columnIndex", ",", "int", "columnToIndex", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getRowCount", "(", ")", "-", "1", ";", "i", "++", ")", "{", "Object", "cellData", "=", "getItems", "(", ...
Switch 2 columns with data @param columnIndex column from @param columnToIndex column to
[ "Switch", "2", "columns", "with", "data" ]
train
https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/BaseDataAdaptiveTableLayoutAdapter.java#L35-L41
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.getBoolean
public boolean getBoolean(Enum<?> key, boolean defaultValue) { if (key == null) { return defaultValue; } return getBoolean(key.name(), defaultValue); }
java
public boolean getBoolean(Enum<?> key, boolean defaultValue) { if (key == null) { return defaultValue; } return getBoolean(key.name(), defaultValue); }
[ "public", "boolean", "getBoolean", "(", "Enum", "<", "?", ">", "key", ",", "boolean", "defaultValue", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "getBoolean", "(", "key", ".", "name", "(", ")", "...
Equivalent to {@link #getBoolean(String, boolean) getBoolean}{@code (key.name(), defaultValue)}. If {@code key} is null, {@code defaultValue} is returned.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L103-L111
to2mbn/JMCCC
jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java
JSONArray.optBigDecimal
public BigDecimal optBigDecimal(int index, BigDecimal defaultValue) { try { return this.getBigDecimal(index); } catch (Exception e) { return defaultValue; } }
java
public BigDecimal optBigDecimal(int index, BigDecimal defaultValue) { try { return this.getBigDecimal(index); } catch (Exception e) { return defaultValue; } }
[ "public", "BigDecimal", "optBigDecimal", "(", "int", "index", ",", "BigDecimal", "defaultValue", ")", "{", "try", "{", "return", "this", ".", "getBigDecimal", "(", "index", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ...
Get the optional BigDecimal value associated with an index. The defaultValue is returned if there is no value for the index, or if the value is not a number and cannot be converted to a number. @param index The index must be between 0 and length() - 1. @param defaultValue The default value. @return The value.
[ "Get", "the", "optional", "BigDecimal", "value", "associated", "with", "an", "index", ".", "The", "defaultValue", "is", "returned", "if", "there", "is", "no", "value", "for", "the", "index", "or", "if", "the", "value", "is", "not", "a", "number", "and", ...
train
https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/internal/org/json/JSONArray.java#L592-L598
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java
SSLTransportParameters.setKeyStore
public void setKeyStore(String keyStore, String keyPass) { setKeyStore(keyStore, keyPass, null, null); }
java
public void setKeyStore(String keyStore, String keyPass) { setKeyStore(keyStore, keyPass, null, null); }
[ "public", "void", "setKeyStore", "(", "String", "keyStore", ",", "String", "keyPass", ")", "{", "setKeyStore", "(", "keyStore", ",", "keyPass", ",", "null", ",", "null", ")", ";", "}" ]
Set the keystore and password @param keyStore Location of the Keystore on disk @param keyPass Keystore password
[ "Set", "the", "keystore", "and", "password" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java#L213-L216
landawn/AbacusUtil
src/com/landawn/abacus/util/ExceptionalStream.java
ExceptionalStream.rows
public static <T> ExceptionalStream<T, SQLException> rows(final ResultSet resultSet, final String columnName) { N.checkArgNotNull(resultSet, "resultSet"); N.checkArgNotNull(columnName, "columnName"); return rows(resultSet, getColumnIndex(resultSet, columnName)); }
java
public static <T> ExceptionalStream<T, SQLException> rows(final ResultSet resultSet, final String columnName) { N.checkArgNotNull(resultSet, "resultSet"); N.checkArgNotNull(columnName, "columnName"); return rows(resultSet, getColumnIndex(resultSet, columnName)); }
[ "public", "static", "<", "T", ">", "ExceptionalStream", "<", "T", ",", "SQLException", ">", "rows", "(", "final", "ResultSet", "resultSet", ",", "final", "String", "columnName", ")", "{", "N", ".", "checkArgNotNull", "(", "resultSet", ",", "\"resultSet\"", "...
It's user's responsibility to close the input <code>resultSet</code> after the stream is finished. @param resultSet @param columnName @return
[ "It", "s", "user", "s", "responsibility", "to", "close", "the", "input", "<code", ">", "resultSet<", "/", "code", ">", "after", "the", "stream", "is", "finished", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ExceptionalStream.java#L768-L773
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuModuleGetTexRef
public static int cuModuleGetTexRef(CUtexref pTexRef, CUmodule hmod, String name) { return checkResult(cuModuleGetTexRefNative(pTexRef, hmod, name)); }
java
public static int cuModuleGetTexRef(CUtexref pTexRef, CUmodule hmod, String name) { return checkResult(cuModuleGetTexRefNative(pTexRef, hmod, name)); }
[ "public", "static", "int", "cuModuleGetTexRef", "(", "CUtexref", "pTexRef", ",", "CUmodule", "hmod", ",", "String", "name", ")", "{", "return", "checkResult", "(", "cuModuleGetTexRefNative", "(", "pTexRef", ",", "hmod", ",", "name", ")", ")", ";", "}" ]
Returns a handle to a texture reference. <pre> CUresult cuModuleGetTexRef ( CUtexref* pTexRef, CUmodule hmod, const char* name ) </pre> <div> <p>Returns a handle to a texture reference. Returns in <tt>*pTexRef</tt> the handle of the texture reference of name <tt>name</tt> in the module <tt>hmod</tt>. If no texture reference of that name exists, cuModuleGetTexRef() returns CUDA_ERROR_NOT_FOUND. This texture reference handle should not be destroyed, since it will be destroyed when the module is unloaded. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param pTexRef Returned texture reference @param hmod Module to retrieve texture reference from @param name Name of texture reference to retrieve @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_FOUND @see JCudaDriver#cuModuleGetFunction @see JCudaDriver#cuModuleGetGlobal @see JCudaDriver#cuModuleGetSurfRef @see JCudaDriver#cuModuleLoad @see JCudaDriver#cuModuleLoadData @see JCudaDriver#cuModuleLoadDataEx @see JCudaDriver#cuModuleLoadFatBinary @see JCudaDriver#cuModuleUnload
[ "Returns", "a", "handle", "to", "a", "texture", "reference", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L2688-L2691
nominanuda/zen-project
zen-core/src/main/java/com/nominanuda/zen/xml/DOMBuilder.java
DOMBuilder.ignorableWhitespace
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { if (isOutsideDocElem()) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createTextNode(s)); }
java
public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { if (isOutsideDocElem()) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createTextNode(s)); }
[ "public", "void", "ignorableWhitespace", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ")", "throws", "SAXException", "{", "if", "(", "isOutsideDocElem", "(", ")", ")", "return", ";", "// avoid DOM006 Hierarchy request error", "String",...
Receive notification of ignorable whitespace in element content. <p> Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models. </p> <p> SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information. </p> <p> The application must not attempt to read from the array outside of the specified range. </p> @param ch The characters from the XML document. @param start The start position in the array. @param length The number of characters to read from the array. @see #characters
[ "Receive", "notification", "of", "ignorable", "whitespace", "in", "element", "content", "." ]
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/xml/DOMBuilder.java#L565-L573
grails/grails-core
grails-encoder/src/main/groovy/org/grails/encoder/DefaultEncodingStateRegistry.java
DefaultEncodingStateRegistry.isPreviousEncoderSafeOrEqual
public static boolean isPreviousEncoderSafeOrEqual(Encoder encoderToApply, Encoder previousEncoder) { return previousEncoder == encoderToApply || !encoderToApply.isApplyToSafelyEncoded() && previousEncoder.isSafe() && encoderToApply.isSafe() || previousEncoder.getCodecIdentifier().isEquivalent(encoderToApply.getCodecIdentifier()); }
java
public static boolean isPreviousEncoderSafeOrEqual(Encoder encoderToApply, Encoder previousEncoder) { return previousEncoder == encoderToApply || !encoderToApply.isApplyToSafelyEncoded() && previousEncoder.isSafe() && encoderToApply.isSafe() || previousEncoder.getCodecIdentifier().isEquivalent(encoderToApply.getCodecIdentifier()); }
[ "public", "static", "boolean", "isPreviousEncoderSafeOrEqual", "(", "Encoder", "encoderToApply", ",", "Encoder", "previousEncoder", ")", "{", "return", "previousEncoder", "==", "encoderToApply", "||", "!", "encoderToApply", ".", "isApplyToSafelyEncoded", "(", ")", "&&",...
Checks if is previous encoder is already "safe", equal or equivalent @param encoderToApply the encoder to apply @param previousEncoder the previous encoder @return true, if previous encoder is already "safe", equal or equivalent
[ "Checks", "if", "is", "previous", "encoder", "is", "already", "safe", "equal", "or", "equivalent" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/encoder/DefaultEncodingStateRegistry.java#L125-L128
ops4j/org.ops4j.pax.wicket
spi/springdm/src/main/java/org/ops4j/pax/wicket/spi/springdm/injection/spring/AbstractSpringBeanDefinitionParser.java
AbstractSpringBeanDefinitionParser.addPropertyReferenceFromElement
protected void addPropertyReferenceFromElement(String id, Element element, BeanDefinitionBuilder bean) { String beanElement = element.getAttribute(id); bean.addPropertyReference(id, beanElement); }
java
protected void addPropertyReferenceFromElement(String id, Element element, BeanDefinitionBuilder bean) { String beanElement = element.getAttribute(id); bean.addPropertyReference(id, beanElement); }
[ "protected", "void", "addPropertyReferenceFromElement", "(", "String", "id", ",", "Element", "element", ",", "BeanDefinitionBuilder", "bean", ")", "{", "String", "beanElement", "=", "element", ".", "getAttribute", "(", "id", ")", ";", "bean", ".", "addPropertyRefe...
<p>addPropertyReferenceFromElement.</p> @param id a {@link java.lang.String} object. @param element a {@link org.w3c.dom.Element} object. @param bean a {@link org.springframework.beans.factory.support.BeanDefinitionBuilder} object.
[ "<p", ">", "addPropertyReferenceFromElement", ".", "<", "/", "p", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/spi/springdm/src/main/java/org/ops4j/pax/wicket/spi/springdm/injection/spring/AbstractSpringBeanDefinitionParser.java#L79-L82
aws/aws-sdk-java
aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateDeploymentJobRequest.java
CreateDeploymentJobRequest.withTags
public CreateDeploymentJobRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateDeploymentJobRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateDeploymentJobRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> A map that contains tag keys and tag values that are attached to the deployment job. </p> @param tags A map that contains tag keys and tag values that are attached to the deployment job. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "that", "contains", "tag", "keys", "and", "tag", "values", "that", "are", "attached", "to", "the", "deployment", "job", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateDeploymentJobRequest.java#L284-L287
alkacon/opencms-core
src/org/opencms/ui/components/editablegroup/CmsEditableGroupButtons.java
CmsEditableGroupButtons.setFirstLast
public void setFirstLast(boolean first, boolean last, boolean hideAdd) { CmsEditableGroupButtonsState state = (CmsEditableGroupButtonsState)getState(false); if ((state.isFirst() != first) || (state.isLast() != last)) { state.setFirst(first); state.setLast(last); state.setAddOptionHidden(hideAdd); markAsDirty(); } }
java
public void setFirstLast(boolean first, boolean last, boolean hideAdd) { CmsEditableGroupButtonsState state = (CmsEditableGroupButtonsState)getState(false); if ((state.isFirst() != first) || (state.isLast() != last)) { state.setFirst(first); state.setLast(last); state.setAddOptionHidden(hideAdd); markAsDirty(); } }
[ "public", "void", "setFirstLast", "(", "boolean", "first", ",", "boolean", "last", ",", "boolean", "hideAdd", ")", "{", "CmsEditableGroupButtonsState", "state", "=", "(", "CmsEditableGroupButtonsState", ")", "getState", "(", "false", ")", ";", "if", "(", "(", ...
Sets the 'first' and 'last' status of the button bar.<p> @param first true if this is the button bar of the first row @param last true if this is the button bar of the last row @param hideAdd true -> hide add option
[ "Sets", "the", "first", "and", "last", "status", "of", "the", "button", "bar", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroupButtons.java#L106-L115
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.blockingTaskExecutor
public ServerBuilder blockingTaskExecutor(Executor blockingTaskExecutor, boolean shutdownOnStop) { this.blockingTaskExecutor = requireNonNull(blockingTaskExecutor, "blockingTaskExecutor"); shutdownBlockingTaskExecutorOnStop = shutdownOnStop; return this; }
java
public ServerBuilder blockingTaskExecutor(Executor blockingTaskExecutor, boolean shutdownOnStop) { this.blockingTaskExecutor = requireNonNull(blockingTaskExecutor, "blockingTaskExecutor"); shutdownBlockingTaskExecutorOnStop = shutdownOnStop; return this; }
[ "public", "ServerBuilder", "blockingTaskExecutor", "(", "Executor", "blockingTaskExecutor", ",", "boolean", "shutdownOnStop", ")", "{", "this", ".", "blockingTaskExecutor", "=", "requireNonNull", "(", "blockingTaskExecutor", ",", "\"blockingTaskExecutor\"", ")", ";", "shu...
Sets the {@link Executor} dedicated to the execution of blocking tasks or invocations. If not set, {@linkplain CommonPools#blockingTaskExecutor() the common pool} is used. @param shutdownOnStop whether to shut down the {@link Executor} when the {@link Server} stops
[ "Sets", "the", "{", "@link", "Executor", "}", "dedicated", "to", "the", "execution", "of", "blocking", "tasks", "or", "invocations", ".", "If", "not", "set", "{", "@linkplain", "CommonPools#blockingTaskExecutor", "()", "the", "common", "pool", "}", "is", "used...
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L667-L671
rapidpro/expressions
java/src/main/java/io/rapidpro/expressions/utils/Parameter.java
Parameter.fromMethod
public static Parameter[] fromMethod(Method method) { Class<?>[] types = method.getParameterTypes(); Annotation[][] annotations = method.getParameterAnnotations(); int numParams = types.length; Parameter[] params = new Parameter[numParams]; for (int p = 0; p < numParams; p++) { params[p] = new Parameter(types[p], annotations[p]); } return params; }
java
public static Parameter[] fromMethod(Method method) { Class<?>[] types = method.getParameterTypes(); Annotation[][] annotations = method.getParameterAnnotations(); int numParams = types.length; Parameter[] params = new Parameter[numParams]; for (int p = 0; p < numParams; p++) { params[p] = new Parameter(types[p], annotations[p]); } return params; }
[ "public", "static", "Parameter", "[", "]", "fromMethod", "(", "Method", "method", ")", "{", "Class", "<", "?", ">", "[", "]", "types", "=", "method", ".", "getParameterTypes", "(", ")", ";", "Annotation", "[", "]", "[", "]", "annotations", "=", "method...
Returns an array of Parameter objects that represent all the parameters to the underlying method
[ "Returns", "an", "array", "of", "Parameter", "objects", "that", "represent", "all", "the", "parameters", "to", "the", "underlying", "method" ]
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/utils/Parameter.java#L23-L33
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java
AbstractNewSarlElementWizardPage.isFileExists
protected static boolean isFileExists(IPackageFragment packageFragment, String filename, String extension) { if (packageFragment != null) { final IResource resource = packageFragment.getResource(); if (resource instanceof IFolder) { final IFolder folder = (IFolder) resource; if (folder.getFile(filename + "." + extension).exists()) { //$NON-NLS-1$ return true; } } } return false; }
java
protected static boolean isFileExists(IPackageFragment packageFragment, String filename, String extension) { if (packageFragment != null) { final IResource resource = packageFragment.getResource(); if (resource instanceof IFolder) { final IFolder folder = (IFolder) resource; if (folder.getFile(filename + "." + extension).exists()) { //$NON-NLS-1$ return true; } } } return false; }
[ "protected", "static", "boolean", "isFileExists", "(", "IPackageFragment", "packageFragment", ",", "String", "filename", ",", "String", "extension", ")", "{", "if", "(", "packageFragment", "!=", "null", ")", "{", "final", "IResource", "resource", "=", "packageFrag...
Replies if the given filename is a SARL script in the given package. @param packageFragment the package in which the file should be search for. @param filename the filename to test. @param extension the filename extension to search for. @return <code>true</code> if a file (SARL or Java) with the given name exists.
[ "Replies", "if", "the", "given", "filename", "is", "a", "SARL", "script", "in", "the", "given", "package", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractNewSarlElementWizardPage.java#L375-L386
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java
RecoveryDirectorImpl.driveCallBacks
private void driveCallBacks(int stage, FailureScope failureScope) { if (tc.isEntryEnabled()) { switch (stage) { case CALLBACK_RECOVERYSTARTED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYSTARTED", failureScope }); break; case CALLBACK_RECOVERYCOMPLETE: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYCOMPLETE", failureScope }); break; case CALLBACK_TERMINATIONSTARTED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_TERMINATIONSTARTED", failureScope }); break; case CALLBACK_TERMINATIONCOMPLETE: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_TERMINATIONCOMPLETE", failureScope }); break; case CALLBACK_RECOVERYFAILED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYFAILED", failureScope }); break; default: Tr.entry(tc, "driveCallBacks", new Object[] { new Integer(stage), failureScope }); break; } } if (_registeredCallbacks != null) { final Iterator registeredCallbacksIterator = _registeredCallbacks.iterator(); while (registeredCallbacksIterator.hasNext()) { final RecoveryLogCallBack callBack = (RecoveryLogCallBack) registeredCallbacksIterator.next(); switch (stage) { case CALLBACK_RECOVERYSTARTED: callBack.recoveryStarted(failureScope); break; case CALLBACK_RECOVERYCOMPLETE: case CALLBACK_RECOVERYFAILED: callBack.recoveryCompleted(failureScope); break; case CALLBACK_TERMINATIONSTARTED: callBack.terminateStarted(failureScope); break; case CALLBACK_TERMINATIONCOMPLETE: callBack.terminateCompleted(failureScope); break; } } } if (tc.isEntryEnabled()) Tr.exit(tc, "driveCallBacks"); }
java
private void driveCallBacks(int stage, FailureScope failureScope) { if (tc.isEntryEnabled()) { switch (stage) { case CALLBACK_RECOVERYSTARTED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYSTARTED", failureScope }); break; case CALLBACK_RECOVERYCOMPLETE: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYCOMPLETE", failureScope }); break; case CALLBACK_TERMINATIONSTARTED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_TERMINATIONSTARTED", failureScope }); break; case CALLBACK_TERMINATIONCOMPLETE: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_TERMINATIONCOMPLETE", failureScope }); break; case CALLBACK_RECOVERYFAILED: Tr.entry(tc, "driveCallBacks", new Object[] { "CALLBACK_RECOVERYFAILED", failureScope }); break; default: Tr.entry(tc, "driveCallBacks", new Object[] { new Integer(stage), failureScope }); break; } } if (_registeredCallbacks != null) { final Iterator registeredCallbacksIterator = _registeredCallbacks.iterator(); while (registeredCallbacksIterator.hasNext()) { final RecoveryLogCallBack callBack = (RecoveryLogCallBack) registeredCallbacksIterator.next(); switch (stage) { case CALLBACK_RECOVERYSTARTED: callBack.recoveryStarted(failureScope); break; case CALLBACK_RECOVERYCOMPLETE: case CALLBACK_RECOVERYFAILED: callBack.recoveryCompleted(failureScope); break; case CALLBACK_TERMINATIONSTARTED: callBack.terminateStarted(failureScope); break; case CALLBACK_TERMINATIONCOMPLETE: callBack.terminateCompleted(failureScope); break; } } } if (tc.isEntryEnabled()) Tr.exit(tc, "driveCallBacks"); }
[ "private", "void", "driveCallBacks", "(", "int", "stage", ",", "FailureScope", "failureScope", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "switch", "(", "stage", ")", "{", "case", "CALLBACK_RECOVERYSTARTED", ":", "Tr", ".", "entr...
<p> Internal method to drive a callback operation onto registered callback objects. Available 'stage' values are defined in this class and consist of the following: </p> <p> <ul> <li>CALLBACK_RECOVERYSTARTED</li> <li>CALLBACK_RECOVERYCOMPLETE</li> <li>CALLBACK_TERMINATIONSTARTED</li> <li>CALLBACK_TERMINATIONCOMPLETE</li> <li>CALLBACK_RECOVERYFAILED</li> </ul> </p> @param stage The required callback stage. @param failureScope The failure scope for which the event is taking place.
[ "<p", ">", "Internal", "method", "to", "drive", "a", "callback", "operation", "onto", "registered", "callback", "objects", ".", "Available", "stage", "values", "are", "defined", "in", "this", "class", "and", "consist", "of", "the", "following", ":", "<", "/"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L1551-L1604
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/DisplayUtil.java
DisplayUtil.pixelsToDp
public static int pixelsToDp(@NonNull final Context context, final int pixels) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(pixels / (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
java
public static int pixelsToDp(@NonNull final Context context, final int pixels) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(pixels / (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
[ "public", "static", "int", "pixelsToDp", "(", "@", "NonNull", "final", "Context", "context", ",", "final", "int", "pixels", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "context", ",", "\"The context may not be null\"", ")", ";", "DisplayMe...
Converts an {@link Integer} value, which is measured in pixels, into a value, which is measured in dp. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param pixels The pixel value, which should be converted, as an {@link Integer} value @return The calculated dp value as an {@link Integer} value. The value might be rounded
[ "Converts", "an", "{", "@link", "Integer", "}", "value", "which", "is", "measured", "in", "pixels", "into", "a", "value", "which", "is", "measured", "in", "dp", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/DisplayUtil.java#L147-L151
hankcs/HanLP
src/main/java/com/hankcs/hanlp/HanLP.java
HanLP.extractWords
public static List<WordInfo> extractWords(BufferedReader reader, int size, boolean newWordsOnly, int max_word_len, float min_freq, float min_entropy, float min_aggregation) throws IOException { NewWordDiscover discover = new NewWordDiscover(max_word_len, min_freq, min_entropy, min_aggregation, newWordsOnly); return discover.discover(reader, size); }
java
public static List<WordInfo> extractWords(BufferedReader reader, int size, boolean newWordsOnly, int max_word_len, float min_freq, float min_entropy, float min_aggregation) throws IOException { NewWordDiscover discover = new NewWordDiscover(max_word_len, min_freq, min_entropy, min_aggregation, newWordsOnly); return discover.discover(reader, size); }
[ "public", "static", "List", "<", "WordInfo", ">", "extractWords", "(", "BufferedReader", "reader", ",", "int", "size", ",", "boolean", "newWordsOnly", ",", "int", "max_word_len", ",", "float", "min_freq", ",", "float", "min_entropy", ",", "float", "min_aggregati...
提取词语(新词发现) @param reader 从reader获取文本 @param size 需要提取词语的数量 @param newWordsOnly 是否只提取词典中没有的词语 @param max_word_len 词语最长长度 @param min_freq 词语最低频率 @param min_entropy 词语最低熵 @param min_aggregation 词语最低互信息 @return 一个词语列表
[ "提取词语(新词发现)" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L789-L793
wcm-io/wcm-io-wcm
commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java
CacheHeader.isNotModified
public static boolean isNotModified(@NotNull Resource resource, @NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException { ResourceModificationDateProvider dateProvider = new ResourceModificationDateProvider(resource); return isNotModified(dateProvider, request, response); }
java
public static boolean isNotModified(@NotNull Resource resource, @NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException { ResourceModificationDateProvider dateProvider = new ResourceModificationDateProvider(resource); return isNotModified(dateProvider, request, response); }
[ "public", "static", "boolean", "isNotModified", "(", "@", "NotNull", "Resource", "resource", ",", "@", "NotNull", "SlingHttpServletRequest", "request", ",", "@", "NotNull", "SlingHttpServletResponse", "response", ")", "throws", "IOException", "{", "ResourceModificationD...
Compares the "If-Modified-Since header" of the incoming request with the last modification date of a resource. If the resource was not modified since the client retrieved the resource, a 304-redirect is send to the response (and the method returns true). If the resource has changed (or the client didn't) supply the "If-Modified-Since" header a "Last-Modified" header is set so future requests can be cached. <p> Expires header is automatically set on author instance, and not set on publish instance. </p> @param resource the JCR resource the last modification date is taken from @param request Request @param response Response @return true if the method send a 304 redirect, so that the caller shouldn't write any output to the response stream @throws IOException I/O exception
[ "Compares", "the", "If", "-", "Modified", "-", "Since", "header", "of", "the", "incoming", "request", "with", "the", "last", "modification", "date", "of", "a", "resource", ".", "If", "the", "resource", "was", "not", "modified", "since", "the", "client", "r...
train
https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java#L99-L103
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java
AWSUtil.getCredentialsProvider
private static AWSCredentialsProvider getCredentialsProvider(final Properties configProps, final String configPrefix) { CredentialProvider credentialProviderType; if (!configProps.containsKey(configPrefix)) { if (configProps.containsKey(AWSConfigConstants.accessKeyId(configPrefix)) && configProps.containsKey(AWSConfigConstants.secretKey(configPrefix))) { // if the credential provider type is not specified, but the Access Key ID and Secret Key are given, it will default to BASIC credentialProviderType = CredentialProvider.BASIC; } else { // if the credential provider type is not specified, it will default to AUTO credentialProviderType = CredentialProvider.AUTO; } } else { credentialProviderType = CredentialProvider.valueOf(configProps.getProperty(configPrefix)); } switch (credentialProviderType) { case ENV_VAR: return new EnvironmentVariableCredentialsProvider(); case SYS_PROP: return new SystemPropertiesCredentialsProvider(); case PROFILE: String profileName = configProps.getProperty( AWSConfigConstants.profileName(configPrefix), null); String profileConfigPath = configProps.getProperty( AWSConfigConstants.profilePath(configPrefix), null); return (profileConfigPath == null) ? new ProfileCredentialsProvider(profileName) : new ProfileCredentialsProvider(profileConfigPath, profileName); case BASIC: return new AWSCredentialsProvider() { @Override public AWSCredentials getCredentials() { return new BasicAWSCredentials( configProps.getProperty(AWSConfigConstants.accessKeyId(configPrefix)), configProps.getProperty(AWSConfigConstants.secretKey(configPrefix))); } @Override public void refresh() { // do nothing } }; case ASSUME_ROLE: final AWSSecurityTokenService baseCredentials = AWSSecurityTokenServiceClientBuilder.standard() .withCredentials(getCredentialsProvider(configProps, AWSConfigConstants.roleCredentialsProvider(configPrefix))) .withRegion(configProps.getProperty(AWSConfigConstants.AWS_REGION)) .build(); return new STSAssumeRoleSessionCredentialsProvider.Builder( configProps.getProperty(AWSConfigConstants.roleArn(configPrefix)), configProps.getProperty(AWSConfigConstants.roleSessionName(configPrefix))) .withExternalId(configProps.getProperty(AWSConfigConstants.externalId(configPrefix))) .withStsClient(baseCredentials) .build(); default: case AUTO: return new DefaultAWSCredentialsProviderChain(); } }
java
private static AWSCredentialsProvider getCredentialsProvider(final Properties configProps, final String configPrefix) { CredentialProvider credentialProviderType; if (!configProps.containsKey(configPrefix)) { if (configProps.containsKey(AWSConfigConstants.accessKeyId(configPrefix)) && configProps.containsKey(AWSConfigConstants.secretKey(configPrefix))) { // if the credential provider type is not specified, but the Access Key ID and Secret Key are given, it will default to BASIC credentialProviderType = CredentialProvider.BASIC; } else { // if the credential provider type is not specified, it will default to AUTO credentialProviderType = CredentialProvider.AUTO; } } else { credentialProviderType = CredentialProvider.valueOf(configProps.getProperty(configPrefix)); } switch (credentialProviderType) { case ENV_VAR: return new EnvironmentVariableCredentialsProvider(); case SYS_PROP: return new SystemPropertiesCredentialsProvider(); case PROFILE: String profileName = configProps.getProperty( AWSConfigConstants.profileName(configPrefix), null); String profileConfigPath = configProps.getProperty( AWSConfigConstants.profilePath(configPrefix), null); return (profileConfigPath == null) ? new ProfileCredentialsProvider(profileName) : new ProfileCredentialsProvider(profileConfigPath, profileName); case BASIC: return new AWSCredentialsProvider() { @Override public AWSCredentials getCredentials() { return new BasicAWSCredentials( configProps.getProperty(AWSConfigConstants.accessKeyId(configPrefix)), configProps.getProperty(AWSConfigConstants.secretKey(configPrefix))); } @Override public void refresh() { // do nothing } }; case ASSUME_ROLE: final AWSSecurityTokenService baseCredentials = AWSSecurityTokenServiceClientBuilder.standard() .withCredentials(getCredentialsProvider(configProps, AWSConfigConstants.roleCredentialsProvider(configPrefix))) .withRegion(configProps.getProperty(AWSConfigConstants.AWS_REGION)) .build(); return new STSAssumeRoleSessionCredentialsProvider.Builder( configProps.getProperty(AWSConfigConstants.roleArn(configPrefix)), configProps.getProperty(AWSConfigConstants.roleSessionName(configPrefix))) .withExternalId(configProps.getProperty(AWSConfigConstants.externalId(configPrefix))) .withStsClient(baseCredentials) .build(); default: case AUTO: return new DefaultAWSCredentialsProviderChain(); } }
[ "private", "static", "AWSCredentialsProvider", "getCredentialsProvider", "(", "final", "Properties", "configProps", ",", "final", "String", "configPrefix", ")", "{", "CredentialProvider", "credentialProviderType", ";", "if", "(", "!", "configProps", ".", "containsKey", ...
If the provider is ASSUME_ROLE, then the credentials for assuming this role are determined recursively. @param configProps the configuration properties @param configPrefix the prefix of the config properties for this credentials provider, e.g. aws.credentials.provider for the base credentials provider, aws.credentials.provider.role.provider for the credentials provider for assuming a role, and so on.
[ "If", "the", "provider", "is", "ASSUME_ROLE", "then", "the", "credentials", "for", "assuming", "this", "role", "are", "determined", "recursively", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java#L118-L180
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/GetStageResult.java
GetStageResult.withStageVariables
public GetStageResult withStageVariables(java.util.Map<String, String> stageVariables) { setStageVariables(stageVariables); return this; }
java
public GetStageResult withStageVariables(java.util.Map<String, String> stageVariables) { setStageVariables(stageVariables); return this; }
[ "public", "GetStageResult", "withStageVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "stageVariables", ")", "{", "setStageVariables", "(", "stageVariables", ")", ";", "return", "this", ";", "}" ]
<p> A map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+. </p> @param stageVariables A map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "that", "defines", "the", "stage", "variables", "for", "a", "stage", "resource", ".", "Variable", "names", "can", "have", "alphanumeric", "and", "underscore", "characters", "and", "the", "values", "must", "match", "[", "A", "-", "Za"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/GetStageResult.java#L505-L508
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRActivity.java
LRActivity.addActor
public boolean addActor(String objectType, String displayName, String url, String[] description) { Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } else { return false; } if (displayName != null) { container.put("displayName", displayName); } if (url != null) { container.put("url", url); } if (description != null && description.length > 0) { container.put("description", description); } return addChild("actor", container, null); }
java
public boolean addActor(String objectType, String displayName, String url, String[] description) { Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } else { return false; } if (displayName != null) { container.put("displayName", displayName); } if (url != null) { container.put("url", url); } if (description != null && description.length > 0) { container.put("description", description); } return addChild("actor", container, null); }
[ "public", "boolean", "addActor", "(", "String", "objectType", ",", "String", "displayName", ",", "String", "url", ",", "String", "[", "]", "description", ")", "{", "Map", "<", "String", ",", "Object", ">", "container", "=", "new", "HashMap", "<", "String",...
Add an actor object to this activity @param objectType The type of actor (required) @param displayName Name of the actor @param url URL of a page representing the actor @param description Array of descriptiosn of this actor @return True if added, false if not (due to missing required fields)
[ "Add", "an", "actor", "object", "to", "this", "activity" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L339-L365
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java
ManagedServer.callbackUnregistered
boolean callbackUnregistered(final TransactionalProtocolClient old, final boolean shuttingDown) { // Disconnect the remote connection. // WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't // be informed that the channel has closed protocolClient.disconnected(old); synchronized (this) { // If the connection dropped without us stopping the process ask for reconnection if (!shuttingDown && requiredState == InternalState.SERVER_STARTED) { final InternalState state = internalState; if (state == InternalState.PROCESS_STOPPED || state == InternalState.PROCESS_STOPPING || state == InternalState.STOPPED) { // In case it stopped we don't reconnect return true; } // In case we are reloading, it will reconnect automatically if (state == InternalState.RELOADING) { return true; } try { ROOT_LOGGER.logf(DEBUG_LEVEL, "trying to reconnect to %s current-state (%s) required-state (%s)", serverName, state, requiredState); internalSetState(new ReconnectTask(), state, InternalState.SEND_STDIN); } catch (Exception e) { ROOT_LOGGER.logf(DEBUG_LEVEL, e, "failed to send reconnect task"); } return false; } else { return true; } } }
java
boolean callbackUnregistered(final TransactionalProtocolClient old, final boolean shuttingDown) { // Disconnect the remote connection. // WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't // be informed that the channel has closed protocolClient.disconnected(old); synchronized (this) { // If the connection dropped without us stopping the process ask for reconnection if (!shuttingDown && requiredState == InternalState.SERVER_STARTED) { final InternalState state = internalState; if (state == InternalState.PROCESS_STOPPED || state == InternalState.PROCESS_STOPPING || state == InternalState.STOPPED) { // In case it stopped we don't reconnect return true; } // In case we are reloading, it will reconnect automatically if (state == InternalState.RELOADING) { return true; } try { ROOT_LOGGER.logf(DEBUG_LEVEL, "trying to reconnect to %s current-state (%s) required-state (%s)", serverName, state, requiredState); internalSetState(new ReconnectTask(), state, InternalState.SEND_STDIN); } catch (Exception e) { ROOT_LOGGER.logf(DEBUG_LEVEL, e, "failed to send reconnect task"); } return false; } else { return true; } } }
[ "boolean", "callbackUnregistered", "(", "final", "TransactionalProtocolClient", "old", ",", "final", "boolean", "shuttingDown", ")", "{", "// Disconnect the remote connection.", "// WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't", "// be inform...
Unregister the mgmt channel. @param old the proxy controller to unregister @param shuttingDown whether the server inventory is shutting down @return whether the registration can be removed from the domain-controller
[ "Unregister", "the", "mgmt", "channel", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L465-L496
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationFull.java
DatabaseInformationFull.SYSTEM_UDTS
Table SYSTEM_UDTS() { Table t = sysTables[SYSTEM_UDTS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_UDTS]); addColumn(t, "TYPE_CAT", SQL_IDENTIFIER); addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER); addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null addColumn(t, "CLASS_NAME", CHARACTER_DATA); // not null addColumn(t, "DATA_TYPE", SQL_IDENTIFIER); // not null addColumn(t, "REMARKS", CHARACTER_DATA); addColumn(t, "BASE_TYPE", Type.SQL_SMALLINT); // HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_UDTS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, null, false); return t; } return t; }
java
Table SYSTEM_UDTS() { Table t = sysTables[SYSTEM_UDTS]; if (t == null) { t = createBlankTable(sysTableHsqlNames[SYSTEM_UDTS]); addColumn(t, "TYPE_CAT", SQL_IDENTIFIER); addColumn(t, "TYPE_SCHEM", SQL_IDENTIFIER); addColumn(t, "TYPE_NAME", SQL_IDENTIFIER); // not null addColumn(t, "CLASS_NAME", CHARACTER_DATA); // not null addColumn(t, "DATA_TYPE", SQL_IDENTIFIER); // not null addColumn(t, "REMARKS", CHARACTER_DATA); addColumn(t, "BASE_TYPE", Type.SQL_SMALLINT); // HsqlName name = HsqlNameManager.newInfoSchemaObjectName( sysTableHsqlNames[SYSTEM_UDTS].name, false, SchemaObject.INDEX); t.createPrimaryKey(name, null, false); return t; } return t; }
[ "Table", "SYSTEM_UDTS", "(", ")", "{", "Table", "t", "=", "sysTables", "[", "SYSTEM_UDTS", "]", ";", "if", "(", "t", "==", "null", ")", "{", "t", "=", "createBlankTable", "(", "sysTableHsqlNames", "[", "SYSTEM_UDTS", "]", ")", ";", "addColumn", "(", "t...
Retrieves a <code>Table</code> object describing the accessible user-defined types defined in this database. <p> Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. <P>Each row is a UDT descripion with the following columns: <OL> <LI><B>TYPE_CAT</B> <code>VARCHAR</code> => the type's catalog <LI><B>TYPE_SCHEM</B> <code>VARCHAR</code> => type's schema <LI><B>TYPE_NAME</B> <code>VARCHAR</code> => type name <LI><B>CLASS_NAME</B> <code>VARCHAR</code> => Java class name <LI><B>DATA_TYPE</B> <code>VARCHAR</code> => type value defined in <code>DITypes</code>; one of <code>JAVA_OBJECT</code>, <code>STRUCT</code>, or <code>DISTINCT</code> <LI><B>REMARKS</B> <code>VARCHAR</code> => explanatory comment on the type <LI><B>BASE_TYPE</B><code>SMALLINT</code> => type code of the source type of a DISTINCT type or the type that implements the user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in DITypes (null if DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) </OL> <p> <B>Note:</B> Currently, neither the HSQLDB engine or the JDBC driver support UDTs, so an empty table is returned. <p> @return a <code>Table</code> object describing the accessible user-defined types defined in this database
[ "Retrieves", "a", "<code", ">", "Table<", "/", "code", ">", "object", "describing", "the", "accessible", "user", "-", "defined", "types", "defined", "in", "this", "database", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationFull.java#L1064-L1090
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java
ListManagementImagesImpl.addImageAsync
public Observable<Image> addImageAsync(String listId, AddImageOptionalParameter addImageOptionalParameter) { return addImageWithServiceResponseAsync(listId, addImageOptionalParameter).map(new Func1<ServiceResponse<Image>, Image>() { @Override public Image call(ServiceResponse<Image> response) { return response.body(); } }); }
java
public Observable<Image> addImageAsync(String listId, AddImageOptionalParameter addImageOptionalParameter) { return addImageWithServiceResponseAsync(listId, addImageOptionalParameter).map(new Func1<ServiceResponse<Image>, Image>() { @Override public Image call(ServiceResponse<Image> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Image", ">", "addImageAsync", "(", "String", "listId", ",", "AddImageOptionalParameter", "addImageOptionalParameter", ")", "{", "return", "addImageWithServiceResponseAsync", "(", "listId", ",", "addImageOptionalParameter", ")", ".", "map", ...
Add an image to the list with list Id equal to list Id passed. @param listId List Id of the image list. @param addImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Image object
[ "Add", "an", "image", "to", "the", "list", "with", "list", "Id", "equal", "to", "list", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L130-L137
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/SerializedForm.java
SerializedForm.addMethodIfExist
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) { Names names = def.name.table.names; for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) { if (e.sym.kind == Kinds.MTH) { MethodSymbol md = (MethodSymbol)e.sym; if ((md.flags() & Flags.STATIC) == 0) { /* * WARNING: not robust if unqualifiedMethodName is overloaded * method. Signature checking could make more robust. * READOBJECT takes a single parameter, java.io.ObjectInputStream. * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream. */ methods.append(env.getMethodDoc(md)); } } } }
java
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) { Names names = def.name.table.names; for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) { if (e.sym.kind == Kinds.MTH) { MethodSymbol md = (MethodSymbol)e.sym; if ((md.flags() & Flags.STATIC) == 0) { /* * WARNING: not robust if unqualifiedMethodName is overloaded * method. Signature checking could make more robust. * READOBJECT takes a single parameter, java.io.ObjectInputStream. * WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream. */ methods.append(env.getMethodDoc(md)); } } } }
[ "private", "void", "addMethodIfExist", "(", "DocEnv", "env", ",", "ClassSymbol", "def", ",", "String", "methodName", ")", "{", "Names", "names", "=", "def", ".", "name", ".", "table", ".", "names", ";", "for", "(", "Scope", ".", "Entry", "e", "=", "def...
/* Catalog Serializable method if it exists in current ClassSymbol. Do not look for method in superclasses. Serialization requires these methods to be non-static. @param method should be an unqualified Serializable method name either READOBJECT, WRITEOBJECT, READRESOLVE or WRITEREPLACE. @param visibility the visibility flag for the given method.
[ "/", "*", "Catalog", "Serializable", "method", "if", "it", "exists", "in", "current", "ClassSymbol", ".", "Do", "not", "look", "for", "method", "in", "superclasses", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/SerializedForm.java#L209-L226
lukas-krecan/JsonUnit
json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java
JsonAssert.assertJsonPartStructureEquals
@Deprecated public static void assertJsonPartStructureEquals(Object expected, Object fullJson, String path) { Diff diff = create(expected, fullJson, FULL_JSON, path, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
java
@Deprecated public static void assertJsonPartStructureEquals(Object expected, Object fullJson, String path) { Diff diff = create(expected, fullJson, FULL_JSON, path, configuration.withOptions(COMPARING_ONLY_STRUCTURE)); diff.failIfDifferent(); }
[ "@", "Deprecated", "public", "static", "void", "assertJsonPartStructureEquals", "(", "Object", "expected", ",", "Object", "fullJson", ",", "String", "path", ")", "{", "Diff", "diff", "=", "create", "(", "expected", ",", "fullJson", ",", "FULL_JSON", ",", "path...
Compares structure of part of the JSON. Path has this format "root.array[0].value". Is too lenient, ignores types, prefer IGNORING_VALUES option instead. @deprecated Use IGNORING_VALUES option instead
[ "Compares", "structure", "of", "part", "of", "the", "JSON", ".", "Path", "has", "this", "format", "root", ".", "array", "[", "0", "]", ".", "value", ".", "Is", "too", "lenient", "ignores", "types", "prefer", "IGNORING_VALUES", "option", "instead", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L140-L144
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionDecoratorFactory.java
ConnectionDecoratorFactory.proxyConnection
@Override protected Connection proxyConnection(Connection target, ConnectionCallback callback) { return new ConnectionDecorator(target, callback); }
java
@Override protected Connection proxyConnection(Connection target, ConnectionCallback callback) { return new ConnectionDecorator(target, callback); }
[ "@", "Override", "protected", "Connection", "proxyConnection", "(", "Connection", "target", ",", "ConnectionCallback", "callback", ")", "{", "return", "new", "ConnectionDecorator", "(", "target", ",", "callback", ")", ";", "}" ]
Create a {@link ConnectionDecorator} delegate to the actual target {@link Connection} @param target connection to proxy @param callback attaching connection lifecycle listener @return {@link Connection} delegate
[ "Create", "a", "{", "@link", "ConnectionDecorator", "}", "delegate", "to", "the", "actual", "target", "{", "@link", "Connection", "}" ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionDecoratorFactory.java#L22-L25
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java
SessionContext.addHttpSessionListener
public void addHttpSessionListener(ArrayList al, String j2eeName) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al); } if (j2eeName != null) { addToJ2eeNameList(j2eeName, al.size(), mHttpSessionListenersJ2eeNames); } synchronized (mHttpSessionListeners) { mHttpSessionListeners.addAll(al); if (mHttpSessionListeners.size() > 0) { sessionListener = true; _coreHttpSessionManager.getIStore().setHttpSessionListener(true); boolean mIBMSessionListenerImplemented = isIBMSessionListenerImplemented(al); // PQ81248 if (mIBMSessionListenerImplemented) { wasHttpSessionObserver.setDoesContainIBMSessionListener(true); } } } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al); } }
java
public void addHttpSessionListener(ArrayList al, String j2eeName) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al); } if (j2eeName != null) { addToJ2eeNameList(j2eeName, al.size(), mHttpSessionListenersJ2eeNames); } synchronized (mHttpSessionListeners) { mHttpSessionListeners.addAll(al); if (mHttpSessionListeners.size() > 0) { sessionListener = true; _coreHttpSessionManager.getIStore().setHttpSessionListener(true); boolean mIBMSessionListenerImplemented = isIBMSessionListenerImplemented(al); // PQ81248 if (mIBMSessionListenerImplemented) { wasHttpSessionObserver.setDoesContainIBMSessionListener(true); } } } if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al); } }
[ "public", "void", "addHttpSessionListener", "(", "ArrayList", "al", ",", "String", "j2eeName", ")", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "LoggingUtil", ".", "SESSION_LOG...
/* Adds a list of Session Listeners For shared session context or global sesions, we call this method to add each app's listeners.
[ "/", "*", "Adds", "a", "list", "of", "Session", "Listeners", "For", "shared", "session", "context", "or", "global", "sesions", "we", "call", "this", "method", "to", "add", "each", "app", "s", "listeners", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java#L825-L847
prestodb/presto
presto-parquet/src/main/java/com/facebook/presto/parquet/reader/ListColumnReader.java
ListColumnReader.calculateCollectionOffsets
public static void calculateCollectionOffsets(Field field, IntList offsets, BooleanList collectionIsNull, int[] definitionLevels, int[] repetitionLevels) { int maxDefinitionLevel = field.getDefinitionLevel(); int maxElementRepetitionLevel = field.getRepetitionLevel() + 1; boolean required = field.isRequired(); int offset = 0; offsets.add(offset); for (int i = 0; i < definitionLevels.length; i = getNextCollectionStartIndex(repetitionLevels, maxElementRepetitionLevel, i)) { if (ParquetTypeUtils.isValueNull(required, definitionLevels[i], maxDefinitionLevel)) { // Collection is null collectionIsNull.add(true); offsets.add(offset); } else if (definitionLevels[i] == maxDefinitionLevel) { // Collection is defined but empty collectionIsNull.add(false); offsets.add(offset); } else if (definitionLevels[i] > maxDefinitionLevel) { // Collection is defined and not empty collectionIsNull.add(false); offset += getCollectionSize(repetitionLevels, maxElementRepetitionLevel, i + 1); offsets.add(offset); } } }
java
public static void calculateCollectionOffsets(Field field, IntList offsets, BooleanList collectionIsNull, int[] definitionLevels, int[] repetitionLevels) { int maxDefinitionLevel = field.getDefinitionLevel(); int maxElementRepetitionLevel = field.getRepetitionLevel() + 1; boolean required = field.isRequired(); int offset = 0; offsets.add(offset); for (int i = 0; i < definitionLevels.length; i = getNextCollectionStartIndex(repetitionLevels, maxElementRepetitionLevel, i)) { if (ParquetTypeUtils.isValueNull(required, definitionLevels[i], maxDefinitionLevel)) { // Collection is null collectionIsNull.add(true); offsets.add(offset); } else if (definitionLevels[i] == maxDefinitionLevel) { // Collection is defined but empty collectionIsNull.add(false); offsets.add(offset); } else if (definitionLevels[i] > maxDefinitionLevel) { // Collection is defined and not empty collectionIsNull.add(false); offset += getCollectionSize(repetitionLevels, maxElementRepetitionLevel, i + 1); offsets.add(offset); } } }
[ "public", "static", "void", "calculateCollectionOffsets", "(", "Field", "field", ",", "IntList", "offsets", ",", "BooleanList", "collectionIsNull", ",", "int", "[", "]", "definitionLevels", ",", "int", "[", "]", "repetitionLevels", ")", "{", "int", "maxDefinitionL...
Each collection (Array or Map) has four variants of presence: 1) Collection is not defined, because one of it's optional parent fields is null 2) Collection is null 3) Collection is defined but empty 4) Collection is defined and not empty. In this case offset value is increased by the number of elements in that collection
[ "Each", "collection", "(", "Array", "or", "Map", ")", "has", "four", "variants", "of", "presence", ":", "1", ")", "Collection", "is", "not", "defined", "because", "one", "of", "it", "s", "optional", "parent", "fields", "is", "null", "2", ")", "Collection...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parquet/src/main/java/com/facebook/presto/parquet/reader/ListColumnReader.java#L34-L59
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java
MarkdownParser.addText
private void addText(TextCursor cursor, int limit, ArrayList<MDText> elements) { if (cursor.currentOffset < limit) { elements.add(new MDRawText(cursor.text.substring(cursor.currentOffset, limit))); cursor.currentOffset = limit; } }
java
private void addText(TextCursor cursor, int limit, ArrayList<MDText> elements) { if (cursor.currentOffset < limit) { elements.add(new MDRawText(cursor.text.substring(cursor.currentOffset, limit))); cursor.currentOffset = limit; } }
[ "private", "void", "addText", "(", "TextCursor", "cursor", ",", "int", "limit", ",", "ArrayList", "<", "MDText", ">", "elements", ")", "{", "if", "(", "cursor", ".", "currentOffset", "<", "limit", ")", "{", "elements", ".", "add", "(", "new", "MDRawText"...
Adding raw simple text @param cursor text cursor @param limit text end @param elements current elements
[ "Adding", "raw", "simple", "text" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L220-L225
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/Polygon.java
Polygon.fromLngLats
public static Polygon fromLngLats(@NonNull List<List<Point>> coordinates) { return new Polygon(TYPE, null, coordinates); }
java
public static Polygon fromLngLats(@NonNull List<List<Point>> coordinates) { return new Polygon(TYPE, null, coordinates); }
[ "public", "static", "Polygon", "fromLngLats", "(", "@", "NonNull", "List", "<", "List", "<", "Point", ">", ">", "coordinates", ")", "{", "return", "new", "Polygon", "(", "TYPE", ",", "null", ",", "coordinates", ")", ";", "}" ]
Create a new instance of this class by defining a list of {@link Point}s which follow the correct specifications described in the Point documentation. Note that the first and last point in the list should be the same enclosing the linear ring. @param coordinates a list of a list of points which represent the polygon geometry @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "defining", "a", "list", "of", "{", "@link", "Point", "}", "s", "which", "follow", "the", "correct", "specifications", "described", "in", "the", "Point", "documentation", ".", "Note", "that", "...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Polygon.java#L98-L100
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/retry/RetryPolicies.java
RetryPolicies.retryUpToMaximumCountWithProportionalSleep
public static final RetryPolicy retryUpToMaximumCountWithProportionalSleep(int maxRetries, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumCountWithProportionalSleep(maxRetries, sleepTime, timeUnit); }
java
public static final RetryPolicy retryUpToMaximumCountWithProportionalSleep(int maxRetries, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumCountWithProportionalSleep(maxRetries, sleepTime, timeUnit); }
[ "public", "static", "final", "RetryPolicy", "retryUpToMaximumCountWithProportionalSleep", "(", "int", "maxRetries", ",", "long", "sleepTime", ",", "TimeUnit", "timeUnit", ")", "{", "return", "new", "RetryUpToMaximumCountWithProportionalSleep", "(", "maxRetries", ",", "sle...
<p> Keep trying a limited number of times, waiting a growing amount of time between attempts, and then fail by re-throwing the exception. The time between attempts is <code>sleepTime</code> mutliplied by the number of tries so far. </p>
[ "<p", ">", "Keep", "trying", "a", "limited", "number", "of", "times", "waiting", "a", "growing", "amount", "of", "time", "between", "attempts", "and", "then", "fail", "by", "re", "-", "throwing", "the", "exception", ".", "The", "time", "between", "attempts...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/retry/RetryPolicies.java#L86-L88
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.initLookAndFeelIntern
private static void initLookAndFeelIntern(final String className) { try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); } }
java
private static void initLookAndFeelIntern(final String className) { try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); } }
[ "private", "static", "void", "initLookAndFeelIntern", "(", "final", "String", "className", ")", "{", "try", "{", "UIManager", ".", "setLookAndFeel", "(", "className", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "RuntimeE...
Initializes the look and feel and wraps exceptions into a runtime exception. It's executed in the calling thread. @param className Full qualified name of the look and feel class.
[ "Initializes", "the", "look", "and", "feel", "and", "wraps", "exceptions", "into", "a", "runtime", "exception", ".", "It", "s", "executed", "in", "the", "calling", "thread", "." ]
train
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L136-L142
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java
FlowPath.activateFrame
public void activateFrame(@NonNull String frameName, boolean reallyActivate) { frames.get(frameName).setActive(reallyActivate); }
java
public void activateFrame(@NonNull String frameName, boolean reallyActivate) { frames.get(frameName).setActive(reallyActivate); }
[ "public", "void", "activateFrame", "(", "@", "NonNull", "String", "frameName", ",", "boolean", "reallyActivate", ")", "{", "frames", ".", "get", "(", "frameName", ")", ".", "setActive", "(", "reallyActivate", ")", ";", "}" ]
This method triggers frame state @param frameName @param reallyActivate
[ "This", "method", "triggers", "frame", "state" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java#L221-L223
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java
DocumentSet.add
DocumentSet add(QueryDocumentSnapshot document) { // Remove any prior mapping of the document's key before adding, preventing sortedSet from // accumulating values that aren't in the index. DocumentSet removed = remove(document.getReference().getResourcePath()); ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex = removed.keyIndex.insert(document.getReference().getResourcePath(), document); ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = removed.sortedSet.insert(document); return new DocumentSet(newKeyIndex, newSortedSet); }
java
DocumentSet add(QueryDocumentSnapshot document) { // Remove any prior mapping of the document's key before adding, preventing sortedSet from // accumulating values that aren't in the index. DocumentSet removed = remove(document.getReference().getResourcePath()); ImmutableSortedMap<ResourcePath, QueryDocumentSnapshot> newKeyIndex = removed.keyIndex.insert(document.getReference().getResourcePath(), document); ImmutableSortedSet<QueryDocumentSnapshot> newSortedSet = removed.sortedSet.insert(document); return new DocumentSet(newKeyIndex, newSortedSet); }
[ "DocumentSet", "add", "(", "QueryDocumentSnapshot", "document", ")", "{", "// Remove any prior mapping of the document's key before adding, preventing sortedSet from", "// accumulating values that aren't in the index.", "DocumentSet", "removed", "=", "remove", "(", "document", ".", "...
Returns a new DocumentSet that contains the given document, replacing any old document with the same key.
[ "Returns", "a", "new", "DocumentSet", "that", "contains", "the", "given", "document", "replacing", "any", "old", "document", "with", "the", "same", "key", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/DocumentSet.java#L99-L108
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/webapp/WebApp.java
WebApp.determineWhetherToAddScis
protected void determineWhetherToAddScis(ServletContainerInitializer sci, List<ServletContainerInitializer> scis) { // SCIs from DS are already added if (acceptAnnotationsFrom(sci.getClass().getName(), DO_ACCEPT_PARTIAL, DO_NOT_ACCEPT_EXCLUDED)) { scis.add(sci); } }
java
protected void determineWhetherToAddScis(ServletContainerInitializer sci, List<ServletContainerInitializer> scis) { // SCIs from DS are already added if (acceptAnnotationsFrom(sci.getClass().getName(), DO_ACCEPT_PARTIAL, DO_NOT_ACCEPT_EXCLUDED)) { scis.add(sci); } }
[ "protected", "void", "determineWhetherToAddScis", "(", "ServletContainerInitializer", "sci", ",", "List", "<", "ServletContainerInitializer", ">", "scis", ")", "{", "// SCIs from DS are already added ", "if", "(", "acceptAnnotationsFrom", "(", "sci", ".", "getClass", ...
Tell if servlet-container-initializer (SCI) annotation processing is to be done on the class of a specified initializer. Provide the answer as a side effect. If processing is to be done, add the initializer to the specified initializer list. If processing is not to be done, do not add the initializer. @param sci The candidate servlet container initializer. @param scis Storage for initializers which are to be processed.
[ "Tell", "if", "servlet", "-", "container", "-", "initializer", "(", "SCI", ")", "annotation", "processing", "is", "to", "be", "done", "on", "the", "class", "of", "a", "specified", "initializer", ".", "Provide", "the", "answer", "as", "a", "side", "effect",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/webapp/WebApp.java#L891-L897
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findIndexValues
public static List<Number> findIndexValues(Object self, Closure closure) { return findIndexValues(self, 0, closure); }
java
public static List<Number> findIndexValues(Object self, Closure closure) { return findIndexValues(self, 0, closure); }
[ "public", "static", "List", "<", "Number", ">", "findIndexValues", "(", "Object", "self", ",", "Closure", "closure", ")", "{", "return", "findIndexValues", "(", "self", ",", "0", ",", "closure", ")", ";", "}" ]
Iterates over the elements of an iterable collection of items and returns the index values of the items that match the condition specified in the closure. @param self the iteration object over which to iterate @param closure the filter to perform a match on the collection @return a list of numbers corresponding to the index values of all matched objects @since 1.5.2
[ "Iterates", "over", "the", "elements", "of", "an", "iterable", "collection", "of", "items", "and", "returns", "the", "index", "values", "of", "the", "items", "that", "match", "the", "condition", "specified", "in", "the", "closure", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L15439-L15441
alkacon/opencms-core
src/org/opencms/file/CmsLinkRewriter.java
CmsLinkRewriter.getRelativePath
protected String getRelativePath(String ancestor, String rootPath) { String result = rootPath.substring(ancestor.length()); result = CmsStringUtil.joinPaths("/", result, "/"); return result; }
java
protected String getRelativePath(String ancestor, String rootPath) { String result = rootPath.substring(ancestor.length()); result = CmsStringUtil.joinPaths("/", result, "/"); return result; }
[ "protected", "String", "getRelativePath", "(", "String", "ancestor", ",", "String", "rootPath", ")", "{", "String", "result", "=", "rootPath", ".", "substring", "(", "ancestor", ".", "length", "(", ")", ")", ";", "result", "=", "CmsStringUtil", ".", "joinPat...
Computes the relative path given an ancestor folder path.<p> @param ancestor the ancestor folder @param rootPath the path for which the relative path should be computed @return the relative path
[ "Computes", "the", "relative", "path", "given", "an", "ancestor", "folder", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsLinkRewriter.java#L463-L468
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.uploadFile
public UploadResult uploadFile(String path, String fileType) throws APIConnectionException, APIRequestException { return _resourceClient.uploadFile(path, fileType); }
java
public UploadResult uploadFile(String path, String fileType) throws APIConnectionException, APIRequestException { return _resourceClient.uploadFile(path, fileType); }
[ "public", "UploadResult", "uploadFile", "(", "String", "path", ",", "String", "fileType", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_resourceClient", ".", "uploadFile", "(", "path", ",", "fileType", ")", ";", "}" ]
Upload file, only support image file(jpg, bmp, gif, png) currently, file size should not larger than 8M. @param path Necessary, the native path of the file you want to upload @param fileType Current support type: image, file, voice @return UploadResult @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Upload", "file", "only", "support", "image", "file", "(", "jpg", "bmp", "gif", "png", ")", "currently", "file", "size", "should", "not", "larger", "than", "8M", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L579-L582
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java
FeatureCollection.fromFeature
public static FeatureCollection fromFeature(@NonNull Feature feature) { List<Feature> featureList = Arrays.asList(feature); return new FeatureCollection(TYPE, null, featureList); }
java
public static FeatureCollection fromFeature(@NonNull Feature feature) { List<Feature> featureList = Arrays.asList(feature); return new FeatureCollection(TYPE, null, featureList); }
[ "public", "static", "FeatureCollection", "fromFeature", "(", "@", "NonNull", "Feature", "feature", ")", "{", "List", "<", "Feature", ">", "featureList", "=", "Arrays", ".", "asList", "(", "feature", ")", ";", "return", "new", "FeatureCollection", "(", "TYPE", ...
Create a new instance of this class by giving the feature collection a single {@link Feature}. @param feature a single feature @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "giving", "the", "feature", "collection", "a", "single", "{", "@link", "Feature", "}", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java#L138-L141
JamesIry/jADT
jADT-core/src/main/java/com/pogofish/jadt/comments/CommentProcessor.java
CommentProcessor.leftAlign
public List<JavaComment> leftAlign(List<JavaComment> originals) { final List<JavaComment> results = new ArrayList<JavaComment>( originals.size()); for (JavaComment original : originals) { results.add(original .match(new JavaComment.MatchBlock<JavaComment>() { @Override public JavaComment _case(JavaDocComment x) { final List<JDToken> leadingWhiteSpace = new ArrayList<JDToken>(1); final LeftAlignState state[] = new LeftAlignState[] { LeftAlignState.IN_LINE }; return _JavaDocComment(x.start, leftAlignSection(x.generalSection, x.tagSections.isEmpty(), leadingWhiteSpace, state), leftAlignSections(x.tagSections, leadingWhiteSpace, state), x.end); } @Override public JavaComment _case(JavaBlockComment x) { return _JavaBlockComment(leftAlignBlock(x.lines)); } @Override public JavaComment _case(JavaEOLComment x) { return x; } })); } return results; }
java
public List<JavaComment> leftAlign(List<JavaComment> originals) { final List<JavaComment> results = new ArrayList<JavaComment>( originals.size()); for (JavaComment original : originals) { results.add(original .match(new JavaComment.MatchBlock<JavaComment>() { @Override public JavaComment _case(JavaDocComment x) { final List<JDToken> leadingWhiteSpace = new ArrayList<JDToken>(1); final LeftAlignState state[] = new LeftAlignState[] { LeftAlignState.IN_LINE }; return _JavaDocComment(x.start, leftAlignSection(x.generalSection, x.tagSections.isEmpty(), leadingWhiteSpace, state), leftAlignSections(x.tagSections, leadingWhiteSpace, state), x.end); } @Override public JavaComment _case(JavaBlockComment x) { return _JavaBlockComment(leftAlignBlock(x.lines)); } @Override public JavaComment _case(JavaEOLComment x) { return x; } })); } return results; }
[ "public", "List", "<", "JavaComment", ">", "leftAlign", "(", "List", "<", "JavaComment", ">", "originals", ")", "{", "final", "List", "<", "JavaComment", ">", "results", "=", "new", "ArrayList", "<", "JavaComment", ">", "(", "originals", ".", "size", "(", ...
Align a list of comments on the left marging. EOLComments are left alone. Block and JavaDoc comments are aligned by making every line that starts with a * be one space in from the comment opener. Lines that don't start with * are left alone.
[ "Align", "a", "list", "of", "comments", "on", "the", "left", "marging", ".", "EOLComments", "are", "left", "alone", ".", "Block", "and", "JavaDoc", "comments", "are", "aligned", "by", "making", "every", "line", "that", "starts", "with", "a", "*", "be", "...
train
https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/comments/CommentProcessor.java#L254-L281
aws/aws-sdk-java
aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java
Policy.setIncludeMap
public void setIncludeMap(java.util.Map<String, java.util.List<String>> includeMap) { this.includeMap = includeMap; }
java
public void setIncludeMap(java.util.Map<String, java.util.List<String>> includeMap) { this.includeMap = includeMap; }
[ "public", "void", "setIncludeMap", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "includeMap", ")", "{", "this", ".", "includeMap", "=", "includeMap", ";", "}" ]
<p> Specifies the AWS account IDs to include in the policy. If <code>IncludeMap</code> is null, all accounts in the organization in AWS Organizations are included in the policy. If <code>IncludeMap</code> is not null, only values listed in <code>IncludeMap</code> are included in the policy. </p> <p> The key to the map is <code>ACCOUNT</code>. For example, a valid <code>IncludeMap</code> would be <code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>. </p> @param includeMap Specifies the AWS account IDs to include in the policy. If <code>IncludeMap</code> is null, all accounts in the organization in AWS Organizations are included in the policy. If <code>IncludeMap</code> is not null, only values listed in <code>IncludeMap</code> are included in the policy.</p> <p> The key to the map is <code>ACCOUNT</code>. For example, a valid <code>IncludeMap</code> would be <code>{“ACCOUNT” : [“accountID1”, “accountID2”]}</code>.
[ "<p", ">", "Specifies", "the", "AWS", "account", "IDs", "to", "include", "in", "the", "policy", ".", "If", "<code", ">", "IncludeMap<", "/", "code", ">", "is", "null", "all", "accounts", "in", "the", "organization", "in", "AWS", "Organizations", "are", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-fms/src/main/java/com/amazonaws/services/fms/model/Policy.java#L656-L658
JOML-CI/JOML
src/org/joml/Intersectiond.java
Intersectiond.distancePointLine
public static double distancePointLine(double pointX, double pointY, double a, double b, double c) { double denom = Math.sqrt(a * a + b * b); return (a * pointX + b * pointY + c) / denom; }
java
public static double distancePointLine(double pointX, double pointY, double a, double b, double c) { double denom = Math.sqrt(a * a + b * b); return (a * pointX + b * pointY + c) / denom; }
[ "public", "static", "double", "distancePointLine", "(", "double", "pointX", ",", "double", "pointY", ",", "double", "a", ",", "double", "b", ",", "double", "c", ")", "{", "double", "denom", "=", "Math", ".", "sqrt", "(", "a", "*", "a", "+", "b", "*",...
Determine the signed distance of the given point <code>(pointX, pointY)</code> to the line specified via its general plane equation <i>a*x + b*y + c = 0</i>. <p> Reference: <a href="http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html">http://mathworld.wolfram.com</a> @param pointX the x coordinate of the point @param pointY the y coordinate of the point @param a the x factor in the plane equation @param b the y factor in the plane equation @param c the constant in the plane equation @return the distance between the point and the line
[ "Determine", "the", "signed", "distance", "of", "the", "given", "point", "<code", ">", "(", "pointX", "pointY", ")", "<", "/", "code", ">", "to", "the", "line", "specified", "via", "its", "general", "plane", "equation", "<i", ">", "a", "*", "x", "+", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L3826-L3829
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java
FhirContext.newRestfulClient
public <T extends IRestfulClient> T newRestfulClient(Class<T> theClientType, String theServerBase) { return getRestfulClientFactory().newClient(theClientType, theServerBase); }
java
public <T extends IRestfulClient> T newRestfulClient(Class<T> theClientType, String theServerBase) { return getRestfulClientFactory().newClient(theClientType, theServerBase); }
[ "public", "<", "T", "extends", "IRestfulClient", ">", "T", "newRestfulClient", "(", "Class", "<", "T", ">", "theClientType", ",", "String", "theServerBase", ")", "{", "return", "getRestfulClientFactory", "(", ")", ".", "newClient", "(", "theClientType", ",", "...
Instantiates a new client instance. This method requires an interface which is defined specifically for your use cases to contain methods for each of the RESTful operations you wish to implement (e.g. "read ImagingStudy", "search Patient by identifier", etc.). This interface must extend {@link IRestfulClient} (or commonly its sub-interface {@link IBasicClient}). See the <a href="http://jamesagnew.github.io/hapi-fhir/doc_rest_client.html">RESTful Client</a> documentation for more information on how to define this interface. <p> Performance Note: <b>This method is cheap</b> to call, and may be called once for every operation invocation without incurring any performance penalty </p> @param theClientType The client type, which is an interface type to be instantiated @param theServerBase The URL of the base for the restful FHIR server to connect to @return A newly created client @throws ConfigurationException If the interface type is not an interface
[ "Instantiates", "a", "new", "client", "instance", ".", "This", "method", "requires", "an", "interface", "which", "is", "defined", "specifically", "for", "your", "use", "cases", "to", "contain", "methods", "for", "each", "of", "the", "RESTful", "operations", "y...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java#L648-L650
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.saveObject
public JSONObject saveObject(JSONObject object, String objectID) throws AlgoliaException { return this.saveObject(object, objectID, RequestOptions.empty); }
java
public JSONObject saveObject(JSONObject object, String objectID) throws AlgoliaException { return this.saveObject(object, objectID, RequestOptions.empty); }
[ "public", "JSONObject", "saveObject", "(", "JSONObject", "object", ",", "String", "objectID", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "saveObject", "(", "object", ",", "objectID", ",", "RequestOptions", ".", "empty", ")", ";", "}" ]
Override the content of object @param object the object to update
[ "Override", "the", "content", "of", "object" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L477-L479
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java
FastAdapter.notifyAdapterItemRangeInserted
public void notifyAdapterItemRangeInserted(int position, int itemCount) { // handle our extensions for (IAdapterExtension<Item> ext : mExtensions.values()) { ext.notifyAdapterItemRangeInserted(position, itemCount); } cacheSizes(); notifyItemRangeInserted(position, itemCount); }
java
public void notifyAdapterItemRangeInserted(int position, int itemCount) { // handle our extensions for (IAdapterExtension<Item> ext : mExtensions.values()) { ext.notifyAdapterItemRangeInserted(position, itemCount); } cacheSizes(); notifyItemRangeInserted(position, itemCount); }
[ "public", "void", "notifyAdapterItemRangeInserted", "(", "int", "position", ",", "int", "itemCount", ")", "{", "// handle our extensions", "for", "(", "IAdapterExtension", "<", "Item", ">", "ext", ":", "mExtensions", ".", "values", "(", ")", ")", "{", "ext", "...
wraps notifyItemRangeInserted @param position the global position @param itemCount the count of items inserted
[ "wraps", "notifyItemRangeInserted" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java#L1279-L1286
mfornos/humanize
humanize-slim/src/main/java/humanize/spi/MessageFormat.java
MessageFormat.render
public StringBuffer render(StringBuffer buffer, Object... arguments) { return format(arguments, buffer, null); }
java
public StringBuffer render(StringBuffer buffer, Object... arguments) { return format(arguments, buffer, null); }
[ "public", "StringBuffer", "render", "(", "StringBuffer", "buffer", ",", "Object", "...", "arguments", ")", "{", "return", "format", "(", "arguments", ",", "buffer", ",", "null", ")", ";", "}" ]
Formats the current pattern with the given arguments. @param buffer The StringBuffer @param arguments The formatting arguments @return StringBuffer with the formatted message
[ "Formats", "the", "current", "pattern", "with", "the", "given", "arguments", "." ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/spi/MessageFormat.java#L108-L113
romannurik/muzei
muzei-api/src/main/java/com/google/android/apps/muzei/api/provider/MuzeiArtProvider.java
MuzeiArtProvider.openArtworkInfo
protected boolean openArtworkInfo(@NonNull Artwork artwork) { if (artwork.getWebUri() != null && getContext() != null) { try { Intent intent = new Intent(Intent.ACTION_VIEW, artwork.getWebUri()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); return true; } catch (ActivityNotFoundException e) { Log.w(TAG, "Could not open " + artwork.getWebUri() + ", artwork info for " + ContentUris.withAppendedId(contentUri, artwork.getId()), e); } } return false; }
java
protected boolean openArtworkInfo(@NonNull Artwork artwork) { if (artwork.getWebUri() != null && getContext() != null) { try { Intent intent = new Intent(Intent.ACTION_VIEW, artwork.getWebUri()); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); return true; } catch (ActivityNotFoundException e) { Log.w(TAG, "Could not open " + artwork.getWebUri() + ", artwork info for " + ContentUris.withAppendedId(contentUri, artwork.getId()), e); } } return false; }
[ "protected", "boolean", "openArtworkInfo", "(", "@", "NonNull", "Artwork", "artwork", ")", "{", "if", "(", "artwork", ".", "getWebUri", "(", ")", "!=", "null", "&&", "getContext", "(", ")", "!=", "null", ")", "{", "try", "{", "Intent", "intent", "=", "...
Callback when the user wishes to see more information about the given artwork. The default implementation opens the {@link ProviderContract.Artwork#WEB_URI web uri} of the artwork. @param artwork The artwork the user wants to see more information about. @return True if the artwork info was successfully opened.
[ "Callback", "when", "the", "user", "wishes", "to", "see", "more", "information", "about", "the", "given", "artwork", ".", "The", "default", "implementation", "opens", "the", "{", "@link", "ProviderContract", ".", "Artwork#WEB_URI", "web", "uri", "}", "of", "th...
train
https://github.com/romannurik/muzei/blob/d00777a5fc59f34471be338c814ea85ddcbde304/muzei-api/src/main/java/com/google/android/apps/muzei/api/provider/MuzeiArtProvider.java#L605-L618
EdwardRaff/JSAT
JSAT/src/jsat/linear/vectorcollection/lsh/E2LSH.java
E2LSH.searchR
public List<? extends VecPaired<Vec, Double>> searchR(Vec q) { return searchR(q, false); }
java
public List<? extends VecPaired<Vec, Double>> searchR(Vec q) { return searchR(q, false); }
[ "public", "List", "<", "?", "extends", "VecPaired", "<", "Vec", ",", "Double", ">", ">", "searchR", "(", "Vec", "q", ")", "{", "return", "searchR", "(", "q", ",", "false", ")", ";", "}" ]
Performs a search for points within the set {@link #getRadius() radius} of the query point. @param q the query point to search near @return a list of vectors paired with their true distance from the query point that are within the desired radius of the query point
[ "Performs", "a", "search", "for", "points", "within", "the", "set", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/vectorcollection/lsh/E2LSH.java#L170-L173
kstateome/canvas-api
src/main/java/edu/ksu/canvas/util/CanvasURLBuilder.java
CanvasURLBuilder.buildCanvasUrl
public static String buildCanvasUrl(String canvasBaseUrl, int canvasAPIVersion, String canvasMethod, Map<String, List<String>> parameters) { canvasMethod = removeForwardSlashIfExists(canvasMethod); String url = canvasBaseUrl + "/api/v" + canvasAPIVersion + "/" + canvasMethod; String finalUrl = url + HttpParameterBuilder.buildParameters(parameters); LOG.debug("Built Canvas url - " + finalUrl); return finalUrl; }
java
public static String buildCanvasUrl(String canvasBaseUrl, int canvasAPIVersion, String canvasMethod, Map<String, List<String>> parameters) { canvasMethod = removeForwardSlashIfExists(canvasMethod); String url = canvasBaseUrl + "/api/v" + canvasAPIVersion + "/" + canvasMethod; String finalUrl = url + HttpParameterBuilder.buildParameters(parameters); LOG.debug("Built Canvas url - " + finalUrl); return finalUrl; }
[ "public", "static", "String", "buildCanvasUrl", "(", "String", "canvasBaseUrl", ",", "int", "canvasAPIVersion", ",", "String", "canvasMethod", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "parameters", ")", "{", "canvasMethod", "=", "remove...
/* Builds parameters in form of ?param[]=value1&param[]=value2&otherParam=someValue
[ "/", "*", "Builds", "parameters", "in", "form", "of", "?param", "[]", "=", "value1&param", "[]", "=", "value2&otherParam", "=", "someValue" ]
train
https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/util/CanvasURLBuilder.java#L12-L18
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/client/PrimeConnections.java
PrimeConnections.primeConnections
public void primeConnections(List<Server> servers) { if (servers == null || servers.size() == 0) { logger.debug("No server to prime"); return; } for (Server server: servers) { server.setReadyToServe(false); } int totalCount = (int) (servers.size() * primeRatio); final CountDownLatch latch = new CountDownLatch(totalCount); final AtomicInteger successCount = new AtomicInteger(0); final AtomicInteger failureCount= new AtomicInteger(0); primeConnectionsAsync(servers, new PrimeConnectionListener() { @Override public void primeCompleted(Server s, Throwable lastException) { if (lastException == null) { successCount.incrementAndGet(); s.setReadyToServe(true); } else { failureCount.incrementAndGet(); } latch.countDown(); } }); Stopwatch stopWatch = initialPrimeTimer.start(); try { latch.await(maxTotalTimeToPrimeConnections, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { logger.error("Priming connection interrupted", e); } finally { stopWatch.stop(); } stats = new PrimeConnectionEndStats(totalCount, successCount.get(), failureCount.get(), stopWatch.getDuration(TimeUnit.MILLISECONDS)); printStats(stats); }
java
public void primeConnections(List<Server> servers) { if (servers == null || servers.size() == 0) { logger.debug("No server to prime"); return; } for (Server server: servers) { server.setReadyToServe(false); } int totalCount = (int) (servers.size() * primeRatio); final CountDownLatch latch = new CountDownLatch(totalCount); final AtomicInteger successCount = new AtomicInteger(0); final AtomicInteger failureCount= new AtomicInteger(0); primeConnectionsAsync(servers, new PrimeConnectionListener() { @Override public void primeCompleted(Server s, Throwable lastException) { if (lastException == null) { successCount.incrementAndGet(); s.setReadyToServe(true); } else { failureCount.incrementAndGet(); } latch.countDown(); } }); Stopwatch stopWatch = initialPrimeTimer.start(); try { latch.await(maxTotalTimeToPrimeConnections, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { logger.error("Priming connection interrupted", e); } finally { stopWatch.stop(); } stats = new PrimeConnectionEndStats(totalCount, successCount.get(), failureCount.get(), stopWatch.getDuration(TimeUnit.MILLISECONDS)); printStats(stats); }
[ "public", "void", "primeConnections", "(", "List", "<", "Server", ">", "servers", ")", "{", "if", "(", "servers", "==", "null", "||", "servers", ".", "size", "(", ")", "==", "0", ")", "{", "logger", ".", "debug", "(", "\"No server to prime\"", ")", ";"...
Prime connections, blocking until configured percentage (default is 100%) of target servers are primed or max time is reached. @see CommonClientConfigKey#MinPrimeConnectionsRatio @see CommonClientConfigKey#MaxTotalTimeToPrimeConnections
[ "Prime", "connections", "blocking", "until", "configured", "percentage", "(", "default", "is", "100%", ")", "of", "target", "servers", "are", "primed", "or", "max", "time", "is", "reached", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/PrimeConnections.java#L198-L235
osmdroid/osmdroid
osmdroid-mapsforge/src/main/java/org/osmdroid/mapsforge/MapsForgeTileSource.java
MapsForgeTileSource.renderTile
public synchronized Drawable renderTile(final long pMapTileIndex) { Tile tile = new Tile(MapTileIndex.getX(pMapTileIndex), MapTileIndex.getY(pMapTileIndex), (byte) MapTileIndex.getZoom(pMapTileIndex), 256); model.setFixedTileSize(256); //You could try something like this to load a custom theme //try{ // jobTheme = new ExternalRenderTheme(themeFile); //} //catch(Exception e){ // jobTheme = InternalRenderTheme.OSMARENDER; //} if (mapDatabase==null) return null; try { //Draw the tile RendererJob mapGeneratorJob = new RendererJob(tile, mapDatabase, theme, model, scale, false, false); AndroidTileBitmap bmp = (AndroidTileBitmap) renderer.executeJob(mapGeneratorJob); if (bmp != null) return new BitmapDrawable(AndroidGraphicFactory.getBitmap(bmp)); } catch (Exception ex) { Log.d(IMapView.LOGTAG, "###################### Mapsforge tile generation failed", ex); } //Make the bad tile easy to spot Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE_PIXELS, TILE_SIZE_PIXELS, Bitmap.Config.RGB_565); bitmap.eraseColor(Color.YELLOW); return new BitmapDrawable(bitmap); }
java
public synchronized Drawable renderTile(final long pMapTileIndex) { Tile tile = new Tile(MapTileIndex.getX(pMapTileIndex), MapTileIndex.getY(pMapTileIndex), (byte) MapTileIndex.getZoom(pMapTileIndex), 256); model.setFixedTileSize(256); //You could try something like this to load a custom theme //try{ // jobTheme = new ExternalRenderTheme(themeFile); //} //catch(Exception e){ // jobTheme = InternalRenderTheme.OSMARENDER; //} if (mapDatabase==null) return null; try { //Draw the tile RendererJob mapGeneratorJob = new RendererJob(tile, mapDatabase, theme, model, scale, false, false); AndroidTileBitmap bmp = (AndroidTileBitmap) renderer.executeJob(mapGeneratorJob); if (bmp != null) return new BitmapDrawable(AndroidGraphicFactory.getBitmap(bmp)); } catch (Exception ex) { Log.d(IMapView.LOGTAG, "###################### Mapsforge tile generation failed", ex); } //Make the bad tile easy to spot Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE_PIXELS, TILE_SIZE_PIXELS, Bitmap.Config.RGB_565); bitmap.eraseColor(Color.YELLOW); return new BitmapDrawable(bitmap); }
[ "public", "synchronized", "Drawable", "renderTile", "(", "final", "long", "pMapTileIndex", ")", "{", "Tile", "tile", "=", "new", "Tile", "(", "MapTileIndex", ".", "getX", "(", "pMapTileIndex", ")", ",", "MapTileIndex", ".", "getY", "(", "pMapTileIndex", ")", ...
The synchronized here is VERY important. If missing, the mapDatabase read gets corrupted by multiple threads reading the file at once.
[ "The", "synchronized", "here", "is", "VERY", "important", ".", "If", "missing", "the", "mapDatabase", "read", "gets", "corrupted", "by", "multiple", "threads", "reading", "the", "file", "at", "once", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-mapsforge/src/main/java/org/osmdroid/mapsforge/MapsForgeTileSource.java#L178-L207
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java
BingNewsImpl.searchWithServiceResponseAsync
public Observable<ServiceResponse<NewsModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Integer offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final Boolean originalImage = searchOptionalParameter != null ? searchOptionalParameter.originalImage() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final String sortBy = searchOptionalParameter != null ? searchOptionalParameter.sortBy() : null; final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter.textDecorations() : null; final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter.textFormat() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, freshness, market, offset, originalImage, safeSearch, setLang, sortBy, textDecorations, textFormat); }
java
public Observable<ServiceResponse<NewsModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Integer offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final Boolean originalImage = searchOptionalParameter != null ? searchOptionalParameter.originalImage() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final String sortBy = searchOptionalParameter != null ? searchOptionalParameter.sortBy() : null; final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter.textDecorations() : null; final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter.textFormat() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, freshness, market, offset, originalImage, safeSearch, setLang, sortBy, textDecorations, textFormat); }
[ "public", "Observable", "<", "ServiceResponse", "<", "NewsModel", ">", ">", "searchWithServiceResponseAsync", "(", "String", "query", ",", "SearchOptionalParameter", "searchOptionalParameter", ")", "{", "if", "(", "query", "==", "null", ")", "{", "throw", "new", "...
The News Search API lets you send a search query to Bing and get back a list of news that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request news and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the web for news](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-news-search/search-the-web). @param query The user's search query string. The query string cannot be empty. The query string may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit news to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this parameter only with the News Search API. Do not specify this parameter when calling the Trending Topics API or News Category API. @param searchOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NewsModel object
[ "The", "News", "Search", "API", "lets", "you", "send", "a", "search", "query", "to", "Bing", "and", "get", "back", "a", "list", "of", "news", "that", "are", "relevant", "to", "the", "search", "query", ".", "This", "section", "provides", "technical", "det...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingnewssearch/src/main/java/com/microsoft/azure/cognitiveservices/search/newssearch/implementation/BingNewsImpl.java#L129-L151
byoutline/CachedField
cachedfield/src/main/java/com/byoutline/cachedfield/internal/CachedValue.java
CachedValue.removeStateListener
public synchronized boolean removeStateListener(@Nonnull EndpointStateListener<VALUE_TYPE, ARG_TYPE> listener) throws IllegalArgumentException { checkListenerNonNull(listener); return fieldStateListeners.remove(listener); }
java
public synchronized boolean removeStateListener(@Nonnull EndpointStateListener<VALUE_TYPE, ARG_TYPE> listener) throws IllegalArgumentException { checkListenerNonNull(listener); return fieldStateListeners.remove(listener); }
[ "public", "synchronized", "boolean", "removeStateListener", "(", "@", "Nonnull", "EndpointStateListener", "<", "VALUE_TYPE", ",", "ARG_TYPE", ">", "listener", ")", "throws", "IllegalArgumentException", "{", "checkListenerNonNull", "(", "listener", ")", ";", "return", ...
Remove field state listener @param listener @return true if listeners collection was modified by this operation, false otherwise @throws IllegalArgumentException if listener is null
[ "Remove", "field", "state", "listener" ]
train
https://github.com/byoutline/CachedField/blob/73d83072cdca22d2b3f5b3d60a93b8a26d9513e6/cachedfield/src/main/java/com/byoutline/cachedfield/internal/CachedValue.java#L146-L149
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java
ByteArrayUtil.readShort
public static short readShort(byte[] array, int offset) { // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; return (short) ((b0 << 8) + (b1 << 0)); }
java
public static short readShort(byte[] array, int offset) { // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; return (short) ((b0 << 8) + (b1 << 0)); }
[ "public", "static", "short", "readShort", "(", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "// First make integers to resolve signed vs. unsigned issues.", "int", "b0", "=", "array", "[", "offset", "+", "0", "]", "&", "0xFF", ";", "int", "b1", ...
Read a short from the byte array at the given offset. @param array Array to read from @param offset Offset to read at @return (signed) short
[ "Read", "a", "short", "from", "the", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L179-L184
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_backend_backend_backupState_POST
public OvhLoadBalancingTask loadBalancing_serviceName_backend_backend_backupState_POST(String serviceName, String backend, Boolean backupStateSet, String mainBackendIp) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}/backupState"; StringBuilder sb = path(qPath, serviceName, backend); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupStateSet", backupStateSet); addBody(o, "mainBackendIp", mainBackendIp); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhLoadBalancingTask.class); }
java
public OvhLoadBalancingTask loadBalancing_serviceName_backend_backend_backupState_POST(String serviceName, String backend, Boolean backupStateSet, String mainBackendIp) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}/backupState"; StringBuilder sb = path(qPath, serviceName, backend); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupStateSet", backupStateSet); addBody(o, "mainBackendIp", mainBackendIp); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhLoadBalancingTask.class); }
[ "public", "OvhLoadBalancingTask", "loadBalancing_serviceName_backend_backend_backupState_POST", "(", "String", "serviceName", ",", "String", "backend", ",", "Boolean", "backupStateSet", ",", "String", "mainBackendIp", ")", "throws", "IOException", "{", "String", "qPath", "=...
Set or unset the backend as a backup of another backend. Requests will be directed to the backup only if the main backend is in probe fail REST: POST /ip/loadBalancing/{serviceName}/backend/{backend}/backupState @param backupStateSet [required] Set or unset the backend as backup. mainBackendIp is optional in case of unset @param mainBackendIp [required] Main backend ip, must be in the same zone as the backup @param serviceName [required] The internal name of your IP load balancing @param backend [required] IP of your backend
[ "Set", "or", "unset", "the", "backend", "as", "a", "backup", "of", "another", "backend", ".", "Requests", "will", "be", "directed", "to", "the", "backup", "only", "if", "the", "main", "backend", "is", "in", "probe", "fail" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1381-L1389
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2List
public List<List<String>> readExcel2List(String excelPath, int offsetLine, int limitLine, int sheetIndex) throws IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
java
public List<List<String>> readExcel2List(String excelPath, int offsetLine, int limitLine, int sheetIndex) throws IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
[ "public", "List", "<", "List", "<", "String", ">", ">", "readExcel2List", "(", "String", "excelPath", ",", "int", "offsetLine", ",", "int", "limitLine", ",", "int", "sheetIndex", ")", "throws", "IOException", ",", "InvalidFormatException", "{", "try", "(", "...
读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param excelPath 待读取Excel的路径 @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @return 返回{@code List<List<String>>}类型的数据集合 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel表格数据", "返回", "{", "@code", "List", "[", "List", "[", "String", "]]", "}", "类型的数据集合" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L318-L324
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/Preconditions.java
Preconditions.checkNotNull
public static <T> T checkNotNull (T value, String param) { if (value == null) { throw new NullPointerException("Must supply non-null '" + param + "'."); } return value; }
java
public static <T> T checkNotNull (T value, String param) { if (value == null) { throw new NullPointerException("Must supply non-null '" + param + "'."); } return value; }
[ "public", "static", "<", "T", ">", "T", "checkNotNull", "(", "T", "value", ",", "String", "param", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Must supply non-null '\"", "+", "param", "+", "\"'.\"",...
Checks that the supplied parameter is not null. Throws a {@link NullPointerException} if it is, using the supplied `param` string to include an informative error message.
[ "Checks", "that", "the", "supplied", "parameter", "is", "not", "null", ".", "Throws", "a", "{" ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/Preconditions.java#L33-L39
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.dateSub
public static String dateSub(String dateStr, int days, TimeZone tz) { long ts = parseToTimeMillis(dateStr, tz); if (ts == Long.MIN_VALUE) { return null; } return dateSub(ts, days, tz); }
java
public static String dateSub(String dateStr, int days, TimeZone tz) { long ts = parseToTimeMillis(dateStr, tz); if (ts == Long.MIN_VALUE) { return null; } return dateSub(ts, days, tz); }
[ "public", "static", "String", "dateSub", "(", "String", "dateStr", ",", "int", "days", ",", "TimeZone", "tz", ")", "{", "long", "ts", "=", "parseToTimeMillis", "(", "dateStr", ",", "tz", ")", ";", "if", "(", "ts", "==", "Long", ".", "MIN_VALUE", ")", ...
Do subtraction on date string. @param dateStr formatted date string. @param days days count you want to subtract. @param tz time zone of the date time string @return datetime string.
[ "Do", "subtraction", "on", "date", "string", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L755-L761
reactor/reactor-netty
src/main/java/reactor/netty/tcp/InetSocketAddressUtil.java
InetSocketAddressUtil.createInetSocketAddress
public static InetSocketAddress createInetSocketAddress(String hostname, int port, boolean resolve) { InetSocketAddress inetAddressForIpString = createForIpString(hostname, port); if (inetAddressForIpString != null) { return inetAddressForIpString; } else { return resolve ? new InetSocketAddress(hostname, port) : InetSocketAddress.createUnresolved(hostname, port); } }
java
public static InetSocketAddress createInetSocketAddress(String hostname, int port, boolean resolve) { InetSocketAddress inetAddressForIpString = createForIpString(hostname, port); if (inetAddressForIpString != null) { return inetAddressForIpString; } else { return resolve ? new InetSocketAddress(hostname, port) : InetSocketAddress.createUnresolved(hostname, port); } }
[ "public", "static", "InetSocketAddress", "createInetSocketAddress", "(", "String", "hostname", ",", "int", "port", ",", "boolean", "resolve", ")", "{", "InetSocketAddress", "inetAddressForIpString", "=", "createForIpString", "(", "hostname", ",", "port", ")", ";", "...
Creates InetSocketAddress instance. Numeric IP addresses will be detected and resolved without doing reverse DNS lookups. @param hostname ip-address or hostname @param port port number @param resolve when true, resolve given hostname at instance creation time @return InetSocketAddress for given parameters
[ "Creates", "InetSocketAddress", "instance", ".", "Numeric", "IP", "addresses", "will", "be", "detected", "and", "resolved", "without", "doing", "reverse", "DNS", "lookups", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/InetSocketAddressUtil.java#L72-L82
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/temporal/Timex2Time.java
Timex2Time.anchoredCopy
@Deprecated public Timex2Time anchoredCopy(final String anchorVal, final Symbol anchorDir) { return anchoredCopy(Symbol.from(checkNotNull(anchorVal)), checkNotNull(anchorDir)); }
java
@Deprecated public Timex2Time anchoredCopy(final String anchorVal, final Symbol anchorDir) { return anchoredCopy(Symbol.from(checkNotNull(anchorVal)), checkNotNull(anchorDir)); }
[ "@", "Deprecated", "public", "Timex2Time", "anchoredCopy", "(", "final", "String", "anchorVal", ",", "final", "Symbol", "anchorDir", ")", "{", "return", "anchoredCopy", "(", "Symbol", ".", "from", "(", "checkNotNull", "(", "anchorVal", ")", ")", ",", "checkNot...
Returns a copy of this Timex which is the same except with the anchor attributes set as specified. @deprecated Use {@link #copyBuilder()} and {@link Builder#withAnchorValue(Symbol)} and {@link Builder#withAnchorDirection(Symbol)} instead
[ "Returns", "a", "copy", "of", "this", "Timex", "which", "is", "the", "same", "except", "with", "the", "anchor", "attributes", "set", "as", "specified", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/temporal/Timex2Time.java#L211-L214
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.pluralizeFormat
public static MessageFormat pluralizeFormat(final String template) { String[] tokens = template.split("\\s*\\:{2}\\s*"); if (tokens.length < 4) { if (tokens.length == 2) { tokens = new String[] { "{0}", tokens[1], tokens[0], tokens[1] }; } else if (tokens.length == 3) { tokens = new String[] { "{0}", tokens[0], tokens[1], tokens[2] }; } else { throw new IllegalArgumentException(String.format( "Template '%s' must declare at least 2 tokens. V.gr. 'one thing::{0} things'", template)); } } return pluralizeFormat(tokens[0], Arrays.copyOfRange(tokens, 1, tokens.length)); }
java
public static MessageFormat pluralizeFormat(final String template) { String[] tokens = template.split("\\s*\\:{2}\\s*"); if (tokens.length < 4) { if (tokens.length == 2) { tokens = new String[] { "{0}", tokens[1], tokens[0], tokens[1] }; } else if (tokens.length == 3) { tokens = new String[] { "{0}", tokens[0], tokens[1], tokens[2] }; } else { throw new IllegalArgumentException(String.format( "Template '%s' must declare at least 2 tokens. V.gr. 'one thing::{0} things'", template)); } } return pluralizeFormat(tokens[0], Arrays.copyOfRange(tokens, 1, tokens.length)); }
[ "public", "static", "MessageFormat", "pluralizeFormat", "(", "final", "String", "template", ")", "{", "String", "[", "]", "tokens", "=", "template", ".", "split", "(", "\"\\\\s*\\\\:{2}\\\\s*\"", ")", ";", "if", "(", "tokens", ".", "length", "<", "4", ")", ...
<p> Constructs a message with pluralization logic from the given template. </p> <h5>Examples:</h5> <pre> MessageFormat msg = pluralize(&quot;There {0} on {1}.::are no files::is one file::are {2} files&quot;); msg.render(0, &quot;disk&quot;); // == &quot;There are no files on disk.&quot; msg.render(1, &quot;disk&quot;); // == &quot;There is one file on disk.&quot; msg.render(1000, &quot;disk&quot;); // == &quot;There are 1,000 files on disk.&quot; </pre> <pre> MessageFormat msg = pluralize(&quot;nothing::one thing::{0} things&quot;); msg.render(-1); // == &quot;nothing&quot; msg.render(0); // == &quot;nothing&quot; msg.render(1); // == &quot;one thing&quot; msg.render(2); // == &quot;2 things&quot; </pre> <pre> MessageFormat msg = pluralize(&quot;one thing::{0} things&quot;); msg.render(-1); // == &quot;-1 things&quot; msg.render(0); // == &quot;0 things&quot; msg.render(1); // == &quot;one thing&quot; msg.render(2); // == &quot;2 things&quot; </pre> @param template String of tokens delimited by '::' @return Message instance prepared to generate pluralized strings
[ "<p", ">", "Constructs", "a", "message", "with", "pluralization", "logic", "from", "the", "given", "template", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2374-L2394
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java
FactoryVisualOdometry.stereoDualTrackerPnP
public static <T extends ImageGray<T>, Desc extends TupleDesc> StereoVisualOdometry<T> stereoDualTrackerPnP(int thresholdAdd, int thresholdRetire, double inlierPixelTol, double epipolarPixelTol, int ransacIterations, int refineIterations, PointTracker<T> trackerLeft, PointTracker<T> trackerRight, DescribeRegionPoint<T,Desc> descriptor, Class<T> imageType) { EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1); DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq(); PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq(); PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0); ModelManagerSe3_F64 manager = new ModelManagerSe3_F64(); EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo); // Pixel tolerance for RANSAC inliers - euclidean error squared from left + right images double ransacTOL = 2*inlierPixelTol * inlierPixelTol; ModelMatcher<Se3_F64, Stereo2D3D> motion = new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL); RefinePnPStereo refinePnP = null; Class<Desc> descType = descriptor.getDescriptionType(); ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType); AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType); // need to make sure associations are unique AssociateDescription2D<Desc> associateUnique = associateStereo; if( !associateStereo.uniqueDestination() || !associateStereo.uniqueSource() ) { associateUnique = new EnforceUniqueByScore.Describe2D<>(associateStereo, true, true); } if( refineIterations > 0 ) { refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations); } Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric( new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC)); VisOdomDualTrackPnP<T,Desc> alg = new VisOdomDualTrackPnP<>(thresholdAdd, thresholdRetire, epipolarPixelTol, trackerLeft, trackerRight, descriptor, associateUnique, triangulate, motion, refinePnP); return new WrapVisOdomDualTrackPnP<>(pnpStereo, distanceMono, distanceStereo, associateStereo, alg, refinePnP, imageType); }
java
public static <T extends ImageGray<T>, Desc extends TupleDesc> StereoVisualOdometry<T> stereoDualTrackerPnP(int thresholdAdd, int thresholdRetire, double inlierPixelTol, double epipolarPixelTol, int ransacIterations, int refineIterations, PointTracker<T> trackerLeft, PointTracker<T> trackerRight, DescribeRegionPoint<T,Desc> descriptor, Class<T> imageType) { EstimateNofPnP pnp = FactoryMultiView.pnp_N(EnumPNP.P3P_FINSTERWALDER, -1); DistanceFromModelMultiView<Se3_F64,Point2D3D> distanceMono = new PnPDistanceReprojectionSq(); PnPStereoDistanceReprojectionSq distanceStereo = new PnPStereoDistanceReprojectionSq(); PnPStereoEstimator pnpStereo = new PnPStereoEstimator(pnp,distanceMono,0); ModelManagerSe3_F64 manager = new ModelManagerSe3_F64(); EstimatorToGenerator<Se3_F64,Stereo2D3D> generator = new EstimatorToGenerator<>(pnpStereo); // Pixel tolerance for RANSAC inliers - euclidean error squared from left + right images double ransacTOL = 2*inlierPixelTol * inlierPixelTol; ModelMatcher<Se3_F64, Stereo2D3D> motion = new Ransac<>(2323, manager, generator, distanceStereo, ransacIterations, ransacTOL); RefinePnPStereo refinePnP = null; Class<Desc> descType = descriptor.getDescriptionType(); ScoreAssociation<Desc> scorer = FactoryAssociation.defaultScore(descType); AssociateStereo2D<Desc> associateStereo = new AssociateStereo2D<>(scorer, epipolarPixelTol, descType); // need to make sure associations are unique AssociateDescription2D<Desc> associateUnique = associateStereo; if( !associateStereo.uniqueDestination() || !associateStereo.uniqueSource() ) { associateUnique = new EnforceUniqueByScore.Describe2D<>(associateStereo, true, true); } if( refineIterations > 0 ) { refinePnP = new PnPStereoRefineRodrigues(1e-12,refineIterations); } Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric( new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC)); VisOdomDualTrackPnP<T,Desc> alg = new VisOdomDualTrackPnP<>(thresholdAdd, thresholdRetire, epipolarPixelTol, trackerLeft, trackerRight, descriptor, associateUnique, triangulate, motion, refinePnP); return new WrapVisOdomDualTrackPnP<>(pnpStereo, distanceMono, distanceStereo, associateStereo, alg, refinePnP, imageType); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "Desc", "extends", "TupleDesc", ">", "StereoVisualOdometry", "<", "T", ">", "stereoDualTrackerPnP", "(", "int", "thresholdAdd", ",", "int", "thresholdRetire", ",", "double", "inlierPixelTo...
Creates a stereo visual odometry algorithm that independently tracks features in left and right camera. @see VisOdomDualTrackPnP @param thresholdAdd When the number of inliers is below this number new features are detected @param thresholdRetire When a feature has not been in the inlier list for this many ticks it is dropped @param inlierPixelTol Tolerance in pixels for defining an inlier during robust model matching. Typically 1.5 @param epipolarPixelTol Tolerance in pixels for enforcing the epipolar constraint @param ransacIterations Number of iterations performed by RANSAC. Try 300 or more. @param refineIterations Number of iterations done during non-linear optimization. Try 50 or more. @param trackerLeft Tracker used for left camera @param trackerRight Tracker used for right camera @param imageType Type of image being processed @return Stereo visual odometry algorithm.
[ "Creates", "a", "stereo", "visual", "odometry", "algorithm", "that", "independently", "tracks", "features", "in", "left", "and", "right", "camera", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/factory/sfm/FactoryVisualOdometry.java#L293-L340
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.onViewCreated
public View onViewCreated(View view, Context context, AttributeSet attrs) { if (view != null && view.getTag(R.id.calligraphy_tag_id) != Boolean.TRUE) { onViewCreatedInternal(view, context, attrs); view.setTag(R.id.calligraphy_tag_id, Boolean.TRUE); } return view; }
java
public View onViewCreated(View view, Context context, AttributeSet attrs) { if (view != null && view.getTag(R.id.calligraphy_tag_id) != Boolean.TRUE) { onViewCreatedInternal(view, context, attrs); view.setTag(R.id.calligraphy_tag_id, Boolean.TRUE); } return view; }
[ "public", "View", "onViewCreated", "(", "View", "view", ",", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "if", "(", "view", "!=", "null", "&&", "view", ".", "getTag", "(", "R", ".", "id", ".", "calligraphy_tag_id", ")", "!=", "Boolean",...
Handle the created view @param view nullable. @param context shouldn't be null. @param attrs shouldn't be null. @return null if null is passed in.
[ "Handle", "the", "created", "view" ]
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L108-L114
apache/groovy
src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java
ConcurrentCommonCache.doWithWriteLock
private <R> R doWithWriteLock(Action<K, V, R> action) { writeLock.lock(); try { return action.doWith(commonCache); } finally { writeLock.unlock(); } }
java
private <R> R doWithWriteLock(Action<K, V, R> action) { writeLock.lock(); try { return action.doWith(commonCache); } finally { writeLock.unlock(); } }
[ "private", "<", "R", ">", "R", "doWithWriteLock", "(", "Action", "<", "K", ",", "V", ",", "R", ">", "action", ")", "{", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "return", "action", ".", "doWith", "(", "commonCache", ")", ";", "}", "fi...
deal with the backed cache guarded by write lock @param action the content to complete
[ "deal", "with", "the", "backed", "cache", "guarded", "by", "write", "lock" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/memoize/ConcurrentCommonCache.java#L247-L254
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/VirtualDiskManager.java
VirtualDiskManager.importUnmanagedSnapshot
public void importUnmanagedSnapshot(String vdisk, Datacenter datacenter, String vvolId) throws InvalidDatastore, NotFound, RuntimeFault, RemoteException { getVimService().importUnmanagedSnapshot(getMOR(), vdisk, datacenter == null ? null : datacenter.getMOR(), vvolId); }
java
public void importUnmanagedSnapshot(String vdisk, Datacenter datacenter, String vvolId) throws InvalidDatastore, NotFound, RuntimeFault, RemoteException { getVimService().importUnmanagedSnapshot(getMOR(), vdisk, datacenter == null ? null : datacenter.getMOR(), vvolId); }
[ "public", "void", "importUnmanagedSnapshot", "(", "String", "vdisk", ",", "Datacenter", "datacenter", ",", "String", "vvolId", ")", "throws", "InvalidDatastore", ",", "NotFound", ",", "RuntimeFault", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "im...
Import an unmanaged-snapshot from Virtual-Volume(VVol) enabled Storage Array. <p> Storage Array may support users to take snapshots indepedent of VMware stack. Such copies or snapshots are known as 'Unmanaged-Snapshots'. We are providing an ability to end-users to import such unmanaged-snapshots as Virtual Disks. <p> End-user needs to know the VVol-Identifier to import unmanaged snapshot as VirtualDisk. <p> Once VirtualDisk is created, user can use 'Datastore Browser' to use with rest of Virtual Machine provisioning APIs. @param vdisk - The name of the disk to import, either a datastore path or a URL referring to the virtual disk from which to get geometry information. @param datacenter - If vdisk is a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter, vdisk must be a URL. @param vvolId Unmanaged snapshot identifier @throws InvalidDatastore @throws NotFound @throws RuntimeFault @throws RemoteException @since 6.0
[ "Import", "an", "unmanaged", "-", "snapshot", "from", "Virtual", "-", "Volume", "(", "VVol", ")", "enabled", "Storage", "Array", ".", "<p", ">", "Storage", "Array", "may", "support", "users", "to", "take", "snapshots", "indepedent", "of", "VMware", "stack", ...
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VirtualDiskManager.java#L165-L167
banq/jdonframework
src/main/java/com/jdon/util/FileUtil.java
FileUtil.createFile
public static void createFile(String output, String content) throws Exception { OutputStreamWriter fw = null; PrintWriter out = null; try { if (ENCODING == null) ENCODING = PropsUtil.ENCODING; fw = new OutputStreamWriter(new FileOutputStream(output), ENCODING); out = new PrintWriter(fw); out.print(content); } catch (Exception ex) { throw new Exception(ex); } finally { if (out != null) out.close(); if (fw != null) fw.close(); } }
java
public static void createFile(String output, String content) throws Exception { OutputStreamWriter fw = null; PrintWriter out = null; try { if (ENCODING == null) ENCODING = PropsUtil.ENCODING; fw = new OutputStreamWriter(new FileOutputStream(output), ENCODING); out = new PrintWriter(fw); out.print(content); } catch (Exception ex) { throw new Exception(ex); } finally { if (out != null) out.close(); if (fw != null) fw.close(); } }
[ "public", "static", "void", "createFile", "(", "String", "output", ",", "String", "content", ")", "throws", "Exception", "{", "OutputStreamWriter", "fw", "=", "null", ";", "PrintWriter", "out", "=", "null", ";", "try", "{", "if", "(", "ENCODING", "==", "nu...
write the content to a file; @param output @param content @throws Exception
[ "write", "the", "content", "to", "a", "file", ";" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/FileUtil.java#L38-L57