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
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java
EJBInfo.getRoot
public Class getRoot(Class clazz, HashMap derivesFrom) { """ Unwinds the results of reflecting through the interface inheritance hierachy to find the original root class from a derived class """ while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
java
public Class getRoot(Class clazz, HashMap derivesFrom) { while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
[ "public", "Class", "getRoot", "(", "Class", "clazz", ",", "HashMap", "derivesFrom", ")", "{", "while", "(", "derivesFrom", ".", "containsKey", "(", "clazz", ")", ")", "clazz", "=", "(", "Class", ")", "derivesFrom", ".", "get", "(", "clazz", ")", ";", "...
Unwinds the results of reflecting through the interface inheritance hierachy to find the original root class from a derived class
[ "Unwinds", "the", "results", "of", "reflecting", "through", "the", "interface", "inheritance", "hierachy", "to", "find", "the", "original", "root", "class", "from", "a", "derived", "class" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java#L148-L151
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/draw/LineSeparator.java
LineSeparator.drawLine
public void drawLine(PdfContentByte canvas, float leftX, float rightX, float y) { """ Draws a horizontal line. @param canvas the canvas to draw on @param leftX the left x coordinate @param rightX the right x coordindate @param y the y coordinate """ float w; if (getPercentage() < 0) w = -getPercentage(); else w = (rightX - leftX) * getPercentage() / 100.0f; float s; switch (getAlignment()) { case Element.ALIGN_LEFT: s = 0; break; case Element.ALIGN_RIGHT: s = rightX - leftX - w; break; default: s = (rightX - leftX - w) / 2; break; } canvas.setLineWidth(getLineWidth()); if (getLineColor() != null) canvas.setColorStroke(getLineColor()); canvas.moveTo(s + leftX, y + offset); canvas.lineTo(s + w + leftX, y + offset); canvas.stroke(); }
java
public void drawLine(PdfContentByte canvas, float leftX, float rightX, float y) { float w; if (getPercentage() < 0) w = -getPercentage(); else w = (rightX - leftX) * getPercentage() / 100.0f; float s; switch (getAlignment()) { case Element.ALIGN_LEFT: s = 0; break; case Element.ALIGN_RIGHT: s = rightX - leftX - w; break; default: s = (rightX - leftX - w) / 2; break; } canvas.setLineWidth(getLineWidth()); if (getLineColor() != null) canvas.setColorStroke(getLineColor()); canvas.moveTo(s + leftX, y + offset); canvas.lineTo(s + w + leftX, y + offset); canvas.stroke(); }
[ "public", "void", "drawLine", "(", "PdfContentByte", "canvas", ",", "float", "leftX", ",", "float", "rightX", ",", "float", "y", ")", "{", "float", "w", ";", "if", "(", "getPercentage", "(", ")", "<", "0", ")", "w", "=", "-", "getPercentage", "(", ")...
Draws a horizontal line. @param canvas the canvas to draw on @param leftX the left x coordinate @param rightX the right x coordindate @param y the y coordinate
[ "Draws", "a", "horizontal", "line", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/draw/LineSeparator.java#L114-L138
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.listByDatabase
public List<EventHubConnectionInner> listByDatabase(String resourceGroupName, String clusterName, String databaseName) { """ Returns the list of Event Hub connections of the given Kusto database. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @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 List&lt;EventHubConnectionInner&gt; object if successful. """ return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); }
java
public List<EventHubConnectionInner> listByDatabase(String resourceGroupName, String clusterName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); }
[ "public", "List", "<", "EventHubConnectionInner", ">", "listByDatabase", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ")", "{", "return", "listByDatabaseWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterN...
Returns the list of Event Hub connections of the given Kusto database. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @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 List&lt;EventHubConnectionInner&gt; object if successful.
[ "Returns", "the", "list", "of", "Event", "Hub", "connections", "of", "the", "given", "Kusto", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L112-L114
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.beginCreateAsync
public Observable<DataLakeStoreAccountInner> beginCreateAsync(String resourceGroupName, String name, DataLakeStoreAccountInner parameters) { """ Creates the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param name The name of the Data Lake Store account to create. @param parameters Parameters supplied to create the Data Lake Store account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInner object """ return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
java
public Observable<DataLakeStoreAccountInner> beginCreateAsync(String resourceGroupName, String name, DataLakeStoreAccountInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeStoreAccountInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "DataLakeStoreAccountInner", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ...
Creates the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param name The name of the Data Lake Store account to create. @param parameters Parameters supplied to create the Data Lake Store account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInner object
[ "Creates", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L664-L671
JodaOrg/joda-money
src/main/java/org/joda/money/BigMoney.java
BigMoney.plusRetainScale
public BigMoney plusRetainScale(BigDecimal amountToAdd, RoundingMode roundingMode) { """ Returns a copy of this monetary value with the amount added retaining the scale by rounding the result. <p> The scale of the result will be the same as the scale of this instance. For example,'USD 25.95' plus '3.021' gives 'USD 28.97' with most rounding modes. <p> This instance is immutable and unaffected by this method. @param amountToAdd the monetary value to add, not null @param roundingMode the rounding mode to use to adjust the scale, not null @return the new instance with the input amount added, never null """ MoneyUtils.checkNotNull(amountToAdd, "Amount must not be null"); if (amountToAdd.compareTo(BigDecimal.ZERO) == 0) { return this; } BigDecimal newAmount = amount.add(amountToAdd); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); }
java
public BigMoney plusRetainScale(BigDecimal amountToAdd, RoundingMode roundingMode) { MoneyUtils.checkNotNull(amountToAdd, "Amount must not be null"); if (amountToAdd.compareTo(BigDecimal.ZERO) == 0) { return this; } BigDecimal newAmount = amount.add(amountToAdd); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); }
[ "public", "BigMoney", "plusRetainScale", "(", "BigDecimal", "amountToAdd", ",", "RoundingMode", "roundingMode", ")", "{", "MoneyUtils", ".", "checkNotNull", "(", "amountToAdd", ",", "\"Amount must not be null\"", ")", ";", "if", "(", "amountToAdd", ".", "compareTo", ...
Returns a copy of this monetary value with the amount added retaining the scale by rounding the result. <p> The scale of the result will be the same as the scale of this instance. For example,'USD 25.95' plus '3.021' gives 'USD 28.97' with most rounding modes. <p> This instance is immutable and unaffected by this method. @param amountToAdd the monetary value to add, not null @param roundingMode the rounding mode to use to adjust the scale, not null @return the new instance with the input amount added, never null
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "with", "the", "amount", "added", "retaining", "the", "scale", "by", "rounding", "the", "result", ".", "<p", ">", "The", "scale", "of", "the", "result", "will", "be", "the", "same", "as", "the", ...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L985-L993
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/RedirectToServiceAction.java
RedirectToServiceAction.getFinalResponseEventId
protected String getFinalResponseEventId(final WebApplicationService service, final Response response, final RequestContext requestContext) { """ Gets final response event id. @param service the service @param response the response @param requestContext the request context @return the final response event id """ val eventId = response.getResponseType().name().toLowerCase(); LOGGER.debug("Signaling flow to redirect to service [{}] via event [{}]", service, eventId); return eventId; }
java
protected String getFinalResponseEventId(final WebApplicationService service, final Response response, final RequestContext requestContext) { val eventId = response.getResponseType().name().toLowerCase(); LOGGER.debug("Signaling flow to redirect to service [{}] via event [{}]", service, eventId); return eventId; }
[ "protected", "String", "getFinalResponseEventId", "(", "final", "WebApplicationService", "service", ",", "final", "Response", "response", ",", "final", "RequestContext", "requestContext", ")", "{", "val", "eventId", "=", "response", ".", "getResponseType", "(", ")", ...
Gets final response event id. @param service the service @param response the response @param requestContext the request context @return the final response event id
[ "Gets", "final", "response", "event", "id", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/actions/RedirectToServiceAction.java#L70-L74
vnesek/nmote-iim4j
src/main/java/com/nmote/iim4j/IIMFile.java
IIMFile.validate
public Set<ConstraintViolation> validate(DataSetInfo info) { """ Checks if data set is mandatory but missing or non repeatable but having multiple values in this IIM instance. @param info IIM data set to check @return list of constraint violations, empty set if data set is valid """ Set<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>(); try { if (info.isMandatory() && get(info.getDataSetNumber()) == null) { errors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_MISSING)); } if (!info.isRepeatable() && getAll(info.getDataSetNumber()).size() > 1) { errors.add(new ConstraintViolation(info, ConstraintViolation.REPEATABLE_REPEATED)); } } catch (SerializationException e) { errors.add(new ConstraintViolation(info, ConstraintViolation.INVALID_VALUE)); } return errors; }
java
public Set<ConstraintViolation> validate(DataSetInfo info) { Set<ConstraintViolation> errors = new LinkedHashSet<ConstraintViolation>(); try { if (info.isMandatory() && get(info.getDataSetNumber()) == null) { errors.add(new ConstraintViolation(info, ConstraintViolation.MANDATORY_MISSING)); } if (!info.isRepeatable() && getAll(info.getDataSetNumber()).size() > 1) { errors.add(new ConstraintViolation(info, ConstraintViolation.REPEATABLE_REPEATED)); } } catch (SerializationException e) { errors.add(new ConstraintViolation(info, ConstraintViolation.INVALID_VALUE)); } return errors; }
[ "public", "Set", "<", "ConstraintViolation", ">", "validate", "(", "DataSetInfo", "info", ")", "{", "Set", "<", "ConstraintViolation", ">", "errors", "=", "new", "LinkedHashSet", "<", "ConstraintViolation", ">", "(", ")", ";", "try", "{", "if", "(", "info", ...
Checks if data set is mandatory but missing or non repeatable but having multiple values in this IIM instance. @param info IIM data set to check @return list of constraint violations, empty set if data set is valid
[ "Checks", "if", "data", "set", "is", "mandatory", "but", "missing", "or", "non", "repeatable", "but", "having", "multiple", "values", "in", "this", "IIM", "instance", "." ]
train
https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/IIMFile.java#L500-L513
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.delDependencyEntry
public void delDependencyEntry(Object id, Object entry) { """ Call this method to delete a cache id from a specified dependency in the disk. @param id - dependency id. @param entry - cache id. """ // SKS-O if (htod.delDependencyEntry(id, entry) == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); } }
java
public void delDependencyEntry(Object id, Object entry) { // SKS-O if (htod.delDependencyEntry(id, entry) == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); } }
[ "public", "void", "delDependencyEntry", "(", "Object", "id", ",", "Object", "entry", ")", "{", "// SKS-O", "if", "(", "htod", ".", "delDependencyEntry", "(", "id", ",", "entry", ")", "==", "HTODDynacache", ".", "DISK_EXCEPTION", ")", "{", "stopOnError", "(",...
Call this method to delete a cache id from a specified dependency in the disk. @param id - dependency id. @param entry - cache id.
[ "Call", "this", "method", "to", "delete", "a", "cache", "id", "from", "a", "specified", "dependency", "in", "the", "disk", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1512-L1516
infinispan/infinispan
core/src/main/java/org/infinispan/statetransfer/StateConsumerImpl.java
StateConsumerImpl.restartBrokenTransfers
private void restartBrokenTransfers(CacheTopology cacheTopology, IntSet addedSegments) { """ Check if any of the existing transfers should be restarted from a different source because the initial source is no longer a member. """ Set<Address> members = new HashSet<>(cacheTopology.getReadConsistentHash().getMembers()); synchronized (transferMapsLock) { for (Iterator<Map.Entry<Address, List<InboundTransferTask>>> it = transfersBySource.entrySet().iterator(); it.hasNext(); ) { Map.Entry<Address, List<InboundTransferTask>> entry = it.next(); Address source = entry.getKey(); if (!members.contains(source)) { if (trace) { log.tracef("Removing inbound transfers from source %s for cache %s", source, cacheName); } List<InboundTransferTask> inboundTransfers = entry.getValue(); it.remove(); for (InboundTransferTask inboundTransfer : inboundTransfers) { // these segments will be restarted if they are still in new write CH if (trace) { log.tracef("Removing inbound transfers from node %s for segments %s", source, inboundTransfer.getSegments()); } IntSet unfinishedSegments = inboundTransfer.getUnfinishedSegments(); inboundTransfer.cancel(); addedSegments.addAll(unfinishedSegments); transfersBySegment.keySet().removeAll(unfinishedSegments); } } } // exclude those that are already in progress from a valid source addedSegments.removeAll(transfersBySegment.keySet()); } }
java
private void restartBrokenTransfers(CacheTopology cacheTopology, IntSet addedSegments) { Set<Address> members = new HashSet<>(cacheTopology.getReadConsistentHash().getMembers()); synchronized (transferMapsLock) { for (Iterator<Map.Entry<Address, List<InboundTransferTask>>> it = transfersBySource.entrySet().iterator(); it.hasNext(); ) { Map.Entry<Address, List<InboundTransferTask>> entry = it.next(); Address source = entry.getKey(); if (!members.contains(source)) { if (trace) { log.tracef("Removing inbound transfers from source %s for cache %s", source, cacheName); } List<InboundTransferTask> inboundTransfers = entry.getValue(); it.remove(); for (InboundTransferTask inboundTransfer : inboundTransfers) { // these segments will be restarted if they are still in new write CH if (trace) { log.tracef("Removing inbound transfers from node %s for segments %s", source, inboundTransfer.getSegments()); } IntSet unfinishedSegments = inboundTransfer.getUnfinishedSegments(); inboundTransfer.cancel(); addedSegments.addAll(unfinishedSegments); transfersBySegment.keySet().removeAll(unfinishedSegments); } } } // exclude those that are already in progress from a valid source addedSegments.removeAll(transfersBySegment.keySet()); } }
[ "private", "void", "restartBrokenTransfers", "(", "CacheTopology", "cacheTopology", ",", "IntSet", "addedSegments", ")", "{", "Set", "<", "Address", ">", "members", "=", "new", "HashSet", "<>", "(", "cacheTopology", ".", "getReadConsistentHash", "(", ")", ".", "...
Check if any of the existing transfers should be restarted from a different source because the initial source is no longer a member.
[ "Check", "if", "any", "of", "the", "existing", "transfers", "should", "be", "restarted", "from", "a", "different", "source", "because", "the", "initial", "source", "is", "no", "longer", "a", "member", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/StateConsumerImpl.java#L1038-L1066
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.addPanel
public void addPanel(AbstractPanel panel, PanelType panelType) { """ Adds the given panel to the workbench, hinting with the given panel type. @param panel the panel to add to the workbench @param panelType the type of the panel @throws IllegalArgumentException if any of the parameters is {@code null}. @since 2.5.0 @see #removePanel(AbstractPanel, PanelType) @see #addPanels(List, PanelType) """ validateNotNull(panel, "panel"); validateNotNull(panelType, "panelType"); boolean fullLayout = layout == Layout.FULL; addPanel(getTabbedFull(), panel, fullLayout); switch (panelType) { case SELECT: addPanel(getTabbedSelect(), panel, !fullLayout); getTabbedSelect().revalidate(); break; case STATUS: addPanel(getTabbedStatus(), panel, !fullLayout); getTabbedStatus().revalidate(); break; case WORK: addPanel(getTabbedWork(), panel, !fullLayout); getTabbedWork().revalidate(); break; default: break; } }
java
public void addPanel(AbstractPanel panel, PanelType panelType) { validateNotNull(panel, "panel"); validateNotNull(panelType, "panelType"); boolean fullLayout = layout == Layout.FULL; addPanel(getTabbedFull(), panel, fullLayout); switch (panelType) { case SELECT: addPanel(getTabbedSelect(), panel, !fullLayout); getTabbedSelect().revalidate(); break; case STATUS: addPanel(getTabbedStatus(), panel, !fullLayout); getTabbedStatus().revalidate(); break; case WORK: addPanel(getTabbedWork(), panel, !fullLayout); getTabbedWork().revalidate(); break; default: break; } }
[ "public", "void", "addPanel", "(", "AbstractPanel", "panel", ",", "PanelType", "panelType", ")", "{", "validateNotNull", "(", "panel", ",", "\"panel\"", ")", ";", "validateNotNull", "(", "panelType", ",", "\"panelType\"", ")", ";", "boolean", "fullLayout", "=", ...
Adds the given panel to the workbench, hinting with the given panel type. @param panel the panel to add to the workbench @param panelType the type of the panel @throws IllegalArgumentException if any of the parameters is {@code null}. @since 2.5.0 @see #removePanel(AbstractPanel, PanelType) @see #addPanels(List, PanelType)
[ "Adds", "the", "given", "panel", "to", "the", "workbench", "hinting", "with", "the", "given", "panel", "type", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L911-L935
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java
StatsImpl.myupdate
private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) { """ Assume we have verified newStats is the same PMI module as this Stats """ if (newStats == null) return; StatsImpl newStats1 = (StatsImpl) newStats; // update the level and description of this collection this.instrumentationLevel = newStats1.getLevel(); // update data updateMembers(newStats, keepOld); // update subcollections if (recursiveUpdate) updateSubcollection(newStats, keepOld, recursiveUpdate); }
java
private synchronized void myupdate(WSStats newStats, boolean keepOld, boolean recursiveUpdate) { if (newStats == null) return; StatsImpl newStats1 = (StatsImpl) newStats; // update the level and description of this collection this.instrumentationLevel = newStats1.getLevel(); // update data updateMembers(newStats, keepOld); // update subcollections if (recursiveUpdate) updateSubcollection(newStats, keepOld, recursiveUpdate); }
[ "private", "synchronized", "void", "myupdate", "(", "WSStats", "newStats", ",", "boolean", "keepOld", ",", "boolean", "recursiveUpdate", ")", "{", "if", "(", "newStats", "==", "null", ")", "return", ";", "StatsImpl", "newStats1", "=", "(", "StatsImpl", ")", ...
Assume we have verified newStats is the same PMI module as this Stats
[ "Assume", "we", "have", "verified", "newStats", "is", "the", "same", "PMI", "module", "as", "this", "Stats" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsImpl.java#L639-L653
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/TileBoundingBoxMapUtils.java
TileBoundingBoxMapUtils.getLongitudeDistance
public static double getLongitudeDistance(double minLongitude, double maxLongitude, double latitude) { """ Get the longitude distance in the middle latitude @param minLongitude min longitude @param maxLongitude max longitude @param latitude latitude @return distance @since 1.2.7 """ LatLng leftMiddle = new LatLng(latitude, minLongitude); LatLng middle = new LatLng(latitude, (minLongitude + maxLongitude) / 2.0); LatLng rightMiddle = new LatLng(latitude, maxLongitude); List<LatLng> path = new ArrayList<LatLng>(); path.add(leftMiddle); path.add(middle); path.add(rightMiddle); double lonDistance = SphericalUtil.computeLength(path); return lonDistance; }
java
public static double getLongitudeDistance(double minLongitude, double maxLongitude, double latitude) { LatLng leftMiddle = new LatLng(latitude, minLongitude); LatLng middle = new LatLng(latitude, (minLongitude + maxLongitude) / 2.0); LatLng rightMiddle = new LatLng(latitude, maxLongitude); List<LatLng> path = new ArrayList<LatLng>(); path.add(leftMiddle); path.add(middle); path.add(rightMiddle); double lonDistance = SphericalUtil.computeLength(path); return lonDistance; }
[ "public", "static", "double", "getLongitudeDistance", "(", "double", "minLongitude", ",", "double", "maxLongitude", ",", "double", "latitude", ")", "{", "LatLng", "leftMiddle", "=", "new", "LatLng", "(", "latitude", ",", "minLongitude", ")", ";", "LatLng", "midd...
Get the longitude distance in the middle latitude @param minLongitude min longitude @param maxLongitude max longitude @param latitude latitude @return distance @since 1.2.7
[ "Get", "the", "longitude", "distance", "in", "the", "middle", "latitude" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/TileBoundingBoxMapUtils.java#L52-L66
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java
AbstractTypeComputer.findDeclaredType
protected <Type extends JvmType> Type findDeclaredType(String clazzName, ITypeReferenceOwner owner) { """ @param clazzName FQN of the type to find. see {@link org.eclipse.xtext.common.types.access.IJvmTypeProvider#findTypeByName(String)}. @param owner the reference owner @since 2.14 """ @SuppressWarnings("unchecked") Type result = (Type) services.getTypeReferences().findDeclaredType(clazzName, owner.getContextResourceSet()); return result; }
java
protected <Type extends JvmType> Type findDeclaredType(String clazzName, ITypeReferenceOwner owner) { @SuppressWarnings("unchecked") Type result = (Type) services.getTypeReferences().findDeclaredType(clazzName, owner.getContextResourceSet()); return result; }
[ "protected", "<", "Type", "extends", "JvmType", ">", "Type", "findDeclaredType", "(", "String", "clazzName", ",", "ITypeReferenceOwner", "owner", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Type", "result", "=", "(", "Type", ")", "services", ...
@param clazzName FQN of the type to find. see {@link org.eclipse.xtext.common.types.access.IJvmTypeProvider#findTypeByName(String)}. @param owner the reference owner @since 2.14
[ "@param", "clazzName", "FQN", "of", "the", "type", "to", "find", ".", "see", "{", "@link", "org", ".", "eclipse", ".", "xtext", ".", "common", ".", "types", ".", "access", ".", "IJvmTypeProvider#findTypeByName", "(", "String", ")", "}", ".", "@param", "o...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/AbstractTypeComputer.java#L111-L115
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java
SelectOnUpdateHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { """ Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param changeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. Synchronize records after an update or add. """ // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE)) return this.syncRecords(); return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE)) return this.syncRecords(); return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Read a valid record", "int", "iErrorCode", "=", "super", ".", "doRecordChange", "(", "field", ",", "iChangeType", ",", "bDispla...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param changeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. Synchronize records after an update or add.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java#L72-L81
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2List
public List<List<String>> readExcel2List(String excelPath, int offsetLine) throws IOException, InvalidFormatException { """ 读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param excelPath 待读取Excel的路径 @param offsetLine Excel表头行(默认是0) @return 返回{@code List<List<String>>}类型的数据集合 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died """ try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0); } }
java
public List<List<String>> readExcel2List(String excelPath, int offsetLine) throws IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(new FileInputStream(new File(excelPath)))) { return readExcel2ObjectsHandler(workbook, offsetLine, Integer.MAX_VALUE, 0); } }
[ "public", "List", "<", "List", "<", "String", ">", ">", "readExcel2List", "(", "String", "excelPath", ",", "int", "offsetLine", ")", "throws", "IOException", ",", "InvalidFormatException", "{", "try", "(", "Workbook", "workbook", "=", "WorkbookFactory", ".", "...
读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param excelPath 待读取Excel的路径 @param offsetLine Excel表头行(默认是0) @return 返回{@code List<List<String>>}类型的数据集合 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel表格数据", "返回", "{", "@code", "List", "[", "List", "[", "String", "]]", "}", "类型的数据集合" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L357-L363
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/Launcher.java
Launcher.findLocations
protected void findLocations(BootstrapConfig bootProps, String processName) { """ Find main locations @param bootProps An instance of BootstrapConfig @param processName Process name to be used """ // Check for environment variables... String userDirStr = getEnv(BootstrapConstants.ENV_WLP_USER_DIR); String serversDirStr = getEnv(bootProps.getOutputDirectoryEnvName()); // Check for the variable calculated by the shell script first (X_LOG_DIR) // If that wasn't found, check for LOG_DIR set for java -jar invocation String logDirStr = getEnv(BootstrapConstants.ENV_X_LOG_DIR); if (logDirStr == null) logDirStr = getEnv(BootstrapConstants.ENV_LOG_DIR); // Likewise for X_LOG_FILE and LOG_FILE. String consoleLogFileStr = getEnv(BootstrapConstants.ENV_X_LOG_FILE); if (consoleLogFileStr == null) consoleLogFileStr = getEnv(BootstrapConstants.ENV_LOG_FILE); // Do enough processing to know where the directories should be.. // this should not cause any directories to be created bootProps.findLocations(processName, userDirStr, serversDirStr, logDirStr, consoleLogFileStr); }
java
protected void findLocations(BootstrapConfig bootProps, String processName) { // Check for environment variables... String userDirStr = getEnv(BootstrapConstants.ENV_WLP_USER_DIR); String serversDirStr = getEnv(bootProps.getOutputDirectoryEnvName()); // Check for the variable calculated by the shell script first (X_LOG_DIR) // If that wasn't found, check for LOG_DIR set for java -jar invocation String logDirStr = getEnv(BootstrapConstants.ENV_X_LOG_DIR); if (logDirStr == null) logDirStr = getEnv(BootstrapConstants.ENV_LOG_DIR); // Likewise for X_LOG_FILE and LOG_FILE. String consoleLogFileStr = getEnv(BootstrapConstants.ENV_X_LOG_FILE); if (consoleLogFileStr == null) consoleLogFileStr = getEnv(BootstrapConstants.ENV_LOG_FILE); // Do enough processing to know where the directories should be.. // this should not cause any directories to be created bootProps.findLocations(processName, userDirStr, serversDirStr, logDirStr, consoleLogFileStr); }
[ "protected", "void", "findLocations", "(", "BootstrapConfig", "bootProps", ",", "String", "processName", ")", "{", "// Check for environment variables...", "String", "userDirStr", "=", "getEnv", "(", "BootstrapConstants", ".", "ENV_WLP_USER_DIR", ")", ";", "String", "se...
Find main locations @param bootProps An instance of BootstrapConfig @param processName Process name to be used
[ "Find", "main", "locations" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/Launcher.java#L307-L326
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/ClusterInstance.java
ClusterInstance.createSlice
synchronized AllocatedSlice createSlice(final InstanceType reqType, final JobID jobID) { """ Tries to create a new slice on this instance. @param reqType the type describing the hardware characteristics of the slice @param jobID the ID of the job the new slice belongs to @return a new {@AllocatedSlice} object if a slice with the given hardware characteristics could still be accommodated on this instance or <code>null</code> if the instance's remaining resources were insufficient to host the desired slice """ // check whether we can accommodate the instance if (remainingCapacity.getNumberOfComputeUnits() >= reqType.getNumberOfComputeUnits() && remainingCapacity.getNumberOfCores() >= reqType.getNumberOfCores() && remainingCapacity.getMemorySize() >= reqType.getMemorySize() && remainingCapacity.getDiskCapacity() >= reqType.getDiskCapacity()) { // reduce available capacity by what has been requested remainingCapacity = InstanceTypeFactory.construct(remainingCapacity.getIdentifier(), remainingCapacity .getNumberOfComputeUnits() - reqType.getNumberOfComputeUnits(), remainingCapacity.getNumberOfCores() - reqType.getNumberOfCores(), remainingCapacity.getMemorySize() - reqType.getMemorySize(), remainingCapacity.getDiskCapacity() - reqType.getDiskCapacity(), remainingCapacity.getPricePerHour()); final long allocationTime = System.currentTimeMillis(); final AllocatedSlice slice = new AllocatedSlice(this, reqType, jobID, allocationTime); this.allocatedSlices.put(slice.getAllocationID(), slice); return slice; } // we cannot accommodate the instance return null; }
java
synchronized AllocatedSlice createSlice(final InstanceType reqType, final JobID jobID) { // check whether we can accommodate the instance if (remainingCapacity.getNumberOfComputeUnits() >= reqType.getNumberOfComputeUnits() && remainingCapacity.getNumberOfCores() >= reqType.getNumberOfCores() && remainingCapacity.getMemorySize() >= reqType.getMemorySize() && remainingCapacity.getDiskCapacity() >= reqType.getDiskCapacity()) { // reduce available capacity by what has been requested remainingCapacity = InstanceTypeFactory.construct(remainingCapacity.getIdentifier(), remainingCapacity .getNumberOfComputeUnits() - reqType.getNumberOfComputeUnits(), remainingCapacity.getNumberOfCores() - reqType.getNumberOfCores(), remainingCapacity.getMemorySize() - reqType.getMemorySize(), remainingCapacity.getDiskCapacity() - reqType.getDiskCapacity(), remainingCapacity.getPricePerHour()); final long allocationTime = System.currentTimeMillis(); final AllocatedSlice slice = new AllocatedSlice(this, reqType, jobID, allocationTime); this.allocatedSlices.put(slice.getAllocationID(), slice); return slice; } // we cannot accommodate the instance return null; }
[ "synchronized", "AllocatedSlice", "createSlice", "(", "final", "InstanceType", "reqType", ",", "final", "JobID", "jobID", ")", "{", "// check whether we can accommodate the instance", "if", "(", "remainingCapacity", ".", "getNumberOfComputeUnits", "(", ")", ">=", "reqType...
Tries to create a new slice on this instance. @param reqType the type describing the hardware characteristics of the slice @param jobID the ID of the job the new slice belongs to @return a new {@AllocatedSlice} object if a slice with the given hardware characteristics could still be accommodated on this instance or <code>null</code> if the instance's remaining resources were insufficient to host the desired slice
[ "Tries", "to", "create", "a", "new", "slice", "on", "this", "instance", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/ClusterInstance.java#L113-L137
stephenc/simple-java-mail
src/main/java/org/codemonkey/simplejavamail/Email.java
Email.addAttachment
public void addAttachment(final String name, final DataSource filedata) { """ Overloaded method which sets an attachment on account of name and {@link DataSource}. @param name The name of the attachment (eg. 'filename.ext'). @param filedata The attachment data. """ attachments.add(new AttachmentResource(name, filedata)); }
java
public void addAttachment(final String name, final DataSource filedata) { attachments.add(new AttachmentResource(name, filedata)); }
[ "public", "void", "addAttachment", "(", "final", "String", "name", ",", "final", "DataSource", "filedata", ")", "{", "attachments", ".", "add", "(", "new", "AttachmentResource", "(", "name", ",", "filedata", ")", ")", ";", "}" ]
Overloaded method which sets an attachment on account of name and {@link DataSource}. @param name The name of the attachment (eg. 'filename.ext'). @param filedata The attachment data.
[ "Overloaded", "method", "which", "sets", "an", "attachment", "on", "account", "of", "name", "and", "{", "@link", "DataSource", "}", "." ]
train
https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L156-L158
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCustomPrebuiltEntityRolesAsync
public Observable<List<EntityRole>> getCustomPrebuiltEntityRolesAsync(UUID appId, String versionId, UUID entityId) { """ Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityRole&gt; object """ return getCustomPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
java
public Observable<List<EntityRole>> getCustomPrebuiltEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getCustomPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EntityRole", ">", ">", "getCustomPrebuiltEntityRolesAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getCustomPrebuiltEntityRolesWithServiceResponseAsync", "(", "appId", ...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityRole&gt; object
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9646-L9653
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/graph/invariant/InvariantRanker.java
InvariantRanker.insertionSortBy
static void insertionSortBy(int[] vs, int lo, int len, long[] curr, long[] prev) { """ Sort the values (using insertion sort) in {@code vs} from {@code lo} (until {@code len}) by the {@code prev[]} and then {@code curr[]} invariants to determine rank. The values in {@code vs} are indices into the invariant arrays. @param vs values (indices) @param lo the first value to start sorting from @param len the len of values to consider @param curr the current invariants @param prev the previous invariants """ for (int j = lo + 1, hi = lo + len; j < hi; j++) { int v = vs[j]; int i = j - 1; while ((i >= lo) && less(v, vs[i], curr, prev)) vs[i + 1] = vs[i--]; vs[i + 1] = v; } }
java
static void insertionSortBy(int[] vs, int lo, int len, long[] curr, long[] prev) { for (int j = lo + 1, hi = lo + len; j < hi; j++) { int v = vs[j]; int i = j - 1; while ((i >= lo) && less(v, vs[i], curr, prev)) vs[i + 1] = vs[i--]; vs[i + 1] = v; } }
[ "static", "void", "insertionSortBy", "(", "int", "[", "]", "vs", ",", "int", "lo", ",", "int", "len", ",", "long", "[", "]", "curr", ",", "long", "[", "]", "prev", ")", "{", "for", "(", "int", "j", "=", "lo", "+", "1", ",", "hi", "=", "lo", ...
Sort the values (using insertion sort) in {@code vs} from {@code lo} (until {@code len}) by the {@code prev[]} and then {@code curr[]} invariants to determine rank. The values in {@code vs} are indices into the invariant arrays. @param vs values (indices) @param lo the first value to start sorting from @param len the len of values to consider @param curr the current invariants @param prev the previous invariants
[ "Sort", "the", "values", "(", "using", "insertion", "sort", ")", "in", "{", "@code", "vs", "}", "from", "{", "@code", "lo", "}", "(", "until", "{", "@code", "len", "}", ")", "by", "the", "{", "@code", "prev", "[]", "}", "and", "then", "{", "@code...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/graph/invariant/InvariantRanker.java#L194-L202
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java
AbstractHolidayParser.isValid
protected static final boolean isValid (final Holiday aHoliday, final int nYear) { """ Evaluates if the provided <code>Holiday</code> instance is valid for the provided year. @param aHoliday The holiday configuration entry to validate @param nYear The year to validate against. @return is valid for the year. """ return _isValidInYear (aHoliday, nYear) && _isValidForCycle (aHoliday, nYear); }
java
protected static final boolean isValid (final Holiday aHoliday, final int nYear) { return _isValidInYear (aHoliday, nYear) && _isValidForCycle (aHoliday, nYear); }
[ "protected", "static", "final", "boolean", "isValid", "(", "final", "Holiday", "aHoliday", ",", "final", "int", "nYear", ")", "{", "return", "_isValidInYear", "(", "aHoliday", ",", "nYear", ")", "&&", "_isValidForCycle", "(", "aHoliday", ",", "nYear", ")", "...
Evaluates if the provided <code>Holiday</code> instance is valid for the provided year. @param aHoliday The holiday configuration entry to validate @param nYear The year to validate against. @return is valid for the year.
[ "Evaluates", "if", "the", "provided", "<code", ">", "Holiday<", "/", "code", ">", "instance", "is", "valid", "for", "the", "provided", "year", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java#L53-L56
albfernandez/itext2
src/main/java/com/lowagie/text/Utilities.java
Utilities.isSurrogatePair
public static boolean isSurrogatePair(String text, int idx) { """ Checks if two subsequent characters in a String are are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character). @param text the String with the high and low surrogate characters @param idx the index of the 'high' character in the pair @return true if the characters are surrogate pairs @since 2.1.2 """ if (idx < 0 || idx > text.length() - 2) return false; return isSurrogateHigh(text.charAt(idx)) && isSurrogateLow(text.charAt(idx + 1)); }
java
public static boolean isSurrogatePair(String text, int idx) { if (idx < 0 || idx > text.length() - 2) return false; return isSurrogateHigh(text.charAt(idx)) && isSurrogateLow(text.charAt(idx + 1)); }
[ "public", "static", "boolean", "isSurrogatePair", "(", "String", "text", ",", "int", "idx", ")", "{", "if", "(", "idx", "<", "0", "||", "idx", ">", "text", ".", "length", "(", ")", "-", "2", ")", "return", "false", ";", "return", "isSurrogateHigh", "...
Checks if two subsequent characters in a String are are the higher and the lower character in a surrogate pair (and therefore eligible for conversion to a UTF 32 character). @param text the String with the high and low surrogate characters @param idx the index of the 'high' character in the pair @return true if the characters are surrogate pairs @since 2.1.2
[ "Checks", "if", "two", "subsequent", "characters", "in", "a", "String", "are", "are", "the", "higher", "and", "the", "lower", "character", "in", "a", "surrogate", "pair", "(", "and", "therefore", "eligible", "for", "conversion", "to", "a", "UTF", "32", "ch...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Utilities.java#L275-L279
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/URLField.java
URLField.setupDefaultView
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { """ Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @return Return the component or ScreenField that is created for this field. """ if (converter.getMaxLength() > ScreenConstants.MAX_SINGLE_CHARS) converter = new FieldLengthConverter((Converter)converter, ScreenConstants.MAX_SINGLE_CHARS); // Show as a single line. ScreenComponent sScreenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.URL); properties.put(ScreenModel.IMAGE, ScreenModel.URL); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return sScreenField; }
java
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { if (converter.getMaxLength() > ScreenConstants.MAX_SINGLE_CHARS) converter = new FieldLengthConverter((Converter)converter, ScreenConstants.MAX_SINGLE_CHARS); // Show as a single line. ScreenComponent sScreenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.URL); properties.put(ScreenModel.IMAGE, ScreenModel.URL); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return sScreenField; }
[ "public", "ScreenComponent", "setupDefaultView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "("...
Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @return Return the component or ScreenField that is created for this field.
[ "Set", "up", "the", "default", "screen", "control", "for", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/URLField.java#L94-L106
SG-O/miIO
src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java
Vacuum.setSoundVolume
public boolean setSoundVolume(int volume) throws CommandExecutionException { """ Set the vacuums volume. @param volume The volume between 0 and 100. @return True if the command was received successfully. @throws CommandExecutionException When there has been a error during the communication or the response was invalid. """ if (volume < 0) volume = 0; if (volume > 100) volume = 100; JSONArray payload = new JSONArray(); payload.put(volume); return sendOk("change_sound_volume", payload); }
java
public boolean setSoundVolume(int volume) throws CommandExecutionException { if (volume < 0) volume = 0; if (volume > 100) volume = 100; JSONArray payload = new JSONArray(); payload.put(volume); return sendOk("change_sound_volume", payload); }
[ "public", "boolean", "setSoundVolume", "(", "int", "volume", ")", "throws", "CommandExecutionException", "{", "if", "(", "volume", "<", "0", ")", "volume", "=", "0", ";", "if", "(", "volume", ">", "100", ")", "volume", "=", "100", ";", "JSONArray", "payl...
Set the vacuums volume. @param volume The volume between 0 and 100. @return True if the command was received successfully. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Set", "the", "vacuums", "volume", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L446-L452
OpenTSDB/opentsdb
src/graph/Plot.java
Plot.setParams
public void setParams(final Map<String, String> params) { """ Sets the global parameters for this plot. @param params Each entry is a Gnuplot setting that will be written as-is in the Gnuplot script file: {@code set KEY VALUE}. When the value is {@code null} the script will instead contain {@code unset KEY}. <p> Special parameters with a special meaning (since OpenTSDB 1.1): <ul> <li>{@code bgcolor}: Either {@code transparent} or an RGB color in hexadecimal (with a leading 'x' as in {@code x01AB23}).</li> <li>{@code fgcolor}: An RGB color in hexadecimal ({@code x42BEE7}).</li> </ul> """ // check "format y" and "format y2" String[] y_format_keys = {"format y", "format y2"}; for(String k : y_format_keys){ if(params.containsKey(k)){ params.put(k, URLDecoder.decode(params.get(k))); } } this.params = params; }
java
public void setParams(final Map<String, String> params) { // check "format y" and "format y2" String[] y_format_keys = {"format y", "format y2"}; for(String k : y_format_keys){ if(params.containsKey(k)){ params.put(k, URLDecoder.decode(params.get(k))); } } this.params = params; }
[ "public", "void", "setParams", "(", "final", "Map", "<", "String", ",", "String", ">", "params", ")", "{", "// check \"format y\" and \"format y2\"", "String", "[", "]", "y_format_keys", "=", "{", "\"format y\"", ",", "\"format y2\"", "}", ";", "for", "(", "St...
Sets the global parameters for this plot. @param params Each entry is a Gnuplot setting that will be written as-is in the Gnuplot script file: {@code set KEY VALUE}. When the value is {@code null} the script will instead contain {@code unset KEY}. <p> Special parameters with a special meaning (since OpenTSDB 1.1): <ul> <li>{@code bgcolor}: Either {@code transparent} or an RGB color in hexadecimal (with a leading 'x' as in {@code x01AB23}).</li> <li>{@code fgcolor}: An RGB color in hexadecimal ({@code x42BEE7}).</li> </ul>
[ "Sets", "the", "global", "parameters", "for", "this", "plot", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/graph/Plot.java#L137-L146
apache/incubator-druid
extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java
ParquetGroupConverter.unwrapListPrimitive
Object unwrapListPrimitive(Object o) { """ Properly formed parquet lists when passed through {@link ParquetGroupConverter#convertField(Group, String)} can return lists which contain 'wrapped' primitives, that are a {@link Group} with a single, primitive field (see {@link ParquetGroupConverter#isWrappedListPrimitive(Object)}) """ assert isWrappedListPrimitive(o); Group g = (Group) o; return convertPrimitiveField(g, 0, binaryAsString); }
java
Object unwrapListPrimitive(Object o) { assert isWrappedListPrimitive(o); Group g = (Group) o; return convertPrimitiveField(g, 0, binaryAsString); }
[ "Object", "unwrapListPrimitive", "(", "Object", "o", ")", "{", "assert", "isWrappedListPrimitive", "(", "o", ")", ";", "Group", "g", "=", "(", "Group", ")", "o", ";", "return", "convertPrimitiveField", "(", "g", ",", "0", ",", "binaryAsString", ")", ";", ...
Properly formed parquet lists when passed through {@link ParquetGroupConverter#convertField(Group, String)} can return lists which contain 'wrapped' primitives, that are a {@link Group} with a single, primitive field (see {@link ParquetGroupConverter#isWrappedListPrimitive(Object)})
[ "Properly", "formed", "parquet", "lists", "when", "passed", "through", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java#L495-L500
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.writeAsCsv
@PublicEvolving public DataStreamSink<T> writeAsCsv(String path, WriteMode writeMode) { """ Writes a DataStream to the file specified by the path parameter. <p>For every field of an element of the DataStream the result of {@link Object#toString()} is written. This method can only be used on data streams of tuples. @param path the path pointing to the location the text file is written to @param writeMode Controls the behavior for existing files. Options are NO_OVERWRITE and OVERWRITE. @return the closed DataStream """ return writeAsCsv(path, writeMode, CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER); }
java
@PublicEvolving public DataStreamSink<T> writeAsCsv(String path, WriteMode writeMode) { return writeAsCsv(path, writeMode, CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER); }
[ "@", "PublicEvolving", "public", "DataStreamSink", "<", "T", ">", "writeAsCsv", "(", "String", "path", ",", "WriteMode", "writeMode", ")", "{", "return", "writeAsCsv", "(", "path", ",", "writeMode", ",", "CsvOutputFormat", ".", "DEFAULT_LINE_DELIMITER", ",", "Cs...
Writes a DataStream to the file specified by the path parameter. <p>For every field of an element of the DataStream the result of {@link Object#toString()} is written. This method can only be used on data streams of tuples. @param path the path pointing to the location the text file is written to @param writeMode Controls the behavior for existing files. Options are NO_OVERWRITE and OVERWRITE. @return the closed DataStream
[ "Writes", "a", "DataStream", "to", "the", "file", "specified", "by", "the", "path", "parameter", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1080-L1083
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.findMethodOrThrowException
@SuppressWarnings("all") public static Method findMethodOrThrowException(Class<?> type, String methodName, Class<?>... parameterTypes) { """ Find method or throw exception. @param type the type @param methodName the method name @param parameterTypes the parameter types @return the method """ Method methodToMock = findMethod(type, methodName, parameterTypes); throwExceptionIfMethodWasNotFound(type, methodName, methodToMock, (Object[]) parameterTypes); return methodToMock; }
java
@SuppressWarnings("all") public static Method findMethodOrThrowException(Class<?> type, String methodName, Class<?>... parameterTypes) { Method methodToMock = findMethod(type, methodName, parameterTypes); throwExceptionIfMethodWasNotFound(type, methodName, methodToMock, (Object[]) parameterTypes); return methodToMock; }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "Method", "findMethodOrThrowException", "(", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Method", "methodToMock"...
Find method or throw exception. @param type the type @param methodName the method name @param parameterTypes the parameter types @return the method
[ "Find", "method", "or", "throw", "exception", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1717-L1722
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java
S3RequestEndpointResolver.resolveRequestEndpoint
public void resolveRequestEndpoint(Request<?> request, String regionString) { """ Set the request's endpoint and resource path with the new region provided @param request Request to set endpoint for @param regionString New region to determine endpoint to hit """ if (regionString != null) { final Region r = RegionUtils.getRegion(regionString); if (r == null) { throw new SdkClientException("Not able to determine region" + " for " + regionString + ".Please upgrade to a newer " + "version of the SDK"); } endpointBuilder.withRegion(r); } final URI endpoint = endpointBuilder.getServiceEndpoint(); if (shouldUseVirtualAddressing(endpoint)) { request.setEndpoint(convertToVirtualHostEndpoint(endpoint, bucketName)); request.setResourcePath(SdkHttpUtils.urlEncode(getHostStyleResourcePath(), true)); } else { request.setEndpoint(endpoint); if (bucketName != null) { request.setResourcePath(SdkHttpUtils.urlEncode(getPathStyleResourcePath(), true)); } } }
java
public void resolveRequestEndpoint(Request<?> request, String regionString) { if (regionString != null) { final Region r = RegionUtils.getRegion(regionString); if (r == null) { throw new SdkClientException("Not able to determine region" + " for " + regionString + ".Please upgrade to a newer " + "version of the SDK"); } endpointBuilder.withRegion(r); } final URI endpoint = endpointBuilder.getServiceEndpoint(); if (shouldUseVirtualAddressing(endpoint)) { request.setEndpoint(convertToVirtualHostEndpoint(endpoint, bucketName)); request.setResourcePath(SdkHttpUtils.urlEncode(getHostStyleResourcePath(), true)); } else { request.setEndpoint(endpoint); if (bucketName != null) { request.setResourcePath(SdkHttpUtils.urlEncode(getPathStyleResourcePath(), true)); } } }
[ "public", "void", "resolveRequestEndpoint", "(", "Request", "<", "?", ">", "request", ",", "String", "regionString", ")", "{", "if", "(", "regionString", "!=", "null", ")", "{", "final", "Region", "r", "=", "RegionUtils", ".", "getRegion", "(", "regionString...
Set the request's endpoint and resource path with the new region provided @param request Request to set endpoint for @param regionString New region to determine endpoint to hit
[ "Set", "the", "request", "s", "endpoint", "and", "resource", "path", "with", "the", "new", "region", "provided" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java#L101-L123
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.processAlterTableDropColumn
void processAlterTableDropColumn(Table table, String colName, boolean cascade) { """ Responsible for handling tail of ALTER TABLE ... DROP COLUMN ... """ int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropColumn(colindex, cascade); //VoltDB extension to support Time to live if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) { table.dropTTL(); } }
java
void processAlterTableDropColumn(Table table, String colName, boolean cascade) { int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } session.commit(false); TableWorks tableWorks = new TableWorks(session, table); tableWorks.dropColumn(colindex, cascade); //VoltDB extension to support Time to live if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) { table.dropTTL(); } }
[ "void", "processAlterTableDropColumn", "(", "Table", "table", ",", "String", "colName", ",", "boolean", "cascade", ")", "{", "int", "colindex", "=", "table", ".", "getColumnIndex", "(", "colName", ")", ";", "if", "(", "table", ".", "getColumnCount", "(", ")"...
Responsible for handling tail of ALTER TABLE ... DROP COLUMN ...
[ "Responsible", "for", "handling", "tail", "of", "ALTER", "TABLE", "...", "DROP", "COLUMN", "..." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L4221-L4240
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/aggregate/CrossTab.java
CrossTab.columnPercents
public static Table columnPercents(Table table, String column1, String column2) { """ Returns a table containing the column percents made from a source table, after first calculating the counts cross-tabulated from the given columns """ return columnPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
java
public static Table columnPercents(Table table, String column1, String column2) { return columnPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
[ "public", "static", "Table", "columnPercents", "(", "Table", "table", ",", "String", "column1", ",", "String", "column2", ")", "{", "return", "columnPercents", "(", "table", ",", "table", ".", "categoricalColumn", "(", "column1", ")", ",", "table", ".", "cat...
Returns a table containing the column percents made from a source table, after first calculating the counts cross-tabulated from the given columns
[ "Returns", "a", "table", "containing", "the", "column", "percents", "made", "from", "a", "source", "table", "after", "first", "calculating", "the", "counts", "cross", "-", "tabulated", "from", "the", "given", "columns" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/aggregate/CrossTab.java#L253-L255
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java
ZWaveController.requestValue
public void requestValue(int nodeId, int endpoint) { """ Request value from the node / endpoint; @param nodeId the node id to request the value for. @param endpoint the endpoint to request the value for. """ ZWaveNode node = this.getNode(nodeId); ZWaveGetCommands zwaveCommandClass = null; SerialMessage serialMessage = null; for (ZWaveCommandClass.CommandClass commandClass : new ZWaveCommandClass.CommandClass[] { ZWaveCommandClass.CommandClass.SENSOR_BINARY, ZWaveCommandClass.CommandClass.SENSOR_ALARM, ZWaveCommandClass.CommandClass.SENSOR_MULTILEVEL, ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL, ZWaveCommandClass.CommandClass.SWITCH_BINARY, ZWaveCommandClass.CommandClass.BASIC }) { zwaveCommandClass = (ZWaveGetCommands)node.resolveCommandClass(commandClass, endpoint); if (zwaveCommandClass != null) break; } if (zwaveCommandClass == null) { logger.error("No Command Class found on node {}, instance/endpoint {} to request value.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveCommandClass.getValueMessage(), (ZWaveCommandClass)zwaveCommandClass, endpoint); if (serialMessage != null) this.sendData(serialMessage); }
java
public void requestValue(int nodeId, int endpoint) { ZWaveNode node = this.getNode(nodeId); ZWaveGetCommands zwaveCommandClass = null; SerialMessage serialMessage = null; for (ZWaveCommandClass.CommandClass commandClass : new ZWaveCommandClass.CommandClass[] { ZWaveCommandClass.CommandClass.SENSOR_BINARY, ZWaveCommandClass.CommandClass.SENSOR_ALARM, ZWaveCommandClass.CommandClass.SENSOR_MULTILEVEL, ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL, ZWaveCommandClass.CommandClass.SWITCH_BINARY, ZWaveCommandClass.CommandClass.BASIC }) { zwaveCommandClass = (ZWaveGetCommands)node.resolveCommandClass(commandClass, endpoint); if (zwaveCommandClass != null) break; } if (zwaveCommandClass == null) { logger.error("No Command Class found on node {}, instance/endpoint {} to request value.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveCommandClass.getValueMessage(), (ZWaveCommandClass)zwaveCommandClass, endpoint); if (serialMessage != null) this.sendData(serialMessage); }
[ "public", "void", "requestValue", "(", "int", "nodeId", ",", "int", "endpoint", ")", "{", "ZWaveNode", "node", "=", "this", ".", "getNode", "(", "nodeId", ")", ";", "ZWaveGetCommands", "zwaveCommandClass", "=", "null", ";", "SerialMessage", "serialMessage", "=...
Request value from the node / endpoint; @param nodeId the node id to request the value for. @param endpoint the endpoint to request the value for.
[ "Request", "value", "from", "the", "node", "/", "endpoint", ";" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L854-L874
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java
InodeTreePersistentState.updateLastModifiedAndChildCount
private void updateLastModifiedAndChildCount(long id, long opTimeMs, long deltaChildCount) { """ Updates the last modified time (LMT) for the indicated inode directory, and updates its child count. If the inode's LMT is already greater than the specified time, the inode's LMT will not be changed. @param id the inode to update @param opTimeMs the time of the operation that modified the inode @param deltaChildCount the change in inode directory child count """ try (LockResource lr = mInodeLockManager.lockUpdate(id)) { MutableInodeDirectory inode = mInodeStore.getMutable(id).get().asDirectory(); boolean madeUpdate = false; if (inode.getLastModificationTimeMs() < opTimeMs) { inode.setLastModificationTimeMs(opTimeMs); madeUpdate = true; } if (deltaChildCount != 0) { inode.setChildCount(inode.getChildCount() + deltaChildCount); madeUpdate = true; } if (madeUpdate) { mInodeStore.writeInode(inode); } } }
java
private void updateLastModifiedAndChildCount(long id, long opTimeMs, long deltaChildCount) { try (LockResource lr = mInodeLockManager.lockUpdate(id)) { MutableInodeDirectory inode = mInodeStore.getMutable(id).get().asDirectory(); boolean madeUpdate = false; if (inode.getLastModificationTimeMs() < opTimeMs) { inode.setLastModificationTimeMs(opTimeMs); madeUpdate = true; } if (deltaChildCount != 0) { inode.setChildCount(inode.getChildCount() + deltaChildCount); madeUpdate = true; } if (madeUpdate) { mInodeStore.writeInode(inode); } } }
[ "private", "void", "updateLastModifiedAndChildCount", "(", "long", "id", ",", "long", "opTimeMs", ",", "long", "deltaChildCount", ")", "{", "try", "(", "LockResource", "lr", "=", "mInodeLockManager", ".", "lockUpdate", "(", "id", ")", ")", "{", "MutableInodeDire...
Updates the last modified time (LMT) for the indicated inode directory, and updates its child count. If the inode's LMT is already greater than the specified time, the inode's LMT will not be changed. @param id the inode to update @param opTimeMs the time of the operation that modified the inode @param deltaChildCount the change in inode directory child count
[ "Updates", "the", "last", "modified", "time", "(", "LMT", ")", "for", "the", "indicated", "inode", "directory", "and", "updates", "its", "child", "count", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java#L573-L589
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java
TransformationPerformer.loadObjectFromField
private Object loadObjectFromField(String fieldname, Object object, Object alternative) throws Exception { """ Loads the object from the field with the given name from either the object parameter or if this parameter is null from the alternative parameter. """ Object source = object != null ? object : alternative; try { return FieldUtils.readField(source, fieldname, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to load field '%s' from object '%s'", fieldname, source.getClass().getName())); } }
java
private Object loadObjectFromField(String fieldname, Object object, Object alternative) throws Exception { Object source = object != null ? object : alternative; try { return FieldUtils.readField(source, fieldname, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to load field '%s' from object '%s'", fieldname, source.getClass().getName())); } }
[ "private", "Object", "loadObjectFromField", "(", "String", "fieldname", ",", "Object", "object", ",", "Object", "alternative", ")", "throws", "Exception", "{", "Object", "source", "=", "object", "!=", "null", "?", "object", ":", "alternative", ";", "try", "{",...
Loads the object from the field with the given name from either the object parameter or if this parameter is null from the alternative parameter.
[ "Loads", "the", "object", "from", "the", "field", "with", "the", "given", "name", "from", "either", "the", "object", "parameter", "or", "if", "this", "parameter", "is", "null", "from", "the", "alternative", "parameter", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L196-L204
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityLeafSpec.java
CardinalityLeafSpec.applyCardinality
@Override public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) { """ If this CardinalitySpec matches the inputkey, then do the work of modifying the data and return true. @return true if this this spec "handles" the inputkey such that no sibling specs need to see it """ MatchedElement thisLevel = getMatch( inputKey, walkedPath ); if ( thisLevel == null ) { return false; } performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel ); return true; }
java
@Override public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) { MatchedElement thisLevel = getMatch( inputKey, walkedPath ); if ( thisLevel == null ) { return false; } performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel ); return true; }
[ "@", "Override", "public", "boolean", "applyCardinality", "(", "String", "inputKey", ",", "Object", "input", ",", "WalkedPath", "walkedPath", ",", "Object", "parentContainer", ")", "{", "MatchedElement", "thisLevel", "=", "getMatch", "(", "inputKey", ",", "walkedP...
If this CardinalitySpec matches the inputkey, then do the work of modifying the data and return true. @return true if this this spec "handles" the inputkey such that no sibling specs need to see it
[ "If", "this", "CardinalitySpec", "matches", "the", "inputkey", "then", "do", "the", "work", "of", "modifying", "the", "data", "and", "return", "true", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityLeafSpec.java#L59-L68
i-net-software/jlessc
src/com/inet/lib/less/ValueExpression.java
ValueExpression.eval
public static ValueExpression eval( CssFormatter formatter, Expression expr ) { """ Create a value expression as parameter for a mixin which not change it value in a different context. @param formatter current formatter @param expr current expression @return a ValueExpression """ expr = expr.unpack( formatter ); // unpack to increase the chance to find a ValueExpression if( expr.getClass() == ValueExpression.class ) { return (ValueExpression)expr; } ValueExpression valueEx = new ValueExpression( expr, expr.stringValue( formatter ) ); valueEx.type = expr.getDataType( formatter ); valueEx.unit = expr.unit( formatter ); switch( valueEx.type ) { case STRING: case BOOLEAN: break; //string is already set case LIST: Operation op = valueEx.op = new Operation( expr, ' ' ); ArrayList<Expression> operants = expr.listValue( formatter ).getOperands(); for( int j = 0; j < operants.size(); j++ ) { op.addOperand( ValueExpression.eval( formatter, operants.get( j ) ) ); } break; default: valueEx.value = expr.doubleValue( formatter ); } return valueEx; }
java
public static ValueExpression eval( CssFormatter formatter, Expression expr ) { expr = expr.unpack( formatter ); // unpack to increase the chance to find a ValueExpression if( expr.getClass() == ValueExpression.class ) { return (ValueExpression)expr; } ValueExpression valueEx = new ValueExpression( expr, expr.stringValue( formatter ) ); valueEx.type = expr.getDataType( formatter ); valueEx.unit = expr.unit( formatter ); switch( valueEx.type ) { case STRING: case BOOLEAN: break; //string is already set case LIST: Operation op = valueEx.op = new Operation( expr, ' ' ); ArrayList<Expression> operants = expr.listValue( formatter ).getOperands(); for( int j = 0; j < operants.size(); j++ ) { op.addOperand( ValueExpression.eval( formatter, operants.get( j ) ) ); } break; default: valueEx.value = expr.doubleValue( formatter ); } return valueEx; }
[ "public", "static", "ValueExpression", "eval", "(", "CssFormatter", "formatter", ",", "Expression", "expr", ")", "{", "expr", "=", "expr", ".", "unpack", "(", "formatter", ")", ";", "// unpack to increase the chance to find a ValueExpression", "if", "(", "expr", "."...
Create a value expression as parameter for a mixin which not change it value in a different context. @param formatter current formatter @param expr current expression @return a ValueExpression
[ "Create", "a", "value", "expression", "as", "parameter", "for", "a", "mixin", "which", "not", "change", "it", "value", "in", "a", "different", "context", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ValueExpression.java#L99-L122
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/Path.java
Path.calcPoints
public PointList calcPoints() { """ This method calculated a list of points for this path <p> @return this path its geometry """ final PointList points = new PointList(edgeIds.size() + 1, nodeAccess.is3D()); if (edgeIds.isEmpty()) { if (isFound()) { points.add(graph.getNodeAccess(), endNode); } return points; } int tmpNode = getFromNode(); points.add(nodeAccess, tmpNode); forEveryEdge(new EdgeVisitor() { @Override public void next(EdgeIteratorState eb, int index, int prevEdgeId) { PointList pl = eb.fetchWayGeometry(2); for (int j = 0; j < pl.getSize(); j++) { points.add(pl, j); } } @Override public void finish() { } }); return points; }
java
public PointList calcPoints() { final PointList points = new PointList(edgeIds.size() + 1, nodeAccess.is3D()); if (edgeIds.isEmpty()) { if (isFound()) { points.add(graph.getNodeAccess(), endNode); } return points; } int tmpNode = getFromNode(); points.add(nodeAccess, tmpNode); forEveryEdge(new EdgeVisitor() { @Override public void next(EdgeIteratorState eb, int index, int prevEdgeId) { PointList pl = eb.fetchWayGeometry(2); for (int j = 0; j < pl.getSize(); j++) { points.add(pl, j); } } @Override public void finish() { } }); return points; }
[ "public", "PointList", "calcPoints", "(", ")", "{", "final", "PointList", "points", "=", "new", "PointList", "(", "edgeIds", ".", "size", "(", ")", "+", "1", ",", "nodeAccess", ".", "is3D", "(", ")", ")", ";", "if", "(", "edgeIds", ".", "isEmpty", "(...
This method calculated a list of points for this path <p> @return this path its geometry
[ "This", "method", "calculated", "a", "list", "of", "points", "for", "this", "path", "<p", ">" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/Path.java#L331-L357
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java
UserBS.changePassword
public boolean changePassword(String password, User user) { """ Trocar o password do usuário. @param password Novo password. @param user Usuário para trocar seu password. @return true Troca de password do usuário ocorreu com sucesso. """ user.setPassword(CryptManager.passwordHash(password)); this.dao.persist(user); return true; }
java
public boolean changePassword(String password, User user) { user.setPassword(CryptManager.passwordHash(password)); this.dao.persist(user); return true; }
[ "public", "boolean", "changePassword", "(", "String", "password", ",", "User", "user", ")", "{", "user", ".", "setPassword", "(", "CryptManager", ".", "passwordHash", "(", "password", ")", ")", ";", "this", ".", "dao", ".", "persist", "(", "user", ")", "...
Trocar o password do usuário. @param password Novo password. @param user Usuário para trocar seu password. @return true Troca de password do usuário ocorreu com sucesso.
[ "Trocar", "o", "password", "do", "usuário", "." ]
train
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java#L122-L127
RobertStewart/privateer
src/main/java/com/wombatnation/privateer/Privateer.java
Privateer.setField
public void setField(Object o, String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException { """ Sets the specified field on Object o to the specified value, even if that field is not normally accessible. Only fields declared on the class for Object o can be accessed. @param o Object to access @param fieldName Name of field whose value will be set @param value Object value that will be set for the field @throws NoSuchFieldException if no field matches <code>fieldName</code> @throws IllegalAccessException @throws IllegalArgumentException if the type of <code>value</code> is incorrect """ Field field = o.getClass().getDeclaredField(fieldName); field.setAccessible(true); field.set(o, value); }
java
public void setField(Object o, String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException { Field field = o.getClass().getDeclaredField(fieldName); field.setAccessible(true); field.set(o, value); }
[ "public", "void", "setField", "(", "Object", "o", ",", "String", "fieldName", ",", "Object", "value", ")", "throws", "NoSuchFieldException", ",", "IllegalAccessException", "{", "Field", "field", "=", "o", ".", "getClass", "(", ")", ".", "getDeclaredField", "("...
Sets the specified field on Object o to the specified value, even if that field is not normally accessible. Only fields declared on the class for Object o can be accessed. @param o Object to access @param fieldName Name of field whose value will be set @param value Object value that will be set for the field @throws NoSuchFieldException if no field matches <code>fieldName</code> @throws IllegalAccessException @throws IllegalArgumentException if the type of <code>value</code> is incorrect
[ "Sets", "the", "specified", "field", "on", "Object", "o", "to", "the", "specified", "value", "even", "if", "that", "field", "is", "not", "normally", "accessible", ".", "Only", "fields", "declared", "on", "the", "class", "for", "Object", "o", "can", "be", ...
train
https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L96-L102
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java
ModelsEngine.go_downstream
public static boolean go_downstream( int[] colRow, double flowdirection ) { """ Moves one pixel downstream. @param colRow the array containing the column and row of the current pixel. It will be modified here to represent the next downstream pixel. @param flowdirection the current flowdirection number. @return true if everything went well. """ int n = (int) flowdirection; if (n == 10) { return true; } else if (n < 1 || n > 9) { return false; } else { colRow[1] += DIR[n][0]; colRow[0] += DIR[n][1]; return true; } }
java
public static boolean go_downstream( int[] colRow, double flowdirection ) { int n = (int) flowdirection; if (n == 10) { return true; } else if (n < 1 || n > 9) { return false; } else { colRow[1] += DIR[n][0]; colRow[0] += DIR[n][1]; return true; } }
[ "public", "static", "boolean", "go_downstream", "(", "int", "[", "]", "colRow", ",", "double", "flowdirection", ")", "{", "int", "n", "=", "(", "int", ")", "flowdirection", ";", "if", "(", "n", "==", "10", ")", "{", "return", "true", ";", "}", "else"...
Moves one pixel downstream. @param colRow the array containing the column and row of the current pixel. It will be modified here to represent the next downstream pixel. @param flowdirection the current flowdirection number. @return true if everything went well.
[ "Moves", "one", "pixel", "downstream", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L105-L117
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java
SegmentAggregator.checkValidOperation
private void checkValidOperation(SegmentOperation operation) throws DataCorruptionException { """ Ensures the following conditions are met: * SegmentId matches this SegmentAggregator's SegmentId * If Segment is Sealed, only TruncateSegmentOperations are allowed. * If Segment is deleted, no further operations are allowed. @param operation The operation to check. @throws IllegalArgumentException If any of the validations failed. """ // Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance. Preconditions.checkArgument( operation.getStreamSegmentId() == this.metadata.getId(), "Operation '%s' refers to a different Segment than this one (%s).", operation, this.metadata.getId()); // After Sealing, we can only Truncate or Delete a Segment. if (this.hasSealPending.get() && !isTruncateOperation(operation) && !isDeleteOperation(operation)) { throw new DataCorruptionException(String.format("Illegal operation for a sealed Segment; received '%s'.", operation)); } }
java
private void checkValidOperation(SegmentOperation operation) throws DataCorruptionException { // Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance. Preconditions.checkArgument( operation.getStreamSegmentId() == this.metadata.getId(), "Operation '%s' refers to a different Segment than this one (%s).", operation, this.metadata.getId()); // After Sealing, we can only Truncate or Delete a Segment. if (this.hasSealPending.get() && !isTruncateOperation(operation) && !isDeleteOperation(operation)) { throw new DataCorruptionException(String.format("Illegal operation for a sealed Segment; received '%s'.", operation)); } }
[ "private", "void", "checkValidOperation", "(", "SegmentOperation", "operation", ")", "throws", "DataCorruptionException", "{", "// Verify that the SegmentOperation has been routed to the correct SegmentAggregator instance.", "Preconditions", ".", "checkArgument", "(", "operation", "....
Ensures the following conditions are met: * SegmentId matches this SegmentAggregator's SegmentId * If Segment is Sealed, only TruncateSegmentOperations are allowed. * If Segment is deleted, no further operations are allowed. @param operation The operation to check. @throws IllegalArgumentException If any of the validations failed.
[ "Ensures", "the", "following", "conditions", "are", "met", ":", "*", "SegmentId", "matches", "this", "SegmentAggregator", "s", "SegmentId", "*", "If", "Segment", "is", "Sealed", "only", "TruncateSegmentOperations", "are", "allowed", ".", "*", "If", "Segment", "i...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1526-L1536
sagiegurari/fax4j
src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java
WindowsProcessFaxClientSpi.createProcessCommandArgumentsForSubmitFaxJob
protected String createProcessCommandArgumentsForSubmitFaxJob(FaxJob faxJob) { """ This function creates and returns the command line arguments for the fax4j external exe when running the submit fax job action. @param faxJob The fax job object @return The full command line arguments line """ //get values from fax job String targetAddress=faxJob.getTargetAddress(); String targetName=faxJob.getTargetName(); String senderName=faxJob.getSenderName(); File file=faxJob.getFile(); String fileName=null; try { fileName=file.getCanonicalPath(); } catch(Exception exception) { throw new FaxException("Unable to extract canonical path from file: "+file,exception); } String documentName=faxJob.getProperty(WindowsFaxClientSpi.FaxJobExtendedPropertyConstants.DOCUMENT_NAME_PROPERTY_KEY.toString(), null); //init buffer StringBuilder buffer=new StringBuilder(); //create command line arguments this.addCommandLineArgument(buffer,Fax4jExeConstants.ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),Fax4jExeConstants.SUBMIT_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString()); this.addCommandLineArgument(buffer,Fax4jExeConstants.SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),this.faxServerName); this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_ADDRESS_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetAddress); this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetName); this.addCommandLineArgument(buffer,Fax4jExeConstants.SENDER_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),senderName); this.addCommandLineArgument(buffer,Fax4jExeConstants.FILE_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),fileName); this.addCommandLineArgument(buffer,Fax4jExeConstants.DOCUMENT_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),documentName); //get text String commandArguments=buffer.toString(); return commandArguments; }
java
protected String createProcessCommandArgumentsForSubmitFaxJob(FaxJob faxJob) { //get values from fax job String targetAddress=faxJob.getTargetAddress(); String targetName=faxJob.getTargetName(); String senderName=faxJob.getSenderName(); File file=faxJob.getFile(); String fileName=null; try { fileName=file.getCanonicalPath(); } catch(Exception exception) { throw new FaxException("Unable to extract canonical path from file: "+file,exception); } String documentName=faxJob.getProperty(WindowsFaxClientSpi.FaxJobExtendedPropertyConstants.DOCUMENT_NAME_PROPERTY_KEY.toString(), null); //init buffer StringBuilder buffer=new StringBuilder(); //create command line arguments this.addCommandLineArgument(buffer,Fax4jExeConstants.ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),Fax4jExeConstants.SUBMIT_ACTION_FAX4J_EXE_COMMAND_LINE_ARGUMENT_VALUE.toString()); this.addCommandLineArgument(buffer,Fax4jExeConstants.SERVER_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),this.faxServerName); this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_ADDRESS_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetAddress); this.addCommandLineArgument(buffer,Fax4jExeConstants.TARGET_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),targetName); this.addCommandLineArgument(buffer,Fax4jExeConstants.SENDER_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),senderName); this.addCommandLineArgument(buffer,Fax4jExeConstants.FILE_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),fileName); this.addCommandLineArgument(buffer,Fax4jExeConstants.DOCUMENT_NAME_FAX4J_EXE_COMMAND_LINE_ARGUMENT.toString(),documentName); //get text String commandArguments=buffer.toString(); return commandArguments; }
[ "protected", "String", "createProcessCommandArgumentsForSubmitFaxJob", "(", "FaxJob", "faxJob", ")", "{", "//get values from fax job", "String", "targetAddress", "=", "faxJob", ".", "getTargetAddress", "(", ")", ";", "String", "targetName", "=", "faxJob", ".", "getTarge...
This function creates and returns the command line arguments for the fax4j external exe when running the submit fax job action. @param faxJob The fax job object @return The full command line arguments line
[ "This", "function", "creates", "and", "returns", "the", "command", "line", "arguments", "for", "the", "fax4j", "external", "exe", "when", "running", "the", "submit", "fax", "job", "action", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java#L341-L375
javagl/CommonUI
src/main/java/de/javagl/common/ui/text/SearchableTextComponent.java
SearchableTextComponent.addHighlights
private void addHighlights(Collection<? extends Point> points, Color color) { """ Add highlights with the given color to the text component for all the given points @param points The points, containing start and end indices @param color The color """ removeHighlights(points); Map<Point, Object> newHighlights = JTextComponents.addHighlights(textComponent, points, color); highlights.putAll(newHighlights); }
java
private void addHighlights(Collection<? extends Point> points, Color color) { removeHighlights(points); Map<Point, Object> newHighlights = JTextComponents.addHighlights(textComponent, points, color); highlights.putAll(newHighlights); }
[ "private", "void", "addHighlights", "(", "Collection", "<", "?", "extends", "Point", ">", "points", ",", "Color", "color", ")", "{", "removeHighlights", "(", "points", ")", ";", "Map", "<", "Point", ",", "Object", ">", "newHighlights", "=", "JTextComponents"...
Add highlights with the given color to the text component for all the given points @param points The points, containing start and end indices @param color The color
[ "Add", "highlights", "with", "the", "given", "color", "to", "the", "text", "component", "for", "all", "the", "given", "points" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/text/SearchableTextComponent.java#L375-L381
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/local/TransactionSet.java
TransactionSet.updatedQueues
public synchronized List<LocalQueue> updatedQueues( List<String> deliveredMessageIDs ) throws FFMQException { """ Compute a list of queues that were updated in this transaction set """ int len = deliveredMessageIDs.size(); List<LocalQueue> updatedQueues = new ArrayList<>(len); for(int n=0;n<len;n++) { String deliveredMessageID = deliveredMessageIDs.get(len-n-1); boolean found = false; Iterator<TransactionItem> entries = items.iterator(); while (entries.hasNext()) { TransactionItem item = entries.next(); if (item.getMessageId().equals(deliveredMessageID)) { found = true; LocalQueue localQueue = item.getDestination(); if (!updatedQueues.contains(localQueue)) updatedQueues.add(localQueue); break; } } if (!found) throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR"); } return updatedQueues; }
java
public synchronized List<LocalQueue> updatedQueues( List<String> deliveredMessageIDs ) throws FFMQException { int len = deliveredMessageIDs.size(); List<LocalQueue> updatedQueues = new ArrayList<>(len); for(int n=0;n<len;n++) { String deliveredMessageID = deliveredMessageIDs.get(len-n-1); boolean found = false; Iterator<TransactionItem> entries = items.iterator(); while (entries.hasNext()) { TransactionItem item = entries.next(); if (item.getMessageId().equals(deliveredMessageID)) { found = true; LocalQueue localQueue = item.getDestination(); if (!updatedQueues.contains(localQueue)) updatedQueues.add(localQueue); break; } } if (!found) throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR"); } return updatedQueues; }
[ "public", "synchronized", "List", "<", "LocalQueue", ">", "updatedQueues", "(", "List", "<", "String", ">", "deliveredMessageIDs", ")", "throws", "FFMQException", "{", "int", "len", "=", "deliveredMessageIDs", ".", "size", "(", ")", ";", "List", "<", "LocalQue...
Compute a list of queues that were updated in this transaction set
[ "Compute", "a", "list", "of", "queues", "that", "were", "updated", "in", "this", "transaction", "set" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/TransactionSet.java#L163-L192
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getDomainSummaryStatistics
public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(GetDomainSummaryStatisticsRequest request) { """ get all domains' summary statistics in the live stream service. @param request The request object containing all options for getting all domains' summary statistics @return the response """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "summary"); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetDomainSummaryStatisticsResponse.class); }
java
public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(GetDomainSummaryStatisticsRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getStartTime(), "startTime should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, STATISTICS, LIVE_DOMAIN, "summary"); internalRequest.addParameter("startTime", request.getStartTime()); if (request.getEndTime() != null) { internalRequest.addParameter("endTime", request.getEndTime()); } return invokeHttpClient(internalRequest, GetDomainSummaryStatisticsResponse.class); }
[ "public", "GetDomainSummaryStatisticsResponse", "getDomainSummaryStatistics", "(", "GetDomainSummaryStatisticsRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".",...
get all domains' summary statistics in the live stream service. @param request The request object containing all options for getting all domains' summary statistics @return the response
[ "get", "all", "domains", "summary", "statistics", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1820-L1831
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/EntityUtils.java
EntityUtils.isEquipped
public static boolean isEquipped(EntityPlayer player, Item item, EnumHand hand) { """ Checks if is the {@link Item} is equipped for the player. @param player the player @param item the item @return true, if is equipped """ return player != null && player.getHeldItem(hand) != null && player.getHeldItem(hand).getItem() == item; }
java
public static boolean isEquipped(EntityPlayer player, Item item, EnumHand hand) { return player != null && player.getHeldItem(hand) != null && player.getHeldItem(hand).getItem() == item; }
[ "public", "static", "boolean", "isEquipped", "(", "EntityPlayer", "player", ",", "Item", "item", ",", "EnumHand", "hand", ")", "{", "return", "player", "!=", "null", "&&", "player", ".", "getHeldItem", "(", "hand", ")", "!=", "null", "&&", "player", ".", ...
Checks if is the {@link Item} is equipped for the player. @param player the player @param item the item @return true, if is equipped
[ "Checks", "if", "is", "the", "{", "@link", "Item", "}", "is", "equipped", "for", "the", "player", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EntityUtils.java#L201-L204
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java
AbstractGauge.create_LED_Image
protected final BufferedImage create_LED_Image(final int SIZE, final int STATE, final LedColor LED_COLOR) { """ Returns an image of a led with the given size, state and color. If the LED_COLOR parameter equals CUSTOM the userLedColor will be used to calculate the custom led colors @param SIZE @param STATE @param LED_COLOR @return the led image """ return LED_FACTORY.create_LED_Image(SIZE, STATE, LED_COLOR, model.getCustomLedColor()); }
java
protected final BufferedImage create_LED_Image(final int SIZE, final int STATE, final LedColor LED_COLOR) { return LED_FACTORY.create_LED_Image(SIZE, STATE, LED_COLOR, model.getCustomLedColor()); }
[ "protected", "final", "BufferedImage", "create_LED_Image", "(", "final", "int", "SIZE", ",", "final", "int", "STATE", ",", "final", "LedColor", "LED_COLOR", ")", "{", "return", "LED_FACTORY", ".", "create_LED_Image", "(", "SIZE", ",", "STATE", ",", "LED_COLOR", ...
Returns an image of a led with the given size, state and color. If the LED_COLOR parameter equals CUSTOM the userLedColor will be used to calculate the custom led colors @param SIZE @param STATE @param LED_COLOR @return the led image
[ "Returns", "an", "image", "of", "a", "led", "with", "the", "given", "size", "state", "and", "color", ".", "If", "the", "LED_COLOR", "parameter", "equals", "CUSTOM", "the", "userLedColor", "will", "be", "used", "to", "calculate", "the", "custom", "led", "co...
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractGauge.java#L2609-L2611
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java
TriggersInner.listByDataBoxEdgeDeviceWithServiceResponseAsync
public Observable<ServiceResponse<Page<TriggerInner>>> listByDataBoxEdgeDeviceWithServiceResponseAsync(final String deviceName, final String resourceGroupName, final String expand) { """ Lists all the triggers configured in the device. @param deviceName The device name. @param resourceGroupName The resource group name. @param expand Specify $filter='CustomContextTag eq &lt;tag&gt;' to filter on custom context tag property @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;TriggerInner&gt; object """ return listByDataBoxEdgeDeviceSinglePageAsync(deviceName, resourceGroupName, expand) .concatMap(new Func1<ServiceResponse<Page<TriggerInner>>, Observable<ServiceResponse<Page<TriggerInner>>>>() { @Override public Observable<ServiceResponse<Page<TriggerInner>>> call(ServiceResponse<Page<TriggerInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDataBoxEdgeDeviceNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<TriggerInner>>> listByDataBoxEdgeDeviceWithServiceResponseAsync(final String deviceName, final String resourceGroupName, final String expand) { return listByDataBoxEdgeDeviceSinglePageAsync(deviceName, resourceGroupName, expand) .concatMap(new Func1<ServiceResponse<Page<TriggerInner>>, Observable<ServiceResponse<Page<TriggerInner>>>>() { @Override public Observable<ServiceResponse<Page<TriggerInner>>> call(ServiceResponse<Page<TriggerInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDataBoxEdgeDeviceNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "TriggerInner", ">", ">", ">", "listByDataBoxEdgeDeviceWithServiceResponseAsync", "(", "final", "String", "deviceName", ",", "final", "String", "resourceGroupName", ",", "final", "String", "expand", ")"...
Lists all the triggers configured in the device. @param deviceName The device name. @param resourceGroupName The resource group name. @param expand Specify $filter='CustomContextTag eq &lt;tag&gt;' to filter on custom context tag property @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;TriggerInner&gt; object
[ "Lists", "all", "the", "triggers", "configured", "in", "the", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/TriggersInner.java#L282-L294
apache/flink
flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java
ConfluentRegistryAvroDeserializationSchema.forGeneric
public static ConfluentRegistryAvroDeserializationSchema<GenericRecord> forGeneric(Schema schema, String url, int identityMapCapacity) { """ Creates {@link ConfluentRegistryAvroDeserializationSchema} that produces {@link GenericRecord} using provided reader schema and looks up writer schema in Confluent Schema Registry. @param schema schema of produced records @param url url of schema registry to connect @param identityMapCapacity maximum number of cached schema versions (default: 1000) @return deserialized record in form of {@link GenericRecord} """ return new ConfluentRegistryAvroDeserializationSchema<>( GenericRecord.class, schema, new CachedSchemaCoderProvider(url, identityMapCapacity)); }
java
public static ConfluentRegistryAvroDeserializationSchema<GenericRecord> forGeneric(Schema schema, String url, int identityMapCapacity) { return new ConfluentRegistryAvroDeserializationSchema<>( GenericRecord.class, schema, new CachedSchemaCoderProvider(url, identityMapCapacity)); }
[ "public", "static", "ConfluentRegistryAvroDeserializationSchema", "<", "GenericRecord", ">", "forGeneric", "(", "Schema", "schema", ",", "String", "url", ",", "int", "identityMapCapacity", ")", "{", "return", "new", "ConfluentRegistryAvroDeserializationSchema", "<>", "(",...
Creates {@link ConfluentRegistryAvroDeserializationSchema} that produces {@link GenericRecord} using provided reader schema and looks up writer schema in Confluent Schema Registry. @param schema schema of produced records @param url url of schema registry to connect @param identityMapCapacity maximum number of cached schema versions (default: 1000) @return deserialized record in form of {@link GenericRecord}
[ "Creates", "{", "@link", "ConfluentRegistryAvroDeserializationSchema", "}", "that", "produces", "{", "@link", "GenericRecord", "}", "using", "provided", "reader", "schema", "and", "looks", "up", "writer", "schema", "in", "Confluent", "Schema", "Registry", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java#L79-L85
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerStateMachine.java
ServerStateMachine.apply
private CompletableFuture<Long> apply(RegisterEntry entry) { """ Applies register session entry to the state machine. <p> Register entries are applied to the state machine to create a new session. The resulting session ID is the index of the RegisterEntry. Once a new session is registered, we call register() on the state machine. In the event that the {@code synchronous} flag is set, that indicates that the registration command expects a response, i.e. it was applied by a leader. In that case, any events published during the execution of the state machine's register() method must be completed synchronously prior to the completion of the returned future. """ // Allow the executor to execute any scheduled events. long timestamp = executor.timestamp(entry.getTimestamp()); long sessionId = entry.getIndex(); ServerSessionContext session = new ServerSessionContext(sessionId, entry.getClient(), log, executor.context(), entry.getTimeout()); ServerSessionContext oldSession = executor.context().sessions().registerSession(session); // Update the session timestamp *after* executing any scheduled operations. The executor's timestamp // is guaranteed to be monotonically increasing, whereas the RegisterEntry may have an earlier timestamp // if, e.g., it was written shortly after a leader change. session.setTimestamp(timestamp); // Determine whether any sessions appear to be expired. This won't immediately expire the session(s), // but it will make them available to be unregistered by the leader. suspectSessions(0, timestamp); ThreadContext context = ThreadContext.currentContextOrThrow(); long index = entry.getIndex(); // Call the register() method on the user-provided state machine to allow the state machine to react to // a new session being registered. User state machine methods are always called in the state machine thread. CompletableFuture<Long> future = new ComposableFuture<>(); executor.executor().execute(() -> registerSession(index, timestamp, session, oldSession, future, context)); return future; }
java
private CompletableFuture<Long> apply(RegisterEntry entry) { // Allow the executor to execute any scheduled events. long timestamp = executor.timestamp(entry.getTimestamp()); long sessionId = entry.getIndex(); ServerSessionContext session = new ServerSessionContext(sessionId, entry.getClient(), log, executor.context(), entry.getTimeout()); ServerSessionContext oldSession = executor.context().sessions().registerSession(session); // Update the session timestamp *after* executing any scheduled operations. The executor's timestamp // is guaranteed to be monotonically increasing, whereas the RegisterEntry may have an earlier timestamp // if, e.g., it was written shortly after a leader change. session.setTimestamp(timestamp); // Determine whether any sessions appear to be expired. This won't immediately expire the session(s), // but it will make them available to be unregistered by the leader. suspectSessions(0, timestamp); ThreadContext context = ThreadContext.currentContextOrThrow(); long index = entry.getIndex(); // Call the register() method on the user-provided state machine to allow the state machine to react to // a new session being registered. User state machine methods are always called in the state machine thread. CompletableFuture<Long> future = new ComposableFuture<>(); executor.executor().execute(() -> registerSession(index, timestamp, session, oldSession, future, context)); return future; }
[ "private", "CompletableFuture", "<", "Long", ">", "apply", "(", "RegisterEntry", "entry", ")", "{", "// Allow the executor to execute any scheduled events.", "long", "timestamp", "=", "executor", ".", "timestamp", "(", "entry", ".", "getTimestamp", "(", ")", ")", ";...
Applies register session entry to the state machine. <p> Register entries are applied to the state machine to create a new session. The resulting session ID is the index of the RegisterEntry. Once a new session is registered, we call register() on the state machine. In the event that the {@code synchronous} flag is set, that indicates that the registration command expects a response, i.e. it was applied by a leader. In that case, any events published during the execution of the state machine's register() method must be completed synchronously prior to the completion of the returned future.
[ "Applies", "register", "session", "entry", "to", "the", "state", "machine", ".", "<p", ">", "Register", "entries", "are", "applied", "to", "the", "state", "machine", "to", "create", "a", "new", "session", ".", "The", "resulting", "session", "ID", "is", "th...
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerStateMachine.java#L374-L400
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java
PlatformBitmapFactory.createBitmap
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Matrix matrix, boolean filter, @Nullable Object callerContext) { """ Creates a bitmap from subset of the source bitmap, transformed by the optional matrix. It is initialized with the same density as the original bitmap. @param source The bitmap we are subsetting @param x The x coordinate of the first pixel in source @param y The y coordinate of the first pixel in source @param width The number of pixels in each row @param height The number of rows @param matrix Optional matrix to be applied to the pixels @param filter true if the source should be filtered. Only applies if the matrix contains more than just translation. @param callerContext the Tag to track who create the Bitmap @return a reference to the bitmap @throws IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0 @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated """ Preconditions.checkNotNull(source, "Source bitmap cannot be null"); checkXYSign(x, y); checkWidthHeight(width, height); checkFinalImageBounds(source, x, y, width, height); // assigned because matrix can modify the final width, height int newWidth = width; int newHeight = height; Canvas canvas; CloseableReference<Bitmap> bitmapRef; Paint paint; Rect srcRectangle = new Rect(x, y, x + width, y + height); RectF dstRectangle = new RectF(0, 0, width, height); Bitmap.Config newConfig = getSuitableBitmapConfig(source); if (matrix == null || matrix.isIdentity()) { bitmapRef = createBitmap(newWidth, newHeight, newConfig, source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); paint = null; // not needed } else { boolean transformed = !matrix.rectStaysRect(); RectF deviceRectangle = new RectF(); matrix.mapRect(deviceRectangle, dstRectangle); newWidth = Math.round(deviceRectangle.width()); newHeight = Math.round(deviceRectangle.height()); bitmapRef = createBitmap( newWidth, newHeight, transformed ? Bitmap.Config.ARGB_8888 : newConfig, transformed || source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); canvas.translate(-deviceRectangle.left, -deviceRectangle.top); canvas.concat(matrix); paint = new Paint(); paint.setFilterBitmap(filter); if (transformed) { paint.setAntiAlias(true); } } canvas.drawBitmap(source, srcRectangle, dstRectangle, paint); canvas.setBitmap(null); return bitmapRef; }
java
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Matrix matrix, boolean filter, @Nullable Object callerContext) { Preconditions.checkNotNull(source, "Source bitmap cannot be null"); checkXYSign(x, y); checkWidthHeight(width, height); checkFinalImageBounds(source, x, y, width, height); // assigned because matrix can modify the final width, height int newWidth = width; int newHeight = height; Canvas canvas; CloseableReference<Bitmap> bitmapRef; Paint paint; Rect srcRectangle = new Rect(x, y, x + width, y + height); RectF dstRectangle = new RectF(0, 0, width, height); Bitmap.Config newConfig = getSuitableBitmapConfig(source); if (matrix == null || matrix.isIdentity()) { bitmapRef = createBitmap(newWidth, newHeight, newConfig, source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); paint = null; // not needed } else { boolean transformed = !matrix.rectStaysRect(); RectF deviceRectangle = new RectF(); matrix.mapRect(deviceRectangle, dstRectangle); newWidth = Math.round(deviceRectangle.width()); newHeight = Math.round(deviceRectangle.height()); bitmapRef = createBitmap( newWidth, newHeight, transformed ? Bitmap.Config.ARGB_8888 : newConfig, transformed || source.hasAlpha(), callerContext); setPropertyFromSourceBitmap(source, bitmapRef.get()); canvas = new Canvas(bitmapRef.get()); canvas.translate(-deviceRectangle.left, -deviceRectangle.top); canvas.concat(matrix); paint = new Paint(); paint.setFilterBitmap(filter); if (transformed) { paint.setAntiAlias(true); } } canvas.drawBitmap(source, srcRectangle, dstRectangle, paint); canvas.setBitmap(null); return bitmapRef; }
[ "public", "CloseableReference", "<", "Bitmap", ">", "createBitmap", "(", "Bitmap", "source", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "@", "Nullable", "Matrix", "matrix", ",", "boolean", "filter", ",", "@", "Nulla...
Creates a bitmap from subset of the source bitmap, transformed by the optional matrix. It is initialized with the same density as the original bitmap. @param source The bitmap we are subsetting @param x The x coordinate of the first pixel in source @param y The y coordinate of the first pixel in source @param width The number of pixels in each row @param height The number of rows @param matrix Optional matrix to be applied to the pixels @param filter true if the source should be filtered. Only applies if the matrix contains more than just translation. @param callerContext the Tag to track who create the Bitmap @return a reference to the bitmap @throws IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0 @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
[ "Creates", "a", "bitmap", "from", "subset", "of", "the", "source", "bitmap", "transformed", "by", "the", "optional", "matrix", ".", "It", "is", "initialized", "with", "the", "same", "density", "as", "the", "original", "bitmap", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L295-L357
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java
DatabaseAdvisorsInner.listByDatabaseAsync
public Observable<AdvisorListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { """ Returns a list of database advisors. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorListResultInner object """ return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() { @Override public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) { return response.body(); } }); }
java
public Observable<AdvisorListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() { @Override public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AdvisorListResultInner", ">", "listByDatabaseAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "listByDatabaseWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Returns a list of database advisors. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorListResultInner object
[ "Returns", "a", "list", "of", "database", "advisors", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java#L109-L116
windup/windup
config-xml/addon/src/main/java/org/jboss/windup/config/parser/ParserContext.java
ParserContext.processElement
@SuppressWarnings("unchecked") public <T> T processElement(Element element) throws ConfigurationException { """ Process the provided {@link Element} with the appropriate handler for it's namespace and tag name. """ String namespace = $(element).namespaceURI(); String tagName = $(element).tag(); ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName)); if (handler != null) { Object o = handler.processElement(this, element); return (T) o; } throw new ConfigurationException("No Handler registered for element named [" + tagName + "] in namespace: [" + namespace + "]"); }
java
@SuppressWarnings("unchecked") public <T> T processElement(Element element) throws ConfigurationException { String namespace = $(element).namespaceURI(); String tagName = $(element).tag(); ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName)); if (handler != null) { Object o = handler.processElement(this, element); return (T) o; } throw new ConfigurationException("No Handler registered for element named [" + tagName + "] in namespace: [" + namespace + "]"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "processElement", "(", "Element", "element", ")", "throws", "ConfigurationException", "{", "String", "namespace", "=", "$", "(", "element", ")", ".", "namespaceURI", "(", ")", ...
Process the provided {@link Element} with the appropriate handler for it's namespace and tag name.
[ "Process", "the", "provided", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config-xml/addon/src/main/java/org/jboss/windup/config/parser/ParserContext.java#L90-L103
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java
SchemaConfiguration.onInheritedProperty
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType) { """ Add {@link DiscriminatorColumn} for schema generation. @param tableInfo table info. @param entityType entity type. """ String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); if (discrColumn != null) { ColumnInfo columnInfo = new ColumnInfo(); columnInfo.setColumnName(discrColumn); columnInfo.setType(String.class); columnInfo.setIndexable(true); IndexInfo idxInfo = new IndexInfo(discrColumn); tableInfo.addColumnInfo(columnInfo); tableInfo.addToIndexedColumnList(idxInfo); } }
java
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); if (discrColumn != null) { ColumnInfo columnInfo = new ColumnInfo(); columnInfo.setColumnName(discrColumn); columnInfo.setType(String.class); columnInfo.setIndexable(true); IndexInfo idxInfo = new IndexInfo(discrColumn); tableInfo.addColumnInfo(columnInfo); tableInfo.addToIndexedColumnList(idxInfo); } }
[ "private", "void", "onInheritedProperty", "(", "TableInfo", "tableInfo", ",", "EntityType", "entityType", ")", "{", "String", "discrColumn", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorColumn", "(", ")", ";", "if", "(", "d...
Add {@link DiscriminatorColumn} for schema generation. @param tableInfo table info. @param entityType entity type.
[ "Add", "{", "@link", "DiscriminatorColumn", "}", "for", "schema", "generation", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java#L514-L529
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
MultiUserChat.banUser
public void banUser(Jid jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { """ Bans a user from the room. An admin or owner of the room can ban users from a room. This means that the banned user will no longer be able to join the room unless the ban has been removed. If the banned user was present in the room then he/she will be removed from the room and notified that he/she was banned along with the reason (if provided) and the bare XMPP user ID of the user who initiated the ban. @param jid the bare XMPP user ID of the user to ban (e.g. "user@host.org"). @param reason the optional reason why the user was banned. @throws XMPPErrorException if an error occurs banning a user. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to be banned (i.e. Not Allowed error). @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException """ changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason); }
java
public void banUser(Jid jid, String reason) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, MUCAffiliation.outcast, reason); }
[ "public", "void", "banUser", "(", "Jid", "jid", ",", "String", "reason", ")", "throws", "XMPPErrorException", ",", "NoResponseException", ",", "NotConnectedException", ",", "InterruptedException", "{", "changeAffiliationByAdmin", "(", "jid", ",", "MUCAffiliation", "."...
Bans a user from the room. An admin or owner of the room can ban users from a room. This means that the banned user will no longer be able to join the room unless the ban has been removed. If the banned user was present in the room then he/she will be removed from the room and notified that he/she was banned along with the reason (if provided) and the bare XMPP user ID of the user who initiated the ban. @param jid the bare XMPP user ID of the user to ban (e.g. "user@host.org"). @param reason the optional reason why the user was banned. @throws XMPPErrorException if an error occurs banning a user. In particular, a 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" was tried to be banned (i.e. Not Allowed error). @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException
[ "Bans", "a", "user", "from", "the", "room", ".", "An", "admin", "or", "owner", "of", "the", "room", "can", "ban", "users", "from", "a", "room", ".", "This", "means", "that", "the", "banned", "user", "will", "no", "longer", "be", "able", "to", "join",...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1335-L1337
twilio/twilio-java
src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java
AssistantReader.nextPage
@Override public Page<Assistant> nextPage(final Page<Assistant> page, final TwilioRestClient client) { """ Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page """ Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.AUTOPILOT.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Assistant> nextPage(final Page<Assistant> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.AUTOPILOT.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Assistant", ">", "nextPage", "(", "final", "Page", "<", "Assistant", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ","...
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java#L84-L95
rzwitserloot/lombok
src/core/lombok/javac/HandlerLibrary.java
HandlerLibrary.javacWarning
public void javacWarning(String message, Throwable t) { """ Generates a warning in the Messager that was used to initialize this HandlerLibrary. """ messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t))); }
java
public void javacWarning(String message, Throwable t) { messager.printMessage(Diagnostic.Kind.WARNING, message + (t == null ? "" : (": " + t))); }
[ "public", "void", "javacWarning", "(", "String", "message", ",", "Throwable", "t", ")", "{", "messager", ".", "printMessage", "(", "Diagnostic", ".", "Kind", ".", "WARNING", ",", "message", "+", "(", "t", "==", "null", "?", "\"\"", ":", "(", "\": \"", ...
Generates a warning in the Messager that was used to initialize this HandlerLibrary.
[ "Generates", "a", "warning", "in", "the", "Messager", "that", "was", "used", "to", "initialize", "this", "HandlerLibrary", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/HandlerLibrary.java#L208-L210
wisdom-framework/wisdom
extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java
MarkdownMojo.execute
public void execute() throws MojoExecutionException { """ Compiles all markdown files located in the internal and external asset directories. @throws MojoExecutionException if a markdown file cannot be processed """ if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("md", "markdown"); } if (instance == null) { instance = new PegDownProcessor(Extensions.ALL); } try { for (File f : getResources(extensions)) { process(f); } } catch (IOException e) { throw new MojoExecutionException("Error while processing a Markdown file", e); } }
java
public void execute() throws MojoExecutionException { if (extensions == null || extensions.isEmpty()) { extensions = ImmutableList.of("md", "markdown"); } if (instance == null) { instance = new PegDownProcessor(Extensions.ALL); } try { for (File f : getResources(extensions)) { process(f); } } catch (IOException e) { throw new MojoExecutionException("Error while processing a Markdown file", e); } }
[ "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "extensions", "==", "null", "||", "extensions", ".", "isEmpty", "(", ")", ")", "{", "extensions", "=", "ImmutableList", ".", "of", "(", "\"md\"", ",", "\"markdown\"", ...
Compiles all markdown files located in the internal and external asset directories. @throws MojoExecutionException if a markdown file cannot be processed
[ "Compiles", "all", "markdown", "files", "located", "in", "the", "internal", "and", "external", "asset", "directories", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java#L71-L89
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/local/DefaultLocalExtensionRepository.java
DefaultLocalExtensionRepository.createExtension
private DefaultLocalExtension createExtension(Extension extension) { """ Create a new local extension from a remote extension. @param extension the extension to copy @return the new local extension """ DefaultLocalExtension localExtension = new DefaultLocalExtension(this, extension); localExtension.setFile(this.storage.getNewExtensionFile(localExtension.getId(), localExtension.getType())); return localExtension; }
java
private DefaultLocalExtension createExtension(Extension extension) { DefaultLocalExtension localExtension = new DefaultLocalExtension(this, extension); localExtension.setFile(this.storage.getNewExtensionFile(localExtension.getId(), localExtension.getType())); return localExtension; }
[ "private", "DefaultLocalExtension", "createExtension", "(", "Extension", "extension", ")", "{", "DefaultLocalExtension", "localExtension", "=", "new", "DefaultLocalExtension", "(", "this", ",", "extension", ")", ";", "localExtension", ".", "setFile", "(", "this", ".",...
Create a new local extension from a remote extension. @param extension the extension to copy @return the new local extension
[ "Create", "a", "new", "local", "extension", "from", "a", "remote", "extension", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/local/DefaultLocalExtensionRepository.java#L151-L158
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java
BinaryImageOps.logicAnd
public static GrayU8 logicAnd(GrayU8 inputA , GrayU8 inputB , GrayU8 output ) { """ For each pixel it applies the logical 'and' operator between two images. @param inputA First input image. Not modified. @param inputB Second input image. Not modified. @param output Output image. Can be same as either input. If null a new instance will be declared, Modified. @return Output of logical operation. """ InputSanityCheck.checkSameShape(inputA,inputB); output = InputSanityCheck.checkDeclare(inputA, output); if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.logicAnd(inputA, inputB, output); } else { ImplBinaryImageOps.logicAnd(inputA, inputB, output); } return output; }
java
public static GrayU8 logicAnd(GrayU8 inputA , GrayU8 inputB , GrayU8 output ) { InputSanityCheck.checkSameShape(inputA,inputB); output = InputSanityCheck.checkDeclare(inputA, output); if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.logicAnd(inputA, inputB, output); } else { ImplBinaryImageOps.logicAnd(inputA, inputB, output); } return output; }
[ "public", "static", "GrayU8", "logicAnd", "(", "GrayU8", "inputA", ",", "GrayU8", "inputB", ",", "GrayU8", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "inputA", ",", "inputB", ")", ";", "output", "=", "InputSanityCheck", ".", "checkDecl...
For each pixel it applies the logical 'and' operator between two images. @param inputA First input image. Not modified. @param inputB Second input image. Not modified. @param output Output image. Can be same as either input. If null a new instance will be declared, Modified. @return Output of logical operation.
[ "For", "each", "pixel", "it", "applies", "the", "logical", "and", "operator", "between", "two", "images", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java#L69-L81
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getMaximum
private static List<IAtomContainer> getMaximum(ArrayList<IAtomContainer> graphList, boolean shouldMatchBonds) throws CDKException { """ Removes all redundant solution. @param graphList the list of structure to clean @return the list cleaned @throws org.openscience.cdk.exception.CDKException if there is atom problem in obtaining subgraphs """ List<IAtomContainer> reducedGraphList = (List<IAtomContainer>) graphList.clone(); for (int i = 0; i < graphList.size(); i++) { IAtomContainer graphI = graphList.get(i); for (int j = i + 1; j < graphList.size(); j++) { IAtomContainer graphJ = graphList.get(j); // Gi included in Gj or Gj included in Gi then // reduce the irrelevant solution if (isSubgraph(graphJ, graphI, shouldMatchBonds)) { reducedGraphList.remove(graphI); } else if (isSubgraph(graphI, graphJ, shouldMatchBonds)) { reducedGraphList.remove(graphJ); } } } return reducedGraphList; }
java
private static List<IAtomContainer> getMaximum(ArrayList<IAtomContainer> graphList, boolean shouldMatchBonds) throws CDKException { List<IAtomContainer> reducedGraphList = (List<IAtomContainer>) graphList.clone(); for (int i = 0; i < graphList.size(); i++) { IAtomContainer graphI = graphList.get(i); for (int j = i + 1; j < graphList.size(); j++) { IAtomContainer graphJ = graphList.get(j); // Gi included in Gj or Gj included in Gi then // reduce the irrelevant solution if (isSubgraph(graphJ, graphI, shouldMatchBonds)) { reducedGraphList.remove(graphI); } else if (isSubgraph(graphI, graphJ, shouldMatchBonds)) { reducedGraphList.remove(graphJ); } } } return reducedGraphList; }
[ "private", "static", "List", "<", "IAtomContainer", ">", "getMaximum", "(", "ArrayList", "<", "IAtomContainer", ">", "graphList", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "List", "<", "IAtomContainer", ">", "reducedGraphList", "=", "...
Removes all redundant solution. @param graphList the list of structure to clean @return the list cleaned @throws org.openscience.cdk.exception.CDKException if there is atom problem in obtaining subgraphs
[ "Removes", "all", "redundant", "solution", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L608-L628
bitcoinj/bitcoinj
wallettemplate/src/main/java/wallettemplate/utils/QRCodeImages.java
QRCodeImages.imageFromString
public static Image imageFromString(String uri, int width, int height) { """ Create an Image from a Bitcoin URI @param uri Bitcoin URI @param width width of image @param height height of image @return a javafx Image """ return imageFromMatrix(matrixFromString(uri, width, height)); }
java
public static Image imageFromString(String uri, int width, int height) { return imageFromMatrix(matrixFromString(uri, width, height)); }
[ "public", "static", "Image", "imageFromString", "(", "String", "uri", ",", "int", "width", ",", "int", "height", ")", "{", "return", "imageFromMatrix", "(", "matrixFromString", "(", "uri", ",", "width", ",", "height", ")", ")", ";", "}" ]
Create an Image from a Bitcoin URI @param uri Bitcoin URI @param width width of image @param height height of image @return a javafx Image
[ "Create", "an", "Image", "from", "a", "Bitcoin", "URI" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/wallettemplate/src/main/java/wallettemplate/utils/QRCodeImages.java#L39-L41
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java
DateUtil.roundToDay
public static long roundToDay(final long pTime, final TimeZone pTimeZone) { """ Rounds the given time down to the closest day, using the given timezone. @param pTime time @param pTimeZone the timezone to use when rounding @return the time rounded to the closest day. """ int offset = pTimeZone.getOffset(pTime); return (((pTime + offset) / DAY) * DAY) - offset; }
java
public static long roundToDay(final long pTime, final TimeZone pTimeZone) { int offset = pTimeZone.getOffset(pTime); return (((pTime + offset) / DAY) * DAY) - offset; }
[ "public", "static", "long", "roundToDay", "(", "final", "long", "pTime", ",", "final", "TimeZone", "pTimeZone", ")", "{", "int", "offset", "=", "pTimeZone", ".", "getOffset", "(", "pTime", ")", ";", "return", "(", "(", "(", "pTime", "+", "offset", ")", ...
Rounds the given time down to the closest day, using the given timezone. @param pTime time @param pTimeZone the timezone to use when rounding @return the time rounded to the closest day.
[ "Rounds", "the", "given", "time", "down", "to", "the", "closest", "day", "using", "the", "given", "timezone", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/DateUtil.java#L200-L203
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java
FeatureListGridTab.addButton
public void addButton(ToolStripButton button, int position) { """ Add a button in the tool strip at the requested position. @param button button to add @param position position """ toolStrip.addButton(button, position); extraButtons.add(button); button.setDisabled(true); }
java
public void addButton(ToolStripButton button, int position) { toolStrip.addButton(button, position); extraButtons.add(button); button.setDisabled(true); }
[ "public", "void", "addButton", "(", "ToolStripButton", "button", ",", "int", "position", ")", "{", "toolStrip", ".", "addButton", "(", "button", ",", "position", ")", ";", "extraButtons", ".", "add", "(", "button", ")", ";", "button", ".", "setDisabled", "...
Add a button in the tool strip at the requested position. @param button button to add @param position position
[ "Add", "a", "button", "in", "the", "tool", "strip", "at", "the", "requested", "position", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java#L221-L225
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java
CmsSitemapView.displayNewModelPage
public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) { """ Adds a new model page to the model page view.<p> @param modelPageData the data for the new model page @param isModelGroup in case of a model group page """ CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false); CmsSitemapHoverbar.installOn( m_controller, treeItem, modelPageData.getStructureId(), modelPageData.getSitePath(), modelPageData.getSitePath() != null); m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem); if (isModelGroup) { m_modelGroupRoot.addChild(treeItem); } else { m_modelPageRoot.addChild(treeItem); } }
java
public void displayNewModelPage(CmsModelPageEntry modelPageData, boolean isModelGroup) { CmsModelPageTreeItem treeItem = new CmsModelPageTreeItem(modelPageData, isModelGroup, false); CmsSitemapHoverbar.installOn( m_controller, treeItem, modelPageData.getStructureId(), modelPageData.getSitePath(), modelPageData.getSitePath() != null); m_modelPageTreeItems.put(modelPageData.getStructureId(), treeItem); if (isModelGroup) { m_modelGroupRoot.addChild(treeItem); } else { m_modelPageRoot.addChild(treeItem); } }
[ "public", "void", "displayNewModelPage", "(", "CmsModelPageEntry", "modelPageData", ",", "boolean", "isModelGroup", ")", "{", "CmsModelPageTreeItem", "treeItem", "=", "new", "CmsModelPageTreeItem", "(", "modelPageData", ",", "isModelGroup", ",", "false", ")", ";", "Cm...
Adds a new model page to the model page view.<p> @param modelPageData the data for the new model page @param isModelGroup in case of a model group page
[ "Adds", "a", "new", "model", "page", "to", "the", "model", "page", "view", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java#L661-L676
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java
AbstractAddStepHandler.rollbackRuntime
@Deprecated protected void rollbackRuntime(OperationContext context, final ModelNode operation, final ModelNode model, List<ServiceController<?>> controllers) { """ <strong>Deprecated</strong>. Subclasses wishing for custom rollback behavior should instead override {@link #rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)}. <p> This default implementation does nothing. <strong>Subclasses that override this method should not call {@code super.performRuntime(...)}.</strong> </p> </p> @param context the operation context @param operation the operation being executed @param model persistent configuration model node that corresponds to the address of {@code operation} @param controllers will always be an empty list @deprecated instead override {@link #rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)} """ // no-op }
java
@Deprecated protected void rollbackRuntime(OperationContext context, final ModelNode operation, final ModelNode model, List<ServiceController<?>> controllers) { // no-op }
[ "@", "Deprecated", "protected", "void", "rollbackRuntime", "(", "OperationContext", "context", ",", "final", "ModelNode", "operation", ",", "final", "ModelNode", "model", ",", "List", "<", "ServiceController", "<", "?", ">", ">", "controllers", ")", "{", "// no-...
<strong>Deprecated</strong>. Subclasses wishing for custom rollback behavior should instead override {@link #rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)}. <p> This default implementation does nothing. <strong>Subclasses that override this method should not call {@code super.performRuntime(...)}.</strong> </p> </p> @param context the operation context @param operation the operation being executed @param model persistent configuration model node that corresponds to the address of {@code operation} @param controllers will always be an empty list @deprecated instead override {@link #rollbackRuntime(OperationContext, org.jboss.dmr.ModelNode, org.jboss.as.controller.registry.Resource)}
[ "<strong", ">", "Deprecated<", "/", "strong", ">", ".", "Subclasses", "wishing", "for", "custom", "rollback", "behavior", "should", "instead", "override", "{", "@link", "#rollbackRuntime", "(", "OperationContext", "org", ".", "jboss", ".", "dmr", ".", "ModelNode...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractAddStepHandler.java#L394-L397
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java
AttributeUtils.createAttributeValueObject
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) { """ Creates an {@code AttributeValue} object of the given class. The type of the attribute value will be the field that is declared as {@code TYPE_NAME} of the given class. <p> After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself. </p> @param <T> the type @param clazz the type of attribute value @return the attribute value @see #createAttributeValueObject(QName, Class) """ try { QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null); return createAttributeValueObject(schemaType, clazz); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } }
java
public static <T extends XMLObject> T createAttributeValueObject(Class<T> clazz) { try { QName schemaType = (QName) clazz.getDeclaredField("TYPE_NAME").get(null); return createAttributeValueObject(schemaType, clazz); } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", "extends", "XMLObject", ">", "T", "createAttributeValueObject", "(", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "QName", "schemaType", "=", "(", "QName", ")", "clazz", ".", "getDeclaredField", "(", "\"TYPE_NAME\"", ...
Creates an {@code AttributeValue} object of the given class. The type of the attribute value will be the field that is declared as {@code TYPE_NAME} of the given class. <p> After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself. </p> @param <T> the type @param clazz the type of attribute value @return the attribute value @see #createAttributeValueObject(QName, Class)
[ "Creates", "an", "{", "@code", "AttributeValue", "}", "object", "of", "the", "given", "class", ".", "The", "type", "of", "the", "attribute", "value", "will", "be", "the", "field", "that", "is", "declared", "as", "{", "@code", "TYPE_NAME", "}", "of", "the...
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java#L90-L98
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/SystemKeyspace.java
SystemKeyspace.updateSizeEstimates
public static void updateSizeEstimates(String keyspace, String table, Map<Range<Token>, Pair<Long, Long>> estimates) { """ Writes the current partition count and size estimates into SIZE_ESTIMATES_CF """ long timestamp = FBUtilities.timestampMicros(); CFMetaData estimatesTable = CFMetaData.SizeEstimatesCf; Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UTF8Type.instance.decompose(keyspace)); // delete all previous values with a single range tombstone. mutation.deleteRange(SIZE_ESTIMATES_CF, estimatesTable.comparator.make(table).start(), estimatesTable.comparator.make(table).end(), timestamp - 1); // add a CQL row for each primary token range. ColumnFamily cells = mutation.addOrGet(estimatesTable); for (Map.Entry<Range<Token>, Pair<Long, Long>> entry : estimates.entrySet()) { Range<Token> range = entry.getKey(); Pair<Long, Long> values = entry.getValue(); Composite prefix = estimatesTable.comparator.make(table, range.left.toString(), range.right.toString()); CFRowAdder adder = new CFRowAdder(cells, prefix, timestamp); adder.add("partitions_count", values.left) .add("mean_partition_size", values.right); } mutation.apply(); }
java
public static void updateSizeEstimates(String keyspace, String table, Map<Range<Token>, Pair<Long, Long>> estimates) { long timestamp = FBUtilities.timestampMicros(); CFMetaData estimatesTable = CFMetaData.SizeEstimatesCf; Mutation mutation = new Mutation(Keyspace.SYSTEM_KS, UTF8Type.instance.decompose(keyspace)); // delete all previous values with a single range tombstone. mutation.deleteRange(SIZE_ESTIMATES_CF, estimatesTable.comparator.make(table).start(), estimatesTable.comparator.make(table).end(), timestamp - 1); // add a CQL row for each primary token range. ColumnFamily cells = mutation.addOrGet(estimatesTable); for (Map.Entry<Range<Token>, Pair<Long, Long>> entry : estimates.entrySet()) { Range<Token> range = entry.getKey(); Pair<Long, Long> values = entry.getValue(); Composite prefix = estimatesTable.comparator.make(table, range.left.toString(), range.right.toString()); CFRowAdder adder = new CFRowAdder(cells, prefix, timestamp); adder.add("partitions_count", values.left) .add("mean_partition_size", values.right); } mutation.apply(); }
[ "public", "static", "void", "updateSizeEstimates", "(", "String", "keyspace", ",", "String", "table", ",", "Map", "<", "Range", "<", "Token", ">", ",", "Pair", "<", "Long", ",", "Long", ">", ">", "estimates", ")", "{", "long", "timestamp", "=", "FBUtilit...
Writes the current partition count and size estimates into SIZE_ESTIMATES_CF
[ "Writes", "the", "current", "partition", "count", "and", "size", "estimates", "into", "SIZE_ESTIMATES_CF" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/SystemKeyspace.java#L950-L975
deeplearning4j/deeplearning4j
nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/messages/intercom/DistributedCbowDotMessage.java
DistributedCbowDotMessage.processMessage
@Override public void processMessage() { """ This method calculates dot of gives rows, with averaging applied to rowsA, as required by CBoW """ // this only picks up new training round //log.info("sI_{} Starting CBOW dot...", transport.getShardIndex()); CbowRequestMessage cbrm = new CbowRequestMessage(rowsA, rowsB, w1, codes, negSamples, alpha, 119); if (negSamples > 0) { // unfortunately we have to get copy of negSamples here int negatives[] = Arrays.copyOfRange(rowsB, codes.length, rowsB.length); cbrm.setNegatives(negatives); } cbrm.setFrameId(-119L); cbrm.setTaskId(this.taskId); cbrm.setOriginatorId(this.getOriginatorId()); // FIXME: get rid of THAT CbowTrainer cbt = (CbowTrainer) trainer; cbt.pickTraining(cbrm); // we calculate dot for all involved rows, and first of all we get mean word INDArray words = Nd4j.pullRows(storage.getArray(WordVectorStorage.SYN_0), 1, rowsA, 'c'); INDArray mean = words.mean(0); int resultLength = codes.length + (negSamples > 0 ? (negSamples + 1) : 0); INDArray result = Nd4j.createUninitialized(resultLength, 1); int e = 0; for (; e < codes.length; e++) { double dot = Nd4j.getBlasWrapper().dot(mean, storage.getArray(WordVectorStorage.SYN_1).getRow(rowsB[e])); result.putScalar(e, dot); } // negSampling round for (; e < resultLength; e++) { double dot = Nd4j.getBlasWrapper().dot(mean, storage.getArray(WordVectorStorage.SYN_1_NEGATIVE).getRow(rowsB[e])); result.putScalar(e, dot); } if (voidConfiguration.getExecutionMode() == ExecutionMode.AVERAGING) { DotAggregation dot = new DotAggregation(taskId, (short) 1, shardIndex, result); dot.setTargetId((short) -1); dot.setOriginatorId(getOriginatorId()); transport.putMessage(dot); } else if (voidConfiguration.getExecutionMode() == ExecutionMode.SHARDED) { // send this message to everyone DotAggregation dot = new DotAggregation(taskId, (short) voidConfiguration.getNumberOfShards(), shardIndex, result); dot.setTargetId((short) -1); dot.setOriginatorId(getOriginatorId()); transport.sendMessage(dot); } }
java
@Override public void processMessage() { // this only picks up new training round //log.info("sI_{} Starting CBOW dot...", transport.getShardIndex()); CbowRequestMessage cbrm = new CbowRequestMessage(rowsA, rowsB, w1, codes, negSamples, alpha, 119); if (negSamples > 0) { // unfortunately we have to get copy of negSamples here int negatives[] = Arrays.copyOfRange(rowsB, codes.length, rowsB.length); cbrm.setNegatives(negatives); } cbrm.setFrameId(-119L); cbrm.setTaskId(this.taskId); cbrm.setOriginatorId(this.getOriginatorId()); // FIXME: get rid of THAT CbowTrainer cbt = (CbowTrainer) trainer; cbt.pickTraining(cbrm); // we calculate dot for all involved rows, and first of all we get mean word INDArray words = Nd4j.pullRows(storage.getArray(WordVectorStorage.SYN_0), 1, rowsA, 'c'); INDArray mean = words.mean(0); int resultLength = codes.length + (negSamples > 0 ? (negSamples + 1) : 0); INDArray result = Nd4j.createUninitialized(resultLength, 1); int e = 0; for (; e < codes.length; e++) { double dot = Nd4j.getBlasWrapper().dot(mean, storage.getArray(WordVectorStorage.SYN_1).getRow(rowsB[e])); result.putScalar(e, dot); } // negSampling round for (; e < resultLength; e++) { double dot = Nd4j.getBlasWrapper().dot(mean, storage.getArray(WordVectorStorage.SYN_1_NEGATIVE).getRow(rowsB[e])); result.putScalar(e, dot); } if (voidConfiguration.getExecutionMode() == ExecutionMode.AVERAGING) { DotAggregation dot = new DotAggregation(taskId, (short) 1, shardIndex, result); dot.setTargetId((short) -1); dot.setOriginatorId(getOriginatorId()); transport.putMessage(dot); } else if (voidConfiguration.getExecutionMode() == ExecutionMode.SHARDED) { // send this message to everyone DotAggregation dot = new DotAggregation(taskId, (short) voidConfiguration.getNumberOfShards(), shardIndex, result); dot.setTargetId((short) -1); dot.setOriginatorId(getOriginatorId()); transport.sendMessage(dot); } }
[ "@", "Override", "public", "void", "processMessage", "(", ")", "{", "// this only picks up new training round", "//log.info(\"sI_{} Starting CBOW dot...\", transport.getShardIndex());", "CbowRequestMessage", "cbrm", "=", "new", "CbowRequestMessage", "(", "rowsA", ",", "rowsB", ...
This method calculates dot of gives rows, with averaging applied to rowsA, as required by CBoW
[ "This", "method", "calculates", "dot", "of", "gives", "rows", "with", "averaging", "applied", "to", "rowsA", "as", "required", "by", "CBoW" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/messages/intercom/DistributedCbowDotMessage.java#L81-L135
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionLinkUtil.java
CPDefinitionLinkUtil.findByUUID_G
public static CPDefinitionLink findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPDefinitionLinkException { """ Returns the cp definition link where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPDefinitionLinkException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp definition link @throws NoSuchCPDefinitionLinkException if a matching cp definition link could not be found """ return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CPDefinitionLink findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPDefinitionLinkException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CPDefinitionLink", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPDefinitionLinkException", "{", "return", "getPersistence", ...
Returns the cp definition link where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPDefinitionLinkException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp definition link @throws NoSuchCPDefinitionLinkException if a matching cp definition link could not be found
[ "Returns", "the", "cp", "definition", "link", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDefinitionLinkException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionLinkUtil.java#L279-L282
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Actor.java
Actor.childActorFor
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) { """ Answers the {@code T} protocol for the child {@code Actor} to be created by this parent {@code Actor}. @param <T> the protocol type @param protocol the {@code Class<T>} protocol of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return T """ if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger()); } } }
java
protected <T> T childActorFor(final Class<T> protocol, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocol, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocol, definition, this, null, logger()); } } }
[ "protected", "<", "T", ">", "T", "childActorFor", "(", "final", "Class", "<", "T", ">", "protocol", ",", "final", "Definition", "definition", ")", "{", "if", "(", "definition", ".", "supervisor", "(", ")", "!=", "null", ")", "{", "return", "lifeCycle", ...
Answers the {@code T} protocol for the child {@code Actor} to be created by this parent {@code Actor}. @param <T> the protocol type @param protocol the {@code Class<T>} protocol of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return T
[ "Answers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Actor.java#L163-L173
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java
AccountsInner.beginUpdate
public DataLakeAnalyticsAccountInner beginUpdate(String resourceGroupName, String accountName, UpdateDataLakeAnalyticsAccountParameters parameters) { """ Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param parameters Parameters supplied to the update Data Lake Analytics account 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 DataLakeAnalyticsAccountInner object if successful. """ return beginUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
java
public DataLakeAnalyticsAccountInner beginUpdate(String resourceGroupName, String accountName, UpdateDataLakeAnalyticsAccountParameters parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).toBlocking().single().body(); }
[ "public", "DataLakeAnalyticsAccountInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "UpdateDataLakeAnalyticsAccountParameters", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "...
Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param parameters Parameters supplied to the update Data Lake Analytics account 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 DataLakeAnalyticsAccountInner object if successful.
[ "Updates", "the", "Data", "Lake", "Analytics", "account", "object", "specified", "by", "the", "accountName", "with", "the", "contents", "of", "the", "account", "object", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L1116-L1118
Netflix/conductor
es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java
ElasticSearchRestDAOV6.initIndexTemplate
private void initIndexTemplate(String type) { """ Initializes the index with the required templates and mappings. """ String template = "template_" + type; try { if (doesResourceNotExist("/_template/" + template)) { logger.info("Creating the index template '" + template + "'"); InputStream stream = ElasticSearchDAOV6.class.getResourceAsStream("/" + template + ".json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/" + template, Collections.emptyMap(), entity); } } catch (Exception e) { logger.error("Failed to init " + template, e); } }
java
private void initIndexTemplate(String type) { String template = "template_" + type; try { if (doesResourceNotExist("/_template/" + template)) { logger.info("Creating the index template '" + template + "'"); InputStream stream = ElasticSearchDAOV6.class.getResourceAsStream("/" + template + ".json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/" + template, Collections.emptyMap(), entity); } } catch (Exception e) { logger.error("Failed to init " + template, e); } }
[ "private", "void", "initIndexTemplate", "(", "String", "type", ")", "{", "String", "template", "=", "\"template_\"", "+", "type", ";", "try", "{", "if", "(", "doesResourceNotExist", "(", "\"/_template/\"", "+", "template", ")", ")", "{", "logger", ".", "info...
Initializes the index with the required templates and mappings.
[ "Initializes", "the", "index", "with", "the", "required", "templates", "and", "mappings", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/es6-persistence/src/main/java/com/netflix/conductor/dao/es6/index/ElasticSearchRestDAOV6.java#L188-L202
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java
GeneratedDFactoryDaoImpl.queryByCreatedBy
public Iterable<DFactory> queryByCreatedBy(java.lang.String createdBy) { """ query-by method for field createdBy @param createdBy the specified attribute @return an Iterable of DFactorys for the specified createdBy """ return queryByField(null, DFactoryMapper.Field.CREATEDBY.getFieldName(), createdBy); }
java
public Iterable<DFactory> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, DFactoryMapper.Field.CREATEDBY.getFieldName(), createdBy); }
[ "public", "Iterable", "<", "DFactory", ">", "queryByCreatedBy", "(", "java", ".", "lang", ".", "String", "createdBy", ")", "{", "return", "queryByField", "(", "null", ",", "DFactoryMapper", ".", "Field", ".", "CREATEDBY", ".", "getFieldName", "(", ")", ",", ...
query-by method for field createdBy @param createdBy the specified attribute @return an Iterable of DFactorys for the specified createdBy
[ "query", "-", "by", "method", "for", "field", "createdBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L97-L99
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java
Validator.demapProperties
public static Map<String, String> demapProperties( final Map<String, String> input, final Map<String, String> mapping, final boolean skip ) { """ Reverses a set of properties mapped using the specified property mapping, or the same input if the description has no mapping @param input input map @param mapping key value mapping @param skip if true, ignore input entries when the key is not present in the mapping @return mapped values """ if (null == mapping) { return input; } final Map<String, String> rev = new HashMap<String, String>(); for (final Map.Entry<String, String> entry : mapping.entrySet()) { rev.put(entry.getValue(), entry.getKey()); } return performMapping(input, rev, skip); }
java
public static Map<String, String> demapProperties( final Map<String, String> input, final Map<String, String> mapping, final boolean skip ) { if (null == mapping) { return input; } final Map<String, String> rev = new HashMap<String, String>(); for (final Map.Entry<String, String> entry : mapping.entrySet()) { rev.put(entry.getValue(), entry.getKey()); } return performMapping(input, rev, skip); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "demapProperties", "(", "final", "Map", "<", "String", ",", "String", ">", "input", ",", "final", "Map", "<", "String", ",", "String", ">", "mapping", ",", "final", "boolean", "skip", ")", "...
Reverses a set of properties mapped using the specified property mapping, or the same input if the description has no mapping @param input input map @param mapping key value mapping @param skip if true, ignore input entries when the key is not present in the mapping @return mapped values
[ "Reverses", "a", "set", "of", "properties", "mapped", "using", "the", "specified", "property", "mapping", "or", "the", "same", "input", "if", "the", "description", "has", "no", "mapping" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java#L290-L304
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java
Authentication.validSecondFactor
public boolean validSecondFactor(String secret, String number) { """ Checks if a given number for 2FA is valid for the given secret @param secret The plaintext secret to use for checking @param number The number entered by the user @return True if number is valid, false otherwise """ Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(number, Required.TOTP.toString()); return TotpUtils.verifiedTotp(secret, number); }
java
public boolean validSecondFactor(String secret, String number) { Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(number, Required.TOTP.toString()); return TotpUtils.verifiedTotp(secret, number); }
[ "public", "boolean", "validSecondFactor", "(", "String", "secret", ",", "String", "number", ")", "{", "Objects", ".", "requireNonNull", "(", "secret", ",", "Required", ".", "SECRET", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(",...
Checks if a given number for 2FA is valid for the given secret @param secret The plaintext secret to use for checking @param number The number entered by the user @return True if number is valid, false otherwise
[ "Checks", "if", "a", "given", "number", "for", "2FA", "is", "valid", "for", "the", "given", "secret" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Authentication.java#L195-L200
morimekta/utils
console-util/src/main/java/net/morimekta/console/args/ArgumentParser.java
ArgumentParser.printUsage
public void printUsage(OutputStream out, boolean showHidden) { """ Print the option usage list. Essentially printed as a list of options with the description indented where it overflows the available line width. @param out The output stream. @param showHidden Whether to show hidden options. """ printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), showHidden); }
java
public void printUsage(OutputStream out, boolean showHidden) { printUsage(new PrintWriter(new OutputStreamWriter(out, UTF_8)), showHidden); }
[ "public", "void", "printUsage", "(", "OutputStream", "out", ",", "boolean", "showHidden", ")", "{", "printUsage", "(", "new", "PrintWriter", "(", "new", "OutputStreamWriter", "(", "out", ",", "UTF_8", ")", ")", ",", "showHidden", ")", ";", "}" ]
Print the option usage list. Essentially printed as a list of options with the description indented where it overflows the available line width. @param out The output stream. @param showHidden Whether to show hidden options.
[ "Print", "the", "option", "usage", "list", ".", "Essentially", "printed", "as", "a", "list", "of", "options", "with", "the", "description", "indented", "where", "it", "overflows", "the", "available", "line", "width", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/args/ArgumentParser.java#L400-L402
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsSearchParamPanel.java
CmsSearchParamPanel.setContent
public void setContent(String content, String paramKey) { """ Sets the text content of the parameters panel.<p> @param content the content @param paramKey the parameter key """ StringBuffer sb = new StringBuffer(128); sb.append("<b>").append(m_title).append("</b>&nbsp;").append(content); m_text.setHTML(sb.toString()); m_paramKey = paramKey; }
java
public void setContent(String content, String paramKey) { StringBuffer sb = new StringBuffer(128); sb.append("<b>").append(m_title).append("</b>&nbsp;").append(content); m_text.setHTML(sb.toString()); m_paramKey = paramKey; }
[ "public", "void", "setContent", "(", "String", "content", ",", "String", "paramKey", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "128", ")", ";", "sb", ".", "append", "(", "\"<b>\"", ")", ".", "append", "(", "m_title", ")", ".", "a...
Sets the text content of the parameters panel.<p> @param content the content @param paramKey the parameter key
[ "Sets", "the", "text", "content", "of", "the", "parameters", "panel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsSearchParamPanel.java#L99-L105
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java
KbServerSideException.fromThrowable
public static KbServerSideException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a KbServerSideException with the specified detail message. If the Throwable is a KbServerSideException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbServerSideException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbServerSideException """ return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage())) ? (KbServerSideException) cause : new KbServerSideException(message, cause); }
java
public static KbServerSideException fromThrowable(String message, Throwable cause) { return (cause instanceof KbServerSideException && Objects.equals(message, cause.getMessage())) ? (KbServerSideException) cause : new KbServerSideException(message, cause); }
[ "public", "static", "KbServerSideException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbServerSideException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessa...
Converts a Throwable to a KbServerSideException with the specified detail message. If the Throwable is a KbServerSideException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbServerSideException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbServerSideException
[ "Converts", "a", "Throwable", "to", "a", "KbServerSideException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbServerSideException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the",...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbServerSideException.java#L62-L66
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java
AbstractExtraLanguageGenerator.writeFile
protected boolean writeFile(QualifiedName name, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) { """ Write the given file. @param name the name of the type to write. @param appendable the content to be written. @param context the generator context. @return {@code true} if the file was written. """ final ExtraLanguageAppendable fileAppendable = createAppendable(null, context); generateFileHeader(name, fileAppendable, context); final ImportManager importManager = appendable.getImportManager(); if (importManager != null && !importManager.getImports().isEmpty()) { for (final String imported : importManager.getImports()) { final QualifiedName qn = getQualifiedNameConverter().toQualifiedName(imported); generateImportStatement(qn, fileAppendable, context); } fileAppendable.newLine(); } fileAppendable.append(appendable.getContent()); final String content = fileAppendable.getContent(); if (!Strings.isEmpty(content)) { final String fileName = toFilename(name, FILENAME_SEPARATOR); final String outputConfiguration = getOutputConfigurationName(); if (Strings.isEmpty(outputConfiguration)) { context.getFileSystemAccess().generateFile(fileName, content); } else { context.getFileSystemAccess().generateFile(fileName, outputConfiguration, content); } return true; } return false; }
java
protected boolean writeFile(QualifiedName name, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) { final ExtraLanguageAppendable fileAppendable = createAppendable(null, context); generateFileHeader(name, fileAppendable, context); final ImportManager importManager = appendable.getImportManager(); if (importManager != null && !importManager.getImports().isEmpty()) { for (final String imported : importManager.getImports()) { final QualifiedName qn = getQualifiedNameConverter().toQualifiedName(imported); generateImportStatement(qn, fileAppendable, context); } fileAppendable.newLine(); } fileAppendable.append(appendable.getContent()); final String content = fileAppendable.getContent(); if (!Strings.isEmpty(content)) { final String fileName = toFilename(name, FILENAME_SEPARATOR); final String outputConfiguration = getOutputConfigurationName(); if (Strings.isEmpty(outputConfiguration)) { context.getFileSystemAccess().generateFile(fileName, content); } else { context.getFileSystemAccess().generateFile(fileName, outputConfiguration, content); } return true; } return false; }
[ "protected", "boolean", "writeFile", "(", "QualifiedName", "name", ",", "ExtraLanguageAppendable", "appendable", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "ExtraLanguageAppendable", "fileAppendable", "=", "createAppendable", "(", "null", ",", "c...
Write the given file. @param name the name of the type to write. @param appendable the content to be written. @param context the generator context. @return {@code true} if the file was written.
[ "Write", "the", "given", "file", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L477-L504
Appendium/flatpack
flatpack/src/main/java/net/sf/flatpack/util/FixedWidthParserUtils.java
FixedWidthParserUtils.getCMDKey
public static String getCMDKey(final MetaData columnMD, final String line) { """ Returns the key to the list of ColumnMetaData objects. Returns the correct MetaData per the mapping file and the data contained on the line @param columnMD @param line @return List - ColumMetaData """ if (!columnMD.isAnyRecordFormatSpecified()) { // no <RECORD> elements were specified for this parse, just return the // detail id return FPConstants.DETAIL_ID; } final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator(); // loop through the XMLRecordElement objects and see if we need a // different MD object while (mapEntries.hasNext()) { final Entry<String, XMLRecordElement> entry = mapEntries.next(); final XMLRecordElement recordXMLElement = entry.getValue(); if (recordXMLElement.getEndPositition() > line.length()) { // make sure our substring is not going to fail continue; } final int subfrm = recordXMLElement.getStartPosition() - 1; // convert // to 0 // based final int subto = recordXMLElement.getEndPositition(); if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) { // we found the MD object we want to return return entry.getKey(); } } // must be a detail line return FPConstants.DETAIL_ID; }
java
public static String getCMDKey(final MetaData columnMD, final String line) { if (!columnMD.isAnyRecordFormatSpecified()) { // no <RECORD> elements were specified for this parse, just return the // detail id return FPConstants.DETAIL_ID; } final Iterator<Entry<String, XMLRecordElement>> mapEntries = columnMD.xmlRecordIterator(); // loop through the XMLRecordElement objects and see if we need a // different MD object while (mapEntries.hasNext()) { final Entry<String, XMLRecordElement> entry = mapEntries.next(); final XMLRecordElement recordXMLElement = entry.getValue(); if (recordXMLElement.getEndPositition() > line.length()) { // make sure our substring is not going to fail continue; } final int subfrm = recordXMLElement.getStartPosition() - 1; // convert // to 0 // based final int subto = recordXMLElement.getEndPositition(); if (line.substring(subfrm, subto).equals(recordXMLElement.getIndicator())) { // we found the MD object we want to return return entry.getKey(); } } // must be a detail line return FPConstants.DETAIL_ID; }
[ "public", "static", "String", "getCMDKey", "(", "final", "MetaData", "columnMD", ",", "final", "String", "line", ")", "{", "if", "(", "!", "columnMD", ".", "isAnyRecordFormatSpecified", "(", ")", ")", "{", "// no <RECORD> elements were specified for this parse, just r...
Returns the key to the list of ColumnMetaData objects. Returns the correct MetaData per the mapping file and the data contained on the line @param columnMD @param line @return List - ColumMetaData
[ "Returns", "the", "key", "to", "the", "list", "of", "ColumnMetaData", "objects", ".", "Returns", "the", "correct", "MetaData", "per", "the", "mapping", "file", "and", "the", "data", "contained", "on", "the", "line" ]
train
https://github.com/Appendium/flatpack/blob/5e09875d97db7038e3ba6af9468f5313d99b0082/flatpack/src/main/java/net/sf/flatpack/util/FixedWidthParserUtils.java#L97-L127
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.hasInstanceOf
public static boolean hasInstanceOf(final JSONObject json, final String key, Class<?> type) { """ Check if the {@link JSONObject} has an item at {@code key} that is an instance of {@code type}. @param json {@code JSONObject} to inspect @param key Item in object to check @param type Type to check the item against @return {@code True} if the item exists and is of the specified {@code type}; {@code false} otherwise """ Object o = json.opt(key); return isInstanceOf(o, type); }
java
public static boolean hasInstanceOf(final JSONObject json, final String key, Class<?> type) { Object o = json.opt(key); return isInstanceOf(o, type); }
[ "public", "static", "boolean", "hasInstanceOf", "(", "final", "JSONObject", "json", ",", "final", "String", "key", ",", "Class", "<", "?", ">", "type", ")", "{", "Object", "o", "=", "json", ".", "opt", "(", "key", ")", ";", "return", "isInstanceOf", "(...
Check if the {@link JSONObject} has an item at {@code key} that is an instance of {@code type}. @param json {@code JSONObject} to inspect @param key Item in object to check @param type Type to check the item against @return {@code True} if the item exists and is of the specified {@code type}; {@code false} otherwise
[ "Check", "if", "the", "{", "@link", "JSONObject", "}", "has", "an", "item", "at", "{", "@code", "key", "}", "that", "is", "an", "instance", "of", "{", "@code", "type", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1117-L1121
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithTokenAndFee
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, Fee fee ) { """ Executes a {@link Transaction} with token for the given amount in the given currency. @param token Token generated by PAYMILL Bridge, which represents a credit card or direct debit. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @param fee A {@link Fee}. @return {@link Transaction} object indicating whether a the call was successful or not. """ return this.createWithTokenAndFee( token, amount, currency, null, fee ); }
java
public Transaction createWithTokenAndFee( String token, Integer amount, String currency, Fee fee ) { return this.createWithTokenAndFee( token, amount, currency, null, fee ); }
[ "public", "Transaction", "createWithTokenAndFee", "(", "String", "token", ",", "Integer", "amount", ",", "String", "currency", ",", "Fee", "fee", ")", "{", "return", "this", ".", "createWithTokenAndFee", "(", "token", ",", "amount", ",", "currency", ",", "null...
Executes a {@link Transaction} with token for the given amount in the given currency. @param token Token generated by PAYMILL Bridge, which represents a credit card or direct debit. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @param fee A {@link Fee}. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L143-L145
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntClassMention.java
OntClassMention.setMatchedTokens
public void setMatchedTokens(int i, Token v) { """ indexed setter for matchedTokens - sets an indexed value - List of tokens the ontology class mention is comprised of. @generated @param i index in the array to set @param v value to set into the array """ if (OntClassMention_Type.featOkTst && ((OntClassMention_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "de.julielab.jules.types.OntClassMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setMatchedTokens(int i, Token v) { if (OntClassMention_Type.featOkTst && ((OntClassMention_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "de.julielab.jules.types.OntClassMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setMatchedTokens", "(", "int", "i", ",", "Token", "v", ")", "{", "if", "(", "OntClassMention_Type", ".", "featOkTst", "&&", "(", "(", "OntClassMention_Type", ")", "jcasType", ")", ".", "casFeat_matchedTokens", "==", "null", ")", "jcasType", ...
indexed setter for matchedTokens - sets an indexed value - List of tokens the ontology class mention is comprised of. @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "matchedTokens", "-", "sets", "an", "indexed", "value", "-", "List", "of", "tokens", "the", "ontology", "class", "mention", "is", "comprised", "of", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntClassMention.java#L249-L253
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java
OrientationHistogramSift.interpolateAngle
double interpolateAngle(int index0, int index1, int index2, double offset) { """ Given the interpolated index, compute the angle from the 3 indexes. The angle for each index is computed from the weighted gradients. @param offset Interpolated index offset relative to index0. range -1 to 1 @return Interpolated angle. """ double angle1 = Math.atan2(histogramY[index1],histogramX[index1]); double deltaAngle; if( offset < 0 ) { double angle0 = Math.atan2(histogramY[index0],histogramX[index0]); deltaAngle = UtilAngle.dist(angle0,angle1); } else { double angle2 = Math.atan2(histogramY[index2], histogramX[index2]); deltaAngle = UtilAngle.dist(angle2,angle1); } return UtilAngle.bound(angle1 + deltaAngle*offset); }
java
double interpolateAngle(int index0, int index1, int index2, double offset) { double angle1 = Math.atan2(histogramY[index1],histogramX[index1]); double deltaAngle; if( offset < 0 ) { double angle0 = Math.atan2(histogramY[index0],histogramX[index0]); deltaAngle = UtilAngle.dist(angle0,angle1); } else { double angle2 = Math.atan2(histogramY[index2], histogramX[index2]); deltaAngle = UtilAngle.dist(angle2,angle1); } return UtilAngle.bound(angle1 + deltaAngle*offset); }
[ "double", "interpolateAngle", "(", "int", "index0", ",", "int", "index1", ",", "int", "index2", ",", "double", "offset", ")", "{", "double", "angle1", "=", "Math", ".", "atan2", "(", "histogramY", "[", "index1", "]", ",", "histogramX", "[", "index1", "]"...
Given the interpolated index, compute the angle from the 3 indexes. The angle for each index is computed from the weighted gradients. @param offset Interpolated index offset relative to index0. range -1 to 1 @return Interpolated angle.
[ "Given", "the", "interpolated", "index", "compute", "the", "angle", "from", "the", "3", "indexes", ".", "The", "angle", "for", "each", "index", "is", "computed", "from", "the", "weighted", "gradients", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/orientation/OrientationHistogramSift.java#L281-L293
daimajia/AndroidImageSlider
library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java
ViewPagerEx.setPageTransformer
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) { """ Set a {@link PageTransformer} that will be called for each attached page whenever the scroll position is changed. This allows the application to apply custom property transformations to each page, overriding the default sliding look and feel. <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist. As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p> @param reverseDrawingOrder true if the supplied PageTransformer requires page views to be drawn from last to first instead of first to last. @param transformer PageTransformer that will modify each page's animation properties """ final boolean hasTransformer = transformer != null; final boolean needsPopulate = hasTransformer != (mPageTransformer != null); mPageTransformer = transformer; setChildrenDrawingOrderEnabledCompat(hasTransformer); if (hasTransformer) { mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD; } else { mDrawingOrder = DRAW_ORDER_DEFAULT; } if (needsPopulate) populate(); }
java
public void setPageTransformer(boolean reverseDrawingOrder, PageTransformer transformer) { final boolean hasTransformer = transformer != null; final boolean needsPopulate = hasTransformer != (mPageTransformer != null); mPageTransformer = transformer; setChildrenDrawingOrderEnabledCompat(hasTransformer); if (hasTransformer) { mDrawingOrder = reverseDrawingOrder ? DRAW_ORDER_REVERSE : DRAW_ORDER_FORWARD; } else { mDrawingOrder = DRAW_ORDER_DEFAULT; } if (needsPopulate) populate(); }
[ "public", "void", "setPageTransformer", "(", "boolean", "reverseDrawingOrder", ",", "PageTransformer", "transformer", ")", "{", "final", "boolean", "hasTransformer", "=", "transformer", "!=", "null", ";", "final", "boolean", "needsPopulate", "=", "hasTransformer", "!=...
Set a {@link PageTransformer} that will be called for each attached page whenever the scroll position is changed. This allows the application to apply custom property transformations to each page, overriding the default sliding look and feel. <p><em>Note:</em> Prior to Android 3.0 the property animation APIs did not exist. As a result, setting a PageTransformer prior to Android 3.0 (API 11) will have no effect.</p> @param reverseDrawingOrder true if the supplied PageTransformer requires page views to be drawn from last to first instead of first to last. @param transformer PageTransformer that will modify each page's animation properties
[ "Set", "a", "{", "@link", "PageTransformer", "}", "that", "will", "be", "called", "for", "each", "attached", "page", "whenever", "the", "scroll", "position", "is", "changed", ".", "This", "allows", "the", "application", "to", "apply", "custom", "property", "...
train
https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java#L625-L636
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java
WorkQueueManager.processWork
protected VirtualConnection processWork(TCPBaseRequestContext req, int options) { """ Processes the request. If the request is already associated with a work queue - send it there. Otherwise round robin requests amongst our set of queues. @param req @param options @return VirtualConnections """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "processWork"); } TCPConnLink conn = req.getTCPConnLink(); VirtualConnection vc = null; if (options != 1) { // initialize the action to false, set to true if we do the allocate if (req.isRequestTypeRead()) { ((TCPReadRequestContextImpl) req).setJITAllocateAction(false); } } if (attemptIO(req, false)) { vc = conn.getVirtualConnection(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "processWork"); } return vc; }
java
protected VirtualConnection processWork(TCPBaseRequestContext req, int options) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "processWork"); } TCPConnLink conn = req.getTCPConnLink(); VirtualConnection vc = null; if (options != 1) { // initialize the action to false, set to true if we do the allocate if (req.isRequestTypeRead()) { ((TCPReadRequestContextImpl) req).setJITAllocateAction(false); } } if (attemptIO(req, false)) { vc = conn.getVirtualConnection(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "processWork"); } return vc; }
[ "protected", "VirtualConnection", "processWork", "(", "TCPBaseRequestContext", "req", ",", "int", "options", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry",...
Processes the request. If the request is already associated with a work queue - send it there. Otherwise round robin requests amongst our set of queues. @param req @param options @return VirtualConnections
[ "Processes", "the", "request", ".", "If", "the", "request", "is", "already", "associated", "with", "a", "work", "queue", "-", "send", "it", "there", ".", "Otherwise", "round", "robin", "requests", "amongst", "our", "set", "of", "queues", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/WorkQueueManager.java#L288-L311
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java
MultiLayerNetwork.setParamTable
@Override public void setParamTable(Map<String, INDArray> paramTable) { """ Set the parameters of the netowrk. Note that the parameter keys must match the format as described in {@link #getParam(String)} and {@link #paramTable()}. Note that the values of the parameters used as an argument to this method are copied - i.e., it is safe to later modify/reuse the values in the provided paramTable without this impacting the network. @param paramTable Parameters to set """ Map<String, INDArray> currParamTable = paramTable(); if (!currParamTable.keySet().equals(paramTable.keySet())) { throw new IllegalArgumentException("Cannot set param table: parameter keys do not match.\n" + "Current: " + currParamTable.keySet() + "\nTo set: " + paramTable.keySet()); } for (String s : paramTable.keySet()) { INDArray curr = currParamTable.get(s); INDArray toSet = paramTable.get(s); if (!Arrays.equals(curr.shape(), toSet.shape())) { throw new IllegalArgumentException("Cannot set parameter table: parameter \"" + s + "\" shapes " + "do not match. Current = " + Arrays.toString(curr.shape()) + ", to set = " + Arrays.toString(toSet.shape())); } } //Now that we've checked ALL params (to avoid leaving net in half-modified state) for (String s : paramTable.keySet()) { INDArray curr = currParamTable.get(s); INDArray toSet = paramTable.get(s); curr.assign(toSet); } }
java
@Override public void setParamTable(Map<String, INDArray> paramTable) { Map<String, INDArray> currParamTable = paramTable(); if (!currParamTable.keySet().equals(paramTable.keySet())) { throw new IllegalArgumentException("Cannot set param table: parameter keys do not match.\n" + "Current: " + currParamTable.keySet() + "\nTo set: " + paramTable.keySet()); } for (String s : paramTable.keySet()) { INDArray curr = currParamTable.get(s); INDArray toSet = paramTable.get(s); if (!Arrays.equals(curr.shape(), toSet.shape())) { throw new IllegalArgumentException("Cannot set parameter table: parameter \"" + s + "\" shapes " + "do not match. Current = " + Arrays.toString(curr.shape()) + ", to set = " + Arrays.toString(toSet.shape())); } } //Now that we've checked ALL params (to avoid leaving net in half-modified state) for (String s : paramTable.keySet()) { INDArray curr = currParamTable.get(s); INDArray toSet = paramTable.get(s); curr.assign(toSet); } }
[ "@", "Override", "public", "void", "setParamTable", "(", "Map", "<", "String", ",", "INDArray", ">", "paramTable", ")", "{", "Map", "<", "String", ",", "INDArray", ">", "currParamTable", "=", "paramTable", "(", ")", ";", "if", "(", "!", "currParamTable", ...
Set the parameters of the netowrk. Note that the parameter keys must match the format as described in {@link #getParam(String)} and {@link #paramTable()}. Note that the values of the parameters used as an argument to this method are copied - i.e., it is safe to later modify/reuse the values in the provided paramTable without this impacting the network. @param paramTable Parameters to set
[ "Set", "the", "parameters", "of", "the", "netowrk", ".", "Note", "that", "the", "parameter", "keys", "must", "match", "the", "format", "as", "described", "in", "{", "@link", "#getParam", "(", "String", ")", "}", "and", "{", "@link", "#paramTable", "()", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L535-L559
kubernetes-client/java
util/src/main/java/io/kubernetes/client/informer/cache/Cache.java
Cache.byIndex
@Override public List<ApiType> byIndex(String indexName, String indexKey) { """ By index list. @param indexName the index name @param indexKey the index key @return the list """ lock.lock(); try { if (!this.indexers.containsKey(indexName)) { throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName)); } Map<String, Set<String>> index = this.indices.get(indexName); Set<String> set = index.get(indexKey); if (set == null) { return Arrays.asList(); } List<ApiType> items = new ArrayList<>(set.size()); for (String key : set) { items.add(this.items.get(key)); } return items; } finally { lock.unlock(); } }
java
@Override public List<ApiType> byIndex(String indexName, String indexKey) { lock.lock(); try { if (!this.indexers.containsKey(indexName)) { throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName)); } Map<String, Set<String>> index = this.indices.get(indexName); Set<String> set = index.get(indexKey); if (set == null) { return Arrays.asList(); } List<ApiType> items = new ArrayList<>(set.size()); for (String key : set) { items.add(this.items.get(key)); } return items; } finally { lock.unlock(); } }
[ "@", "Override", "public", "List", "<", "ApiType", ">", "byIndex", "(", "String", "indexName", ",", "String", "indexKey", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "!", "this", ".", "indexers", ".", "containsKey", "(", "ind...
By index list. @param indexName the index name @param indexKey the index key @return the list
[ "By", "index", "list", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/cache/Cache.java#L294-L314
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java
DataGenerator.genFile
@SuppressWarnings("unused") private void genFile(Path file, long fileSize) throws IOException { """ Create a file with the name <code>file</code> and a length of <code>fileSize</code>. The file is filled with character 'a'. """ FSDataOutputStream out = fs.create(file, true, getConf().getInt("io.file.buffer.size", 4096), (short) getConf().getInt("dfs.replication", 3), fs.getDefaultBlockSize()); for (long i = 0; i < fileSize; i++) { out.writeByte('a'); } out.close(); }
java
@SuppressWarnings("unused") private void genFile(Path file, long fileSize) throws IOException { FSDataOutputStream out = fs.create(file, true, getConf().getInt("io.file.buffer.size", 4096), (short) getConf().getInt("dfs.replication", 3), fs.getDefaultBlockSize()); for (long i = 0; i < fileSize; i++) { out.writeByte('a'); } out.close(); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "void", "genFile", "(", "Path", "file", ",", "long", "fileSize", ")", "throws", "IOException", "{", "FSDataOutputStream", "out", "=", "fs", ".", "create", "(", "file", ",", "true", ",", "getConf", ...
Create a file with the name <code>file</code> and a length of <code>fileSize</code>. The file is filled with character 'a'.
[ "Create", "a", "file", "with", "the", "name", "<code", ">", "file<", "/", "code", ">", "and", "a", "length", "of", "<code", ">", "fileSize<", "/", "code", ">", ".", "The", "file", "is", "filled", "with", "character", "a", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java#L163-L173
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orLessEqual
public ZealotKhala orLessEqual(String field, Object value) { """ 生成带" OR "前缀小于等于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例 """ return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
java
public ZealotKhala orLessEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.LTE_SUFFIX, true); }
[ "public", "ZealotKhala", "orLessEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "LTE_SUFFIX", ",", "true", ")", ...
生成带" OR "前缀小于等于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "OR", "前缀小于等于查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L879-L881
redkale/redkale
src/org/redkale/asm/ClassWriter.java
ClassWriter.newStringishItem
Item newStringishItem(final int type, final String value) { """ Adds a string reference, a class reference, a method type, a module or a package to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. @param type a type among STR, CLASS, MTYPE, MODULE or PACKAGE @param value string value of the reference. @return a new or already existing reference item. """ key2.set(type, value, null, null); Item result = get(key2); if (result == null) { pool.put12(type, newUTF8(value)); result = new Item(index++, key2); put(result); } return result; }
java
Item newStringishItem(final int type, final String value) { key2.set(type, value, null, null); Item result = get(key2); if (result == null) { pool.put12(type, newUTF8(value)); result = new Item(index++, key2); put(result); } return result; }
[ "Item", "newStringishItem", "(", "final", "int", "type", ",", "final", "String", "value", ")", "{", "key2", ".", "set", "(", "type", ",", "value", ",", "null", ",", "null", ")", ";", "Item", "result", "=", "get", "(", "key2", ")", ";", "if", "(", ...
Adds a string reference, a class reference, a method type, a module or a package to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. @param type a type among STR, CLASS, MTYPE, MODULE or PACKAGE @param value string value of the reference. @return a new or already existing reference item.
[ "Adds", "a", "string", "reference", "a", "class", "reference", "a", "method", "type", "a", "module", "or", "a", "package", "to", "the", "constant", "pool", "of", "the", "class", "being", "build", ".", "Does", "nothing", "if", "the", "constant", "pool", "...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ClassWriter.java#L1188-L1197
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java
RespokeClient.setConversationsRead
public void setConversationsRead(final List<RespokeConversationReadStatus> updates, final Respoke.TaskCompletionListener completionListener) { """ Mark messages in a conversation as having been read, up to the given timestamp @param updates An array of records, each of which indicates a groupId and timestamp of the the most recent message the client has "read". @param completionListener The callback called when this async operation has completed. """ if (!isConnected()) { Respoke.postTaskError(completionListener, "Can't complete request when not connected, " + "Please reconnect!"); return; } if ((updates == null) || (updates.size() == 0)) { Respoke.postTaskError(completionListener, "At least 1 conversation must be specified"); return; } JSONObject body = new JSONObject(); JSONArray groupsJsonArray = new JSONArray(); try { // Add each status object to the array. for (RespokeConversationReadStatus status : updates) { JSONObject jsonStatus = new JSONObject(); jsonStatus.put("groupId", status.groupId); jsonStatus.put("timestamp", status.timestamp.toString()); groupsJsonArray.put(jsonStatus); } // Set the array to the 'groups' property. body.put("groups", groupsJsonArray); } catch(JSONException e) { Respoke.postTaskError(completionListener, "Error forming JSON body to send."); return; } String urlEndpoint = "/v1/endpoints/" + localEndpointID + "/conversations"; signalingChannel.sendRESTMessage("put", urlEndpoint, body, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (completionListener != null) { completionListener.onSuccess(); } } }); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); }
java
public void setConversationsRead(final List<RespokeConversationReadStatus> updates, final Respoke.TaskCompletionListener completionListener) { if (!isConnected()) { Respoke.postTaskError(completionListener, "Can't complete request when not connected, " + "Please reconnect!"); return; } if ((updates == null) || (updates.size() == 0)) { Respoke.postTaskError(completionListener, "At least 1 conversation must be specified"); return; } JSONObject body = new JSONObject(); JSONArray groupsJsonArray = new JSONArray(); try { // Add each status object to the array. for (RespokeConversationReadStatus status : updates) { JSONObject jsonStatus = new JSONObject(); jsonStatus.put("groupId", status.groupId); jsonStatus.put("timestamp", status.timestamp.toString()); groupsJsonArray.put(jsonStatus); } // Set the array to the 'groups' property. body.put("groups", groupsJsonArray); } catch(JSONException e) { Respoke.postTaskError(completionListener, "Error forming JSON body to send."); return; } String urlEndpoint = "/v1/endpoints/" + localEndpointID + "/conversations"; signalingChannel.sendRESTMessage("put", urlEndpoint, body, new RespokeSignalingChannel.RESTListener() { @Override public void onSuccess(Object response) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (completionListener != null) { completionListener.onSuccess(); } } }); } @Override public void onError(final String errorMessage) { Respoke.postTaskError(completionListener, errorMessage); } }); }
[ "public", "void", "setConversationsRead", "(", "final", "List", "<", "RespokeConversationReadStatus", ">", "updates", ",", "final", "Respoke", ".", "TaskCompletionListener", "completionListener", ")", "{", "if", "(", "!", "isConnected", "(", ")", ")", "{", "Respok...
Mark messages in a conversation as having been read, up to the given timestamp @param updates An array of records, each of which indicates a groupId and timestamp of the the most recent message the client has "read". @param completionListener The callback called when this async operation has completed.
[ "Mark", "messages", "in", "a", "conversation", "as", "having", "been", "read", "up", "to", "the", "given", "timestamp" ]
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L735-L787
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.execute
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { """ Telnet RPC responder that returns the stats in ASCII style @param tsdb The TSDB to use for fetching stats @param chan The netty channel to respond on @param cmd call parameters """ final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doCollectStats(tsdb, collector, canonical); chan.write(buf.toString()); return Deferred.fromResult(null); }
java
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doCollectStats(tsdb, collector, canonical); chan.write(buf.toString()); return Deferred.fromResult(null); }
[ "public", "Deferred", "<", "Object", ">", "execute", "(", "final", "TSDB", "tsdb", ",", "final", "Channel", "chan", ",", "final", "String", "[", "]", "cmd", ")", "{", "final", "boolean", "canonical", "=", "tsdb", ".", "getConfig", "(", ")", ".", "getBo...
Telnet RPC responder that returns the stats in ASCII style @param tsdb The TSDB to use for fetching stats @param chan The netty channel to respond on @param cmd call parameters
[ "Telnet", "RPC", "responder", "that", "returns", "the", "stats", "in", "ASCII", "style" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L59-L67
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateServiceActionRequest.java
CreateServiceActionRequest.withDefinition
public CreateServiceActionRequest withDefinition(java.util.Map<String, String> definition) { """ <p> The self-service action definition. Can be one of the following: </p> <dl> <dt>Name</dt> <dd> <p> The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>. </p> </dd> <dt>Version</dt> <dd> <p> The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code> </p> </dd> <dt>AssumeRole</dt> <dd> <p> The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>. </p> <p> To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>. </p> </dd> <dt>Parameters</dt> <dd> <p> The list of parameters in JSON format. </p> <p> For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>. </p> </dd> </dl> @param definition The self-service action definition. Can be one of the following:</p> <dl> <dt>Name</dt> <dd> <p> The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>. </p> </dd> <dt>Version</dt> <dd> <p> The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code> </p> </dd> <dt>AssumeRole</dt> <dd> <p> The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>. </p> <p> To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>. </p> </dd> <dt>Parameters</dt> <dd> <p> The list of parameters in JSON format. </p> <p> For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>. </p> </dd> @return Returns a reference to this object so that method calls can be chained together. """ setDefinition(definition); return this; }
java
public CreateServiceActionRequest withDefinition(java.util.Map<String, String> definition) { setDefinition(definition); return this; }
[ "public", "CreateServiceActionRequest", "withDefinition", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "definition", ")", "{", "setDefinition", "(", "definition", ")", ";", "return", "this", ";", "}" ]
<p> The self-service action definition. Can be one of the following: </p> <dl> <dt>Name</dt> <dd> <p> The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>. </p> </dd> <dt>Version</dt> <dd> <p> The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code> </p> </dd> <dt>AssumeRole</dt> <dd> <p> The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>. </p> <p> To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>. </p> </dd> <dt>Parameters</dt> <dd> <p> The list of parameters in JSON format. </p> <p> For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>. </p> </dd> </dl> @param definition The self-service action definition. Can be one of the following:</p> <dl> <dt>Name</dt> <dd> <p> The name of the AWS Systems Manager Document. For example, <code>AWS-RestartEC2Instance</code>. </p> </dd> <dt>Version</dt> <dd> <p> The AWS Systems Manager automation document version. For example, <code>"Version": "1"</code> </p> </dd> <dt>AssumeRole</dt> <dd> <p> The Amazon Resource Name (ARN) of the role that performs the self-service actions on your behalf. For example, <code>"AssumeRole": "arn:aws:iam::12345678910:role/ActionRole"</code>. </p> <p> To reuse the provisioned product launch role, set to <code>"AssumeRole": "LAUNCH_ROLE"</code>. </p> </dd> <dt>Parameters</dt> <dd> <p> The list of parameters in JSON format. </p> <p> For example: <code>[{\"Name\":\"InstanceId\",\"Type\":\"TARGET\"}]</code>. </p> </dd> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "self", "-", "service", "action", "definition", ".", "Can", "be", "one", "of", "the", "following", ":", "<", "/", "p", ">", "<dl", ">", "<dt", ">", "Name<", "/", "dt", ">", "<dd", ">", "<p", ">", "The", "name", "of", "the", "A...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/CreateServiceActionRequest.java#L445-L448
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipTypeHandlerImpl.java
MembershipTypeHandlerImpl.postSave
private void postSave(MembershipType type, boolean isNew) throws Exception { """ Notifying listeners after membership type creation. @param type the membership which is used in create operation @param isNew true, if we have a deal with new membership type, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event """ for (MembershipTypeEventListener listener : listeners) { listener.postSave(type, isNew); } }
java
private void postSave(MembershipType type, boolean isNew) throws Exception { for (MembershipTypeEventListener listener : listeners) { listener.postSave(type, isNew); } }
[ "private", "void", "postSave", "(", "MembershipType", "type", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "for", "(", "MembershipTypeEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "postSave", "(", "type", ",", "isNew", "...
Notifying listeners after membership type creation. @param type the membership which is used in create operation @param isNew true, if we have a deal with new membership type, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event
[ "Notifying", "listeners", "after", "membership", "type", "creation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipTypeHandlerImpl.java#L484-L490
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java
ProductUrl.getProductUrl
public static MozuUrl getProductUrl(Boolean acceptVariantProductCode, Boolean allowInactive, String productCode, String purchaseLocation, Integer quantity, String responseFields, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String variationProductCode, String variationProductCodeFilter) { """ Get Resource Url for GetProduct @param acceptVariantProductCode Specifies whether to accept a product variant's code as the .When you set this parameter to , you can pass in a product variant's code in the GetProduct call to retrieve the product variant details that are associated with the base product. @param allowInactive If true, allow inactive categories to be retrieved in the category list response. If false, the categories retrieved will not include ones marked inactive. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param purchaseLocation The location where the order item(s) was purchased. @param quantity The number of cart items in the shopper's active cart. @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 skipInventoryCheck If true, skip the process to validate inventory when creating this product reservation. @param supressOutOfStock404 Specifies whether to supress the 404 error when the product is out of stock. @param variationProductCode Merchant-created code associated with a specific product variation. Variation product codes maintain an association with the base product code. @param variationProductCodeFilter @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantProductCode}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}"); formatter.formatUrl("acceptVariantProductCode", acceptVariantProductCode); formatter.formatUrl("allowInactive", allowInactive); formatter.formatUrl("productCode", productCode); formatter.formatUrl("purchaseLocation", purchaseLocation); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("skipInventoryCheck", skipInventoryCheck); formatter.formatUrl("supressOutOfStock404", supressOutOfStock404); formatter.formatUrl("variationProductCode", variationProductCode); formatter.formatUrl("variationProductCodeFilter", variationProductCodeFilter); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getProductUrl(Boolean acceptVariantProductCode, Boolean allowInactive, String productCode, String purchaseLocation, Integer quantity, String responseFields, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String variationProductCode, String variationProductCodeFilter) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/{productCode}?variationProductCode={variationProductCode}&allowInactive={allowInactive}&skipInventoryCheck={skipInventoryCheck}&supressOutOfStock404={supressOutOfStock404}&quantity={quantity}&acceptVariantProductCode={acceptVariantProductCode}&purchaseLocation={purchaseLocation}&variationProductCodeFilter={variationProductCodeFilter}&responseFields={responseFields}"); formatter.formatUrl("acceptVariantProductCode", acceptVariantProductCode); formatter.formatUrl("allowInactive", allowInactive); formatter.formatUrl("productCode", productCode); formatter.formatUrl("purchaseLocation", purchaseLocation); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("skipInventoryCheck", skipInventoryCheck); formatter.formatUrl("supressOutOfStock404", supressOutOfStock404); formatter.formatUrl("variationProductCode", variationProductCode); formatter.formatUrl("variationProductCodeFilter", variationProductCodeFilter); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getProductUrl", "(", "Boolean", "acceptVariantProductCode", ",", "Boolean", "allowInactive", ",", "String", "productCode", ",", "String", "purchaseLocation", ",", "Integer", "quantity", ",", "String", "responseFields", ",", "Boolean", "...
Get Resource Url for GetProduct @param acceptVariantProductCode Specifies whether to accept a product variant's code as the .When you set this parameter to , you can pass in a product variant's code in the GetProduct call to retrieve the product variant details that are associated with the base product. @param allowInactive If true, allow inactive categories to be retrieved in the category list response. If false, the categories retrieved will not include ones marked inactive. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param purchaseLocation The location where the order item(s) was purchased. @param quantity The number of cart items in the shopper's active cart. @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 skipInventoryCheck If true, skip the process to validate inventory when creating this product reservation. @param supressOutOfStock404 Specifies whether to supress the 404 error when the product is out of stock. @param variationProductCode Merchant-created code associated with a specific product variation. Variation product codes maintain an association with the base product code. @param variationProductCodeFilter @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetProduct" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java#L72-L86
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java
XMLUpdateShredder.addNewText
private void addNewText(final EAdd paramAdd, final Characters paramTextEvent) throws TTException { """ Add a new text node. @param paramAdd determines how to add the node @param paramTextEvent the current {@link Character} event from the StAX parser. @throws TTException if adding text node fails """ assert paramTextEvent != null; final String text = paramTextEvent.getData().trim(); final ByteBuffer textByteBuffer = ByteBuffer.wrap(TypedValue.getBytes(text)); if (textByteBuffer.array().length > 0) { if (paramAdd == EAdd.ASFIRSTCHILD) { mWtx.insertTextAsFirstChild(new String(textByteBuffer.array())); } else { mWtx.insertTextAsRightSibling(new String(textByteBuffer.array())); } } }
java
private void addNewText(final EAdd paramAdd, final Characters paramTextEvent) throws TTException { assert paramTextEvent != null; final String text = paramTextEvent.getData().trim(); final ByteBuffer textByteBuffer = ByteBuffer.wrap(TypedValue.getBytes(text)); if (textByteBuffer.array().length > 0) { if (paramAdd == EAdd.ASFIRSTCHILD) { mWtx.insertTextAsFirstChild(new String(textByteBuffer.array())); } else { mWtx.insertTextAsRightSibling(new String(textByteBuffer.array())); } } }
[ "private", "void", "addNewText", "(", "final", "EAdd", "paramAdd", ",", "final", "Characters", "paramTextEvent", ")", "throws", "TTException", "{", "assert", "paramTextEvent", "!=", "null", ";", "final", "String", "text", "=", "paramTextEvent", ".", "getData", "...
Add a new text node. @param paramAdd determines how to add the node @param paramTextEvent the current {@link Character} event from the StAX parser. @throws TTException if adding text node fails
[ "Add", "a", "new", "text", "node", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L1117-L1128
amzn/ion-java
src/com/amazon/ion/impl/lite/IonContainerLite.java
IonContainerLite.add
void add(int index, IonValueLite child) throws ContainedValueException, NullPointerException { """ Validates the child and checks locks. @param child must not be null. @throws NullPointerException if the element is <code>null</code>. @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index > size()). """ if ((index < 0) || (index > get_child_count())) { throw new IndexOutOfBoundsException(); } checkForLock(); validateNewChild(child); add_child(index, child); patch_elements_helper(index + 1); assert((index >= 0) && (index < get_child_count()) && (child == get_child(index)) && (child._elementid() == index)); }
java
void add(int index, IonValueLite child) throws ContainedValueException, NullPointerException { if ((index < 0) || (index > get_child_count())) { throw new IndexOutOfBoundsException(); } checkForLock(); validateNewChild(child); add_child(index, child); patch_elements_helper(index + 1); assert((index >= 0) && (index < get_child_count()) && (child == get_child(index)) && (child._elementid() == index)); }
[ "void", "add", "(", "int", "index", ",", "IonValueLite", "child", ")", "throws", "ContainedValueException", ",", "NullPointerException", "{", "if", "(", "(", "index", "<", "0", ")", "||", "(", "index", ">", "get_child_count", "(", ")", ")", ")", "{", "th...
Validates the child and checks locks. @param child must not be null. @throws NullPointerException if the element is <code>null</code>. @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index > size()).
[ "Validates", "the", "child", "and", "checks", "locks", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonContainerLite.java#L541-L558
joniles/mpxj
src/main/java/net/sf/mpxj/sdef/SDEFmethods.java
SDEFmethods.rset
public static String rset(String input, int width) { """ Another method to force an input string into a fixed width field and set it on the right with the left side filled with space ' ' characters. @param input input string @param width required width @return formatted string """ String result; // result to return StringBuilder pad = new StringBuilder(); if (input == null) { for (int i = 0; i < width - 1; i++) { pad.append(' '); // put blanks into buffer } result = " " + pad; // one short to use + overload } else { if (input.length() >= width) { result = input.substring(0, width); // when input is too long, truncate } else { int padLength = width - input.length(); // number of blanks to add for (int i = 0; i < padLength; i++) { pad.append(' '); // actually put blanks into buffer } result = pad + input; // concatenate } } return result; }
java
public static String rset(String input, int width) { String result; // result to return StringBuilder pad = new StringBuilder(); if (input == null) { for (int i = 0; i < width - 1; i++) { pad.append(' '); // put blanks into buffer } result = " " + pad; // one short to use + overload } else { if (input.length() >= width) { result = input.substring(0, width); // when input is too long, truncate } else { int padLength = width - input.length(); // number of blanks to add for (int i = 0; i < padLength; i++) { pad.append(' '); // actually put blanks into buffer } result = pad + input; // concatenate } } return result; }
[ "public", "static", "String", "rset", "(", "String", "input", ",", "int", "width", ")", "{", "String", "result", ";", "// result to return", "StringBuilder", "pad", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "input", "==", "null", ")", "{", "...
Another method to force an input string into a fixed width field and set it on the right with the left side filled with space ' ' characters. @param input input string @param width required width @return formatted string
[ "Another", "method", "to", "force", "an", "input", "string", "into", "a", "fixed", "width", "field", "and", "set", "it", "on", "the", "right", "with", "the", "left", "side", "filled", "with", "space", "characters", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sdef/SDEFmethods.java#L82-L111