repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java
ConversionManager.convertGenericClazz
@SuppressWarnings("unchecked") private <T> ConversionStatus convertGenericClazz(String rawString, Class<T> type, TypeVariable<?> typeVariable) { ConversionStatus status = new ConversionStatus(); AnnotatedType[] bounds = typeVariable.getAnnotatedBounds(); for (AnnotatedType bound : bounds) { Type bType = bound.getType(); if (bType instanceof Class) { Class<?> bClazz = (Class<?>) bType; if (bClazz.isAssignableFrom(type)) { T converted = (T) convert(rawString, typeVariable); status.setConverted(converted); break; } } } return status; }
java
@SuppressWarnings("unchecked") private <T> ConversionStatus convertGenericClazz(String rawString, Class<T> type, TypeVariable<?> typeVariable) { ConversionStatus status = new ConversionStatus(); AnnotatedType[] bounds = typeVariable.getAnnotatedBounds(); for (AnnotatedType bound : bounds) { Type bType = bound.getType(); if (bType instanceof Class) { Class<?> bClazz = (Class<?>) bType; if (bClazz.isAssignableFrom(type)) { T converted = (T) convert(rawString, typeVariable); status.setConverted(converted); break; } } } return status; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", ">", "ConversionStatus", "convertGenericClazz", "(", "String", "rawString", ",", "Class", "<", "T", ">", "type", ",", "TypeVariable", "<", "?", ">", "typeVariable", ")", "{", "ConversionS...
Front end to (T)convert(rawString, typeVariable) if isAssignableFrom compatible Converter present @param rawString @param type @param typeVariable @return ConversionStatus<T> whether a converter is found and the converted value
[ "Front", "end", "to", "(", "T", ")", "convert", "(", "rawString", "typeVariable", ")", "if", "isAssignableFrom", "compatible", "Converter", "present" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/ConversionManager.java#L244-L261
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java
LockFile.writeMagic
private final void writeMagic() throws LockFile.FileSecurityException, LockFile.UnexpectedEndOfFileException, LockFile.UnexpectedFileIOException { try { raf.seek(0); raf.write(MAGIC); } catch (SecurityException ex) { throw new FileSecurityException(this, "writeMagic", ex); } catch (EOFException ex) { throw new UnexpectedEndOfFileException(this, "writeMagic", ex); } catch (IOException ex) { throw new UnexpectedFileIOException(this, "writeMagic", ex); } }
java
private final void writeMagic() throws LockFile.FileSecurityException, LockFile.UnexpectedEndOfFileException, LockFile.UnexpectedFileIOException { try { raf.seek(0); raf.write(MAGIC); } catch (SecurityException ex) { throw new FileSecurityException(this, "writeMagic", ex); } catch (EOFException ex) { throw new UnexpectedEndOfFileException(this, "writeMagic", ex); } catch (IOException ex) { throw new UnexpectedFileIOException(this, "writeMagic", ex); } }
[ "private", "final", "void", "writeMagic", "(", ")", "throws", "LockFile", ".", "FileSecurityException", ",", "LockFile", ".", "UnexpectedEndOfFileException", ",", "LockFile", ".", "UnexpectedFileIOException", "{", "try", "{", "raf", ".", "seek", "(", "0", ")", "...
Writes the {@link #MAGIC} value to this object's lock file that distiguishes it as an HSQLDB lock file. <p> @throws FileSecurityException possibly never (seek and write are native methods whose JavaDoc entries do not actually specify throwing <tt>SecurityException</tt>). However, it is conceivable that these native methods may, in turn, access Java methods that do throw <tt>SecurityException</tt>. In this case, a <tt>SecurityException</tt> might be thrown if a required system property value cannot be accessed, or if a security manager exists and its <tt>{@link java.lang.SecurityManager#checkWrite(java.io.FileDescriptor)}</tt> method denies write access to the file @throws UnexpectedEndOfFileException if an end of file exception is thrown while attempting to write the <tt>MAGIC</tt> value to the target file (typically, this cannot happen, but the case is included to distiguish it from the general <tt>IOException</tt> case). @throws UnexpectedFileIOException if any other I/O error occurs while attepting to write the <tt>MAGIC</tt> value to the target file.
[ "Writes", "the", "{", "@link", "#MAGIC", "}", "value", "to", "this", "object", "s", "lock", "file", "that", "distiguishes", "it", "as", "an", "HSQLDB", "lock", "file", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/LockFile.java#L1221-L1236
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java
DiskClient.insertDisk
@BetaApi public final Operation insertDisk(ProjectZoneName zone, Disk diskResource) { InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder() .setZone(zone == null ? null : zone.toString()) .setDiskResource(diskResource) .build(); return insertDisk(request); }
java
@BetaApi public final Operation insertDisk(ProjectZoneName zone, Disk diskResource) { InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder() .setZone(zone == null ? null : zone.toString()) .setDiskResource(diskResource) .build(); return insertDisk(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertDisk", "(", "ProjectZoneName", "zone", ",", "Disk", "diskResource", ")", "{", "InsertDiskHttpRequest", "request", "=", "InsertDiskHttpRequest", ".", "newBuilder", "(", ")", ".", "setZone", "(", "zone", "==", ...
Creates a persistent disk in the specified project using the data in the request. You can create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property. <p>Sample code: <pre><code> try (DiskClient diskClient = DiskClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); Disk diskResource = Disk.newBuilder().build(); Operation response = diskClient.insertDisk(zone, diskResource); } </code></pre> @param zone The name of the zone for this request. @param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "persistent", "disk", "in", "the", "specified", "project", "using", "the", "data", "in", "the", "request", ".", "You", "can", "create", "a", "disk", "with", "a", "sourceImage", "a", "sourceSnapshot", "or", "create", "an", "empty", "500", "G...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java#L741-L750
podio/podio-java
src/main/java/com/podio/item/ItemAPI.java
ItemAPI.getItemsByExternalId
public ItemsResponse getItemsByExternalId(int appId, String externalId) { return getItems(appId, null, null, null, null, new FilterByValue<String>(new ExternalIdFilterBy(), externalId)); }
java
public ItemsResponse getItemsByExternalId(int appId, String externalId) { return getItems(appId, null, null, null, null, new FilterByValue<String>(new ExternalIdFilterBy(), externalId)); }
[ "public", "ItemsResponse", "getItemsByExternalId", "(", "int", "appId", ",", "String", "externalId", ")", "{", "return", "getItems", "(", "appId", ",", "null", ",", "null", ",", "null", ",", "null", ",", "new", "FilterByValue", "<", "String", ">", "(", "ne...
Utility method to get items matching an external id @param appId The id of the app @param externalId The external id @return The items matching the app and external id
[ "Utility", "method", "to", "get", "items", "matching", "an", "external", "id" ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/item/ItemAPI.java#L327-L330
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.getFileUri
public static Uri getFileUri(Context context, File file) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(context, context.getPackageName() + ".file.path.share", file); } return Uri.fromFile(file); }
java
public static Uri getFileUri(Context context, File file) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile(context, context.getPackageName() + ".file.path.share", file); } return Uri.fromFile(file); }
[ "public", "static", "Uri", "getFileUri", "(", "Context", "context", ",", "File", "file", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "N", ")", "{", "return", "FileProvider", ".", "getUriForFile", ...
Get compatible Android 7.0 and lower versions of Uri. @param context {@link Context}. @param file apk file. @return uri.
[ "Get", "compatible", "Android", "7", ".", "0", "and", "lower", "versions", "of", "Uri", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L323-L328
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.containsIgnoreCase
public static boolean containsIgnoreCase (@Nullable final String sText, final char cSearch, @Nonnull final Locale aSortLocale) { return getIndexOfIgnoreCase (sText, cSearch, aSortLocale) != STRING_NOT_FOUND; }
java
public static boolean containsIgnoreCase (@Nullable final String sText, final char cSearch, @Nonnull final Locale aSortLocale) { return getIndexOfIgnoreCase (sText, cSearch, aSortLocale) != STRING_NOT_FOUND; }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "@", "Nullable", "final", "String", "sText", ",", "final", "char", "cSearch", ",", "@", "Nonnull", "final", "Locale", "aSortLocale", ")", "{", "return", "getIndexOfIgnoreCase", "(", "sText", ",", "cSearch...
Check if cSearch is contained within sText ignoring case. @param sText The text to search in. May be <code>null</code>. @param cSearch The char to search for. May be <code>null</code>. @param aSortLocale The locale to be used for case unifying. @return <code>true</code> if sSearch is contained in sText, <code>false</code> otherwise. @see String#indexOf(int)
[ "Check", "if", "cSearch", "is", "contained", "within", "sText", "ignoring", "case", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3082-L3087
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java
ST_CollectionExtract.getArealGeometry
private static void getArealGeometry(ArrayList<Polygon> polygones, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Polygon){ polygones.add((Polygon) subGeom); } else if (subGeom instanceof GeometryCollection){ getArealGeometry(polygones, subGeom); } } }
java
private static void getArealGeometry(ArrayList<Polygon> polygones, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Polygon){ polygones.add((Polygon) subGeom); } else if (subGeom instanceof GeometryCollection){ getArealGeometry(polygones, subGeom); } } }
[ "private", "static", "void", "getArealGeometry", "(", "ArrayList", "<", "Polygon", ">", "polygones", ",", "Geometry", "geometry", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "(", ")", ";", "i", "++", ...
Filter polygon from a geometry @param polygones @param geometry
[ "Filter", "polygon", "from", "a", "geometry" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java#L140-L150
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java
RequestUtil.addFileItem
public static void addFileItem(final Map<String, FileItem[]> files, final String name, final FileItem item) { if (files.containsKey(name)) { // This field contains multiple values, append the new value to the existing values. FileItem[] oldValues = files.get(name); FileItem[] newValues = new FileItem[oldValues.length + 1]; System.arraycopy(oldValues, 0, newValues, 0, oldValues.length); newValues[newValues.length - 1] = item; files.put(name, newValues); } else { files.put(name, new FileItem[]{item}); } }
java
public static void addFileItem(final Map<String, FileItem[]> files, final String name, final FileItem item) { if (files.containsKey(name)) { // This field contains multiple values, append the new value to the existing values. FileItem[] oldValues = files.get(name); FileItem[] newValues = new FileItem[oldValues.length + 1]; System.arraycopy(oldValues, 0, newValues, 0, oldValues.length); newValues[newValues.length - 1] = item; files.put(name, newValues); } else { files.put(name, new FileItem[]{item}); } }
[ "public", "static", "void", "addFileItem", "(", "final", "Map", "<", "String", ",", "FileItem", "[", "]", ">", "files", ",", "final", "String", "name", ",", "final", "FileItem", "item", ")", "{", "if", "(", "files", ".", "containsKey", "(", "name", ")"...
Add the file data to the files collection. If a file already exists with the given name then the value for this name will be an array of all registered files. @param files the map in which to store file data. @param name the name of the file, i.e. the key to store the file against. @param item the file data.
[ "Add", "the", "file", "data", "to", "the", "files", "collection", ".", "If", "a", "file", "already", "exists", "with", "the", "given", "name", "then", "the", "value", "for", "this", "name", "will", "be", "an", "array", "of", "all", "registered", "files",...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/RequestUtil.java#L28-L39
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java
Dictionary.read
public static Dictionary read(Path location) throws IOException { final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location); try (InputStream fsaStream = Files.newInputStream(location); InputStream metadataStream = Files.newInputStream(metadata)) { return read(fsaStream, metadataStream); } }
java
public static Dictionary read(Path location) throws IOException { final Path metadata = DictionaryMetadata.getExpectedMetadataLocation(location); try (InputStream fsaStream = Files.newInputStream(location); InputStream metadataStream = Files.newInputStream(metadata)) { return read(fsaStream, metadataStream); } }
[ "public", "static", "Dictionary", "read", "(", "Path", "location", ")", "throws", "IOException", "{", "final", "Path", "metadata", "=", "DictionaryMetadata", ".", "getExpectedMetadataLocation", "(", "location", ")", ";", "try", "(", "InputStream", "fsaStream", "="...
Attempts to load a dictionary using the path to the FSA file and the expected metadata extension. @param location The location of the dictionary file (<code>*.dict</code>). @return An instantiated dictionary. @throws IOException if an I/O error occurs.
[ "Attempts", "to", "load", "a", "dictionary", "using", "the", "path", "to", "the", "FSA", "file", "and", "the", "expected", "metadata", "extension", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L60-L67
btrplace/scheduler
api/src/main/java/org/btrplace/model/constraint/Ban.java
Ban.newBan
public static List<Ban> newBan(Collection<VM> vms, Collection<Node> nodes) { return vms.stream().map(v -> new Ban(v, nodes)).collect(Collectors.toList()); }
java
public static List<Ban> newBan(Collection<VM> vms, Collection<Node> nodes) { return vms.stream().map(v -> new Ban(v, nodes)).collect(Collectors.toList()); }
[ "public", "static", "List", "<", "Ban", ">", "newBan", "(", "Collection", "<", "VM", ">", "vms", ",", "Collection", "<", "Node", ">", "nodes", ")", "{", "return", "vms", ".", "stream", "(", ")", ".", "map", "(", "v", "->", "new", "Ban", "(", "v",...
Instantiate discrete constraints for a collection of VMs. @param vms the VMs to integrate @param nodes the hosts to disallow @return the associated list of constraints
[ "Instantiate", "discrete", "constraints", "for", "a", "collection", "of", "VMs", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/constraint/Ban.java#L103-L105
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/input/MapZoomControls.java
MapZoomControls.setZoomInFirst
public void setZoomInFirst(boolean zoomInFirst) { this.removeAllViews(); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); if (zoomInFirst) { this.addView(buttonZoomIn, layoutParams); this.addView(buttonZoomOut, layoutParams); } else { this.addView(buttonZoomOut, layoutParams); this.addView(buttonZoomIn, layoutParams); } }
java
public void setZoomInFirst(boolean zoomInFirst) { this.removeAllViews(); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); if (zoomInFirst) { this.addView(buttonZoomIn, layoutParams); this.addView(buttonZoomOut, layoutParams); } else { this.addView(buttonZoomOut, layoutParams); this.addView(buttonZoomIn, layoutParams); } }
[ "public", "void", "setZoomInFirst", "(", "boolean", "zoomInFirst", ")", "{", "this", ".", "removeAllViews", "(", ")", ";", "LayoutParams", "layoutParams", "=", "new", "LayoutParams", "(", "LayoutParams", ".", "WRAP_CONTENT", ",", "LayoutParams", ".", "WRAP_CONTENT...
For horizontal orientation, "zoom in first" means the zoom in button will appear on top of the zoom out button.<br/> For vertical orientation, "zoom in first" means the zoom in button will appear to the left of the zoom out button. @param zoomInFirst zoom in button will be first in layout.
[ "For", "horizontal", "orientation", "zoom", "in", "first", "means", "the", "zoom", "in", "button", "will", "appear", "on", "top", "of", "the", "zoom", "out", "button", ".", "<br", "/", ">", "For", "vertical", "orientation", "zoom", "in", "first", "means", ...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/input/MapZoomControls.java#L317-L327
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java
InvocationHandlerAdapter.toField
public static InvocationHandlerAdapter toField(String name, FieldLocator.Factory fieldLocatorFactory) { return new ForField(name, CACHED, UNPRIVILEGED, Assigner.DEFAULT, fieldLocatorFactory); }
java
public static InvocationHandlerAdapter toField(String name, FieldLocator.Factory fieldLocatorFactory) { return new ForField(name, CACHED, UNPRIVILEGED, Assigner.DEFAULT, fieldLocatorFactory); }
[ "public", "static", "InvocationHandlerAdapter", "toField", "(", "String", "name", ",", "FieldLocator", ".", "Factory", "fieldLocatorFactory", ")", "{", "return", "new", "ForField", "(", "name", ",", "CACHED", ",", "UNPRIVILEGED", ",", "Assigner", ".", "DEFAULT", ...
Creates an implementation for any {@link java.lang.reflect.InvocationHandler} that delegates all method interceptions to a field with the given name. This field has to be of a subtype of invocation handler and needs to be set before any invocations are intercepted. Otherwise, a {@link java.lang.NullPointerException} will be thrown. @param name The name of the field. @param fieldLocatorFactory The field locator factory @return An implementation that delegates all method interceptions to an instance field of the given name.
[ "Creates", "an", "implementation", "for", "any", "{", "@link", "java", ".", "lang", ".", "reflect", ".", "InvocationHandler", "}", "that", "delegates", "all", "method", "interceptions", "to", "a", "field", "with", "the", "given", "name", ".", "This", "field"...
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/InvocationHandlerAdapter.java#L161-L163
RuedigerMoeller/kontraktor
src/main/java/org/nustaq/kontraktor/remoting/base/RemoteRefPolling.java
RemoteRefPolling.scheduleSendLoop
public IPromise scheduleSendLoop(ConnectionRegistry reg) { Promise promise = new Promise(); sendJobs.add(new ScheduleEntry(reg, promise)); synchronized (this) { if ( ! loopStarted ) { loopStarted = true; Actor.current().execute(this); } } return promise; }
java
public IPromise scheduleSendLoop(ConnectionRegistry reg) { Promise promise = new Promise(); sendJobs.add(new ScheduleEntry(reg, promise)); synchronized (this) { if ( ! loopStarted ) { loopStarted = true; Actor.current().execute(this); } } return promise; }
[ "public", "IPromise", "scheduleSendLoop", "(", "ConnectionRegistry", "reg", ")", "{", "Promise", "promise", "=", "new", "Promise", "(", ")", ";", "sendJobs", ".", "add", "(", "new", "ScheduleEntry", "(", "reg", ",", "promise", ")", ")", ";", "synchronized", ...
return a future which is completed upon connection close @param reg @return future completed upon termination of scheduling (disconnect)
[ "return", "a", "future", "which", "is", "completed", "upon", "connection", "close" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/src/main/java/org/nustaq/kontraktor/remoting/base/RemoteRefPolling.java#L66-L76
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/acknowledge/RangedAcknowledger.java
RangedAcknowledger.action
@Override public void action(String queueUrl, List<String> receiptHandles) throws JMSException { if (receiptHandles == null || receiptHandles.isEmpty()) { return; } List<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntries = new ArrayList<DeleteMessageBatchRequestEntry>(); int batchId = 0; for (String receiptHandle : receiptHandles) { // Remove the message from queue of unAckMessages unAckMessages.poll(); DeleteMessageBatchRequestEntry entry = new DeleteMessageBatchRequestEntry( Integer.toString(batchId), receiptHandle); deleteMessageBatchRequestEntries.add(entry); batchId++; } DeleteMessageBatchRequest deleteMessageBatchRequest = new DeleteMessageBatchRequest( queueUrl, deleteMessageBatchRequestEntries); /** * TODO: If one of the batch calls fail, then the remaining messages on * the batch will not be deleted, and will be visible and delivered as * duplicate after visibility timeout expires. */ amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest); }
java
@Override public void action(String queueUrl, List<String> receiptHandles) throws JMSException { if (receiptHandles == null || receiptHandles.isEmpty()) { return; } List<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntries = new ArrayList<DeleteMessageBatchRequestEntry>(); int batchId = 0; for (String receiptHandle : receiptHandles) { // Remove the message from queue of unAckMessages unAckMessages.poll(); DeleteMessageBatchRequestEntry entry = new DeleteMessageBatchRequestEntry( Integer.toString(batchId), receiptHandle); deleteMessageBatchRequestEntries.add(entry); batchId++; } DeleteMessageBatchRequest deleteMessageBatchRequest = new DeleteMessageBatchRequest( queueUrl, deleteMessageBatchRequestEntries); /** * TODO: If one of the batch calls fail, then the remaining messages on * the batch will not be deleted, and will be visible and delivered as * duplicate after visibility timeout expires. */ amazonSQSClient.deleteMessageBatch(deleteMessageBatchRequest); }
[ "@", "Override", "public", "void", "action", "(", "String", "queueUrl", ",", "List", "<", "String", ">", "receiptHandles", ")", "throws", "JMSException", "{", "if", "(", "receiptHandles", "==", "null", "||", "receiptHandles", ".", "isEmpty", "(", ")", ")", ...
Acknowledges up to 10 messages via calling <code>deleteMessageBatch</code>.
[ "Acknowledges", "up", "to", "10", "messages", "via", "calling", "<code", ">", "deleteMessageBatch<", "/", "code", ">", "." ]
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/acknowledge/RangedAcknowledger.java#L131-L157
Alluxio/alluxio
core/common/src/main/java/alluxio/util/ThreadFactoryUtils.java
ThreadFactoryUtils.build
public static ThreadFactory build(final String nameFormat, boolean isDaemon) { return new ThreadFactoryBuilder().setDaemon(isDaemon).setNameFormat(nameFormat).build(); }
java
public static ThreadFactory build(final String nameFormat, boolean isDaemon) { return new ThreadFactoryBuilder().setDaemon(isDaemon).setNameFormat(nameFormat).build(); }
[ "public", "static", "ThreadFactory", "build", "(", "final", "String", "nameFormat", ",", "boolean", "isDaemon", ")", "{", "return", "new", "ThreadFactoryBuilder", "(", ")", ".", "setDaemon", "(", "isDaemon", ")", ".", "setNameFormat", "(", "nameFormat", ")", "...
Creates a {@link java.util.concurrent.ThreadFactory} that spawns off threads. @param nameFormat name pattern for each thread. should contain '%d' to distinguish between threads. @param isDaemon if true, the {@link java.util.concurrent.ThreadFactory} will create daemon threads. @return the created factory
[ "Creates", "a", "{", "@link", "java", ".", "util", ".", "concurrent", ".", "ThreadFactory", "}", "that", "spawns", "off", "threads", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/ThreadFactoryUtils.java#L36-L38
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java
ProductExtraUrl.getExtraUrl
public static MozuUrl getExtraUrl(String attributeFQN, String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getExtraUrl(String attributeFQN, String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getExtraUrl", "(", "String", "attributeFQN", ",", "String", "productCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/products/{productCode}/Extras/{...
Get Resource Url for GetExtra @param attributeFQN Fully qualified name for an attribute. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetExtra" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductExtraUrl.java#L71-L78
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolder_path_GET
public OvhPublicFolder organizationName_service_exchangeService_publicFolder_path_GET(String organizationName, String exchangeService, String path) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPublicFolder.class); }
java
public OvhPublicFolder organizationName_service_exchangeService_publicFolder_path_GET(String organizationName, String exchangeService, String path) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPublicFolder.class); }
[ "public", "OvhPublicFolder", "organizationName_service_exchangeService_publicFolder_path_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "path", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organization...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param path [required] Path for public folder
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L166-L171
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java
FormatUtil.format
public static String format(double[][] m, int w, int d, String pre, String pos, String csep) { DecimalFormat format = new DecimalFormat(); format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); format.setMinimumIntegerDigits(1); format.setMaximumFractionDigits(d); format.setMinimumFractionDigits(d); format.setGroupingUsed(false); StringBuilder msg = new StringBuilder(); for(int i = 0; i < m.length; i++) { double[] row = m[i]; msg.append(pre); for(int j = 0; j < row.length; j++) { if(j > 0) { msg.append(csep); } String s = format.format(row[j]); // format the number whitespace(msg, w - s.length()).append(s); } msg.append(pos); } return msg.toString(); }
java
public static String format(double[][] m, int w, int d, String pre, String pos, String csep) { DecimalFormat format = new DecimalFormat(); format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); format.setMinimumIntegerDigits(1); format.setMaximumFractionDigits(d); format.setMinimumFractionDigits(d); format.setGroupingUsed(false); StringBuilder msg = new StringBuilder(); for(int i = 0; i < m.length; i++) { double[] row = m[i]; msg.append(pre); for(int j = 0; j < row.length; j++) { if(j > 0) { msg.append(csep); } String s = format.format(row[j]); // format the number whitespace(msg, w - s.length()).append(s); } msg.append(pos); } return msg.toString(); }
[ "public", "static", "String", "format", "(", "double", "[", "]", "[", "]", "m", ",", "int", "w", ",", "int", "d", ",", "String", "pre", ",", "String", "pos", ",", "String", "csep", ")", "{", "DecimalFormat", "format", "=", "new", "DecimalFormat", "("...
Returns a string representation of this matrix. @param w column width @param d number of digits after the decimal @param pre Row prefix (e.g. " [") @param pos Row postfix (e.g. "]\n") @param csep Column separator (e.g. ", ") @return a string representation of this matrix
[ "Returns", "a", "string", "representation", "of", "this", "matrix", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L646-L668
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/MetadataManager.java
MetadataManager.readDescriptorRepository
public DescriptorRepository readDescriptorRepository(InputStream inst) { try { RepositoryPersistor persistor = new RepositoryPersistor(); return persistor.readDescriptorRepository(inst); } catch (Exception e) { throw new MetadataException("Can not read repository " + inst, e); } }
java
public DescriptorRepository readDescriptorRepository(InputStream inst) { try { RepositoryPersistor persistor = new RepositoryPersistor(); return persistor.readDescriptorRepository(inst); } catch (Exception e) { throw new MetadataException("Can not read repository " + inst, e); } }
[ "public", "DescriptorRepository", "readDescriptorRepository", "(", "InputStream", "inst", ")", "{", "try", "{", "RepositoryPersistor", "persistor", "=", "new", "RepositoryPersistor", "(", ")", ";", "return", "persistor", ".", "readDescriptorRepository", "(", "inst", "...
Read ClassDescriptors from the given InputStream. @see #mergeDescriptorRepository
[ "Read", "ClassDescriptors", "from", "the", "given", "InputStream", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/MetadataManager.java#L351-L362
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/zeromq/ZeroMQNetworkService.java
ZeroMQNetworkService.firePeerConnected
protected void firePeerConnected(URI peerURI, SpaceID space) { final NetworkServiceListener[] ilisteners; synchronized (this.listeners) { ilisteners = new NetworkServiceListener[this.listeners.size()]; this.listeners.toArray(ilisteners); } for (final NetworkServiceListener listener : ilisteners) { listener.peerConnected(peerURI, space); } }
java
protected void firePeerConnected(URI peerURI, SpaceID space) { final NetworkServiceListener[] ilisteners; synchronized (this.listeners) { ilisteners = new NetworkServiceListener[this.listeners.size()]; this.listeners.toArray(ilisteners); } for (final NetworkServiceListener listener : ilisteners) { listener.peerConnected(peerURI, space); } }
[ "protected", "void", "firePeerConnected", "(", "URI", "peerURI", ",", "SpaceID", "space", ")", "{", "final", "NetworkServiceListener", "[", "]", "ilisteners", ";", "synchronized", "(", "this", ".", "listeners", ")", "{", "ilisteners", "=", "new", "NetworkService...
Notifies that a peer space was connected. @param peerURI - the URI of the peer that was connected to. @param space - the identifier of the connected space.
[ "Notifies", "that", "a", "peer", "space", "was", "connected", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/zeromq/ZeroMQNetworkService.java#L185-L194
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java
CopyManager.copyIn
public long copyIn(final String sql, InputStream from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }
java
public long copyIn(final String sql, InputStream from) throws SQLException, IOException { return copyIn(sql, from, DEFAULT_BUFFER_SIZE); }
[ "public", "long", "copyIn", "(", "final", "String", "sql", ",", "InputStream", "from", ")", "throws", "SQLException", ",", "IOException", "{", "return", "copyIn", "(", "sql", ",", "from", ",", "DEFAULT_BUFFER_SIZE", ")", ";", "}" ]
Use COPY FROM STDIN for very fast copying from an InputStream into a database table. @param sql COPY FROM STDIN statement @param from a CSV file or such @return number of rows updated for server 8.2 or newer; -1 for older @throws SQLException on database usage issues @throws IOException upon input stream or database connection failure
[ "Use", "COPY", "FROM", "STDIN", "for", "very", "fast", "copying", "from", "an", "InputStream", "into", "a", "database", "table", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/copy/CopyManager.java#L198-L200
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/comm/betterssl/BetterSSLFactory.java
BetterSSLFactory.createSocketFactory
public static SSLSocketFactory createSocketFactory(Collection<KeyStore> extraStores) throws KeyStoreException, KeyManagementException { final Collection<X509TrustManager> managers = new ArrayList<>(); for (KeyStore ks : extraStores) { addX509Managers(managers, ks); } /* Add default manager. */ addX509Managers(managers, null); final TrustManager tm = new CompositeTrustManager(managers); try { final SSLContext ctx = SSLContext.getInstance("SSL"); ctx.init(null, new TrustManager[] {tm}, null); return new SSLSocketFactory(ctx); } catch (NoSuchAlgorithmException e) { throw new Error("No SSL protocols supported :(", e); } }
java
public static SSLSocketFactory createSocketFactory(Collection<KeyStore> extraStores) throws KeyStoreException, KeyManagementException { final Collection<X509TrustManager> managers = new ArrayList<>(); for (KeyStore ks : extraStores) { addX509Managers(managers, ks); } /* Add default manager. */ addX509Managers(managers, null); final TrustManager tm = new CompositeTrustManager(managers); try { final SSLContext ctx = SSLContext.getInstance("SSL"); ctx.init(null, new TrustManager[] {tm}, null); return new SSLSocketFactory(ctx); } catch (NoSuchAlgorithmException e) { throw new Error("No SSL protocols supported :(", e); } }
[ "public", "static", "SSLSocketFactory", "createSocketFactory", "(", "Collection", "<", "KeyStore", ">", "extraStores", ")", "throws", "KeyStoreException", ",", "KeyManagementException", "{", "final", "Collection", "<", "X509TrustManager", ">", "managers", "=", "new", ...
Creates a new SSL socket factory which supports both system-installed keys and all additional keys in the provided keystores. @param extraStores extra keystores containing root certificate authorities. @return Socket factory supporting authorization for both system (default) keystores and all the extraStores. @throws KeyStoreException if key store have problems. @throws KeyManagementException if new SSL context could not be initialized.
[ "Creates", "a", "new", "SSL", "socket", "factory", "which", "supports", "both", "system", "-", "installed", "keys", "and", "all", "additional", "keys", "in", "the", "provided", "keystores", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/comm/betterssl/BetterSSLFactory.java#L37-L53
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java
ProcessApplicationContext.withProcessApplicationContext
public static <T> T withProcessApplicationContext(Callable<T> callable, String processApplicationName) throws Exception { try { setCurrentProcessApplication(processApplicationName); return callable.call(); } finally { clear(); } }
java
public static <T> T withProcessApplicationContext(Callable<T> callable, String processApplicationName) throws Exception { try { setCurrentProcessApplication(processApplicationName); return callable.call(); } finally { clear(); } }
[ "public", "static", "<", "T", ">", "T", "withProcessApplicationContext", "(", "Callable", "<", "T", ">", "callable", ",", "String", "processApplicationName", ")", "throws", "Exception", "{", "try", "{", "setCurrentProcessApplication", "(", "processApplicationName", ...
<p>Takes a callable and executes all engine API invocations within that callable in the context of the given process application <p>Equivalent to <pre> try { ProcessApplicationContext.setCurrentProcessApplication("someProcessApplication"); callable.call(); } finally { ProcessApplicationContext.clear(); } </pre> @param callable the callable to execute @param name the name of the process application to switch into
[ "<p", ">", "Takes", "a", "callable", "and", "executes", "all", "engine", "API", "invocations", "within", "that", "callable", "in", "the", "context", "of", "the", "given", "process", "application" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/ProcessApplicationContext.java#L120-L128
netty/netty
buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
CompositeByteBuf.removeComponents
public CompositeByteBuf removeComponents(int cIndex, int numComponents) { checkComponentIndex(cIndex, numComponents); if (numComponents == 0) { return this; } int endIndex = cIndex + numComponents; boolean needsUpdate = false; for (int i = cIndex; i < endIndex; ++i) { Component c = components[i]; if (c.length() > 0) { needsUpdate = true; } if (lastAccessed == c) { lastAccessed = null; } c.free(); } removeCompRange(cIndex, endIndex); if (needsUpdate) { // Only need to call updateComponentOffsets if the length was > 0 updateComponentOffsets(cIndex); } return this; }
java
public CompositeByteBuf removeComponents(int cIndex, int numComponents) { checkComponentIndex(cIndex, numComponents); if (numComponents == 0) { return this; } int endIndex = cIndex + numComponents; boolean needsUpdate = false; for (int i = cIndex; i < endIndex; ++i) { Component c = components[i]; if (c.length() > 0) { needsUpdate = true; } if (lastAccessed == c) { lastAccessed = null; } c.free(); } removeCompRange(cIndex, endIndex); if (needsUpdate) { // Only need to call updateComponentOffsets if the length was > 0 updateComponentOffsets(cIndex); } return this; }
[ "public", "CompositeByteBuf", "removeComponents", "(", "int", "cIndex", ",", "int", "numComponents", ")", "{", "checkComponentIndex", "(", "cIndex", ",", "numComponents", ")", ";", "if", "(", "numComponents", "==", "0", ")", "{", "return", "this", ";", "}", ...
Remove the number of {@link ByteBuf}s starting from the given index. @param cIndex the index on which the {@link ByteBuf}s will be started to removed @param numComponents the number of components to remove
[ "Remove", "the", "number", "of", "{", "@link", "ByteBuf", "}", "s", "starting", "from", "the", "given", "index", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L599-L624
micronaut-projects/micronaut-core
http/src/main/java/io/micronaut/http/context/ServerRequestContext.java
ServerRequestContext.with
public static void with(HttpRequest request, Runnable runnable) { HttpRequest existing = REQUEST.get(); boolean isSet = false; try { if (request != existing) { isSet = true; REQUEST.set(request); } runnable.run(); } finally { if (isSet) { REQUEST.remove(); } } }
java
public static void with(HttpRequest request, Runnable runnable) { HttpRequest existing = REQUEST.get(); boolean isSet = false; try { if (request != existing) { isSet = true; REQUEST.set(request); } runnable.run(); } finally { if (isSet) { REQUEST.remove(); } } }
[ "public", "static", "void", "with", "(", "HttpRequest", "request", ",", "Runnable", "runnable", ")", "{", "HttpRequest", "existing", "=", "REQUEST", ".", "get", "(", ")", ";", "boolean", "isSet", "=", "false", ";", "try", "{", "if", "(", "request", "!=",...
Wrap the execution of the given runnable in request context processing. @param request The request @param runnable The runnable
[ "Wrap", "the", "execution", "of", "the", "given", "runnable", "in", "request", "context", "processing", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http/src/main/java/io/micronaut/http/context/ServerRequestContext.java#L44-L58
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java
DragableArea.duringDrag
protected boolean duringDrag(SVGPoint startPoint, SVGPoint dragPoint, Event evt, boolean inside) { if (listener != null) { return listener.duringDrag(startPoint, dragPoint, evt, inside); } return true; }
java
protected boolean duringDrag(SVGPoint startPoint, SVGPoint dragPoint, Event evt, boolean inside) { if (listener != null) { return listener.duringDrag(startPoint, dragPoint, evt, inside); } return true; }
[ "protected", "boolean", "duringDrag", "(", "SVGPoint", "startPoint", ",", "SVGPoint", "dragPoint", ",", "Event", "evt", ",", "boolean", "inside", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "return", "listener", ".", "duringDrag", "(", "startPoi...
Method called during drags. @param startPoint Drag starting point @param dragPoint Drag end point @param evt The event object @param inside Inside the tracked element @return {@code true} to continue the drag
[ "Method", "called", "during", "drags", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java#L283-L288
HubSpot/Singularity
SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java
SingularityExecutor.killTask
@Override public void killTask(ExecutorDriver executorDriver, Protos.TaskID taskID) { final String taskId = taskID.getValue(); LOG.info("Asked to kill task {}", taskId); KillState killState = monitor.requestKill(taskId); switch (killState) { case DIDNT_EXIST: case INCONSISTENT_STATE: LOG.warn("Couldn't kill task {} due to killState {}", taskId, killState); break; case DESTROYING_PROCESS: case INTERRUPTING_PRE_PROCESS: case KILLING_PROCESS: LOG.info("Requested kill of task {} with killState {}", taskId, killState); break; } }
java
@Override public void killTask(ExecutorDriver executorDriver, Protos.TaskID taskID) { final String taskId = taskID.getValue(); LOG.info("Asked to kill task {}", taskId); KillState killState = monitor.requestKill(taskId); switch (killState) { case DIDNT_EXIST: case INCONSISTENT_STATE: LOG.warn("Couldn't kill task {} due to killState {}", taskId, killState); break; case DESTROYING_PROCESS: case INTERRUPTING_PRE_PROCESS: case KILLING_PROCESS: LOG.info("Requested kill of task {} with killState {}", taskId, killState); break; } }
[ "@", "Override", "public", "void", "killTask", "(", "ExecutorDriver", "executorDriver", ",", "Protos", ".", "TaskID", "taskID", ")", "{", "final", "String", "taskId", "=", "taskID", ".", "getValue", "(", ")", ";", "LOG", ".", "info", "(", "\"Asked to kill ta...
Invoked when a task running within this executor has been killed (via SchedulerDriver::killTask). Note that no status update will be sent on behalf of the executor, the executor is responsible for creating a new TaskStatus (i.e., with TASK_KILLED) and invoking ExecutorDriver::sendStatusUpdate.
[ "Invoked", "when", "a", "task", "running", "within", "this", "executor", "has", "been", "killed", "(", "via", "SchedulerDriver", "::", "killTask", ")", ".", "Note", "that", "no", "status", "update", "will", "be", "sent", "on", "behalf", "of", "the", "execu...
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityExecutor/src/main/java/com/hubspot/singularity/executor/SingularityExecutor.java#L111-L130
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/object/TabularDataConverter.java
TabularDataConverter.checkForFullTabularDataRepresentation
private boolean checkForFullTabularDataRepresentation(JSONObject pValue, TabularType pType) { if (pValue.containsKey("indexNames") && pValue.containsKey("values") && pValue.size() == 2) { Object jsonVal = pValue.get("indexNames"); if (!(jsonVal instanceof JSONArray)) { throw new IllegalArgumentException("Index names for tabular data must given as JSON array, not " + jsonVal.getClass()); } JSONArray indexNames = (JSONArray) jsonVal; List<String> tabularIndexNames = pType.getIndexNames(); if (indexNames.size() != tabularIndexNames.size()) { throw new IllegalArgumentException("Given array with index names must have " + tabularIndexNames.size() + " entries " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")"); } for (Object index : indexNames) { if (!tabularIndexNames.contains(index.toString())) { throw new IllegalArgumentException("No index with name '" + index + "' known " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")"); } } return true; } return false; }
java
private boolean checkForFullTabularDataRepresentation(JSONObject pValue, TabularType pType) { if (pValue.containsKey("indexNames") && pValue.containsKey("values") && pValue.size() == 2) { Object jsonVal = pValue.get("indexNames"); if (!(jsonVal instanceof JSONArray)) { throw new IllegalArgumentException("Index names for tabular data must given as JSON array, not " + jsonVal.getClass()); } JSONArray indexNames = (JSONArray) jsonVal; List<String> tabularIndexNames = pType.getIndexNames(); if (indexNames.size() != tabularIndexNames.size()) { throw new IllegalArgumentException("Given array with index names must have " + tabularIndexNames.size() + " entries " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")"); } for (Object index : indexNames) { if (!tabularIndexNames.contains(index.toString())) { throw new IllegalArgumentException("No index with name '" + index + "' known " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")"); } } return true; } return false; }
[ "private", "boolean", "checkForFullTabularDataRepresentation", "(", "JSONObject", "pValue", ",", "TabularType", "pType", ")", "{", "if", "(", "pValue", ".", "containsKey", "(", "\"indexNames\"", ")", "&&", "pValue", ".", "containsKey", "(", "\"values\"", ")", "&&"...
Check for a full table data representation and do some sanity checks
[ "Check", "for", "a", "full", "table", "data", "representation", "and", "do", "some", "sanity", "checks" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/object/TabularDataConverter.java#L109-L130
Omertron/api-tvrage
src/main/java/com/omertron/tvrageapi/tools/TVRageParser.java
TVRageParser.parseEpisode
private static Episode parseEpisode(Element eEpisode, String season) { Episode episode = new Episode(); EpisodeNumber en = new EpisodeNumber(); en.setSeason(season); en.setEpisode(DOMHelper.getValueFromElement(eEpisode, "seasonnum")); en.setAbsolute(DOMHelper.getValueFromElement(eEpisode, "epnum")); episode.setEpisodeNumber(en); episode.setProductionId(DOMHelper.getValueFromElement(eEpisode, "prodnum")); episode.setAirDate(DOMHelper.getValueFromElement(eEpisode, AIRDATE)); episode.setLink(DOMHelper.getValueFromElement(eEpisode, "link")); episode.setTitle(DOMHelper.getValueFromElement(eEpisode, TITLE)); episode.setSummary(DOMHelper.getValueFromElement(eEpisode, SUMMARY)); episode.setRating(DOMHelper.getValueFromElement(eEpisode, "rating")); episode.setScreenCap(DOMHelper.getValueFromElement(eEpisode, "screencap")); return episode; }
java
private static Episode parseEpisode(Element eEpisode, String season) { Episode episode = new Episode(); EpisodeNumber en = new EpisodeNumber(); en.setSeason(season); en.setEpisode(DOMHelper.getValueFromElement(eEpisode, "seasonnum")); en.setAbsolute(DOMHelper.getValueFromElement(eEpisode, "epnum")); episode.setEpisodeNumber(en); episode.setProductionId(DOMHelper.getValueFromElement(eEpisode, "prodnum")); episode.setAirDate(DOMHelper.getValueFromElement(eEpisode, AIRDATE)); episode.setLink(DOMHelper.getValueFromElement(eEpisode, "link")); episode.setTitle(DOMHelper.getValueFromElement(eEpisode, TITLE)); episode.setSummary(DOMHelper.getValueFromElement(eEpisode, SUMMARY)); episode.setRating(DOMHelper.getValueFromElement(eEpisode, "rating")); episode.setScreenCap(DOMHelper.getValueFromElement(eEpisode, "screencap")); return episode; }
[ "private", "static", "Episode", "parseEpisode", "(", "Element", "eEpisode", ",", "String", "season", ")", "{", "Episode", "episode", "=", "new", "Episode", "(", ")", ";", "EpisodeNumber", "en", "=", "new", "EpisodeNumber", "(", ")", ";", "en", ".", "setSea...
Parse the episode node into an Episode object @param eEpisode @param season @return
[ "Parse", "the", "episode", "node", "into", "an", "Episode", "object" ]
train
https://github.com/Omertron/api-tvrage/blob/4e805a99de812fabea69d97098f2376be14d51bc/src/main/java/com/omertron/tvrageapi/tools/TVRageParser.java#L196-L214
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.Comment
public JBBPDslBuilder Comment(final String text) { this.addItem(new ItemComment(text == null ? "" : text, false)); return this; }
java
public JBBPDslBuilder Comment(final String text) { this.addItem(new ItemComment(text == null ? "" : text, false)); return this; }
[ "public", "JBBPDslBuilder", "Comment", "(", "final", "String", "text", ")", "{", "this", ".", "addItem", "(", "new", "ItemComment", "(", "text", "==", "null", "?", "\"\"", ":", "text", ",", "false", ")", ")", ";", "return", "this", ";", "}" ]
Add comment, in case that a field followed by the comment, the comment will be placed on the same line as field definition. @param text text of comment, can be null @return the builder instance, must not be null
[ "Add", "comment", "in", "case", "that", "a", "field", "followed", "by", "the", "comment", "the", "comment", "will", "be", "placed", "on", "the", "same", "line", "as", "field", "definition", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1301-L1304
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java
JBBPUtils.float2str
public static String float2str(final float floatValue, final int radix) { if (radix != 10 && radix != 16) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } final String result; if (radix == 16) { String converted = Double.toHexString(floatValue); boolean minus = converted.startsWith("-"); if (minus) { converted = converted.substring(1); } if (converted.startsWith("0x")) { converted = converted.substring(2); } result = (minus ? '-' + converted : converted).toUpperCase(Locale.ENGLISH); } else { result = Double.toString(floatValue); } return result; }
java
public static String float2str(final float floatValue, final int radix) { if (radix != 10 && radix != 16) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } final String result; if (radix == 16) { String converted = Double.toHexString(floatValue); boolean minus = converted.startsWith("-"); if (minus) { converted = converted.substring(1); } if (converted.startsWith("0x")) { converted = converted.substring(2); } result = (minus ? '-' + converted : converted).toUpperCase(Locale.ENGLISH); } else { result = Double.toString(floatValue); } return result; }
[ "public", "static", "String", "float2str", "(", "final", "float", "floatValue", ",", "final", "int", "radix", ")", "{", "if", "(", "radix", "!=", "10", "&&", "radix", "!=", "16", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal radix [\"...
Convert float value into string representation with defined radix base. @param floatValue value to be converted in string @param radix radix base to be used for conversion, must be 10 or 16 @return converted value as upper case string @throws IllegalArgumentException for wrong radix base @since 1.4.0
[ "Convert", "float", "value", "into", "string", "representation", "with", "defined", "radix", "base", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L738-L757
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/PoolUtils.java
PoolUtils.doWorkInPoolNicely
public static <V> V doWorkInPoolNicely(final Pool<Jedis> pool, final PoolWork<Jedis, V> work) { final V result; try { result = doWorkInPool(pool, work); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new RuntimeException(e); } return result; }
java
public static <V> V doWorkInPoolNicely(final Pool<Jedis> pool, final PoolWork<Jedis, V> work) { final V result; try { result = doWorkInPool(pool, work); } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new RuntimeException(e); } return result; }
[ "public", "static", "<", "V", ">", "V", "doWorkInPoolNicely", "(", "final", "Pool", "<", "Jedis", ">", "pool", ",", "final", "PoolWork", "<", "Jedis", ",", "V", ">", "work", ")", "{", "final", "V", "result", ";", "try", "{", "result", "=", "doWorkInP...
Perform the given work with a Jedis connection from the given pool. Wraps any thrown checked exceptions in a RuntimeException. @param pool the resource pool @param work the work to perform @param <V> the result type @return the result of the given work
[ "Perform", "the", "given", "work", "with", "a", "Jedis", "connection", "from", "the", "given", "pool", ".", "Wraps", "any", "thrown", "checked", "exceptions", "in", "a", "RuntimeException", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/PoolUtils.java#L68-L78
aws/aws-sdk-java
aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java
StepFunctionBuilder.lte
public static StringLessThanOrEqualCondition.Builder lte(String variable, String expectedValue) { return StringLessThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue); }
java
public static StringLessThanOrEqualCondition.Builder lte(String variable, String expectedValue) { return StringLessThanOrEqualCondition.builder().variable(variable).expectedValue(expectedValue); }
[ "public", "static", "StringLessThanOrEqualCondition", ".", "Builder", "lte", "(", "String", "variable", ",", "String", "expectedValue", ")", "{", "return", "StringLessThanOrEqualCondition", ".", "builder", "(", ")", ".", "variable", "(", "variable", ")", ".", "exp...
Binary condition for String less than or equal to comparison. @param variable The JSONPath expression that determines which piece of the input document is used for the comparison. @param expectedValue The expected value for this condition. @see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a> @see com.amazonaws.services.stepfunctions.builder.states.Choice
[ "Binary", "condition", "for", "String", "less", "than", "or", "equal", "to", "comparison", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L416-L418
jenkinsci/ghprb-plugin
src/main/java/org/jenkinsci/plugins/ghprb/jobdsl/GhprbUpstreamStatusContext.java
GhprbUpstreamStatusContext.completedStatus
void completedStatus(String buildResult, String message) { completedStatus.add(new GhprbBuildResultMessage( GHCommitState.valueOf(buildResult), message )); }
java
void completedStatus(String buildResult, String message) { completedStatus.add(new GhprbBuildResultMessage( GHCommitState.valueOf(buildResult), message )); }
[ "void", "completedStatus", "(", "String", "buildResult", ",", "String", "message", ")", "{", "completedStatus", ".", "add", "(", "new", "GhprbBuildResultMessage", "(", "GHCommitState", ".", "valueOf", "(", "buildResult", ")", ",", "message", ")", ")", ";", "}"...
Use a custom status for when a build is completed. Can be called multiple times to set messages for different build results. Valid build results are {@code 'SUCCESS'}, {@code 'FAILURE'}, and {@code 'ERROR'}.
[ "Use", "a", "custom", "status", "for", "when", "a", "build", "is", "completed", ".", "Can", "be", "called", "multiple", "times", "to", "set", "messages", "for", "different", "build", "results", ".", "Valid", "build", "results", "are", "{" ]
train
https://github.com/jenkinsci/ghprb-plugin/blob/b972d3b94ebbe6d40542c2771407e297bff8430b/src/main/java/org/jenkinsci/plugins/ghprb/jobdsl/GhprbUpstreamStatusContext.java#L78-L83
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.fetchByG_K
@Override public CPOptionCategory fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
java
@Override public CPOptionCategory fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
[ "@", "Override", "public", "CPOptionCategory", "fetchByG_K", "(", "long", "groupId", ",", "String", "key", ")", "{", "return", "fetchByG_K", "(", "groupId", ",", "key", ",", "true", ")", ";", "}" ]
Returns the cp option category where groupId = &#63; and key = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param groupId the group ID @param key the key @return the matching cp option category, or <code>null</code> if a matching cp option category could not be found
[ "Returns", "the", "cp", "option", "category", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "ca...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L2560-L2563
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/android/AuthActivity.java
AuthActivity.checkAppBeforeAuth
public static boolean checkAppBeforeAuth(Context context, String appKey, boolean alertUser) { // Check if the app has set up its manifest properly. Intent testIntent = new Intent(Intent.ACTION_VIEW); String scheme = "db-" +appKey; String uri = scheme + "://" + AUTH_VERSION + AUTH_PATH_CONNECT; testIntent.setData(Uri.parse(uri)); PackageManager pm = context.getPackageManager(); List<ResolveInfo> activities = pm.queryIntentActivities(testIntent, 0); if (null == activities || 0 == activities.size()) { throw new IllegalStateException("URI scheme in your app's " + "manifest is not set up correctly. You should have a " + AuthActivity.class.getName() + " with the " + "scheme: " + scheme); } else if (activities.size() > 1) { if (alertUser) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Security alert"); builder.setMessage("Another app on your phone may be trying to " + "pose as the app you are currently using. The malicious " + "app can't access your account, but linking to Dropbox " + "has been disabled as a precaution. Please contact " + "support@dropbox.com."); builder.setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); } else { Log.w(TAG, "There are multiple apps registered for the AuthActivity " + "URI scheme (" + scheme + "). Another app may be trying to " + " impersonate this app, so authentication will be disabled."); } return false; } else { // Just one activity registered for the URI scheme. Now make sure // it's within the same package so when we return from web auth // we're going back to this app and not some other app. ResolveInfo resolveInfo = activities.get(0); if (null == resolveInfo || null == resolveInfo.activityInfo || !context.getPackageName().equals(resolveInfo.activityInfo.packageName)) { throw new IllegalStateException("There must be a " + AuthActivity.class.getName() + " within your app's package " + "registered for your URI scheme (" + scheme + "). However, " + "it appears that an activity in a different package is " + "registered for that scheme instead. If you have " + "multiple apps that all want to use the same access" + "token pair, designate one of them to do " + "authentication and have the other apps launch it " + "and then retrieve the token pair from it."); } } return true; }
java
public static boolean checkAppBeforeAuth(Context context, String appKey, boolean alertUser) { // Check if the app has set up its manifest properly. Intent testIntent = new Intent(Intent.ACTION_VIEW); String scheme = "db-" +appKey; String uri = scheme + "://" + AUTH_VERSION + AUTH_PATH_CONNECT; testIntent.setData(Uri.parse(uri)); PackageManager pm = context.getPackageManager(); List<ResolveInfo> activities = pm.queryIntentActivities(testIntent, 0); if (null == activities || 0 == activities.size()) { throw new IllegalStateException("URI scheme in your app's " + "manifest is not set up correctly. You should have a " + AuthActivity.class.getName() + " with the " + "scheme: " + scheme); } else if (activities.size() > 1) { if (alertUser) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Security alert"); builder.setMessage("Another app on your phone may be trying to " + "pose as the app you are currently using. The malicious " + "app can't access your account, but linking to Dropbox " + "has been disabled as a precaution. Please contact " + "support@dropbox.com."); builder.setPositiveButton("OK", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); } else { Log.w(TAG, "There are multiple apps registered for the AuthActivity " + "URI scheme (" + scheme + "). Another app may be trying to " + " impersonate this app, so authentication will be disabled."); } return false; } else { // Just one activity registered for the URI scheme. Now make sure // it's within the same package so when we return from web auth // we're going back to this app and not some other app. ResolveInfo resolveInfo = activities.get(0); if (null == resolveInfo || null == resolveInfo.activityInfo || !context.getPackageName().equals(resolveInfo.activityInfo.packageName)) { throw new IllegalStateException("There must be a " + AuthActivity.class.getName() + " within your app's package " + "registered for your URI scheme (" + scheme + "). However, " + "it appears that an activity in a different package is " + "registered for that scheme instead. If you have " + "multiple apps that all want to use the same access" + "token pair, designate one of them to do " + "authentication and have the other apps launch it " + "and then retrieve the token pair from it."); } } return true; }
[ "public", "static", "boolean", "checkAppBeforeAuth", "(", "Context", "context", ",", "String", "appKey", ",", "boolean", "alertUser", ")", "{", "// Check if the app has set up its manifest properly.", "Intent", "testIntent", "=", "new", "Intent", "(", "Intent", ".", "...
Check's the current app's manifest setup for authentication. If the manifest is incorrect, an exception will be thrown. If another app on the device is conflicting with this one, the user will (optionally) be alerted and false will be returned. @param context the app context @param appKey the consumer key for the app @param alertUser whether to alert the user for the case where multiple apps are conflicting. @return {@code true} if this app is properly set up for authentication.
[ "Check", "s", "the", "current", "app", "s", "manifest", "setup", "for", "authentication", ".", "If", "the", "manifest", "is", "incorrect", "an", "exception", "will", "be", "thrown", ".", "If", "another", "app", "on", "the", "device", "is", "conflicting", "...
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/AuthActivity.java#L275-L331
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.registerTypeWithKryoSerializer
public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) { config.registerTypeWithKryoSerializer(type, serializer); }
java
public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) { config.registerTypeWithKryoSerializer(type, serializer); }
[ "public", "<", "T", "extends", "Serializer", "<", "?", ">", "&", "Serializable", ">", "void", "registerTypeWithKryoSerializer", "(", "Class", "<", "?", ">", "type", ",", "T", "serializer", ")", "{", "config", ".", "registerTypeWithKryoSerializer", "(", "type",...
Registers the given type with a Kryo Serializer. <p>Note that the serializer instance must be serializable (as defined by java.io.Serializable), because it may be distributed to the worker nodes by java serialization. @param type The class of the types serialized with the given serializer. @param serializer The serializer to use.
[ "Registers", "the", "given", "type", "with", "a", "Kryo", "Serializer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L582-L584
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/codec/Base64.java
Base64.encodeBase64URLSafeString
public static String encodeBase64URLSafeString(final byte[] binaryData) { return new String(encodeBase64(binaryData, false, true), StandardCharsets.UTF_8); }
java
public static String encodeBase64URLSafeString(final byte[] binaryData) { return new String(encodeBase64(binaryData, false, true), StandardCharsets.UTF_8); }
[ "public", "static", "String", "encodeBase64URLSafeString", "(", "final", "byte", "[", "]", "binaryData", ")", "{", "return", "new", "String", "(", "encodeBase64", "(", "binaryData", ",", "false", ",", "true", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ...
Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The url-safe variation emits - and _ instead of + and / characters. <b>Note: no padding is added.</b> @param binaryData binary data to encode @return String containing Base64 characters @since 1.4
[ "Encodes", "binary", "data", "using", "a", "URL", "-", "safe", "variation", "of", "the", "base64", "algorithm", "but", "does", "not", "chunk", "the", "output", ".", "The", "url", "-", "safe", "variation", "emits", "-", "and", "_", "instead", "of", "+", ...
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/codec/Base64.java#L574-L576
jfrog/artifactory-client-java
httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java
HttpBuilderBase.hostFromUrl
public T hostFromUrl(String urlStr) { if (StringUtils.isNotBlank(urlStr)) { try { URL url = new URL(urlStr); defaultHost = new HttpHost(url.getHost(), url.getPort(), url.getProtocol()); } catch (MalformedURLException e) { throw new IllegalArgumentException("Cannot parse the url " + urlStr, e); } } else { defaultHost = null; } return self(); }
java
public T hostFromUrl(String urlStr) { if (StringUtils.isNotBlank(urlStr)) { try { URL url = new URL(urlStr); defaultHost = new HttpHost(url.getHost(), url.getPort(), url.getProtocol()); } catch (MalformedURLException e) { throw new IllegalArgumentException("Cannot parse the url " + urlStr, e); } } else { defaultHost = null; } return self(); }
[ "public", "T", "hostFromUrl", "(", "String", "urlStr", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "urlStr", ")", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "urlStr", ")", ";", "defaultHost", "=", "new", "HttpHost", "...
Sets the host the client works with by default. This method accepts any valid {@link URL} formatted string. This will extract the schema, host and port to use by default. @throws IllegalArgumentException if the given URL is invalid
[ "Sets", "the", "host", "the", "client", "works", "with", "by", "default", ".", "This", "method", "accepts", "any", "valid", "{", "@link", "URL", "}", "formatted", "string", ".", "This", "will", "extract", "the", "schema", "host", "and", "port", "to", "us...
train
https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java#L87-L99
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getUIOfType
public static Object getUIOfType(ComponentUI ui, Class klass) { if (klass.isInstance(ui)) { return ui; } return null; }
java
public static Object getUIOfType(ComponentUI ui, Class klass) { if (klass.isInstance(ui)) { return ui; } return null; }
[ "public", "static", "Object", "getUIOfType", "(", "ComponentUI", "ui", ",", "Class", "klass", ")", "{", "if", "(", "klass", ".", "isInstance", "(", "ui", ")", ")", "{", "return", "ui", ";", "}", "return", "null", ";", "}" ]
Returns the ui that is of type <code>klass</code>, or null if one can not be found. @param ui the UI delegate to be tested. @param klass the class to test against. @return {@code ui} if {@code klass} is an instance of {@code ui}, {@code null} otherwise.
[ "Returns", "the", "ui", "that", "is", "of", "type", "<code", ">", "klass<", "/", "code", ">", "or", "null", "if", "one", "can", "not", "be", "found", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2555-L2561
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java
ParserBase.copyStreams
protected void copyStreams(InputStream is, OutputStream os) throws IOException { byte[] buffer = new byte[1024]; try { int read; while ((read = is.read(buffer)) != -1) { os.write(buffer, 0, read); buffer = new byte[1024]; } } finally { if (null != os) os.close(); if (null != is) is.close(); } }
java
protected void copyStreams(InputStream is, OutputStream os) throws IOException { byte[] buffer = new byte[1024]; try { int read; while ((read = is.read(buffer)) != -1) { os.write(buffer, 0, read); buffer = new byte[1024]; } } finally { if (null != os) os.close(); if (null != is) is.close(); } }
[ "protected", "void", "copyStreams", "(", "InputStream", "is", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1024", "]", ";", "try", "{", "int", "read", ";", "while", "(", "(", "read"...
Reads from the input stream and copies to the output stream @param is @param os @throws IOException
[ "Reads", "from", "the", "input", "stream", "and", "copies", "to", "the", "output", "stream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L167-L181
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
JBasePanel.addScrollbars
public JPanel addScrollbars(JComponent screen) { Dimension dimension = screen.getPreferredSize(); if ((dimension.height == 0) && (dimension.width == 0)) dimension = JScreenConstants.PREFERRED_SCREEN_SIZE; else if ((screen.getBounds().width != 0) && (screen.getBounds().height != 0)) { dimension.width = screen.getBounds().width; dimension.height = screen.getBounds().height; } dimension.width = Math.max(JScreenConstants.MIN_SCREEN_SIZE.width, Math.min(dimension.width + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.width)); dimension.height = Math.max(JScreenConstants.MIN_SCREEN_SIZE.height, Math.min(dimension.height + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.height)); JScrollPane scrollpane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (dimension != null) scrollpane.setPreferredSize(dimension); scrollpane.setAlignmentX(Component.LEFT_ALIGNMENT); scrollpane.getViewport().add(screen); JPanel panel = new JPanel(); panel.setAlignmentX(Component.LEFT_ALIGNMENT); panel.add(scrollpane); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setOpaque(false); screen.setOpaque(false); scrollpane.setOpaque(false); scrollpane.getViewport().setOpaque(false); return panel; }
java
public JPanel addScrollbars(JComponent screen) { Dimension dimension = screen.getPreferredSize(); if ((dimension.height == 0) && (dimension.width == 0)) dimension = JScreenConstants.PREFERRED_SCREEN_SIZE; else if ((screen.getBounds().width != 0) && (screen.getBounds().height != 0)) { dimension.width = screen.getBounds().width; dimension.height = screen.getBounds().height; } dimension.width = Math.max(JScreenConstants.MIN_SCREEN_SIZE.width, Math.min(dimension.width + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.width)); dimension.height = Math.max(JScreenConstants.MIN_SCREEN_SIZE.height, Math.min(dimension.height + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.height)); JScrollPane scrollpane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); if (dimension != null) scrollpane.setPreferredSize(dimension); scrollpane.setAlignmentX(Component.LEFT_ALIGNMENT); scrollpane.getViewport().add(screen); JPanel panel = new JPanel(); panel.setAlignmentX(Component.LEFT_ALIGNMENT); panel.add(scrollpane); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setOpaque(false); screen.setOpaque(false); scrollpane.setOpaque(false); scrollpane.getViewport().setOpaque(false); return panel; }
[ "public", "JPanel", "addScrollbars", "(", "JComponent", "screen", ")", "{", "Dimension", "dimension", "=", "screen", ".", "getPreferredSize", "(", ")", ";", "if", "(", "(", "dimension", ".", "height", "==", "0", ")", "&&", "(", "dimension", ".", "width", ...
Add a scrollpane to this component and return the component with the scroller and this screen in it. @param screen The screen to add a scroller around.
[ "Add", "a", "scrollpane", "to", "this", "component", "and", "return", "the", "component", "with", "the", "scroller", "and", "this", "screen", "in", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L481-L507
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeaturePyramid.java
FeaturePyramid.detectCandidateFeatures
private void detectCandidateFeatures(T image, double sigma) { // adjust corner intensity threshold based upon the current scale factor float scaleThreshold = (float) (baseThreshold / Math.pow(sigma, scalePower)); detector.setThreshold(scaleThreshold); computeDerivative.setInput(image); D derivX = null, derivY = null; D derivXX = null, derivYY = null, derivXY = null; if (detector.getRequiresGradient()) { derivX = computeDerivative.getDerivative(true); derivY = computeDerivative.getDerivative(false); } if (detector.getRequiresHessian()) { derivXX = computeDerivative.getDerivative(true, true); derivYY = computeDerivative.getDerivative(false, false); derivXY = computeDerivative.getDerivative(true, false); } detector.process(image, derivX, derivY, derivXX, derivYY, derivXY); intensities[spaceIndex].reshape(image.width, image.height); intensities[spaceIndex].setTo(detector.getIntensity()); List<Point2D_I16> m = maximums[spaceIndex]; m.clear(); QueueCorner q = detector.getMaximums(); for (int i = 0; i < q.size; i++) { m.add(q.get(i).copy()); } spaceIndex++; if (spaceIndex >= 3) spaceIndex = 0; }
java
private void detectCandidateFeatures(T image, double sigma) { // adjust corner intensity threshold based upon the current scale factor float scaleThreshold = (float) (baseThreshold / Math.pow(sigma, scalePower)); detector.setThreshold(scaleThreshold); computeDerivative.setInput(image); D derivX = null, derivY = null; D derivXX = null, derivYY = null, derivXY = null; if (detector.getRequiresGradient()) { derivX = computeDerivative.getDerivative(true); derivY = computeDerivative.getDerivative(false); } if (detector.getRequiresHessian()) { derivXX = computeDerivative.getDerivative(true, true); derivYY = computeDerivative.getDerivative(false, false); derivXY = computeDerivative.getDerivative(true, false); } detector.process(image, derivX, derivY, derivXX, derivYY, derivXY); intensities[spaceIndex].reshape(image.width, image.height); intensities[spaceIndex].setTo(detector.getIntensity()); List<Point2D_I16> m = maximums[spaceIndex]; m.clear(); QueueCorner q = detector.getMaximums(); for (int i = 0; i < q.size; i++) { m.add(q.get(i).copy()); } spaceIndex++; if (spaceIndex >= 3) spaceIndex = 0; }
[ "private", "void", "detectCandidateFeatures", "(", "T", "image", ",", "double", "sigma", ")", "{", "// adjust corner intensity threshold based upon the current scale factor", "float", "scaleThreshold", "=", "(", "float", ")", "(", "baseThreshold", "/", "Math", ".", "pow...
Use the feature detector to find candidate features in each level. Only compute the needed image derivatives.
[ "Use", "the", "feature", "detector", "to", "find", "candidate", "features", "in", "each", "level", ".", "Only", "compute", "the", "needed", "image", "derivatives", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeaturePyramid.java#L129-L163
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java
ResourceUtils.buildInputStreamResourceFrom
public static InputStreamResource buildInputStreamResourceFrom(final String value, final String description) { val reader = new StringReader(value); val is = new ReaderInputStream(reader, StandardCharsets.UTF_8); return new InputStreamResource(is, description); }
java
public static InputStreamResource buildInputStreamResourceFrom(final String value, final String description) { val reader = new StringReader(value); val is = new ReaderInputStream(reader, StandardCharsets.UTF_8); return new InputStreamResource(is, description); }
[ "public", "static", "InputStreamResource", "buildInputStreamResourceFrom", "(", "final", "String", "value", ",", "final", "String", "description", ")", "{", "val", "reader", "=", "new", "StringReader", "(", "value", ")", ";", "val", "is", "=", "new", "ReaderInpu...
Build input stream resource from string value. @param value the value @param description the description @return the input stream resource
[ "Build", "input", "stream", "resource", "from", "string", "value", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L218-L222
sagiegurari/fax4j
src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java
AbstractFaxClientSpi.fireFaxMonitorEvent
public final void fireFaxMonitorEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus) { this.fireFaxEvent(id,faxJob,faxJobStatus); }
java
public final void fireFaxMonitorEvent(FaxMonitorEventID id,FaxJob faxJob,FaxJobStatus faxJobStatus) { this.fireFaxEvent(id,faxJob,faxJobStatus); }
[ "public", "final", "void", "fireFaxMonitorEvent", "(", "FaxMonitorEventID", "id", ",", "FaxJob", "faxJob", ",", "FaxJobStatus", "faxJobStatus", ")", "{", "this", ".", "fireFaxEvent", "(", "id", ",", "faxJob", ",", "faxJobStatus", ")", ";", "}" ]
This function fires a new fax monitor event. @param id The fax monitor event ID @param faxJob The fax job @param faxJobStatus The fax job status
[ "This", "function", "fires", "a", "new", "fax", "monitor", "event", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/AbstractFaxClientSpi.java#L246-L249
Prototik/HoloEverywhere
library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java
RadialPickerLayout.setCurrentItemShowing
public void setCurrentItemShowing(int index, boolean animate) { if (index != HOUR_INDEX && index != MINUTE_INDEX) { Log.e(TAG, "TimePicker does not support view at index " + index); return; } int lastIndex = getCurrentItemShowing(); mCurrentItemShowing = index; if (animate && (index != lastIndex)) { ObjectAnimator[] anims = new ObjectAnimator[4]; if (index == MINUTE_INDEX) { anims[0] = mHourRadialTextsView.getDisappearAnimator(); anims[1] = mHourRadialSelectorView.getDisappearAnimator(); anims[2] = mMinuteRadialTextsView.getReappearAnimator(); anims[3] = mMinuteRadialSelectorView.getReappearAnimator(); } else if (index == HOUR_INDEX) { anims[0] = mHourRadialTextsView.getReappearAnimator(); anims[1] = mHourRadialSelectorView.getReappearAnimator(); anims[2] = mMinuteRadialTextsView.getDisappearAnimator(); anims[3] = mMinuteRadialSelectorView.getDisappearAnimator(); } if (mTransition != null && mTransition.isRunning()) { mTransition.end(); } mTransition = new AnimatorSet(); mTransition.playTogether(anims); mTransition.start(); } else { int hourAlpha = (index == HOUR_INDEX) ? 255 : 0; int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0; mHourRadialTextsView.setAlpha(hourAlpha); mHourRadialSelectorView.setAlpha(hourAlpha); mMinuteRadialTextsView.setAlpha(minuteAlpha); mMinuteRadialSelectorView.setAlpha(minuteAlpha); } }
java
public void setCurrentItemShowing(int index, boolean animate) { if (index != HOUR_INDEX && index != MINUTE_INDEX) { Log.e(TAG, "TimePicker does not support view at index " + index); return; } int lastIndex = getCurrentItemShowing(); mCurrentItemShowing = index; if (animate && (index != lastIndex)) { ObjectAnimator[] anims = new ObjectAnimator[4]; if (index == MINUTE_INDEX) { anims[0] = mHourRadialTextsView.getDisappearAnimator(); anims[1] = mHourRadialSelectorView.getDisappearAnimator(); anims[2] = mMinuteRadialTextsView.getReappearAnimator(); anims[3] = mMinuteRadialSelectorView.getReappearAnimator(); } else if (index == HOUR_INDEX) { anims[0] = mHourRadialTextsView.getReappearAnimator(); anims[1] = mHourRadialSelectorView.getReappearAnimator(); anims[2] = mMinuteRadialTextsView.getDisappearAnimator(); anims[3] = mMinuteRadialSelectorView.getDisappearAnimator(); } if (mTransition != null && mTransition.isRunning()) { mTransition.end(); } mTransition = new AnimatorSet(); mTransition.playTogether(anims); mTransition.start(); } else { int hourAlpha = (index == HOUR_INDEX) ? 255 : 0; int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0; mHourRadialTextsView.setAlpha(hourAlpha); mHourRadialSelectorView.setAlpha(hourAlpha); mMinuteRadialTextsView.setAlpha(minuteAlpha); mMinuteRadialSelectorView.setAlpha(minuteAlpha); } }
[ "public", "void", "setCurrentItemShowing", "(", "int", "index", ",", "boolean", "animate", ")", "{", "if", "(", "index", "!=", "HOUR_INDEX", "&&", "index", "!=", "MINUTE_INDEX", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"TimePicker does not support view at...
Set either minutes or hours as showing. @param animate True to animate the transition, false to show with no animation.
[ "Set", "either", "minutes", "or", "hours", "as", "showing", "." ]
train
https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java#L515-L553
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java
MasterWorkerInfo.updateUsedBytes
public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } }
java
public void updateUsedBytes(Map<String, Long> usedBytesOnTiers) { mUsedBytes = 0; mUsedBytesOnTiers = new HashMap<>(usedBytesOnTiers); for (long t : mUsedBytesOnTiers.values()) { mUsedBytes += t; } }
[ "public", "void", "updateUsedBytes", "(", "Map", "<", "String", ",", "Long", ">", "usedBytesOnTiers", ")", "{", "mUsedBytes", "=", "0", ";", "mUsedBytesOnTiers", "=", "new", "HashMap", "<>", "(", "usedBytesOnTiers", ")", ";", "for", "(", "long", "t", ":", ...
Sets the used space of the worker in bytes. @param usedBytesOnTiers used bytes on each storage tier
[ "Sets", "the", "used", "space", "of", "the", "worker", "in", "bytes", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java#L425-L431
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixSuppressWarnings
@Fix("*") public void fixSuppressWarnings(Issue issue, IssueResolutionAcceptor acceptor) { if (isIgnorable(issue.getCode())) { SuppressWarningsAddModification.accept(this, issue, acceptor); } }
java
@Fix("*") public void fixSuppressWarnings(Issue issue, IssueResolutionAcceptor acceptor) { if (isIgnorable(issue.getCode())) { SuppressWarningsAddModification.accept(this, issue, acceptor); } }
[ "@", "Fix", "(", "\"*\"", ")", "public", "void", "fixSuppressWarnings", "(", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "if", "(", "isIgnorable", "(", "issue", ".", "getCode", "(", ")", ")", ")", "{", "SuppressWarningsAddModificati...
Add the fixes with suppress-warning annotations. @param issue the issue. @param acceptor the resolution acceptor.
[ "Add", "the", "fixes", "with", "suppress", "-", "warning", "annotations", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L181-L186
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
XMLConfigAdmin.setMailLog
public void setMailLog(String logFile, String level) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); ConfigWebUtil.getFile(config, config.getRootDirectory(), logFile, FileUtil.TYPE_FILE); Element logging = XMLConfigWebFactory.getChildByName(doc.getDocumentElement(), "logging"); Element[] children = XMLUtil.getChildElementsAsArray(logging); Element logger = null; for (int i = 0; i < children.length; i++) { if (children[i].getTagName().equals("logger") && "mail".equalsIgnoreCase(children[i].getAttribute("name"))) { logger = children[i]; break; } } if (logger == null) { logger = doc.createElement("logger"); logging.appendChild(logger); } logger.setAttribute("name", "mail"); if ("console".equalsIgnoreCase(logFile)) { setClass(logger, null, "appender-", Log4jUtil.appenderClassDefintion("console")); setClass(logger, null, "layout-", Log4jUtil.layoutClassDefintion("pattern")); } else { setClass(logger, null, "appender-", Log4jUtil.appenderClassDefintion("resource")); setClass(logger, null, "layout-", Log4jUtil.layoutClassDefintion("classic")); logger.setAttribute("appender-arguments", "path:" + logFile); } logger.setAttribute("log-level", level); }
java
public void setMailLog(String logFile, String level) throws PageException { checkWriteAccess(); boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAIL); if (!hasAccess) throw new SecurityException("no access to update mail server settings"); ConfigWebUtil.getFile(config, config.getRootDirectory(), logFile, FileUtil.TYPE_FILE); Element logging = XMLConfigWebFactory.getChildByName(doc.getDocumentElement(), "logging"); Element[] children = XMLUtil.getChildElementsAsArray(logging); Element logger = null; for (int i = 0; i < children.length; i++) { if (children[i].getTagName().equals("logger") && "mail".equalsIgnoreCase(children[i].getAttribute("name"))) { logger = children[i]; break; } } if (logger == null) { logger = doc.createElement("logger"); logging.appendChild(logger); } logger.setAttribute("name", "mail"); if ("console".equalsIgnoreCase(logFile)) { setClass(logger, null, "appender-", Log4jUtil.appenderClassDefintion("console")); setClass(logger, null, "layout-", Log4jUtil.layoutClassDefintion("pattern")); } else { setClass(logger, null, "appender-", Log4jUtil.appenderClassDefintion("resource")); setClass(logger, null, "layout-", Log4jUtil.layoutClassDefintion("classic")); logger.setAttribute("appender-arguments", "path:" + logFile); } logger.setAttribute("log-level", level); }
[ "public", "void", "setMailLog", "(", "String", "logFile", ",", "String", "level", ")", "throws", "PageException", "{", "checkWriteAccess", "(", ")", ";", "boolean", "hasAccess", "=", "ConfigWebUtil", ".", "hasAccess", "(", "config", ",", "SecurityManager", ".", ...
sets Mail Logger to Config @param logFile @param level @throws PageException
[ "sets", "Mail", "Logger", "to", "Config" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L353-L385
tehuti-io/tehuti
src/main/java/io/tehuti/metrics/Sensor.java
Sensor.checkQuotas
private void checkQuotas(long timeMs, boolean preCheck, double requestedValue) { for (int i = 0; i < this.metrics.size(); i++) { TehutiMetric metric = this.metrics.get(i); MetricConfig config = metric.config(); if (config != null) { Quota quota = config.quota(); if (quota != null) { // Only check the quota on the right time. If quota is set to check quota before recording, // only verify the usage in pre-check round. if (quota.isCheckQuotaBeforeRecording() ^ preCheck) { continue; } // If we check quota before recording, we should count on the value of the current request. // So we could prevent the usage of current request exceeding the quota. double value = preCheck? metric.extraValue(timeMs, requestedValue): metric.value(timeMs); if (!quota.acceptable(value)) { throw new QuotaViolationException( "Metric " + metric.name() + " is in violation of its " + quota.toString(), value); } } } } }
java
private void checkQuotas(long timeMs, boolean preCheck, double requestedValue) { for (int i = 0; i < this.metrics.size(); i++) { TehutiMetric metric = this.metrics.get(i); MetricConfig config = metric.config(); if (config != null) { Quota quota = config.quota(); if (quota != null) { // Only check the quota on the right time. If quota is set to check quota before recording, // only verify the usage in pre-check round. if (quota.isCheckQuotaBeforeRecording() ^ preCheck) { continue; } // If we check quota before recording, we should count on the value of the current request. // So we could prevent the usage of current request exceeding the quota. double value = preCheck? metric.extraValue(timeMs, requestedValue): metric.value(timeMs); if (!quota.acceptable(value)) { throw new QuotaViolationException( "Metric " + metric.name() + " is in violation of its " + quota.toString(), value); } } } } }
[ "private", "void", "checkQuotas", "(", "long", "timeMs", ",", "boolean", "preCheck", ",", "double", "requestedValue", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "metrics", ".", "size", "(", ")", ";", "i", "++", ")", "{"...
Check if we have violated our quota for any metric that has a configured quota @param timeMs The current POSIX time in milliseconds
[ "Check", "if", "we", "have", "violated", "our", "quota", "for", "any", "metric", "that", "has", "a", "configured", "quota" ]
train
https://github.com/tehuti-io/tehuti/blob/c28a2f838eac775660efb270aafd2a464d712948/src/main/java/io/tehuti/metrics/Sensor.java#L117-L139
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/TransparentDataEncryptionActivitiesInner.java
TransparentDataEncryptionActivitiesInner.listByConfiguration
public List<TransparentDataEncryptionActivityInner> listByConfiguration(String resourceGroupName, String serverName, String databaseName) { return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
java
public List<TransparentDataEncryptionActivityInner> listByConfiguration(String resourceGroupName, String serverName, String databaseName) { return listByConfigurationWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
[ "public", "List", "<", "TransparentDataEncryptionActivityInner", ">", "listByConfiguration", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "listByConfigurationWithServiceResponseAsync", "(", "resourceGroupN...
Returns a database's transparent data encryption operation result. @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 for which the transparent data encryption applies. @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;TransparentDataEncryptionActivityInner&gt; object if successful.
[ "Returns", "a", "database", "s", "transparent", "data", "encryption", "operation", "result", "." ]
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/TransparentDataEncryptionActivitiesInner.java#L72-L74
jayantk/jklol
src/com/jayantkrish/jklol/models/loglinear/DiscreteLogLinearFactor.java
DiscreteLogLinearFactor.createIndicatorFactor
public static DiscreteLogLinearFactor createIndicatorFactor(VariableNumMap vars, TableFactorBuilder initialWeights) { Preconditions.checkArgument(vars.size() == vars.getDiscreteVariables().size()); int featureVarNum = Ints.max(vars.getVariableNumsArray()) + 1; DiscreteFactor featureValues = createIndicatorFeatureTensor(vars, featureVarNum, initialWeights); VariableNumMap featureVarMap = featureValues.getVars().intersection(featureVarNum); TableFactor initialWeightFactor = (initialWeights != null) ? initialWeights.build() : null; return new DiscreteLogLinearFactor(vars, featureVarMap, featureValues, initialWeightFactor); }
java
public static DiscreteLogLinearFactor createIndicatorFactor(VariableNumMap vars, TableFactorBuilder initialWeights) { Preconditions.checkArgument(vars.size() == vars.getDiscreteVariables().size()); int featureVarNum = Ints.max(vars.getVariableNumsArray()) + 1; DiscreteFactor featureValues = createIndicatorFeatureTensor(vars, featureVarNum, initialWeights); VariableNumMap featureVarMap = featureValues.getVars().intersection(featureVarNum); TableFactor initialWeightFactor = (initialWeights != null) ? initialWeights.build() : null; return new DiscreteLogLinearFactor(vars, featureVarMap, featureValues, initialWeightFactor); }
[ "public", "static", "DiscreteLogLinearFactor", "createIndicatorFactor", "(", "VariableNumMap", "vars", ",", "TableFactorBuilder", "initialWeights", ")", "{", "Preconditions", ".", "checkArgument", "(", "vars", ".", "size", "(", ")", "==", "vars", ".", "getDiscreteVari...
Creates and returns a {@code DiscreteLogLinearFactor} over {@code vars} which is parameterized by indicator functions. The returned factor has one indicator feature for every possible assignment to {@code vars}. {@code initialWeights} determines the sparsity pattern of the factors created by the returned parametric factor; pass {@code null} to create a dense factor. <p> {@code vars} must contain only {@link DiscreteVariable}s. @param vars @param initialWeights @return
[ "Creates", "and", "returns", "a", "{", "@code", "DiscreteLogLinearFactor", "}", "over", "{", "@code", "vars", "}", "which", "is", "parameterized", "by", "indicator", "functions", ".", "The", "returned", "factor", "has", "one", "indicator", "feature", "for", "e...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/loglinear/DiscreteLogLinearFactor.java#L250-L261
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.withBuilder
public Object withBuilder(Map attributes, FactoryBuilderSupport builder, String name, Closure closure) { if (name == null) { return null; } Object result = getProxyBuilder().withBuilder(builder, closure); return getProxyBuilder().invokeMethod(name, new Object[]{attributes, result}); }
java
public Object withBuilder(Map attributes, FactoryBuilderSupport builder, String name, Closure closure) { if (name == null) { return null; } Object result = getProxyBuilder().withBuilder(builder, closure); return getProxyBuilder().invokeMethod(name, new Object[]{attributes, result}); }
[ "public", "Object", "withBuilder", "(", "Map", "attributes", ",", "FactoryBuilderSupport", "builder", ",", "String", "name", ",", "Closure", "closure", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "Object", "result", "="...
Switches the builder's proxyBuilder during the execution of a closure.<br> This is useful to temporary change the building context to another builder without the need for a contrived setup. It will also take care of restoring the previous proxyBuilder when the execution finishes, even if an exception was thrown from inside the closure. Additionally it will use the closure's result as the value for the node identified by 'name' and assign any attributes that might have been set. @param attributes additional properties for the node on the parent builder. @param builder the temporary builder to switch to as proxyBuilder. @param name the node to build on the 'parent' builder. @param closure the closure to be executed under the temporary builder. @return a node that responds to value of name with the closure's result as its value. @throws RuntimeException - any exception the closure might have thrown during execution.
[ "Switches", "the", "builder", "s", "proxyBuilder", "during", "the", "execution", "of", "a", "closure", ".", "<br", ">", "This", "is", "useful", "to", "temporary", "change", "the", "building", "context", "to", "another", "builder", "without", "the", "need", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L1279-L1285
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java
OffsetDateTime.withOffsetSameInstant
public OffsetDateTime withOffsetSameInstant(ZoneOffset offset) { if (offset.equals(this.offset)) { return this; } int difference = offset.getTotalSeconds() - this.offset.getTotalSeconds(); LocalDateTime adjusted = dateTime.plusSeconds(difference); return new OffsetDateTime(adjusted, offset); }
java
public OffsetDateTime withOffsetSameInstant(ZoneOffset offset) { if (offset.equals(this.offset)) { return this; } int difference = offset.getTotalSeconds() - this.offset.getTotalSeconds(); LocalDateTime adjusted = dateTime.plusSeconds(difference); return new OffsetDateTime(adjusted, offset); }
[ "public", "OffsetDateTime", "withOffsetSameInstant", "(", "ZoneOffset", "offset", ")", "{", "if", "(", "offset", ".", "equals", "(", "this", ".", "offset", ")", ")", "{", "return", "this", ";", "}", "int", "difference", "=", "offset", ".", "getTotalSeconds",...
Returns a copy of this {@code OffsetDateTime} with the specified offset ensuring that the result is at the same instant. <p> This method returns an object with the specified {@code ZoneOffset} and a {@code LocalDateTime} adjusted by the difference between the two offsets. This will result in the old and new objects representing the same instant. This is useful for finding the local time in a different offset. For example, if this time represents {@code 2007-12-03T10:30+02:00} and the offset specified is {@code +03:00}, then this method will return {@code 2007-12-03T11:30+03:00}. <p> To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. <p> This instance is immutable and unaffected by this method call. @param offset the zone offset to change to, not null @return an {@code OffsetDateTime} based on this date-time with the requested offset, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "OffsetDateTime", "}", "with", "the", "specified", "offset", "ensuring", "that", "the", "result", "is", "at", "the", "same", "instant", ".", "<p", ">", "This", "method", "returns", "an", "object", "with",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java#L690-L697
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java
LdapHelper.inAttributes
public static boolean inAttributes(String attrName, Attributes attrs) { for (NamingEnumeration<String> neu = attrs.getIDs(); neu.hasMoreElements();) { String attrId = neu.nextElement(); if (attrId.equalsIgnoreCase(attrName)) { return true; } } return false; }
java
public static boolean inAttributes(String attrName, Attributes attrs) { for (NamingEnumeration<String> neu = attrs.getIDs(); neu.hasMoreElements();) { String attrId = neu.nextElement(); if (attrId.equalsIgnoreCase(attrName)) { return true; } } return false; }
[ "public", "static", "boolean", "inAttributes", "(", "String", "attrName", ",", "Attributes", "attrs", ")", "{", "for", "(", "NamingEnumeration", "<", "String", ">", "neu", "=", "attrs", ".", "getIDs", "(", ")", ";", "neu", ".", "hasMoreElements", "(", ")",...
Whether the specified attribute name is contained in the attributes. @param attrName The name of the attribute @param attrs The Attributes object @return true if the Attributes contain the attribute name (case-insensitive); false otherwise
[ "Whether", "the", "specified", "attribute", "name", "is", "contained", "in", "the", "attributes", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java#L880-L888
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/HashIndex.java
HashIndex.indexOf
public int indexOf(E o, boolean add) { Integer index = indexes.get(o); if (index == null) { if (add && ! locked) { try { semaphore.acquire(); index = indexes.get(o); if (index == null) { index = objects.size(); objects.add(o); indexes.put(o, index); } semaphore.release(); } catch (InterruptedException e) { throw new RuntimeException(e); } } else { return -1; } } return index; }
java
public int indexOf(E o, boolean add) { Integer index = indexes.get(o); if (index == null) { if (add && ! locked) { try { semaphore.acquire(); index = indexes.get(o); if (index == null) { index = objects.size(); objects.add(o); indexes.put(o, index); } semaphore.release(); } catch (InterruptedException e) { throw new RuntimeException(e); } } else { return -1; } } return index; }
[ "public", "int", "indexOf", "(", "E", "o", ",", "boolean", "add", ")", "{", "Integer", "index", "=", "indexes", ".", "get", "(", "o", ")", ";", "if", "(", "index", "==", "null", ")", "{", "if", "(", "add", "&&", "!", "locked", ")", "{", "try", ...
Takes an Object and returns the integer index of the Object, perhaps adding it to the index first. Returns -1 if the Object is not in the Index. <p> <i>Notes:</i> The method indexOf(x, true) is the direct replacement for the number(x) method in the old Numberer class. This method now uses a Semaphore object to make the index safe for concurrent multithreaded usage. (CDM: Is this better than using a synchronized block?) @param o the Object whose index is desired. @param add Whether it is okay to add new items to the index @return The index of the Object argument. Returns -1 if the object is not in the index.
[ "Takes", "an", "Object", "and", "returns", "the", "integer", "index", "of", "the", "Object", "perhaps", "adding", "it", "to", "the", "index", "first", ".", "Returns", "-", "1", "if", "the", "Object", "is", "not", "in", "the", "Index", ".", "<p", ">", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/HashIndex.java#L161-L182
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java
ZipBuilder.addFile
public ZipBuilder addFile(File sourceFile, String targetFile) throws IOException { FileInputStream fis = new FileInputStream(sourceFile); ZipEntry jarEntry = new ZipEntry(targetFile); jarOutputStream.putNextEntry(jarEntry); StreamUtils.copyStream(fis, jarOutputStream, false); fis.close(); return this; }
java
public ZipBuilder addFile(File sourceFile, String targetFile) throws IOException { FileInputStream fis = new FileInputStream(sourceFile); ZipEntry jarEntry = new ZipEntry(targetFile); jarOutputStream.putNextEntry(jarEntry); StreamUtils.copyStream(fis, jarOutputStream, false); fis.close(); return this; }
[ "public", "ZipBuilder", "addFile", "(", "File", "sourceFile", ",", "String", "targetFile", ")", "throws", "IOException", "{", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "sourceFile", ")", ";", "ZipEntry", "jarEntry", "=", "new", "ZipEntry", "(...
Adds a file to the archive. The archive must not be closed. <p> Example:<br> <pre> sourceFile = C:\opt\work\deps\foo.jar targetDir = WEB-INF/lib/foo.jar </pre> @param sourceFile File to be added @param targetFile Relative path for the file within the archive. Regardless of the OS, this path must use slashes ('/') as separators. @return this for fluent syntax @throws IOException on I/O error
[ "Adds", "a", "file", "to", "the", "archive", ".", "The", "archive", "must", "not", "be", "closed", ".", "<p", ">", "Example", ":", "<br", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L103-L110
meertensinstituut/mtas
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java
MtasSolrComponentFacet.getFieldType
private String getFieldType(IndexSchema schema, String field) throws IOException { SchemaField sf = schema.getField(field); FieldType ft = sf.getType(); if (ft != null) { if (ft.isPointField() && !sf.hasDocValues()) { return ComponentFacet.TYPE_POINTFIELD_WITHOUT_DOCVALUES; } NumberType nt = ft.getNumberType(); if (nt != null) { return nt.name(); } else { return ComponentFacet.TYPE_STRING; } } else { // best guess return ComponentFacet.TYPE_STRING; } }
java
private String getFieldType(IndexSchema schema, String field) throws IOException { SchemaField sf = schema.getField(field); FieldType ft = sf.getType(); if (ft != null) { if (ft.isPointField() && !sf.hasDocValues()) { return ComponentFacet.TYPE_POINTFIELD_WITHOUT_DOCVALUES; } NumberType nt = ft.getNumberType(); if (nt != null) { return nt.name(); } else { return ComponentFacet.TYPE_STRING; } } else { // best guess return ComponentFacet.TYPE_STRING; } }
[ "private", "String", "getFieldType", "(", "IndexSchema", "schema", ",", "String", "field", ")", "throws", "IOException", "{", "SchemaField", "sf", "=", "schema", ".", "getField", "(", "field", ")", ";", "FieldType", "ft", "=", "sf", ".", "getType", "(", ")...
Gets the field type. @param schema the schema @param field the field @return the field type @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "field", "type", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentFacet.java#L658-L676
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.getAttribute
private Attribute getAttribute(MappedField configuredField, Class<?> configuredClass){ // If configuredClass exists in XML configuration file for (Class<?> clazz : getAllsuperClasses(configuredClass)) if (isMapped(clazz)) // loads all configured attributes for (Attribute attribute : loadAttributes().get(clazz.getName())) { // verifies that exists the attribute written in XML in // the configured Class if (isNull(fieldName(clazz, attribute.getName()))) Error.attributeAbsent(clazz, attribute); // if the field given in input isn't equal to xmlField // continue with the cycle if (attribute.getName().equals(configuredField.getValue().getName())) return attribute; } return null; }
java
private Attribute getAttribute(MappedField configuredField, Class<?> configuredClass){ // If configuredClass exists in XML configuration file for (Class<?> clazz : getAllsuperClasses(configuredClass)) if (isMapped(clazz)) // loads all configured attributes for (Attribute attribute : loadAttributes().get(clazz.getName())) { // verifies that exists the attribute written in XML in // the configured Class if (isNull(fieldName(clazz, attribute.getName()))) Error.attributeAbsent(clazz, attribute); // if the field given in input isn't equal to xmlField // continue with the cycle if (attribute.getName().equals(configuredField.getValue().getName())) return attribute; } return null; }
[ "private", "Attribute", "getAttribute", "(", "MappedField", "configuredField", ",", "Class", "<", "?", ">", "configuredClass", ")", "{", "// If configuredClass exists in XML configuration file\r", "for", "(", "Class", "<", "?", ">", "clazz", ":", "getAllsuperClasses", ...
Returns the Attribute relative to the configured field, null otherwise. @param configuredField field to find @param configuredClass class of field @return
[ "Returns", "the", "Attribute", "relative", "to", "the", "configured", "field", "null", "otherwise", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L532-L550
btaz/data-util
src/main/java/com/btaz/util/xml/model/Xml.java
Xml.bsfHashCode
private int bsfHashCode(Node node, int result) { result += 31 * node.hashCode(); if(node instanceof Content) { return result; } Element elem = (Element) node; List<Node> childElements = elem.getChildElements(); for (Node childElement : childElements) { result += 31 * childElement.hashCode(); } for (Node child : childElements) { if (child instanceof Content) { result += 31 * child.hashCode(); } else { result = bsfHashCode(child, result); } } return result; }
java
private int bsfHashCode(Node node, int result) { result += 31 * node.hashCode(); if(node instanceof Content) { return result; } Element elem = (Element) node; List<Node> childElements = elem.getChildElements(); for (Node childElement : childElements) { result += 31 * childElement.hashCode(); } for (Node child : childElements) { if (child instanceof Content) { result += 31 * child.hashCode(); } else { result = bsfHashCode(child, result); } } return result; }
[ "private", "int", "bsfHashCode", "(", "Node", "node", ",", "int", "result", ")", "{", "result", "+=", "31", "*", "node", ".", "hashCode", "(", ")", ";", "if", "(", "node", "instanceof", "Content", ")", "{", "return", "result", ";", "}", "Element", "e...
Recursive hash code creator @param node root node @param result cumulative hash code value @return result resulting cumulative hash code value
[ "Recursive", "hash", "code", "creator" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/model/Xml.java#L228-L251
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.getProperty
public static PropertyDescriptor getProperty(Class<?> clazz, String propertyName) { if (clazz == null || propertyName == null) { return null; } try { return BeanUtils.getPropertyDescriptor(clazz, propertyName); } catch (Exception e) { // if there are any errors in instantiating just return null for the moment return null; } }
java
public static PropertyDescriptor getProperty(Class<?> clazz, String propertyName) { if (clazz == null || propertyName == null) { return null; } try { return BeanUtils.getPropertyDescriptor(clazz, propertyName); } catch (Exception e) { // if there are any errors in instantiating just return null for the moment return null; } }
[ "public", "static", "PropertyDescriptor", "getProperty", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ")", "{", "if", "(", "clazz", "==", "null", "||", "propertyName", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{"...
Retrieves a property of the given class of the specified name and type @param clazz The class to retrieve the property from @param propertyName The name of the property @return A PropertyDescriptor instance or null if none exists
[ "Retrieves", "a", "property", "of", "the", "given", "class", "of", "the", "specified", "name", "and", "type", "@param", "clazz", "The", "class", "to", "retrieve", "the", "property", "from", "@param", "propertyName", "The", "name", "of", "the", "property" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L421-L433
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Invoker.java
Invoker.callSetter
public static void callSetter(Object o, String prop, Object value) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { prop = "set" + StringUtil.ucFirst(prop); Class c = o.getClass(); // Class[] cArg=new Class[]{value.getClass()}; Object[] oArg = new Object[] { value }; MethodParameterPair mp = getMethodParameterPairIgnoreCase(c, prop, oArg); // Method m=getMethodIgnoreCase(c,prop,cArg); if (!mp.getMethod().getReturnType().getName().equals("void")) throw new NoSuchMethodException( "invalid return Type, method [" + mp.getMethod().getName() + "] must have return type void, now [" + mp.getMethod().getReturnType().getName() + "]"); mp.getMethod().invoke(o, mp.getParameters()); }
java
public static void callSetter(Object o, String prop, Object value) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { prop = "set" + StringUtil.ucFirst(prop); Class c = o.getClass(); // Class[] cArg=new Class[]{value.getClass()}; Object[] oArg = new Object[] { value }; MethodParameterPair mp = getMethodParameterPairIgnoreCase(c, prop, oArg); // Method m=getMethodIgnoreCase(c,prop,cArg); if (!mp.getMethod().getReturnType().getName().equals("void")) throw new NoSuchMethodException( "invalid return Type, method [" + mp.getMethod().getName() + "] must have return type void, now [" + mp.getMethod().getReturnType().getName() + "]"); mp.getMethod().invoke(o, mp.getParameters()); }
[ "public", "static", "void", "callSetter", "(", "Object", "o", ",", "String", "prop", ",", "Object", "value", ")", "throws", "SecurityException", ",", "NoSuchMethodException", ",", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException...
to invoke a setter Method of a Object @param o Object to invoke method from @param prop Name of the Method without get @param value Value to set to the Method @throws SecurityException @throws NoSuchMethodException @throws IllegalArgumentException @throws IllegalAccessException @throws InvocationTargetException
[ "to", "invoke", "a", "setter", "Method", "of", "a", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Invoker.java#L338-L349
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationShardingDataSourceFactory.java
YamlOrchestrationShardingDataSourceFactory.createDataSource
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlFile); return createDataSource(dataSourceMap, config.getShardingRule(), config.getProps(), config.getOrchestration()); }
java
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlOrchestrationShardingRuleConfiguration config = unmarshal(yamlFile); return createDataSource(dataSourceMap, config.getShardingRule(), config.getProps(), config.getOrchestration()); }
[ "public", "static", "DataSource", "createDataSource", "(", "final", "Map", "<", "String", ",", "DataSource", ">", "dataSourceMap", ",", "final", "File", "yamlFile", ")", "throws", "SQLException", ",", "IOException", "{", "YamlOrchestrationShardingRuleConfiguration", "...
Create sharding data source. @param dataSourceMap data source map @param yamlFile YAML file for rule configuration of databases and tables sharding without data sources @return sharding data source @throws SQLException SQL exception @throws IOException IO exception
[ "Create", "sharding", "data", "source", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationShardingDataSourceFactory.java#L74-L77
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/RevisionDecoder.java
RevisionDecoder.decodeDelete
private DiffPart decodeDelete(final int blockSize_S, final int blockSize_E) throws DecodingException { if (blockSize_S < 1 || blockSize_E < 1) { throw new DecodingException("Invalid value for blockSize_S: " + blockSize_S + " or blockSize_E: " + blockSize_E); } int s = r.read(blockSize_S); int e = r.read(blockSize_E); DiffPart part = new DiffPart(DiffAction.DELETE); part.setStart(s); part.setLength(e); r.skip(); return part; }
java
private DiffPart decodeDelete(final int blockSize_S, final int blockSize_E) throws DecodingException { if (blockSize_S < 1 || blockSize_E < 1) { throw new DecodingException("Invalid value for blockSize_S: " + blockSize_S + " or blockSize_E: " + blockSize_E); } int s = r.read(blockSize_S); int e = r.read(blockSize_E); DiffPart part = new DiffPart(DiffAction.DELETE); part.setStart(s); part.setLength(e); r.skip(); return part; }
[ "private", "DiffPart", "decodeDelete", "(", "final", "int", "blockSize_S", ",", "final", "int", "blockSize_E", ")", "throws", "DecodingException", "{", "if", "(", "blockSize_S", "<", "1", "||", "blockSize_E", "<", "1", ")", "{", "throw", "new", "DecodingExcept...
Decodes a Delete operation. @param blockSize_S length of a S block @param blockSize_E length of a E block @return DiffPart, Delete operation @throws DecodingException if the decoding failed
[ "Decodes", "a", "Delete", "operation", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/RevisionDecoder.java#L305-L324
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
EscapedFunctions2.sqldayname
public static void sqldayname(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { if (parsedArgs.size() != 1) { throw new PSQLException(GT.tr("{0} function takes one and only one argument.", "dayname"), PSQLState.SYNTAX_ERROR); } appendCall(buf, "to_char(", ",", ",'Day')", parsedArgs); }
java
public static void sqldayname(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { if (parsedArgs.size() != 1) { throw new PSQLException(GT.tr("{0} function takes one and only one argument.", "dayname"), PSQLState.SYNTAX_ERROR); } appendCall(buf, "to_char(", ",", ",'Day')", parsedArgs); }
[ "public", "static", "void", "sqldayname", "(", "StringBuilder", "buf", ",", "List", "<", "?", "extends", "CharSequence", ">", "parsedArgs", ")", "throws", "SQLException", "{", "if", "(", "parsedArgs", ".", "size", "(", ")", "!=", "1", ")", "{", "throw", ...
dayname translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens
[ "dayname", "translation" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L353-L359
grails/grails-core
grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java
DefaultGrailsApplication.getArtefactInfo
protected DefaultArtefactInfo getArtefactInfo(String artefactType, boolean create) { DefaultArtefactInfo cache = (DefaultArtefactInfo) artefactInfo.get(artefactType); if (cache == null && create) { cache = new DefaultArtefactInfo(); artefactInfo.put(artefactType, cache); cache.updateComplete(); } return cache; }
java
protected DefaultArtefactInfo getArtefactInfo(String artefactType, boolean create) { DefaultArtefactInfo cache = (DefaultArtefactInfo) artefactInfo.get(artefactType); if (cache == null && create) { cache = new DefaultArtefactInfo(); artefactInfo.put(artefactType, cache); cache.updateComplete(); } return cache; }
[ "protected", "DefaultArtefactInfo", "getArtefactInfo", "(", "String", "artefactType", ",", "boolean", "create", ")", "{", "DefaultArtefactInfo", "cache", "=", "(", "DefaultArtefactInfo", ")", "artefactInfo", ".", "get", "(", "artefactType", ")", ";", "if", "(", "c...
Get or create the cache of classes for the specified artefact type. @param artefactType The name of an artefact type @param create Set to true if you want non-existent caches to be created @return The cache of classes for the type, or null if no cache exists and create is false
[ "Get", "or", "create", "the", "cache", "of", "classes", "for", "the", "specified", "artefact", "type", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java#L603-L611
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java
DynamoDBMapper.batchWrite
public void batchWrite(List<? extends Object> objectsToWrite, List<? extends Object> objectsToDelete) { batchWrite(objectsToWrite, objectsToDelete, this.config); }
java
public void batchWrite(List<? extends Object> objectsToWrite, List<? extends Object> objectsToDelete) { batchWrite(objectsToWrite, objectsToDelete, this.config); }
[ "public", "void", "batchWrite", "(", "List", "<", "?", "extends", "Object", ">", "objectsToWrite", ",", "List", "<", "?", "extends", "Object", ">", "objectsToDelete", ")", "{", "batchWrite", "(", "objectsToWrite", ",", "objectsToDelete", ",", "this", ".", "c...
Saves and deletes the objects given using one or more calls to the {@link AmazonDynamoDB#batchWriteItem(BatchWriteItemRequest)} API. @see DynamoDBMapper#batchWrite(List, List, DynamoDBMapperConfig)
[ "Saves", "and", "deletes", "the", "objects", "given", "using", "one", "or", "more", "calls", "to", "the", "{", "@link", "AmazonDynamoDB#batchWriteItem", "(", "BatchWriteItemRequest", ")", "}", "API", "." ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L695-L697
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java
InputRecordCountHelper.readRecordCount
@Deprecated public static long readRecordCount (FileSystem fs, Path dir) throws IOException { State state = loadState(fs, dir); if (!state.contains(CompactionSlaEventHelper.RECORD_COUNT_TOTAL)) { if (fs.exists(new Path (dir, RECORD_COUNT_FILE))){ try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.open (new Path (dir, RECORD_COUNT_FILE)), Charsets.UTF_8))) { long count = Long.parseLong(br.readLine()); return count; } } else { return 0; } } else { return Long.parseLong(state.getProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL)); } }
java
@Deprecated public static long readRecordCount (FileSystem fs, Path dir) throws IOException { State state = loadState(fs, dir); if (!state.contains(CompactionSlaEventHelper.RECORD_COUNT_TOTAL)) { if (fs.exists(new Path (dir, RECORD_COUNT_FILE))){ try (BufferedReader br = new BufferedReader(new InputStreamReader(fs.open (new Path (dir, RECORD_COUNT_FILE)), Charsets.UTF_8))) { long count = Long.parseLong(br.readLine()); return count; } } else { return 0; } } else { return Long.parseLong(state.getProp(CompactionSlaEventHelper.RECORD_COUNT_TOTAL)); } }
[ "@", "Deprecated", "public", "static", "long", "readRecordCount", "(", "FileSystem", "fs", ",", "Path", "dir", ")", "throws", "IOException", "{", "State", "state", "=", "loadState", "(", "fs", ",", "dir", ")", ";", "if", "(", "!", "state", ".", "contains...
Read record count from a specific directory. File name is {@link InputRecordCountHelper#STATE_FILE} @param fs file system in use @param dir directory where a state file is located @return record count
[ "Read", "record", "count", "from", "a", "specific", "directory", ".", "File", "name", "is", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/verify/InputRecordCountHelper.java#L150-L166
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java
CProductPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CProduct cProduct : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cProduct); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CProduct cProduct : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cProduct); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CProduct", "cProduct", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", ...
Removes all the c products where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "c", "products", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CProductPersistenceImpl.java#L1390-L1396
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.addDocument
public ApiSuccessResponse addDocument(String mediatype, String id, AddDocumentData addDocumentData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = addDocumentWithHttpInfo(mediatype, id, addDocumentData); return resp.getData(); }
java
public ApiSuccessResponse addDocument(String mediatype, String id, AddDocumentData addDocumentData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = addDocumentWithHttpInfo(mediatype, id, addDocumentData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "addDocument", "(", "String", "mediatype", ",", "String", "id", ",", "AddDocumentData", "addDocumentData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "addDocumentWithHttpInfo", "(", "...
Add an attachment to the open-media interaction Add an attachment to the interaction specified in the id path parameter @param mediatype media-type of interaction to add attachment (required) @param id id of interaction (required) @param addDocumentData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Add", "an", "attachment", "to", "the", "open", "-", "media", "interaction", "Add", "an", "attachment", "to", "the", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L594-L597
akberc/ceylon-maven-plugin
src/main/java/com/dgwave/car/maven/CeylonSdkDownload.java
CeylonSdkDownload.downloadSdk
private File downloadSdk(final String path) throws MojoExecutionException { File dotCeylon = new File(path); // or some other directory if (!dotCeylon.exists()) { dotCeylon.mkdirs(); } String[] segments = this.fromURL.split("/"); String file = segments[segments.length - 1]; String repoUrl = this.fromURL.substring(0, this.fromURL.length() - file.length()); String version = FileUtils.basename(file); File home = new File(dotCeylon, version); if (home.exists()) { getLog().info("Skipping download: Folder " + version + " corresponding to SDK already exists " + " in " + dotCeylon.getAbsolutePath()); return new File(home, "repo"); } File outputFile = new File(dotCeylon, file); if (outputFile.exists()) { throw new MojoExecutionException("Downloaded file " + outputFile.getAbsolutePath() + " exists. Please remove it and try again"); } try { doGet(outputFile, repoUrl); } catch (Exception e) { throw new MojoExecutionException("Error downloading SDK" + e.getLocalizedMessage(), e); } CeylonUtil.extract(outputFile, dotCeylon); outputFile.delete(); return new File(home, "repo"); }
java
private File downloadSdk(final String path) throws MojoExecutionException { File dotCeylon = new File(path); // or some other directory if (!dotCeylon.exists()) { dotCeylon.mkdirs(); } String[] segments = this.fromURL.split("/"); String file = segments[segments.length - 1]; String repoUrl = this.fromURL.substring(0, this.fromURL.length() - file.length()); String version = FileUtils.basename(file); File home = new File(dotCeylon, version); if (home.exists()) { getLog().info("Skipping download: Folder " + version + " corresponding to SDK already exists " + " in " + dotCeylon.getAbsolutePath()); return new File(home, "repo"); } File outputFile = new File(dotCeylon, file); if (outputFile.exists()) { throw new MojoExecutionException("Downloaded file " + outputFile.getAbsolutePath() + " exists. Please remove it and try again"); } try { doGet(outputFile, repoUrl); } catch (Exception e) { throw new MojoExecutionException("Error downloading SDK" + e.getLocalizedMessage(), e); } CeylonUtil.extract(outputFile, dotCeylon); outputFile.delete(); return new File(home, "repo"); }
[ "private", "File", "downloadSdk", "(", "final", "String", "path", ")", "throws", "MojoExecutionException", "{", "File", "dotCeylon", "=", "new", "File", "(", "path", ")", ";", "// or some other directory\r", "if", "(", "!", "dotCeylon", ".", "exists", "(", ")"...
Download the Ceylon SDK. @param path Where to download @return File The location of the SDK @throws MojoExecutionException In case of download error
[ "Download", "the", "Ceylon", "SDK", "." ]
train
https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/maven/CeylonSdkDownload.java#L100-L138
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MsgSaver.java
MsgSaver.urlCheckAndSave
public void urlCheckAndSave(BasicCheckInfo basicCheckInfo, ParamType paramType, ReqUrl reqUrl, Class<?> type) { if (!this.validationConfig.isFreshUrlSave() || !basicCheckInfo.isUrlMapping()) { return; } List<ValidationData> datas = this.validationDataRepository.findByParamTypeAndMethodAndUrl(paramType, reqUrl.getMethod(), reqUrl.getUrl()); if (datas.isEmpty()) { this.saveParameter(basicCheckInfo.getDetailParam(), paramType, reqUrl, null, type, 0, this.validationConfig.getMaxDeepLevel()); this.validationDataRepository.flush(); this.validationStore.refresh(); } }
java
public void urlCheckAndSave(BasicCheckInfo basicCheckInfo, ParamType paramType, ReqUrl reqUrl, Class<?> type) { if (!this.validationConfig.isFreshUrlSave() || !basicCheckInfo.isUrlMapping()) { return; } List<ValidationData> datas = this.validationDataRepository.findByParamTypeAndMethodAndUrl(paramType, reqUrl.getMethod(), reqUrl.getUrl()); if (datas.isEmpty()) { this.saveParameter(basicCheckInfo.getDetailParam(), paramType, reqUrl, null, type, 0, this.validationConfig.getMaxDeepLevel()); this.validationDataRepository.flush(); this.validationStore.refresh(); } }
[ "public", "void", "urlCheckAndSave", "(", "BasicCheckInfo", "basicCheckInfo", ",", "ParamType", "paramType", ",", "ReqUrl", "reqUrl", ",", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "!", "this", ".", "validationConfig", ".", "isFreshUrlSave", "(", ...
Url check and save. @param basicCheckInfo the basic check info @param paramType the param type @param reqUrl the req url @param type the type
[ "Url", "check", "and", "save", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MsgSaver.java#L74-L85
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/tag/CFMLTransformer.java
CFMLTransformer.transform
public Page transform(Factory factory, ConfigImpl config, SourceCode sc, TagLib[] tlibs, FunctionLib[] flibs, long sourceLastModified, Boolean dotNotationUpperCase, boolean returnValue, boolean ignoreScope) throws TemplateException { boolean dnuc; if (dotNotationUpperCase == null) { if (sc instanceof PageSourceCode) dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && ((MappingImpl) ((PageSourceCode) sc).getPageSource().getMapping()).getDotNotationUpperCase(); else dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && config.getDotNotationUpperCase(); } else dnuc = dotNotationUpperCase; TagLib[][] _tlibs = new TagLib[][] { null, new TagLib[0] }; _tlibs[TAG_LIB_GLOBAL] = tlibs; // reset page tlds if (_tlibs[TAG_LIB_PAGE].length > 0) { _tlibs[TAG_LIB_PAGE] = new TagLib[0]; } Page page = new Page(factory, config, sc, null, ConfigWebUtil.getEngine(config).getInfo().getFullVersionInfo(), sourceLastModified, sc.getWriteLog(), sc.getDialect() == CFMLEngine.DIALECT_LUCEE || config.getSuppressWSBeforeArg(), config.getDefaultFunctionOutput(), returnValue, ignoreScope); TransfomerSettings settings = new TransfomerSettings(dnuc, sc.getDialect() == CFMLEngine.DIALECT_CFML && factory.getConfig().getHandleUnQuotedAttrValueAsString(), ignoreScope); Data data = new Data(factory, page, sc, new EvaluatorPool(), settings, _tlibs, flibs, config.getCoreTagLib(sc.getDialect()).getScriptTags(), false); transform(data, page); return page; }
java
public Page transform(Factory factory, ConfigImpl config, SourceCode sc, TagLib[] tlibs, FunctionLib[] flibs, long sourceLastModified, Boolean dotNotationUpperCase, boolean returnValue, boolean ignoreScope) throws TemplateException { boolean dnuc; if (dotNotationUpperCase == null) { if (sc instanceof PageSourceCode) dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && ((MappingImpl) ((PageSourceCode) sc).getPageSource().getMapping()).getDotNotationUpperCase(); else dnuc = sc.getDialect() == CFMLEngine.DIALECT_CFML && config.getDotNotationUpperCase(); } else dnuc = dotNotationUpperCase; TagLib[][] _tlibs = new TagLib[][] { null, new TagLib[0] }; _tlibs[TAG_LIB_GLOBAL] = tlibs; // reset page tlds if (_tlibs[TAG_LIB_PAGE].length > 0) { _tlibs[TAG_LIB_PAGE] = new TagLib[0]; } Page page = new Page(factory, config, sc, null, ConfigWebUtil.getEngine(config).getInfo().getFullVersionInfo(), sourceLastModified, sc.getWriteLog(), sc.getDialect() == CFMLEngine.DIALECT_LUCEE || config.getSuppressWSBeforeArg(), config.getDefaultFunctionOutput(), returnValue, ignoreScope); TransfomerSettings settings = new TransfomerSettings(dnuc, sc.getDialect() == CFMLEngine.DIALECT_CFML && factory.getConfig().getHandleUnQuotedAttrValueAsString(), ignoreScope); Data data = new Data(factory, page, sc, new EvaluatorPool(), settings, _tlibs, flibs, config.getCoreTagLib(sc.getDialect()).getScriptTags(), false); transform(data, page); return page; }
[ "public", "Page", "transform", "(", "Factory", "factory", ",", "ConfigImpl", "config", ",", "SourceCode", "sc", ",", "TagLib", "[", "]", "tlibs", ",", "FunctionLib", "[", "]", "flibs", ",", "long", "sourceLastModified", ",", "Boolean", "dotNotationUpperCase", ...
Startmethode zum transfomieren einer CFMLString. <br /> EBNF:<br /> <code>{body}</code> @param config @param sc CFMLString @param tlibs Tag Library Deskriptoren, nach denen innerhalb der CFML Datei geprueft werden soll. @param flibs Function Library Deskriptoren, nach denen innerhalb der Expressions der CFML Datei geprueft werden soll. @param sourceLastModified @param dotNotationUpperCase @param returnValue if true the method returns the value of the last expression executed inside when you call the method "call" @return uebersetztes CFXD Dokument Element. @throws TemplateException
[ "Startmethode", "zum", "transfomieren", "einer", "CFMLString", ".", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "{", "body", "}", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/tag/CFMLTransformer.java#L283-L309
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listDiagnostics
public List<HostingEnvironmentDiagnosticsInner> listDiagnostics(String resourceGroupName, String name) { return listDiagnosticsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public List<HostingEnvironmentDiagnosticsInner> listDiagnostics(String resourceGroupName, String name) { return listDiagnosticsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "List", "<", "HostingEnvironmentDiagnosticsInner", ">", "listDiagnostics", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listDiagnosticsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", ...
Get diagnostic information for an App Service Environment. Get diagnostic information for an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @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;HostingEnvironmentDiagnosticsInner&gt; object if successful.
[ "Get", "diagnostic", "information", "for", "an", "App", "Service", "Environment", ".", "Get", "diagnostic", "information", "for", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1516-L1518
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java
CurrentSpanUtils.withSpan
static Runnable withSpan(Span span, boolean endSpan, Runnable runnable) { return new RunnableInSpan(span, runnable, endSpan); }
java
static Runnable withSpan(Span span, boolean endSpan, Runnable runnable) { return new RunnableInSpan(span, runnable, endSpan); }
[ "static", "Runnable", "withSpan", "(", "Span", "span", ",", "boolean", "endSpan", ",", "Runnable", "runnable", ")", "{", "return", "new", "RunnableInSpan", "(", "span", ",", "runnable", ",", "endSpan", ")", ";", "}" ]
Wraps a {@link Runnable} so that it executes with the {@code span} as the current {@code Span}. @param span the {@code Span} to be set as current. @param endSpan if {@code true} the returned {@code Runnable} will close the {@code Span}. @param runnable the {@code Runnable} to run in the {@code Span}. @return the wrapped {@code Runnable}.
[ "Wraps", "a", "{", "@link", "Runnable", "}", "so", "that", "it", "executes", "with", "the", "{", "@code", "span", "}", "as", "the", "current", "{", "@code", "Span", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/CurrentSpanUtils.java#L63-L65
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java
SharedBaseRecordTable.copyRecordInfo
public void copyRecordInfo(Record recDest, Record recSource, boolean bCopyEditMode, boolean bOnlyModifiedFields) { if (recDest == null) recDest = this.getCurrentRecord(); if (recDest != recSource) { boolean bAllowFieldChange = false; // This will disable field behaviors on move boolean bMoveModifiedState = true; // This will move the modified status to the new field Object[] rgobjEnabledFieldsOld = recSource.setEnableFieldListeners(false); recDest.moveFields(recSource, null, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE, bAllowFieldChange, bOnlyModifiedFields, bMoveModifiedState, false); recSource.setEnableFieldListeners(rgobjEnabledFieldsOld); if (bCopyEditMode) recDest.setEditMode(recSource.getEditMode()); // Okay? } }
java
public void copyRecordInfo(Record recDest, Record recSource, boolean bCopyEditMode, boolean bOnlyModifiedFields) { if (recDest == null) recDest = this.getCurrentRecord(); if (recDest != recSource) { boolean bAllowFieldChange = false; // This will disable field behaviors on move boolean bMoveModifiedState = true; // This will move the modified status to the new field Object[] rgobjEnabledFieldsOld = recSource.setEnableFieldListeners(false); recDest.moveFields(recSource, null, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE, bAllowFieldChange, bOnlyModifiedFields, bMoveModifiedState, false); recSource.setEnableFieldListeners(rgobjEnabledFieldsOld); if (bCopyEditMode) recDest.setEditMode(recSource.getEditMode()); // Okay? } }
[ "public", "void", "copyRecordInfo", "(", "Record", "recDest", ",", "Record", "recSource", ",", "boolean", "bCopyEditMode", ",", "boolean", "bOnlyModifiedFields", ")", "{", "if", "(", "recDest", "==", "null", ")", "recDest", "=", "this", ".", "getCurrentRecord", ...
Set the current table target. @param table The new current table.
[ "Set", "the", "current", "table", "target", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/SharedBaseRecordTable.java#L431-L445
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/balancer/Balancer.java
Balancer.createNamenode
protected static NamenodeProtocol createNamenode(InetSocketAddress nameNodeAddr, Configuration conf) throws IOException { RetryPolicy timeoutPolicy = RetryPolicies.exponentialBackoffRetry( 5, 200, TimeUnit.MILLISECONDS); Map<Class<? extends Exception>,RetryPolicy> exceptionToPolicyMap = new HashMap<Class<? extends Exception>, RetryPolicy>(); RetryPolicy methodPolicy = RetryPolicies.retryByException( timeoutPolicy, exceptionToPolicyMap); Map<String,RetryPolicy> methodNameToPolicyMap = new HashMap<String, RetryPolicy>(); methodNameToPolicyMap.put("getBlocks", methodPolicy); UserGroupInformation ugi; try { ugi = UnixUserGroupInformation.login(conf); } catch (javax.security.auth.login.LoginException e) { throw new IOException(StringUtils.stringifyException(e)); } return (NamenodeProtocol) RetryProxy.create( NamenodeProtocol.class, RPC.getProxy(NamenodeProtocol.class, NamenodeProtocol.versionID, nameNodeAddr, ugi, conf, NetUtils.getDefaultSocketFactory(conf)), methodNameToPolicyMap); }
java
protected static NamenodeProtocol createNamenode(InetSocketAddress nameNodeAddr, Configuration conf) throws IOException { RetryPolicy timeoutPolicy = RetryPolicies.exponentialBackoffRetry( 5, 200, TimeUnit.MILLISECONDS); Map<Class<? extends Exception>,RetryPolicy> exceptionToPolicyMap = new HashMap<Class<? extends Exception>, RetryPolicy>(); RetryPolicy methodPolicy = RetryPolicies.retryByException( timeoutPolicy, exceptionToPolicyMap); Map<String,RetryPolicy> methodNameToPolicyMap = new HashMap<String, RetryPolicy>(); methodNameToPolicyMap.put("getBlocks", methodPolicy); UserGroupInformation ugi; try { ugi = UnixUserGroupInformation.login(conf); } catch (javax.security.auth.login.LoginException e) { throw new IOException(StringUtils.stringifyException(e)); } return (NamenodeProtocol) RetryProxy.create( NamenodeProtocol.class, RPC.getProxy(NamenodeProtocol.class, NamenodeProtocol.versionID, nameNodeAddr, ugi, conf, NetUtils.getDefaultSocketFactory(conf)), methodNameToPolicyMap); }
[ "protected", "static", "NamenodeProtocol", "createNamenode", "(", "InetSocketAddress", "nameNodeAddr", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "RetryPolicy", "timeoutPolicy", "=", "RetryPolicies", ".", "exponentialBackoffRetry", "(", "5", ",", "...
/* Build a NamenodeProtocol connection to the namenode and set up the retry policy
[ "/", "*", "Build", "a", "NamenodeProtocol", "connection", "to", "the", "namenode", "and", "set", "up", "the", "retry", "policy" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/balancer/Balancer.java#L930-L958
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/BicValueValidator.java
BicValueValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); } else { valueAsString = Objects.toString(pvalue, null); } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } if (valueAsString.length() != BicValidator.BIC_LENGTH_MIN && valueAsString.length() != BicValidator.BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; } if (!valueAsString.matches(BicValidator.BIC_REGEX)) { // format is wrong! return false; } // final BicMapConstants BIC_MAP = CreateClass.create(BicMapConstants.class); return BIC_MAP.bics().containsKey(valueAsString) || BIC_MAP.bics() .containsKey(StringUtils.substring(valueAsString, 0, BicValidator.BIC_LENGTH_MIN)); }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString; if (ignoreWhitspaces) { valueAsString = Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("\\s+", StringUtils.EMPTY); } else { valueAsString = Objects.toString(pvalue, null); } if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } if (valueAsString.length() != BicValidator.BIC_LENGTH_MIN && valueAsString.length() != BicValidator.BIC_LENGTH_MAX) { // to short or to long, but it's handled by size validator! return true; } if (!valueAsString.matches(BicValidator.BIC_REGEX)) { // format is wrong! return false; } // final BicMapConstants BIC_MAP = CreateClass.create(BicMapConstants.class); return BIC_MAP.bics().containsKey(valueAsString) || BIC_MAP.bics() .containsKey(StringUtils.substring(valueAsString, 0, BicValidator.BIC_LENGTH_MIN)); }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", ";", "if", "(", "ignoreWhitspaces", ")", "{", "valueAsString", "=", ...
{@inheritDoc} check if given string is a valid BIC. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "string", "is", "a", "valid", "BIC", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/BicValueValidator.java#L63-L88
drewnoakes/metadata-extractor
Source/com/drew/imaging/jpeg/JpegSegmentReader.java
JpegSegmentReader.readSegments
@NotNull public static JpegSegmentData readSegments(@NotNull File file, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException { FileInputStream stream = null; try { stream = new FileInputStream(file); return readSegments(new StreamReader(stream), segmentTypes); } finally { if (stream != null) { stream.close(); } } }
java
@NotNull public static JpegSegmentData readSegments(@NotNull File file, @Nullable Iterable<JpegSegmentType> segmentTypes) throws JpegProcessingException, IOException { FileInputStream stream = null; try { stream = new FileInputStream(file); return readSegments(new StreamReader(stream), segmentTypes); } finally { if (stream != null) { stream.close(); } } }
[ "@", "NotNull", "public", "static", "JpegSegmentData", "readSegments", "(", "@", "NotNull", "File", "file", ",", "@", "Nullable", "Iterable", "<", "JpegSegmentType", ">", "segmentTypes", ")", "throws", "JpegProcessingException", ",", "IOException", "{", "FileInputSt...
Processes the provided JPEG data, and extracts the specified JPEG segments into a {@link JpegSegmentData} object. <p> Will not return SOS (start of scan) or EOI (end of image) segments. @param file a {@link File} from which the JPEG data will be read. @param segmentTypes the set of JPEG segments types that are to be returned. If this argument is <code>null</code> then all found segment types are returned.
[ "Processes", "the", "provided", "JPEG", "data", "and", "extracts", "the", "specified", "JPEG", "segments", "into", "a", "{", "@link", "JpegSegmentData", "}", "object", ".", "<p", ">", "Will", "not", "return", "SOS", "(", "start", "of", "scan", ")", "or", ...
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/jpeg/JpegSegmentReader.java#L69-L81
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.getPointIndex
@Pure public int getPointIndex(int groupIndex, int position) { final int groupMemberCount = getPointCountInGroup(groupIndex); final int pos; if (position < 0) { pos = 0; } else if (position >= groupMemberCount) { pos = groupMemberCount - 1; } else { pos = position; } // Move the start/end indexes to corresponds to the bounds of the new points return (firstInGroup(groupIndex) + pos * 2) / 2; }
java
@Pure public int getPointIndex(int groupIndex, int position) { final int groupMemberCount = getPointCountInGroup(groupIndex); final int pos; if (position < 0) { pos = 0; } else if (position >= groupMemberCount) { pos = groupMemberCount - 1; } else { pos = position; } // Move the start/end indexes to corresponds to the bounds of the new points return (firstInGroup(groupIndex) + pos * 2) / 2; }
[ "@", "Pure", "public", "int", "getPointIndex", "(", "int", "groupIndex", ",", "int", "position", ")", "{", "final", "int", "groupMemberCount", "=", "getPointCountInGroup", "(", "groupIndex", ")", ";", "final", "int", "pos", ";", "if", "(", "position", "<", ...
Replies the global index of the point that corresponds to the position in the given group. @param groupIndex the group index. @param position is the index of the point in the group @return the global index of the point @throws IndexOutOfBoundsException in case of error.
[ "Replies", "the", "global", "index", "of", "the", "point", "that", "corresponds", "to", "the", "position", "in", "the", "given", "group", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L416-L430
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.populateResponseValues
@Sensitive public Map<String, String> populateResponseValues(@Sensitive String responseBody) { Map<String, String> responseValues = new HashMap<String, String>(); if (responseBody == null) { return responseValues; } StringTokenizer st = new StringTokenizer(responseBody, "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); String[] keyValue = token.split("="); String key = keyValue[0]; String value = ""; if (keyValue.length > 1) { value = keyValue[1]; } if (tc.isDebugEnabled()) { // Do not trace token secrets Tr.debug(tc, key + ": [" + (TwitterConstants.RESPONSE_OAUTH_TOKEN_SECRET.equals(key) ? "****" : value) + "]"); } responseValues.put(key, value); } return responseValues; }
java
@Sensitive public Map<String, String> populateResponseValues(@Sensitive String responseBody) { Map<String, String> responseValues = new HashMap<String, String>(); if (responseBody == null) { return responseValues; } StringTokenizer st = new StringTokenizer(responseBody, "&"); while (st.hasMoreTokens()) { String token = st.nextToken(); String[] keyValue = token.split("="); String key = keyValue[0]; String value = ""; if (keyValue.length > 1) { value = keyValue[1]; } if (tc.isDebugEnabled()) { // Do not trace token secrets Tr.debug(tc, key + ": [" + (TwitterConstants.RESPONSE_OAUTH_TOKEN_SECRET.equals(key) ? "****" : value) + "]"); } responseValues.put(key, value); } return responseValues; }
[ "@", "Sensitive", "public", "Map", "<", "String", ",", "String", ">", "populateResponseValues", "(", "@", "Sensitive", "String", "responseBody", ")", "{", "Map", "<", "String", ",", "String", ">", "responseValues", "=", "new", "HashMap", "<", "String", ",", ...
Populates a map of key/value pairs from the response body. Because the response body may contain token secrets, that value has been annotated as @Sensitive. This method expects the responseBody value to be formatted: key=value[&key2=value2]* @param responseBody @return
[ "Populates", "a", "map", "of", "key", "/", "value", "pairs", "from", "the", "response", "body", ".", "Because", "the", "response", "body", "may", "contain", "token", "secrets", "that", "value", "has", "been", "annotated", "as", "@Sensitive", ".", "This", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L467-L491
floragunncom/search-guard
src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java
WildcardMatcher.checkIndexOf
private static int checkIndexOf(final String str, final int strStartIndex, final String search) { final int endIndex = str.length() - search.length(); if (endIndex >= strStartIndex) { for (int i = strStartIndex; i <= endIndex; i++) { if (checkRegionMatches(str, i, search)) { return i; } } } return -1; }
java
private static int checkIndexOf(final String str, final int strStartIndex, final String search) { final int endIndex = str.length() - search.length(); if (endIndex >= strStartIndex) { for (int i = strStartIndex; i <= endIndex; i++) { if (checkRegionMatches(str, i, search)) { return i; } } } return -1; }
[ "private", "static", "int", "checkIndexOf", "(", "final", "String", "str", ",", "final", "int", "strStartIndex", ",", "final", "String", "search", ")", "{", "final", "int", "endIndex", "=", "str", ".", "length", "(", ")", "-", "search", ".", "length", "(...
Checks if one string contains another starting at a specific index using the case-sensitivity rule. <p> This method mimics parts of {@link String#indexOf(String, int)} but takes case-sensitivity into account. @param str the string to check, not null @param strStartIndex the index to start at in str @param search the start to search for, not null @return the first index of the search String, -1 if no match or {@code null} string input @throws NullPointerException if either string is null @since 2.0
[ "Checks", "if", "one", "string", "contains", "another", "starting", "at", "a", "specific", "index", "using", "the", "case", "-", "sensitivity", "rule", ".", "<p", ">", "This", "method", "mimics", "parts", "of", "{", "@link", "String#indexOf", "(", "String", ...
train
https://github.com/floragunncom/search-guard/blob/f9828004e11dc0e4b6da4dead1fafcf3be8f7f6d/src/main/java/com/floragunn/searchguard/support/WildcardMatcher.java#L599-L609
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsDestinationAddressFactoryImpl.java
JsDestinationAddressFactoryImpl.createJsDestinationAddress
public final JsDestinationAddress createJsDestinationAddress(String destinationName ,boolean localOnly ,SIBUuid8 meId ) throws NullPointerException { if (destinationName == null) { throw new NullPointerException("destinationName"); } return new JsDestinationAddressImpl(destinationName, localOnly, meId, null, false); }
java
public final JsDestinationAddress createJsDestinationAddress(String destinationName ,boolean localOnly ,SIBUuid8 meId ) throws NullPointerException { if (destinationName == null) { throw new NullPointerException("destinationName"); } return new JsDestinationAddressImpl(destinationName, localOnly, meId, null, false); }
[ "public", "final", "JsDestinationAddress", "createJsDestinationAddress", "(", "String", "destinationName", ",", "boolean", "localOnly", ",", "SIBUuid8", "meId", ")", "throws", "NullPointerException", "{", "if", "(", "destinationName", "==", "null", ")", "{", "throw", ...
Create a JsDestinationAddress from the given parameters @param destinationName The name of the SIBus Destination @param localOnly Indicates that the Destination should be limited to only the queue or mediation point on the Messaging Engine that the application is connected to, if one exists. If no such message point exists then the option is ignored. @param localOnly Indicates that the Destination should be localized to the local Messaging Engine. @param meId The Id of the Message Engine where the destination is localized @return JsDestinationAddress The JsDestinationAddress corresponding to the buffer contents. @exception NullPointerException Thrown if the destinationName parameter is null.
[ "Create", "a", "JsDestinationAddress", "from", "the", "given", "parameters" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsDestinationAddressFactoryImpl.java#L135-L144
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_domainTrust_domainTrustId_addDomainController_POST
public OvhTask serviceName_domainTrust_domainTrustId_addDomainController_POST(String serviceName, Long domainTrustId, String domain, String domainControllerIp) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainController"; StringBuilder sb = path(qPath, serviceName, domainTrustId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "domainControllerIp", domainControllerIp); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_domainTrust_domainTrustId_addDomainController_POST(String serviceName, Long domainTrustId, String domain, String domainControllerIp) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainController"; StringBuilder sb = path(qPath, serviceName, domainTrustId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "domainControllerIp", domainControllerIp); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_domainTrust_domainTrustId_addDomainController_POST", "(", "String", "serviceName", ",", "Long", "domainTrustId", ",", "String", "domain", ",", "String", "domainControllerIp", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/...
Add a Domain Controller for this domain. REST: POST /horizonView/{serviceName}/domainTrust/{domainTrustId}/addDomainController @param domainControllerIp [required] IP of your Domain Controller @param domain [required] Name of your Domain Controller (example : domain.local) @param serviceName [required] Domain of the service @param domainTrustId [required] Domain trust id
[ "Add", "a", "Domain", "Controller", "for", "this", "domain", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L334-L342
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java
SeaGlassGraphicsUtils.drawEmphasizedText
public void drawEmphasizedText(Graphics g, Color foreground, Color emphasis, String s, int x, int y) { drawEmphasizedText(g, foreground, emphasis, s, -1, x, y); }
java
public void drawEmphasizedText(Graphics g, Color foreground, Color emphasis, String s, int x, int y) { drawEmphasizedText(g, foreground, emphasis, s, -1, x, y); }
[ "public", "void", "drawEmphasizedText", "(", "Graphics", "g", ",", "Color", "foreground", ",", "Color", "emphasis", ",", "String", "s", ",", "int", "x", ",", "int", "y", ")", "{", "drawEmphasizedText", "(", "g", ",", "foreground", ",", "emphasis", ",", "...
Draw text with an emphasized background. @param g the Graphics context to draw with. @param foreground the foreground color. @param emphasis the emphasis color. @param s the text to draw. @param x the x coordinate to draw at. @param y the y coordinate to draw at.
[ "Draw", "text", "with", "an", "emphasized", "background", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java#L343-L345
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/TsurgeonPatternRoot.java
TsurgeonPatternRoot.evaluate
@Override public Tree evaluate(Tree t, TregexMatcher m) { newNodeNames = new HashMap<String,Tree>(); coindexer.setLastIndex(t); for (TsurgeonPattern child : children) { t = child.evaluate(t, m); if (t == null) { return null; } } return t; }
java
@Override public Tree evaluate(Tree t, TregexMatcher m) { newNodeNames = new HashMap<String,Tree>(); coindexer.setLastIndex(t); for (TsurgeonPattern child : children) { t = child.evaluate(t, m); if (t == null) { return null; } } return t; }
[ "@", "Override", "public", "Tree", "evaluate", "(", "Tree", "t", ",", "TregexMatcher", "m", ")", "{", "newNodeNames", "=", "new", "HashMap", "<", "String", ",", "Tree", ">", "(", ")", ";", "coindexer", ".", "setLastIndex", "(", "t", ")", ";", "for", ...
returns null if one of the surgeries eliminates the tree entirely. The operated-on tree is not to be trusted in this instance.
[ "returns", "null", "if", "one", "of", "the", "surgeries", "eliminates", "the", "tree", "entirely", ".", "The", "operated", "-", "on", "tree", "is", "not", "to", "be", "trusted", "in", "this", "instance", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/TsurgeonPatternRoot.java#L28-L39
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownNtoN_F32.java
RemoveBrownNtoN_F32.compute
@Override public void compute(float x, float y, Point2D_F32 out) { removeRadial(x, y, params.radial, params.t1, params.t2, out, tol ); }
java
@Override public void compute(float x, float y, Point2D_F32 out) { removeRadial(x, y, params.radial, params.t1, params.t2, out, tol ); }
[ "@", "Override", "public", "void", "compute", "(", "float", "x", ",", "float", "y", ",", "Point2D_F32", "out", ")", "{", "removeRadial", "(", "x", ",", "y", ",", "params", ".", "radial", ",", "params", ".", "t1", ",", "params", ".", "t2", ",", "out...
Removes radial distortion @param x Distorted x-coordinate normalized image coordinate @param y Distorted y-coordinate normalized image coordinate @param out Undistorted normalized coordinate.
[ "Removes", "radial", "distortion" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/RemoveBrownNtoN_F32.java#L60-L64
radkovo/SwingBox
src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java
DelegateView.paint
@Override public void paint(Graphics g, Shape allocation) { if (view != null) { view.paint(g, allocation); } }
java
@Override public void paint(Graphics g, Shape allocation) { if (view != null) { view.paint(g, allocation); } }
[ "@", "Override", "public", "void", "paint", "(", "Graphics", "g", ",", "Shape", "allocation", ")", "{", "if", "(", "view", "!=", "null", ")", "{", "view", ".", "paint", "(", "g", ",", "allocation", ")", ";", "}", "}" ]
Renders the view. @param g the graphics context @param allocation the region to render into
[ "Renders", "the", "view", "." ]
train
https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java#L278-L285
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.deleteScope
public String deleteScope(String scopeName) throws OAuthException { String responseMsg; Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); } else { // first, check whether there is a client app registered with that scope List<ApplicationInfo> registeredApps = getClientAppsByScope(scopeName); if (registeredApps.size() > 0) { responseMsg = SCOPE_USED_BY_APP_MESSAGE; } else { boolean ok = DBManagerFactory.getInstance().deleteScope(scopeName).blockingGet(); if (ok) { responseMsg = SCOPE_DELETED_OK_MESSAGE; } else { responseMsg = SCOPE_DELETED_NOK_MESSAGE; } } } return responseMsg; }
java
public String deleteScope(String scopeName) throws OAuthException { String responseMsg; Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EXIST, HttpResponseStatus.BAD_REQUEST); } else { // first, check whether there is a client app registered with that scope List<ApplicationInfo> registeredApps = getClientAppsByScope(scopeName); if (registeredApps.size() > 0) { responseMsg = SCOPE_USED_BY_APP_MESSAGE; } else { boolean ok = DBManagerFactory.getInstance().deleteScope(scopeName).blockingGet(); if (ok) { responseMsg = SCOPE_DELETED_OK_MESSAGE; } else { responseMsg = SCOPE_DELETED_NOK_MESSAGE; } } } return responseMsg; }
[ "public", "String", "deleteScope", "(", "String", "scopeName", ")", "throws", "OAuthException", "{", "String", "responseMsg", ";", "Scope", "foundScope", "=", "DBManagerFactory", ".", "getInstance", "(", ")", ".", "findScope", "(", "scopeName", ")", ".", "blocki...
Deletes a scope. If the scope does not exists, returns an error. @param scopeName scopeName @return String message that will be returned in the response
[ "Deletes", "a", "scope", ".", "If", "the", "scope", "does", "not", "exists", "returns", "an", "error", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L251-L272
FXMisc/WellBehavedFX
src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java
InputMapTemplate.consumeWhen
public static <S, T extends Event, U extends T> InputMapTemplate<S, U> consumeWhen( EventPattern<? super T, ? extends U> eventPattern, Predicate<? super S> condition, BiConsumer<? super S, ? super U> action) { return process(eventPattern, (s, u) -> { if(condition.test(s)) { action.accept(s, u); return Result.CONSUME; } else { return Result.PROCEED; } }); }
java
public static <S, T extends Event, U extends T> InputMapTemplate<S, U> consumeWhen( EventPattern<? super T, ? extends U> eventPattern, Predicate<? super S> condition, BiConsumer<? super S, ? super U> action) { return process(eventPattern, (s, u) -> { if(condition.test(s)) { action.accept(s, u); return Result.CONSUME; } else { return Result.PROCEED; } }); }
[ "public", "static", "<", "S", ",", "T", "extends", "Event", ",", "U", "extends", "T", ">", "InputMapTemplate", "<", "S", ",", "U", ">", "consumeWhen", "(", "EventPattern", "<", "?", "super", "T", ",", "?", "extends", "U", ">", "eventPattern", ",", "P...
If the given {@link EventPattern} matches the given event type and {@code condition} is true, consumes the event and does not attempt to match additional {@code InputMap}s (if they exist).
[ "If", "the", "given", "{" ]
train
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L260-L272
hawkular/hawkular-inventory
hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java
TraversalContext.proceedToRelationships
Builder<BE, Relationship> proceedToRelationships(Relationships.Direction direction) { return new Builder<>(this, hop(), Query.filter(), Relationship.class) .hop(new SwitchElementType(direction, false)); }
java
Builder<BE, Relationship> proceedToRelationships(Relationships.Direction direction) { return new Builder<>(this, hop(), Query.filter(), Relationship.class) .hop(new SwitchElementType(direction, false)); }
[ "Builder", "<", "BE", ",", "Relationship", ">", "proceedToRelationships", "(", "Relationships", ".", "Direction", "direction", ")", "{", "return", "new", "Builder", "<>", "(", "this", ",", "hop", "(", ")", ",", "Query", ".", "filter", "(", ")", ",", "Rel...
The new context will have the source path composed by appending current select candidates to the current source path. The new context will have select candidates such that it will select the relationships in given direction stemming from the entities on the new source path. @param direction the direction of the relationships to look for @return a context builder with the modified source path, select candidates and type
[ "The", "new", "context", "will", "have", "the", "source", "path", "composed", "by", "appending", "current", "select", "candidates", "to", "the", "current", "source", "path", ".", "The", "new", "context", "will", "have", "select", "candidates", "such", "that", ...
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/base/TraversalContext.java#L217-L220
google/closure-compiler
src/com/google/javascript/jscomp/FunctionInjector.java
FunctionInjector.estimateCallCost
private static int estimateCallCost(Node fnNode, boolean referencesThis) { Node argsNode = NodeUtil.getFunctionParameters(fnNode); int numArgs = argsNode.getChildCount(); int callCost = NAME_COST_ESTIMATE + PAREN_COST; if (numArgs > 0) { callCost += (numArgs * NAME_COST_ESTIMATE) + ((numArgs - 1) * COMMA_COST); } if (referencesThis) { // TODO(johnlenz): Update this if we start supporting inlining // other functions that reference this. // The only functions that reference this that are currently inlined // are those that are called via ".call" with an explicit "this". callCost += 5 + 5; // ".call" + "this," } return callCost; }
java
private static int estimateCallCost(Node fnNode, boolean referencesThis) { Node argsNode = NodeUtil.getFunctionParameters(fnNode); int numArgs = argsNode.getChildCount(); int callCost = NAME_COST_ESTIMATE + PAREN_COST; if (numArgs > 0) { callCost += (numArgs * NAME_COST_ESTIMATE) + ((numArgs - 1) * COMMA_COST); } if (referencesThis) { // TODO(johnlenz): Update this if we start supporting inlining // other functions that reference this. // The only functions that reference this that are currently inlined // are those that are called via ".call" with an explicit "this". callCost += 5 + 5; // ".call" + "this," } return callCost; }
[ "private", "static", "int", "estimateCallCost", "(", "Node", "fnNode", ",", "boolean", "referencesThis", ")", "{", "Node", "argsNode", "=", "NodeUtil", ".", "getFunctionParameters", "(", "fnNode", ")", ";", "int", "numArgs", "=", "argsNode", ".", "getChildCount"...
Gets an estimate of the cost in characters of making the function call: the sum of the identifiers and the separators. @param referencesThis
[ "Gets", "an", "estimate", "of", "the", "cost", "in", "characters", "of", "making", "the", "function", "call", ":", "the", "sum", "of", "the", "identifiers", "and", "the", "separators", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionInjector.java#L923-L941
googleapis/google-cloud-java
google-cloud-clients/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java
DeviceManagerClient.modifyCloudToDeviceConfig
public final DeviceConfig modifyCloudToDeviceConfig(String name, ByteString binaryData) { ModifyCloudToDeviceConfigRequest request = ModifyCloudToDeviceConfigRequest.newBuilder() .setName(name) .setBinaryData(binaryData) .build(); return modifyCloudToDeviceConfig(request); }
java
public final DeviceConfig modifyCloudToDeviceConfig(String name, ByteString binaryData) { ModifyCloudToDeviceConfigRequest request = ModifyCloudToDeviceConfigRequest.newBuilder() .setName(name) .setBinaryData(binaryData) .build(); return modifyCloudToDeviceConfig(request); }
[ "public", "final", "DeviceConfig", "modifyCloudToDeviceConfig", "(", "String", "name", ",", "ByteString", "binaryData", ")", "{", "ModifyCloudToDeviceConfigRequest", "request", "=", "ModifyCloudToDeviceConfigRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "n...
Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata. <p>Sample code: <pre><code> try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); ByteString binaryData = ByteString.copyFromUtf8(""); DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(name.toString(), binaryData); } </code></pre> @param name The name of the device. For example, `projects/p0/locations/us-central1/registries/registry0/devices/device0` or `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. @param binaryData The configuration data for the device. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Modifies", "the", "configuration", "for", "the", "device", "which", "is", "eventually", "sent", "from", "the", "Cloud", "IoT", "Core", "servers", ".", "Returns", "the", "modified", "configuration", "version", "and", "its", "metadata", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java#L1241-L1249
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDefinitionList.java
WDefinitionList.addTerm
public void addTerm(final String term, final WComponent... data) { for (WComponent component : data) { if (component != null) { content.add(component, term); } } // If the term doesn't exist, we may need to add a dummy component if (getComponentsForTerm(term).isEmpty()) { content.add(new DefaultWComponent(), term); } }
java
public void addTerm(final String term, final WComponent... data) { for (WComponent component : data) { if (component != null) { content.add(component, term); } } // If the term doesn't exist, we may need to add a dummy component if (getComponentsForTerm(term).isEmpty()) { content.add(new DefaultWComponent(), term); } }
[ "public", "void", "addTerm", "(", "final", "String", "term", ",", "final", "WComponent", "...", "data", ")", "{", "for", "(", "WComponent", "component", ":", "data", ")", "{", "if", "(", "component", "!=", "null", ")", "{", "content", ".", "add", "(", ...
Adds a term to this definition list. If there is an existing term, the component is added to the list of data for the term. @param term the term to add. @param data the term data.
[ "Adds", "a", "term", "to", "this", "definition", "list", ".", "If", "there", "is", "an", "existing", "term", "the", "component", "is", "added", "to", "the", "list", "of", "data", "for", "the", "term", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDefinitionList.java#L102-L113
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java
N1qlQueryExecutor.retryPrepareAndExecuteOnce
protected Observable<AsyncN1qlQueryResult> retryPrepareAndExecuteOnce(Throwable error, N1qlQuery query, CouchbaseEnvironment env, long timeout, TimeUnit timeUnit) { if (error instanceof QueryExecutionException && shouldRetry(((QueryExecutionException) error).getN1qlError())) { queryCache.remove(query.statement().toString()); return prepareAndExecute(query, env, timeout, timeUnit); } return Observable.error(error); }
java
protected Observable<AsyncN1qlQueryResult> retryPrepareAndExecuteOnce(Throwable error, N1qlQuery query, CouchbaseEnvironment env, long timeout, TimeUnit timeUnit) { if (error instanceof QueryExecutionException && shouldRetry(((QueryExecutionException) error).getN1qlError())) { queryCache.remove(query.statement().toString()); return prepareAndExecute(query, env, timeout, timeUnit); } return Observable.error(error); }
[ "protected", "Observable", "<", "AsyncN1qlQueryResult", ">", "retryPrepareAndExecuteOnce", "(", "Throwable", "error", ",", "N1qlQuery", "query", ",", "CouchbaseEnvironment", "env", ",", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "{", "if", "(", "error", ...
In case the error warrants a retry, issue a PREPARE, followed by an update of the cache and an EXECUTE. Any failure in the EXECUTE won't continue the retry cycle.
[ "In", "case", "the", "error", "warrants", "a", "retry", "issue", "a", "PREPARE", "followed", "by", "an", "update", "of", "the", "cache", "and", "an", "EXECUTE", ".", "Any", "failure", "in", "the", "EXECUTE", "won", "t", "continue", "the", "retry", "cycle...
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/core/N1qlQueryExecutor.java#L384-L391
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/managers/AccountManager.java
AccountManager.setEmail
@CheckReturnValue public AccountManager setEmail(String email, String currentPassword) { Checks.notNull(email, "email"); this.currentPassword = currentPassword; this.email = email; set |= EMAIL; return this; }
java
@CheckReturnValue public AccountManager setEmail(String email, String currentPassword) { Checks.notNull(email, "email"); this.currentPassword = currentPassword; this.email = email; set |= EMAIL; return this; }
[ "@", "CheckReturnValue", "public", "AccountManager", "setEmail", "(", "String", "email", ",", "String", "currentPassword", ")", "{", "Checks", ".", "notNull", "(", "email", ",", "\"email\"", ")", ";", "this", ".", "currentPassword", "=", "currentPassword", ";", ...
Sets the email for the currently logged in client account. @param email The new email @param currentPassword The <b>valid</b> current password for the represented account @throws net.dv8tion.jda.core.exceptions.AccountTypeException If the currently logged in account is not from {@link net.dv8tion.jda.core.AccountType#CLIENT} @throws IllegalArgumentException <ul> <li>If the provided {@code currentPassword} or the provided {@code email} is {@code null} or empty <li>If the provided {@code email} is not valid.</li> </ul> @return AccountManager for chaining convenience
[ "Sets", "the", "email", "for", "the", "currently", "logged", "in", "client", "account", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/AccountManager.java#L278-L286
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java
LogAnalyticsInner.exportThrottledRequests
public LogAnalyticsOperationResultInner exportThrottledRequests(String location, ThrottledRequestsInput parameters) { return exportThrottledRequestsWithServiceResponseAsync(location, parameters).toBlocking().last().body(); }
java
public LogAnalyticsOperationResultInner exportThrottledRequests(String location, ThrottledRequestsInput parameters) { return exportThrottledRequestsWithServiceResponseAsync(location, parameters).toBlocking().last().body(); }
[ "public", "LogAnalyticsOperationResultInner", "exportThrottledRequests", "(", "String", "location", ",", "ThrottledRequestsInput", "parameters", ")", "{", "return", "exportThrottledRequestsWithServiceResponseAsync", "(", "location", ",", "parameters", ")", ".", "toBlocking", ...
Export logs that show total throttled Api requests for this subscription in the given time window. @param location The location upon which virtual-machine-sizes is queried. @param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api. @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 LogAnalyticsOperationResultInner object if successful.
[ "Export", "logs", "that", "show", "total", "throttled", "Api", "requests", "for", "this", "subscription", "in", "the", "given", "time", "window", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java#L244-L246
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/dekker/island/IslandConflictResolver.java
IslandConflictResolver.resolveConflictsBySelectingPreferredIslands
private void resolveConflictsBySelectingPreferredIslands(IslandSelection selection, Map<IslandCompetition, List<Island>> islandConflictMap) { // First select competing islands that are on the ideal line LOG.fine("addBestOfCompeting with competingIslandsOnIdealLine"); makeDistanceMap(islandConflictMap.getOrDefault(IslandCompetition.CompetingIslandAndOnIdealIine, Collections.emptyList())) .values().stream()// .flatMap(List::stream)// .filter(selection::isIslandPossibleCandidate)// .forEach(selection::addIsland); // Second select other competing islands LOG.fine("addBestOfCompeting with otherCompetingIslands"); makeDistanceMap(islandConflictMap.getOrDefault(IslandCompetition.CompetingIsland, Collections.emptyList())) .values().stream()// .flatMap(List::stream)// .filter(selection::isIslandPossibleCandidate)// .forEach(selection::addIsland); // Third select non competing islands LOG.fine("add non competing islands"); islandConflictMap.getOrDefault(IslandCompetition.NonCompetingIsland, Collections.emptyList()) .forEach(selection::addIsland); }
java
private void resolveConflictsBySelectingPreferredIslands(IslandSelection selection, Map<IslandCompetition, List<Island>> islandConflictMap) { // First select competing islands that are on the ideal line LOG.fine("addBestOfCompeting with competingIslandsOnIdealLine"); makeDistanceMap(islandConflictMap.getOrDefault(IslandCompetition.CompetingIslandAndOnIdealIine, Collections.emptyList())) .values().stream()// .flatMap(List::stream)// .filter(selection::isIslandPossibleCandidate)// .forEach(selection::addIsland); // Second select other competing islands LOG.fine("addBestOfCompeting with otherCompetingIslands"); makeDistanceMap(islandConflictMap.getOrDefault(IslandCompetition.CompetingIsland, Collections.emptyList())) .values().stream()// .flatMap(List::stream)// .filter(selection::isIslandPossibleCandidate)// .forEach(selection::addIsland); // Third select non competing islands LOG.fine("add non competing islands"); islandConflictMap.getOrDefault(IslandCompetition.NonCompetingIsland, Collections.emptyList()) .forEach(selection::addIsland); }
[ "private", "void", "resolveConflictsBySelectingPreferredIslands", "(", "IslandSelection", "selection", ",", "Map", "<", "IslandCompetition", ",", "List", "<", "Island", ">", ">", "islandConflictMap", ")", "{", "// First select competing islands that are on the ideal line", "L...
/* The preferred Islands are directly added to the result Archipelago If we want to re-factor this into a pull construction rather then a push construction we have to move this code out of this method and move it to the caller class
[ "/", "*", "The", "preferred", "Islands", "are", "directly", "added", "to", "the", "result", "Archipelago", "If", "we", "want", "to", "re", "-", "factor", "this", "into", "a", "pull", "construction", "rather", "then", "a", "push", "construction", "we", "hav...
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/dekker/island/IslandConflictResolver.java#L98-L119
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginListAvailableProviders
public AvailableProvidersListInner beginListAvailableProviders(String resourceGroupName, String networkWatcherName, AvailableProvidersListParameters parameters) { return beginListAvailableProvidersWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public AvailableProvidersListInner beginListAvailableProviders(String resourceGroupName, String networkWatcherName, AvailableProvidersListParameters parameters) { return beginListAvailableProvidersWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "AvailableProvidersListInner", "beginListAvailableProviders", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "AvailableProvidersListParameters", "parameters", ")", "{", "return", "beginListAvailableProvidersWithServiceResponseAsync", "(", "r...
Lists all available internet service providers for a specified Azure region. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that scope the list of available providers. @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 AvailableProvidersListInner object if successful.
[ "Lists", "all", "available", "internet", "service", "providers", "for", "a", "specified", "Azure", "region", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2551-L2553
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java
XcodeProjectWriter.addDocumentationGroup
private PBXObjectRef addDocumentationGroup(final Map objects, final String sourceTree) { final List productsList = new ArrayList(); final PBXObjectRef products = createPBXGroup("Documentation", sourceTree, productsList); objects.put(products.getID(), products.getProperties()); return products; }
java
private PBXObjectRef addDocumentationGroup(final Map objects, final String sourceTree) { final List productsList = new ArrayList(); final PBXObjectRef products = createPBXGroup("Documentation", sourceTree, productsList); objects.put(products.getID(), products.getProperties()); return products; }
[ "private", "PBXObjectRef", "addDocumentationGroup", "(", "final", "Map", "objects", ",", "final", "String", "sourceTree", ")", "{", "final", "List", "productsList", "=", "new", "ArrayList", "(", ")", ";", "final", "PBXObjectRef", "products", "=", "createPBXGroup",...
Add documentation group to map of objects. @param objects object map. @param sourceTree source tree description. @return documentation group.
[ "Add", "documentation", "group", "to", "map", "of", "objects", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/apple/XcodeProjectWriter.java#L474-L479