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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
undera/jmeter-plugins
graphs/graphs-basic/src/main/java/kg/apc/jmeter/vizualizers/ThreadsStateOverTimeGui.java
ThreadsStateOverTimeGui.rebuildAggRow
private void rebuildAggRow(GraphRowSimple row, long time, long duration) { """ perf fix: only process elements between time and last processed - sampler duration """ long key = row.getHigherKey(lastAggUpdateTime - duration - 1); while (key < time && key != -1) { GraphPanelChartSimpleElement elt = (GraphPanelChartSimpleElement) row.getElement(key); elt.add(getAllThreadCount(key)); Long nextKey = row.getHigherKey(key); if (nextKey != null) { key = nextKey; } else { key = -1; } } }
java
private void rebuildAggRow(GraphRowSimple row, long time, long duration) { long key = row.getHigherKey(lastAggUpdateTime - duration - 1); while (key < time && key != -1) { GraphPanelChartSimpleElement elt = (GraphPanelChartSimpleElement) row.getElement(key); elt.add(getAllThreadCount(key)); Long nextKey = row.getHigherKey(key); if (nextKey != null) { key = nextKey; } else { key = -1; } } }
[ "private", "void", "rebuildAggRow", "(", "GraphRowSimple", "row", ",", "long", "time", ",", "long", "duration", ")", "{", "long", "key", "=", "row", ".", "getHigherKey", "(", "lastAggUpdateTime", "-", "duration", "-", "1", ")", ";", "while", "(", "key", ...
perf fix: only process elements between time and last processed - sampler duration
[ "perf", "fix", ":", "only", "process", "elements", "between", "time", "and", "last", "processed", "-", "sampler", "duration" ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/graphs/graphs-basic/src/main/java/kg/apc/jmeter/vizualizers/ThreadsStateOverTimeGui.java#L54-L67
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java
PRJUtil.getValidSRID
public static int getValidSRID(Connection connection, File prjFile) throws SQLException, IOException { """ Get a valid SRID value from a prj file. If the the prj file - is null, - doesn't contain a valid srid code, - is empty * then a default srid equals to 0 is added. @param connection @param prjFile @return @throws SQLException @throws IOException """ int srid = getSRID(prjFile); if(!isSRIDValid(srid, connection)){ srid = 0; } return srid; }
java
public static int getValidSRID(Connection connection, File prjFile) throws SQLException, IOException { int srid = getSRID(prjFile); if(!isSRIDValid(srid, connection)){ srid = 0; } return srid; }
[ "public", "static", "int", "getValidSRID", "(", "Connection", "connection", ",", "File", "prjFile", ")", "throws", "SQLException", ",", "IOException", "{", "int", "srid", "=", "getSRID", "(", "prjFile", ")", ";", "if", "(", "!", "isSRIDValid", "(", "srid", ...
Get a valid SRID value from a prj file. If the the prj file - is null, - doesn't contain a valid srid code, - is empty * then a default srid equals to 0 is added. @param connection @param prjFile @return @throws SQLException @throws IOException
[ "Get", "a", "valid", "SRID", "value", "from", "a", "prj", "file", ".", "If", "the", "the", "prj", "file", "-", "is", "null", "-", "doesn", "t", "contain", "a", "valid", "srid", "code", "-", "is", "empty", "*", "then", "a", "default", "srid", "equal...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java#L95-L101
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteDetectorWithServiceResponseAsync
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName) { """ Get Detector. Get Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param detectorName Detector Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object """ return getSiteDetectorSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSiteDetectorNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName) { return getSiteDetectorSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSiteDetectorNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DetectorDefinitionInner", ">", ">", ">", "getSiteDetectorWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnosticCat...
Get Detector. Get Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param detectorName Detector Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object
[ "Get", "Detector", ".", "Get", "Detector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1056-L1068
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java
SequenceAlgorithms.longestCommonSubsequenceWithIsomorphism
public static List<int[]> longestCommonSubsequenceWithIsomorphism(List<ITree> s0, List<ITree> s1) { """ Returns the longest common subsequence between the two list of nodes. This version use isomorphism to ensure equality. @see ITree#isIsomorphicTo(ITree) @return a list of size 2 int arrays that corresponds to match of index in sequence 1 to index in sequence 2. """ int[][] lengths = new int[s0.size() + 1][s1.size() + 1]; for (int i = 0; i < s0.size(); i++) for (int j = 0; j < s1.size(); j++) if (s0.get(i).isIsomorphicTo(s1.get(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.size(), s1.size()); }
java
public static List<int[]> longestCommonSubsequenceWithIsomorphism(List<ITree> s0, List<ITree> s1) { int[][] lengths = new int[s0.size() + 1][s1.size() + 1]; for (int i = 0; i < s0.size(); i++) for (int j = 0; j < s1.size(); j++) if (s0.get(i).isIsomorphicTo(s1.get(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.size(), s1.size()); }
[ "public", "static", "List", "<", "int", "[", "]", ">", "longestCommonSubsequenceWithIsomorphism", "(", "List", "<", "ITree", ">", "s0", ",", "List", "<", "ITree", ">", "s1", ")", "{", "int", "[", "]", "[", "]", "lengths", "=", "new", "int", "[", "s0"...
Returns the longest common subsequence between the two list of nodes. This version use isomorphism to ensure equality. @see ITree#isIsomorphicTo(ITree) @return a list of size 2 int arrays that corresponds to match of index in sequence 1 to index in sequence 2.
[ "Returns", "the", "longest", "common", "subsequence", "between", "the", "two", "list", "of", "nodes", ".", "This", "version", "use", "isomorphism", "to", "ensure", "equality", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java#L131-L141
m-m-m/util
datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java
GenericColor.calculateHue
private static double calculateHue(double red, double green, double blue, double max, double chroma) { """ Calculate the {@link Hue}. @param red is the {@link Red} value. @param green is the {@link Green} value. @param blue is the {@link Blue} value. @param max is the maximum of RGB. @param chroma is the {@link Chroma} value. @return the {@link Saturation}. """ if (chroma == 0) { return 0; } else { double hue; if (red == max) { hue = (green - blue) / chroma; } else if (green == max) { hue = (blue - red) / chroma + 2; } else { hue = (red - green) / chroma + 4; } hue = hue * 60.0; if (hue < 0) { hue = hue + Hue.MAX_VALUE; } return hue; } }
java
private static double calculateHue(double red, double green, double blue, double max, double chroma) { if (chroma == 0) { return 0; } else { double hue; if (red == max) { hue = (green - blue) / chroma; } else if (green == max) { hue = (blue - red) / chroma + 2; } else { hue = (red - green) / chroma + 4; } hue = hue * 60.0; if (hue < 0) { hue = hue + Hue.MAX_VALUE; } return hue; } }
[ "private", "static", "double", "calculateHue", "(", "double", "red", ",", "double", "green", ",", "double", "blue", ",", "double", "max", ",", "double", "chroma", ")", "{", "if", "(", "chroma", "==", "0", ")", "{", "return", "0", ";", "}", "else", "{...
Calculate the {@link Hue}. @param red is the {@link Red} value. @param green is the {@link Green} value. @param blue is the {@link Blue} value. @param max is the maximum of RGB. @param chroma is the {@link Chroma} value. @return the {@link Saturation}.
[ "Calculate", "the", "{", "@link", "Hue", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java#L234-L253
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XLifecycleExtension.java
XLifecycleExtension.assignModel
public void assignModel(XLog log, String model) { """ Assigns a value for the lifecycle model identifier to a given log. @param log Log to be tagged. @param model Lifecycle model identifier string to be used. """ if (model != null && model.trim().length() > 0) { XAttributeLiteral modelAttr = (XAttributeLiteral) ATTR_MODEL .clone(); modelAttr.setValue(model.trim()); log.getAttributes().put(KEY_MODEL, modelAttr); } }
java
public void assignModel(XLog log, String model) { if (model != null && model.trim().length() > 0) { XAttributeLiteral modelAttr = (XAttributeLiteral) ATTR_MODEL .clone(); modelAttr.setValue(model.trim()); log.getAttributes().put(KEY_MODEL, modelAttr); } }
[ "public", "void", "assignModel", "(", "XLog", "log", ",", "String", "model", ")", "{", "if", "(", "model", "!=", "null", "&&", "model", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "modelAttr", "=", "(", ...
Assigns a value for the lifecycle model identifier to a given log. @param log Log to be tagged. @param model Lifecycle model identifier string to be used.
[ "Assigns", "a", "value", "for", "the", "lifecycle", "model", "identifier", "to", "a", "given", "log", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XLifecycleExtension.java#L240-L247
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java
Buffer.writeBytes
public void writeBytes(byte header, byte[] bytes) { """ Write bytes. @param header header byte @param bytes command bytes """ int length = bytes.length; while (remaining() < length + 10) { grow(); } writeLength(length + 1); buf[position++] = header; System.arraycopy(bytes, 0, buf, position, length); position += length; }
java
public void writeBytes(byte header, byte[] bytes) { int length = bytes.length; while (remaining() < length + 10) { grow(); } writeLength(length + 1); buf[position++] = header; System.arraycopy(bytes, 0, buf, position, length); position += length; }
[ "public", "void", "writeBytes", "(", "byte", "header", ",", "byte", "[", "]", "bytes", ")", "{", "int", "length", "=", "bytes", ".", "length", ";", "while", "(", "remaining", "(", ")", "<", "length", "+", "10", ")", "{", "grow", "(", ")", ";", "}...
Write bytes. @param header header byte @param bytes command bytes
[ "Write", "bytes", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java#L379-L388
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/fog/FogOfWar.java
FogOfWar.isFogged
public boolean isFogged(int tx, int ty) { """ In case of active fog of war, check if tile is hidden by fog. @param tx The horizontal tile. @param ty The vertical tile. @return <code>true</code> if hidden by fog, <code>false</code> else. """ return mapFogged.getTile(tx, ty).getNumber() < MapTileFog.FOG; }
java
public boolean isFogged(int tx, int ty) { return mapFogged.getTile(tx, ty).getNumber() < MapTileFog.FOG; }
[ "public", "boolean", "isFogged", "(", "int", "tx", ",", "int", "ty", ")", "{", "return", "mapFogged", ".", "getTile", "(", "tx", ",", "ty", ")", ".", "getNumber", "(", ")", "<", "MapTileFog", ".", "FOG", ";", "}" ]
In case of active fog of war, check if tile is hidden by fog. @param tx The horizontal tile. @param ty The vertical tile. @return <code>true</code> if hidden by fog, <code>false</code> else.
[ "In", "case", "of", "active", "fog", "of", "war", "check", "if", "tile", "is", "hidden", "by", "fog", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/fog/FogOfWar.java#L168-L171
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addAnnotation
AnnotationVisitor addAnnotation(TypeCache.CachedType containingDescriptor, AnnotatedDescriptor annotatedDescriptor, String typeName) { """ Add an annotation descriptor of the given type name to an annotated descriptor. @param annotatedDescriptor The annotated descriptor. @param typeName The type name of the annotation. @return The annotation descriptor. """ if (typeName == null) { return null; } if (jQASuppress.class.getName().equals(typeName)) { JavaSuppressDescriptor javaSuppressDescriptor = scannerContext.getStore().addDescriptorType(annotatedDescriptor, JavaSuppressDescriptor.class); return new SuppressAnnotationVisitor(javaSuppressDescriptor); } TypeDescriptor type = resolveType(typeName, containingDescriptor).getTypeDescriptor(); AnnotationValueDescriptor annotationDescriptor = scannerContext.getStore().create(AnnotationValueDescriptor.class); annotationDescriptor.setType(type); annotatedDescriptor.getAnnotatedBy().add(annotationDescriptor); return new AnnotationValueVisitor(containingDescriptor, annotationDescriptor, this); }
java
AnnotationVisitor addAnnotation(TypeCache.CachedType containingDescriptor, AnnotatedDescriptor annotatedDescriptor, String typeName) { if (typeName == null) { return null; } if (jQASuppress.class.getName().equals(typeName)) { JavaSuppressDescriptor javaSuppressDescriptor = scannerContext.getStore().addDescriptorType(annotatedDescriptor, JavaSuppressDescriptor.class); return new SuppressAnnotationVisitor(javaSuppressDescriptor); } TypeDescriptor type = resolveType(typeName, containingDescriptor).getTypeDescriptor(); AnnotationValueDescriptor annotationDescriptor = scannerContext.getStore().create(AnnotationValueDescriptor.class); annotationDescriptor.setType(type); annotatedDescriptor.getAnnotatedBy().add(annotationDescriptor); return new AnnotationValueVisitor(containingDescriptor, annotationDescriptor, this); }
[ "AnnotationVisitor", "addAnnotation", "(", "TypeCache", ".", "CachedType", "containingDescriptor", ",", "AnnotatedDescriptor", "annotatedDescriptor", ",", "String", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "return", "null", ";", "}", "i...
Add an annotation descriptor of the given type name to an annotated descriptor. @param annotatedDescriptor The annotated descriptor. @param typeName The type name of the annotation. @return The annotation descriptor.
[ "Add", "an", "annotation", "descriptor", "of", "the", "given", "type", "name", "to", "an", "annotated", "descriptor", "." ]
train
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L229-L242
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.listBulkRecipients
public BulkRecipientsResponse listBulkRecipients(String accountId, String templateId, String recipientId, TemplatesApi.ListBulkRecipientsOptions options) throws ApiException { """ Gets the bulk recipient file from a template. Retrieves the bulk recipient file information from a template that has a bulk recipient. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param recipientId The ID of the recipient being accessed. (required) @param options for modifying the method behavior. @return BulkRecipientsResponse @throws ApiException if fails to make API call """ Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listBulkRecipients"); } // verify the required parameter 'templateId' is set if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling listBulkRecipients"); } // verify the required parameter 'recipientId' is set if (recipientId == null) { throw new ApiException(400, "Missing the required parameter 'recipientId' when calling listBulkRecipients"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "templateId" + "\\}", apiClient.escapeString(templateId.toString())) .replaceAll("\\{" + "recipientId" + "\\}", apiClient.escapeString(recipientId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_tabs", options.includeTabs)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<BulkRecipientsResponse> localVarReturnType = new GenericType<BulkRecipientsResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public BulkRecipientsResponse listBulkRecipients(String accountId, String templateId, String recipientId, TemplatesApi.ListBulkRecipientsOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listBulkRecipients"); } // verify the required parameter 'templateId' is set if (templateId == null) { throw new ApiException(400, "Missing the required parameter 'templateId' when calling listBulkRecipients"); } // verify the required parameter 'recipientId' is set if (recipientId == null) { throw new ApiException(400, "Missing the required parameter 'recipientId' when calling listBulkRecipients"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "templateId" + "\\}", apiClient.escapeString(templateId.toString())) .replaceAll("\\{" + "recipientId" + "\\}", apiClient.escapeString(recipientId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_tabs", options.includeTabs)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<BulkRecipientsResponse> localVarReturnType = new GenericType<BulkRecipientsResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "BulkRecipientsResponse", "listBulkRecipients", "(", "String", "accountId", ",", "String", "templateId", ",", "String", "recipientId", ",", "TemplatesApi", ".", "ListBulkRecipientsOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBo...
Gets the bulk recipient file from a template. Retrieves the bulk recipient file information from a template that has a bulk recipient. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param recipientId The ID of the recipient being accessed. (required) @param options for modifying the method behavior. @return BulkRecipientsResponse @throws ApiException if fails to make API call
[ "Gets", "the", "bulk", "recipient", "file", "from", "a", "template", ".", "Retrieves", "the", "bulk", "recipient", "file", "information", "from", "a", "template", "that", "has", "a", "bulk", "recipient", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2014-L2063
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/entries/CounterValue.java
CounterValue.newCounterValue
public static CounterValue newCounterValue(long value, long lowerBound, long upperBound) { """ Creates a new {@link CounterValue} with the value and state based on the boundaries. @param value the counter's value. @param lowerBound the counter's lower bound. @param upperBound the counter's upper bound. @return the {@link CounterValue}. """ return new CounterValue(value, calculateState(value, lowerBound, upperBound)); }
java
public static CounterValue newCounterValue(long value, long lowerBound, long upperBound) { return new CounterValue(value, calculateState(value, lowerBound, upperBound)); }
[ "public", "static", "CounterValue", "newCounterValue", "(", "long", "value", ",", "long", "lowerBound", ",", "long", "upperBound", ")", "{", "return", "new", "CounterValue", "(", "value", ",", "calculateState", "(", "value", ",", "lowerBound", ",", "upperBound",...
Creates a new {@link CounterValue} with the value and state based on the boundaries. @param value the counter's value. @param lowerBound the counter's lower bound. @param upperBound the counter's upper bound. @return the {@link CounterValue}.
[ "Creates", "a", "new", "{", "@link", "CounterValue", "}", "with", "the", "value", "and", "state", "based", "on", "the", "boundaries", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/entries/CounterValue.java#L62-L64
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java
FilteredAttributes.getValue
public String getValue(String uri, String localName) { """ Get the value of the attribute. @param uri The attribute uri. @param localName The attribute local name. """ return attributes.getValue(getRealIndex(uri, localName)); }
java
public String getValue(String uri, String localName) { return attributes.getValue(getRealIndex(uri, localName)); }
[ "public", "String", "getValue", "(", "String", "uri", ",", "String", "localName", ")", "{", "return", "attributes", ".", "getValue", "(", "getRealIndex", "(", "uri", ",", "localName", ")", ")", ";", "}" ]
Get the value of the attribute. @param uri The attribute uri. @param localName The attribute local name.
[ "Get", "the", "value", "of", "the", "attribute", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java#L167-L169
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java
UnsafeOperations.deepCopy
public <T> T deepCopy(final T obj) { """ Performs a deep copy of the object. With a deep copy all references from the object are also copied. The identity of referenced objects is preserved, so, for example, if the object graph contains two references to the same object, the cloned object will preserve this structure. @param obj The object to perform a deep copy for. @param <T> The type being copied @return A deep copy of the original object. """ return deepCopy(obj, new IdentityHashMap<Object, Object>(10)); }
java
public <T> T deepCopy(final T obj) { return deepCopy(obj, new IdentityHashMap<Object, Object>(10)); }
[ "public", "<", "T", ">", "T", "deepCopy", "(", "final", "T", "obj", ")", "{", "return", "deepCopy", "(", "obj", ",", "new", "IdentityHashMap", "<", "Object", ",", "Object", ">", "(", "10", ")", ")", ";", "}" ]
Performs a deep copy of the object. With a deep copy all references from the object are also copied. The identity of referenced objects is preserved, so, for example, if the object graph contains two references to the same object, the cloned object will preserve this structure. @param obj The object to perform a deep copy for. @param <T> The type being copied @return A deep copy of the original object.
[ "Performs", "a", "deep", "copy", "of", "the", "object", ".", "With", "a", "deep", "copy", "all", "references", "from", "the", "object", "are", "also", "copied", ".", "The", "identity", "of", "referenced", "objects", "is", "preserved", "so", "for", "example...
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L271-L273
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.newPost
public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException { """ Set up a new post of a given type @param blogName the name of the blog for this post (or null) @param klass the type of Post to instantiate @param <T> the type of Post to instantiate @return the new post with the client set @throws IllegalAccessException if class instantiation fails @throws InstantiationException if class instantiation fails """ T post = klass.newInstance(); post.setClient(this); post.setBlogName(blogName); return post; }
java
public <T extends Post> T newPost(String blogName, Class<T> klass) throws IllegalAccessException, InstantiationException { T post = klass.newInstance(); post.setClient(this); post.setBlogName(blogName); return post; }
[ "public", "<", "T", "extends", "Post", ">", "T", "newPost", "(", "String", "blogName", ",", "Class", "<", "T", ">", "klass", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "T", "post", "=", "klass", ".", "newInstance", "(", ")...
Set up a new post of a given type @param blogName the name of the blog for this post (or null) @param klass the type of Post to instantiate @param <T> the type of Post to instantiate @return the new post with the client set @throws IllegalAccessException if class instantiation fails @throws InstantiationException if class instantiation fails
[ "Set", "up", "a", "new", "post", "of", "a", "given", "type" ]
train
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L397-L402
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
FieldUtils.getDeclaredField
public static Field getDeclaredField(final Class<?> cls, final String fieldName, final boolean forceAccess) { """ Gets an accessible {@link Field} by name, breaking scope if requested. Only the specified class will be considered. @param cls the {@link Class} to reflect, must not be {@code null} @param fieldName the field name to obtain @param forceAccess whether to break scope restrictions using the {@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code false} will only match {@code public} fields. @return the Field object @throws IllegalArgumentException if the class is {@code null}, or the field name is blank or empty """ Validate.isTrue(cls != null, "The class must not be null"); Validate.isTrue(StringUtils.isNotBlank(fieldName), "The field name must not be blank/empty"); try { // only consider the specified class by using getDeclaredField() final Field field = cls.getDeclaredField(fieldName); if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true); } else { return null; } } return field; } catch (final NoSuchFieldException e) { // NOPMD // ignore } return null; }
java
public static Field getDeclaredField(final Class<?> cls, final String fieldName, final boolean forceAccess) { Validate.isTrue(cls != null, "The class must not be null"); Validate.isTrue(StringUtils.isNotBlank(fieldName), "The field name must not be blank/empty"); try { // only consider the specified class by using getDeclaredField() final Field field = cls.getDeclaredField(fieldName); if (!MemberUtils.isAccessible(field)) { if (forceAccess) { field.setAccessible(true); } else { return null; } } return field; } catch (final NoSuchFieldException e) { // NOPMD // ignore } return null; }
[ "public", "static", "Field", "getDeclaredField", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "String", "fieldName", ",", "final", "boolean", "forceAccess", ")", "{", "Validate", ".", "isTrue", "(", "cls", "!=", "null", ",", "\"The class must n...
Gets an accessible {@link Field} by name, breaking scope if requested. Only the specified class will be considered. @param cls the {@link Class} to reflect, must not be {@code null} @param fieldName the field name to obtain @param forceAccess whether to break scope restrictions using the {@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code false} will only match {@code public} fields. @return the Field object @throws IllegalArgumentException if the class is {@code null}, or the field name is blank or empty
[ "Gets", "an", "accessible", "{", "@link", "Field", "}", "by", "name", "breaking", "scope", "if", "requested", ".", "Only", "the", "specified", "class", "will", "be", "considered", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L171-L189
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
DocServiceBuilder.exampleHttpHeaders
public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders) { """ Adds the example {@link HttpHeaders} for the service with the specified name. """ requireNonNull(exampleHttpHeaders, "exampleHttpHeaders"); return exampleHttpHeaders(serviceName, ImmutableList.copyOf(exampleHttpHeaders)); }
java
public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders) { requireNonNull(exampleHttpHeaders, "exampleHttpHeaders"); return exampleHttpHeaders(serviceName, ImmutableList.copyOf(exampleHttpHeaders)); }
[ "public", "DocServiceBuilder", "exampleHttpHeaders", "(", "String", "serviceName", ",", "HttpHeaders", "...", "exampleHttpHeaders", ")", "{", "requireNonNull", "(", "exampleHttpHeaders", ",", "\"exampleHttpHeaders\"", ")", ";", "return", "exampleHttpHeaders", "(", "servic...
Adds the example {@link HttpHeaders} for the service with the specified name.
[ "Adds", "the", "example", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L105-L108
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.disableAllForWebAppAsync
public Observable<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName) { """ Disable all recommendations for an app. Disable all recommendations for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName) { return disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "disableAllForWebAppAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "return", "disableAllForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "map", "(", "ne...
Disable all recommendations for an app. Disable all recommendations for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Disable", "all", "recommendations", "for", "an", "app", ".", "Disable", "all", "recommendations", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1057-L1064
lotaris/rox-client-java
rox-client-java/src/main/java/com/lotaris/rox/core/cache/CacheOptimizerStore.java
CacheOptimizerStore.getCacheDir
private File getCacheDir() { """ Get the cache directory. if not exist, it is created and returned. @return The cache base directory """ // Get the root cache dir File cacheDir = new File(configuration.getOptimizerCacheDir()); if (!cacheDir.exists()) { cacheDir.mkdir(); } // Get the directory that represent the host directory // return FootprintGenerator.footprint(getMandatory(P_ROX_URL)); File roxCacheDir = new File(cacheDir, configuration.getServerConfiguration().getBaseUrlFootprint()); if (!roxCacheDir.exists()) { roxCacheDir.mkdirs(); } return roxCacheDir; }
java
private File getCacheDir() { // Get the root cache dir File cacheDir = new File(configuration.getOptimizerCacheDir()); if (!cacheDir.exists()) { cacheDir.mkdir(); } // Get the directory that represent the host directory // return FootprintGenerator.footprint(getMandatory(P_ROX_URL)); File roxCacheDir = new File(cacheDir, configuration.getServerConfiguration().getBaseUrlFootprint()); if (!roxCacheDir.exists()) { roxCacheDir.mkdirs(); } return roxCacheDir; }
[ "private", "File", "getCacheDir", "(", ")", "{", "// Get the root cache dir", "File", "cacheDir", "=", "new", "File", "(", "configuration", ".", "getOptimizerCacheDir", "(", ")", ")", ";", "if", "(", "!", "cacheDir", ".", "exists", "(", ")", ")", "{", "cac...
Get the cache directory. if not exist, it is created and returned. @return The cache base directory
[ "Get", "the", "cache", "directory", ".", "if", "not", "exist", "it", "is", "created", "and", "returned", "." ]
train
https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/cache/CacheOptimizerStore.java#L146-L161
structr/structr
structr-core/src/main/java/javatools/parsers/Char.java
Char.eatUtf8
public static char eatUtf8(String a, int[] n) { """ Eats a UTF8 code from a String. There is also a built-in way in Java that converts UTF8 to characters and back, but it does not work with all characters. """ if (a.length() == 0) { n[0] = 0; return ((char) 0); } n[0] = Utf8Length(a.charAt(0)); if (a.length() >= n[0]) { switch (n[0]) { case 1: return (a.charAt(0)); case 2: if ((a.charAt(1) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x1F) << 6) + (a.charAt(1) & 0x3F))); case 3: if ((a.charAt(1) & 0xC0) != 0x80 || (a.charAt(2) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x0F) << 12) + ((a.charAt(1) & 0x3F) << 6) + ((a.charAt(2) & 0x3F)))); case 4: if ((a.charAt(1) & 0xC0) != 0x80 || (a.charAt(2) & 0xC0) != 0x80 || (a.charAt(3) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x07) << 18) + ((a.charAt(1) & 0x3F) << 12) + ((a.charAt(2) & 0x3F) << 6) + ((a.charAt(3) & 0x3F)))); } } n[0] = -1; return ((char) 0); }
java
public static char eatUtf8(String a, int[] n) { if (a.length() == 0) { n[0] = 0; return ((char) 0); } n[0] = Utf8Length(a.charAt(0)); if (a.length() >= n[0]) { switch (n[0]) { case 1: return (a.charAt(0)); case 2: if ((a.charAt(1) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x1F) << 6) + (a.charAt(1) & 0x3F))); case 3: if ((a.charAt(1) & 0xC0) != 0x80 || (a.charAt(2) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x0F) << 12) + ((a.charAt(1) & 0x3F) << 6) + ((a.charAt(2) & 0x3F)))); case 4: if ((a.charAt(1) & 0xC0) != 0x80 || (a.charAt(2) & 0xC0) != 0x80 || (a.charAt(3) & 0xC0) != 0x80) break; return ((char) (((a.charAt(0) & 0x07) << 18) + ((a.charAt(1) & 0x3F) << 12) + ((a.charAt(2) & 0x3F) << 6) + ((a.charAt(3) & 0x3F)))); } } n[0] = -1; return ((char) 0); }
[ "public", "static", "char", "eatUtf8", "(", "String", "a", ",", "int", "[", "]", "n", ")", "{", "if", "(", "a", ".", "length", "(", ")", "==", "0", ")", "{", "n", "[", "0", "]", "=", "0", ";", "return", "(", "(", "char", ")", "0", ")", ";...
Eats a UTF8 code from a String. There is also a built-in way in Java that converts UTF8 to characters and back, but it does not work with all characters.
[ "Eats", "a", "UTF8", "code", "from", "a", "String", ".", "There", "is", "also", "a", "built", "-", "in", "way", "in", "Java", "that", "converts", "UTF8", "to", "characters", "and", "back", "but", "it", "does", "not", "work", "with", "all", "characters"...
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/javatools/parsers/Char.java#L765-L788
thorntail/thorntail
core/bootstrap/src/main/java/org/wildfly/swarm/bootstrap/modules/GradleResolver.java
GradleResolver.doDownload
File doDownload(String remoteRepos, String artifactAbsoluteHttpPath, String artifactRelativeHttpPath, ArtifactCoordinates artifactCoordinates, String packaging, File targetArtifactPomDirectory, File targetArtifactDirectory) { """ Download the POM and the artifact file and return it. @param remoteRepos @param artifactAbsoluteHttpPath @param artifactRelativeHttpPath @param artifactCoordinates @param packaging @param targetArtifactPomDirectory @param targetArtifactDirectory @return """ //Download POM File targetArtifactPomFile = new File(targetArtifactPomDirectory, toGradleArtifactFileName(artifactCoordinates, "pom")); try { MavenArtifactUtil.downloadFile(artifactCoordinates + ":pom", artifactAbsoluteHttpPath + "pom", targetArtifactPomFile); } catch (IOException e) { Module.getModuleLogger().trace(e, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos); // try next one } //Download Artifact File targetArtifactFile = new File(targetArtifactDirectory, toGradleArtifactFileName(artifactCoordinates, packaging)); try { MavenArtifactUtil.downloadFile(artifactCoordinates + ":" + packaging, artifactAbsoluteHttpPath + packaging, targetArtifactFile); if (targetArtifactFile.exists()) { return targetArtifactFile; } } catch (IOException e) { Module.getModuleLogger().trace(e, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos); // try next one } return null; }
java
File doDownload(String remoteRepos, String artifactAbsoluteHttpPath, String artifactRelativeHttpPath, ArtifactCoordinates artifactCoordinates, String packaging, File targetArtifactPomDirectory, File targetArtifactDirectory) { //Download POM File targetArtifactPomFile = new File(targetArtifactPomDirectory, toGradleArtifactFileName(artifactCoordinates, "pom")); try { MavenArtifactUtil.downloadFile(artifactCoordinates + ":pom", artifactAbsoluteHttpPath + "pom", targetArtifactPomFile); } catch (IOException e) { Module.getModuleLogger().trace(e, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos); // try next one } //Download Artifact File targetArtifactFile = new File(targetArtifactDirectory, toGradleArtifactFileName(artifactCoordinates, packaging)); try { MavenArtifactUtil.downloadFile(artifactCoordinates + ":" + packaging, artifactAbsoluteHttpPath + packaging, targetArtifactFile); if (targetArtifactFile.exists()) { return targetArtifactFile; } } catch (IOException e) { Module.getModuleLogger().trace(e, "Could not doDownload '%s' from '%s' repository", artifactRelativeHttpPath, remoteRepos); // try next one } return null; }
[ "File", "doDownload", "(", "String", "remoteRepos", ",", "String", "artifactAbsoluteHttpPath", ",", "String", "artifactRelativeHttpPath", ",", "ArtifactCoordinates", "artifactCoordinates", ",", "String", "packaging", ",", "File", "targetArtifactPomDirectory", ",", "File", ...
Download the POM and the artifact file and return it. @param remoteRepos @param artifactAbsoluteHttpPath @param artifactRelativeHttpPath @param artifactCoordinates @param packaging @param targetArtifactPomDirectory @param targetArtifactDirectory @return
[ "Download", "the", "POM", "and", "the", "artifact", "file", "and", "return", "it", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/bootstrap/src/main/java/org/wildfly/swarm/bootstrap/modules/GradleResolver.java#L148-L170
Bernardo-MG/dice-notation-java
src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java
DefaultDiceExpressionBuilder.getDiceOperand
private final DiceOperand getDiceOperand(final DiceContext ctx) { """ Creates a dice operand from the parsed context data. <p> If the dice is being subtracted then the sign of the dice set is reversed. @param ctx parsed context @return a dice operand """ final Dice dice; // Parsed dice final Integer quantity; // Number of dice final Integer sides; // Number of sides final Iterator<TerminalNode> digits; // Parsed digits // Parses the dice data digits = ctx.DIGIT().iterator(); if (Iterables.size(ctx.DIGIT()) > 1) { if ((ctx.ADDOPERATOR() != null) && (SUBTRACTION_OPERATOR .equals(ctx.ADDOPERATOR().getText()))) { LOGGER.debug("This is part of a subtraction. Reversing sign."); quantity = 0 - Integer.parseInt(digits.next().getText()); } else { quantity = Integer.parseInt(digits.next().getText()); } } else { // No quantity of dice defined // Defaults to 1 quantity = 1; } sides = Integer.parseInt(digits.next().getText()); // Creates the dice dice = new DefaultDice(quantity, sides); return new DefaultDiceOperand(dice); }
java
private final DiceOperand getDiceOperand(final DiceContext ctx) { final Dice dice; // Parsed dice final Integer quantity; // Number of dice final Integer sides; // Number of sides final Iterator<TerminalNode> digits; // Parsed digits // Parses the dice data digits = ctx.DIGIT().iterator(); if (Iterables.size(ctx.DIGIT()) > 1) { if ((ctx.ADDOPERATOR() != null) && (SUBTRACTION_OPERATOR .equals(ctx.ADDOPERATOR().getText()))) { LOGGER.debug("This is part of a subtraction. Reversing sign."); quantity = 0 - Integer.parseInt(digits.next().getText()); } else { quantity = Integer.parseInt(digits.next().getText()); } } else { // No quantity of dice defined // Defaults to 1 quantity = 1; } sides = Integer.parseInt(digits.next().getText()); // Creates the dice dice = new DefaultDice(quantity, sides); return new DefaultDiceOperand(dice); }
[ "private", "final", "DiceOperand", "getDiceOperand", "(", "final", "DiceContext", "ctx", ")", "{", "final", "Dice", "dice", ";", "// Parsed dice", "final", "Integer", "quantity", ";", "// Number of dice", "final", "Integer", "sides", ";", "// Number of sides", "fina...
Creates a dice operand from the parsed context data. <p> If the dice is being subtracted then the sign of the dice set is reversed. @param ctx parsed context @return a dice operand
[ "Creates", "a", "dice", "operand", "from", "the", "parsed", "context", "data", ".", "<p", ">", "If", "the", "dice", "is", "being", "subtracted", "then", "the", "sign", "of", "the", "dice", "set", "is", "reversed", "." ]
train
https://github.com/Bernardo-MG/dice-notation-java/blob/fdba6a6eb7ff35740399f2694a58514a383dad88/src/main/java/com/bernardomg/tabletop/dice/parser/listener/DefaultDiceExpressionBuilder.java#L243-L271
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.setFloat
@PublicEvolving public void setFloat(ConfigOption<Float> key, float value) { """ Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added """ setValueInternal(key.key(), value); }
java
@PublicEvolving public void setFloat(ConfigOption<Float> key, float value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setFloat", "(", "ConfigOption", "<", "Float", ">", "key", ",", "float", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L486-L489
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/userservice/GetAllRoles.java
GetAllRoles.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ // Get the UserService. UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class); // Get all roles. Role[] roles = userService.getAllRoles(); int i = 0; for (Role role : roles) { System.out.printf( "%d) Role with ID %d and name '%s' was found.%n", i++, role.getId(), role.getName()); } System.out.printf("Number of results found: %d%n", roles.length); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the UserService. UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class); // Get all roles. Role[] roles = userService.getAllRoles(); int i = 0; for (Role role : roles) { System.out.printf( "%d) Role with ID %d and name '%s' was found.%n", i++, role.getId(), role.getName()); } System.out.printf("Number of results found: %d%n", roles.length); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the UserService.", "UserServiceInterface", "userService", "=", "adManagerServices", ".", "get", "(", ...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/userservice/GetAllRoles.java#L49-L64
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java
ProductSortDefinitionUrl.addProductSortDefinitionUrl
public static MozuUrl addProductSortDefinitionUrl(String responseFields, Boolean useProvidedId) { """ Get Resource Url for AddProductSortDefinition @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param useProvidedId If true, the provided Id value will be used as the ProductSortDefinitionId. If omitted or false, the system will generate a ProductSortDefinitionId @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvidedId}&responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("useProvidedId", useProvidedId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl addProductSortDefinitionUrl(String responseFields, Boolean useProvidedId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvidedId}&responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("useProvidedId", useProvidedId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "addProductSortDefinitionUrl", "(", "String", "responseFields", ",", "Boolean", "useProvidedId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/productsortdefinitions/?useProvidedId={useProvide...
Get Resource Url for AddProductSortDefinition @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param useProvidedId If true, the provided Id value will be used as the ProductSortDefinitionId. If omitted or false, the system will generate a ProductSortDefinitionId @return String Resource Url
[ "Get", "Resource", "Url", "for", "AddProductSortDefinition" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java#L56-L62
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getUntilFirstExcl
@Nullable public static String getUntilFirstExcl (@Nullable final String sStr, final char cSearch) { """ Get everything from the string up to and excluding first the passed char. @param sStr The source string. May be <code>null</code>. @param cSearch The character to search. @return <code>null</code> if the passed string does not contain the search character. """ return _getUntilFirst (sStr, cSearch, false); }
java
@Nullable public static String getUntilFirstExcl (@Nullable final String sStr, final char cSearch) { return _getUntilFirst (sStr, cSearch, false); }
[ "@", "Nullable", "public", "static", "String", "getUntilFirstExcl", "(", "@", "Nullable", "final", "String", "sStr", ",", "final", "char", "cSearch", ")", "{", "return", "_getUntilFirst", "(", "sStr", ",", "cSearch", ",", "false", ")", ";", "}" ]
Get everything from the string up to and excluding first the passed char. @param sStr The source string. May be <code>null</code>. @param cSearch The character to search. @return <code>null</code> if the passed string does not contain the search character.
[ "Get", "everything", "from", "the", "string", "up", "to", "and", "excluding", "first", "the", "passed", "char", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4772-L4776
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.forEachElement
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) { """ Iterate through all elements of the current module and pass the output of the ElementVisitor to the provided consumer. 'null' responses from the visitor are ignored. This call will not modify any bindings @param visitor """ Elements .getElements(module) .forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer)); return this; }
java
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) { Elements .getElements(module) .forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer)); return this; }
[ "public", "<", "T", ">", "InjectorBuilder", "forEachElement", "(", "ElementVisitor", "<", "T", ">", "visitor", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "Elements", ".", "getElements", "(", "module", ")", ".", "forEach", "(", "element", "->", ...
Iterate through all elements of the current module and pass the output of the ElementVisitor to the provided consumer. 'null' responses from the visitor are ignored. This call will not modify any bindings @param visitor
[ "Iterate", "through", "all", "elements", "of", "the", "current", "module", "and", "pass", "the", "output", "of", "the", "ElementVisitor", "to", "the", "provided", "consumer", ".", "null", "responses", "from", "the", "visitor", "are", "ignored", "." ]
train
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L123-L128
wisdom-framework/wisdom
framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/impl/WisdomTemplateEngine.java
WisdomTemplateEngine.process
public RenderableString process(Template template, Controller controller, Router router, Assets assets, Map<String, Object> variables) { """ Renders the given template. <p> Variables from the session, flash and request parameters are added to the given parameters. @param template the template @param controller the template asking for the rendering @param router the router service @param variables the template parameters @return the rendered HTML page """ Context ctx = new Context(); // Add session final org.wisdom.api.http.Context http = org.wisdom.api.http.Context.CONTEXT.get(); ctx.setVariables(http.session().getData()); // Add flash ctx.setVariables(http.flash().getCurrentFlashCookieData()); ctx.setVariables(http.flash().getOutgoingFlashCookieData()); // Add parameter from request, flattened for (Map.Entry<String, List<String>> entry : http.parameters().entrySet()) { if (entry.getValue().size() == 1) { ctx.setVariable(entry.getKey(), entry.getValue().get(0)); } else { ctx.setVariable(entry.getKey(), entry.getValue()); } } // Add request scope for (Map.Entry<String, Object> entry : http.request().data().entrySet()) { ctx.setVariable(entry.getKey(), entry.getValue()); } // Add variable. ctx.setVariables(variables); ctx.setVariable(Routes.ROUTES_VAR, new Routes(router, assets, controller)); // This variable let us resolve template using relative path (in the same directory as the current template). // It's mainly used for 'layout', so we can compute the full url. ctx.setVariable("__TEMPLATE__", template); StringWriter writer = new StringWriter(); try { this.process(template.fullName(), ctx, writer); } catch (TemplateProcessingException e) { // If we have a nested cause having a nested cause, heuristics say that it's the useful message. // Rebuild an exception using this data. if (e.getCause() != null && e.getCause().getCause() != null) { throw new TemplateProcessingException(e.getCause().getCause().getMessage(), e.getTemplateName(), e.getLineNumber(), e.getCause().getCause()); } else { throw e; } } return new RenderableString(writer, MimeTypes.HTML); }
java
public RenderableString process(Template template, Controller controller, Router router, Assets assets, Map<String, Object> variables) { Context ctx = new Context(); // Add session final org.wisdom.api.http.Context http = org.wisdom.api.http.Context.CONTEXT.get(); ctx.setVariables(http.session().getData()); // Add flash ctx.setVariables(http.flash().getCurrentFlashCookieData()); ctx.setVariables(http.flash().getOutgoingFlashCookieData()); // Add parameter from request, flattened for (Map.Entry<String, List<String>> entry : http.parameters().entrySet()) { if (entry.getValue().size() == 1) { ctx.setVariable(entry.getKey(), entry.getValue().get(0)); } else { ctx.setVariable(entry.getKey(), entry.getValue()); } } // Add request scope for (Map.Entry<String, Object> entry : http.request().data().entrySet()) { ctx.setVariable(entry.getKey(), entry.getValue()); } // Add variable. ctx.setVariables(variables); ctx.setVariable(Routes.ROUTES_VAR, new Routes(router, assets, controller)); // This variable let us resolve template using relative path (in the same directory as the current template). // It's mainly used for 'layout', so we can compute the full url. ctx.setVariable("__TEMPLATE__", template); StringWriter writer = new StringWriter(); try { this.process(template.fullName(), ctx, writer); } catch (TemplateProcessingException e) { // If we have a nested cause having a nested cause, heuristics say that it's the useful message. // Rebuild an exception using this data. if (e.getCause() != null && e.getCause().getCause() != null) { throw new TemplateProcessingException(e.getCause().getCause().getMessage(), e.getTemplateName(), e.getLineNumber(), e.getCause().getCause()); } else { throw e; } } return new RenderableString(writer, MimeTypes.HTML); }
[ "public", "RenderableString", "process", "(", "Template", "template", ",", "Controller", "controller", ",", "Router", "router", ",", "Assets", "assets", ",", "Map", "<", "String", ",", "Object", ">", "variables", ")", "{", "Context", "ctx", "=", "new", "Cont...
Renders the given template. <p> Variables from the session, flash and request parameters are added to the given parameters. @param template the template @param controller the template asking for the rendering @param router the router service @param variables the template parameters @return the rendered HTML page
[ "Renders", "the", "given", "template", ".", "<p", ">", "Variables", "from", "the", "session", "flash", "and", "request", "parameters", "are", "added", "to", "the", "given", "parameters", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/impl/WisdomTemplateEngine.java#L69-L115
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.aggregateQuery
public AggregateResult aggregateQuery(TableDefinition tableDef, OlapAggregate request) { """ Perform an aggregate query on the given table using the given request. @param tableDef {@link TableDefinition} of table to query. @param request {@link OlapAggregate} that defines query parameters. @return {@link AggregateResult} containing search results. """ checkServiceState(); AggregationResult result = m_olap.aggregate(tableDef.getAppDef(), tableDef.getTableName(), request); return AggregateResultConverter.create(result, request); }
java
public AggregateResult aggregateQuery(TableDefinition tableDef, OlapAggregate request) { checkServiceState(); AggregationResult result = m_olap.aggregate(tableDef.getAppDef(), tableDef.getTableName(), request); return AggregateResultConverter.create(result, request); }
[ "public", "AggregateResult", "aggregateQuery", "(", "TableDefinition", "tableDef", ",", "OlapAggregate", "request", ")", "{", "checkServiceState", "(", ")", ";", "AggregationResult", "result", "=", "m_olap", ".", "aggregate", "(", "tableDef", ".", "getAppDef", "(", ...
Perform an aggregate query on the given table using the given request. @param tableDef {@link TableDefinition} of table to query. @param request {@link OlapAggregate} that defines query parameters. @return {@link AggregateResult} containing search results.
[ "Perform", "an", "aggregate", "query", "on", "the", "given", "table", "using", "the", "given", "request", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L181-L185
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java
JsonTextSequences.fromStream
public static HttpResponse fromStream(HttpHeaders headers, Stream<?> contentStream, HttpHeaders trailingHeaders, Executor executor, ObjectMapper mapper) { """ Creates a new JSON Text Sequences from the specified {@link Stream}. @param headers the HTTP headers supposed to send @param contentStream the {@link Stream} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param executor the executor which iterates the stream @param mapper the mapper which converts the content object into JSON Text Sequences """ requireNonNull(mapper, "mapper"); return streamingFrom(contentStream, sanitizeHeaders(headers), trailingHeaders, o -> toHttpData(mapper, o), executor); }
java
public static HttpResponse fromStream(HttpHeaders headers, Stream<?> contentStream, HttpHeaders trailingHeaders, Executor executor, ObjectMapper mapper) { requireNonNull(mapper, "mapper"); return streamingFrom(contentStream, sanitizeHeaders(headers), trailingHeaders, o -> toHttpData(mapper, o), executor); }
[ "public", "static", "HttpResponse", "fromStream", "(", "HttpHeaders", "headers", ",", "Stream", "<", "?", ">", "contentStream", ",", "HttpHeaders", "trailingHeaders", ",", "Executor", "executor", ",", "ObjectMapper", "mapper", ")", "{", "requireNonNull", "(", "map...
Creates a new JSON Text Sequences from the specified {@link Stream}. @param headers the HTTP headers supposed to send @param contentStream the {@link Stream} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param executor the executor which iterates the stream @param mapper the mapper which converts the content object into JSON Text Sequences
[ "Creates", "a", "new", "JSON", "Text", "Sequences", "from", "the", "specified", "{", "@link", "Stream", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java#L205-L211
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/AbstractMappingHTTPResponseHandler.java
AbstractMappingHTTPResponseHandler.findValue
protected String findValue(HTTPResponse httpResponse,String path) { """ This function returns the requested value from the HTTP response content.<br> The path is a set of key names seperated by ';'. @param httpResponse The HTTP response @param path The path to the value (elements seperated by ;) @return The value (null if not found) """ String value=null; if((path!=null)&&(httpResponse!=null)) { //parse output T object=this.convertToObject(httpResponse); if(object!=null) { //look for an error String errorMessage=this.findError(object); if(errorMessage!=null) { throw new FaxException("Error found in response: "+errorMessage); } //find value value=this.findValue(object,path); } } return value; }
java
protected String findValue(HTTPResponse httpResponse,String path) { String value=null; if((path!=null)&&(httpResponse!=null)) { //parse output T object=this.convertToObject(httpResponse); if(object!=null) { //look for an error String errorMessage=this.findError(object); if(errorMessage!=null) { throw new FaxException("Error found in response: "+errorMessage); } //find value value=this.findValue(object,path); } } return value; }
[ "protected", "String", "findValue", "(", "HTTPResponse", "httpResponse", ",", "String", "path", ")", "{", "String", "value", "=", "null", ";", "if", "(", "(", "path", "!=", "null", ")", "&&", "(", "httpResponse", "!=", "null", ")", ")", "{", "//parse out...
This function returns the requested value from the HTTP response content.<br> The path is a set of key names seperated by ';'. @param httpResponse The HTTP response @param path The path to the value (elements seperated by ;) @return The value (null if not found)
[ "This", "function", "returns", "the", "requested", "value", "from", "the", "HTTP", "response", "content", ".", "<br", ">", "The", "path", "is", "a", "set", "of", "key", "names", "seperated", "by", ";", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/AbstractMappingHTTPResponseHandler.java#L224-L247
apache/flink
flink-core/src/main/java/org/apache/flink/util/NetUtils.java
NetUtils.unresolvedHostToNormalizedString
public static String unresolvedHostToNormalizedString(String host) { """ Returns an address in a normalized format for Akka. When an IPv6 address is specified, it normalizes the IPv6 address to avoid complications with the exact URL match policy of Akka. @param host The hostname, IPv4 or IPv6 address @return host which will be normalized if it is an IPv6 address """ // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; }
java
public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; }
[ "public", "static", "String", "unresolvedHostToNormalizedString", "(", "String", "host", ")", "{", "// Return loopback interface address if host is null", "// This represents the behavior of {@code InetAddress.getByName } and RFC 3330", "if", "(", "host", "==", "null", ")", "{", ...
Returns an address in a normalized format for Akka. When an IPv6 address is specified, it normalizes the IPv6 address to avoid complications with the exact URL match policy of Akka. @param host The hostname, IPv4 or IPv6 address @return host which will be normalized if it is an IPv6 address
[ "Returns", "an", "address", "in", "a", "normalized", "format", "for", "Akka", ".", "When", "an", "IPv6", "address", "is", "specified", "it", "normalizes", "the", "IPv6", "address", "to", "avoid", "complications", "with", "the", "exact", "URL", "match", "poli...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L130-L155
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.availableDefaultSipDomains_GET
public ArrayList<OvhDefaultSipDomains> availableDefaultSipDomains_GET(OvhSipDomainProductTypeEnum type) throws IOException { """ Get all available SIP domains by country REST: GET /telephony/availableDefaultSipDomains @param type [required] Product type """ String qPath = "/telephony/availableDefaultSipDomains"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<OvhDefaultSipDomains> availableDefaultSipDomains_GET(OvhSipDomainProductTypeEnum type) throws IOException { String qPath = "/telephony/availableDefaultSipDomains"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "OvhDefaultSipDomains", ">", "availableDefaultSipDomains_GET", "(", "OvhSipDomainProductTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/availableDefaultSipDomains\"", ";", "StringBuilder", "sb", "=", "p...
Get all available SIP domains by country REST: GET /telephony/availableDefaultSipDomains @param type [required] Product type
[ "Get", "all", "available", "SIP", "domains", "by", "country" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L207-L213
stapler/stapler
groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java
SimpleTemplateParser.groovyExpression
private void groovyExpression(Reader reader, StringWriter sw) throws IOException { """ Closes the currently open write and writes out the following text as a GString expression until it reaches an end %>. @param reader a reader for the template text @param sw a StringWriter to write expression content @throws IOException if something goes wrong """ sw.write("${"); int c; while ((c = reader.read()) != -1) { if (c == '%') { c = reader.read(); if (c != '>') { sw.write('%'); } else { break; } } if (c != '\n' && c != '\r') { sw.write(c); } } sw.write("}"); }
java
private void groovyExpression(Reader reader, StringWriter sw) throws IOException { sw.write("${"); int c; while ((c = reader.read()) != -1) { if (c == '%') { c = reader.read(); if (c != '>') { sw.write('%'); } else { break; } } if (c != '\n' && c != '\r') { sw.write(c); } } sw.write("}"); }
[ "private", "void", "groovyExpression", "(", "Reader", "reader", ",", "StringWriter", "sw", ")", "throws", "IOException", "{", "sw", ".", "write", "(", "\"${\"", ")", ";", "int", "c", ";", "while", "(", "(", "c", "=", "reader", ".", "read", "(", ")", ...
Closes the currently open write and writes out the following text as a GString expression until it reaches an end %>. @param reader a reader for the template text @param sw a StringWriter to write expression content @throws IOException if something goes wrong
[ "Closes", "the", "currently", "open", "write", "and", "writes", "out", "the", "following", "text", "as", "a", "GString", "expression", "until", "it", "reaches", "an", "end", "%", ">", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java#L135-L152
l0rdn1kk0n/wicket-jquery-selectors
src/main/java/de/agilecoders/wicket/jquery/util/Json.java
Json.fromJson
public static <T> T fromJson(final String json, final JavaType type) { """ Convert a string to a Java value @param json Json value to convert. @param type Expected Java value type. @param <T> type of return object @return casted value of given json object @throws ParseException to runtime if json node can't be casted to clazz. """ try { return createObjectMapper().readValue(json, type); } catch (Exception e) { throw new ParseException(e); } }
java
public static <T> T fromJson(final String json, final JavaType type) { try { return createObjectMapper().readValue(json, type); } catch (Exception e) { throw new ParseException(e); } }
[ "public", "static", "<", "T", ">", "T", "fromJson", "(", "final", "String", "json", ",", "final", "JavaType", "type", ")", "{", "try", "{", "return", "createObjectMapper", "(", ")", ".", "readValue", "(", "json", ",", "type", ")", ";", "}", "catch", ...
Convert a string to a Java value @param json Json value to convert. @param type Expected Java value type. @param <T> type of return object @return casted value of given json object @throws ParseException to runtime if json node can't be casted to clazz.
[ "Convert", "a", "string", "to", "a", "Java", "value" ]
train
https://github.com/l0rdn1kk0n/wicket-jquery-selectors/blob/a606263f7821d0b5f337c9e65f8caa466ad398ad/src/main/java/de/agilecoders/wicket/jquery/util/Json.java#L44-L50
elki-project/elki
elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/distancematrix/PrecomputedSimilarityMatrix.java
PrecomputedSimilarityMatrix.getOffset
private int getOffset(int x, int y) { """ Array offset computation. @param x X parameter @param y Y parameter @return Array offset """ return (y < x) ? (triangleSize(x) + y) : (triangleSize(y) + x); }
java
private int getOffset(int x, int y) { return (y < x) ? (triangleSize(x) + y) : (triangleSize(y) + x); }
[ "private", "int", "getOffset", "(", "int", "x", ",", "int", "y", ")", "{", "return", "(", "y", "<", "x", ")", "?", "(", "triangleSize", "(", "x", ")", "+", "y", ")", ":", "(", "triangleSize", "(", "y", ")", "+", "x", ")", ";", "}" ]
Array offset computation. @param x X parameter @param y Y parameter @return Array offset
[ "Array", "offset", "computation", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index/src/main/java/de/lmu/ifi/dbs/elki/index/distancematrix/PrecomputedSimilarityMatrix.java#L162-L164
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java
MessageUnpacker.unpackMapHeader
public int unpackMapHeader() throws IOException { """ Reads header of a map. <p> This method returns number of pairs to be read. After this method call, for each pair, you call unpacker methods for key first, and then value. You will call unpacker methods twice as many time as the returned count. You don't have to call anything at the end of iteration. @return the size of the map to be read @throws MessageTypeException when value is not MessagePack Map type @throws MessageSizeException when size of the map is larger than 2^31 - 1 @throws IOException when underlying input throws IOException """ byte b = readByte(); if (Code.isFixedMap(b)) { // fixmap return b & 0x0f; } switch (b) { case Code.MAP16: { // map 16 int len = readNextLength16(); return len; } case Code.MAP32: { // map 32 int len = readNextLength32(); return len; } } throw unexpected("Map", b); }
java
public int unpackMapHeader() throws IOException { byte b = readByte(); if (Code.isFixedMap(b)) { // fixmap return b & 0x0f; } switch (b) { case Code.MAP16: { // map 16 int len = readNextLength16(); return len; } case Code.MAP32: { // map 32 int len = readNextLength32(); return len; } } throw unexpected("Map", b); }
[ "public", "int", "unpackMapHeader", "(", ")", "throws", "IOException", "{", "byte", "b", "=", "readByte", "(", ")", ";", "if", "(", "Code", ".", "isFixedMap", "(", "b", ")", ")", "{", "// fixmap", "return", "b", "&", "0x0f", ";", "}", "switch", "(", ...
Reads header of a map. <p> This method returns number of pairs to be read. After this method call, for each pair, you call unpacker methods for key first, and then value. You will call unpacker methods twice as many time as the returned count. You don't have to call anything at the end of iteration. @return the size of the map to be read @throws MessageTypeException when value is not MessagePack Map type @throws MessageSizeException when size of the map is larger than 2^31 - 1 @throws IOException when underlying input throws IOException
[ "Reads", "header", "of", "a", "map", "." ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1305-L1323
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/UpdaterBlock.java
UpdaterBlock.applyRegularization
protected void applyRegularization(Regularization.ApplyStep step, Trainable layer, String paramName, INDArray gradientView, INDArray paramsView, int iter, int epoch, double lr) { """ Apply L1 and L2 regularization, if necessary. Note that L1/L2 may differ for different layers in the same block @param layer The layer to apply L1/L2 to @param paramName Parameter name in the given layer @param gradientView Gradient view array for the layer + param @param paramsView Parameter view array for the layer + param """ //TODO: do this for multiple contiguous params/layers (fewer, larger ops) List<Regularization> l = layer.getConfig().getRegularizationByParam(paramName); if(l != null && !l.isEmpty()){ for(Regularization r : l){ if(r.applyStep() == step){ r.apply(paramsView, gradientView, lr, iter, epoch); } } } }
java
protected void applyRegularization(Regularization.ApplyStep step, Trainable layer, String paramName, INDArray gradientView, INDArray paramsView, int iter, int epoch, double lr) { //TODO: do this for multiple contiguous params/layers (fewer, larger ops) List<Regularization> l = layer.getConfig().getRegularizationByParam(paramName); if(l != null && !l.isEmpty()){ for(Regularization r : l){ if(r.applyStep() == step){ r.apply(paramsView, gradientView, lr, iter, epoch); } } } }
[ "protected", "void", "applyRegularization", "(", "Regularization", ".", "ApplyStep", "step", ",", "Trainable", "layer", ",", "String", "paramName", ",", "INDArray", "gradientView", ",", "INDArray", "paramsView", ",", "int", "iter", ",", "int", "epoch", ",", "dou...
Apply L1 and L2 regularization, if necessary. Note that L1/L2 may differ for different layers in the same block @param layer The layer to apply L1/L2 to @param paramName Parameter name in the given layer @param gradientView Gradient view array for the layer + param @param paramsView Parameter view array for the layer + param
[ "Apply", "L1", "and", "L2", "regularization", "if", "necessary", ".", "Note", "that", "L1", "/", "L2", "may", "differ", "for", "different", "layers", "in", "the", "same", "block" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/UpdaterBlock.java#L199-L210
Harium/keel
src/main/java/com/harium/keel/catalano/math/Tools.java
Tools.Hypotenuse
public static double Hypotenuse(double a, double b) { """ Hypotenuse calculus without overflow/underflow. @param a First value. @param b Second value. @return The hypotenuse Sqrt(a^2 + b^2). """ double r = 0.0; double absA = Math.abs(a); double absB = Math.abs(b); if (absA > absB) { r = b / a; r = absA * Math.sqrt(1 + r * r); } else if (b != 0) { r = a / b; r = absB * Math.sqrt(1 + r * r); } return r; }
java
public static double Hypotenuse(double a, double b) { double r = 0.0; double absA = Math.abs(a); double absB = Math.abs(b); if (absA > absB) { r = b / a; r = absA * Math.sqrt(1 + r * r); } else if (b != 0) { r = a / b; r = absB * Math.sqrt(1 + r * r); } return r; }
[ "public", "static", "double", "Hypotenuse", "(", "double", "a", ",", "double", "b", ")", "{", "double", "r", "=", "0.0", ";", "double", "absA", "=", "Math", ".", "abs", "(", "a", ")", ";", "double", "absB", "=", "Math", ".", "abs", "(", "b", ")",...
Hypotenuse calculus without overflow/underflow. @param a First value. @param b Second value. @return The hypotenuse Sqrt(a^2 + b^2).
[ "Hypotenuse", "calculus", "without", "overflow", "/", "underflow", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L561-L575
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java
ShardingEncryptorStrategy.getAssistedQueryColumn
public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) { """ Get assisted query column. @param logicTableName logic table name @param columnName column name @return assisted query column """ if (assistedQueryColumns.isEmpty()) { return Optional.absent(); } for (ColumnNode each : columns) { ColumnNode target = new ColumnNode(logicTableName, columnName); if (each.equals(target)) { return Optional.of(assistedQueryColumns.get(columns.indexOf(target)).getColumnName()); } } return Optional.absent(); }
java
public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) { if (assistedQueryColumns.isEmpty()) { return Optional.absent(); } for (ColumnNode each : columns) { ColumnNode target = new ColumnNode(logicTableName, columnName); if (each.equals(target)) { return Optional.of(assistedQueryColumns.get(columns.indexOf(target)).getColumnName()); } } return Optional.absent(); }
[ "public", "Optional", "<", "String", ">", "getAssistedQueryColumn", "(", "final", "String", "logicTableName", ",", "final", "String", "columnName", ")", "{", "if", "(", "assistedQueryColumns", ".", "isEmpty", "(", ")", ")", "{", "return", "Optional", ".", "abs...
Get assisted query column. @param logicTableName logic table name @param columnName column name @return assisted query column
[ "Get", "assisted", "query", "column", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java#L107-L118
Alluxio/alluxio
underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java
HdfsUnderFileSystem.createConfiguration
public static Configuration createConfiguration(UnderFileSystemConfiguration conf) { """ Prepares the Hadoop configuration necessary to successfully obtain a {@link FileSystem} instance that can access the provided path. <p> Derived implementations that work with specialised Hadoop {@linkplain FileSystem} API compatible implementations can override this method to add implementation specific configuration necessary for obtaining a usable {@linkplain FileSystem} instance. </p> @param conf the configuration for this UFS @return the configuration for HDFS """ Preconditions.checkNotNull(conf, "conf"); Configuration hdfsConf = new Configuration(); // Load HDFS site properties from the given file and overwrite the default HDFS conf, // the path of this file can be passed through --option for (String path : conf.get(PropertyKey.UNDERFS_HDFS_CONFIGURATION).split(":")) { hdfsConf.addResource(new Path(path)); } // On Hadoop 2.x this is strictly unnecessary since it uses ServiceLoader to automatically // discover available file system implementations. However this configuration setting is // required for earlier Hadoop versions plus it is still honoured as an override even in 2.x so // if present propagate it to the Hadoop configuration String ufsHdfsImpl = conf.get(PropertyKey.UNDERFS_HDFS_IMPL); if (!StringUtils.isEmpty(ufsHdfsImpl)) { hdfsConf.set("fs.hdfs.impl", ufsHdfsImpl); } // Disable HDFS client caching so that input configuration is respected. Configurable from // system property hdfsConf.set("fs.hdfs.impl.disable.cache", System.getProperty("fs.hdfs.impl.disable.cache", "true")); // Set all parameters passed through --option for (Map.Entry<String, String> entry : conf.getMountSpecificConf().entrySet()) { hdfsConf.set(entry.getKey(), entry.getValue()); } return hdfsConf; }
java
public static Configuration createConfiguration(UnderFileSystemConfiguration conf) { Preconditions.checkNotNull(conf, "conf"); Configuration hdfsConf = new Configuration(); // Load HDFS site properties from the given file and overwrite the default HDFS conf, // the path of this file can be passed through --option for (String path : conf.get(PropertyKey.UNDERFS_HDFS_CONFIGURATION).split(":")) { hdfsConf.addResource(new Path(path)); } // On Hadoop 2.x this is strictly unnecessary since it uses ServiceLoader to automatically // discover available file system implementations. However this configuration setting is // required for earlier Hadoop versions plus it is still honoured as an override even in 2.x so // if present propagate it to the Hadoop configuration String ufsHdfsImpl = conf.get(PropertyKey.UNDERFS_HDFS_IMPL); if (!StringUtils.isEmpty(ufsHdfsImpl)) { hdfsConf.set("fs.hdfs.impl", ufsHdfsImpl); } // Disable HDFS client caching so that input configuration is respected. Configurable from // system property hdfsConf.set("fs.hdfs.impl.disable.cache", System.getProperty("fs.hdfs.impl.disable.cache", "true")); // Set all parameters passed through --option for (Map.Entry<String, String> entry : conf.getMountSpecificConf().entrySet()) { hdfsConf.set(entry.getKey(), entry.getValue()); } return hdfsConf; }
[ "public", "static", "Configuration", "createConfiguration", "(", "UnderFileSystemConfiguration", "conf", ")", "{", "Preconditions", ".", "checkNotNull", "(", "conf", ",", "\"conf\"", ")", ";", "Configuration", "hdfsConf", "=", "new", "Configuration", "(", ")", ";", ...
Prepares the Hadoop configuration necessary to successfully obtain a {@link FileSystem} instance that can access the provided path. <p> Derived implementations that work with specialised Hadoop {@linkplain FileSystem} API compatible implementations can override this method to add implementation specific configuration necessary for obtaining a usable {@linkplain FileSystem} instance. </p> @param conf the configuration for this UFS @return the configuration for HDFS
[ "Prepares", "the", "Hadoop", "configuration", "necessary", "to", "successfully", "obtain", "a", "{", "@link", "FileSystem", "}", "instance", "that", "can", "access", "the", "provided", "path", ".", "<p", ">", "Derived", "implementations", "that", "work", "with",...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/hdfs/src/main/java/alluxio/underfs/hdfs/HdfsUnderFileSystem.java#L206-L235
QSFT/Doradus
doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DynamoDBService.java
DynamoDBService.deleteRow
void deleteRow(String storeName, Map<String, AttributeValue> key) { """ Delete row and back off if ProvisionedThroughputExceededException occurs. """ String tableName = storeToTableName(storeName); m_logger.debug("Deleting row from table {}, key={}", tableName, DynamoDBService.getDDBKey(key)); Timer timer = new Timer(); boolean bSuccess = false; for (int attempts = 1; !bSuccess; attempts++) { try { m_ddbClient.deleteItem(tableName, key); if (attempts > 1) { m_logger.info("deleteRow() succeeded on attempt #{}", attempts); } bSuccess = true; m_logger.debug("Time to delete table {}, key={}: {}", new Object[]{tableName, DynamoDBService.getDDBKey(key), timer.toString()}); } catch (ProvisionedThroughputExceededException e) { if (attempts >= m_max_commit_attempts) { String errMsg = "All retries exceeded; abandoning deleteRow() for table: " + tableName; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } m_logger.warn("deleteRow() attempt #{} failed: {}", attempts, e); try { Thread.sleep(attempts * m_retry_wait_millis); } catch (InterruptedException ex2) { // ignore } } } }
java
void deleteRow(String storeName, Map<String, AttributeValue> key) { String tableName = storeToTableName(storeName); m_logger.debug("Deleting row from table {}, key={}", tableName, DynamoDBService.getDDBKey(key)); Timer timer = new Timer(); boolean bSuccess = false; for (int attempts = 1; !bSuccess; attempts++) { try { m_ddbClient.deleteItem(tableName, key); if (attempts > 1) { m_logger.info("deleteRow() succeeded on attempt #{}", attempts); } bSuccess = true; m_logger.debug("Time to delete table {}, key={}: {}", new Object[]{tableName, DynamoDBService.getDDBKey(key), timer.toString()}); } catch (ProvisionedThroughputExceededException e) { if (attempts >= m_max_commit_attempts) { String errMsg = "All retries exceeded; abandoning deleteRow() for table: " + tableName; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } m_logger.warn("deleteRow() attempt #{} failed: {}", attempts, e); try { Thread.sleep(attempts * m_retry_wait_millis); } catch (InterruptedException ex2) { // ignore } } } }
[ "void", "deleteRow", "(", "String", "storeName", ",", "Map", "<", "String", ",", "AttributeValue", ">", "key", ")", "{", "String", "tableName", "=", "storeToTableName", "(", "storeName", ")", ";", "m_logger", ".", "debug", "(", "\"Deleting row from table {}, key...
Delete row and back off if ProvisionedThroughputExceededException occurs.
[ "Delete", "row", "and", "back", "off", "if", "ProvisionedThroughputExceededException", "occurs", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-dynamodb/src/main/java/com/dell/doradus/db/dynamodb/DynamoDBService.java#L283-L312
rolfl/MicroBench
src/main/java/net/tuis/ubench/UBench.java
UBench.addLongTask
public UBench addLongTask(String name, LongSupplier task, LongPredicate check) { """ Include a long-specialized named task (and validator) in to the benchmark. @param name The name of the task. Only one task with any one name is allowed. @param task The task to perform @param check The check of the results from the task. @return The same object, for chaining calls. """ return putTask(name, () -> { long start = System.nanoTime(); long result = task.getAsLong(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %d", name, result)); } return time; }); }
java
public UBench addLongTask(String name, LongSupplier task, LongPredicate check) { return putTask(name, () -> { long start = System.nanoTime(); long result = task.getAsLong(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %d", name, result)); } return time; }); }
[ "public", "UBench", "addLongTask", "(", "String", "name", ",", "LongSupplier", "task", ",", "LongPredicate", "check", ")", "{", "return", "putTask", "(", "name", ",", "(", ")", "->", "{", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", ...
Include a long-specialized named task (and validator) in to the benchmark. @param name The name of the task. Only one task with any one name is allowed. @param task The task to perform @param check The check of the results from the task. @return The same object, for chaining calls.
[ "Include", "a", "long", "-", "specialized", "named", "task", "(", "and", "validator", ")", "in", "to", "the", "benchmark", "." ]
train
https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L209-L219
alkacon/opencms-core
src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java
CmsSitemapExtensionConnector.openPageCopyDialog
public void openPageCopyDialog(String id, JavaScriptObject callback) { """ Opens the page copy dialog.<p> @param id the structure id of the resource for which to open the dialog @param callback the native callback to call with the result when the dialog has finished """ openPageCopyDialog(id, CmsJsUtil.wrapCallback(callback)); }
java
public void openPageCopyDialog(String id, JavaScriptObject callback) { openPageCopyDialog(id, CmsJsUtil.wrapCallback(callback)); }
[ "public", "void", "openPageCopyDialog", "(", "String", "id", ",", "JavaScriptObject", "callback", ")", "{", "openPageCopyDialog", "(", "id", ",", "CmsJsUtil", ".", "wrapCallback", "(", "callback", ")", ")", ";", "}" ]
Opens the page copy dialog.<p> @param id the structure id of the resource for which to open the dialog @param callback the native callback to call with the result when the dialog has finished
[ "Opens", "the", "page", "copy", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java#L125-L128
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/UpdatableHeap.java
UpdatableHeap.offerAt
protected void offerAt(final int pos, O e) { """ Offer element at the given position. @param pos Position @param e Element """ if(pos == NO_VALUE) { // resize when needed if(size + 1 > queue.length) { resize(size + 1); } index.put(e, size); size++; heapifyUp(size - 1, e); heapModified(); return; } assert (pos >= 0) : "Unexpected negative position."; assert (queue[pos].equals(e)); // Did the value improve? if(comparator.compare(e, queue[pos]) >= 0) { return; } heapifyUp(pos, e); heapModified(); return; }
java
protected void offerAt(final int pos, O e) { if(pos == NO_VALUE) { // resize when needed if(size + 1 > queue.length) { resize(size + 1); } index.put(e, size); size++; heapifyUp(size - 1, e); heapModified(); return; } assert (pos >= 0) : "Unexpected negative position."; assert (queue[pos].equals(e)); // Did the value improve? if(comparator.compare(e, queue[pos]) >= 0) { return; } heapifyUp(pos, e); heapModified(); return; }
[ "protected", "void", "offerAt", "(", "final", "int", "pos", ",", "O", "e", ")", "{", "if", "(", "pos", "==", "NO_VALUE", ")", "{", "// resize when needed", "if", "(", "size", "+", "1", ">", "queue", ".", "length", ")", "{", "resize", "(", "size", "...
Offer element at the given position. @param pos Position @param e Element
[ "Offer", "element", "at", "the", "given", "position", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/heap/UpdatableHeap.java#L111-L132
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.createSignatureBaseString
public String createSignatureBaseString(String requestMethod, String baseUrl, Map<String, String> parameters) { """ Per {@link https://dev.twitter.com/oauth/overview/creating-signatures}, a signature for an authorized request takes the following form: [HTTP Method] + "&" + [Percent encoded URL] + "&" + [Percent encoded parameter string] - HTTP Method: Request method (either "GET" or "POST"). Must be in uppercase. - Percent encoded URL: Base URL to which the request is directed, minus any query string or hash parameters. Be sure the URL uses the correct protocol (http or https) that matches the actual request sent to the Twitter API. - Percent encoded parameter string: Each request parameter name and value is percent encoded according to a specific structure @param requestMethod @param baseUrl Raw base URL, not percent encoded. This method will perform the percent encoding. @param parameters Raw parameter names and values, not percent encoded. This method will perform the percent encoding. @return """ if (requestMethod == null || (!requestMethod.equalsIgnoreCase("GET") && !requestMethod.equalsIgnoreCase("POST"))) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Request method was not an expected value (GET or POST) so defaulting to POST"); } requestMethod = "POST"; } String cleanedUrl = removeQueryAndFragment(baseUrl); String parameterString = createParameterStringForSignature(parameters); StringBuilder signatureBaseString = new StringBuilder(); signatureBaseString.append(requestMethod.toUpperCase()); signatureBaseString.append("&"); signatureBaseString.append(Utils.percentEncode(cleanedUrl)); signatureBaseString.append("&"); signatureBaseString.append(Utils.percentEncode(parameterString)); return signatureBaseString.toString(); }
java
public String createSignatureBaseString(String requestMethod, String baseUrl, Map<String, String> parameters) { if (requestMethod == null || (!requestMethod.equalsIgnoreCase("GET") && !requestMethod.equalsIgnoreCase("POST"))) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Request method was not an expected value (GET or POST) so defaulting to POST"); } requestMethod = "POST"; } String cleanedUrl = removeQueryAndFragment(baseUrl); String parameterString = createParameterStringForSignature(parameters); StringBuilder signatureBaseString = new StringBuilder(); signatureBaseString.append(requestMethod.toUpperCase()); signatureBaseString.append("&"); signatureBaseString.append(Utils.percentEncode(cleanedUrl)); signatureBaseString.append("&"); signatureBaseString.append(Utils.percentEncode(parameterString)); return signatureBaseString.toString(); }
[ "public", "String", "createSignatureBaseString", "(", "String", "requestMethod", ",", "String", "baseUrl", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "if", "(", "requestMethod", "==", "null", "||", "(", "!", "requestMethod", ".", ...
Per {@link https://dev.twitter.com/oauth/overview/creating-signatures}, a signature for an authorized request takes the following form: [HTTP Method] + "&" + [Percent encoded URL] + "&" + [Percent encoded parameter string] - HTTP Method: Request method (either "GET" or "POST"). Must be in uppercase. - Percent encoded URL: Base URL to which the request is directed, minus any query string or hash parameters. Be sure the URL uses the correct protocol (http or https) that matches the actual request sent to the Twitter API. - Percent encoded parameter string: Each request parameter name and value is percent encoded according to a specific structure @param requestMethod @param baseUrl Raw base URL, not percent encoded. This method will perform the percent encoding. @param parameters Raw parameter names and values, not percent encoded. This method will perform the percent encoding. @return
[ "Per", "{", "@link", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "oauth", "/", "overview", "/", "creating", "-", "signatures", "}", "a", "signature", "for", "an", "authorized", "request", "takes", "the", "following", "form", ":" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L244-L263
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopic
public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException { """ Process Access Topic Controller @param ctx @param topic @throws IllegalAccessException """ boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic); boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic); boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic); if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) { logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic); } }
java
public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException { boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic); boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic); boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic); if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) { logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic); } }
[ "public", "void", "checkAccessTopic", "(", "UserContext", "ctx", ",", "String", "topic", ")", "throws", "IllegalAccessException", "{", "boolean", "tacPresent0", "=", "checkAccessTopicGlobalAC", "(", "ctx", ",", "topic", ")", ";", "boolean", "tacPresent1", "=", "ch...
Process Access Topic Controller @param ctx @param topic @throws IllegalAccessException
[ "Process", "Access", "Topic", "Controller" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L51-L58
sirthias/parboiled
parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java
AsmUtils.isAssignableTo
public static boolean isAssignableTo(String classInternalName, Class<?> type) { """ Determines whether the class with the given descriptor is assignable to the given type. @param classInternalName the class descriptor @param type the type @return true if the class with the given descriptor is assignable to the given type """ checkArgNotNull(classInternalName, "classInternalName"); checkArgNotNull(type, "type"); return type.isAssignableFrom(getClassForInternalName(classInternalName)); }
java
public static boolean isAssignableTo(String classInternalName, Class<?> type) { checkArgNotNull(classInternalName, "classInternalName"); checkArgNotNull(type, "type"); return type.isAssignableFrom(getClassForInternalName(classInternalName)); }
[ "public", "static", "boolean", "isAssignableTo", "(", "String", "classInternalName", ",", "Class", "<", "?", ">", "type", ")", "{", "checkArgNotNull", "(", "classInternalName", ",", "\"classInternalName\"", ")", ";", "checkArgNotNull", "(", "type", ",", "\"type\""...
Determines whether the class with the given descriptor is assignable to the given type. @param classInternalName the class descriptor @param type the type @return true if the class with the given descriptor is assignable to the given type
[ "Determines", "whether", "the", "class", "with", "the", "given", "descriptor", "is", "assignable", "to", "the", "given", "type", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java#L295-L299
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.getStreamsByUsername
public void getStreamsByUsername(String username, int pageNumber, int itemsPerPage, final KickflipCallback cb) { """ Get a List of {@link io.kickflip.sdk.api.json.Stream} objects created by the given Kickflip User. @param username the target Kickflip username @param cb A callback to receive the resulting List of Streams """ if (!assertActiveUserAvailable(cb)) return; GenericData data = new GenericData(); addPaginationData(pageNumber, itemsPerPage, data); data.put("uuid", getActiveUser().getUUID()); data.put("username", username); post(SEARCH_USER, new UrlEncodedContent(data), StreamList.class, cb); }
java
public void getStreamsByUsername(String username, int pageNumber, int itemsPerPage, final KickflipCallback cb) { if (!assertActiveUserAvailable(cb)) return; GenericData data = new GenericData(); addPaginationData(pageNumber, itemsPerPage, data); data.put("uuid", getActiveUser().getUUID()); data.put("username", username); post(SEARCH_USER, new UrlEncodedContent(data), StreamList.class, cb); }
[ "public", "void", "getStreamsByUsername", "(", "String", "username", ",", "int", "pageNumber", ",", "int", "itemsPerPage", ",", "final", "KickflipCallback", "cb", ")", "{", "if", "(", "!", "assertActiveUserAvailable", "(", "cb", ")", ")", "return", ";", "Gener...
Get a List of {@link io.kickflip.sdk.api.json.Stream} objects created by the given Kickflip User. @param username the target Kickflip username @param cb A callback to receive the resulting List of Streams
[ "Get", "a", "List", "of", "{", "@link", "io", ".", "kickflip", ".", "sdk", ".", "api", ".", "json", ".", "Stream", "}", "objects", "created", "by", "the", "given", "Kickflip", "User", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L489-L496
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/router/Router.java
Router.convertCBLQueryRowsToMaps
private static void convertCBLQueryRowsToMaps(Map<String, Object> allDocsResult) { """ This is a hack to deal with the fact that there is currently no custom serializer for QueryRow. Instead, just convert everything to generic Maps. """ List<Map<String, Object>> rowsAsMaps = new ArrayList<Map<String, Object>>(); List<QueryRow> rows = (List<QueryRow>) allDocsResult.get("rows"); if (rows != null) { for (QueryRow row : rows) { rowsAsMaps.add(row.asJSONDictionary()); } } allDocsResult.put("rows", rowsAsMaps); }
java
private static void convertCBLQueryRowsToMaps(Map<String, Object> allDocsResult) { List<Map<String, Object>> rowsAsMaps = new ArrayList<Map<String, Object>>(); List<QueryRow> rows = (List<QueryRow>) allDocsResult.get("rows"); if (rows != null) { for (QueryRow row : rows) { rowsAsMaps.add(row.asJSONDictionary()); } } allDocsResult.put("rows", rowsAsMaps); }
[ "private", "static", "void", "convertCBLQueryRowsToMaps", "(", "Map", "<", "String", ",", "Object", ">", "allDocsResult", ")", "{", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "rowsAsMaps", "=", "new", "ArrayList", "<", "Map", "<", "String"...
This is a hack to deal with the fact that there is currently no custom serializer for QueryRow. Instead, just convert everything to generic Maps.
[ "This", "is", "a", "hack", "to", "deal", "with", "the", "fact", "that", "there", "is", "currently", "no", "custom", "serializer", "for", "QueryRow", ".", "Instead", "just", "convert", "everything", "to", "generic", "Maps", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/router/Router.java#L1196-L1205
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.getDisplayNames
public SortedMap<String, String> getDisplayNames() { """ Convenience override of getDisplayNames(ULocale, Comparator, String) that uses the current default Locale as the locale, null as the comparator, and null for the matchID. """ ULocale locale = ULocale.getDefault(Category.DISPLAY); return getDisplayNames(locale, null, null); }
java
public SortedMap<String, String> getDisplayNames() { ULocale locale = ULocale.getDefault(Category.DISPLAY); return getDisplayNames(locale, null, null); }
[ "public", "SortedMap", "<", "String", ",", "String", ">", "getDisplayNames", "(", ")", "{", "ULocale", "locale", "=", "ULocale", ".", "getDefault", "(", "Category", ".", "DISPLAY", ")", ";", "return", "getDisplayNames", "(", "locale", ",", "null", ",", "nu...
Convenience override of getDisplayNames(ULocale, Comparator, String) that uses the current default Locale as the locale, null as the comparator, and null for the matchID.
[ "Convenience", "override", "of", "getDisplayNames", "(", "ULocale", "Comparator", "String", ")", "that", "uses", "the", "current", "default", "Locale", "as", "the", "locale", "null", "as", "the", "comparator", "and", "null", "for", "the", "matchID", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L643-L646
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.generateMapFile
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { """ Generate a map file from a jar file. @param jarFile jar file @param mapFileName map file name @param mapClassMethods true if we want to produce .Net style class method names @throws XMLStreamException @throws IOException @throws ClassNotFoundException @throws IntrospectionException """ m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
java
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
[ "public", "void", "generateMapFile", "(", "File", "jarFile", ",", "String", "mapFileName", ",", "boolean", "mapClassMethods", ")", "throws", "XMLStreamException", ",", "IOException", ",", "ClassNotFoundException", ",", "IntrospectionException", "{", "m_responseList", "=...
Generate a map file from a jar file. @param jarFile jar file @param mapFileName map file name @param mapClassMethods true if we want to produce .Net style class method names @throws XMLStreamException @throws IOException @throws ClassNotFoundException @throws IntrospectionException
[ "Generate", "a", "map", "file", "from", "a", "jar", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L94-L98
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
ToStringStyle.appendDetail
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) { """ <p>Append to the <code>toString</code> an <code>Object</code> value, printing the full detail of the <code>Object</code>.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code> """ buffer.append(value); }
java
protected void appendDetail(final StringBuffer buffer, final String fieldName, final Object value) { buffer.append(value); }
[ "protected", "void", "appendDetail", "(", "final", "StringBuffer", "buffer", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "buffer", ".", "append", "(", "value", ")", ";", "}" ]
<p>Append to the <code>toString</code> an <code>Object</code> value, printing the full detail of the <code>Object</code>.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code>
[ "<p", ">", "Append", "to", "the", "<code", ">", "toString<", "/", "code", ">", "an", "<code", ">", "Object<", "/", "code", ">", "value", "printing", "the", "full", "detail", "of", "the", "<code", ">", "Object<", "/", "code", ">", ".", "<", "/", "p"...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java#L625-L627
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.isPotentialVarArgsMethod
private static boolean isPotentialVarArgsMethod(Method method, Object[] arguments) { """ Checks if is potential var args method. @param method the method @param arguments the arguments @return true, if is potential var args method """ return doesParameterTypesMatchForVarArgsInvocation(method.isVarArgs(), method.getParameterTypes(), arguments); }
java
private static boolean isPotentialVarArgsMethod(Method method, Object[] arguments) { return doesParameterTypesMatchForVarArgsInvocation(method.isVarArgs(), method.getParameterTypes(), arguments); }
[ "private", "static", "boolean", "isPotentialVarArgsMethod", "(", "Method", "method", ",", "Object", "[", "]", "arguments", ")", "{", "return", "doesParameterTypesMatchForVarArgsInvocation", "(", "method", ".", "isVarArgs", "(", ")", ",", "method", ".", "getParameter...
Checks if is potential var args method. @param method the method @param arguments the arguments @return true, if is potential var args method
[ "Checks", "if", "is", "potential", "var", "args", "method", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2387-L2389
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java
BridgedTransportManager.sessionEstablished
@Override public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException { """ Implement a Session Listener to relay candidates after establishment """ RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); }
java
@Override public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); }
[ "@", "Override", "public", "void", "sessionEstablished", "(", "PayloadType", "pt", ",", "TransportCandidate", "rc", ",", "TransportCandidate", "lc", ",", "JingleSession", "jingleSession", ")", "throws", "NotConnectedException", ",", "InterruptedException", "{", "RTPBrid...
Implement a Session Listener to relay candidates after establishment
[ "Implement", "a", "Session", "Listener", "to", "relay", "candidates", "after", "establishment" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/BridgedTransportManager.java#L58-L61
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForSubscriptionLevelPolicyAssignment
public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { """ Queries policy states for the subscription level policy assignment. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param policyAssignmentName Policy assignment name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful. """ return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); }
java
public PolicyStatesQueryResultsInner listQueryResultsForSubscriptionLevelPolicyAssignment(PolicyStatesResource policyStatesResource, String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) { return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, policyAssignmentName, queryOptions).toBlocking().single().body(); }
[ "public", "PolicyStatesQueryResultsInner", "listQueryResultsForSubscriptionLevelPolicyAssignment", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "subscriptionId", ",", "String", "policyAssignmentName", ",", "QueryOptions", "queryOptions", ")", "{", "return", ...
Queries policy states for the subscription level policy assignment. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param policyAssignmentName Policy assignment name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful.
[ "Queries", "policy", "states", "for", "the", "subscription", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2567-L2569
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java
Bzip2BitWriter.writeBoolean
void writeBoolean(ByteBuf out, final boolean value) { """ Writes a single bit to the output {@link ByteBuf}. @param value The bit to write """ int bitCount = this.bitCount + 1; long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L); if (bitCount == 32) { out.writeInt((int) (bitBuffer >>> 32)); bitBuffer = 0; bitCount = 0; } this.bitBuffer = bitBuffer; this.bitCount = bitCount; }
java
void writeBoolean(ByteBuf out, final boolean value) { int bitCount = this.bitCount + 1; long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L); if (bitCount == 32) { out.writeInt((int) (bitBuffer >>> 32)); bitBuffer = 0; bitCount = 0; } this.bitBuffer = bitBuffer; this.bitCount = bitCount; }
[ "void", "writeBoolean", "(", "ByteBuf", "out", ",", "final", "boolean", "value", ")", "{", "int", "bitCount", "=", "this", ".", "bitCount", "+", "1", ";", "long", "bitBuffer", "=", "this", ".", "bitBuffer", "|", "(", "value", "?", "1L", "<<", "64", "...
Writes a single bit to the output {@link ByteBuf}. @param value The bit to write
[ "Writes", "a", "single", "bit", "to", "the", "output", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L62-L73
pushbit/sprockets
src/main/java/net/sf/sprockets/util/Elements.java
Elements.addAll
public static boolean addAll(LongCollection collection, long[] array) { """ Add all elements in the array to the collection. @return true if the collection was changed @since 2.6.0 """ boolean changed = false; for (long element : array) { changed |= collection.add(element); } return changed; }
java
public static boolean addAll(LongCollection collection, long[] array) { boolean changed = false; for (long element : array) { changed |= collection.add(element); } return changed; }
[ "public", "static", "boolean", "addAll", "(", "LongCollection", "collection", ",", "long", "[", "]", "array", ")", "{", "boolean", "changed", "=", "false", ";", "for", "(", "long", "element", ":", "array", ")", "{", "changed", "|=", "collection", ".", "a...
Add all elements in the array to the collection. @return true if the collection was changed @since 2.6.0
[ "Add", "all", "elements", "in", "the", "array", "to", "the", "collection", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L44-L50
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/SetProperty.java
SetProperty.encodeSingleElement
public VALUETO encodeSingleElement(VALUEFROM javaValue, Optional<CassandraOptions> cassandraOptions) { """ Encode the single element of the set to a CQL-compatible value using Achilles codec system and a CassandraOptions containing a runtime SchemaNameProvider. Use the <br/> <br/> <pre class="code"><code class="java"> CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider) </code></pre> <br/> static method to build such a CassandraOptions instance @param javaValue @param cassandraOptions @return """ return valueProperty.encodeFromRaw(javaValue, cassandraOptions); }
java
public VALUETO encodeSingleElement(VALUEFROM javaValue, Optional<CassandraOptions> cassandraOptions) { return valueProperty.encodeFromRaw(javaValue, cassandraOptions); }
[ "public", "VALUETO", "encodeSingleElement", "(", "VALUEFROM", "javaValue", ",", "Optional", "<", "CassandraOptions", ">", "cassandraOptions", ")", "{", "return", "valueProperty", ".", "encodeFromRaw", "(", "javaValue", ",", "cassandraOptions", ")", ";", "}" ]
Encode the single element of the set to a CQL-compatible value using Achilles codec system and a CassandraOptions containing a runtime SchemaNameProvider. Use the <br/> <br/> <pre class="code"><code class="java"> CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider) </code></pre> <br/> static method to build such a CassandraOptions instance @param javaValue @param cassandraOptions @return
[ "Encode", "the", "single", "element", "of", "the", "set", "to", "a", "CQL", "-", "compatible", "value", "using", "Achilles", "codec", "system", "and", "a", "CassandraOptions", "containing", "a", "runtime", "SchemaNameProvider", ".", "Use", "the", "<br", "/", ...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/SetProperty.java#L96-L98
box/box-java-sdk
src/main/java/com/box/sdk/BoxTrash.java
BoxTrash.restoreFile
public BoxFile.Info restoreFile(String fileID, String newName, String newParentID) { """ Restores a trashed file to a new location with a new name. @param fileID the ID of the trashed file. @param newName an optional new name to give the file. This can be null to use the file's original name. @param newParentID an optional new parent ID for the file. This can be null to use the file's original parent. @return info about the restored file. """ JsonObject requestJSON = new JsonObject(); if (newName != null) { requestJSON.add("name", newName); } if (newParentID != null) { JsonObject parent = new JsonObject(); parent.add("id", newParentID); requestJSON.add("parent", parent); } URL url = RESTORE_FILE_URL_TEMPLATE.build(this.api.getBaseURL(), fileID); BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxFile restoredFile = new BoxFile(this.api, responseJSON.get("id").asString()); return restoredFile.new Info(responseJSON); }
java
public BoxFile.Info restoreFile(String fileID, String newName, String newParentID) { JsonObject requestJSON = new JsonObject(); if (newName != null) { requestJSON.add("name", newName); } if (newParentID != null) { JsonObject parent = new JsonObject(); parent.add("id", newParentID); requestJSON.add("parent", parent); } URL url = RESTORE_FILE_URL_TEMPLATE.build(this.api.getBaseURL(), fileID); BoxJSONRequest request = new BoxJSONRequest(this.api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxFile restoredFile = new BoxFile(this.api, responseJSON.get("id").asString()); return restoredFile.new Info(responseJSON); }
[ "public", "BoxFile", ".", "Info", "restoreFile", "(", "String", "fileID", ",", "String", "newName", ",", "String", "newParentID", ")", "{", "JsonObject", "requestJSON", "=", "new", "JsonObject", "(", ")", ";", "if", "(", "newName", "!=", "null", ")", "{", ...
Restores a trashed file to a new location with a new name. @param fileID the ID of the trashed file. @param newName an optional new name to give the file. This can be null to use the file's original name. @param newParentID an optional new parent ID for the file. This can be null to use the file's original parent. @return info about the restored file.
[ "Restores", "a", "trashed", "file", "to", "a", "new", "location", "with", "a", "new", "name", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L210-L231
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java
EJBJavaColonNamingHelper.addModuleBinding
public void addModuleBinding(ModuleMetaData mmd, String name, EJBBinding bindingObject) { """ Add a java:module binding to the map. Lock not required since the the map is unique to one module. @param mmd module meta data @param name lookup name @param bindingObject """ JavaColonNamespaceBindings<EJBBinding> bindingMap = getModuleBindingMap(mmd); bindingMap.bind(name, bindingObject); }
java
public void addModuleBinding(ModuleMetaData mmd, String name, EJBBinding bindingObject) { JavaColonNamespaceBindings<EJBBinding> bindingMap = getModuleBindingMap(mmd); bindingMap.bind(name, bindingObject); }
[ "public", "void", "addModuleBinding", "(", "ModuleMetaData", "mmd", ",", "String", "name", ",", "EJBBinding", "bindingObject", ")", "{", "JavaColonNamespaceBindings", "<", "EJBBinding", ">", "bindingMap", "=", "getModuleBindingMap", "(", "mmd", ")", ";", "bindingMap...
Add a java:module binding to the map. Lock not required since the the map is unique to one module. @param mmd module meta data @param name lookup name @param bindingObject
[ "Add", "a", "java", ":", "module", "binding", "to", "the", "map", ".", "Lock", "not", "required", "since", "the", "the", "map", "is", "unique", "to", "one", "module", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/naming/EJBJavaColonNamingHelper.java#L405-L408
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfString.java
PdfString.toPdf
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { """ Writes the PDF representation of this <CODE>PdfString</CODE> as an array of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. @param writer for backwards compatibility @param os The <CODE>OutputStream</CODE> to write the bytes to. """ byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
java
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
[ "public", "void", "toPdf", "(", "PdfWriter", "writer", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "b", "[", "]", "=", "getBytes", "(", ")", ";", "PdfEncryption", "crypto", "=", "null", ";", "if", "(", "writer", "!=", "null", ...
Writes the PDF representation of this <CODE>PdfString</CODE> as an array of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. @param writer for backwards compatibility @param os The <CODE>OutputStream</CODE> to write the bytes to.
[ "Writes", "the", "PDF", "representation", "of", "this", "<CODE", ">", "PdfString<", "/", "CODE", ">", "as", "an", "array", "of", "<CODE", ">", "byte<", "/", "CODE", ">", "to", "the", "specified", "<CODE", ">", "OutputStream<", "/", "CODE", ">", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfString.java#L144-L162
yan74/afplib
org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java
BaseValidator.validateModcaString32_MinLength
public boolean validateModcaString32_MinLength(String modcaString32, DiagnosticChain diagnostics, Map<Object, Object> context) { """ Validates the MinLength constraint of '<em>Modca String32</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated """ int length = modcaString32.length(); boolean result = length >= 32; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING32, modcaString32, length, 32, diagnostics, context); return result; }
java
public boolean validateModcaString32_MinLength(String modcaString32, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString32.length(); boolean result = length >= 32; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING32, modcaString32, length, 32, diagnostics, context); return result; }
[ "public", "boolean", "validateModcaString32_MinLength", "(", "String", "modcaString32", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "int", "length", "=", "modcaString32", ".", "length", "(", ")", ";"...
Validates the MinLength constraint of '<em>Modca String32</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "MinLength", "constraint", "of", "<em", ">", "Modca", "String32<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java#L264-L270
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java
StreamHelper.readStreamLines
@Nullable @ReturnsMutableCopy public static ICommonsList <String> readStreamLines (@Nullable final IHasInputStream aISP, @Nonnull final Charset aCharset) { """ Get the content of the passed Spring resource as one big string in the passed character set. @param aISP The resource to read. May not be <code>null</code>. @param aCharset The character set to use. May not be <code>null</code>. @return <code>null</code> if the resolved input stream is <code>null</code> , the content otherwise. """ return readStreamLines (aISP, aCharset, 0, CGlobal.ILLEGAL_UINT); }
java
@Nullable @ReturnsMutableCopy public static ICommonsList <String> readStreamLines (@Nullable final IHasInputStream aISP, @Nonnull final Charset aCharset) { return readStreamLines (aISP, aCharset, 0, CGlobal.ILLEGAL_UINT); }
[ "@", "Nullable", "@", "ReturnsMutableCopy", "public", "static", "ICommonsList", "<", "String", ">", "readStreamLines", "(", "@", "Nullable", "final", "IHasInputStream", "aISP", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "return", "readStreamLin...
Get the content of the passed Spring resource as one big string in the passed character set. @param aISP The resource to read. May not be <code>null</code>. @param aCharset The character set to use. May not be <code>null</code>. @return <code>null</code> if the resolved input stream is <code>null</code> , the content otherwise.
[ "Get", "the", "content", "of", "the", "passed", "Spring", "resource", "as", "one", "big", "string", "in", "the", "passed", "character", "set", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1019-L1025
alkacon/opencms-core
src/org/opencms/file/wrapper/A_CmsResourceExtensionWrapper.java
A_CmsResourceExtensionWrapper.getResource
private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) { """ Trys to read the resourcename after removing the file extension and return the resource if the type id is correct.<p> @param cms the initialized CmsObject @param resourcename the name of the resource to read @param filter the resource filter to use while reading @return the resource or null if not found """ CmsResource res = null; try { res = cms.readResource( CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()), filter); } catch (CmsException ex) { return null; } if (checkTypeId(res.getTypeId())) { return res; } return null; }
java
private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) { CmsResource res = null; try { res = cms.readResource( CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()), filter); } catch (CmsException ex) { return null; } if (checkTypeId(res.getTypeId())) { return res; } return null; }
[ "private", "CmsResource", "getResource", "(", "CmsObject", "cms", ",", "String", "resourcename", ",", "CmsResourceFilter", "filter", ")", "{", "CmsResource", "res", "=", "null", ";", "try", "{", "res", "=", "cms", ".", "readResource", "(", "CmsResourceWrapperUti...
Trys to read the resourcename after removing the file extension and return the resource if the type id is correct.<p> @param cms the initialized CmsObject @param resourcename the name of the resource to read @param filter the resource filter to use while reading @return the resource or null if not found
[ "Trys", "to", "read", "the", "resourcename", "after", "removing", "the", "file", "extension", "and", "return", "the", "resource", "if", "the", "type", "id", "is", "correct", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/A_CmsResourceExtensionWrapper.java#L335-L352
VoltDB/voltdb
src/frontend/org/voltdb/ProcedureRunnerNT.java
ProcedureRunnerNT.callAllNodeNTProcedure
protected CompletableFuture<Map<Integer,ClientResponse>> callAllNodeNTProcedure(String procName, Object... params) { """ Send an invocation directly to each host's CI mailbox. This ONLY works for NT procedures. Track responses and complete the returned future when they're all accounted for. """ // only one of these at a time if (!m_outstandingAllHostProc.compareAndSet(false, true)) { throw new VoltAbortException(new IllegalStateException("Only one AllNodeNTProcedure operation can be running at a time.")); } StoredProcedureInvocation invocation = new StoredProcedureInvocation(); invocation.setProcName(procName); invocation.setParams(params); invocation.setClientHandle(m_id); final Iv2InitiateTaskMessage workRequest = new Iv2InitiateTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), TransactionInfoBaseMessage.UNUSED_TRUNC_HANDLE, m_id, m_id, true, false, invocation, m_id, ClientInterface.NT_REMOTE_PROC_CID, false); m_allHostFut = new CompletableFuture<>(); m_allHostResponses = new HashMap<>(); // hold this lock while getting the count of live nodes // also held when long[] hsids; synchronized(m_allHostCallbackLock) { // collect the set of live client interface mailbox ids m_outstandingAllHostProcedureHostIds = VoltDB.instance().getHostMessenger().getLiveHostIds(); // convert host ids to hsids hsids = m_outstandingAllHostProcedureHostIds.stream() .mapToLong(hostId -> CoreUtils.getHSIdFromHostAndSite(hostId, HostMessenger.CLIENT_INTERFACE_SITE_ID)) .toArray(); } // send the invocation to all live nodes // n.b. can't combine this step with above because sometimes the callbacks comeback so fast // you get a concurrent modification exception for (long hsid : hsids) { m_mailbox.send(hsid, workRequest); } return m_allHostFut; }
java
protected CompletableFuture<Map<Integer,ClientResponse>> callAllNodeNTProcedure(String procName, Object... params) { // only one of these at a time if (!m_outstandingAllHostProc.compareAndSet(false, true)) { throw new VoltAbortException(new IllegalStateException("Only one AllNodeNTProcedure operation can be running at a time.")); } StoredProcedureInvocation invocation = new StoredProcedureInvocation(); invocation.setProcName(procName); invocation.setParams(params); invocation.setClientHandle(m_id); final Iv2InitiateTaskMessage workRequest = new Iv2InitiateTaskMessage(m_mailbox.getHSId(), m_mailbox.getHSId(), TransactionInfoBaseMessage.UNUSED_TRUNC_HANDLE, m_id, m_id, true, false, invocation, m_id, ClientInterface.NT_REMOTE_PROC_CID, false); m_allHostFut = new CompletableFuture<>(); m_allHostResponses = new HashMap<>(); // hold this lock while getting the count of live nodes // also held when long[] hsids; synchronized(m_allHostCallbackLock) { // collect the set of live client interface mailbox ids m_outstandingAllHostProcedureHostIds = VoltDB.instance().getHostMessenger().getLiveHostIds(); // convert host ids to hsids hsids = m_outstandingAllHostProcedureHostIds.stream() .mapToLong(hostId -> CoreUtils.getHSIdFromHostAndSite(hostId, HostMessenger.CLIENT_INTERFACE_SITE_ID)) .toArray(); } // send the invocation to all live nodes // n.b. can't combine this step with above because sometimes the callbacks comeback so fast // you get a concurrent modification exception for (long hsid : hsids) { m_mailbox.send(hsid, workRequest); } return m_allHostFut; }
[ "protected", "CompletableFuture", "<", "Map", "<", "Integer", ",", "ClientResponse", ">", ">", "callAllNodeNTProcedure", "(", "String", "procName", ",", "Object", "...", "params", ")", "{", "// only one of these at a time", "if", "(", "!", "m_outstandingAllHostProc", ...
Send an invocation directly to each host's CI mailbox. This ONLY works for NT procedures. Track responses and complete the returned future when they're all accounted for.
[ "Send", "an", "invocation", "directly", "to", "each", "host", "s", "CI", "mailbox", ".", "This", "ONLY", "works", "for", "NT", "procedures", ".", "Track", "responses", "and", "complete", "the", "returned", "future", "when", "they", "re", "all", "accounted", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ProcedureRunnerNT.java#L261-L308
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscaleprofile.java
autoscaleprofile.get
public static autoscaleprofile get(nitro_service service, String name) throws Exception { """ Use this API to fetch autoscaleprofile resource of given name . """ autoscaleprofile obj = new autoscaleprofile(); obj.set_name(name); autoscaleprofile response = (autoscaleprofile) obj.get_resource(service); return response; }
java
public static autoscaleprofile get(nitro_service service, String name) throws Exception{ autoscaleprofile obj = new autoscaleprofile(); obj.set_name(name); autoscaleprofile response = (autoscaleprofile) obj.get_resource(service); return response; }
[ "public", "static", "autoscaleprofile", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "autoscaleprofile", "obj", "=", "new", "autoscaleprofile", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "...
Use this API to fetch autoscaleprofile resource of given name .
[ "Use", "this", "API", "to", "fetch", "autoscaleprofile", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscaleprofile.java#L299-L304
casmi/casmi
src/main/java/casmi/graphics/element/Lines.java
Lines.setVertex
public void setVertex(int i, double x, double y) { """ Sets the coordinates of the point. @param i The index number of the point. @param x The x-coordinate of the point. @param y The y-coordinate of the point. """ this.x.set(i, x); this.y.set(i, y); this.z.set(i, 0d); calcG(); }
java
public void setVertex(int i, double x, double y) { this.x.set(i, x); this.y.set(i, y); this.z.set(i, 0d); calcG(); }
[ "public", "void", "setVertex", "(", "int", "i", ",", "double", "x", ",", "double", "y", ")", "{", "this", ".", "x", ".", "set", "(", "i", ",", "x", ")", ";", "this", ".", "y", ".", "set", "(", "i", ",", "y", ")", ";", "this", ".", "z", "....
Sets the coordinates of the point. @param i The index number of the point. @param x The x-coordinate of the point. @param y The y-coordinate of the point.
[ "Sets", "the", "coordinates", "of", "the", "point", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L151-L156
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java
ASTHelpers.isCheckedExceptionType
public static boolean isCheckedExceptionType(Type t, VisitorState state) { """ Returns true if {@code t} is a subtype of Exception but not a subtype of RuntimeException. """ Symtab symtab = state.getSymtab(); return isSubtype(t, symtab.exceptionType, state) && !isSubtype(t, symtab.runtimeExceptionType, state); }
java
public static boolean isCheckedExceptionType(Type t, VisitorState state) { Symtab symtab = state.getSymtab(); return isSubtype(t, symtab.exceptionType, state) && !isSubtype(t, symtab.runtimeExceptionType, state); }
[ "public", "static", "boolean", "isCheckedExceptionType", "(", "Type", "t", ",", "VisitorState", "state", ")", "{", "Symtab", "symtab", "=", "state", ".", "getSymtab", "(", ")", ";", "return", "isSubtype", "(", "t", ",", "symtab", ".", "exceptionType", ",", ...
Returns true if {@code t} is a subtype of Exception but not a subtype of RuntimeException.
[ "Returns", "true", "if", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L962-L966
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/object/DirectionsPane.java
DirectionsPane.addStateEventHandler
public void addStateEventHandler(MapStateEventType type, StateEventHandler h) { """ Adds a handler for a state type event on the map. <p> We could allow this to handle any state event by adding a parameter JavascriptObject obj, but we would then need to loosen up the event type and either accept a String value, or fill an enum with all potential state events. @param type Type of the event to register against. @param h Handler that will be called when the event occurs. """ String key = registerEventHandler(h); String mcall = "google.maps.event.addListener(" + getVariableName() + ", '" + type.name() + "', " + "function() {document.jsHandlers.handleStateEvent('" + key + "');});"; //System.out.println("addStateEventHandler mcall: " + mcall); runtime.execute(mcall); }
java
public void addStateEventHandler(MapStateEventType type, StateEventHandler h) { String key = registerEventHandler(h); String mcall = "google.maps.event.addListener(" + getVariableName() + ", '" + type.name() + "', " + "function() {document.jsHandlers.handleStateEvent('" + key + "');});"; //System.out.println("addStateEventHandler mcall: " + mcall); runtime.execute(mcall); }
[ "public", "void", "addStateEventHandler", "(", "MapStateEventType", "type", ",", "StateEventHandler", "h", ")", "{", "String", "key", "=", "registerEventHandler", "(", "h", ")", ";", "String", "mcall", "=", "\"google.maps.event.addListener(\"", "+", "getVariableName",...
Adds a handler for a state type event on the map. <p> We could allow this to handle any state event by adding a parameter JavascriptObject obj, but we would then need to loosen up the event type and either accept a String value, or fill an enum with all potential state events. @param type Type of the event to register against. @param h Handler that will be called when the event occurs.
[ "Adds", "a", "handler", "for", "a", "state", "type", "event", "on", "the", "map", ".", "<p", ">", "We", "could", "allow", "this", "to", "handle", "any", "state", "event", "by", "adding", "a", "parameter", "JavascriptObject", "obj", "but", "we", "would", ...
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/object/DirectionsPane.java#L257-L264
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java
TmdbSearch.searchCompanies
public ResultList<Company> searchCompanies(String query, Integer page) throws MovieDbException { """ Search Companies. You can use this method to search for production companies that are part of TMDb. The company IDs will map to those returned on movie calls. http://help.themoviedb.org/kb/api/search-companies @param query @param page @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.QUERY, query); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.COMPANY).buildUrl(parameters); WrapperGenericList<Company> wrapper = processWrapper(getTypeReference(Company.class), url, "company"); return wrapper.getResultsList(); }
java
public ResultList<Company> searchCompanies(String query, Integer page) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.QUERY, query); parameters.add(Param.PAGE, page); URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.COMPANY).buildUrl(parameters); WrapperGenericList<Company> wrapper = processWrapper(getTypeReference(Company.class), url, "company"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "Company", ">", "searchCompanies", "(", "String", "query", ",", "Integer", "page", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", ...
Search Companies. You can use this method to search for production companies that are part of TMDb. The company IDs will map to those returned on movie calls. http://help.themoviedb.org/kb/api/search-companies @param query @param page @return @throws MovieDbException
[ "Search", "Companies", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbSearch.java#L75-L83
meertensinstituut/mtas
src/main/java/mtas/codec/MtasFieldsProducer.java
MtasFieldsProducer.openMtasFile
private IndexInput openMtasFile(SegmentReadState state, String name, String extension) throws IOException { """ Open mtas file. @param state the state @param name the name @param extension the extension @return the index input @throws IOException Signals that an I/O exception has occurred. """ return openMtasFile(state, name, extension, null, null); }
java
private IndexInput openMtasFile(SegmentReadState state, String name, String extension) throws IOException { return openMtasFile(state, name, extension, null, null); }
[ "private", "IndexInput", "openMtasFile", "(", "SegmentReadState", "state", ",", "String", "name", ",", "String", "extension", ")", "throws", "IOException", "{", "return", "openMtasFile", "(", "state", ",", "name", ",", "extension", ",", "null", ",", "null", ")...
Open mtas file. @param state the state @param name the name @param extension the extension @return the index input @throws IOException Signals that an I/O exception has occurred.
[ "Open", "mtas", "file", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/MtasFieldsProducer.java#L279-L282
graknlabs/grakn
server/src/server/session/TransactionOLTP.java
TransactionOLTP.putSchemaConcept
private <T extends SchemaConcept> T putSchemaConcept(Label label, Schema.BaseType baseType, boolean isImplicit, Function<VertexElement, T> newConceptFactory) { """ This is a helper method which will either find or create a SchemaConcept. When a new SchemaConcept is created it is added for validation through it's own creation method for example RoleImpl#create(VertexElement, Role). <p> When an existing SchemaConcept is found it is build via it's get method such as RoleImpl#get(VertexElement) and skips validation. <p> Once the SchemaConcept is found or created a few checks for uniqueness and correct Schema.BaseType are performed. @param label The Label of the SchemaConcept to find or create @param baseType The Schema.BaseType of the SchemaConcept to find or create @param isImplicit a flag indicating if the label we are creating is for an implicit grakn.core.concept.type.Type or not @param newConceptFactory the factory to be using when creating a new SchemaConcept @param <T> The type of SchemaConcept to return @return a new or existing SchemaConcept """ //Get the type if it already exists otherwise build a new one SchemaConceptImpl schemaConcept = getSchemaConcept(convertToId(label)); if (schemaConcept == null) { if (!isImplicit && label.getValue().startsWith(Schema.ImplicitType.RESERVED.getValue())) { throw TransactionException.invalidLabelStart(label); } VertexElement vertexElement = addTypeVertex(getNextId(), label, baseType); //Mark it as implicit here so we don't have to pass it down the constructors if (isImplicit) { vertexElement.property(Schema.VertexProperty.IS_IMPLICIT, true); } // if the schema concept is not in janus, create it here schemaConcept = SchemaConceptImpl.from(newConceptFactory.apply(vertexElement)); } else if (!baseType.equals(schemaConcept.baseType())) { throw labelTaken(schemaConcept); } //noinspection unchecked return (T) schemaConcept; }
java
private <T extends SchemaConcept> T putSchemaConcept(Label label, Schema.BaseType baseType, boolean isImplicit, Function<VertexElement, T> newConceptFactory) { //Get the type if it already exists otherwise build a new one SchemaConceptImpl schemaConcept = getSchemaConcept(convertToId(label)); if (schemaConcept == null) { if (!isImplicit && label.getValue().startsWith(Schema.ImplicitType.RESERVED.getValue())) { throw TransactionException.invalidLabelStart(label); } VertexElement vertexElement = addTypeVertex(getNextId(), label, baseType); //Mark it as implicit here so we don't have to pass it down the constructors if (isImplicit) { vertexElement.property(Schema.VertexProperty.IS_IMPLICIT, true); } // if the schema concept is not in janus, create it here schemaConcept = SchemaConceptImpl.from(newConceptFactory.apply(vertexElement)); } else if (!baseType.equals(schemaConcept.baseType())) { throw labelTaken(schemaConcept); } //noinspection unchecked return (T) schemaConcept; }
[ "private", "<", "T", "extends", "SchemaConcept", ">", "T", "putSchemaConcept", "(", "Label", "label", ",", "Schema", ".", "BaseType", "baseType", ",", "boolean", "isImplicit", ",", "Function", "<", "VertexElement", ",", "T", ">", "newConceptFactory", ")", "{",...
This is a helper method which will either find or create a SchemaConcept. When a new SchemaConcept is created it is added for validation through it's own creation method for example RoleImpl#create(VertexElement, Role). <p> When an existing SchemaConcept is found it is build via it's get method such as RoleImpl#get(VertexElement) and skips validation. <p> Once the SchemaConcept is found or created a few checks for uniqueness and correct Schema.BaseType are performed. @param label The Label of the SchemaConcept to find or create @param baseType The Schema.BaseType of the SchemaConcept to find or create @param isImplicit a flag indicating if the label we are creating is for an implicit grakn.core.concept.type.Type or not @param newConceptFactory the factory to be using when creating a new SchemaConcept @param <T> The type of SchemaConcept to return @return a new or existing SchemaConcept
[ "This", "is", "a", "helper", "method", "which", "will", "either", "find", "or", "create", "a", "SchemaConcept", ".", "When", "a", "new", "SchemaConcept", "is", "created", "it", "is", "added", "for", "validation", "through", "it", "s", "own", "creation", "m...
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/TransactionOLTP.java#L516-L539
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/AccrueTypeUtility.java
AccrueTypeUtility.getInstance
public static AccrueType getInstance(String type, Locale locale) { """ This method takes the textual version of an accrue type name and populates the class instance appropriately. Note that unrecognised values are treated as "Prorated". @param type text version of the accrue type @param locale target locale @return AccrueType class instance """ AccrueType result = null; String[] typeNames = LocaleData.getStringArray(locale, LocaleData.ACCRUE_TYPES); for (int loop = 0; loop < typeNames.length; loop++) { if (typeNames[loop].equalsIgnoreCase(type) == true) { result = AccrueType.getInstance(loop + 1); break; } } if (result == null) { result = AccrueType.PRORATED; } return (result); }
java
public static AccrueType getInstance(String type, Locale locale) { AccrueType result = null; String[] typeNames = LocaleData.getStringArray(locale, LocaleData.ACCRUE_TYPES); for (int loop = 0; loop < typeNames.length; loop++) { if (typeNames[loop].equalsIgnoreCase(type) == true) { result = AccrueType.getInstance(loop + 1); break; } } if (result == null) { result = AccrueType.PRORATED; } return (result); }
[ "public", "static", "AccrueType", "getInstance", "(", "String", "type", ",", "Locale", "locale", ")", "{", "AccrueType", "result", "=", "null", ";", "String", "[", "]", "typeNames", "=", "LocaleData", ".", "getStringArray", "(", "locale", ",", "LocaleData", ...
This method takes the textual version of an accrue type name and populates the class instance appropriately. Note that unrecognised values are treated as "Prorated". @param type text version of the accrue type @param locale target locale @return AccrueType class instance
[ "This", "method", "takes", "the", "textual", "version", "of", "an", "accrue", "type", "name", "and", "populates", "the", "class", "instance", "appropriately", ".", "Note", "that", "unrecognised", "values", "are", "treated", "as", "Prorated", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/AccrueTypeUtility.java#L53-L74
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginCreateOrUpdate
public ApplicationGatewayInner beginCreateOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { """ Creates or updates the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param parameters Parameters supplied to the create or update application gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ApplicationGatewayInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().single().body(); }
java
public ApplicationGatewayInner beginCreateOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().single().body(); }
[ "public", "ApplicationGatewayInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ",", "ApplicationGatewayInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",",...
Creates or updates the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param parameters Parameters supplied to the create or update application gateway operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ApplicationGatewayInner object if successful.
[ "Creates", "or", "updates", "the", "specified", "application", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L481-L483
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/EventHelper.java
EventHelper.printTotalPages
protected void printTotalPages(PdfTemplate template, float x, float y) throws VectorPrintException, InstantiationException, IllegalAccessException { """ When the setting {@link ReportConstants#PRINTFOOTER} is true prints the total number of pages on each page when the document is closed. Note that @param template @see #PAGEFOOTERSTYLEKEY @param x @param y """ if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) { Phrase p = elementProducer.createElement(String.valueOf(lastPage), Phrase.class, stylerFactory.getStylers(PAGEFOOTERSTYLEKEY)); ColumnText.showTextAligned(template, Element.ALIGN_LEFT, p, x, y, 0); } }
java
protected void printTotalPages(PdfTemplate template, float x, float y) throws VectorPrintException, InstantiationException, IllegalAccessException { if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) { Phrase p = elementProducer.createElement(String.valueOf(lastPage), Phrase.class, stylerFactory.getStylers(PAGEFOOTERSTYLEKEY)); ColumnText.showTextAligned(template, Element.ALIGN_LEFT, p, x, y, 0); } }
[ "protected", "void", "printTotalPages", "(", "PdfTemplate", "template", ",", "float", "x", ",", "float", "y", ")", "throws", "VectorPrintException", ",", "InstantiationException", ",", "IllegalAccessException", "{", "if", "(", "getSettings", "(", ")", ".", "getBoo...
When the setting {@link ReportConstants#PRINTFOOTER} is true prints the total number of pages on each page when the document is closed. Note that @param template @see #PAGEFOOTERSTYLEKEY @param x @param y
[ "When", "the", "setting", "{", "@link", "ReportConstants#PRINTFOOTER", "}", "is", "true", "prints", "the", "total", "number", "of", "pages", "on", "each", "page", "when", "the", "document", "is", "closed", ".", "Note", "that" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L257-L262
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java
SimpleElementVisitor6.visitVariable
public R visitVariable(VariableElement e, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}, unless the element is a {@code RESOURCE_VARIABLE} in which case {@code visitUnknown} is called. @param e {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} or {@code visitUnknown} """ if (e.getKind() != ElementKind.RESOURCE_VARIABLE) return defaultAction(e, p); else return visitUnknown(e, p); }
java
public R visitVariable(VariableElement e, P p) { if (e.getKind() != ElementKind.RESOURCE_VARIABLE) return defaultAction(e, p); else return visitUnknown(e, p); }
[ "public", "R", "visitVariable", "(", "VariableElement", "e", ",", "P", "p", ")", "{", "if", "(", "e", ".", "getKind", "(", ")", "!=", "ElementKind", ".", "RESOURCE_VARIABLE", ")", "return", "defaultAction", "(", "e", ",", "p", ")", ";", "else", "return...
{@inheritDoc} This implementation calls {@code defaultAction}, unless the element is a {@code RESOURCE_VARIABLE} in which case {@code visitUnknown} is called. @param e {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} or {@code visitUnknown}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java#L160-L165
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/InverseGaussianDistribution.java
InverseGaussianDistribution.logpdf
public static double logpdf(double x, double mu, double shape) { """ Probability density function of the Wald distribution. @param x The value. @param mu The mean. @param shape Shape parameter @return log PDF of the given Wald distribution at x. """ if(!(x > 0) || x == Double.POSITIVE_INFINITY) { return x == x ? Double.NEGATIVE_INFINITY : Double.NaN; } final double v = (x - mu) / mu; return v < Double.MAX_VALUE ? 0.5 * FastMath.log(shape / (MathUtil.TWOPI * x * x * x)) - shape * v * v / (2. * x) : Double.NEGATIVE_INFINITY; }
java
public static double logpdf(double x, double mu, double shape) { if(!(x > 0) || x == Double.POSITIVE_INFINITY) { return x == x ? Double.NEGATIVE_INFINITY : Double.NaN; } final double v = (x - mu) / mu; return v < Double.MAX_VALUE ? 0.5 * FastMath.log(shape / (MathUtil.TWOPI * x * x * x)) - shape * v * v / (2. * x) : Double.NEGATIVE_INFINITY; }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "mu", ",", "double", "shape", ")", "{", "if", "(", "!", "(", "x", ">", "0", ")", "||", "x", "==", "Double", ".", "POSITIVE_INFINITY", ")", "{", "return", "x", "==", "x", "...
Probability density function of the Wald distribution. @param x The value. @param mu The mean. @param shape Shape parameter @return log PDF of the given Wald distribution at x.
[ "Probability", "density", "function", "of", "the", "Wald", "distribution", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/InverseGaussianDistribution.java#L181-L187
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/GeoPackageCache.java
GeoPackageCache.getOrOpen
public GeoPackage getOrOpen(String name, File file) { """ Get the cached GeoPackage or open and cache the GeoPackage file @param name GeoPackage name @param file GeoPackage file @return GeoPackage """ return getOrOpen(name, file, true); }
java
public GeoPackage getOrOpen(String name, File file) { return getOrOpen(name, file, true); }
[ "public", "GeoPackage", "getOrOpen", "(", "String", "name", ",", "File", "file", ")", "{", "return", "getOrOpen", "(", "name", ",", "file", ",", "true", ")", ";", "}" ]
Get the cached GeoPackage or open and cache the GeoPackage file @param name GeoPackage name @param file GeoPackage file @return GeoPackage
[ "Get", "the", "cached", "GeoPackage", "or", "open", "and", "cache", "the", "GeoPackage", "file" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/GeoPackageCache.java#L42-L44
Netflix/zeno
src/main/java/com/netflix/zeno/util/collections/impl/OpenAddressing.java
OpenAddressing.newHashTable
public static Object newHashTable(int numEntries, float loadFactor) { """ /* The number of entries will determine the size of the hash table elements. If the entry index can be always represented in 8 bits, the hash table will be byte[] If the entry index can always be represented in 16 bits, the hash table will be short[] Otherwise, the hash table will be int[]. The sign bit is used for byte[] and short[] hash tables, but the value -1 is reserved to mean "empty". Because the entries[] array stores both keys and values, the key for entry "n" will be stored at entries[n*2]. "n" is the value stored in the hash table. """ int hashSize = (int) Math.ceil((float) numEntries / loadFactor); hashSize = 1 << (32 - Integer.numberOfLeadingZeros(hashSize)); // next // power // of 2 if (numEntries < 256) { byte hashTable[] = new byte[hashSize]; Arrays.fill(hashTable, (byte) -1); return hashTable; } if (numEntries < 65536) { short hashTable[] = new short[hashSize]; Arrays.fill(hashTable, (short) -1); return hashTable; } int hashTable[] = new int[hashSize]; Arrays.fill(hashTable, -1); return hashTable; }
java
public static Object newHashTable(int numEntries, float loadFactor) { int hashSize = (int) Math.ceil((float) numEntries / loadFactor); hashSize = 1 << (32 - Integer.numberOfLeadingZeros(hashSize)); // next // power // of 2 if (numEntries < 256) { byte hashTable[] = new byte[hashSize]; Arrays.fill(hashTable, (byte) -1); return hashTable; } if (numEntries < 65536) { short hashTable[] = new short[hashSize]; Arrays.fill(hashTable, (short) -1); return hashTable; } int hashTable[] = new int[hashSize]; Arrays.fill(hashTable, -1); return hashTable; }
[ "public", "static", "Object", "newHashTable", "(", "int", "numEntries", ",", "float", "loadFactor", ")", "{", "int", "hashSize", "=", "(", "int", ")", "Math", ".", "ceil", "(", "(", "float", ")", "numEntries", "/", "loadFactor", ")", ";", "hashSize", "="...
/* The number of entries will determine the size of the hash table elements. If the entry index can be always represented in 8 bits, the hash table will be byte[] If the entry index can always be represented in 16 bits, the hash table will be short[] Otherwise, the hash table will be int[]. The sign bit is used for byte[] and short[] hash tables, but the value -1 is reserved to mean "empty". Because the entries[] array stores both keys and values, the key for entry "n" will be stored at entries[n*2]. "n" is the value stored in the hash table.
[ "/", "*", "The", "number", "of", "entries", "will", "determine", "the", "size", "of", "the", "hash", "table", "elements", "." ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/util/collections/impl/OpenAddressing.java#L43-L65
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/BrokerHelper.java
BrokerHelper.getKeyValues
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException { """ Returns an Array with an Objects PK VALUES if convertToSql is true, any associated java-to-sql conversions are applied. If the Object is a Proxy or a VirtualProxy NO conversion is necessary. @param objectOrProxy @param convertToSql @return Object[] @throws PersistenceBrokerException """ IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy); if(handler != null) { return getKeyValues(cld, handler.getIdentity(), convertToSql); //BRJ: convert Identity } else { ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy); return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql); } }
java
public ValueContainer[] getKeyValues(ClassDescriptor cld, Object objectOrProxy, boolean convertToSql) throws PersistenceBrokerException { IndirectionHandler handler = ProxyHelper.getIndirectionHandler(objectOrProxy); if(handler != null) { return getKeyValues(cld, handler.getIdentity(), convertToSql); //BRJ: convert Identity } else { ClassDescriptor realCld = getRealClassDescriptor(cld, objectOrProxy); return getValuesForObject(realCld.getPkFields(), objectOrProxy, convertToSql); } }
[ "public", "ValueContainer", "[", "]", "getKeyValues", "(", "ClassDescriptor", "cld", ",", "Object", "objectOrProxy", ",", "boolean", "convertToSql", ")", "throws", "PersistenceBrokerException", "{", "IndirectionHandler", "handler", "=", "ProxyHelper", ".", "getIndirecti...
Returns an Array with an Objects PK VALUES if convertToSql is true, any associated java-to-sql conversions are applied. If the Object is a Proxy or a VirtualProxy NO conversion is necessary. @param objectOrProxy @param convertToSql @return Object[] @throws PersistenceBrokerException
[ "Returns", "an", "Array", "with", "an", "Objects", "PK", "VALUES", "if", "convertToSql", "is", "true", "any", "associated", "java", "-", "to", "-", "sql", "conversions", "are", "applied", ".", "If", "the", "Object", "is", "a", "Proxy", "or", "a", "Virtua...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L167-L180
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java
AssetsInner.getEncryptionKeyAsync
public Observable<StorageEncryptedAssetDecryptionDataInner> getEncryptionKeyAsync(String resourceGroupName, String accountName, String assetName) { """ Gets the Asset storage key. Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageEncryptedAssetDecryptionDataInner object """ return getEncryptionKeyWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>, StorageEncryptedAssetDecryptionDataInner>() { @Override public StorageEncryptedAssetDecryptionDataInner call(ServiceResponse<StorageEncryptedAssetDecryptionDataInner> response) { return response.body(); } }); }
java
public Observable<StorageEncryptedAssetDecryptionDataInner> getEncryptionKeyAsync(String resourceGroupName, String accountName, String assetName) { return getEncryptionKeyWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<StorageEncryptedAssetDecryptionDataInner>, StorageEncryptedAssetDecryptionDataInner>() { @Override public StorageEncryptedAssetDecryptionDataInner call(ServiceResponse<StorageEncryptedAssetDecryptionDataInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageEncryptedAssetDecryptionDataInner", ">", "getEncryptionKeyAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ")", "{", "return", "getEncryptionKeyWithServiceResponseAsync", "(", "resourceG...
Gets the Asset storage key. Gets the Asset storage encryption keys used to decrypt content created by version 2 of the Media Services API. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageEncryptedAssetDecryptionDataInner object
[ "Gets", "the", "Asset", "storage", "key", ".", "Gets", "the", "Asset", "storage", "encryption", "keys", "used", "to", "decrypt", "content", "created", "by", "version", "2", "of", "the", "Media", "Services", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java#L924-L931
dita-ot/dita-ot
src/main/java/org/dita/dost/module/ImageMetadataModule.java
ImageMetadataModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { """ Entry point of image metadata ModuleElem. @param input Input parameters and resources. @return null @throws DITAOTException exception """ if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equals(f.format) || ATTR_FORMAT_VALUE_HTML.equals(f.format)); if (!images.isEmpty()) { final File outputDir = new File(input.getAttribute(ANT_INVOKER_EXT_PARAM_OUTPUTDIR)); final ImageMetadataFilter writer = new ImageMetadataFilter(outputDir, job); writer.setLogger(logger); writer.setJob(job); final Predicate<FileInfo> filter = fileInfoFilter != null ? fileInfoFilter : f -> !f.isResourceOnly && ATTR_FORMAT_VALUE_DITA.equals(f.format); for (final FileInfo f : job.getFileInfo(filter)) { writer.write(new File(job.tempDir, f.file.getPath()).getAbsoluteFile()); } storeImageFormat(writer.getImages(), outputDir); try { job.write(); } catch (IOException e) { throw new DITAOTException("Failed to serialize job configuration: " + e.getMessage(), e); } } return null; }
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (logger == null) { throw new IllegalStateException("Logger not set"); } final Collection<FileInfo> images = job.getFileInfo(f -> ATTR_FORMAT_VALUE_IMAGE.equals(f.format) || ATTR_FORMAT_VALUE_HTML.equals(f.format)); if (!images.isEmpty()) { final File outputDir = new File(input.getAttribute(ANT_INVOKER_EXT_PARAM_OUTPUTDIR)); final ImageMetadataFilter writer = new ImageMetadataFilter(outputDir, job); writer.setLogger(logger); writer.setJob(job); final Predicate<FileInfo> filter = fileInfoFilter != null ? fileInfoFilter : f -> !f.isResourceOnly && ATTR_FORMAT_VALUE_DITA.equals(f.format); for (final FileInfo f : job.getFileInfo(filter)) { writer.write(new File(job.tempDir, f.file.getPath()).getAbsoluteFile()); } storeImageFormat(writer.getImages(), outputDir); try { job.write(); } catch (IOException e) { throw new DITAOTException("Failed to serialize job configuration: " + e.getMessage(), e); } } return null; }
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "if", "(", "logger", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Logger not set\"", ")...
Entry point of image metadata ModuleElem. @param input Input parameters and resources. @return null @throws DITAOTException exception
[ "Entry", "point", "of", "image", "metadata", "ModuleElem", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/ImageMetadataModule.java#L43-L72
prolificinteractive/material-calendarview
sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/decorators/RangeDayDecorator.java
RangeDayDecorator.addFirstAndLast
public void addFirstAndLast(final CalendarDay first, final CalendarDay last) { """ We're changing the dates, so make sure to call {@linkplain MaterialCalendarView#invalidateDecorators()} """ list.clear(); list.add(first); list.add(last); }
java
public void addFirstAndLast(final CalendarDay first, final CalendarDay last) { list.clear(); list.add(first); list.add(last); }
[ "public", "void", "addFirstAndLast", "(", "final", "CalendarDay", "first", ",", "final", "CalendarDay", "last", ")", "{", "list", ".", "clear", "(", ")", ";", "list", ".", "add", "(", "first", ")", ";", "list", ".", "add", "(", "last", ")", ";", "}" ...
We're changing the dates, so make sure to call {@linkplain MaterialCalendarView#invalidateDecorators()}
[ "We", "re", "changing", "the", "dates", "so", "make", "sure", "to", "call", "{" ]
train
https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/decorators/RangeDayDecorator.java#L37-L41
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/UsersApi.java
UsersApi.getUsersWithHttpInfo
public ApiResponse<GetUsersSuccessResponse> getUsersWithHttpInfo(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { """ Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return ApiResponse&lt;GetUsersSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ com.squareup.okhttp.Call call = getUsersValidateBeforeCall(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null); Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
java
public ApiResponse<GetUsersSuccessResponse> getUsersWithHttpInfo(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException { com.squareup.okhttp.Call call = getUsersValidateBeforeCall(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid, null, null); Type localVarReturnType = new TypeToken<GetUsersSuccessResponse>(){}.getType(); return apiClient.execute(call, localVarReturnType); }
[ "public", "ApiResponse", "<", "GetUsersSuccessResponse", ">", "getUsersWithHttpInfo", "(", "Integer", "limit", ",", "Integer", "offset", ",", "String", "order", ",", "String", "sortBy", ",", "String", "filterName", ",", "String", "filterParameters", ",", "String", ...
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @return ApiResponse&lt;GetUsersSuccessResponse&gt; @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", ...
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L673-L677
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java
MoreLikeThis.addTermFrequencies
private void addTermFrequencies(Map<String, Int> termFreqMap, TermFreqVector vector) { """ Adds terms and frequencies found in vector into the Map termFreqMap @param termFreqMap a Map of terms and their frequencies @param vector List of terms and their frequencies for a doc/field """ String[] terms = vector.getTerms(); int[] freqs = vector.getTermFrequencies(); for (int j = 0; j < terms.length; j++) { String term = terms[j]; if (isNoiseWord(term)) { continue; } // increment frequency Int cnt = termFreqMap.get(term); if (cnt == null) { cnt = new Int(); termFreqMap.put(term, cnt); cnt.x = freqs[j]; } else { cnt.x += freqs[j]; } } }
java
private void addTermFrequencies(Map<String, Int> termFreqMap, TermFreqVector vector) { String[] terms = vector.getTerms(); int[] freqs = vector.getTermFrequencies(); for (int j = 0; j < terms.length; j++) { String term = terms[j]; if (isNoiseWord(term)) { continue; } // increment frequency Int cnt = termFreqMap.get(term); if (cnt == null) { cnt = new Int(); termFreqMap.put(term, cnt); cnt.x = freqs[j]; } else { cnt.x += freqs[j]; } } }
[ "private", "void", "addTermFrequencies", "(", "Map", "<", "String", ",", "Int", ">", "termFreqMap", ",", "TermFreqVector", "vector", ")", "{", "String", "[", "]", "terms", "=", "vector", ".", "getTerms", "(", ")", ";", "int", "[", "]", "freqs", "=", "v...
Adds terms and frequencies found in vector into the Map termFreqMap @param termFreqMap a Map of terms and their frequencies @param vector List of terms and their frequencies for a doc/field
[ "Adds", "terms", "and", "frequencies", "found", "in", "vector", "into", "the", "Map", "termFreqMap" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java#L759-L784
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_license_compliantWindowsSqlServer_GET
public ArrayList<OvhWindowsSqlVersionEnum> serviceName_license_compliantWindowsSqlServer_GET(String serviceName) throws IOException { """ Get the windows SQL server license compliant with your server. REST: GET /dedicated/server/{serviceName}/license/compliantWindowsSqlServer @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/license/compliantWindowsSqlServer"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhWindowsSqlVersionEnum> serviceName_license_compliantWindowsSqlServer_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/license/compliantWindowsSqlServer"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhWindowsSqlVersionEnum", ">", "serviceName_license_compliantWindowsSqlServer_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/license/compliantWindowsSqlServer\"", ";", ...
Get the windows SQL server license compliant with your server. REST: GET /dedicated/server/{serviceName}/license/compliantWindowsSqlServer @param serviceName [required] The internal name of your dedicated server
[ "Get", "the", "windows", "SQL", "server", "license", "compliant", "with", "your", "server", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1193-L1198
mbenson/therian
core/src/main/java/therian/operator/copy/BeanToMapCopier.java
BeanToMapCopier.supports
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { """ If at least one property name can be converted to an assignable key, say the operation is supported and we'll give it a shot. """ if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
java
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
[ "@", "Override", "public", "boolean", "supports", "(", "TherianContext", "context", ",", "Copy", "<", "?", "extends", "Object", ",", "?", "extends", "Map", ">", "copy", ")", "{", "if", "(", "!", "super", ".", "supports", "(", "context", ",", "copy", ")...
If at least one property name can be converted to an assignable key, say the operation is supported and we'll give it a shot.
[ "If", "at", "least", "one", "property", "name", "can", "be", "converted", "to", "an", "assignable", "key", "say", "the", "operation", "is", "supported", "and", "we", "ll", "give", "it", "a", "shot", "." ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/copy/BeanToMapCopier.java#L84-L94
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java
DateTimeUtil.getTime
public static Date getTime(Datebox datebox, Timebox timebox) { """ Returns a date/time from the UI. This is combined from two UI input elements, one for date and one for time. @param datebox The date box. @param timebox The time box. @return The combined date/time. """ if (timebox.getValue() == null || datebox.getValue() == null) { return DateUtil.stripTime(datebox.getValue()); } Calendar date = Calendar.getInstance(); Calendar time = Calendar.getInstance(); date.setTime(datebox.getValue()); time.setTime(timebox.getValue()); time.set(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); return time.getTime(); }
java
public static Date getTime(Datebox datebox, Timebox timebox) { if (timebox.getValue() == null || datebox.getValue() == null) { return DateUtil.stripTime(datebox.getValue()); } Calendar date = Calendar.getInstance(); Calendar time = Calendar.getInstance(); date.setTime(datebox.getValue()); time.setTime(timebox.getValue()); time.set(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); return time.getTime(); }
[ "public", "static", "Date", "getTime", "(", "Datebox", "datebox", ",", "Timebox", "timebox", ")", "{", "if", "(", "timebox", ".", "getValue", "(", ")", "==", "null", "||", "datebox", ".", "getValue", "(", ")", "==", "null", ")", "{", "return", "DateUti...
Returns a date/time from the UI. This is combined from two UI input elements, one for date and one for time. @param datebox The date box. @param timebox The time box. @return The combined date/time.
[ "Returns", "a", "date", "/", "time", "from", "the", "UI", ".", "This", "is", "combined", "from", "two", "UI", "input", "elements", "one", "for", "date", "and", "one", "for", "time", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java#L48-L59
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.substringFirstRear
public static String substringFirstRear(String str, String... delimiters) { """ Extract rear sub-string from first-found delimiter. <pre> substringFirstRear("foo.bar/baz.qux", ".", "/") returns "bar/baz.qux" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The part of string. (NotNull: if delimiter not found, returns argument-plain string) """ assertStringNotNull(str); return doSubstringFirstRear(false, true, false, str, delimiters); }
java
public static String substringFirstRear(String str, String... delimiters) { assertStringNotNull(str); return doSubstringFirstRear(false, true, false, str, delimiters); }
[ "public", "static", "String", "substringFirstRear", "(", "String", "str", ",", "String", "...", "delimiters", ")", "{", "assertStringNotNull", "(", "str", ")", ";", "return", "doSubstringFirstRear", "(", "false", ",", "true", ",", "false", ",", "str", ",", "...
Extract rear sub-string from first-found delimiter. <pre> substringFirstRear("foo.bar/baz.qux", ".", "/") returns "bar/baz.qux" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The part of string. (NotNull: if delimiter not found, returns argument-plain string)
[ "Extract", "rear", "sub", "-", "string", "from", "first", "-", "found", "delimiter", ".", "<pre", ">", "substringFirstRear", "(", "foo", ".", "bar", "/", "baz", ".", "qux", ".", "/", ")", "returns", "bar", "/", "baz", ".", "qux", "<", "/", "pre", "...
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L657-L660
arnaudroger/SimpleFlatMapper
sfm-poi/src/main/java/org/simpleflatmapper/poi/SheetMapperFactory.java
SheetMapperFactory.getterFactory
public SheetMapperFactory getterFactory(GetterFactory<Row, CsvColumnKey> getterFactory) { """ set a new getterFactory. @param getterFactory the getterFactory @return the newInstance """ return super.addGetterFactory(new ContextualGetterFactoryAdapter<Row, CsvColumnKey>(getterFactory)); }
java
public SheetMapperFactory getterFactory(GetterFactory<Row, CsvColumnKey> getterFactory) { return super.addGetterFactory(new ContextualGetterFactoryAdapter<Row, CsvColumnKey>(getterFactory)); }
[ "public", "SheetMapperFactory", "getterFactory", "(", "GetterFactory", "<", "Row", ",", "CsvColumnKey", ">", "getterFactory", ")", "{", "return", "super", ".", "addGetterFactory", "(", "new", "ContextualGetterFactoryAdapter", "<", "Row", ",", "CsvColumnKey", ">", "(...
set a new getterFactory. @param getterFactory the getterFactory @return the newInstance
[ "set", "a", "new", "getterFactory", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-poi/src/main/java/org/simpleflatmapper/poi/SheetMapperFactory.java#L46-L48
square/okhttp
okhttp/src/main/java/okhttp3/internal/Util.java
Util.delimiterOffset
public static int delimiterOffset(String input, int pos, int limit, char delimiter) { """ Returns the index of the first character in {@code input} that is {@code delimiter}. Returns limit if there is no such character. """ for (int i = pos; i < limit; i++) { if (input.charAt(i) == delimiter) return i; } return limit; }
java
public static int delimiterOffset(String input, int pos, int limit, char delimiter) { for (int i = pos; i < limit; i++) { if (input.charAt(i) == delimiter) return i; } return limit; }
[ "public", "static", "int", "delimiterOffset", "(", "String", "input", ",", "int", "pos", ",", "int", "limit", ",", "char", "delimiter", ")", "{", "for", "(", "int", "i", "=", "pos", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "if", "(", "in...
Returns the index of the first character in {@code input} that is {@code delimiter}. Returns limit if there is no such character.
[ "Returns", "the", "index", "of", "the", "first", "character", "in", "{" ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/Util.java#L354-L359
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.asynchGet
public TransferState asynchGet(String remoteFileName, DataSink sink, MarkerListener mListener) throws IOException, ClientException, ServerException { """ Retrieves the file from the remote server. @param remoteFileName remote file name @param sink sink to which the data will be written @param mListener restart marker listener (currently not used) """ checkTransferParamsGet(); localServer.store(sink); controlChannel.write(new Command("RETR", remoteFileName)); return transferStart(localServer.getControlChannel(), mListener); }
java
public TransferState asynchGet(String remoteFileName, DataSink sink, MarkerListener mListener) throws IOException, ClientException, ServerException { checkTransferParamsGet(); localServer.store(sink); controlChannel.write(new Command("RETR", remoteFileName)); return transferStart(localServer.getControlChannel(), mListener); }
[ "public", "TransferState", "asynchGet", "(", "String", "remoteFileName", ",", "DataSink", "sink", ",", "MarkerListener", "mListener", ")", "throws", "IOException", ",", "ClientException", ",", "ServerException", "{", "checkTransferParamsGet", "(", ")", ";", "localServ...
Retrieves the file from the remote server. @param remoteFileName remote file name @param sink sink to which the data will be written @param mListener restart marker listener (currently not used)
[ "Retrieves", "the", "file", "from", "the", "remote", "server", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1262-L1272
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.saveContent
public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException { """ Saves the content values to the sessions edit resource.<p> @param contentValues the content values by XPath @return the validation handler @throws CmsUgcException if writing the content fails """ checkNotFinished(); try { CmsFile file = m_cms.readFile(m_editResource); CmsXmlContent content = addContentValues(file, contentValues); CmsXmlContentErrorHandler errorHandler = content.validate(m_cms); if (!errorHandler.hasErrors()) { file.setContents(content.marshal()); // the file content might have been modified during the write operation file = m_cms.writeFile(file); } return errorHandler; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage()); } }
java
public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException { checkNotFinished(); try { CmsFile file = m_cms.readFile(m_editResource); CmsXmlContent content = addContentValues(file, contentValues); CmsXmlContentErrorHandler errorHandler = content.validate(m_cms); if (!errorHandler.hasErrors()) { file.setContents(content.marshal()); // the file content might have been modified during the write operation file = m_cms.writeFile(file); } return errorHandler; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage()); } }
[ "public", "CmsXmlContentErrorHandler", "saveContent", "(", "Map", "<", "String", ",", "String", ">", "contentValues", ")", "throws", "CmsUgcException", "{", "checkNotFinished", "(", ")", ";", "try", "{", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "...
Saves the content values to the sessions edit resource.<p> @param contentValues the content values by XPath @return the validation handler @throws CmsUgcException if writing the content fails
[ "Saves", "the", "content", "values", "to", "the", "sessions", "edit", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L499-L518
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java
WishlistUrl.getWishlistByNameUrl
public static MozuUrl getWishlistByNameUrl(Integer customerAccountId, String responseFields, String wishlistName) { """ Get Resource Url for GetWishlistByName @param customerAccountId The unique identifier of the customer account for which to retrieve wish lists. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param wishlistName The name of the wish list to retrieve. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}?responseFields={responseFields}"); formatter.formatUrl("customerAccountId", customerAccountId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistName", wishlistName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getWishlistByNameUrl(Integer customerAccountId, String responseFields, String wishlistName) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/customers/{customerAccountId}/{wishlistName}?responseFields={responseFields}"); formatter.formatUrl("customerAccountId", customerAccountId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistName", wishlistName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getWishlistByNameUrl", "(", "Integer", "customerAccountId", ",", "String", "responseFields", ",", "String", "wishlistName", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/wishlists/customers/{customer...
Get Resource Url for GetWishlistByName @param customerAccountId The unique identifier of the customer account for which to retrieve wish lists. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param wishlistName The name of the wish list to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetWishlistByName" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/WishlistUrl.java#L61-L68
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpRequestHeader.java
HttpRequestHeader.setMessage
public void setMessage(String data, boolean isSecure) throws HttpMalformedHeaderException { """ Set this request header with the given message. @param data the request header @param isSecure {@code true} if the request should be secure, {@code false} otherwise @throws HttpMalformedHeaderException if the request being set is malformed @see #setSecure(boolean) """ super.setMessage(data); try { parse(isSecure); } catch (HttpMalformedHeaderException e) { mMalformedHeader = true; if (log.isDebugEnabled()) { log.debug("Malformed header: " + data, e); } throw e; } catch (Exception e) { log.error("Failed to parse:\n" + data, e); mMalformedHeader = true; throw new HttpMalformedHeaderException(e.getMessage()); } }
java
public void setMessage(String data, boolean isSecure) throws HttpMalformedHeaderException { super.setMessage(data); try { parse(isSecure); } catch (HttpMalformedHeaderException e) { mMalformedHeader = true; if (log.isDebugEnabled()) { log.debug("Malformed header: " + data, e); } throw e; } catch (Exception e) { log.error("Failed to parse:\n" + data, e); mMalformedHeader = true; throw new HttpMalformedHeaderException(e.getMessage()); } }
[ "public", "void", "setMessage", "(", "String", "data", ",", "boolean", "isSecure", ")", "throws", "HttpMalformedHeaderException", "{", "super", ".", "setMessage", "(", "data", ")", ";", "try", "{", "parse", "(", "isSecure", ")", ";", "}", "catch", "(", "Ht...
Set this request header with the given message. @param data the request header @param isSecure {@code true} if the request should be secure, {@code false} otherwise @throws HttpMalformedHeaderException if the request being set is malformed @see #setSecure(boolean)
[ "Set", "this", "request", "header", "with", "the", "given", "message", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpRequestHeader.java#L273-L292
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java
RegionAddressId.of
public static RegionAddressId of(RegionId regionId, String address) { """ Returns a region address identity given the region identity and the address name. The address name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a> """ return new RegionAddressId(regionId.getProject(), regionId.getRegion(), address); }
java
public static RegionAddressId of(RegionId regionId, String address) { return new RegionAddressId(regionId.getProject(), regionId.getRegion(), address); }
[ "public", "static", "RegionAddressId", "of", "(", "RegionId", "regionId", ",", "String", "address", ")", "{", "return", "new", "RegionAddressId", "(", "regionId", ".", "getProject", "(", ")", ",", "regionId", ".", "getRegion", "(", ")", ",", "address", ")", ...
Returns a region address identity given the region identity and the address name. The address name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
[ "Returns", "a", "region", "address", "identity", "given", "the", "region", "identity", "and", "the", "address", "name", ".", "The", "address", "name", "must", "be", "1", "-", "63", "characters", "long", "and", "comply", "with", "RFC1035", ".", "Specifically"...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java#L99-L101
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/cmp/cmppolicylabel_stats.java
cmppolicylabel_stats.get
public static cmppolicylabel_stats get(nitro_service service, String labelname) throws Exception { """ Use this API to fetch statistics of cmppolicylabel_stats resource of given name . """ cmppolicylabel_stats obj = new cmppolicylabel_stats(); obj.set_labelname(labelname); cmppolicylabel_stats response = (cmppolicylabel_stats) obj.stat_resource(service); return response; }
java
public static cmppolicylabel_stats get(nitro_service service, String labelname) throws Exception{ cmppolicylabel_stats obj = new cmppolicylabel_stats(); obj.set_labelname(labelname); cmppolicylabel_stats response = (cmppolicylabel_stats) obj.stat_resource(service); return response; }
[ "public", "static", "cmppolicylabel_stats", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "cmppolicylabel_stats", "obj", "=", "new", "cmppolicylabel_stats", "(", ")", ";", "obj", ".", "set_labelname", "(", "la...
Use this API to fetch statistics of cmppolicylabel_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "cmppolicylabel_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cmp/cmppolicylabel_stats.java#L149-L154
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java
GobblinMetrics.getCounter
public Counter getCounter(String prefix, String... suffixes) { """ Get a {@link Counter} with the given name prefix and suffixes. @param prefix the given name prefix @param suffixes the given name suffixes @return a {@link Counter} with the given name prefix and suffixes """ return this.metricContext.counter(MetricRegistry.name(prefix, suffixes)); }
java
public Counter getCounter(String prefix, String... suffixes) { return this.metricContext.counter(MetricRegistry.name(prefix, suffixes)); }
[ "public", "Counter", "getCounter", "(", "String", "prefix", ",", "String", "...", "suffixes", ")", "{", "return", "this", ".", "metricContext", ".", "counter", "(", "MetricRegistry", ".", "name", "(", "prefix", ",", "suffixes", ")", ")", ";", "}" ]
Get a {@link Counter} with the given name prefix and suffixes. @param prefix the given name prefix @param suffixes the given name suffixes @return a {@link Counter} with the given name prefix and suffixes
[ "Get", "a", "{", "@link", "Counter", "}", "with", "the", "given", "name", "prefix", "and", "suffixes", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java#L323-L325
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Expression.java
Expression.withSourceLocation
public Expression withSourceLocation(SourceLocation location) { """ Returns an identical {@link Expression} with the given source location. """ checkNotNull(location); if (location.equals(this.location)) { return this; } return new Expression(resultType, features, location) { @Override protected void doGen(CodeBuilder adapter) { Expression.this.gen(adapter); } }; }
java
public Expression withSourceLocation(SourceLocation location) { checkNotNull(location); if (location.equals(this.location)) { return this; } return new Expression(resultType, features, location) { @Override protected void doGen(CodeBuilder adapter) { Expression.this.gen(adapter); } }; }
[ "public", "Expression", "withSourceLocation", "(", "SourceLocation", "location", ")", "{", "checkNotNull", "(", "location", ")", ";", "if", "(", "location", ".", "equals", "(", "this", ".", "location", ")", ")", "{", "return", "this", ";", "}", "return", "...
Returns an identical {@link Expression} with the given source location.
[ "Returns", "an", "identical", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Expression.java#L215-L226
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.bytesToChar
public static char bytesToChar(byte[] bytes, int offset) { """ A utility method to convert the char from the byte array to a char. @param bytes The byte array containing the char. @param offset The index at which the char is located. @return The char value. """ char result = 0x0; for (int i = offset; i < offset + 2; ++i) { result = (char) ((result) << 8); result |= (bytes[i] & 0x00FF); } return result; }
java
public static char bytesToChar(byte[] bytes, int offset) { char result = 0x0; for (int i = offset; i < offset + 2; ++i) { result = (char) ((result) << 8); result |= (bytes[i] & 0x00FF); } return result; }
[ "public", "static", "char", "bytesToChar", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "char", "result", "=", "0x0", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "offset", "+", "2", ";", "++", "i", ")", "{", "r...
A utility method to convert the char from the byte array to a char. @param bytes The byte array containing the char. @param offset The index at which the char is located. @return The char value.
[ "A", "utility", "method", "to", "convert", "the", "char", "from", "the", "byte", "array", "to", "a", "char", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L83-L90