repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilderLegacy.java
SearchBuilderLegacy.fromJson
static SearchBuilder fromJson(String json) { """ Returns the {@link SearchBuilder} represented by the specified JSON {@code String}. @param json the JSON {@code String} representing a {@link SearchBuilder} @return the {@link SearchBuilder} represented by the specified JSON {@code String} """ try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } }
java
static SearchBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } }
[ "static", "SearchBuilder", "fromJson", "(", "String", "json", ")", "{", "try", "{", "return", "JsonSerializer", ".", "fromString", "(", "json", ",", "SearchBuilderLegacy", ".", "class", ")", ".", "builder", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IndexException", "(", "e", ",", "\"Unparseable JSON search: {}\"", ",", "json", ")", ";", "}", "}" ]
Returns the {@link SearchBuilder} represented by the specified JSON {@code String}. @param json the JSON {@code String} representing a {@link SearchBuilder} @return the {@link SearchBuilder} represented by the specified JSON {@code String}
[ "Returns", "the", "{", "@link", "SearchBuilder", "}", "represented", "by", "the", "specified", "JSON", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilderLegacy.java#L97-L103
treasure-data/td-client-java
src/main/java/com/treasuredata/client/TDHttpClient.java
TDHttpClient.submitRequest
public <Result> Result submitRequest(TDApiRequest apiRequest, Optional<String> apiKeyCache, TDHttpRequestHandler<Result> handler) throws TDClientException { """ A low-level method to submit a TD API request. @param apiRequest @param apiKeyCache @param handler @param <Result> @return @throws TDClientException """ RequestContext requestContext = new RequestContext(config, apiRequest, apiKeyCache); try { return submitRequest(requestContext, handler); } catch (InterruptedException e) { logger.warn("API request interrupted", e); throw new TDClientInterruptedException(e); } catch (TDClientException e) { throw e; } catch (Exception e) { throw new TDClientException(INVALID_JSON_RESPONSE, e); } }
java
public <Result> Result submitRequest(TDApiRequest apiRequest, Optional<String> apiKeyCache, TDHttpRequestHandler<Result> handler) throws TDClientException { RequestContext requestContext = new RequestContext(config, apiRequest, apiKeyCache); try { return submitRequest(requestContext, handler); } catch (InterruptedException e) { logger.warn("API request interrupted", e); throw new TDClientInterruptedException(e); } catch (TDClientException e) { throw e; } catch (Exception e) { throw new TDClientException(INVALID_JSON_RESPONSE, e); } }
[ "public", "<", "Result", ">", "Result", "submitRequest", "(", "TDApiRequest", "apiRequest", ",", "Optional", "<", "String", ">", "apiKeyCache", ",", "TDHttpRequestHandler", "<", "Result", ">", "handler", ")", "throws", "TDClientException", "{", "RequestContext", "requestContext", "=", "new", "RequestContext", "(", "config", ",", "apiRequest", ",", "apiKeyCache", ")", ";", "try", "{", "return", "submitRequest", "(", "requestContext", ",", "handler", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "logger", ".", "warn", "(", "\"API request interrupted\"", ",", "e", ")", ";", "throw", "new", "TDClientInterruptedException", "(", "e", ")", ";", "}", "catch", "(", "TDClientException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TDClientException", "(", "INVALID_JSON_RESPONSE", ",", "e", ")", ";", "}", "}" ]
A low-level method to submit a TD API request. @param apiRequest @param apiKeyCache @param handler @param <Result> @return @throws TDClientException
[ "A", "low", "-", "level", "method", "to", "submit", "a", "TD", "API", "request", "." ]
train
https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L455-L472
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.getPublicMethod
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { """ 查找指定Public方法 如果找不到对应的方法或方法不为public的则返回<code>null</code> @param clazz 类 @param methodName 方法名 @param paramTypes 参数类型 @return 方法 @throws SecurityException 无权访问抛出异常 """ return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes); }
java
public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { return ReflectUtil.getPublicMethod(clazz, methodName, paramTypes); }
[ "public", "static", "Method", "getPublicMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "throws", "SecurityException", "{", "return", "ReflectUtil", ".", "getPublicMethod", "(", "clazz", ",", "methodName", ",", "paramTypes", ")", ";", "}" ]
查找指定Public方法 如果找不到对应的方法或方法不为public的则返回<code>null</code> @param clazz 类 @param methodName 方法名 @param paramTypes 参数类型 @return 方法 @throws SecurityException 无权访问抛出异常
[ "查找指定Public方法", "如果找不到对应的方法或方法不为public的则返回<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L294-L296
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/CustomViewPager.java
CustomViewPager.onMeasure
@Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { """ Setting wrap_content on a ViewPager's layout_height in XML doesn't seem to be recognized and the ViewPager will fill the height of the screen regardless. We'll force the ViewPager to have the same height as its immediate child. <p> Thanks to alexrainman for the bugfix! """ int height = 0; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = child.getMeasuredHeight(); if (h > height) height = h; } heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); mDatePicker = (DatePicker) findViewById(R.id.hlklib_datetimepicker_date_picker); mTimePicker = (TimePicker) findViewById(R.id.hlklib_datetimepicker_time_picker); }
java
@Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int height = 0; for (int i = 0; i < getChildCount(); i++) { View child = getChildAt(i); child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); int h = child.getMeasuredHeight(); if (h > height) height = h; } heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY); super.onMeasure(widthMeasureSpec, heightMeasureSpec); mDatePicker = (DatePicker) findViewById(R.id.hlklib_datetimepicker_date_picker); mTimePicker = (TimePicker) findViewById(R.id.hlklib_datetimepicker_time_picker); }
[ "@", "Override", "public", "void", "onMeasure", "(", "int", "widthMeasureSpec", ",", "int", "heightMeasureSpec", ")", "{", "int", "height", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getChildCount", "(", ")", ";", "i", "++", ")", "{", "View", "child", "=", "getChildAt", "(", "i", ")", ";", "child", ".", "measure", "(", "widthMeasureSpec", ",", "MeasureSpec", ".", "makeMeasureSpec", "(", "0", ",", "MeasureSpec", ".", "UNSPECIFIED", ")", ")", ";", "int", "h", "=", "child", ".", "getMeasuredHeight", "(", ")", ";", "if", "(", "h", ">", "height", ")", "height", "=", "h", ";", "}", "heightMeasureSpec", "=", "MeasureSpec", ".", "makeMeasureSpec", "(", "height", ",", "MeasureSpec", ".", "EXACTLY", ")", ";", "super", ".", "onMeasure", "(", "widthMeasureSpec", ",", "heightMeasureSpec", ")", ";", "mDatePicker", "=", "(", "DatePicker", ")", "findViewById", "(", "R", ".", "id", ".", "hlklib_datetimepicker_date_picker", ")", ";", "mTimePicker", "=", "(", "TimePicker", ")", "findViewById", "(", "R", ".", "id", ".", "hlklib_datetimepicker_time_picker", ")", ";", "}" ]
Setting wrap_content on a ViewPager's layout_height in XML doesn't seem to be recognized and the ViewPager will fill the height of the screen regardless. We'll force the ViewPager to have the same height as its immediate child. <p> Thanks to alexrainman for the bugfix!
[ "Setting", "wrap_content", "on", "a", "ViewPager", "s", "layout_height", "in", "XML", "doesn", "t", "seem", "to", "be", "recognized", "and", "the", "ViewPager", "will", "fill", "the", "height", "of", "the", "screen", "regardless", ".", "We", "ll", "force", "the", "ViewPager", "to", "have", "the", "same", "height", "as", "its", "immediate", "child", ".", "<p", ">", "Thanks", "to", "alexrainman", "for", "the", "bugfix!" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/CustomViewPager.java#L51-L69
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java
JobsInner.listByExperimentAsync
public Observable<Page<JobInner>> listByExperimentAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final JobsListByExperimentOptions jobsListByExperimentOptions) { """ Gets a list of Jobs within the specified Experiment. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobsListByExperimentOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobInner&gt; object """ return listByExperimentWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobsListByExperimentOptions) .map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() { @Override public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) { return response.body(); } }); }
java
public Observable<Page<JobInner>> listByExperimentAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final JobsListByExperimentOptions jobsListByExperimentOptions) { return listByExperimentWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobsListByExperimentOptions) .map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() { @Override public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "JobInner", ">", ">", "listByExperimentAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "workspaceName", ",", "final", "String", "experimentName", ",", "final", "JobsListByExperimentOptions", "jobsListByExperimentOptions", ")", "{", "return", "listByExperimentWithServiceResponseAsync", "(", "resourceGroupName", ",", "workspaceName", ",", "experimentName", ",", "jobsListByExperimentOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "JobInner", ">", ">", ",", "Page", "<", "JobInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "JobInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "JobInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of Jobs within the specified Experiment. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobsListByExperimentOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobInner&gt; object
[ "Gets", "a", "list", "of", "Jobs", "within", "the", "specified", "Experiment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L303-L311
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
ClassFinder.newCompletionFailure
private CompletionFailure newCompletionFailure(TypeSymbol c, JCDiagnostic diag) { """ Static factory for CompletionFailure objects. In practice, only one can be used at a time, so we share one to reduce the expense of allocating new exception objects. """ if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); return new CompletionFailure(c, diag); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } }
java
private CompletionFailure newCompletionFailure(TypeSymbol c, JCDiagnostic diag) { if (!cacheCompletionFailure) { // log.warning("proc.messager", // Log.getLocalizedString("class.file.not.found", c.flatname)); // c.debug.printStackTrace(); return new CompletionFailure(c, diag); } else { CompletionFailure result = cachedCompletionFailure; result.sym = c; result.diag = diag; return result; } }
[ "private", "CompletionFailure", "newCompletionFailure", "(", "TypeSymbol", "c", ",", "JCDiagnostic", "diag", ")", "{", "if", "(", "!", "cacheCompletionFailure", ")", "{", "// log.warning(\"proc.messager\",", "// Log.getLocalizedString(\"class.file.not.found\", c.flatname));", "// c.debug.printStackTrace();", "return", "new", "CompletionFailure", "(", "c", ",", "diag", ")", ";", "}", "else", "{", "CompletionFailure", "result", "=", "cachedCompletionFailure", ";", "result", ".", "sym", "=", "c", ";", "result", ".", "diag", "=", "diag", ";", "return", "result", ";", "}", "}" ]
Static factory for CompletionFailure objects. In practice, only one can be used at a time, so we share one to reduce the expense of allocating new exception objects.
[ "Static", "factory", "for", "CompletionFailure", "objects", ".", "In", "practice", "only", "one", "can", "be", "used", "at", "a", "time", "so", "we", "share", "one", "to", "reduce", "the", "expense", "of", "allocating", "new", "exception", "objects", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java#L375-L388
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java
RTreeIndexCoreExtension.dropAllTriggers
public void dropAllTriggers(String tableName, String geometryColumnName) { """ Drop Triggers that Maintain Spatial Index Values @param tableName table name @param geometryColumnName geometry column name """ dropInsertTrigger(tableName, geometryColumnName); dropUpdate1Trigger(tableName, geometryColumnName); dropUpdate2Trigger(tableName, geometryColumnName); dropUpdate3Trigger(tableName, geometryColumnName); dropUpdate4Trigger(tableName, geometryColumnName); dropDeleteTrigger(tableName, geometryColumnName); }
java
public void dropAllTriggers(String tableName, String geometryColumnName) { dropInsertTrigger(tableName, geometryColumnName); dropUpdate1Trigger(tableName, geometryColumnName); dropUpdate2Trigger(tableName, geometryColumnName); dropUpdate3Trigger(tableName, geometryColumnName); dropUpdate4Trigger(tableName, geometryColumnName); dropDeleteTrigger(tableName, geometryColumnName); }
[ "public", "void", "dropAllTriggers", "(", "String", "tableName", ",", "String", "geometryColumnName", ")", "{", "dropInsertTrigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "dropUpdate1Trigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "dropUpdate2Trigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "dropUpdate3Trigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "dropUpdate4Trigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "dropDeleteTrigger", "(", "tableName", ",", "geometryColumnName", ")", ";", "}" ]
Drop Triggers that Maintain Spatial Index Values @param tableName table name @param geometryColumnName geometry column name
[ "Drop", "Triggers", "that", "Maintain", "Spatial", "Index", "Values" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java#L876-L885
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.getIndexOfElementType
public static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes) { """ Find the index of the type of a model element in a list of element types @param modelElement the model element which type is searched for @param childElementTypes the list to search the type @return the index of the model element type in the list or -1 if it is not found """ for (int index = 0; index < childElementTypes.size(); index++) { ModelElementType childElementType = childElementTypes.get(index); Class<? extends ModelElementInstance> instanceType = childElementType.getInstanceType(); if(instanceType.isAssignableFrom(modelElement.getClass())) { return index; } } Collection<String> childElementTypeNames = new ArrayList<String>(); for (ModelElementType childElementType : childElementTypes) { childElementTypeNames.add(childElementType.getTypeName()); } throw new ModelException("New child is not a valid child element type: " + modelElement.getElementType().getTypeName() + "; valid types are: " + childElementTypeNames); }
java
public static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes) { for (int index = 0; index < childElementTypes.size(); index++) { ModelElementType childElementType = childElementTypes.get(index); Class<? extends ModelElementInstance> instanceType = childElementType.getInstanceType(); if(instanceType.isAssignableFrom(modelElement.getClass())) { return index; } } Collection<String> childElementTypeNames = new ArrayList<String>(); for (ModelElementType childElementType : childElementTypes) { childElementTypeNames.add(childElementType.getTypeName()); } throw new ModelException("New child is not a valid child element type: " + modelElement.getElementType().getTypeName() + "; valid types are: " + childElementTypeNames); }
[ "public", "static", "int", "getIndexOfElementType", "(", "ModelElementInstance", "modelElement", ",", "List", "<", "ModelElementType", ">", "childElementTypes", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "childElementTypes", ".", "size", "(", ")", ";", "index", "++", ")", "{", "ModelElementType", "childElementType", "=", "childElementTypes", ".", "get", "(", "index", ")", ";", "Class", "<", "?", "extends", "ModelElementInstance", ">", "instanceType", "=", "childElementType", ".", "getInstanceType", "(", ")", ";", "if", "(", "instanceType", ".", "isAssignableFrom", "(", "modelElement", ".", "getClass", "(", ")", ")", ")", "{", "return", "index", ";", "}", "}", "Collection", "<", "String", ">", "childElementTypeNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "ModelElementType", "childElementType", ":", "childElementTypes", ")", "{", "childElementTypeNames", ".", "add", "(", "childElementType", ".", "getTypeName", "(", ")", ")", ";", "}", "throw", "new", "ModelException", "(", "\"New child is not a valid child element type: \"", "+", "modelElement", ".", "getElementType", "(", ")", ".", "getTypeName", "(", ")", "+", "\"; valid types are: \"", "+", "childElementTypeNames", ")", ";", "}" ]
Find the index of the type of a model element in a list of element types @param modelElement the model element which type is searched for @param childElementTypes the list to search the type @return the index of the model element type in the list or -1 if it is not found
[ "Find", "the", "index", "of", "the", "type", "of", "a", "model", "element", "in", "a", "list", "of", "element", "types" ]
train
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L191-L204
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java
ScriptUtil.getScriptFromResource
public static ExecutableScript getScriptFromResource(String language, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { """ Creates a new {@link ExecutableScript} from a resource. It excepts static and dynamic resources. Dynamic means that the resource is an expression which will be evaluated during execution. @param language the language of the script @param resource the resource path of the script code or an expression which evaluates to the resource path @param expressionManager the expression manager to use to generate the expressions of dynamic scripts @param scriptFactory the script factory used to create the script @return the newly created script @throws NotValidException if language or resource are null or empty """ ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotEmpty(NotValidException.class, "Script resource", resource); if (isDynamicScriptExpression(language, resource)) { Expression resourceExpression = expressionManager.createExpression(resource); return getScriptFromResourceExpression(language, resourceExpression, scriptFactory); } else { return getScriptFromResource(language, resource, scriptFactory); } }
java
public static ExecutableScript getScriptFromResource(String language, String resource, ExpressionManager expressionManager, ScriptFactory scriptFactory) { ensureNotEmpty(NotValidException.class, "Script language", language); ensureNotEmpty(NotValidException.class, "Script resource", resource); if (isDynamicScriptExpression(language, resource)) { Expression resourceExpression = expressionManager.createExpression(resource); return getScriptFromResourceExpression(language, resourceExpression, scriptFactory); } else { return getScriptFromResource(language, resource, scriptFactory); } }
[ "public", "static", "ExecutableScript", "getScriptFromResource", "(", "String", "language", ",", "String", "resource", ",", "ExpressionManager", "expressionManager", ",", "ScriptFactory", "scriptFactory", ")", "{", "ensureNotEmpty", "(", "NotValidException", ".", "class", ",", "\"Script language\"", ",", "language", ")", ";", "ensureNotEmpty", "(", "NotValidException", ".", "class", ",", "\"Script resource\"", ",", "resource", ")", ";", "if", "(", "isDynamicScriptExpression", "(", "language", ",", "resource", ")", ")", "{", "Expression", "resourceExpression", "=", "expressionManager", ".", "createExpression", "(", "resource", ")", ";", "return", "getScriptFromResourceExpression", "(", "language", ",", "resourceExpression", ",", "scriptFactory", ")", ";", "}", "else", "{", "return", "getScriptFromResource", "(", "language", ",", "resource", ",", "scriptFactory", ")", ";", "}", "}" ]
Creates a new {@link ExecutableScript} from a resource. It excepts static and dynamic resources. Dynamic means that the resource is an expression which will be evaluated during execution. @param language the language of the script @param resource the resource path of the script code or an expression which evaluates to the resource path @param expressionManager the expression manager to use to generate the expressions of dynamic scripts @param scriptFactory the script factory used to create the script @return the newly created script @throws NotValidException if language or resource are null or empty
[ "Creates", "a", "new", "{", "@link", "ExecutableScript", "}", "from", "a", "resource", ".", "It", "excepts", "static", "and", "dynamic", "resources", ".", "Dynamic", "means", "that", "the", "resource", "is", "an", "expression", "which", "will", "be", "evaluated", "during", "execution", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L142-L152
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.listComputeNodes
public PagedList<ComputeNode> listComputeNodes(String poolId) throws BatchErrorException, IOException { """ Lists the {@link ComputeNode compute nodes} of the specified pool. @param poolId The ID of the pool. @return A list of {@link ComputeNode} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ return listComputeNodes(poolId, null, null); }
java
public PagedList<ComputeNode> listComputeNodes(String poolId) throws BatchErrorException, IOException { return listComputeNodes(poolId, null, null); }
[ "public", "PagedList", "<", "ComputeNode", ">", "listComputeNodes", "(", "String", "poolId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listComputeNodes", "(", "poolId", ",", "null", ",", "null", ")", ";", "}" ]
Lists the {@link ComputeNode compute nodes} of the specified pool. @param poolId The ID of the pool. @return A list of {@link ComputeNode} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "{", "@link", "ComputeNode", "compute", "nodes", "}", "of", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L506-L508
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.resumeAsync
public Observable<Page<SiteInner>> resumeAsync(final String resourceGroupName, final String name) { """ Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object """ return resumeWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
java
public Observable<Page<SiteInner>> resumeAsync(final String resourceGroupName, final String name) { return resumeWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SiteInner", ">", ">", "resumeAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "resumeWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", ",", "Page", "<", "SiteInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "SiteInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SiteInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SiteInner&gt; object
[ "Resume", "an", "App", "Service", "Environment", ".", "Resume", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3850-L3858
Gagravarr/VorbisJava
core/src/main/java/org/gagravarr/ogg/IOUtils.java
IOUtils.writeUTF8WithLength
public static void writeUTF8WithLength(OutputStream out, String str) throws IOException { """ Writes out a 4 byte integer of the length (in bytes!) of the String, followed by the String (as UTF-8) """ byte[] s = str.getBytes(UTF8); writeInt4(out, s.length); out.write(s); }
java
public static void writeUTF8WithLength(OutputStream out, String str) throws IOException { byte[] s = str.getBytes(UTF8); writeInt4(out, s.length); out.write(s); }
[ "public", "static", "void", "writeUTF8WithLength", "(", "OutputStream", "out", ",", "String", "str", ")", "throws", "IOException", "{", "byte", "[", "]", "s", "=", "str", ".", "getBytes", "(", "UTF8", ")", ";", "writeInt4", "(", "out", ",", "s", ".", "length", ")", ";", "out", ".", "write", "(", "s", ")", ";", "}" ]
Writes out a 4 byte integer of the length (in bytes!) of the String, followed by the String (as UTF-8)
[ "Writes", "out", "a", "4", "byte", "integer", "of", "the", "length", "(", "in", "bytes!", ")", "of", "the", "String", "followed", "by", "the", "String", "(", "as", "UTF", "-", "8", ")" ]
train
https://github.com/Gagravarr/VorbisJava/blob/22b4d645b00386d59d17a336a2bc9d54db08df16/core/src/main/java/org/gagravarr/ogg/IOUtils.java#L370-L374
Netflix/ribbon
ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java
DefaultClientConfigImpl.loadProperties
@Override public void loadProperties(String restClientName) { """ Load properties for a given client. It first loads the default values for all properties, and any properties already defined with Archaius ConfigurationManager. """ enableDynamicProperties = true; setClientName(restClientName); loadDefaultValues(); Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName); for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){ String key = keys.next(); String prop = key; try { if (prop.startsWith(getNameSpace())){ prop = prop.substring(getNameSpace().length() + 1); } setPropertyInternal(prop, getStringValue(props, key)); } catch (Exception ex) { throw new RuntimeException(String.format("Property %s is invalid", prop)); } } }
java
@Override public void loadProperties(String restClientName){ enableDynamicProperties = true; setClientName(restClientName); loadDefaultValues(); Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName); for (Iterator<String> keys = props.getKeys(); keys.hasNext(); ){ String key = keys.next(); String prop = key; try { if (prop.startsWith(getNameSpace())){ prop = prop.substring(getNameSpace().length() + 1); } setPropertyInternal(prop, getStringValue(props, key)); } catch (Exception ex) { throw new RuntimeException(String.format("Property %s is invalid", prop)); } } }
[ "@", "Override", "public", "void", "loadProperties", "(", "String", "restClientName", ")", "{", "enableDynamicProperties", "=", "true", ";", "setClientName", "(", "restClientName", ")", ";", "loadDefaultValues", "(", ")", ";", "Configuration", "props", "=", "ConfigurationManager", ".", "getConfigInstance", "(", ")", ".", "subset", "(", "restClientName", ")", ";", "for", "(", "Iterator", "<", "String", ">", "keys", "=", "props", ".", "getKeys", "(", ")", ";", "keys", ".", "hasNext", "(", ")", ";", ")", "{", "String", "key", "=", "keys", ".", "next", "(", ")", ";", "String", "prop", "=", "key", ";", "try", "{", "if", "(", "prop", ".", "startsWith", "(", "getNameSpace", "(", ")", ")", ")", "{", "prop", "=", "prop", ".", "substring", "(", "getNameSpace", "(", ")", ".", "length", "(", ")", "+", "1", ")", ";", "}", "setPropertyInternal", "(", "prop", ",", "getStringValue", "(", "props", ",", "key", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"Property %s is invalid\"", ",", "prop", ")", ")", ";", "}", "}", "}" ]
Load properties for a given client. It first loads the default values for all properties, and any properties already defined with Archaius ConfigurationManager.
[ "Load", "properties", "for", "a", "given", "client", ".", "It", "first", "loads", "the", "default", "values", "for", "all", "properties", "and", "any", "properties", "already", "defined", "with", "Archaius", "ConfigurationManager", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java#L625-L643
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.writeTo
public static void writeTo(Node node, Resource file) throws PageException { """ write a xml Dom to a file @param node @param file @throws PageException """ OutputStream os = null; try { os = IOUtil.toBufferedOutputStream(file.getOutputStream()); writeTo(node, new StreamResult(os), false, false, null, null, null); } catch (IOException ioe) { throw Caster.toPageException(ioe); } finally { IOUtil.closeEL(os); } }
java
public static void writeTo(Node node, Resource file) throws PageException { OutputStream os = null; try { os = IOUtil.toBufferedOutputStream(file.getOutputStream()); writeTo(node, new StreamResult(os), false, false, null, null, null); } catch (IOException ioe) { throw Caster.toPageException(ioe); } finally { IOUtil.closeEL(os); } }
[ "public", "static", "void", "writeTo", "(", "Node", "node", ",", "Resource", "file", ")", "throws", "PageException", "{", "OutputStream", "os", "=", "null", ";", "try", "{", "os", "=", "IOUtil", ".", "toBufferedOutputStream", "(", "file", ".", "getOutputStream", "(", ")", ")", ";", "writeTo", "(", "node", ",", "new", "StreamResult", "(", "os", ")", ",", "false", ",", "false", ",", "null", ",", "null", ",", "null", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "Caster", ".", "toPageException", "(", "ioe", ")", ";", "}", "finally", "{", "IOUtil", ".", "closeEL", "(", "os", ")", ";", "}", "}" ]
write a xml Dom to a file @param node @param file @throws PageException
[ "write", "a", "xml", "Dom", "to", "a", "file" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L518-L530
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.exportObjects2Excel
public void exportObjects2Excel(String templatePath, List<?> data, Class clazz, String targetPath) throws Excel4JException { """ 基于Excel模板与注解{@link com.github.crab2died.annotation.ExcelField}导出Excel @param templatePath Excel模板路径 @param data 待导出数据的集合 @param clazz 映射对象Class @param targetPath 生成的Excel输出全路径 @throws Excel4JException 异常 @author Crab2Died """ exportObjects2Excel(templatePath, 0, data, null, clazz, true, targetPath); }
java
public void exportObjects2Excel(String templatePath, List<?> data, Class clazz, String targetPath) throws Excel4JException { exportObjects2Excel(templatePath, 0, data, null, clazz, true, targetPath); }
[ "public", "void", "exportObjects2Excel", "(", "String", "templatePath", ",", "List", "<", "?", ">", "data", ",", "Class", "clazz", ",", "String", "targetPath", ")", "throws", "Excel4JException", "{", "exportObjects2Excel", "(", "templatePath", ",", "0", ",", "data", ",", "null", ",", "clazz", ",", "true", ",", "targetPath", ")", ";", "}" ]
基于Excel模板与注解{@link com.github.crab2died.annotation.ExcelField}导出Excel @param templatePath Excel模板路径 @param data 待导出数据的集合 @param clazz 映射对象Class @param targetPath 生成的Excel输出全路径 @throws Excel4JException 异常 @author Crab2Died
[ "基于Excel模板与注解", "{", "@link", "com", ".", "github", ".", "crab2died", ".", "annotation", ".", "ExcelField", "}", "导出Excel" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L590-L594
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java
CoverageDataCore.getValue
public Double getValue(GriddedTile griddedTile, int unsignedPixelValue) { """ Get the coverage data value for the unsigned short pixel value @param griddedTile gridded tile @param unsignedPixelValue pixel value as an unsigned 16 bit integer @return coverage data value """ Double value = null; if (!isDataNull(unsignedPixelValue)) { value = pixelValueToValue(griddedTile, new Double( unsignedPixelValue)); } return value; }
java
public Double getValue(GriddedTile griddedTile, int unsignedPixelValue) { Double value = null; if (!isDataNull(unsignedPixelValue)) { value = pixelValueToValue(griddedTile, new Double( unsignedPixelValue)); } return value; }
[ "public", "Double", "getValue", "(", "GriddedTile", "griddedTile", ",", "int", "unsignedPixelValue", ")", "{", "Double", "value", "=", "null", ";", "if", "(", "!", "isDataNull", "(", "unsignedPixelValue", ")", ")", "{", "value", "=", "pixelValueToValue", "(", "griddedTile", ",", "new", "Double", "(", "unsignedPixelValue", ")", ")", ";", "}", "return", "value", ";", "}" ]
Get the coverage data value for the unsigned short pixel value @param griddedTile gridded tile @param unsignedPixelValue pixel value as an unsigned 16 bit integer @return coverage data value
[ "Get", "the", "coverage", "data", "value", "for", "the", "unsigned", "short", "pixel", "value" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1432-L1441
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java
OnChangeEvictingCache.execWithTemporaryCaching
public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { """ The transaction will be executed with caching enabled. However, all newly cached values will be discarded as soon as the transaction is over. @since 2.1 """ CacheAdapter cacheAdapter = getOrCreate(resource); IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues(); try { return transaction.exec(resource); } catch (Exception e) { throw new WrappedException(e); } finally { memento.done(); } }
java
public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate(resource); IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues(); try { return transaction.exec(resource); } catch (Exception e) { throw new WrappedException(e); } finally { memento.done(); } }
[ "public", "<", "Result", ",", "Param", "extends", "Resource", ">", "Result", "execWithTemporaryCaching", "(", "Param", "resource", ",", "IUnitOfWork", "<", "Result", ",", "Param", ">", "transaction", ")", "throws", "WrappedException", "{", "CacheAdapter", "cacheAdapter", "=", "getOrCreate", "(", "resource", ")", ";", "IgnoreValuesMemento", "memento", "=", "cacheAdapter", ".", "ignoreNewValues", "(", ")", ";", "try", "{", "return", "transaction", ".", "exec", "(", "resource", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "WrappedException", "(", "e", ")", ";", "}", "finally", "{", "memento", ".", "done", "(", ")", ";", "}", "}" ]
The transaction will be executed with caching enabled. However, all newly cached values will be discarded as soon as the transaction is over. @since 2.1
[ "The", "transaction", "will", "be", "executed", "with", "caching", "enabled", ".", "However", "all", "newly", "cached", "values", "will", "be", "discarded", "as", "soon", "as", "the", "transaction", "is", "over", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L143-L153
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/YearMonthRangeRandomizer.java
YearMonthRangeRandomizer.aNewYearMonthRangeRandomizer
public static YearMonthRangeRandomizer aNewYearMonthRangeRandomizer(final YearMonth min, final YearMonth max, final long seed) { """ Create a new {@link YearMonthRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link YearMonthRangeRandomizer}. """ return new YearMonthRangeRandomizer(min, max, seed); }
java
public static YearMonthRangeRandomizer aNewYearMonthRangeRandomizer(final YearMonth min, final YearMonth max, final long seed) { return new YearMonthRangeRandomizer(min, max, seed); }
[ "public", "static", "YearMonthRangeRandomizer", "aNewYearMonthRangeRandomizer", "(", "final", "YearMonth", "min", ",", "final", "YearMonth", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "YearMonthRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", ";", "}" ]
Create a new {@link YearMonthRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link YearMonthRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "YearMonthRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/YearMonthRangeRandomizer.java#L77-L79
jenkinsci/jenkins
core/src/main/java/hudson/diagnosis/OldDataMonitor.java
OldDataMonitor.report
public static void report(Saveable obj, String version) { """ Inform monitor that some data in a deprecated format has been loaded, and converted in-memory to a new structure. @param obj Saveable object; calling save() on this object will persist the data in its new format to disk. @param version Hudson release when the data structure changed. """ OldDataMonitor odm = get(Jenkins.getInstance()); try { SaveableReference ref = referTo(obj); while (true) { VersionRange vr = odm.data.get(ref); if (vr != null && odm.data.replace(ref, vr, new VersionRange(vr, version, null))) { break; } else if (odm.data.putIfAbsent(ref, new VersionRange(null, version, null)) == null) { break; } } } catch (IllegalArgumentException ex) { LOGGER.log(Level.WARNING, "Bad parameter given to OldDataMonitor", ex); } }
java
public static void report(Saveable obj, String version) { OldDataMonitor odm = get(Jenkins.getInstance()); try { SaveableReference ref = referTo(obj); while (true) { VersionRange vr = odm.data.get(ref); if (vr != null && odm.data.replace(ref, vr, new VersionRange(vr, version, null))) { break; } else if (odm.data.putIfAbsent(ref, new VersionRange(null, version, null)) == null) { break; } } } catch (IllegalArgumentException ex) { LOGGER.log(Level.WARNING, "Bad parameter given to OldDataMonitor", ex); } }
[ "public", "static", "void", "report", "(", "Saveable", "obj", ",", "String", "version", ")", "{", "OldDataMonitor", "odm", "=", "get", "(", "Jenkins", ".", "getInstance", "(", ")", ")", ";", "try", "{", "SaveableReference", "ref", "=", "referTo", "(", "obj", ")", ";", "while", "(", "true", ")", "{", "VersionRange", "vr", "=", "odm", ".", "data", ".", "get", "(", "ref", ")", ";", "if", "(", "vr", "!=", "null", "&&", "odm", ".", "data", ".", "replace", "(", "ref", ",", "vr", ",", "new", "VersionRange", "(", "vr", ",", "version", ",", "null", ")", ")", ")", "{", "break", ";", "}", "else", "if", "(", "odm", ".", "data", ".", "putIfAbsent", "(", "ref", ",", "new", "VersionRange", "(", "null", ",", "version", ",", "null", ")", ")", "==", "null", ")", "{", "break", ";", "}", "}", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Bad parameter given to OldDataMonitor\"", ",", "ex", ")", ";", "}", "}" ]
Inform monitor that some data in a deprecated format has been loaded, and converted in-memory to a new structure. @param obj Saveable object; calling save() on this object will persist the data in its new format to disk. @param version Hudson release when the data structure changed.
[ "Inform", "monitor", "that", "some", "data", "in", "a", "deprecated", "format", "has", "been", "loaded", "and", "converted", "in", "-", "memory", "to", "a", "new", "structure", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/diagnosis/OldDataMonitor.java#L168-L183
jayantk/jklol
src/com/jayantkrish/jklol/util/PairCountAccumulator.java
PairCountAccumulator.incrementOutcome
public void incrementOutcome(A first, B second, double amount) { """ Increments the count of outcome (first, second) by {@code amount}. """ if (!counts.containsKey(first)) { counts.put(first, Maps.<B, Double> newHashMap()); } if (!counts.get(first).containsKey(second)) { counts.get(first).put(second, 0.0); } counts.get(first).put(second, amount + counts.get(first).get(second)); conditionalCounts.put(first, amount + conditionalCounts.get(first)); totalCount += amount; }
java
public void incrementOutcome(A first, B second, double amount) { if (!counts.containsKey(first)) { counts.put(first, Maps.<B, Double> newHashMap()); } if (!counts.get(first).containsKey(second)) { counts.get(first).put(second, 0.0); } counts.get(first).put(second, amount + counts.get(first).get(second)); conditionalCounts.put(first, amount + conditionalCounts.get(first)); totalCount += amount; }
[ "public", "void", "incrementOutcome", "(", "A", "first", ",", "B", "second", ",", "double", "amount", ")", "{", "if", "(", "!", "counts", ".", "containsKey", "(", "first", ")", ")", "{", "counts", ".", "put", "(", "first", ",", "Maps", ".", "<", "B", ",", "Double", ">", "newHashMap", "(", ")", ")", ";", "}", "if", "(", "!", "counts", ".", "get", "(", "first", ")", ".", "containsKey", "(", "second", ")", ")", "{", "counts", ".", "get", "(", "first", ")", ".", "put", "(", "second", ",", "0.0", ")", ";", "}", "counts", ".", "get", "(", "first", ")", ".", "put", "(", "second", ",", "amount", "+", "counts", ".", "get", "(", "first", ")", ".", "get", "(", "second", ")", ")", ";", "conditionalCounts", ".", "put", "(", "first", ",", "amount", "+", "conditionalCounts", ".", "get", "(", "first", ")", ")", ";", "totalCount", "+=", "amount", ";", "}" ]
Increments the count of outcome (first, second) by {@code amount}.
[ "Increments", "the", "count", "of", "outcome", "(", "first", "second", ")", "by", "{" ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/PairCountAccumulator.java#L49-L59
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.openTagHtmlContent
public static String openTagHtmlContent(String tag, String clazz, String style, String... content) { """ Build a String containing a HTML opening tag with given CSS class and/or style and concatenates the given HTML content. @param tag String name of HTML tag @param clazz CSS class of the tag @param style style for tag (plain CSS) @param content content string @return HTML tag element as string """ return openTag(tag, clazz, style, true, content); }
java
public static String openTagHtmlContent(String tag, String clazz, String style, String... content) { return openTag(tag, clazz, style, true, content); }
[ "public", "static", "String", "openTagHtmlContent", "(", "String", "tag", ",", "String", "clazz", ",", "String", "style", ",", "String", "...", "content", ")", "{", "return", "openTag", "(", "tag", ",", "clazz", ",", "style", ",", "true", ",", "content", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS class and/or style and concatenates the given HTML content. @param tag String name of HTML tag @param clazz CSS class of the tag @param style style for tag (plain CSS) @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "class", "and", "/", "or", "style", "and", "concatenates", "the", "given", "HTML", "content", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L404-L406
google/closure-compiler
src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
JsDocInfoParser.extractBlockComment
private ExtractionInfo extractBlockComment(JsDocToken token) { """ Extracts the top-level block comment from the JsDoc comment, if any. This method differs from the extractMultilineTextualBlock in that it terminates under different conditions (it doesn't have the same prechecks), it does not first read in the remaining of the current line and its conditions for ignoring the "*" (STAR) are different. @param token The starting token. @return The extraction information. """ return extractMultilineComment(token, getWhitespaceOption(WhitespaceOption.TRIM), false, false); }
java
private ExtractionInfo extractBlockComment(JsDocToken token) { return extractMultilineComment(token, getWhitespaceOption(WhitespaceOption.TRIM), false, false); }
[ "private", "ExtractionInfo", "extractBlockComment", "(", "JsDocToken", "token", ")", "{", "return", "extractMultilineComment", "(", "token", ",", "getWhitespaceOption", "(", "WhitespaceOption", ".", "TRIM", ")", ",", "false", ",", "false", ")", ";", "}" ]
Extracts the top-level block comment from the JsDoc comment, if any. This method differs from the extractMultilineTextualBlock in that it terminates under different conditions (it doesn't have the same prechecks), it does not first read in the remaining of the current line and its conditions for ignoring the "*" (STAR) are different. @param token The starting token. @return The extraction information.
[ "Extracts", "the", "top", "-", "level", "block", "comment", "from", "the", "JsDoc", "comment", "if", "any", ".", "This", "method", "differs", "from", "the", "extractMultilineTextualBlock", "in", "that", "it", "terminates", "under", "different", "conditions", "(", "it", "doesn", "t", "have", "the", "same", "prechecks", ")", "it", "does", "not", "first", "read", "in", "the", "remaining", "of", "the", "current", "line", "and", "its", "conditions", "for", "ignoring", "the", "*", "(", "STAR", ")", "are", "different", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L1753-L1755
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitUnknownInlineTag
@Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} """ return defaultAction(node, p); }
java
@Override public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitUnknownInlineTag", "(", "UnknownInlineTagTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L441-L444
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java
ModelControllerLock.lockInterruptibly
boolean lockInterruptibly(final Integer permit, final long timeout, final TimeUnit unit) throws InterruptedException { """ Acquire the exclusive lock, with a max wait timeout to acquire. @param permit - the permit Integer for this operation. May not be {@code null}. @param timeout - the timeout scalar quantity. @param unit - see {@code TimeUnit} for quantities. @return {@code boolean} true on successful acquire. @throws InterruptedException - if the acquiring thread was interrupted. @throws IllegalArgumentException if {@code permit} is null. """ if (permit == null) { throw new IllegalArgumentException(); } return sync.tryAcquireNanos(permit, unit.toNanos(timeout)); }
java
boolean lockInterruptibly(final Integer permit, final long timeout, final TimeUnit unit) throws InterruptedException { if (permit == null) { throw new IllegalArgumentException(); } return sync.tryAcquireNanos(permit, unit.toNanos(timeout)); }
[ "boolean", "lockInterruptibly", "(", "final", "Integer", "permit", ",", "final", "long", "timeout", ",", "final", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "permit", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "sync", ".", "tryAcquireNanos", "(", "permit", ",", "unit", ".", "toNanos", "(", "timeout", ")", ")", ";", "}" ]
Acquire the exclusive lock, with a max wait timeout to acquire. @param permit - the permit Integer for this operation. May not be {@code null}. @param timeout - the timeout scalar quantity. @param unit - see {@code TimeUnit} for quantities. @return {@code boolean} true on successful acquire. @throws InterruptedException - if the acquiring thread was interrupted. @throws IllegalArgumentException if {@code permit} is null.
[ "Acquire", "the", "exclusive", "lock", "with", "a", "max", "wait", "timeout", "to", "acquire", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java#L135-L140
riversun/bigdoc
src/main/java/org/riversun/bigdoc/bin/BigFileSearcher.java
BigFileSearcher.searchBigFile
public List<Long> searchBigFile(File f, byte[] searchBytes) { """ Search bytes from big file faster in a concurrent processing with progress callback @param f target file @param searchBytes sequence of bytes you want to search @return """ return searchBigFile(f, searchBytes, null); }
java
public List<Long> searchBigFile(File f, byte[] searchBytes) { return searchBigFile(f, searchBytes, null); }
[ "public", "List", "<", "Long", ">", "searchBigFile", "(", "File", "f", ",", "byte", "[", "]", "searchBytes", ")", "{", "return", "searchBigFile", "(", "f", ",", "searchBytes", ",", "null", ")", ";", "}" ]
Search bytes from big file faster in a concurrent processing with progress callback @param f target file @param searchBytes sequence of bytes you want to search @return
[ "Search", "bytes", "from", "big", "file", "faster", "in", "a", "concurrent", "processing", "with", "progress", "callback" ]
train
https://github.com/riversun/bigdoc/blob/46bd7c9a8667be23acdb1ad8286027e4b08cff3a/src/main/java/org/riversun/bigdoc/bin/BigFileSearcher.java#L271-L273
btc-ag/redg
redg-generator/src/main/java/com/btc/redg/generator/extractor/DatabaseManager.java
DatabaseManager.crawlDatabase
public static Catalog crawlDatabase(final Connection connection, final InclusionRule schemaRule, final InclusionRule tableRule) throws SchemaCrawlerException { """ Starts the schema crawler and lets it crawl the given JDBC connection. @param connection The JDBC connection @param schemaRule The {@link InclusionRule} to be passed to SchemaCrawler that specifies which schemas should be analyzed @param tableRule The {@link InclusionRule} to be passed to SchemaCrawler that specifies which tables should be analyzed. If a table is included by the {@code tableRule} but excluded by the {@code schemaRule} it will not be analyzed. @return The populated {@link Catalog} object containing the metadata for the extractor @throws SchemaCrawlerException Gets thrown when the database could not be crawled successfully """ final SchemaCrawlerOptions options = SchemaCrawlerOptionsBuilder.builder() .withSchemaInfoLevel(SchemaInfoLevelBuilder.standard().setRetrieveIndexes(false)) .routineTypes(Arrays.asList(RoutineType.procedure, RoutineType.unknown)) .includeSchemas(schemaRule == null ? new IncludeAll() : schemaRule) .includeTables(tableRule == null ? new IncludeAll() : tableRule) .toOptions(); try { return SchemaCrawlerUtility.getCatalog(connection, options); } catch (SchemaCrawlerException e) { LOG.error("Schema crawling failed with exception", e); throw e; } }
java
public static Catalog crawlDatabase(final Connection connection, final InclusionRule schemaRule, final InclusionRule tableRule) throws SchemaCrawlerException { final SchemaCrawlerOptions options = SchemaCrawlerOptionsBuilder.builder() .withSchemaInfoLevel(SchemaInfoLevelBuilder.standard().setRetrieveIndexes(false)) .routineTypes(Arrays.asList(RoutineType.procedure, RoutineType.unknown)) .includeSchemas(schemaRule == null ? new IncludeAll() : schemaRule) .includeTables(tableRule == null ? new IncludeAll() : tableRule) .toOptions(); try { return SchemaCrawlerUtility.getCatalog(connection, options); } catch (SchemaCrawlerException e) { LOG.error("Schema crawling failed with exception", e); throw e; } }
[ "public", "static", "Catalog", "crawlDatabase", "(", "final", "Connection", "connection", ",", "final", "InclusionRule", "schemaRule", ",", "final", "InclusionRule", "tableRule", ")", "throws", "SchemaCrawlerException", "{", "final", "SchemaCrawlerOptions", "options", "=", "SchemaCrawlerOptionsBuilder", ".", "builder", "(", ")", ".", "withSchemaInfoLevel", "(", "SchemaInfoLevelBuilder", ".", "standard", "(", ")", ".", "setRetrieveIndexes", "(", "false", ")", ")", ".", "routineTypes", "(", "Arrays", ".", "asList", "(", "RoutineType", ".", "procedure", ",", "RoutineType", ".", "unknown", ")", ")", ".", "includeSchemas", "(", "schemaRule", "==", "null", "?", "new", "IncludeAll", "(", ")", ":", "schemaRule", ")", ".", "includeTables", "(", "tableRule", "==", "null", "?", "new", "IncludeAll", "(", ")", ":", "tableRule", ")", ".", "toOptions", "(", ")", ";", "try", "{", "return", "SchemaCrawlerUtility", ".", "getCatalog", "(", "connection", ",", "options", ")", ";", "}", "catch", "(", "SchemaCrawlerException", "e", ")", "{", "LOG", ".", "error", "(", "\"Schema crawling failed with exception\"", ",", "e", ")", ";", "throw", "e", ";", "}", "}" ]
Starts the schema crawler and lets it crawl the given JDBC connection. @param connection The JDBC connection @param schemaRule The {@link InclusionRule} to be passed to SchemaCrawler that specifies which schemas should be analyzed @param tableRule The {@link InclusionRule} to be passed to SchemaCrawler that specifies which tables should be analyzed. If a table is included by the {@code tableRule} but excluded by the {@code schemaRule} it will not be analyzed. @return The populated {@link Catalog} object containing the metadata for the extractor @throws SchemaCrawlerException Gets thrown when the database could not be crawled successfully
[ "Starts", "the", "schema", "crawler", "and", "lets", "it", "crawl", "the", "given", "JDBC", "connection", "." ]
train
https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-generator/src/main/java/com/btc/redg/generator/extractor/DatabaseManager.java#L146-L160
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java
CommerceNotificationQueueEntryPersistenceImpl.findByGroupId
@Override public List<CommerceNotificationQueueEntry> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the commerce notification queue entries where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationQueueEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce notification queue entries @param end the upper bound of the range of commerce notification queue entries (not inclusive) @return the range of matching commerce notification queue entries """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceNotificationQueueEntry> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationQueueEntry", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce notification queue entries where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationQueueEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce notification queue entries @param end the upper bound of the range of commerce notification queue entries (not inclusive) @return the range of matching commerce notification queue entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "notification", "queue", "entries", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L145-L149
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.patchAsync
public <T> CompletableFuture<T> patchAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { """ Executes asynchronous PATCH request on the configured URI (alias for the `patch(Class, Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletableFuture future = http.patchAsync(String){ request.uri.path = '/something' } String result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type """ return CompletableFuture.supplyAsync(() -> patch(type, closure), getExecutor()); }
java
public <T> CompletableFuture<T> patchAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> patch(type, closure), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "patchAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "patch", "(", "type", ",", "closure", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes asynchronous PATCH request on the configured URI (alias for the `patch(Class, Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletableFuture future = http.patchAsync(String){ request.uri.path = '/something' } String result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} for the resulting content cast to the specified type
[ "Executes", "asynchronous", "PATCH", "request", "on", "the", "configured", "URI", "(", "alias", "for", "the", "patch", "(", "Class", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure", ".", "The", "result", "will", "be", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1716-L1718
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.saferL2Normalize
public static <E, C extends Counter<E>> C saferL2Normalize(C c) { """ L2 normalize a counter, using the "safer" L2 normalizer. @param c The {@link Counter} to be L2 normalized. This counter is not modified. @return A new l2-normalized Counter based on c. """ return scale(c, 1.0 / saferL2Norm(c)); }
java
public static <E, C extends Counter<E>> C saferL2Normalize(C c) { return scale(c, 1.0 / saferL2Norm(c)); }
[ "public", "static", "<", "E", ",", "C", "extends", "Counter", "<", "E", ">", ">", "C", "saferL2Normalize", "(", "C", "c", ")", "{", "return", "scale", "(", "c", ",", "1.0", "/", "saferL2Norm", "(", "c", ")", ")", ";", "}" ]
L2 normalize a counter, using the "safer" L2 normalizer. @param c The {@link Counter} to be L2 normalized. This counter is not modified. @return A new l2-normalized Counter based on c.
[ "L2", "normalize", "a", "counter", "using", "the", "safer", "L2", "normalizer", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1348-L1350
diffplug/durian
src/com/diffplug/common/base/TreeComparison.java
TreeComparison.isEqualBasedOn
public boolean isEqualBasedOn(BiPredicate<? super E, ? super A> compareFunc) { """ Returns true if the two trees are equal, based on the given {@link BiPredicate}. """ return equals(expectedDef, expectedRoot, actualDef, actualRoot, compareFunc); }
java
public boolean isEqualBasedOn(BiPredicate<? super E, ? super A> compareFunc) { return equals(expectedDef, expectedRoot, actualDef, actualRoot, compareFunc); }
[ "public", "boolean", "isEqualBasedOn", "(", "BiPredicate", "<", "?", "super", "E", ",", "?", "super", "A", ">", "compareFunc", ")", "{", "return", "equals", "(", "expectedDef", ",", "expectedRoot", ",", "actualDef", ",", "actualRoot", ",", "compareFunc", ")", ";", "}" ]
Returns true if the two trees are equal, based on the given {@link BiPredicate}.
[ "Returns", "true", "if", "the", "two", "trees", "are", "equal", "based", "on", "the", "given", "{" ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L52-L54
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java
SubsystemSuspensionLevels.setLevels
public void setLevels(Map<Integer, Long> levels) { """ Sets the suspension time in milliseconds for the corresponding infraction count. @param levels The map of infraction counts to suspension times. """ SystemAssert.requireArgument(levels != null, "Levels cannot be null"); this.levels.clear(); this.levels.putAll(levels); }
java
public void setLevels(Map<Integer, Long> levels) { SystemAssert.requireArgument(levels != null, "Levels cannot be null"); this.levels.clear(); this.levels.putAll(levels); }
[ "public", "void", "setLevels", "(", "Map", "<", "Integer", ",", "Long", ">", "levels", ")", "{", "SystemAssert", ".", "requireArgument", "(", "levels", "!=", "null", ",", "\"Levels cannot be null\"", ")", ";", "this", ".", "levels", ".", "clear", "(", ")", ";", "this", ".", "levels", ".", "putAll", "(", "levels", ")", ";", "}" ]
Sets the suspension time in milliseconds for the corresponding infraction count. @param levels The map of infraction counts to suspension times.
[ "Sets", "the", "suspension", "time", "in", "milliseconds", "for", "the", "corresponding", "infraction", "count", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java#L195-L199
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.queryByExpireTime
public Iterable<DConnection> queryByExpireTime(java.util.Date expireTime) { """ query-by method for field expireTime @param expireTime the specified attribute @return an Iterable of DConnections for the specified expireTime """ return queryByField(null, DConnectionMapper.Field.EXPIRETIME.getFieldName(), expireTime); }
java
public Iterable<DConnection> queryByExpireTime(java.util.Date expireTime) { return queryByField(null, DConnectionMapper.Field.EXPIRETIME.getFieldName(), expireTime); }
[ "public", "Iterable", "<", "DConnection", ">", "queryByExpireTime", "(", "java", ".", "util", ".", "Date", "expireTime", ")", "{", "return", "queryByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "EXPIRETIME", ".", "getFieldName", "(", ")", ",", "expireTime", ")", ";", "}" ]
query-by method for field expireTime @param expireTime the specified attribute @return an Iterable of DConnections for the specified expireTime
[ "query", "-", "by", "method", "for", "field", "expireTime" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L88-L90
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/AbstractExtensionDependency.java
AbstractExtensionDependency.setProperties
public void setProperties(Map<String, Object> properties) { """ Replace existing properties with provided properties. @param properties the properties """ this.properties.clear(); this.properties.putAll(properties); }
java
public void setProperties(Map<String, Object> properties) { this.properties.clear(); this.properties.putAll(properties); }
[ "public", "void", "setProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "this", ".", "properties", ".", "clear", "(", ")", ";", "this", ".", "properties", ".", "putAll", "(", "properties", ")", ";", "}" ]
Replace existing properties with provided properties. @param properties the properties
[ "Replace", "existing", "properties", "with", "provided", "properties", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/AbstractExtensionDependency.java#L258-L262
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java
VisitorHelper.getName
public static String getName(String name, String path) { """ Returns the OGNL name of the node. @param name the name of the property. @param path the object graph navigation path so far. @return the OGNL name of the node. """ logger.trace("getting OGNL name for node '{}' at path '{}'", name, path); StringBuilder buffer = new StringBuilder(); if(path != null) { buffer.append(path); } if(buffer.length() != 0 && name != null && !name.startsWith("[")) { buffer.append("."); } buffer.append(name); logger.trace("OGNL path of node is '{}'", buffer.toString()); return buffer.toString(); }
java
public static String getName(String name, String path) { logger.trace("getting OGNL name for node '{}' at path '{}'", name, path); StringBuilder buffer = new StringBuilder(); if(path != null) { buffer.append(path); } if(buffer.length() != 0 && name != null && !name.startsWith("[")) { buffer.append("."); } buffer.append(name); logger.trace("OGNL path of node is '{}'", buffer.toString()); return buffer.toString(); }
[ "public", "static", "String", "getName", "(", "String", "name", ",", "String", "path", ")", "{", "logger", ".", "trace", "(", "\"getting OGNL name for node '{}' at path '{}'\"", ",", "name", ",", "path", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "buffer", ".", "append", "(", "path", ")", ";", "}", "if", "(", "buffer", ".", "length", "(", ")", "!=", "0", "&&", "name", "!=", "null", "&&", "!", "name", ".", "startsWith", "(", "\"[\"", ")", ")", "{", "buffer", ".", "append", "(", "\".\"", ")", ";", "}", "buffer", ".", "append", "(", "name", ")", ";", "logger", ".", "trace", "(", "\"OGNL path of node is '{}'\"", ",", "buffer", ".", "toString", "(", ")", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Returns the OGNL name of the node. @param name the name of the property. @param path the object graph navigation path so far. @return the OGNL name of the node.
[ "Returns", "the", "OGNL", "name", "of", "the", "node", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java#L38-L50
rundeck/rundeck
rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/LockingTree.java
LockingTree.synchStream
protected HasInputStream synchStream(final Path path, final HasInputStream stream) { """ Return a {@link HasInputStream} where all read access to the underlying data is synchronized around the path @param path path @param stream stream @return synchronized stream access """ return new HasInputStream() { @Override public InputStream getInputStream() throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); writeContent(bytes); return new ByteArrayInputStream(bytes.toByteArray()); } @Override public long writeContent(OutputStream outputStream) throws IOException { synchronized (pathSynch(path)) { return stream.writeContent(outputStream); } } }; }
java
protected HasInputStream synchStream(final Path path, final HasInputStream stream) { return new HasInputStream() { @Override public InputStream getInputStream() throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); writeContent(bytes); return new ByteArrayInputStream(bytes.toByteArray()); } @Override public long writeContent(OutputStream outputStream) throws IOException { synchronized (pathSynch(path)) { return stream.writeContent(outputStream); } } }; }
[ "protected", "HasInputStream", "synchStream", "(", "final", "Path", "path", ",", "final", "HasInputStream", "stream", ")", "{", "return", "new", "HasInputStream", "(", ")", "{", "@", "Override", "public", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "bytes", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "writeContent", "(", "bytes", ")", ";", "return", "new", "ByteArrayInputStream", "(", "bytes", ".", "toByteArray", "(", ")", ")", ";", "}", "@", "Override", "public", "long", "writeContent", "(", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "synchronized", "(", "pathSynch", "(", "path", ")", ")", "{", "return", "stream", ".", "writeContent", "(", "outputStream", ")", ";", "}", "}", "}", ";", "}" ]
Return a {@link HasInputStream} where all read access to the underlying data is synchronized around the path @param path path @param stream stream @return synchronized stream access
[ "Return", "a", "{", "@link", "HasInputStream", "}", "where", "all", "read", "access", "to", "the", "underlying", "data", "is", "synchronized", "around", "the", "path" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/LockingTree.java#L61-L78
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/host_device.java
host_device.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ host_device_responses result = (host_device_responses) service.get_payload_formatter().string_to_resource(host_device_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.host_device_response_array); } host_device[] result_host_device = new host_device[result.host_device_response_array.length]; for(int i = 0; i < result.host_device_response_array.length; i++) { result_host_device[i] = result.host_device_response_array[i].host_device[0]; } return result_host_device; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { host_device_responses result = (host_device_responses) service.get_payload_formatter().string_to_resource(host_device_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.host_device_response_array); } host_device[] result_host_device = new host_device[result.host_device_response_array.length]; for(int i = 0; i < result.host_device_response_array.length; i++) { result_host_device[i] = result.host_device_response_array[i].host_device[0]; } return result_host_device; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "host_device_responses", "result", "=", "(", "host_device_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "host_device_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "host_device_response_array", ")", ";", "}", "host_device", "[", "]", "result_host_device", "=", "new", "host_device", "[", "result", ".", "host_device_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "host_device_response_array", ".", "length", ";", "i", "++", ")", "{", "result_host_device", "[", "i", "]", "=", "result", ".", "host_device_response_array", "[", "i", "]", ".", "host_device", "[", "0", "]", ";", "}", "return", "result_host_device", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/host_device.java#L333-L350
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/ConfigBasedDatasetsFinder.java
ConfigBasedDatasetsFinder.getValidDatasetURIs
protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) { """ Semantic of black/whitelist: - Whitelist always respect blacklist. - Job-level blacklist is reponsible for dataset filtering instead of dataset discovery. i.e. There's no implementation of job-level whitelist currently. """ Collection<URI> allDatasetURIs; Set<URI> disabledURISet = new HashSet(); // This try block basically populate the Valid dataset URI set. try { allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true); enhanceDisabledURIsWithBlackListTag(disabledURISet); } catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | URISyntaxException e) { log.error("Caught error while getting all the datasets URIs " + e.getMessage()); throw new RuntimeException(e); } return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot); }
java
protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) { Collection<URI> allDatasetURIs; Set<URI> disabledURISet = new HashSet(); // This try block basically populate the Valid dataset URI set. try { allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true); enhanceDisabledURIsWithBlackListTag(disabledURISet); } catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException | URISyntaxException e) { log.error("Caught error while getting all the datasets URIs " + e.getMessage()); throw new RuntimeException(e); } return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot); }
[ "protected", "Set", "<", "URI", ">", "getValidDatasetURIs", "(", "Path", "datasetCommonRoot", ")", "{", "Collection", "<", "URI", ">", "allDatasetURIs", ";", "Set", "<", "URI", ">", "disabledURISet", "=", "new", "HashSet", "(", ")", ";", "// This try block basically populate the Valid dataset URI set.", "try", "{", "allDatasetURIs", "=", "configClient", ".", "getImportedBy", "(", "new", "URI", "(", "whitelistTag", ".", "toString", "(", ")", ")", ",", "true", ")", ";", "enhanceDisabledURIsWithBlackListTag", "(", "disabledURISet", ")", ";", "}", "catch", "(", "ConfigStoreFactoryDoesNotExistsException", "|", "ConfigStoreCreationException", "|", "URISyntaxException", "e", ")", "{", "log", ".", "error", "(", "\"Caught error while getting all the datasets URIs \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "getValidDatasetURIsHelper", "(", "allDatasetURIs", ",", "disabledURISet", ",", "datasetCommonRoot", ")", ";", "}" ]
Semantic of black/whitelist: - Whitelist always respect blacklist. - Job-level blacklist is reponsible for dataset filtering instead of dataset discovery. i.e. There's no implementation of job-level whitelist currently.
[ "Semantic", "of", "black", "/", "whitelist", ":", "-", "Whitelist", "always", "respect", "blacklist", ".", "-", "Job", "-", "level", "blacklist", "is", "reponsible", "for", "dataset", "filtering", "instead", "of", "dataset", "discovery", ".", "i", ".", "e", ".", "There", "s", "no", "implementation", "of", "job", "-", "level", "whitelist", "currently", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/ConfigBasedDatasetsFinder.java#L168-L182
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.applyElementSize
private void applyElementSize(Element element, int width, int height, boolean addCoordSize) { """ Apply a size on an element. @param element The element that needs sizing. @param width The new width to apply on the element. @param height The new height to apply on the element. @param addCoordSize Should a coordsize attribute be added as well? """ if (width >= 0 && height >= 0) { if (addCoordSize) { Dom.setElementAttribute(element, "coordsize", width + " " + height); } Dom.setStyleAttribute(element, "width", width + "px"); Dom.setStyleAttribute(element, "height", height + "px"); } }
java
private void applyElementSize(Element element, int width, int height, boolean addCoordSize) { if (width >= 0 && height >= 0) { if (addCoordSize) { Dom.setElementAttribute(element, "coordsize", width + " " + height); } Dom.setStyleAttribute(element, "width", width + "px"); Dom.setStyleAttribute(element, "height", height + "px"); } }
[ "private", "void", "applyElementSize", "(", "Element", "element", ",", "int", "width", ",", "int", "height", ",", "boolean", "addCoordSize", ")", "{", "if", "(", "width", ">=", "0", "&&", "height", ">=", "0", ")", "{", "if", "(", "addCoordSize", ")", "{", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"coordsize\"", ",", "width", "+", "\" \"", "+", "height", ")", ";", "}", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"width\"", ",", "width", "+", "\"px\"", ")", ";", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"height\"", ",", "height", "+", "\"px\"", ")", ";", "}", "}" ]
Apply a size on an element. @param element The element that needs sizing. @param width The new width to apply on the element. @param height The new height to apply on the element. @param addCoordSize Should a coordsize attribute be added as well?
[ "Apply", "a", "size", "on", "an", "element", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L510-L518
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java
Tabs.setAjaxLoadEvent
public Tabs setAjaxLoadEvent(ITabsAjaxEvent loadEvent) { """ Sets the call-back for the AJAX Load event. @param loadEvent The ITabsAjaxEvent. """ this.ajaxEvents.put(TabEvent.load, loadEvent); setLoadEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.load)); return this; }
java
public Tabs setAjaxLoadEvent(ITabsAjaxEvent loadEvent) { this.ajaxEvents.put(TabEvent.load, loadEvent); setLoadEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.load)); return this; }
[ "public", "Tabs", "setAjaxLoadEvent", "(", "ITabsAjaxEvent", "loadEvent", ")", "{", "this", ".", "ajaxEvents", ".", "put", "(", "TabEvent", ".", "load", ",", "loadEvent", ")", ";", "setLoadEvent", "(", "new", "TabsAjaxJsScopeUiEvent", "(", "this", ",", "TabEvent", ".", "load", ")", ")", ";", "return", "this", ";", "}" ]
Sets the call-back for the AJAX Load event. @param loadEvent The ITabsAjaxEvent.
[ "Sets", "the", "call", "-", "back", "for", "the", "AJAX", "Load", "event", "." ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java#L589-L594
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L93_L4
@Pure public static Point2d L93_L4(double x, double y) { """ This function convert France Lambert 93 coordinate to France Lambert IV coordinate. @param x is the coordinate in France Lambert 93 @param y is the coordinate in France Lambert 93 @return the France Lambert IV coordinate. """ final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
java
@Pure public static Point2d L93_L4(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_4_N, LAMBERT_4_C, LAMBERT_4_XS, LAMBERT_4_YS); }
[ "@", "Pure", "public", "static", "Point2d", "L93_L4", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_93_N", ",", "LAMBERT_93_C", ",", "LAMBERT_93_XS", ",", "LAMBERT_93_YS", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfLambdaPhi", ".", "getX", "(", ")", ",", "ntfLambdaPhi", ".", "getY", "(", ")", ",", "LAMBERT_4_N", ",", "LAMBERT_4_C", ",", "LAMBERT_4_XS", ",", "LAMBERT_4_YS", ")", ";", "}" ]
This function convert France Lambert 93 coordinate to France Lambert IV coordinate. @param x is the coordinate in France Lambert 93 @param y is the coordinate in France Lambert 93 @return the France Lambert IV coordinate.
[ "This", "function", "convert", "France", "Lambert", "93", "coordinate", "to", "France", "Lambert", "IV", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L915-L928
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmModelCompleter.java
JvmModelCompleter.replaceVariables
protected String replaceVariables(String commentForGenerated, JvmDeclaredType jvmType) { """ Replace the variables contained in the comment to be written to the <code>@Generated</code> annotation. """ String result = commentForGenerated; if (result.contains(GENERATED_COMMENT_VAR_SOURCE_FILE)) { Resource resource = jvmType.eResource(); if (resource != null) { URI uri = resource.getURI(); if (uri != null) { String sourceFile = uri.lastSegment(); if (sourceFile == null) sourceFile = uri.toString(); result = result.replace(GENERATED_COMMENT_VAR_SOURCE_FILE, sourceFile); } } } return result; }
java
protected String replaceVariables(String commentForGenerated, JvmDeclaredType jvmType) { String result = commentForGenerated; if (result.contains(GENERATED_COMMENT_VAR_SOURCE_FILE)) { Resource resource = jvmType.eResource(); if (resource != null) { URI uri = resource.getURI(); if (uri != null) { String sourceFile = uri.lastSegment(); if (sourceFile == null) sourceFile = uri.toString(); result = result.replace(GENERATED_COMMENT_VAR_SOURCE_FILE, sourceFile); } } } return result; }
[ "protected", "String", "replaceVariables", "(", "String", "commentForGenerated", ",", "JvmDeclaredType", "jvmType", ")", "{", "String", "result", "=", "commentForGenerated", ";", "if", "(", "result", ".", "contains", "(", "GENERATED_COMMENT_VAR_SOURCE_FILE", ")", ")", "{", "Resource", "resource", "=", "jvmType", ".", "eResource", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "URI", "uri", "=", "resource", ".", "getURI", "(", ")", ";", "if", "(", "uri", "!=", "null", ")", "{", "String", "sourceFile", "=", "uri", ".", "lastSegment", "(", ")", ";", "if", "(", "sourceFile", "==", "null", ")", "sourceFile", "=", "uri", ".", "toString", "(", ")", ";", "result", "=", "result", ".", "replace", "(", "GENERATED_COMMENT_VAR_SOURCE_FILE", ",", "sourceFile", ")", ";", "}", "}", "}", "return", "result", ";", "}" ]
Replace the variables contained in the comment to be written to the <code>@Generated</code> annotation.
[ "Replace", "the", "variables", "contained", "in", "the", "comment", "to", "be", "written", "to", "the", "<code", ">" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmModelCompleter.java#L275-L290
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.BeginBin
public static JBBPOut BeginBin(final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { """ Start a DSL session for defined both byte outOrder and bit outOrder parameters. @param byteOrder the byte outOrder to be used for the session @param bitOrder the bit outOrder to be used for the session @return the new DSL session generated with the parameters and inside byte array stream. """ return new JBBPOut(new ByteArrayOutputStream(), byteOrder, bitOrder); }
java
public static JBBPOut BeginBin(final JBBPByteOrder byteOrder, final JBBPBitOrder bitOrder) { return new JBBPOut(new ByteArrayOutputStream(), byteOrder, bitOrder); }
[ "public", "static", "JBBPOut", "BeginBin", "(", "final", "JBBPByteOrder", "byteOrder", ",", "final", "JBBPBitOrder", "bitOrder", ")", "{", "return", "new", "JBBPOut", "(", "new", "ByteArrayOutputStream", "(", ")", ",", "byteOrder", ",", "bitOrder", ")", ";", "}" ]
Start a DSL session for defined both byte outOrder and bit outOrder parameters. @param byteOrder the byte outOrder to be used for the session @param bitOrder the bit outOrder to be used for the session @return the new DSL session generated with the parameters and inside byte array stream.
[ "Start", "a", "DSL", "session", "for", "defined", "both", "byte", "outOrder", "and", "bit", "outOrder", "parameters", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L107-L109
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java
ValidatorConfig.setWarningLevels
@BQConfigProperty("Specify the levels of specific warnings") public void setWarningLevels(Map<String, Severity> levels) { """ Change the specific warning levels. @param levels the warnings levels. """ if (levels == null) { this.warningLevels = new HashMap<>(); } else { this.warningLevels = levels; } }
java
@BQConfigProperty("Specify the levels of specific warnings") public void setWarningLevels(Map<String, Severity> levels) { if (levels == null) { this.warningLevels = new HashMap<>(); } else { this.warningLevels = levels; } }
[ "@", "BQConfigProperty", "(", "\"Specify the levels of specific warnings\"", ")", "public", "void", "setWarningLevels", "(", "Map", "<", "String", ",", "Severity", ">", "levels", ")", "{", "if", "(", "levels", "==", "null", ")", "{", "this", ".", "warningLevels", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "else", "{", "this", ".", "warningLevels", "=", "levels", ";", "}", "}" ]
Change the specific warning levels. @param levels the warnings levels.
[ "Change", "the", "specific", "warning", "levels", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java#L90-L97
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java
EnvironmentSettingsInner.publishAsync
public Observable<Void> publishAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) { """ Provisions/deprovisions required resources for an environment setting based on current state of the lab/environment setting. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return publishWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> publishAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) { return publishWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "publishAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ")", "{", "return", "publishWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "environmentSettingName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Provisions/deprovisions required resources for an environment setting based on current state of the lab/environment setting. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Provisions", "/", "deprovisions", "required", "resources", "for", "an", "environment", "setting", "based", "on", "current", "state", "of", "the", "lab", "/", "environment", "setting", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L1232-L1239
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java
AuditEvent.isAuditRequired
public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException { """ Check to see if auditing is required for an event type and outcome. @param eventType SECURITY_AUTHN, SECURITY_AUTHZ, etc @param outcome OUTCOME_SUCCESS, OUTCOME_DENIED, etc. @return true - events with the type/outcome should be audited false - events with the type/outcome should not be audited @throws AuditServiceUnavailableException """ AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { return auditService.isAuditRequired(eventType, outcome); } else { throw new AuditServiceUnavailableException(); } }
java
public static boolean isAuditRequired(String eventType, String outcome) throws AuditServiceUnavailableException { AuditService auditService = SecurityUtils.getAuditService(); if (auditService != null) { return auditService.isAuditRequired(eventType, outcome); } else { throw new AuditServiceUnavailableException(); } }
[ "public", "static", "boolean", "isAuditRequired", "(", "String", "eventType", ",", "String", "outcome", ")", "throws", "AuditServiceUnavailableException", "{", "AuditService", "auditService", "=", "SecurityUtils", ".", "getAuditService", "(", ")", ";", "if", "(", "auditService", "!=", "null", ")", "{", "return", "auditService", ".", "isAuditRequired", "(", "eventType", ",", "outcome", ")", ";", "}", "else", "{", "throw", "new", "AuditServiceUnavailableException", "(", ")", ";", "}", "}" ]
Check to see if auditing is required for an event type and outcome. @param eventType SECURITY_AUTHN, SECURITY_AUTHZ, etc @param outcome OUTCOME_SUCCESS, OUTCOME_DENIED, etc. @return true - events with the type/outcome should be audited false - events with the type/outcome should not be audited @throws AuditServiceUnavailableException
[ "Check", "to", "see", "if", "auditing", "is", "required", "for", "an", "event", "type", "and", "outcome", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/websphere/security/audit/AuditEvent.java#L595-L602
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Expression.java
Expression.checkTypes
static void checkTypes(ImmutableList<Type> types, Iterable<? extends Expression> exprs) { """ Checks that the given expressions are compatible with the given types. """ int size = Iterables.size(exprs); checkArgument( size == types.size(), "Supplied the wrong number of parameters. Expected %s, got %s", types.size(), size); // checkIsAssignableTo is an no-op if DEBUG is false if (Flags.DEBUG) { int i = 0; for (Expression expr : exprs) { expr.checkAssignableTo(types.get(i), "Parameter %s", i); i++; } } }
java
static void checkTypes(ImmutableList<Type> types, Iterable<? extends Expression> exprs) { int size = Iterables.size(exprs); checkArgument( size == types.size(), "Supplied the wrong number of parameters. Expected %s, got %s", types.size(), size); // checkIsAssignableTo is an no-op if DEBUG is false if (Flags.DEBUG) { int i = 0; for (Expression expr : exprs) { expr.checkAssignableTo(types.get(i), "Parameter %s", i); i++; } } }
[ "static", "void", "checkTypes", "(", "ImmutableList", "<", "Type", ">", "types", ",", "Iterable", "<", "?", "extends", "Expression", ">", "exprs", ")", "{", "int", "size", "=", "Iterables", ".", "size", "(", "exprs", ")", ";", "checkArgument", "(", "size", "==", "types", ".", "size", "(", ")", ",", "\"Supplied the wrong number of parameters. Expected %s, got %s\"", ",", "types", ".", "size", "(", ")", ",", "size", ")", ";", "// checkIsAssignableTo is an no-op if DEBUG is false", "if", "(", "Flags", ".", "DEBUG", ")", "{", "int", "i", "=", "0", ";", "for", "(", "Expression", "expr", ":", "exprs", ")", "{", "expr", ".", "checkAssignableTo", "(", "types", ".", "get", "(", "i", ")", ",", "\"Parameter %s\"", ",", "i", ")", ";", "i", "++", ";", "}", "}", "}" ]
Checks that the given expressions are compatible with the given types.
[ "Checks", "that", "the", "given", "expressions", "are", "compatible", "with", "the", "given", "types", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Expression.java#L167-L182
molgenis/molgenis
molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java
IndexJobService.performAction
private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) { """ Performs a single IndexAction @param progress {@link Progress} to report progress to @param progressCount the progress count for this IndexAction @param indexAction Entity of type IndexActionMetaData @return boolean indicating success or failure """ requireNonNull(indexAction); String entityTypeId = indexAction.getEntityTypeId(); updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED); try { if (dataService.hasEntityType(entityTypeId)) { EntityType entityType = dataService.getEntityType(entityTypeId); if (indexAction.getEntityId() != null) { progress.progress( progressCount, format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId())); rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId()); } else { progress.progress(progressCount, format("Indexing {0}", entityType.getId())); final Repository<Entity> repository = dataService.getRepository(entityType.getId()); indexService.rebuildIndex(repository); } } else { EntityType entityType = getEntityType(indexAction); if (indexService.hasIndex(entityType)) { progress.progress( progressCount, format("Dropping entityType with id: {0}", entityType.getId())); indexService.deleteIndex(entityType); } else { // Index Job is finished, here we concluded that we don't have enough info to continue the // index job progress.progress( progressCount, format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId())); } } updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED); return true; } catch (Exception ex) { LOG.error("Index job failed", ex); updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED); return false; } }
java
private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) { requireNonNull(indexAction); String entityTypeId = indexAction.getEntityTypeId(); updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED); try { if (dataService.hasEntityType(entityTypeId)) { EntityType entityType = dataService.getEntityType(entityTypeId); if (indexAction.getEntityId() != null) { progress.progress( progressCount, format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId())); rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId()); } else { progress.progress(progressCount, format("Indexing {0}", entityType.getId())); final Repository<Entity> repository = dataService.getRepository(entityType.getId()); indexService.rebuildIndex(repository); } } else { EntityType entityType = getEntityType(indexAction); if (indexService.hasIndex(entityType)) { progress.progress( progressCount, format("Dropping entityType with id: {0}", entityType.getId())); indexService.deleteIndex(entityType); } else { // Index Job is finished, here we concluded that we don't have enough info to continue the // index job progress.progress( progressCount, format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId())); } } updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED); return true; } catch (Exception ex) { LOG.error("Index job failed", ex); updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED); return false; } }
[ "private", "boolean", "performAction", "(", "Progress", "progress", ",", "int", "progressCount", ",", "IndexAction", "indexAction", ")", "{", "requireNonNull", "(", "indexAction", ")", ";", "String", "entityTypeId", "=", "indexAction", ".", "getEntityTypeId", "(", ")", ";", "updateIndexActionStatus", "(", "indexAction", ",", "IndexActionMetadata", ".", "IndexStatus", ".", "STARTED", ")", ";", "try", "{", "if", "(", "dataService", ".", "hasEntityType", "(", "entityTypeId", ")", ")", "{", "EntityType", "entityType", "=", "dataService", ".", "getEntityType", "(", "entityTypeId", ")", ";", "if", "(", "indexAction", ".", "getEntityId", "(", ")", "!=", "null", ")", "{", "progress", ".", "progress", "(", "progressCount", ",", "format", "(", "\"Indexing {0}.{1}\"", ",", "entityType", ".", "getId", "(", ")", ",", "indexAction", ".", "getEntityId", "(", ")", ")", ")", ";", "rebuildIndexOneEntity", "(", "entityTypeId", ",", "indexAction", ".", "getEntityId", "(", ")", ")", ";", "}", "else", "{", "progress", ".", "progress", "(", "progressCount", ",", "format", "(", "\"Indexing {0}\"", ",", "entityType", ".", "getId", "(", ")", ")", ")", ";", "final", "Repository", "<", "Entity", ">", "repository", "=", "dataService", ".", "getRepository", "(", "entityType", ".", "getId", "(", ")", ")", ";", "indexService", ".", "rebuildIndex", "(", "repository", ")", ";", "}", "}", "else", "{", "EntityType", "entityType", "=", "getEntityType", "(", "indexAction", ")", ";", "if", "(", "indexService", ".", "hasIndex", "(", "entityType", ")", ")", "{", "progress", ".", "progress", "(", "progressCount", ",", "format", "(", "\"Dropping entityType with id: {0}\"", ",", "entityType", ".", "getId", "(", ")", ")", ")", ";", "indexService", ".", "deleteIndex", "(", "entityType", ")", ";", "}", "else", "{", "// Index Job is finished, here we concluded that we don't have enough info to continue the", "// index job", "progress", ".", "progress", "(", "progressCount", ",", "format", "(", "\"Skip index entity {0}.{1}\"", ",", "entityType", ".", "getId", "(", ")", ",", "indexAction", ".", "getEntityId", "(", ")", ")", ")", ";", "}", "}", "updateIndexActionStatus", "(", "indexAction", ",", "IndexActionMetadata", ".", "IndexStatus", ".", "FINISHED", ")", ";", "return", "true", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOG", ".", "error", "(", "\"Index job failed\"", ",", "ex", ")", ";", "updateIndexActionStatus", "(", "indexAction", ",", "IndexActionMetadata", ".", "IndexStatus", ".", "FAILED", ")", ";", "return", "false", ";", "}", "}" ]
Performs a single IndexAction @param progress {@link Progress} to report progress to @param progressCount the progress count for this IndexAction @param indexAction Entity of type IndexActionMetaData @return boolean indicating success or failure
[ "Performs", "a", "single", "IndexAction" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L107-L145
AKSW/RDFUnit
rdfunit-model/src/main/java/org/aksw/rdfunit/model/shacl/ShaclModel.java
ShaclModel.getExplicitShapeTargets
public Map<Shape, Set<ShapeTarget>> getExplicitShapeTargets(Collection<Shape> shapes) { """ /* public Set<TestCase> generateTestCasesOld() { ImmutableSet.Builder<TestCase> builder = ImmutableSet.builder(); getShapes().forEach( shape -> // for every shape shape.getTargets().forEach(target -> // for every target (skip if none) shape.getPropertyConstraintGroups().forEach( ppg -> ppg.getPropertyConstraints().forEach( ppc -> { String filter = ppg.getPropertyFilter(); if (!ppc.usesValidatorFunction()) {filter = "";} builder.add( TestCaseWithTarget.builder() .target(target) .filterSpqrql(filter) .testCase(ppc.getTestCase(ppg.isInverse())) .build()); } )))); return builder.build(); } """ Map<Shape, Set<ShapeTarget>> targets = new HashMap<>(); shapes.forEach( s -> { Set<ShapeTarget> trgs = BatchShapeTargetReader.create().read(s.getElement()); if (!trgs.isEmpty()) { targets.put(s, trgs); } }); return targets; }
java
public Map<Shape, Set<ShapeTarget>> getExplicitShapeTargets(Collection<Shape> shapes) { Map<Shape, Set<ShapeTarget>> targets = new HashMap<>(); shapes.forEach( s -> { Set<ShapeTarget> trgs = BatchShapeTargetReader.create().read(s.getElement()); if (!trgs.isEmpty()) { targets.put(s, trgs); } }); return targets; }
[ "public", "Map", "<", "Shape", ",", "Set", "<", "ShapeTarget", ">", ">", "getExplicitShapeTargets", "(", "Collection", "<", "Shape", ">", "shapes", ")", "{", "Map", "<", "Shape", ",", "Set", "<", "ShapeTarget", ">", ">", "targets", "=", "new", "HashMap", "<>", "(", ")", ";", "shapes", ".", "forEach", "(", "s", "->", "{", "Set", "<", "ShapeTarget", ">", "trgs", "=", "BatchShapeTargetReader", ".", "create", "(", ")", ".", "read", "(", "s", ".", "getElement", "(", ")", ")", ";", "if", "(", "!", "trgs", ".", "isEmpty", "(", ")", ")", "{", "targets", ".", "put", "(", "s", ",", "trgs", ")", ";", "}", "}", ")", ";", "return", "targets", ";", "}" ]
/* public Set<TestCase> generateTestCasesOld() { ImmutableSet.Builder<TestCase> builder = ImmutableSet.builder(); getShapes().forEach( shape -> // for every shape shape.getTargets().forEach(target -> // for every target (skip if none) shape.getPropertyConstraintGroups().forEach( ppg -> ppg.getPropertyConstraints().forEach( ppc -> { String filter = ppg.getPropertyFilter(); if (!ppc.usesValidatorFunction()) {filter = "";} builder.add( TestCaseWithTarget.builder() .target(target) .filterSpqrql(filter) .testCase(ppc.getTestCase(ppg.isInverse())) .build()); } )))); return builder.build(); }
[ "/", "*", "public", "Set<TestCase", ">", "generateTestCasesOld", "()", "{", "ImmutableSet", ".", "Builder<TestCase", ">", "builder", "=", "ImmutableSet", ".", "builder", "()", ";" ]
train
https://github.com/AKSW/RDFUnit/blob/083f18ebda4ad790b1fbb4cfe1c9dd1762d51384/rdfunit-model/src/main/java/org/aksw/rdfunit/model/shacl/ShaclModel.java#L119-L128
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java
BaseMessageProcessor.getMessageProcessor
public static BaseMessageProcessor getMessageProcessor(Task taskParent, BaseMessage externalTrxMessage, String strDefaultProcessorClass) { """ Given the message (code) name, get the message processor. @param taskParent Task to pass to new process. @param recordMain Record to pass to the new process. @param properties Properties to pass to the new process. @param strMessageName The name of the message to get the processor from (the message code or ID in the MessageInfo file). @param mapMessageInfo Return the message properties in this map. @return The new MessageProcessor. """ BaseMessageProcessor messageProcessor = null; String strClass = null; if (externalTrxMessage != null) strClass = (String)((TrxMessageHeader)externalTrxMessage.getMessageHeader()).get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS); if ((strClass == null) || (strClass.length() == 0)) strClass = strDefaultProcessorClass; String strPackage = null; if (externalTrxMessage != null) strPackage = (String)((TrxMessageHeader)externalTrxMessage.getMessageHeader()).get(TrxMessageHeader.BASE_PACKAGE); strClass = ClassServiceUtility.getFullClassName(strPackage, strClass); messageProcessor = (BaseMessageProcessor)ClassServiceUtility.getClassService().makeObjectFromClassName(strClass); if (messageProcessor != null) messageProcessor.init(taskParent, null, null); else Utility.getLogger().warning("Message processor not found: " + strClass); return messageProcessor; }
java
public static BaseMessageProcessor getMessageProcessor(Task taskParent, BaseMessage externalTrxMessage, String strDefaultProcessorClass) { BaseMessageProcessor messageProcessor = null; String strClass = null; if (externalTrxMessage != null) strClass = (String)((TrxMessageHeader)externalTrxMessage.getMessageHeader()).get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS); if ((strClass == null) || (strClass.length() == 0)) strClass = strDefaultProcessorClass; String strPackage = null; if (externalTrxMessage != null) strPackage = (String)((TrxMessageHeader)externalTrxMessage.getMessageHeader()).get(TrxMessageHeader.BASE_PACKAGE); strClass = ClassServiceUtility.getFullClassName(strPackage, strClass); messageProcessor = (BaseMessageProcessor)ClassServiceUtility.getClassService().makeObjectFromClassName(strClass); if (messageProcessor != null) messageProcessor.init(taskParent, null, null); else Utility.getLogger().warning("Message processor not found: " + strClass); return messageProcessor; }
[ "public", "static", "BaseMessageProcessor", "getMessageProcessor", "(", "Task", "taskParent", ",", "BaseMessage", "externalTrxMessage", ",", "String", "strDefaultProcessorClass", ")", "{", "BaseMessageProcessor", "messageProcessor", "=", "null", ";", "String", "strClass", "=", "null", ";", "if", "(", "externalTrxMessage", "!=", "null", ")", "strClass", "=", "(", "String", ")", "(", "(", "TrxMessageHeader", ")", "externalTrxMessage", ".", "getMessageHeader", "(", ")", ")", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESSOR_CLASS", ")", ";", "if", "(", "(", "strClass", "==", "null", ")", "||", "(", "strClass", ".", "length", "(", ")", "==", "0", ")", ")", "strClass", "=", "strDefaultProcessorClass", ";", "String", "strPackage", "=", "null", ";", "if", "(", "externalTrxMessage", "!=", "null", ")", "strPackage", "=", "(", "String", ")", "(", "(", "TrxMessageHeader", ")", "externalTrxMessage", ".", "getMessageHeader", "(", ")", ")", ".", "get", "(", "TrxMessageHeader", ".", "BASE_PACKAGE", ")", ";", "strClass", "=", "ClassServiceUtility", ".", "getFullClassName", "(", "strPackage", ",", "strClass", ")", ";", "messageProcessor", "=", "(", "BaseMessageProcessor", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "strClass", ")", ";", "if", "(", "messageProcessor", "!=", "null", ")", "messageProcessor", ".", "init", "(", "taskParent", ",", "null", ",", "null", ")", ";", "else", "Utility", ".", "getLogger", "(", ")", ".", "warning", "(", "\"Message processor not found: \"", "+", "strClass", ")", ";", "return", "messageProcessor", ";", "}" ]
Given the message (code) name, get the message processor. @param taskParent Task to pass to new process. @param recordMain Record to pass to the new process. @param properties Properties to pass to the new process. @param strMessageName The name of the message to get the processor from (the message code or ID in the MessageInfo file). @param mapMessageInfo Return the message properties in this map. @return The new MessageProcessor.
[ "Given", "the", "message", "(", "code", ")", "name", "get", "the", "message", "processor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java#L113-L131
Netflix/astyanax
astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityMapper.java
CompositeEntityMapper.toColumnName
private ByteBuffer toColumnName(Object obj) { """ Return the column name byte buffer for this entity @param obj @return """ SimpleCompositeBuilder composite = new SimpleCompositeBuilder(bufferSize, Equality.EQUAL); // Iterate through each component and add to a CompositeType structure for (FieldMapper<?> mapper : components) { try { composite.addWithoutControl(mapper.toByteBuffer(obj)); } catch (Exception e) { throw new RuntimeException(e); } } return composite.get(); }
java
private ByteBuffer toColumnName(Object obj) { SimpleCompositeBuilder composite = new SimpleCompositeBuilder(bufferSize, Equality.EQUAL); // Iterate through each component and add to a CompositeType structure for (FieldMapper<?> mapper : components) { try { composite.addWithoutControl(mapper.toByteBuffer(obj)); } catch (Exception e) { throw new RuntimeException(e); } } return composite.get(); }
[ "private", "ByteBuffer", "toColumnName", "(", "Object", "obj", ")", "{", "SimpleCompositeBuilder", "composite", "=", "new", "SimpleCompositeBuilder", "(", "bufferSize", ",", "Equality", ".", "EQUAL", ")", ";", "// Iterate through each component and add to a CompositeType structure", "for", "(", "FieldMapper", "<", "?", ">", "mapper", ":", "components", ")", "{", "try", "{", "composite", ".", "addWithoutControl", "(", "mapper", ".", "toByteBuffer", "(", "obj", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "return", "composite", ".", "get", "(", ")", ";", "}" ]
Return the column name byte buffer for this entity @param obj @return
[ "Return", "the", "column", "name", "byte", "buffer", "for", "this", "entity" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityMapper.java#L226-L239
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/DateUtils.java
DateUtils.convertTwoDigitYearToFour
@IntRange(from = 1000, to = 9999) static int convertTwoDigitYearToFour(@IntRange(from = 0, to = 99) int inputYear) { """ Converts a two-digit input year to a four-digit year. As the current calendar year approaches a century, we assume small values to mean the next century. For instance, if the current year is 2090, and the input value is "18", the user probably means 2118, not 2018. However, in 2017, the input "18" probably means 2018. This code should be updated before the year 9981. @param inputYear a two-digit integer, between 0 and 99, inclusive @return a four-digit year """ return convertTwoDigitYearToFour(inputYear, Calendar.getInstance()); }
java
@IntRange(from = 1000, to = 9999) static int convertTwoDigitYearToFour(@IntRange(from = 0, to = 99) int inputYear) { return convertTwoDigitYearToFour(inputYear, Calendar.getInstance()); }
[ "@", "IntRange", "(", "from", "=", "1000", ",", "to", "=", "9999", ")", "static", "int", "convertTwoDigitYearToFour", "(", "@", "IntRange", "(", "from", "=", "0", ",", "to", "=", "99", ")", "int", "inputYear", ")", "{", "return", "convertTwoDigitYearToFour", "(", "inputYear", ",", "Calendar", ".", "getInstance", "(", ")", ")", ";", "}" ]
Converts a two-digit input year to a four-digit year. As the current calendar year approaches a century, we assume small values to mean the next century. For instance, if the current year is 2090, and the input value is "18", the user probably means 2118, not 2018. However, in 2017, the input "18" probably means 2018. This code should be updated before the year 9981. @param inputYear a two-digit integer, between 0 and 99, inclusive @return a four-digit year
[ "Converts", "a", "two", "-", "digit", "input", "year", "to", "a", "four", "-", "digit", "year", ".", "As", "the", "current", "calendar", "year", "approaches", "a", "century", "we", "assume", "small", "values", "to", "mean", "the", "next", "century", ".", "For", "instance", "if", "the", "current", "year", "is", "2090", "and", "the", "input", "value", "is", "18", "the", "user", "probably", "means", "2118", "not", "2018", ".", "However", "in", "2017", "the", "input", "18", "probably", "means", "2018", ".", "This", "code", "should", "be", "updated", "before", "the", "year", "9981", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/DateUtils.java#L143-L146
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildPackageDoc
public void buildPackageDoc(XMLNode node, Content contentTree) throws DocletException { """ Build the package documentation. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation """ contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageElement)); buildChildren(node, contentTree); packageWriter.addPackageFooter(contentTree); packageWriter.printDocument(contentTree); utils.copyDocFiles(packageElement); }
java
public void buildPackageDoc(XMLNode node, Content contentTree) throws DocletException { contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageElement)); buildChildren(node, contentTree); packageWriter.addPackageFooter(contentTree); packageWriter.printDocument(contentTree); utils.copyDocFiles(packageElement); }
[ "public", "void", "buildPackageDoc", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "DocletException", "{", "contentTree", "=", "packageWriter", ".", "getPackageHeader", "(", "utils", ".", "getPackageName", "(", "packageElement", ")", ")", ";", "buildChildren", "(", "node", ",", "contentTree", ")", ";", "packageWriter", ".", "addPackageFooter", "(", "contentTree", ")", ";", "packageWriter", ".", "printDocument", "(", "contentTree", ")", ";", "utils", ".", "copyDocFiles", "(", "packageElement", ")", ";", "}" ]
Build the package documentation. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation
[ "Build", "the", "package", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L133-L139
apereo/cas
support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java
SamlMetadataUIParserAction.getRegisteredServiceFromRequest
protected RegisteredService getRegisteredServiceFromRequest(final RequestContext requestContext, final String entityId) { """ Gets registered service from request. @param requestContext the request context @param entityId the entity id @return the registered service from request """ val currentService = WebUtils.getService(requestContext); val service = this.serviceFactory.createService(entityId); var registeredService = this.servicesManager.findServiceBy(service); if (registeredService == null) { LOGGER.debug("Entity id [{}] not found in the registry. Fallback onto [{}]", entityId, currentService); registeredService = this.servicesManager.findServiceBy(currentService); } LOGGER.debug("Located service definition [{}]", registeredService); return registeredService; }
java
protected RegisteredService getRegisteredServiceFromRequest(final RequestContext requestContext, final String entityId) { val currentService = WebUtils.getService(requestContext); val service = this.serviceFactory.createService(entityId); var registeredService = this.servicesManager.findServiceBy(service); if (registeredService == null) { LOGGER.debug("Entity id [{}] not found in the registry. Fallback onto [{}]", entityId, currentService); registeredService = this.servicesManager.findServiceBy(currentService); } LOGGER.debug("Located service definition [{}]", registeredService); return registeredService; }
[ "protected", "RegisteredService", "getRegisteredServiceFromRequest", "(", "final", "RequestContext", "requestContext", ",", "final", "String", "entityId", ")", "{", "val", "currentService", "=", "WebUtils", ".", "getService", "(", "requestContext", ")", ";", "val", "service", "=", "this", ".", "serviceFactory", ".", "createService", "(", "entityId", ")", ";", "var", "registeredService", "=", "this", ".", "servicesManager", ".", "findServiceBy", "(", "service", ")", ";", "if", "(", "registeredService", "==", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Entity id [{}] not found in the registry. Fallback onto [{}]\"", ",", "entityId", ",", "currentService", ")", ";", "registeredService", "=", "this", ".", "servicesManager", ".", "findServiceBy", "(", "currentService", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"Located service definition [{}]\"", ",", "registeredService", ")", ";", "return", "registeredService", ";", "}" ]
Gets registered service from request. @param requestContext the request context @param entityId the entity id @return the registered service from request
[ "Gets", "registered", "service", "from", "request", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-mdui/src/main/java/org/apereo/cas/support/saml/mdui/web/flow/SamlMetadataUIParserAction.java#L106-L116
bignerdranch/expandable-recycler-view
sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java
HorizontalExpandableAdapter.onCreateParentViewHolder
@UiThread @NonNull @Override public HorizontalParentViewHolder onCreateParentViewHolder(@NonNull ViewGroup parent, int viewType) { """ OnCreateViewHolder implementation for parent items. The desired ParentViewHolder should be inflated here @param parent for inflating the View @return the user's custom parent ViewHolder that must extend ParentViewHolder """ View view = mInflater.inflate(R.layout.list_item_parent_horizontal, parent, false); return new HorizontalParentViewHolder(view); }
java
@UiThread @NonNull @Override public HorizontalParentViewHolder onCreateParentViewHolder(@NonNull ViewGroup parent, int viewType) { View view = mInflater.inflate(R.layout.list_item_parent_horizontal, parent, false); return new HorizontalParentViewHolder(view); }
[ "@", "UiThread", "@", "NonNull", "@", "Override", "public", "HorizontalParentViewHolder", "onCreateParentViewHolder", "(", "@", "NonNull", "ViewGroup", "parent", ",", "int", "viewType", ")", "{", "View", "view", "=", "mInflater", ".", "inflate", "(", "R", ".", "layout", ".", "list_item_parent_horizontal", ",", "parent", ",", "false", ")", ";", "return", "new", "HorizontalParentViewHolder", "(", "view", ")", ";", "}" ]
OnCreateViewHolder implementation for parent items. The desired ParentViewHolder should be inflated here @param parent for inflating the View @return the user's custom parent ViewHolder that must extend ParentViewHolder
[ "OnCreateViewHolder", "implementation", "for", "parent", "items", ".", "The", "desired", "ParentViewHolder", "should", "be", "inflated", "here" ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java#L41-L47
btaz/data-util
src/main/java/com/btaz/util/xml/diff/DefaultReport.java
DefaultReport.trimNonXmlElements
@SuppressWarnings("RedundantStringConstructorCall") // avoid String substring memory leak in JDK 1.6 private String trimNonXmlElements(String path) { """ /* This method trims non XML element data from the end of a path e.g. <float name="score">12.34567 would become <float name="score">, 12.34567 would be stripped out """ if(path != null && path.length() > 0) { int pos = path.lastIndexOf(">"); if(pos > -1) { path = new String(path.substring(0, pos+1)); } } return path; }
java
@SuppressWarnings("RedundantStringConstructorCall") // avoid String substring memory leak in JDK 1.6 private String trimNonXmlElements(String path) { if(path != null && path.length() > 0) { int pos = path.lastIndexOf(">"); if(pos > -1) { path = new String(path.substring(0, pos+1)); } } return path; }
[ "@", "SuppressWarnings", "(", "\"RedundantStringConstructorCall\"", ")", "// avoid String substring memory leak in JDK 1.6", "private", "String", "trimNonXmlElements", "(", "String", "path", ")", "{", "if", "(", "path", "!=", "null", "&&", "path", ".", "length", "(", ")", ">", "0", ")", "{", "int", "pos", "=", "path", ".", "lastIndexOf", "(", "\">\"", ")", ";", "if", "(", "pos", ">", "-", "1", ")", "{", "path", "=", "new", "String", "(", "path", ".", "substring", "(", "0", ",", "pos", "+", "1", ")", ")", ";", "}", "}", "return", "path", ";", "}" ]
/* This method trims non XML element data from the end of a path e.g. <float name="score">12.34567 would become <float name="score">, 12.34567 would be stripped out
[ "/", "*", "This", "method", "trims", "non", "XML", "element", "data", "from", "the", "end", "of", "a", "path", "e", ".", "g", ".", "<float", "name", "=", "score", ">", "12", ".", "34567", "would", "become", "<float", "name", "=", "score", ">", "12", ".", "34567", "would", "be", "stripped", "out" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/diff/DefaultReport.java#L71-L80
LearnLib/learnlib
algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/adt/ADT.java
ADT.replaceNode
public void replaceNode(final ADTNode<S, I, O> oldNode, final ADTNode<S, I, O> newNode) { """ Replaces an existing node in the tree with a new one and updates the references of parent/child nodes accordingly. @param oldNode the node to replace @param newNode the replacement """ if (this.root.equals(oldNode)) { this.root = newNode; } else if (ADTUtil.isResetNode(oldNode)) { final ADTNode<S, I, O> endOfPreviousADS = oldNode.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNode); newNode.setParent(endOfPreviousADS); endOfPreviousADS.getChildren().put(outputToReset, newNode); } else { final ADTNode<S, I, O> oldNodeParent = oldNode.getParent(); //reset node assert ADTUtil.isResetNode(oldNodeParent); final ADTNode<S, I, O> endOfPreviousADS = oldNodeParent.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNodeParent); final ADTNode<S, I, O> newResetNode = new ADTResetNode<>(newNode); newResetNode.setParent(endOfPreviousADS); newNode.setParent(newResetNode); endOfPreviousADS.getChildren().put(outputToReset, newResetNode); } }
java
public void replaceNode(final ADTNode<S, I, O> oldNode, final ADTNode<S, I, O> newNode) { if (this.root.equals(oldNode)) { this.root = newNode; } else if (ADTUtil.isResetNode(oldNode)) { final ADTNode<S, I, O> endOfPreviousADS = oldNode.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNode); newNode.setParent(endOfPreviousADS); endOfPreviousADS.getChildren().put(outputToReset, newNode); } else { final ADTNode<S, I, O> oldNodeParent = oldNode.getParent(); //reset node assert ADTUtil.isResetNode(oldNodeParent); final ADTNode<S, I, O> endOfPreviousADS = oldNodeParent.getParent(); final O outputToReset = ADTUtil.getOutputForSuccessor(endOfPreviousADS, oldNodeParent); final ADTNode<S, I, O> newResetNode = new ADTResetNode<>(newNode); newResetNode.setParent(endOfPreviousADS); newNode.setParent(newResetNode); endOfPreviousADS.getChildren().put(outputToReset, newResetNode); } }
[ "public", "void", "replaceNode", "(", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "oldNode", ",", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "newNode", ")", "{", "if", "(", "this", ".", "root", ".", "equals", "(", "oldNode", ")", ")", "{", "this", ".", "root", "=", "newNode", ";", "}", "else", "if", "(", "ADTUtil", ".", "isResetNode", "(", "oldNode", ")", ")", "{", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "endOfPreviousADS", "=", "oldNode", ".", "getParent", "(", ")", ";", "final", "O", "outputToReset", "=", "ADTUtil", ".", "getOutputForSuccessor", "(", "endOfPreviousADS", ",", "oldNode", ")", ";", "newNode", ".", "setParent", "(", "endOfPreviousADS", ")", ";", "endOfPreviousADS", ".", "getChildren", "(", ")", ".", "put", "(", "outputToReset", ",", "newNode", ")", ";", "}", "else", "{", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "oldNodeParent", "=", "oldNode", ".", "getParent", "(", ")", ";", "//reset node", "assert", "ADTUtil", ".", "isResetNode", "(", "oldNodeParent", ")", ";", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "endOfPreviousADS", "=", "oldNodeParent", ".", "getParent", "(", ")", ";", "final", "O", "outputToReset", "=", "ADTUtil", ".", "getOutputForSuccessor", "(", "endOfPreviousADS", ",", "oldNodeParent", ")", ";", "final", "ADTNode", "<", "S", ",", "I", ",", "O", ">", "newResetNode", "=", "new", "ADTResetNode", "<>", "(", "newNode", ")", ";", "newResetNode", ".", "setParent", "(", "endOfPreviousADS", ")", ";", "newNode", ".", "setParent", "(", "newResetNode", ")", ";", "endOfPreviousADS", ".", "getChildren", "(", ")", ".", "put", "(", "outputToReset", ",", "newResetNode", ")", ";", "}", "}" ]
Replaces an existing node in the tree with a new one and updates the references of parent/child nodes accordingly. @param oldNode the node to replace @param newNode the replacement
[ "Replaces", "an", "existing", "node", "in", "the", "tree", "with", "a", "new", "one", "and", "updates", "the", "references", "of", "parent", "/", "child", "nodes", "accordingly", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/adt/ADT.java#L83-L106
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.toShort
public static short toShort(byte[] bytes, int offset, final int length) { """ Converts a byte array to a short value. @param bytes byte array @param offset offset into array @param length length, has to be {@link #SIZEOF_SHORT} @return the short value @throws IllegalArgumentException if length is not {@link #SIZEOF_SHORT} or if there's not enough room in the array at the offset indicated. """ if (length != SIZEOF_SHORT || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT); } short n = 0; n ^= bytes[offset] & 0xFF; n <<= 8; n ^= bytes[offset + 1] & 0xFF; return n; }
java
public static short toShort(byte[] bytes, int offset, final int length) { if (length != SIZEOF_SHORT || offset + length > bytes.length) { throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT); } short n = 0; n ^= bytes[offset] & 0xFF; n <<= 8; n ^= bytes[offset + 1] & 0xFF; return n; }
[ "public", "static", "short", "toShort", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "final", "int", "length", ")", "{", "if", "(", "length", "!=", "SIZEOF_SHORT", "||", "offset", "+", "length", ">", "bytes", ".", "length", ")", "{", "throw", "explainWrongLengthOrOffset", "(", "bytes", ",", "offset", ",", "length", ",", "SIZEOF_SHORT", ")", ";", "}", "short", "n", "=", "0", ";", "n", "^=", "bytes", "[", "offset", "]", "&", "0xFF", ";", "n", "<<=", "8", ";", "n", "^=", "bytes", "[", "offset", "+", "1", "]", "&", "0xFF", ";", "return", "n", ";", "}" ]
Converts a byte array to a short value. @param bytes byte array @param offset offset into array @param length length, has to be {@link #SIZEOF_SHORT} @return the short value @throws IllegalArgumentException if length is not {@link #SIZEOF_SHORT} or if there's not enough room in the array at the offset indicated.
[ "Converts", "a", "byte", "array", "to", "a", "short", "value", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L642-L651
joniles/mpxj
src/main/java/net/sf/mpxj/reader/ProjectReaderUtility.java
ProjectReaderUtility.getProjectReader
public static ProjectReader getProjectReader(String name) throws MPXJException { """ Retrieves a ProjectReader instance which can read a file of the type specified by the supplied file name. @param name file name @return ProjectReader instance """ int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectReader> fileClass = READER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot read files of type: " + extension); } try { ProjectReader file = fileClass.newInstance(); return (file); } catch (Exception ex) { throw new MPXJException("Failed to load project reader", ex); } }
java
public static ProjectReader getProjectReader(String name) throws MPXJException { int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectReader> fileClass = READER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot read files of type: " + extension); } try { ProjectReader file = fileClass.newInstance(); return (file); } catch (Exception ex) { throw new MPXJException("Failed to load project reader", ex); } }
[ "public", "static", "ProjectReader", "getProjectReader", "(", "String", "name", ")", "throws", "MPXJException", "{", "int", "index", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Filename has no extension: \"", "+", "name", ")", ";", "}", "String", "extension", "=", "name", ".", "substring", "(", "index", "+", "1", ")", ".", "toUpperCase", "(", ")", ";", "Class", "<", "?", "extends", "ProjectReader", ">", "fileClass", "=", "READER_MAP", ".", "get", "(", "extension", ")", ";", "if", "(", "fileClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot read files of type: \"", "+", "extension", ")", ";", "}", "try", "{", "ProjectReader", "file", "=", "fileClass", ".", "newInstance", "(", ")", ";", "return", "(", "file", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "MPXJException", "(", "\"Failed to load project reader\"", ",", "ex", ")", ";", "}", "}" ]
Retrieves a ProjectReader instance which can read a file of the type specified by the supplied file name. @param name file name @return ProjectReader instance
[ "Retrieves", "a", "ProjectReader", "instance", "which", "can", "read", "a", "file", "of", "the", "type", "specified", "by", "the", "supplied", "file", "name", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/ProjectReaderUtility.java#L66-L92
alkacon/opencms-core
src/org/opencms/loader/CmsJspLoader.java
CmsJspLoader.readJspResource
protected CmsResource readJspResource(CmsFlexController controller, String jspName) throws CmsException { """ Returns the jsp resource identified by the given name, using the controllers cms context.<p> @param controller the flex controller @param jspName the name of the jsp @return an OpenCms resource @throws CmsException if something goes wrong """ // create an OpenCms user context that operates in the root site CmsObject cms = OpenCms.initCmsObject(controller.getCmsObject()); // we only need to change the site, but not the project, // since the request has already the right project set cms.getRequestContext().setSiteRoot(""); // try to read the resource return cms.readResource(jspName); }
java
protected CmsResource readJspResource(CmsFlexController controller, String jspName) throws CmsException { // create an OpenCms user context that operates in the root site CmsObject cms = OpenCms.initCmsObject(controller.getCmsObject()); // we only need to change the site, but not the project, // since the request has already the right project set cms.getRequestContext().setSiteRoot(""); // try to read the resource return cms.readResource(jspName); }
[ "protected", "CmsResource", "readJspResource", "(", "CmsFlexController", "controller", ",", "String", "jspName", ")", "throws", "CmsException", "{", "// create an OpenCms user context that operates in the root site", "CmsObject", "cms", "=", "OpenCms", ".", "initCmsObject", "(", "controller", ".", "getCmsObject", "(", ")", ")", ";", "// we only need to change the site, but not the project,", "// since the request has already the right project set", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "\"\"", ")", ";", "// try to read the resource", "return", "cms", ".", "readResource", "(", "jspName", ")", ";", "}" ]
Returns the jsp resource identified by the given name, using the controllers cms context.<p> @param controller the flex controller @param jspName the name of the jsp @return an OpenCms resource @throws CmsException if something goes wrong
[ "Returns", "the", "jsp", "resource", "identified", "by", "the", "given", "name", "using", "the", "controllers", "cms", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1601-L1610
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.checkNull
public static Date checkNull(Date value, Date elseValue) { """ 检测日期是否为NULL @param value 需要检测的日期 @param elseValue 为null染返回的值 @return {@link Date} @since 1.0.8 """ return isNull(value) ? elseValue : value; }
java
public static Date checkNull(Date value, Date elseValue) { return isNull(value) ? elseValue : value; }
[ "public", "static", "Date", "checkNull", "(", "Date", "value", ",", "Date", "elseValue", ")", "{", "return", "isNull", "(", "value", ")", "?", "elseValue", ":", "value", ";", "}" ]
检测日期是否为NULL @param value 需要检测的日期 @param elseValue 为null染返回的值 @return {@link Date} @since 1.0.8
[ "检测日期是否为NULL" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1544-L1546
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java
KeyValueFeatureHandler.helloRequest
private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception { """ Creates the HELLO request to ask for certain supported features. @param connId the connection id @return the request to send over the wire """ byte[] key = generateAgentJson( ctx.environment().userAgent(), ctx.coreId(), connId ); short keyLength = (short) key.length; ByteBuf wanted = Unpooled.buffer(features.size() * 2); for (ServerFeatures feature : features) { wanted.writeShort(feature.value()); } LOGGER.debug("Requesting supported features: {}", features); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(key, Unpooled.EMPTY_BUFFER, wanted); request.setOpcode(HELLO_CMD); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + wanted.readableBytes()); return request; }
java
private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception { byte[] key = generateAgentJson( ctx.environment().userAgent(), ctx.coreId(), connId ); short keyLength = (short) key.length; ByteBuf wanted = Unpooled.buffer(features.size() * 2); for (ServerFeatures feature : features) { wanted.writeShort(feature.value()); } LOGGER.debug("Requesting supported features: {}", features); FullBinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(key, Unpooled.EMPTY_BUFFER, wanted); request.setOpcode(HELLO_CMD); request.setKeyLength(keyLength); request.setTotalBodyLength(keyLength + wanted.readableBytes()); return request; }
[ "private", "FullBinaryMemcacheRequest", "helloRequest", "(", "int", "connId", ")", "throws", "Exception", "{", "byte", "[", "]", "key", "=", "generateAgentJson", "(", "ctx", ".", "environment", "(", ")", ".", "userAgent", "(", ")", ",", "ctx", ".", "coreId", "(", ")", ",", "connId", ")", ";", "short", "keyLength", "=", "(", "short", ")", "key", ".", "length", ";", "ByteBuf", "wanted", "=", "Unpooled", ".", "buffer", "(", "features", ".", "size", "(", ")", "*", "2", ")", ";", "for", "(", "ServerFeatures", "feature", ":", "features", ")", "{", "wanted", ".", "writeShort", "(", "feature", ".", "value", "(", ")", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"Requesting supported features: {}\"", ",", "features", ")", ";", "FullBinaryMemcacheRequest", "request", "=", "new", "DefaultFullBinaryMemcacheRequest", "(", "key", ",", "Unpooled", ".", "EMPTY_BUFFER", ",", "wanted", ")", ";", "request", ".", "setOpcode", "(", "HELLO_CMD", ")", ";", "request", ".", "setKeyLength", "(", "keyLength", ")", ";", "request", ".", "setTotalBodyLength", "(", "keyLength", "+", "wanted", ".", "readableBytes", "(", ")", ")", ";", "return", "request", ";", "}" ]
Creates the HELLO request to ask for certain supported features. @param connId the connection id @return the request to send over the wire
[ "Creates", "the", "HELLO", "request", "to", "ask", "for", "certain", "supported", "features", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java#L130-L149
google/closure-compiler
src/com/google/javascript/jscomp/MinimizeExitPoints.java
MinimizeExitPoints.tryMinimizeSwitchCaseExits
void tryMinimizeSwitchCaseExits(Node n, Token exitType, @Nullable String labelName) { """ Attempt to remove explicit exits from switch cases that also occur implicitly after the switch. """ checkState(NodeUtil.isSwitchCase(n)); checkState(n != n.getParent().getLastChild()); Node block = n.getLastChild(); Node maybeBreak = block.getLastChild(); if (maybeBreak == null || !maybeBreak.isBreak() || maybeBreak.hasChildren()) { // Can not minimize exits from a case without an explicit break from the switch. return; } // Now try to minimize the exits of the last child before the break, if it is removed // look at what has become the child before the break. Node childBeforeBreak = maybeBreak.getPrevious(); while (childBeforeBreak != null) { Node c = childBeforeBreak; tryMinimizeExits(c, exitType, labelName); // If the node is still the last child, we are done. childBeforeBreak = maybeBreak.getPrevious(); if (c == childBeforeBreak) { break; } } }
java
void tryMinimizeSwitchCaseExits(Node n, Token exitType, @Nullable String labelName) { checkState(NodeUtil.isSwitchCase(n)); checkState(n != n.getParent().getLastChild()); Node block = n.getLastChild(); Node maybeBreak = block.getLastChild(); if (maybeBreak == null || !maybeBreak.isBreak() || maybeBreak.hasChildren()) { // Can not minimize exits from a case without an explicit break from the switch. return; } // Now try to minimize the exits of the last child before the break, if it is removed // look at what has become the child before the break. Node childBeforeBreak = maybeBreak.getPrevious(); while (childBeforeBreak != null) { Node c = childBeforeBreak; tryMinimizeExits(c, exitType, labelName); // If the node is still the last child, we are done. childBeforeBreak = maybeBreak.getPrevious(); if (c == childBeforeBreak) { break; } } }
[ "void", "tryMinimizeSwitchCaseExits", "(", "Node", "n", ",", "Token", "exitType", ",", "@", "Nullable", "String", "labelName", ")", "{", "checkState", "(", "NodeUtil", ".", "isSwitchCase", "(", "n", ")", ")", ";", "checkState", "(", "n", "!=", "n", ".", "getParent", "(", ")", ".", "getLastChild", "(", ")", ")", ";", "Node", "block", "=", "n", ".", "getLastChild", "(", ")", ";", "Node", "maybeBreak", "=", "block", ".", "getLastChild", "(", ")", ";", "if", "(", "maybeBreak", "==", "null", "||", "!", "maybeBreak", ".", "isBreak", "(", ")", "||", "maybeBreak", ".", "hasChildren", "(", ")", ")", "{", "// Can not minimize exits from a case without an explicit break from the switch.", "return", ";", "}", "// Now try to minimize the exits of the last child before the break, if it is removed", "// look at what has become the child before the break.", "Node", "childBeforeBreak", "=", "maybeBreak", ".", "getPrevious", "(", ")", ";", "while", "(", "childBeforeBreak", "!=", "null", ")", "{", "Node", "c", "=", "childBeforeBreak", ";", "tryMinimizeExits", "(", "c", ",", "exitType", ",", "labelName", ")", ";", "// If the node is still the last child, we are done.", "childBeforeBreak", "=", "maybeBreak", ".", "getPrevious", "(", ")", ";", "if", "(", "c", "==", "childBeforeBreak", ")", "{", "break", ";", "}", "}", "}" ]
Attempt to remove explicit exits from switch cases that also occur implicitly after the switch.
[ "Attempt", "to", "remove", "explicit", "exits", "from", "switch", "cases", "that", "also", "occur", "implicitly", "after", "the", "switch", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/MinimizeExitPoints.java#L219-L242
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java
CollisionFormulaConfig.createCollision
public static CollisionFormula createCollision(Xml node) { """ Create a collision formula from its node. @param node The collision formula node (must not be <code>null</code>). @return The tile collision formula instance. @throws LionEngineException If error when reading data. """ Check.notNull(node); final String name = node.readString(ATT_NAME); final CollisionRange range = CollisionRangeConfig.imports(node.getChild(CollisionRangeConfig.NODE_RANGE)); final CollisionFunction function = CollisionFunctionConfig.imports(node); final CollisionConstraint constraint = CollisionConstraintConfig.imports(node); return new CollisionFormula(name, range, function, constraint); }
java
public static CollisionFormula createCollision(Xml node) { Check.notNull(node); final String name = node.readString(ATT_NAME); final CollisionRange range = CollisionRangeConfig.imports(node.getChild(CollisionRangeConfig.NODE_RANGE)); final CollisionFunction function = CollisionFunctionConfig.imports(node); final CollisionConstraint constraint = CollisionConstraintConfig.imports(node); return new CollisionFormula(name, range, function, constraint); }
[ "public", "static", "CollisionFormula", "createCollision", "(", "Xml", "node", ")", "{", "Check", ".", "notNull", "(", "node", ")", ";", "final", "String", "name", "=", "node", ".", "readString", "(", "ATT_NAME", ")", ";", "final", "CollisionRange", "range", "=", "CollisionRangeConfig", ".", "imports", "(", "node", ".", "getChild", "(", "CollisionRangeConfig", ".", "NODE_RANGE", ")", ")", ";", "final", "CollisionFunction", "function", "=", "CollisionFunctionConfig", ".", "imports", "(", "node", ")", ";", "final", "CollisionConstraint", "constraint", "=", "CollisionConstraintConfig", ".", "imports", "(", "node", ")", ";", "return", "new", "CollisionFormula", "(", "name", ",", "range", ",", "function", ",", "constraint", ")", ";", "}" ]
Create a collision formula from its node. @param node The collision formula node (must not be <code>null</code>). @return The tile collision formula instance. @throws LionEngineException If error when reading data.
[ "Create", "a", "collision", "formula", "from", "its", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java#L98-L108
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonDriverFunction.java
JsonDriverFunction.exportTable
@Override public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException { """ Save a table or a query to JSON file @param connection @param tableReference @param fileName @param progress @param encoding @throws SQLException @throws IOException """ JsonWriteDriver jsonDriver = new JsonWriteDriver(connection); jsonDriver.write(progress,tableReference, fileName, encoding); }
java
@Override public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException { JsonWriteDriver jsonDriver = new JsonWriteDriver(connection); jsonDriver.write(progress,tableReference, fileName, encoding); }
[ "@", "Override", "public", "void", "exportTable", "(", "Connection", "connection", ",", "String", "tableReference", ",", "File", "fileName", ",", "ProgressVisitor", "progress", ",", "String", "encoding", ")", "throws", "SQLException", ",", "IOException", "{", "JsonWriteDriver", "jsonDriver", "=", "new", "JsonWriteDriver", "(", "connection", ")", ";", "jsonDriver", ".", "write", "(", "progress", ",", "tableReference", ",", "fileName", ",", "encoding", ")", ";", "}" ]
Save a table or a query to JSON file @param connection @param tableReference @param fileName @param progress @param encoding @throws SQLException @throws IOException
[ "Save", "a", "table", "or", "a", "query", "to", "JSON", "file" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonDriverFunction.java#L81-L85
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/style/MasterPageStyle.java
MasterPageStyle.appendXMLToMasterStyle
public void appendXMLToMasterStyle(final XMLUtil util, final Appendable appendable) throws IOException { """ Return the master-style informations for this PageStyle. @param util a util for XML writing @param appendable where to write @throws IOException If an I/O error occurs """ appendable.append("<style:master-page"); util.appendEAttribute(appendable, "style:name", this.name); util.appendEAttribute(appendable, "style:page-layout-name", this.layoutName); appendable.append("><style:header>"); this.header.appendXMLToMasterStyle(util, appendable); appendable.append("</style:header>"); appendable.append("<style:header-left"); util.appendAttribute(appendable, "style:display", false); appendable.append("/>"); appendable.append("<style:footer>"); this.footer.appendXMLToMasterStyle(util, appendable); appendable.append("</style:footer>"); appendable.append("<style:footer-left"); util.appendAttribute(appendable, "style:display", false); appendable.append("/>"); appendable.append("</style:master-page>"); }
java
public void appendXMLToMasterStyle(final XMLUtil util, final Appendable appendable) throws IOException { appendable.append("<style:master-page"); util.appendEAttribute(appendable, "style:name", this.name); util.appendEAttribute(appendable, "style:page-layout-name", this.layoutName); appendable.append("><style:header>"); this.header.appendXMLToMasterStyle(util, appendable); appendable.append("</style:header>"); appendable.append("<style:header-left"); util.appendAttribute(appendable, "style:display", false); appendable.append("/>"); appendable.append("<style:footer>"); this.footer.appendXMLToMasterStyle(util, appendable); appendable.append("</style:footer>"); appendable.append("<style:footer-left"); util.appendAttribute(appendable, "style:display", false); appendable.append("/>"); appendable.append("</style:master-page>"); }
[ "public", "void", "appendXMLToMasterStyle", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ")", "throws", "IOException", "{", "appendable", ".", "append", "(", "\"<style:master-page\"", ")", ";", "util", ".", "appendEAttribute", "(", "appendable", ",", "\"style:name\"", ",", "this", ".", "name", ")", ";", "util", ".", "appendEAttribute", "(", "appendable", ",", "\"style:page-layout-name\"", ",", "this", ".", "layoutName", ")", ";", "appendable", ".", "append", "(", "\"><style:header>\"", ")", ";", "this", ".", "header", ".", "appendXMLToMasterStyle", "(", "util", ",", "appendable", ")", ";", "appendable", ".", "append", "(", "\"</style:header>\"", ")", ";", "appendable", ".", "append", "(", "\"<style:header-left\"", ")", ";", "util", ".", "appendAttribute", "(", "appendable", ",", "\"style:display\"", ",", "false", ")", ";", "appendable", ".", "append", "(", "\"/>\"", ")", ";", "appendable", ".", "append", "(", "\"<style:footer>\"", ")", ";", "this", ".", "footer", ".", "appendXMLToMasterStyle", "(", "util", ",", "appendable", ")", ";", "appendable", ".", "append", "(", "\"</style:footer>\"", ")", ";", "appendable", ".", "append", "(", "\"<style:footer-left\"", ")", ";", "util", ".", "appendAttribute", "(", "appendable", ",", "\"style:display\"", ",", "false", ")", ";", "appendable", ".", "append", "(", "\"/>\"", ")", ";", "appendable", ".", "append", "(", "\"</style:master-page>\"", ")", ";", "}" ]
Return the master-style informations for this PageStyle. @param util a util for XML writing @param appendable where to write @throws IOException If an I/O error occurs
[ "Return", "the", "master", "-", "style", "informations", "for", "this", "PageStyle", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/style/MasterPageStyle.java#L88-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/WsLocationAdminImpl.java
WsLocationAdminImpl.createLocations
public static WsLocationAdminImpl createLocations(final Map<String, Object> initProps) { """ Construct the WsLocationAdminService singleton based on a set of initial properties provided by bootstrap or other initialization code (e.g. an initializer in a test environment). @param initProps @return WsLocationAdmin """ if (instance.get() == null) { SymbolRegistry.getRegistry().clear(); Callable<WsLocationAdminImpl> initializer = new Callable<WsLocationAdminImpl>() { @Override public WsLocationAdminImpl call() throws Exception { return new WsLocationAdminImpl(initProps); } }; instance = StaticValue.mutateStaticValue(instance, initializer); } return instance.get(); }
java
public static WsLocationAdminImpl createLocations(final Map<String, Object> initProps) { if (instance.get() == null) { SymbolRegistry.getRegistry().clear(); Callable<WsLocationAdminImpl> initializer = new Callable<WsLocationAdminImpl>() { @Override public WsLocationAdminImpl call() throws Exception { return new WsLocationAdminImpl(initProps); } }; instance = StaticValue.mutateStaticValue(instance, initializer); } return instance.get(); }
[ "public", "static", "WsLocationAdminImpl", "createLocations", "(", "final", "Map", "<", "String", ",", "Object", ">", "initProps", ")", "{", "if", "(", "instance", ".", "get", "(", ")", "==", "null", ")", "{", "SymbolRegistry", ".", "getRegistry", "(", ")", ".", "clear", "(", ")", ";", "Callable", "<", "WsLocationAdminImpl", ">", "initializer", "=", "new", "Callable", "<", "WsLocationAdminImpl", ">", "(", ")", "{", "@", "Override", "public", "WsLocationAdminImpl", "call", "(", ")", "throws", "Exception", "{", "return", "new", "WsLocationAdminImpl", "(", "initProps", ")", ";", "}", "}", ";", "instance", "=", "StaticValue", ".", "mutateStaticValue", "(", "instance", ",", "initializer", ")", ";", "}", "return", "instance", ".", "get", "(", ")", ";", "}" ]
Construct the WsLocationAdminService singleton based on a set of initial properties provided by bootstrap or other initialization code (e.g. an initializer in a test environment). @param initProps @return WsLocationAdmin
[ "Construct", "the", "WsLocationAdminService", "singleton", "based", "on", "a", "set", "of", "initial", "properties", "provided", "by", "bootstrap", "or", "other", "initialization", "code", "(", "e", ".", "g", ".", "an", "initializer", "in", "a", "test", "environment", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/WsLocationAdminImpl.java#L81-L94
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java
AbstractBundleLinkRenderer.renderGlobalBundleLinks
protected void renderGlobalBundleLinks(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException { """ Renders the links for the global bundles @param ctx the context @param out the writer @param debugOn the debug flag @throws IOException if an IOException occurs. """ if (debugOn) { addComment("Start adding global members.", out); } performGlobalBundleLinksRendering(ctx, out, debugOn); ctx.setGlobalBundleAdded(true); if (debugOn) { addComment("Finished adding global members.", out); } }
java
protected void renderGlobalBundleLinks(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException { if (debugOn) { addComment("Start adding global members.", out); } performGlobalBundleLinksRendering(ctx, out, debugOn); ctx.setGlobalBundleAdded(true); if (debugOn) { addComment("Finished adding global members.", out); } }
[ "protected", "void", "renderGlobalBundleLinks", "(", "BundleRendererContext", "ctx", ",", "Writer", "out", ",", "boolean", "debugOn", ")", "throws", "IOException", "{", "if", "(", "debugOn", ")", "{", "addComment", "(", "\"Start adding global members.\"", ",", "out", ")", ";", "}", "performGlobalBundleLinksRendering", "(", "ctx", ",", "out", ",", "debugOn", ")", ";", "ctx", ".", "setGlobalBundleAdded", "(", "true", ")", ";", "if", "(", "debugOn", ")", "{", "addComment", "(", "\"Finished adding global members.\"", ",", "out", ")", ";", "}", "}" ]
Renders the links for the global bundles @param ctx the context @param out the writer @param debugOn the debug flag @throws IOException if an IOException occurs.
[ "Renders", "the", "links", "for", "the", "global", "bundles" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java#L195-L207
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.pushSpaceHandling
void pushSpaceHandling(Attributes attrs) throws org.xml.sax.SAXParseException { """ Push boolean value on to the spacePreserve stack depending on the value of xml:space=default/preserve. @param attrs list of attributes that were passed to startElement. """ String value = attrs.getValue("xml:space"); if(null == value) { m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse()); } else if(value.equals("preserve")) { m_spacePreserveStack.push(true); } else if(value.equals("default")) { m_spacePreserveStack.push(false); } else { SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.error(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE, null), locator)); //"Illegal value for xml:space", locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXParseException(te.getMessage(), locator, te); } m_spacePreserveStack.push(m_spacePreserveStack.peek()); } }
java
void pushSpaceHandling(Attributes attrs) throws org.xml.sax.SAXParseException { String value = attrs.getValue("xml:space"); if(null == value) { m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse()); } else if(value.equals("preserve")) { m_spacePreserveStack.push(true); } else if(value.equals("default")) { m_spacePreserveStack.push(false); } else { SAXSourceLocator locator = getLocator(); ErrorListener handler = m_stylesheetProcessor.getErrorListener(); try { handler.error(new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE, null), locator)); //"Illegal value for xml:space", locator)); } catch (TransformerException te) { throw new org.xml.sax.SAXParseException(te.getMessage(), locator, te); } m_spacePreserveStack.push(m_spacePreserveStack.peek()); } }
[ "void", "pushSpaceHandling", "(", "Attributes", "attrs", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXParseException", "{", "String", "value", "=", "attrs", ".", "getValue", "(", "\"xml:space\"", ")", ";", "if", "(", "null", "==", "value", ")", "{", "m_spacePreserveStack", ".", "push", "(", "m_spacePreserveStack", ".", "peekOrFalse", "(", ")", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "\"preserve\"", ")", ")", "{", "m_spacePreserveStack", ".", "push", "(", "true", ")", ";", "}", "else", "if", "(", "value", ".", "equals", "(", "\"default\"", ")", ")", "{", "m_spacePreserveStack", ".", "push", "(", "false", ")", ";", "}", "else", "{", "SAXSourceLocator", "locator", "=", "getLocator", "(", ")", ";", "ErrorListener", "handler", "=", "m_stylesheetProcessor", ".", "getErrorListener", "(", ")", ";", "try", "{", "handler", ".", "error", "(", "new", "TransformerException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_ILLEGAL_XMLSPACE_VALUE", ",", "null", ")", ",", "locator", ")", ")", ";", "//\"Illegal value for xml:space\", locator));", "}", "catch", "(", "TransformerException", "te", ")", "{", "throw", "new", "org", ".", "xml", ".", "sax", ".", "SAXParseException", "(", "te", ".", "getMessage", "(", ")", ",", "locator", ",", "te", ")", ";", "}", "m_spacePreserveStack", ".", "push", "(", "m_spacePreserveStack", ".", "peek", "(", ")", ")", ";", "}", "}" ]
Push boolean value on to the spacePreserve stack depending on the value of xml:space=default/preserve. @param attrs list of attributes that were passed to startElement.
[ "Push", "boolean", "value", "on", "to", "the", "spacePreserve", "stack", "depending", "on", "the", "value", "of", "xml", ":", "space", "=", "default", "/", "preserve", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L1646-L1677
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_game_ipOnGame_rule_GET
public ArrayList<Long> ip_game_ipOnGame_rule_GET(String ip, String ipOnGame) throws IOException { """ IDs of rules configured for this IP REST: GET /ip/{ip}/game/{ipOnGame}/rule @param ip [required] @param ipOnGame [required] """ String qPath = "/ip/{ip}/game/{ipOnGame}/rule"; StringBuilder sb = path(qPath, ip, ipOnGame); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<Long> ip_game_ipOnGame_rule_GET(String ip, String ipOnGame) throws IOException { String qPath = "/ip/{ip}/game/{ipOnGame}/rule"; StringBuilder sb = path(qPath, ip, ipOnGame); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "ip_game_ipOnGame_rule_GET", "(", "String", "ip", ",", "String", "ipOnGame", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/game/{ipOnGame}/rule\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ",", "ipOnGame", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
IDs of rules configured for this IP REST: GET /ip/{ip}/game/{ipOnGame}/rule @param ip [required] @param ipOnGame [required]
[ "IDs", "of", "rules", "configured", "for", "this", "IP" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L358-L363
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/ComparatorCompat.java
ComparatorCompat.nullsLast
@NotNull public static <T> ComparatorCompat<T> nullsLast(@Nullable Comparator<? super T> comparator) { """ Returns a comparator that considers {@code null} to be greater than non-null. If the specified comparator is {@code null}, then the returned comparator considers all non-null values to be equal. @param <T> the type of the objects compared by the comparator @param comparator a comparator for comparing non-null values @return a comparator """ return nullsComparator(false, comparator); }
java
@NotNull public static <T> ComparatorCompat<T> nullsLast(@Nullable Comparator<? super T> comparator) { return nullsComparator(false, comparator); }
[ "@", "NotNull", "public", "static", "<", "T", ">", "ComparatorCompat", "<", "T", ">", "nullsLast", "(", "@", "Nullable", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "nullsComparator", "(", "false", ",", "comparator", ")", ";", "}" ]
Returns a comparator that considers {@code null} to be greater than non-null. If the specified comparator is {@code null}, then the returned comparator considers all non-null values to be equal. @param <T> the type of the objects compared by the comparator @param comparator a comparator for comparing non-null values @return a comparator
[ "Returns", "a", "comparator", "that", "considers", "{", "@code", "null", "}", "to", "be", "greater", "than", "non", "-", "null", ".", "If", "the", "specified", "comparator", "is", "{", "@code", "null", "}", "then", "the", "returned", "comparator", "considers", "all", "non", "-", "null", "values", "to", "be", "equal", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/ComparatorCompat.java#L272-L275
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java
AbstractVolatilitySurfaceParametric.getCloneCalibrated
public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFactory) throws SolverException { """ Create a clone of this volatility surface using a generic calibration of its parameters to given market data. @param calibrationModel The model used during calibration (contains additional objects required during valuation, e.g. curves). @param calibrationProducts The calibration products. @param calibrationTargetValues The target values of the calibration products. @param calibrationParameters A map containing additional settings like "evaluationTime" (Double). @param parameterTransformation An optional parameter transformation. @param optimizerFactory The factory providing the optimizer to be used during calibration. @return An object having the same type as this one, using (hopefully) calibrated parameters. @throws SolverException Exception thrown when solver fails. """ if(calibrationParameters == null) { calibrationParameters = new HashMap<>(); } Integer maxIterationsParameter = (Integer)calibrationParameters.get("maxIterations"); Double accuracyParameter = (Double)calibrationParameters.get("accuracy"); Double evaluationTimeParameter = (Double)calibrationParameters.get("evaluationTime"); // @TODO currently ignored, we use the setting form the OptimizerFactory int maxIterations = maxIterationsParameter != null ? maxIterationsParameter.intValue() : 600; double accuracy = accuracyParameter != null ? accuracyParameter.doubleValue() : 1E-8; double evaluationTime = evaluationTimeParameter != null ? evaluationTimeParameter.doubleValue() : 0.0; AnalyticModel model = calibrationModel.addVolatilitySurfaces(this); Solver solver = new Solver(model, calibrationProducts, calibrationTargetValues, parameterTransformation, evaluationTime, optimizerFactory); Set<ParameterObject> objectsToCalibrate = new HashSet<>(); objectsToCalibrate.add(this); AnalyticModel modelCalibrated = solver.getCalibratedModel(objectsToCalibrate); // Diagnostic output if (logger.isLoggable(Level.FINE)) { double lastAccuracy = solver.getAccuracy(); int lastIterations = solver.getIterations(); logger.fine("The solver achieved an accuracy of " + lastAccuracy + " in " + lastIterations + "."); } return (AbstractVolatilitySurfaceParametric)modelCalibrated.getVolatilitySurface(this.getName()); }
java
public AbstractVolatilitySurfaceParametric getCloneCalibrated(final AnalyticModel calibrationModel, final Vector<AnalyticProduct> calibrationProducts, final List<Double> calibrationTargetValues, Map<String,Object> calibrationParameters, final ParameterTransformation parameterTransformation, OptimizerFactory optimizerFactory) throws SolverException { if(calibrationParameters == null) { calibrationParameters = new HashMap<>(); } Integer maxIterationsParameter = (Integer)calibrationParameters.get("maxIterations"); Double accuracyParameter = (Double)calibrationParameters.get("accuracy"); Double evaluationTimeParameter = (Double)calibrationParameters.get("evaluationTime"); // @TODO currently ignored, we use the setting form the OptimizerFactory int maxIterations = maxIterationsParameter != null ? maxIterationsParameter.intValue() : 600; double accuracy = accuracyParameter != null ? accuracyParameter.doubleValue() : 1E-8; double evaluationTime = evaluationTimeParameter != null ? evaluationTimeParameter.doubleValue() : 0.0; AnalyticModel model = calibrationModel.addVolatilitySurfaces(this); Solver solver = new Solver(model, calibrationProducts, calibrationTargetValues, parameterTransformation, evaluationTime, optimizerFactory); Set<ParameterObject> objectsToCalibrate = new HashSet<>(); objectsToCalibrate.add(this); AnalyticModel modelCalibrated = solver.getCalibratedModel(objectsToCalibrate); // Diagnostic output if (logger.isLoggable(Level.FINE)) { double lastAccuracy = solver.getAccuracy(); int lastIterations = solver.getIterations(); logger.fine("The solver achieved an accuracy of " + lastAccuracy + " in " + lastIterations + "."); } return (AbstractVolatilitySurfaceParametric)modelCalibrated.getVolatilitySurface(this.getName()); }
[ "public", "AbstractVolatilitySurfaceParametric", "getCloneCalibrated", "(", "final", "AnalyticModel", "calibrationModel", ",", "final", "Vector", "<", "AnalyticProduct", ">", "calibrationProducts", ",", "final", "List", "<", "Double", ">", "calibrationTargetValues", ",", "Map", "<", "String", ",", "Object", ">", "calibrationParameters", ",", "final", "ParameterTransformation", "parameterTransformation", ",", "OptimizerFactory", "optimizerFactory", ")", "throws", "SolverException", "{", "if", "(", "calibrationParameters", "==", "null", ")", "{", "calibrationParameters", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "Integer", "maxIterationsParameter", "=", "(", "Integer", ")", "calibrationParameters", ".", "get", "(", "\"maxIterations\"", ")", ";", "Double", "accuracyParameter", "=", "(", "Double", ")", "calibrationParameters", ".", "get", "(", "\"accuracy\"", ")", ";", "Double", "evaluationTimeParameter", "=", "(", "Double", ")", "calibrationParameters", ".", "get", "(", "\"evaluationTime\"", ")", ";", "// @TODO currently ignored, we use the setting form the OptimizerFactory", "int", "maxIterations", "=", "maxIterationsParameter", "!=", "null", "?", "maxIterationsParameter", ".", "intValue", "(", ")", ":", "600", ";", "double", "accuracy", "=", "accuracyParameter", "!=", "null", "?", "accuracyParameter", ".", "doubleValue", "(", ")", ":", "1E-8", ";", "double", "evaluationTime", "=", "evaluationTimeParameter", "!=", "null", "?", "evaluationTimeParameter", ".", "doubleValue", "(", ")", ":", "0.0", ";", "AnalyticModel", "model", "=", "calibrationModel", ".", "addVolatilitySurfaces", "(", "this", ")", ";", "Solver", "solver", "=", "new", "Solver", "(", "model", ",", "calibrationProducts", ",", "calibrationTargetValues", ",", "parameterTransformation", ",", "evaluationTime", ",", "optimizerFactory", ")", ";", "Set", "<", "ParameterObject", ">", "objectsToCalibrate", "=", "new", "HashSet", "<>", "(", ")", ";", "objectsToCalibrate", ".", "add", "(", "this", ")", ";", "AnalyticModel", "modelCalibrated", "=", "solver", ".", "getCalibratedModel", "(", "objectsToCalibrate", ")", ";", "// Diagnostic output", "if", "(", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "double", "lastAccuracy", "=", "solver", ".", "getAccuracy", "(", ")", ";", "int", "lastIterations", "=", "solver", ".", "getIterations", "(", ")", ";", "logger", ".", "fine", "(", "\"The solver achieved an accuracy of \"", "+", "lastAccuracy", "+", "\" in \"", "+", "lastIterations", "+", "\".\"", ")", ";", "}", "return", "(", "AbstractVolatilitySurfaceParametric", ")", "modelCalibrated", ".", "getVolatilitySurface", "(", "this", ".", "getName", "(", ")", ")", ";", "}" ]
Create a clone of this volatility surface using a generic calibration of its parameters to given market data. @param calibrationModel The model used during calibration (contains additional objects required during valuation, e.g. curves). @param calibrationProducts The calibration products. @param calibrationTargetValues The target values of the calibration products. @param calibrationParameters A map containing additional settings like "evaluationTime" (Double). @param parameterTransformation An optional parameter transformation. @param optimizerFactory The factory providing the optimizer to be used during calibration. @return An object having the same type as this one, using (hopefully) calibrated parameters. @throws SolverException Exception thrown when solver fails.
[ "Create", "a", "clone", "of", "this", "volatility", "surface", "using", "a", "generic", "calibration", "of", "its", "parameters", "to", "given", "market", "data", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/volatilities/AbstractVolatilitySurfaceParametric.java#L81-L110
pressgang-ccms/PressGangCCMSDatasourceProviders
rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTPropertyTagProvider.java
RESTPropertyTagProvider.getRESTPropertyTagRevisions
public RESTPropertyTagCollectionV1 getRESTPropertyTagRevisions(int id, Integer revision) { """ /*@Override public UpdateableCollectionWrapper<PropertyCategoryWrapper> getPropertyTagCategories(int id, final Integer revision) { try { RESTPropertyTagV1 propertyTag = null; Check the cache first if (getRESTEntityCache().containsKeyValue(RESTPropertyTagV1.class, id, revision)) { propertyTag = getRESTEntityCache().get(RESTPropertyTagV1.class, id, revision); if (propertyTag.getPropertyCategories() != null) { return (UpdateableCollectionWrapper<PropertyCategoryWrapper>) getWrapperFactory().createPropertyTagCollection( propertyTag.getPropertyCategories(), revision != null); } } We need to expand the all the property tag categories in the property tag final String expandString = getExpansionString(RESTPropertyTagV1.PROPERTY_CATEGORIES_NAME); Load the property tag from the REST Interface final RESTPropertyTagV1 tempPropertyTag = loadPropertyTag(id, revision, expandString); if (propertyTag == null) { propertyTag = tempPropertyTag; getRESTEntityCache().add(propertyTag, revision); } else { propertyTag.setPropertyCategories(tempPropertyTag.getPropertyCategories()); } return (UpdateableCollectionWrapper<PropertyCategoryWrapper>) getWrapperFactory().createPropertyTagCollection( propertyTag.getPropertyCategories(), revision != null); } catch (Exception e) { log.debug("Failed to retrieve the Property Categories for Property Tag " + id + (revision == null ? "" : (", Revision " + revision)), e); throw handleException(e); } } """ try { RESTPropertyTagV1 propertyTag = null; if (getRESTEntityCache().containsKeyValue(RESTPropertyTagV1.class, id, revision)) { propertyTag = getRESTEntityCache().get(RESTPropertyTagV1.class, id, revision); if (propertyTag.getRevisions() != null) { return propertyTag.getRevisions(); } } // We need to expand the all the revisions in the property tag final String expandString = getExpansionString(RESTPropertyTagV1.REVISIONS_NAME); // Load the property tag from the REST Interface final RESTPropertyTagV1 tempPropertyTag = loadPropertyTag(id, revision, expandString); if (propertyTag == null) { propertyTag = tempPropertyTag; getRESTEntityCache().add(propertyTag, revision); } else { propertyTag.setRevisions(tempPropertyTag.getRevisions()); } return propertyTag.getRevisions(); } catch (Exception e) { log.debug("Failed to retrieve Revisions for Property Tag " + id + (revision == null ? "" : (", Revision " + revision)), e); throw handleException(e); } }
java
public RESTPropertyTagCollectionV1 getRESTPropertyTagRevisions(int id, Integer revision) { try { RESTPropertyTagV1 propertyTag = null; if (getRESTEntityCache().containsKeyValue(RESTPropertyTagV1.class, id, revision)) { propertyTag = getRESTEntityCache().get(RESTPropertyTagV1.class, id, revision); if (propertyTag.getRevisions() != null) { return propertyTag.getRevisions(); } } // We need to expand the all the revisions in the property tag final String expandString = getExpansionString(RESTPropertyTagV1.REVISIONS_NAME); // Load the property tag from the REST Interface final RESTPropertyTagV1 tempPropertyTag = loadPropertyTag(id, revision, expandString); if (propertyTag == null) { propertyTag = tempPropertyTag; getRESTEntityCache().add(propertyTag, revision); } else { propertyTag.setRevisions(tempPropertyTag.getRevisions()); } return propertyTag.getRevisions(); } catch (Exception e) { log.debug("Failed to retrieve Revisions for Property Tag " + id + (revision == null ? "" : (", Revision " + revision)), e); throw handleException(e); } }
[ "public", "RESTPropertyTagCollectionV1", "getRESTPropertyTagRevisions", "(", "int", "id", ",", "Integer", "revision", ")", "{", "try", "{", "RESTPropertyTagV1", "propertyTag", "=", "null", ";", "if", "(", "getRESTEntityCache", "(", ")", ".", "containsKeyValue", "(", "RESTPropertyTagV1", ".", "class", ",", "id", ",", "revision", ")", ")", "{", "propertyTag", "=", "getRESTEntityCache", "(", ")", ".", "get", "(", "RESTPropertyTagV1", ".", "class", ",", "id", ",", "revision", ")", ";", "if", "(", "propertyTag", ".", "getRevisions", "(", ")", "!=", "null", ")", "{", "return", "propertyTag", ".", "getRevisions", "(", ")", ";", "}", "}", "// We need to expand the all the revisions in the property tag", "final", "String", "expandString", "=", "getExpansionString", "(", "RESTPropertyTagV1", ".", "REVISIONS_NAME", ")", ";", "// Load the property tag from the REST Interface", "final", "RESTPropertyTagV1", "tempPropertyTag", "=", "loadPropertyTag", "(", "id", ",", "revision", ",", "expandString", ")", ";", "if", "(", "propertyTag", "==", "null", ")", "{", "propertyTag", "=", "tempPropertyTag", ";", "getRESTEntityCache", "(", ")", ".", "add", "(", "propertyTag", ",", "revision", ")", ";", "}", "else", "{", "propertyTag", ".", "setRevisions", "(", "tempPropertyTag", ".", "getRevisions", "(", ")", ")", ";", "}", "return", "propertyTag", ".", "getRevisions", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "debug", "(", "\"Failed to retrieve Revisions for Property Tag \"", "+", "id", "+", "(", "revision", "==", "null", "?", "\"\"", ":", "(", "\", Revision \"", "+", "revision", ")", ")", ",", "e", ")", ";", "throw", "handleException", "(", "e", ")", ";", "}", "}" ]
/*@Override public UpdateableCollectionWrapper<PropertyCategoryWrapper> getPropertyTagCategories(int id, final Integer revision) { try { RESTPropertyTagV1 propertyTag = null; Check the cache first if (getRESTEntityCache().containsKeyValue(RESTPropertyTagV1.class, id, revision)) { propertyTag = getRESTEntityCache().get(RESTPropertyTagV1.class, id, revision); if (propertyTag.getPropertyCategories() != null) { return (UpdateableCollectionWrapper<PropertyCategoryWrapper>) getWrapperFactory().createPropertyTagCollection( propertyTag.getPropertyCategories(), revision != null); } } We need to expand the all the property tag categories in the property tag final String expandString = getExpansionString(RESTPropertyTagV1.PROPERTY_CATEGORIES_NAME); Load the property tag from the REST Interface final RESTPropertyTagV1 tempPropertyTag = loadPropertyTag(id, revision, expandString); if (propertyTag == null) { propertyTag = tempPropertyTag; getRESTEntityCache().add(propertyTag, revision); } else { propertyTag.setPropertyCategories(tempPropertyTag.getPropertyCategories()); } return (UpdateableCollectionWrapper<PropertyCategoryWrapper>) getWrapperFactory().createPropertyTagCollection( propertyTag.getPropertyCategories(), revision != null); } catch (Exception e) { log.debug("Failed to retrieve the Property Categories for Property Tag " + id + (revision == null ? "" : (", Revision " + revision)), e); throw handleException(e); } }
[ "/", "*", "@Override", "public", "UpdateableCollectionWrapper<PropertyCategoryWrapper", ">", "getPropertyTagCategories", "(", "int", "id", "final", "Integer", "revision", ")", "{", "try", "{", "RESTPropertyTagV1", "propertyTag", "=", "null", ";", "Check", "the", "cache", "first", "if", "(", "getRESTEntityCache", "()", ".", "containsKeyValue", "(", "RESTPropertyTagV1", ".", "class", "id", "revision", "))", "{", "propertyTag", "=", "getRESTEntityCache", "()", ".", "get", "(", "RESTPropertyTagV1", ".", "class", "id", "revision", ")", ";" ]
train
https://github.com/pressgang-ccms/PressGangCCMSDatasourceProviders/blob/e47588adad0dcd55608b197b37825a512bc8fd25/rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTPropertyTagProvider.java#L135-L164
konmik/solid
collections/src/main/java/solid/collectors/ToSolidMap.java
ToSolidMap.toSolidMap
public static <T, K> Func1<Iterable<T>, SolidMap<K, T>> toSolidMap(final Func1<T, K> keyExtractor) { """ Returns a function that converts a stream into {@link SolidMap} using a given key extractor method. """ return toSolidMap(keyExtractor, new Func1<T, T>() { @Override public T call(T value) { return value; } }); }
java
public static <T, K> Func1<Iterable<T>, SolidMap<K, T>> toSolidMap(final Func1<T, K> keyExtractor) { return toSolidMap(keyExtractor, new Func1<T, T>() { @Override public T call(T value) { return value; } }); }
[ "public", "static", "<", "T", ",", "K", ">", "Func1", "<", "Iterable", "<", "T", ">", ",", "SolidMap", "<", "K", ",", "T", ">", ">", "toSolidMap", "(", "final", "Func1", "<", "T", ",", "K", ">", "keyExtractor", ")", "{", "return", "toSolidMap", "(", "keyExtractor", ",", "new", "Func1", "<", "T", ",", "T", ">", "(", ")", "{", "@", "Override", "public", "T", "call", "(", "T", "value", ")", "{", "return", "value", ";", "}", "}", ")", ";", "}" ]
Returns a function that converts a stream into {@link SolidMap} using a given key extractor method.
[ "Returns", "a", "function", "that", "converts", "a", "stream", "into", "{" ]
train
https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/collections/src/main/java/solid/collectors/ToSolidMap.java#L34-L41
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java
ExperimentsInner.getAsync
public Observable<ExperimentInner> getAsync(String resourceGroupName, String workspaceName, String experimentName) { """ Gets information about an Experiment. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExperimentInner object """ return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() { @Override public ExperimentInner call(ServiceResponse<ExperimentInner> response) { return response.body(); } }); }
java
public Observable<ExperimentInner> getAsync(String resourceGroupName, String workspaceName, String experimentName) { return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() { @Override public ExperimentInner call(ServiceResponse<ExperimentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExperimentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "workspaceName", ",", "String", "experimentName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "workspaceName", ",", "experimentName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ExperimentInner", ">", ",", "ExperimentInner", ">", "(", ")", "{", "@", "Override", "public", "ExperimentInner", "call", "(", "ServiceResponse", "<", "ExperimentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about an Experiment. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExperimentInner object
[ "Gets", "information", "about", "an", "Experiment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java#L722-L729
icode/ameba-utils
src/main/java/ameba/util/IOUtils.java
IOUtils.getJarManifestValue
public static String getJarManifestValue(Class clazz, String attrName) { """ <p>getJarManifestValue.</p> @param clazz a {@link java.lang.Class} object. @param attrName a {@link java.lang.String} object. @return a {@link java.lang.String} object. """ URL url = getResource("/" + clazz.getName().replace('.', '/') + ".class"); if (url != null) try { URLConnection uc = url.openConnection(); if (uc instanceof java.net.JarURLConnection) { JarURLConnection juc = (JarURLConnection) uc; Manifest m = juc.getManifest(); return m.getMainAttributes().getValue(attrName); } } catch (IOException e) { return null; } return null; }
java
public static String getJarManifestValue(Class clazz, String attrName) { URL url = getResource("/" + clazz.getName().replace('.', '/') + ".class"); if (url != null) try { URLConnection uc = url.openConnection(); if (uc instanceof java.net.JarURLConnection) { JarURLConnection juc = (JarURLConnection) uc; Manifest m = juc.getManifest(); return m.getMainAttributes().getValue(attrName); } } catch (IOException e) { return null; } return null; }
[ "public", "static", "String", "getJarManifestValue", "(", "Class", "clazz", ",", "String", "attrName", ")", "{", "URL", "url", "=", "getResource", "(", "\"/\"", "+", "clazz", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ")", ";", "if", "(", "url", "!=", "null", ")", "try", "{", "URLConnection", "uc", "=", "url", ".", "openConnection", "(", ")", ";", "if", "(", "uc", "instanceof", "java", ".", "net", ".", "JarURLConnection", ")", "{", "JarURLConnection", "juc", "=", "(", "JarURLConnection", ")", "uc", ";", "Manifest", "m", "=", "juc", ".", "getManifest", "(", ")", ";", "return", "m", ".", "getMainAttributes", "(", ")", ".", "getValue", "(", "attrName", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "return", "null", ";", "}", "return", "null", ";", "}" ]
<p>getJarManifestValue.</p> @param clazz a {@link java.lang.Class} object. @param attrName a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "getJarManifestValue", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/IOUtils.java#L325-L340
apache/incubator-zipkin
zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/JsonReaders.java
JsonReaders.enterPath
@Nullable public static JsonReader enterPath(JsonReader reader, String path1, String path2) throws IOException { """ This saves you from having to define nested types to read a single value <p>Instead of defining two types like this, and double-checking null.. <pre>{@code class Response { Message message; } class Message { String status; } JsonAdapter<Response> adapter = moshi.adapter(Response.class); Message message = adapter.fromJson(body.source()); if (message != null && message.status != null) throw new IllegalStateException(message.status); }</pre> <p>You can advance to the field directly. <pre>{@code JsonReader status = enterPath(JsonReader.of(body.source()), "message", "status"); if (status != null) throw new IllegalStateException(status.nextString()); }</pre> """ return enterPath(reader, path1) != null ? enterPath(reader, path2) : null; }
java
@Nullable public static JsonReader enterPath(JsonReader reader, String path1, String path2) throws IOException { return enterPath(reader, path1) != null ? enterPath(reader, path2) : null; }
[ "@", "Nullable", "public", "static", "JsonReader", "enterPath", "(", "JsonReader", "reader", ",", "String", "path1", ",", "String", "path2", ")", "throws", "IOException", "{", "return", "enterPath", "(", "reader", ",", "path1", ")", "!=", "null", "?", "enterPath", "(", "reader", ",", "path2", ")", ":", "null", ";", "}" ]
This saves you from having to define nested types to read a single value <p>Instead of defining two types like this, and double-checking null.. <pre>{@code class Response { Message message; } class Message { String status; } JsonAdapter<Response> adapter = moshi.adapter(Response.class); Message message = adapter.fromJson(body.source()); if (message != null && message.status != null) throw new IllegalStateException(message.status); }</pre> <p>You can advance to the field directly. <pre>{@code JsonReader status = enterPath(JsonReader.of(body.source()), "message", "status"); if (status != null) throw new IllegalStateException(status.nextString()); }</pre>
[ "This", "saves", "you", "from", "having", "to", "define", "nested", "types", "to", "read", "a", "single", "value" ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/JsonReaders.java#L54-L58
Stratio/bdt
src/main/java/com/stratio/qa/specs/KafkaSpec.java
KafkaSpec.sendAMessage
@When("^I send a message '(.+?)' to the kafka topic named '(.+?)'") public void sendAMessage(String message, String topic_name) throws Exception { """ Sending a message in a Kafka topic. @param topic_name topic name @param message string that you send to topic """ commonspec.getKafkaUtils().sendMessage(message, topic_name); }
java
@When("^I send a message '(.+?)' to the kafka topic named '(.+?)'") public void sendAMessage(String message, String topic_name) throws Exception { commonspec.getKafkaUtils().sendMessage(message, topic_name); }
[ "@", "When", "(", "\"^I send a message '(.+?)' to the kafka topic named '(.+?)'\"", ")", "public", "void", "sendAMessage", "(", "String", "message", ",", "String", "topic_name", ")", "throws", "Exception", "{", "commonspec", ".", "getKafkaUtils", "(", ")", ".", "sendMessage", "(", "message", ",", "topic_name", ")", ";", "}" ]
Sending a message in a Kafka topic. @param topic_name topic name @param message string that you send to topic
[ "Sending", "a", "message", "in", "a", "Kafka", "topic", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/KafkaSpec.java#L108-L111
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_webstorage_serviceName_traffic_GET
public OvhOrder cdn_webstorage_serviceName_traffic_GET(String serviceName, OvhOrderTrafficEnum bandwidth) throws IOException { """ Get prices and contracts information REST: GET /order/cdn/webstorage/{serviceName}/traffic @param bandwidth [required] Traffic in TB that will be added to the cdn.webstorage service @param serviceName [required] The internal name of your CDN Static offer """ String qPath = "/order/cdn/webstorage/{serviceName}/traffic"; StringBuilder sb = path(qPath, serviceName); query(sb, "bandwidth", bandwidth); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cdn_webstorage_serviceName_traffic_GET(String serviceName, OvhOrderTrafficEnum bandwidth) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/traffic"; StringBuilder sb = path(qPath, serviceName); query(sb, "bandwidth", bandwidth); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cdn_webstorage_serviceName_traffic_GET", "(", "String", "serviceName", ",", "OvhOrderTrafficEnum", "bandwidth", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/webstorage/{serviceName}/traffic\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"bandwidth\"", ",", "bandwidth", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/cdn/webstorage/{serviceName}/traffic @param bandwidth [required] Traffic in TB that will be added to the cdn.webstorage service @param serviceName [required] The internal name of your CDN Static offer
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5435-L5441
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java
SecurityFileMonitor.isActionNeeded
private Boolean isActionNeeded(Collection<File> createdFiles, Collection<File> modifiedFiles) { """ Action is needed if a file is modified or if it is recreated after it was deleted. @param modifiedFiles """ boolean actionNeeded = false; for (File createdFile : createdFiles) { if (currentlyDeletedFiles.contains(createdFile)) { currentlyDeletedFiles.remove(createdFile); actionNeeded = true; } } if (modifiedFiles.isEmpty() == false) { actionNeeded = true; } return actionNeeded; }
java
private Boolean isActionNeeded(Collection<File> createdFiles, Collection<File> modifiedFiles) { boolean actionNeeded = false; for (File createdFile : createdFiles) { if (currentlyDeletedFiles.contains(createdFile)) { currentlyDeletedFiles.remove(createdFile); actionNeeded = true; } } if (modifiedFiles.isEmpty() == false) { actionNeeded = true; } return actionNeeded; }
[ "private", "Boolean", "isActionNeeded", "(", "Collection", "<", "File", ">", "createdFiles", ",", "Collection", "<", "File", ">", "modifiedFiles", ")", "{", "boolean", "actionNeeded", "=", "false", ";", "for", "(", "File", "createdFile", ":", "createdFiles", ")", "{", "if", "(", "currentlyDeletedFiles", ".", "contains", "(", "createdFile", ")", ")", "{", "currentlyDeletedFiles", ".", "remove", "(", "createdFile", ")", ";", "actionNeeded", "=", "true", ";", "}", "}", "if", "(", "modifiedFiles", ".", "isEmpty", "(", ")", "==", "false", ")", "{", "actionNeeded", "=", "true", ";", "}", "return", "actionNeeded", ";", "}" ]
Action is needed if a file is modified or if it is recreated after it was deleted. @param modifiedFiles
[ "Action", "is", "needed", "if", "a", "file", "is", "modified", "or", "if", "it", "is", "recreated", "after", "it", "was", "deleted", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/filemonitor/SecurityFileMonitor.java#L121-L135
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/TextEnterer.java
TextEnterer.typeText
public void typeText(final EditText editText, final String text) { """ Types text in an {@code EditText} @param index the index of the {@code EditText} @param text the text that should be typed """ if(editText != null){ inst.runOnMainSync(new Runnable() { public void run() { editText.setInputType(InputType.TYPE_NULL); } }); clicker.clickOnScreen(editText, false, 0); dialogUtils.hideSoftKeyboard(editText, true, true); boolean successfull = false; int retry = 0; while(!successfull && retry < 10) { try{ inst.sendStringSync(text); successfull = true; }catch(SecurityException e){ dialogUtils.hideSoftKeyboard(editText, true, true); retry++; } } if(!successfull) { Assert.fail("Text can not be typed!"); } } }
java
public void typeText(final EditText editText, final String text){ if(editText != null){ inst.runOnMainSync(new Runnable() { public void run() { editText.setInputType(InputType.TYPE_NULL); } }); clicker.clickOnScreen(editText, false, 0); dialogUtils.hideSoftKeyboard(editText, true, true); boolean successfull = false; int retry = 0; while(!successfull && retry < 10) { try{ inst.sendStringSync(text); successfull = true; }catch(SecurityException e){ dialogUtils.hideSoftKeyboard(editText, true, true); retry++; } } if(!successfull) { Assert.fail("Text can not be typed!"); } } }
[ "public", "void", "typeText", "(", "final", "EditText", "editText", ",", "final", "String", "text", ")", "{", "if", "(", "editText", "!=", "null", ")", "{", "inst", ".", "runOnMainSync", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "editText", ".", "setInputType", "(", "InputType", ".", "TYPE_NULL", ")", ";", "}", "}", ")", ";", "clicker", ".", "clickOnScreen", "(", "editText", ",", "false", ",", "0", ")", ";", "dialogUtils", ".", "hideSoftKeyboard", "(", "editText", ",", "true", ",", "true", ")", ";", "boolean", "successfull", "=", "false", ";", "int", "retry", "=", "0", ";", "while", "(", "!", "successfull", "&&", "retry", "<", "10", ")", "{", "try", "{", "inst", ".", "sendStringSync", "(", "text", ")", ";", "successfull", "=", "true", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "dialogUtils", ".", "hideSoftKeyboard", "(", "editText", ",", "true", ",", "true", ")", ";", "retry", "++", ";", "}", "}", "if", "(", "!", "successfull", ")", "{", "Assert", ".", "fail", "(", "\"Text can not be typed!\"", ")", ";", "}", "}", "}" ]
Types text in an {@code EditText} @param index the index of the {@code EditText} @param text the text that should be typed
[ "Types", "text", "in", "an", "{", "@code", "EditText", "}" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/TextEnterer.java#L73-L102
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java
ProcessUtils.processObject
public static <T, R> void processObject(R r, T src) { """ 拷贝单个对象 @param r 目标对象 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型 """ processObject(r, src, (r1, src1) -> { }); }
java
public static <T, R> void processObject(R r, T src) { processObject(r, src, (r1, src1) -> { }); }
[ "public", "static", "<", "T", ",", "R", ">", "void", "processObject", "(", "R", "r", ",", "T", "src", ")", "{", "processObject", "(", "r", ",", "src", ",", "(", "r1", ",", "src1", ")", "->", "{", "}", ")", ";", "}" ]
拷贝单个对象 @param r 目标对象 @param src 原对象 @param <T> 原数据类型 @param <R> 目标数据类型
[ "拷贝单个对象" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/beans/ProcessUtils.java#L115-L118
ziccardi/jnrpe
jcheck_nrpe/src/main/java/it/jnrpe/client/JNRPEClient.java
JNRPEClient.sendCommand
public final ReturnValue sendCommand(final String sCommandName, final String... arguments) throws JNRPEClientException { """ Inovoke a command installed in JNRPE. @param sCommandName The name of the command to be invoked @param arguments The arguments to pass to the command (will substitute the $ARGSx$ parameters) @return The value returned by the server @throws JNRPEClientException Thrown on any communication error. """ return sendRequest(new JNRPERequest(sCommandName, arguments)); }
java
public final ReturnValue sendCommand(final String sCommandName, final String... arguments) throws JNRPEClientException { return sendRequest(new JNRPERequest(sCommandName, arguments)); }
[ "public", "final", "ReturnValue", "sendCommand", "(", "final", "String", "sCommandName", ",", "final", "String", "...", "arguments", ")", "throws", "JNRPEClientException", "{", "return", "sendRequest", "(", "new", "JNRPERequest", "(", "sCommandName", ",", "arguments", ")", ")", ";", "}" ]
Inovoke a command installed in JNRPE. @param sCommandName The name of the command to be invoked @param arguments The arguments to pass to the command (will substitute the $ARGSx$ parameters) @return The value returned by the server @throws JNRPEClientException Thrown on any communication error.
[ "Inovoke", "a", "command", "installed", "in", "JNRPE", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jcheck_nrpe/src/main/java/it/jnrpe/client/JNRPEClient.java#L226-L228
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java
ServiceBuilder.withDataLogFactory
public ServiceBuilder withDataLogFactory(Function<ComponentSetup, DurableDataLogFactory> dataLogFactoryCreator) { """ Attaches the given DurableDataLogFactory creator to this ServiceBuilder. The given Function will only not be invoked right away; it will be called when needed. @param dataLogFactoryCreator The Function to attach. @return This ServiceBuilder. """ Preconditions.checkNotNull(dataLogFactoryCreator, "dataLogFactoryCreator"); this.dataLogFactoryCreator = dataLogFactoryCreator; return this; }
java
public ServiceBuilder withDataLogFactory(Function<ComponentSetup, DurableDataLogFactory> dataLogFactoryCreator) { Preconditions.checkNotNull(dataLogFactoryCreator, "dataLogFactoryCreator"); this.dataLogFactoryCreator = dataLogFactoryCreator; return this; }
[ "public", "ServiceBuilder", "withDataLogFactory", "(", "Function", "<", "ComponentSetup", ",", "DurableDataLogFactory", ">", "dataLogFactoryCreator", ")", "{", "Preconditions", ".", "checkNotNull", "(", "dataLogFactoryCreator", ",", "\"dataLogFactoryCreator\"", ")", ";", "this", ".", "dataLogFactoryCreator", "=", "dataLogFactoryCreator", ";", "return", "this", ";", "}" ]
Attaches the given DurableDataLogFactory creator to this ServiceBuilder. The given Function will only not be invoked right away; it will be called when needed. @param dataLogFactoryCreator The Function to attach. @return This ServiceBuilder.
[ "Attaches", "the", "given", "DurableDataLogFactory", "creator", "to", "this", "ServiceBuilder", ".", "The", "given", "Function", "will", "only", "not", "be", "invoked", "right", "away", ";", "it", "will", "be", "called", "when", "needed", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L170-L174
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayScript
public static String getDisplayScript(String localeID, String displayLocaleID) { """ <strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. This is a cover for the ICU4C API. @param localeID the id of the locale whose script will be displayed @param displayLocaleID the id of the locale in which to display the name. @return the localized script name. """ return getDisplayScriptInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
java
public static String getDisplayScript(String localeID, String displayLocaleID) { return getDisplayScriptInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
[ "public", "static", "String", "getDisplayScript", "(", "String", "localeID", ",", "String", "displayLocaleID", ")", "{", "return", "getDisplayScriptInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "new", "ULocale", "(", "displayLocaleID", ")", ")", ";", "}" ]
<strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. This is a cover for the ICU4C API. @param localeID the id of the locale whose script will be displayed @param displayLocaleID the id of the locale in which to display the name. @return the localized script name.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "script", "localized", "for", "display", "in", "the", "provided", "locale", ".", "This", "is", "a", "cover", "for", "the", "ICU4C", "API", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1510-L1512
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java
StringQuery.getBindingFor
public ParameterBinding getBindingFor(int position) { """ Returns the {@link ParameterBinding} for the given position. @param position @return """ for (ParameterBinding binding : bindings) { if (binding.hasPosition(position)) { return binding; } } throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position)); }
java
public ParameterBinding getBindingFor(int position) { for (ParameterBinding binding : bindings) { if (binding.hasPosition(position)) { return binding; } } throw new IllegalArgumentException(String.format("No parameter binding found for position %s!", position)); }
[ "public", "ParameterBinding", "getBindingFor", "(", "int", "position", ")", "{", "for", "(", "ParameterBinding", "binding", ":", "bindings", ")", "{", "if", "(", "binding", ".", "hasPosition", "(", "position", ")", ")", "{", "return", "binding", ";", "}", "}", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"No parameter binding found for position %s!\"", ",", "position", ")", ")", ";", "}" ]
Returns the {@link ParameterBinding} for the given position. @param position @return
[ "Returns", "the", "{", "@link", "ParameterBinding", "}", "for", "the", "given", "position", "." ]
train
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/query/StringQuery.java#L114-L123
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.Canberra
public static double Canberra(IntPoint p, IntPoint q) { """ Gets the Canberra distance between two points. @param p IntPoint with X and Y axis coordinates. @param q IntPoint with X and Y axis coordinates. @return The Canberra distance between x and y. """ return Canberra(p.x, p.y, q.x, q.y); }
java
public static double Canberra(IntPoint p, IntPoint q) { return Canberra(p.x, p.y, q.x, q.y); }
[ "public", "static", "double", "Canberra", "(", "IntPoint", "p", ",", "IntPoint", "q", ")", "{", "return", "Canberra", "(", "p", ".", "x", ",", "p", ".", "y", ",", "q", ".", "x", ",", "q", ".", "y", ")", ";", "}" ]
Gets the Canberra distance between two points. @param p IntPoint with X and Y axis coordinates. @param q IntPoint with X and Y axis coordinates. @return The Canberra distance between x and y.
[ "Gets", "the", "Canberra", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L167-L169
openengsb/openengsb
components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java
EDBModelObject.getCorrespondingModel
public OpenEngSBModel getCorrespondingModel() throws EKBException { """ Returns the corresponding model object for the EDBModelObject """ ModelDescription description = getModelDescription(); try { Class<?> modelClass = modelRegistry.loadModel(description); return (OpenEngSBModel) edbConverter.convertEDBObjectToModel(modelClass, object); } catch (ClassNotFoundException e) { throw new EKBException(String.format("Unable to load model of type %s", description), e); } }
java
public OpenEngSBModel getCorrespondingModel() throws EKBException { ModelDescription description = getModelDescription(); try { Class<?> modelClass = modelRegistry.loadModel(description); return (OpenEngSBModel) edbConverter.convertEDBObjectToModel(modelClass, object); } catch (ClassNotFoundException e) { throw new EKBException(String.format("Unable to load model of type %s", description), e); } }
[ "public", "OpenEngSBModel", "getCorrespondingModel", "(", ")", "throws", "EKBException", "{", "ModelDescription", "description", "=", "getModelDescription", "(", ")", ";", "try", "{", "Class", "<", "?", ">", "modelClass", "=", "modelRegistry", ".", "loadModel", "(", "description", ")", ";", "return", "(", "OpenEngSBModel", ")", "edbConverter", ".", "convertEDBObjectToModel", "(", "modelClass", ",", "object", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "EKBException", "(", "String", ".", "format", "(", "\"Unable to load model of type %s\"", ",", "description", ")", ",", "e", ")", ";", "}", "}" ]
Returns the corresponding model object for the EDBModelObject
[ "Returns", "the", "corresponding", "model", "object", "for", "the", "EDBModelObject" ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java#L55-L63
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.executeUpdate
public int executeUpdate(Map params, String sql) throws SQLException { """ A variant of {@link #executeUpdate(String, java.util.List)} useful when providing the named parameters as named arguments. @param params a map containing the named parameters @param sql the SQL statement @return the number of rows updated or 0 for SQL statements that return nothing @throws SQLException if a database access error occurs @since 1.8.7 """ return executeUpdate(sql, singletonList(params)); }
java
public int executeUpdate(Map params, String sql) throws SQLException { return executeUpdate(sql, singletonList(params)); }
[ "public", "int", "executeUpdate", "(", "Map", "params", ",", "String", "sql", ")", "throws", "SQLException", "{", "return", "executeUpdate", "(", "sql", ",", "singletonList", "(", "params", ")", ")", ";", "}" ]
A variant of {@link #executeUpdate(String, java.util.List)} useful when providing the named parameters as named arguments. @param params a map containing the named parameters @param sql the SQL statement @return the number of rows updated or 0 for SQL statements that return nothing @throws SQLException if a database access error occurs @since 1.8.7
[ "A", "variant", "of", "{", "@link", "#executeUpdate", "(", "String", "java", ".", "util", ".", "List", ")", "}", "useful", "when", "providing", "the", "named", "parameters", "as", "named", "arguments", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2944-L2946
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ResourceUtils.java
ResourceUtils.getReader
public static Reader getReader(final URL url, String encoding) throws IOException { """ Returns a Reader for reading the specified url. @param url the url @param encoding the encoding @return the reader instance @throws IOException if an error occurred when reading resources using any I/O operations """ InputStream stream; try { stream = AccessController.doPrivileged( new PrivilegedExceptionAction<InputStream>() { @Override public InputStream run() throws IOException { InputStream is = null; if (url != null) { URLConnection connection = url.openConnection(); if (connection != null) { // Disable caches to get fresh data for reloading. connection.setUseCaches(false); is = connection.getInputStream(); } } return is; } } ); } catch (PrivilegedActionException e) { throw (IOException)e.getException(); } Reader reader; if (encoding != null) { reader = new InputStreamReader(stream, encoding); } else { reader = new InputStreamReader(stream); } return reader; }
java
public static Reader getReader(final URL url, String encoding) throws IOException { InputStream stream; try { stream = AccessController.doPrivileged( new PrivilegedExceptionAction<InputStream>() { @Override public InputStream run() throws IOException { InputStream is = null; if (url != null) { URLConnection connection = url.openConnection(); if (connection != null) { // Disable caches to get fresh data for reloading. connection.setUseCaches(false); is = connection.getInputStream(); } } return is; } } ); } catch (PrivilegedActionException e) { throw (IOException)e.getException(); } Reader reader; if (encoding != null) { reader = new InputStreamReader(stream, encoding); } else { reader = new InputStreamReader(stream); } return reader; }
[ "public", "static", "Reader", "getReader", "(", "final", "URL", "url", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStream", "stream", ";", "try", "{", "stream", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "InputStream", ">", "(", ")", "{", "@", "Override", "public", "InputStream", "run", "(", ")", "throws", "IOException", "{", "InputStream", "is", "=", "null", ";", "if", "(", "url", "!=", "null", ")", "{", "URLConnection", "connection", "=", "url", ".", "openConnection", "(", ")", ";", "if", "(", "connection", "!=", "null", ")", "{", "// Disable caches to get fresh data for reloading.", "connection", ".", "setUseCaches", "(", "false", ")", ";", "is", "=", "connection", ".", "getInputStream", "(", ")", ";", "}", "}", "return", "is", ";", "}", "}", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "(", "IOException", ")", "e", ".", "getException", "(", ")", ";", "}", "Reader", "reader", ";", "if", "(", "encoding", "!=", "null", ")", "{", "reader", "=", "new", "InputStreamReader", "(", "stream", ",", "encoding", ")", ";", "}", "else", "{", "reader", "=", "new", "InputStreamReader", "(", "stream", ")", ";", "}", "return", "reader", ";", "}" ]
Returns a Reader for reading the specified url. @param url the url @param encoding the encoding @return the reader instance @throws IOException if an error occurred when reading resources using any I/O operations
[ "Returns", "a", "Reader", "for", "reading", "the", "specified", "url", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L326-L357
stickfigure/batchfb
src/main/java/com/googlecode/batchfb/FacebookBatcher.java
FacebookBatcher.getAppAccessToken
public static String getAppAccessToken(String clientId, String clientSecret) { """ Get the app access token from Facebook. see https://developers.facebook.com/docs/authentication/ """ return getAccessToken(clientId, clientSecret, null, null); }
java
public static String getAppAccessToken(String clientId, String clientSecret) { return getAccessToken(clientId, clientSecret, null, null); }
[ "public", "static", "String", "getAppAccessToken", "(", "String", "clientId", ",", "String", "clientSecret", ")", "{", "return", "getAccessToken", "(", "clientId", ",", "clientSecret", ",", "null", ",", "null", ")", ";", "}" ]
Get the app access token from Facebook. see https://developers.facebook.com/docs/authentication/
[ "Get", "the", "app", "access", "token", "from", "Facebook", "." ]
train
https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/FacebookBatcher.java#L69-L71
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/LinearScaling.java
LinearScaling.fromMinMax
public static LinearScaling fromMinMax(double min, double max) { """ Make a linear scaling from a given minimum and maximum. The minimum will be mapped to zero, the maximum to one. @param min Minimum @param max Maximum @return New linear scaling. """ double zoom = 1.0 / (max - min); return new LinearScaling(zoom, -min * zoom); }
java
public static LinearScaling fromMinMax(double min, double max) { double zoom = 1.0 / (max - min); return new LinearScaling(zoom, -min * zoom); }
[ "public", "static", "LinearScaling", "fromMinMax", "(", "double", "min", ",", "double", "max", ")", "{", "double", "zoom", "=", "1.0", "/", "(", "max", "-", "min", ")", ";", "return", "new", "LinearScaling", "(", "zoom", ",", "-", "min", "*", "zoom", ")", ";", "}" ]
Make a linear scaling from a given minimum and maximum. The minimum will be mapped to zero, the maximum to one. @param min Minimum @param max Maximum @return New linear scaling.
[ "Make", "a", "linear", "scaling", "from", "a", "given", "minimum", "and", "maximum", ".", "The", "minimum", "will", "be", "mapped", "to", "zero", "the", "maximum", "to", "one", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/scaling/LinearScaling.java#L102-L105
apache/flink
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.java
JDBCInputFormat.nextRecord
@Override public Row nextRecord(Row row) throws IOException { """ Stores the next resultSet row in a tuple. @param row row to be reused. @return row containing next {@link Row} @throws java.io.IOException """ try { if (!hasNext) { return null; } for (int pos = 0; pos < row.getArity(); pos++) { row.setField(pos, resultSet.getObject(pos + 1)); } //update hasNext after we've read the record hasNext = resultSet.next(); return row; } catch (SQLException se) { throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { throw new IOException("Couldn't access resultSet", npe); } }
java
@Override public Row nextRecord(Row row) throws IOException { try { if (!hasNext) { return null; } for (int pos = 0; pos < row.getArity(); pos++) { row.setField(pos, resultSet.getObject(pos + 1)); } //update hasNext after we've read the record hasNext = resultSet.next(); return row; } catch (SQLException se) { throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { throw new IOException("Couldn't access resultSet", npe); } }
[ "@", "Override", "public", "Row", "nextRecord", "(", "Row", "row", ")", "throws", "IOException", "{", "try", "{", "if", "(", "!", "hasNext", ")", "{", "return", "null", ";", "}", "for", "(", "int", "pos", "=", "0", ";", "pos", "<", "row", ".", "getArity", "(", ")", ";", "pos", "++", ")", "{", "row", ".", "setField", "(", "pos", ",", "resultSet", ".", "getObject", "(", "pos", "+", "1", ")", ")", ";", "}", "//update hasNext after we've read the record", "hasNext", "=", "resultSet", ".", "next", "(", ")", ";", "return", "row", ";", "}", "catch", "(", "SQLException", "se", ")", "{", "throw", "new", "IOException", "(", "\"Couldn't read data - \"", "+", "se", ".", "getMessage", "(", ")", ",", "se", ")", ";", "}", "catch", "(", "NullPointerException", "npe", ")", "{", "throw", "new", "IOException", "(", "\"Couldn't access resultSet\"", ",", "npe", ")", ";", "}", "}" ]
Stores the next resultSet row in a tuple. @param row row to be reused. @return row containing next {@link Row} @throws java.io.IOException
[ "Stores", "the", "next", "resultSet", "row", "in", "a", "tuple", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.java#L289-L306
skuzzle/jeve
jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java
EventStackImpl.popEvent
public <L extends Listener> void popEvent(Event<?, L> expected) { """ Pops the top event off the current event stack. This action has to be performed immediately after the event has been dispatched to all listeners. @param <L> Type of the listener. @param expected The Event which is expected at the top of the stack. @see #pushEvent(Event) """ synchronized (this.stack) { final Event<?, ?> actual = this.stack.pop(); if (actual != expected) { throw new IllegalStateException(String.format( "Unbalanced pop: expected '%s' but encountered '%s'", expected.getListenerClass(), actual)); } } }
java
public <L extends Listener> void popEvent(Event<?, L> expected) { synchronized (this.stack) { final Event<?, ?> actual = this.stack.pop(); if (actual != expected) { throw new IllegalStateException(String.format( "Unbalanced pop: expected '%s' but encountered '%s'", expected.getListenerClass(), actual)); } } }
[ "public", "<", "L", "extends", "Listener", ">", "void", "popEvent", "(", "Event", "<", "?", ",", "L", ">", "expected", ")", "{", "synchronized", "(", "this", ".", "stack", ")", "{", "final", "Event", "<", "?", ",", "?", ">", "actual", "=", "this", ".", "stack", ".", "pop", "(", ")", ";", "if", "(", "actual", "!=", "expected", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"Unbalanced pop: expected '%s' but encountered '%s'\"", ",", "expected", ".", "getListenerClass", "(", ")", ",", "actual", ")", ")", ";", "}", "}", "}" ]
Pops the top event off the current event stack. This action has to be performed immediately after the event has been dispatched to all listeners. @param <L> Type of the listener. @param expected The Event which is expected at the top of the stack. @see #pushEvent(Event)
[ "Pops", "the", "top", "event", "off", "the", "current", "event", "stack", ".", "This", "action", "has", "to", "be", "performed", "immediately", "after", "the", "event", "has", "been", "dispatched", "to", "all", "listeners", "." ]
train
https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/providers/EventStackImpl.java#L114-L123
sporniket/core
sporniket-core-io/src/main/java/com/sporniket/libre/io/FileTools.java
FileTools.createReaderForInputStream
public static Reader createReaderForInputStream(InputStream source, Encoding encoding) throws FileNotFoundException, UnsupportedEncodingException { """ Instanciate a Reader for a InputStream using the given encoding. @param source source stream. @param encoding can be <code>null</code> @return the reader. @throws FileNotFoundException if there is a problem to deal with. @throws UnsupportedEncodingException if there is a problem to deal with. @since 12.06.01 """ return (null == encoding) ? new InputStreamReader(source) : new InputStreamReader(source, encoding.getSunOldIoName()); }
java
public static Reader createReaderForInputStream(InputStream source, Encoding encoding) throws FileNotFoundException, UnsupportedEncodingException { return (null == encoding) ? new InputStreamReader(source) : new InputStreamReader(source, encoding.getSunOldIoName()); }
[ "public", "static", "Reader", "createReaderForInputStream", "(", "InputStream", "source", ",", "Encoding", "encoding", ")", "throws", "FileNotFoundException", ",", "UnsupportedEncodingException", "{", "return", "(", "null", "==", "encoding", ")", "?", "new", "InputStreamReader", "(", "source", ")", ":", "new", "InputStreamReader", "(", "source", ",", "encoding", ".", "getSunOldIoName", "(", ")", ")", ";", "}" ]
Instanciate a Reader for a InputStream using the given encoding. @param source source stream. @param encoding can be <code>null</code> @return the reader. @throws FileNotFoundException if there is a problem to deal with. @throws UnsupportedEncodingException if there is a problem to deal with. @since 12.06.01
[ "Instanciate", "a", "Reader", "for", "a", "InputStream", "using", "the", "given", "encoding", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-io/src/main/java/com/sporniket/libre/io/FileTools.java#L171-L175
lawloretienne/ImageGallery
library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java
TouchImageView.setZoom
public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) { """ Set zoom to the specified scale. Image will be centered around the point (focusX, focusY). These floats range from 0 to 1 and denote the focus point as a fraction from the left and top of the view. For example, the top left corner of the image would be (0, 0). And the bottom right corner would be (1, 1). @param scale @param focusX @param focusY @param scaleType """ // // setZoom can be called before the image is on the screen, but at this point, // image and view sizes have not yet been calculated in onMeasure. Thus, we should // delay calling setZoom until the view has been measured. // if (!onDrawReady) { delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType); return; } if (scaleType != mScaleType) { setScaleType(scaleType); } resetZoom(); scaleImage(scale, viewWidth / 2, viewHeight / 2, true); matrix.getValues(m); m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f)); m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f)); matrix.setValues(m); fixTrans(); setImageMatrix(matrix); }
java
public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) { // // setZoom can be called before the image is on the screen, but at this point, // image and view sizes have not yet been calculated in onMeasure. Thus, we should // delay calling setZoom until the view has been measured. // if (!onDrawReady) { delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType); return; } if (scaleType != mScaleType) { setScaleType(scaleType); } resetZoom(); scaleImage(scale, viewWidth / 2, viewHeight / 2, true); matrix.getValues(m); m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f)); m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f)); matrix.setValues(m); fixTrans(); setImageMatrix(matrix); }
[ "public", "void", "setZoom", "(", "float", "scale", ",", "float", "focusX", ",", "float", "focusY", ",", "ScaleType", "scaleType", ")", "{", "//", "// setZoom can be called before the image is on the screen, but at this point,", "// image and view sizes have not yet been calculated in onMeasure. Thus, we should", "// delay calling setZoom until the view has been measured.", "//", "if", "(", "!", "onDrawReady", ")", "{", "delayedZoomVariables", "=", "new", "ZoomVariables", "(", "scale", ",", "focusX", ",", "focusY", ",", "scaleType", ")", ";", "return", ";", "}", "if", "(", "scaleType", "!=", "mScaleType", ")", "{", "setScaleType", "(", "scaleType", ")", ";", "}", "resetZoom", "(", ")", ";", "scaleImage", "(", "scale", ",", "viewWidth", "/", "2", ",", "viewHeight", "/", "2", ",", "true", ")", ";", "matrix", ".", "getValues", "(", "m", ")", ";", "m", "[", "Matrix", ".", "MTRANS_X", "]", "=", "-", "(", "(", "focusX", "*", "getImageWidth", "(", ")", ")", "-", "(", "viewWidth", "*", "0.5f", ")", ")", ";", "m", "[", "Matrix", ".", "MTRANS_Y", "]", "=", "-", "(", "(", "focusY", "*", "getImageHeight", "(", ")", ")", "-", "(", "viewHeight", "*", "0.5f", ")", ")", ";", "matrix", ".", "setValues", "(", "m", ")", ";", "fixTrans", "(", ")", ";", "setImageMatrix", "(", "matrix", ")", ";", "}" ]
Set zoom to the specified scale. Image will be centered around the point (focusX, focusY). These floats range from 0 to 1 and denote the focus point as a fraction from the left and top of the view. For example, the top left corner of the image would be (0, 0). And the bottom right corner would be (1, 1). @param scale @param focusX @param focusY @param scaleType
[ "Set", "zoom", "to", "the", "specified", "scale", ".", "Image", "will", "be", "centered", "around", "the", "point", "(", "focusX", "focusY", ")", ".", "These", "floats", "range", "from", "0", "to", "1", "and", "denote", "the", "focus", "point", "as", "a", "fraction", "from", "the", "left", "and", "top", "of", "the", "view", ".", "For", "example", "the", "top", "left", "corner", "of", "the", "image", "would", "be", "(", "0", "0", ")", ".", "And", "the", "bottom", "right", "corner", "would", "be", "(", "1", "1", ")", "." ]
train
https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L389-L411
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.getEndValue
public static int getEndValue(Calendar calendar, int dateField) { """ 获取指定日期字段的最大值,例如分钟的最小值是59 @param calendar {@link Calendar} @param dateField {@link DateField} @return 字段最大值 @since 4.5.7 @see Calendar#getActualMaximum(int) """ if(Calendar.DAY_OF_WEEK == dateField) { return (calendar.getFirstDayOfWeek() + 6) % 7; } return calendar.getActualMaximum(dateField); }
java
public static int getEndValue(Calendar calendar, int dateField) { if(Calendar.DAY_OF_WEEK == dateField) { return (calendar.getFirstDayOfWeek() + 6) % 7; } return calendar.getActualMaximum(dateField); }
[ "public", "static", "int", "getEndValue", "(", "Calendar", "calendar", ",", "int", "dateField", ")", "{", "if", "(", "Calendar", ".", "DAY_OF_WEEK", "==", "dateField", ")", "{", "return", "(", "calendar", ".", "getFirstDayOfWeek", "(", ")", "+", "6", ")", "%", "7", ";", "}", "return", "calendar", ".", "getActualMaximum", "(", "dateField", ")", ";", "}" ]
获取指定日期字段的最大值,例如分钟的最小值是59 @param calendar {@link Calendar} @param dateField {@link DateField} @return 字段最大值 @since 4.5.7 @see Calendar#getActualMaximum(int)
[ "获取指定日期字段的最大值,例如分钟的最小值是59" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1696-L1701
alkacon/opencms-core
src-setup/org/opencms/setup/db/CmsUpdateDBManager.java
CmsUpdateDBManager.getOracleTablespaces
protected void getOracleTablespaces(Map<String, String> dbPoolData) { """ Retrieves the oracle tablespace names.<p> @param dbPoolData the database pool data """ String dataTablespace = "users"; String indexTablespace = "users"; CmsSetupDb setupDb = new CmsSetupDb(null); try { setupDb.setConnection( dbPoolData.get("driver"), dbPoolData.get("url"), dbPoolData.get("params"), dbPoolData.get("user"), dbPoolData.get("pwd")); // read tablespace for data CmsSetupDBWrapper db = null; try { db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_tables", null); if (db.getResultSet().next()) { dataTablespace = db.getResultSet().getString(1).toLowerCase(); } } finally { if (db != null) { db.close(); } } // read tablespace for indexes try { db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_indexes", null); if (db.getResultSet().next()) { indexTablespace = db.getResultSet().getString(1).toLowerCase(); } } finally { if (db != null) { db.close(); } } } catch (SQLException e) { e.printStackTrace(); } finally { setupDb.closeConnection(); } dbPoolData.put("indexTablespace", indexTablespace); System.out.println("Index Tablespace: " + indexTablespace); dbPoolData.put("dataTablespace", dataTablespace); System.out.println("Data Tablespace: " + dataTablespace); }
java
protected void getOracleTablespaces(Map<String, String> dbPoolData) { String dataTablespace = "users"; String indexTablespace = "users"; CmsSetupDb setupDb = new CmsSetupDb(null); try { setupDb.setConnection( dbPoolData.get("driver"), dbPoolData.get("url"), dbPoolData.get("params"), dbPoolData.get("user"), dbPoolData.get("pwd")); // read tablespace for data CmsSetupDBWrapper db = null; try { db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_tables", null); if (db.getResultSet().next()) { dataTablespace = db.getResultSet().getString(1).toLowerCase(); } } finally { if (db != null) { db.close(); } } // read tablespace for indexes try { db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_indexes", null); if (db.getResultSet().next()) { indexTablespace = db.getResultSet().getString(1).toLowerCase(); } } finally { if (db != null) { db.close(); } } } catch (SQLException e) { e.printStackTrace(); } finally { setupDb.closeConnection(); } dbPoolData.put("indexTablespace", indexTablespace); System.out.println("Index Tablespace: " + indexTablespace); dbPoolData.put("dataTablespace", dataTablespace); System.out.println("Data Tablespace: " + dataTablespace); }
[ "protected", "void", "getOracleTablespaces", "(", "Map", "<", "String", ",", "String", ">", "dbPoolData", ")", "{", "String", "dataTablespace", "=", "\"users\"", ";", "String", "indexTablespace", "=", "\"users\"", ";", "CmsSetupDb", "setupDb", "=", "new", "CmsSetupDb", "(", "null", ")", ";", "try", "{", "setupDb", ".", "setConnection", "(", "dbPoolData", ".", "get", "(", "\"driver\"", ")", ",", "dbPoolData", ".", "get", "(", "\"url\"", ")", ",", "dbPoolData", ".", "get", "(", "\"params\"", ")", ",", "dbPoolData", ".", "get", "(", "\"user\"", ")", ",", "dbPoolData", ".", "get", "(", "\"pwd\"", ")", ")", ";", "// read tablespace for data", "CmsSetupDBWrapper", "db", "=", "null", ";", "try", "{", "db", "=", "setupDb", ".", "executeSqlStatement", "(", "\"SELECT DISTINCT tablespace_name FROM user_tables\"", ",", "null", ")", ";", "if", "(", "db", ".", "getResultSet", "(", ")", ".", "next", "(", ")", ")", "{", "dataTablespace", "=", "db", ".", "getResultSet", "(", ")", ".", "getString", "(", "1", ")", ".", "toLowerCase", "(", ")", ";", "}", "}", "finally", "{", "if", "(", "db", "!=", "null", ")", "{", "db", ".", "close", "(", ")", ";", "}", "}", "// read tablespace for indexes", "try", "{", "db", "=", "setupDb", ".", "executeSqlStatement", "(", "\"SELECT DISTINCT tablespace_name FROM user_indexes\"", ",", "null", ")", ";", "if", "(", "db", ".", "getResultSet", "(", ")", ".", "next", "(", ")", ")", "{", "indexTablespace", "=", "db", ".", "getResultSet", "(", ")", ".", "getString", "(", "1", ")", ".", "toLowerCase", "(", ")", ";", "}", "}", "finally", "{", "if", "(", "db", "!=", "null", ")", "{", "db", ".", "close", "(", ")", ";", "}", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "setupDb", ".", "closeConnection", "(", ")", ";", "}", "dbPoolData", ".", "put", "(", "\"indexTablespace\"", ",", "indexTablespace", ")", ";", "System", ".", "out", ".", "println", "(", "\"Index Tablespace: \"", "+", "indexTablespace", ")", ";", "dbPoolData", ".", "put", "(", "\"dataTablespace\"", ",", "dataTablespace", ")", ";", "System", ".", "out", ".", "println", "(", "\"Data Tablespace: \"", "+", "dataTablespace", ")", ";", "}" ]
Retrieves the oracle tablespace names.<p> @param dbPoolData the database pool data
[ "Retrieves", "the", "oracle", "tablespace", "names", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L424-L472
baratine/baratine
web/src/main/java/com/caucho/v5/util/PeriodUtil.java
PeriodUtil.periodEnd
public static long periodEnd(long now, long period) { """ Calculates the next period end. The calculation is in local time. @param now the current time in GMT ms since the epoch @return the time of the next period in GMT ms since the epoch """ LocalDateTime time = LocalDateTime.ofEpochSecond(now / 1000, 0, ZoneOffset.UTC); //QDate localCalendar = QDate.allocateLocalDate(); long endTime = periodEnd(now, period, time); //QDate.freeLocalDate(localCalendar); return endTime; }
java
public static long periodEnd(long now, long period) { LocalDateTime time = LocalDateTime.ofEpochSecond(now / 1000, 0, ZoneOffset.UTC); //QDate localCalendar = QDate.allocateLocalDate(); long endTime = periodEnd(now, period, time); //QDate.freeLocalDate(localCalendar); return endTime; }
[ "public", "static", "long", "periodEnd", "(", "long", "now", ",", "long", "period", ")", "{", "LocalDateTime", "time", "=", "LocalDateTime", ".", "ofEpochSecond", "(", "now", "/", "1000", ",", "0", ",", "ZoneOffset", ".", "UTC", ")", ";", "//QDate localCalendar = QDate.allocateLocalDate();", "long", "endTime", "=", "periodEnd", "(", "now", ",", "period", ",", "time", ")", ";", "//QDate.freeLocalDate(localCalendar);", "return", "endTime", ";", "}" ]
Calculates the next period end. The calculation is in local time. @param now the current time in GMT ms since the epoch @return the time of the next period in GMT ms since the epoch
[ "Calculates", "the", "next", "period", "end", ".", "The", "calculation", "is", "in", "local", "time", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/util/PeriodUtil.java#L218-L228
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java
GosuClassTransformer.compileJavaInteropBridgeConstructor
private void compileJavaInteropBridgeConstructor( DynamicFunctionSymbol dfs ) { """ Add constructor so Java can use the Gosu generic class without explicitly passing in type arguments. Note this constructor forwards to the given constructor with default type arguments. """ DynamicFunctionSymbol copy = new DynamicFunctionSymbol( dfs ); copy.setValue( null ); copy.setInitializer( null ); ConstructorStatement fs = new ConstructorStatement( true ); fs.setDynamicFunctionSymbol( copy ); fs.setSynthetic( true ); MethodCallExpression expr = new MethodCallExpression(); expr.setType( JavaTypes.pVOID() ); List<ISymbol> args = dfs.getArgs(); Expression[] exprArgs = new Expression[args.size()]; for( int i = 0; i < args.size(); i++ ) { ISymbol arg = args.get( i ); Identifier id = new Identifier(); id.setSymbol( arg, dfs.getSymbolTable() ); id.setType( arg.getType() ); exprArgs[i] = id; } expr.setArgs( exprArgs ); expr.setFunctionSymbol( new ThisConstructorFunctionSymbol( dfs, true ) ); MethodCallStatement stmt = new MethodCallStatement(); stmt.setMethodCall( expr ); stmt.setSynthetic( true ); copy.setValue( stmt ); copy.setDeclFunctionStmt( fs ); int iModifiers = getModifiers( copy ); List<IRSymbol> parameters = new ArrayList<>(); maybeGetEnumSuperConstructorSymbols( parameters ); for( ISymbol param : copy.getArgs() ) { parameters.add( makeParamSymbol( copy, param ) ); } setUpFunctionContext( copy, true, parameters ); FunctionStatementTransformer funcStmtCompiler = new FunctionStatementTransformer( copy, _context ); IRStatement methodBody = funcStmtCompiler.compile(); IExpression annotationDefault = copy.getAnnotationDefault(); Object[] annotationDefaultValue = null; if( annotationDefault != null ) { annotationDefaultValue = new Object[] {CompileTimeExpressionParser.convertValueToInfoFriendlyValue( annotationDefault.evaluate(), getGosuClass().getTypeInfo() )}; } IRMethodStatement methodStatement = new IRMethodStatement( methodBody, "<init>", iModifiers, copy.isInternal(), IRTypeConstants.pVOID(), copy.getReturnType(), parameters, copy.getArgTypes(), copy.getType(), annotationDefaultValue); methodStatement.setAnnotations( getIRAnnotations( makeAnnotationInfos( copy.getModifierInfo().getAnnotations(), getGosuClass().getTypeInfo() ) ) ); _irClass.addMethod( methodStatement ); }
java
private void compileJavaInteropBridgeConstructor( DynamicFunctionSymbol dfs ) { DynamicFunctionSymbol copy = new DynamicFunctionSymbol( dfs ); copy.setValue( null ); copy.setInitializer( null ); ConstructorStatement fs = new ConstructorStatement( true ); fs.setDynamicFunctionSymbol( copy ); fs.setSynthetic( true ); MethodCallExpression expr = new MethodCallExpression(); expr.setType( JavaTypes.pVOID() ); List<ISymbol> args = dfs.getArgs(); Expression[] exprArgs = new Expression[args.size()]; for( int i = 0; i < args.size(); i++ ) { ISymbol arg = args.get( i ); Identifier id = new Identifier(); id.setSymbol( arg, dfs.getSymbolTable() ); id.setType( arg.getType() ); exprArgs[i] = id; } expr.setArgs( exprArgs ); expr.setFunctionSymbol( new ThisConstructorFunctionSymbol( dfs, true ) ); MethodCallStatement stmt = new MethodCallStatement(); stmt.setMethodCall( expr ); stmt.setSynthetic( true ); copy.setValue( stmt ); copy.setDeclFunctionStmt( fs ); int iModifiers = getModifiers( copy ); List<IRSymbol> parameters = new ArrayList<>(); maybeGetEnumSuperConstructorSymbols( parameters ); for( ISymbol param : copy.getArgs() ) { parameters.add( makeParamSymbol( copy, param ) ); } setUpFunctionContext( copy, true, parameters ); FunctionStatementTransformer funcStmtCompiler = new FunctionStatementTransformer( copy, _context ); IRStatement methodBody = funcStmtCompiler.compile(); IExpression annotationDefault = copy.getAnnotationDefault(); Object[] annotationDefaultValue = null; if( annotationDefault != null ) { annotationDefaultValue = new Object[] {CompileTimeExpressionParser.convertValueToInfoFriendlyValue( annotationDefault.evaluate(), getGosuClass().getTypeInfo() )}; } IRMethodStatement methodStatement = new IRMethodStatement( methodBody, "<init>", iModifiers, copy.isInternal(), IRTypeConstants.pVOID(), copy.getReturnType(), parameters, copy.getArgTypes(), copy.getType(), annotationDefaultValue); methodStatement.setAnnotations( getIRAnnotations( makeAnnotationInfos( copy.getModifierInfo().getAnnotations(), getGosuClass().getTypeInfo() ) ) ); _irClass.addMethod( methodStatement ); }
[ "private", "void", "compileJavaInteropBridgeConstructor", "(", "DynamicFunctionSymbol", "dfs", ")", "{", "DynamicFunctionSymbol", "copy", "=", "new", "DynamicFunctionSymbol", "(", "dfs", ")", ";", "copy", ".", "setValue", "(", "null", ")", ";", "copy", ".", "setInitializer", "(", "null", ")", ";", "ConstructorStatement", "fs", "=", "new", "ConstructorStatement", "(", "true", ")", ";", "fs", ".", "setDynamicFunctionSymbol", "(", "copy", ")", ";", "fs", ".", "setSynthetic", "(", "true", ")", ";", "MethodCallExpression", "expr", "=", "new", "MethodCallExpression", "(", ")", ";", "expr", ".", "setType", "(", "JavaTypes", ".", "pVOID", "(", ")", ")", ";", "List", "<", "ISymbol", ">", "args", "=", "dfs", ".", "getArgs", "(", ")", ";", "Expression", "[", "]", "exprArgs", "=", "new", "Expression", "[", "args", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ISymbol", "arg", "=", "args", ".", "get", "(", "i", ")", ";", "Identifier", "id", "=", "new", "Identifier", "(", ")", ";", "id", ".", "setSymbol", "(", "arg", ",", "dfs", ".", "getSymbolTable", "(", ")", ")", ";", "id", ".", "setType", "(", "arg", ".", "getType", "(", ")", ")", ";", "exprArgs", "[", "i", "]", "=", "id", ";", "}", "expr", ".", "setArgs", "(", "exprArgs", ")", ";", "expr", ".", "setFunctionSymbol", "(", "new", "ThisConstructorFunctionSymbol", "(", "dfs", ",", "true", ")", ")", ";", "MethodCallStatement", "stmt", "=", "new", "MethodCallStatement", "(", ")", ";", "stmt", ".", "setMethodCall", "(", "expr", ")", ";", "stmt", ".", "setSynthetic", "(", "true", ")", ";", "copy", ".", "setValue", "(", "stmt", ")", ";", "copy", ".", "setDeclFunctionStmt", "(", "fs", ")", ";", "int", "iModifiers", "=", "getModifiers", "(", "copy", ")", ";", "List", "<", "IRSymbol", ">", "parameters", "=", "new", "ArrayList", "<>", "(", ")", ";", "maybeGetEnumSuperConstructorSymbols", "(", "parameters", ")", ";", "for", "(", "ISymbol", "param", ":", "copy", ".", "getArgs", "(", ")", ")", "{", "parameters", ".", "add", "(", "makeParamSymbol", "(", "copy", ",", "param", ")", ")", ";", "}", "setUpFunctionContext", "(", "copy", ",", "true", ",", "parameters", ")", ";", "FunctionStatementTransformer", "funcStmtCompiler", "=", "new", "FunctionStatementTransformer", "(", "copy", ",", "_context", ")", ";", "IRStatement", "methodBody", "=", "funcStmtCompiler", ".", "compile", "(", ")", ";", "IExpression", "annotationDefault", "=", "copy", ".", "getAnnotationDefault", "(", ")", ";", "Object", "[", "]", "annotationDefaultValue", "=", "null", ";", "if", "(", "annotationDefault", "!=", "null", ")", "{", "annotationDefaultValue", "=", "new", "Object", "[", "]", "{", "CompileTimeExpressionParser", ".", "convertValueToInfoFriendlyValue", "(", "annotationDefault", ".", "evaluate", "(", ")", ",", "getGosuClass", "(", ")", ".", "getTypeInfo", "(", ")", ")", "}", ";", "}", "IRMethodStatement", "methodStatement", "=", "new", "IRMethodStatement", "(", "methodBody", ",", "\"<init>\"", ",", "iModifiers", ",", "copy", ".", "isInternal", "(", ")", ",", "IRTypeConstants", ".", "pVOID", "(", ")", ",", "copy", ".", "getReturnType", "(", ")", ",", "parameters", ",", "copy", ".", "getArgTypes", "(", ")", ",", "copy", ".", "getType", "(", ")", ",", "annotationDefaultValue", ")", ";", "methodStatement", ".", "setAnnotations", "(", "getIRAnnotations", "(", "makeAnnotationInfos", "(", "copy", ".", "getModifierInfo", "(", ")", ".", "getAnnotations", "(", ")", ",", "getGosuClass", "(", ")", ".", "getTypeInfo", "(", ")", ")", ")", ")", ";", "_irClass", ".", "addMethod", "(", "methodStatement", ")", ";", "}" ]
Add constructor so Java can use the Gosu generic class without explicitly passing in type arguments. Note this constructor forwards to the given constructor with default type arguments.
[ "Add", "constructor", "so", "Java", "can", "use", "the", "Gosu", "generic", "class", "without", "explicitly", "passing", "in", "type", "arguments", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java#L565-L626
leancloud/java-sdk-all
core/src/main/java/cn/leancloud/AVObject.java
AVObject.hasCircleReference
public boolean hasCircleReference(Map<AVObject, Boolean> markMap) { """ judge operations' value include circle reference or not. notice: internal used, pls not invoke it. @param markMap @return """ if (null == markMap) { return false; } markMap.put(this, true); boolean rst = false; for (ObjectFieldOperation op: operations.values()) { rst = rst || op.checkCircleReference(markMap); } return rst; }
java
public boolean hasCircleReference(Map<AVObject, Boolean> markMap) { if (null == markMap) { return false; } markMap.put(this, true); boolean rst = false; for (ObjectFieldOperation op: operations.values()) { rst = rst || op.checkCircleReference(markMap); } return rst; }
[ "public", "boolean", "hasCircleReference", "(", "Map", "<", "AVObject", ",", "Boolean", ">", "markMap", ")", "{", "if", "(", "null", "==", "markMap", ")", "{", "return", "false", ";", "}", "markMap", ".", "put", "(", "this", ",", "true", ")", ";", "boolean", "rst", "=", "false", ";", "for", "(", "ObjectFieldOperation", "op", ":", "operations", ".", "values", "(", ")", ")", "{", "rst", "=", "rst", "||", "op", ".", "checkCircleReference", "(", "markMap", ")", ";", "}", "return", "rst", ";", "}" ]
judge operations' value include circle reference or not. notice: internal used, pls not invoke it. @param markMap @return
[ "judge", "operations", "value", "include", "circle", "reference", "or", "not", "." ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/AVObject.java#L621-L631