repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java
RequestInterceptor.preInvoke
public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException { preRequest( ( RequestInterceptorContext ) context, chain ); }
java
public void preInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException { preRequest( ( RequestInterceptorContext ) context, chain ); }
[ "public", "void", "preInvoke", "(", "InterceptorContext", "context", ",", "InterceptorChain", "chain", ")", "throws", "InterceptorException", "{", "preRequest", "(", "(", "RequestInterceptorContext", ")", "context", ",", "chain", ")", ";", "}" ]
Callback invoked before the request is processed. {@link #preRequest} may be used instead.
[ "Callback", "invoked", "before", "the", "request", "is", "processed", ".", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java#L49-L52
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java
AbstractMySQLQuery.intoOutfile
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C intoOutfile(File file) { return addFlag(Position.END, "\ninto outfile '" + file.getPath() + "'"); }
java
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C intoOutfile(File file) { return addFlag(Position.END, "\ninto outfile '" + file.getPath() + "'"); }
[ "@", "WithBridgeMethods", "(", "value", "=", "MySQLQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "intoOutfile", "(", "File", "file", ")", "{", "return", "addFlag", "(", "Position", ".", "END", ",", "\"\\ninto outfile '\"", "+", ...
SELECT ... INTO OUTFILE writes the selected rows to a file. Column and line terminators c an be specified to produce a specific output format. @param file file to write to @return the current object
[ "SELECT", "...", "INTO", "OUTFILE", "writes", "the", "selected", "rows", "to", "a", "file", ".", "Column", "and", "line", "terminators", "c", "an", "be", "specified", "to", "produce", "a", "specific", "output", "format", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L156-L159
square/spoon
spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java
SpoonUtils.initAdb
public static AndroidDebugBridge initAdb(File sdk, Duration timeOut) { AndroidDebugBridge.initIfNeeded(false); File adbPath = FileUtils.getFile(sdk, "platform-tools", "adb"); AndroidDebugBridge adb = AndroidDebugBridge.createBridge(adbPath.getAbsolutePath(), false); waitForAdb(adb, timeOut); return adb; }
java
public static AndroidDebugBridge initAdb(File sdk, Duration timeOut) { AndroidDebugBridge.initIfNeeded(false); File adbPath = FileUtils.getFile(sdk, "platform-tools", "adb"); AndroidDebugBridge adb = AndroidDebugBridge.createBridge(adbPath.getAbsolutePath(), false); waitForAdb(adb, timeOut); return adb; }
[ "public", "static", "AndroidDebugBridge", "initAdb", "(", "File", "sdk", ",", "Duration", "timeOut", ")", "{", "AndroidDebugBridge", ".", "initIfNeeded", "(", "false", ")", ";", "File", "adbPath", "=", "FileUtils", ".", "getFile", "(", "sdk", ",", "\"platform-...
Get an {@link com.android.ddmlib.AndroidDebugBridge} instance given an SDK path.
[ "Get", "an", "{" ]
train
https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/SpoonUtils.java#L119-L125
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/util/CompareUtils.java
CompareUtils.compareUnbound
public static int compareUnbound(final Comparable<?> obj1, final Object obj2) throws ClassCastException { if (obj1 == obj2) { return 0; } if (obj1 == null) { return -1; } if (obj2 == null) { return 1; } @SuppressWarnings("unchecked") final Comparable<Object> castedObj1 = (Comparable<Object>) obj1; return castedObj1.compareTo(obj2); }
java
public static int compareUnbound(final Comparable<?> obj1, final Object obj2) throws ClassCastException { if (obj1 == obj2) { return 0; } if (obj1 == null) { return -1; } if (obj2 == null) { return 1; } @SuppressWarnings("unchecked") final Comparable<Object> castedObj1 = (Comparable<Object>) obj1; return castedObj1.compareTo(obj2); }
[ "public", "static", "int", "compareUnbound", "(", "final", "Comparable", "<", "?", ">", "obj1", ",", "final", "Object", "obj2", ")", "throws", "ClassCastException", "{", "if", "(", "obj1", "==", "obj2", ")", "{", "return", "0", ";", "}", "if", "(", "ob...
Compares two objects with an unbound (and thus unsafe) {@link Comparable} . Use {@link #compare(Comparable, Object)} if possible. @param obj1 @param obj2 @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. @throws ClassCastException if obj1's Comparable type is not compatible with the argument obj2.
[ "Compares", "two", "objects", "with", "an", "unbound", "(", "and", "thus", "unsafe", ")", "{", "@link", "Comparable", "}", ".", "Use", "{", "@link", "#compare", "(", "Comparable", "Object", ")", "}", "if", "possible", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/util/CompareUtils.java#L41-L54
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java
OpenCensusUtils.propagateTracingContext
public static void propagateTracingContext(Span span, HttpHeaders headers) { Preconditions.checkArgument(span != null, "span should not be null."); Preconditions.checkArgument(headers != null, "headers should not be null."); if (propagationTextFormat != null && propagationTextFormatSetter != null) { if (!span.equals(BlankSpan.INSTANCE)) { propagationTextFormat.inject(span.getContext(), headers, propagationTextFormatSetter); } } }
java
public static void propagateTracingContext(Span span, HttpHeaders headers) { Preconditions.checkArgument(span != null, "span should not be null."); Preconditions.checkArgument(headers != null, "headers should not be null."); if (propagationTextFormat != null && propagationTextFormatSetter != null) { if (!span.equals(BlankSpan.INSTANCE)) { propagationTextFormat.inject(span.getContext(), headers, propagationTextFormatSetter); } } }
[ "public", "static", "void", "propagateTracingContext", "(", "Span", "span", ",", "HttpHeaders", "headers", ")", "{", "Preconditions", ".", "checkArgument", "(", "span", "!=", "null", ",", "\"span should not be null.\"", ")", ";", "Preconditions", ".", "checkArgument...
Propagate information of current tracing context. This information will be injected into HTTP header. @param span the span to be propagated. @param headers the headers used in propagation.
[ "Propagate", "information", "of", "current", "tracing", "context", ".", "This", "information", "will", "be", "injected", "into", "HTTP", "header", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/OpenCensusUtils.java#L132-L140
rjstanford/protea-http
src/main/java/cc/protea/util/http/Request.java
Request.writeResource
private Response writeResource(final String method, final String body) throws IOException { buildQueryString(); buildHeaders(); connection.setDoOutput(true); connection.setRequestMethod(method); writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(body); writer.close(); return readResponse(); }
java
private Response writeResource(final String method, final String body) throws IOException { buildQueryString(); buildHeaders(); connection.setDoOutput(true); connection.setRequestMethod(method); writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(body); writer.close(); return readResponse(); }
[ "private", "Response", "writeResource", "(", "final", "String", "method", ",", "final", "String", "body", ")", "throws", "IOException", "{", "buildQueryString", "(", ")", ";", "buildHeaders", "(", ")", ";", "connection", ".", "setDoOutput", "(", "true", ")", ...
A private method that handles issuing POST and PUT requests @param method POST or PUT @param body The body of the Message @return the {@link Response} from the server @throws IOException
[ "A", "private", "method", "that", "handles", "issuing", "POST", "and", "PUT", "requests" ]
train
https://github.com/rjstanford/protea-http/blob/4d4a18805639181a738faff199e39d58337169ea/src/main/java/cc/protea/util/http/Request.java#L221-L233
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subSeconds
public static long subSeconds(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.SECOND); }
java
public static long subSeconds(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.SECOND); }
[ "public", "static", "long", "subSeconds", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "SECOND", ")", ";", "}" ]
Get how many seconds between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many seconds between two date.
[ "Get", "how", "many", "seconds", "between", "two", "date", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L411-L414
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java
WaveformFinder.updateDetail
private void updateDetail(TrackMetadataUpdate update, WaveformDetail detail) { detailHotCache.put(DeckReference.getDeckReference(update.player, 0), detail); // Main deck if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well for (CueList.Entry entry : update.metadata.getCueList().entries) { if (entry.hotCueNumber != 0) { detailHotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), detail); } } } deliverWaveformDetailUpdate(update.player, detail); }
java
private void updateDetail(TrackMetadataUpdate update, WaveformDetail detail) { detailHotCache.put(DeckReference.getDeckReference(update.player, 0), detail); // Main deck if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well for (CueList.Entry entry : update.metadata.getCueList().entries) { if (entry.hotCueNumber != 0) { detailHotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), detail); } } } deliverWaveformDetailUpdate(update.player, detail); }
[ "private", "void", "updateDetail", "(", "TrackMetadataUpdate", "update", ",", "WaveformDetail", "detail", ")", "{", "detailHotCache", ".", "put", "(", "DeckReference", ".", "getDeckReference", "(", "update", ".", "player", ",", "0", ")", ",", "detail", ")", ";...
We have obtained waveform detail for a device, so store it and alert any listeners. @param update the update which caused us to retrieve this waveform detail @param detail the waveform detail which we retrieved
[ "We", "have", "obtained", "waveform", "detail", "for", "a", "device", "so", "store", "it", "and", "alert", "any", "listeners", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L301-L311
LearnLib/automatalib
commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java
AbstractLinkedList.insertAfterEntry
protected void insertAfterEntry(T e, T insertPos) { T oldNext = insertPos.getNext(); e.setNext(oldNext); e.setPrev(insertPos); insertPos.setNext(e); if (oldNext != null) { oldNext.setPrev(e); } else { last = e; } size++; }
java
protected void insertAfterEntry(T e, T insertPos) { T oldNext = insertPos.getNext(); e.setNext(oldNext); e.setPrev(insertPos); insertPos.setNext(e); if (oldNext != null) { oldNext.setPrev(e); } else { last = e; } size++; }
[ "protected", "void", "insertAfterEntry", "(", "T", "e", ",", "T", "insertPos", ")", "{", "T", "oldNext", "=", "insertPos", ".", "getNext", "(", ")", ";", "e", ".", "setNext", "(", "oldNext", ")", ";", "e", ".", "setPrev", "(", "insertPos", ")", ";", ...
Inserts a new entry <i>after</i> a given one. @param e the entry to add. @param insertPos the entry before which to add the new one.
[ "Inserts", "a", "new", "entry", "<i", ">", "after<", "/", "i", ">", "a", "given", "one", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java#L462-L473
Azure/azure-sdk-for-java
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java
SpatialAnchorsAccountsInner.updateAsync
public Observable<SpatialAnchorsAccountInner> updateAsync(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).map(new Func1<ServiceResponse<SpatialAnchorsAccountInner>, SpatialAnchorsAccountInner>() { @Override public SpatialAnchorsAccountInner call(ServiceResponse<SpatialAnchorsAccountInner> response) { return response.body(); } }); }
java
public Observable<SpatialAnchorsAccountInner> updateAsync(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) { return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).map(new Func1<ServiceResponse<SpatialAnchorsAccountInner>, SpatialAnchorsAccountInner>() { @Override public SpatialAnchorsAccountInner call(ServiceResponse<SpatialAnchorsAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SpatialAnchorsAccountInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "spatialAnchorsAccountName", ",", "SpatialAnchorsAccountInner", "spatialAnchorsAccount", ")", "{", "return", "updateWithServiceResponseAsync", "(", ...
Updating a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @param spatialAnchorsAccount Spatial Anchors Account parameter. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SpatialAnchorsAccountInner object
[ "Updating", "a", "Spatial", "Anchors", "Account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L544-L551
yanzhenjie/AndPermission
support/src/main/java/com/yanzhenjie/permission/AndPermission.java
AndPermission.hasAlwaysDeniedPermission
public static boolean hasAlwaysDeniedPermission(Fragment fragment, List<String> deniedPermissions) { return hasAlwaysDeniedPermission(new SupportFragmentSource(fragment), deniedPermissions); }
java
public static boolean hasAlwaysDeniedPermission(Fragment fragment, List<String> deniedPermissions) { return hasAlwaysDeniedPermission(new SupportFragmentSource(fragment), deniedPermissions); }
[ "public", "static", "boolean", "hasAlwaysDeniedPermission", "(", "Fragment", "fragment", ",", "List", "<", "String", ">", "deniedPermissions", ")", "{", "return", "hasAlwaysDeniedPermission", "(", "new", "SupportFragmentSource", "(", "fragment", ")", ",", "deniedPermi...
Some privileges permanently disabled, may need to set up in the execute. @param fragment {@link Fragment}. @param deniedPermissions one or more permissions. @return true, other wise is false.
[ "Some", "privileges", "permanently", "disabled", "may", "need", "to", "set", "up", "in", "the", "execute", "." ]
train
https://github.com/yanzhenjie/AndPermission/blob/bbfaaecdb8ecf0f2aa270d80c0b88d022dddda7c/support/src/main/java/com/yanzhenjie/permission/AndPermission.java#L106-L108
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java
OperationSupport.handleResponse
protected <T> T handleResponse(Request.Builder requestBuilder, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { return handleResponse(requestBuilder, type, Collections.<String, String>emptyMap()); }
java
protected <T> T handleResponse(Request.Builder requestBuilder, Class<T> type) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { return handleResponse(requestBuilder, type, Collections.<String, String>emptyMap()); }
[ "protected", "<", "T", ">", "T", "handleResponse", "(", "Request", ".", "Builder", "requestBuilder", ",", "Class", "<", "T", ">", "type", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "KubernetesClientException", ",", "IOException", "{", ...
Send an http request and handle the response. @param requestBuilder Request Builder object @param type type of resource @param <T> template argument provided @return Returns a de-serialized object as api server response of provided type. @throws ExecutionException Execution Exception @throws InterruptedException Interrupted Exception @throws KubernetesClientException KubernetesClientException @throws IOException IOException
[ "Send", "an", "http", "request", "and", "handle", "the", "response", "." ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java#L346-L348
ops4j/org.ops4j.pax.logging
pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/internal/PaxLoggingServiceImpl.java
PaxLoggingServiceImpl.getService
public Object getService( final Bundle bundle, ServiceRegistration registration ) { class ManagedPaxLoggingService implements PaxLoggingService, LogService, ManagedService { private final String fqcn = getClass().getName(); public void log( int level, String message ) { PaxLoggingServiceImpl.this.log(bundle, level, message, null, fqcn); } public void log( int level, String message, Throwable exception ) { PaxLoggingServiceImpl.this.log(bundle, level, message, exception, fqcn); } public void log( ServiceReference sr, int level, String message ) { Bundle b = bundle == null && sr != null ? sr.getBundle() : bundle; PaxLoggingServiceImpl.this.log(b, level, message, null, fqcn); } public void log( ServiceReference sr, int level, String message, Throwable exception ) { Bundle b = bundle == null && sr != null ? sr.getBundle() : bundle; PaxLoggingServiceImpl.this.log(b, level, message, exception, fqcn); } public int getLogLevel() { return PaxLoggingServiceImpl.this.getLogLevel(); } public PaxLogger getLogger( Bundle myBundle, String category, String fqcn ) { return PaxLoggingServiceImpl.this.getLogger( myBundle, category, fqcn ); } public void updated( Dictionary<String, ?> configuration ) throws ConfigurationException { PaxLoggingServiceImpl.this.updated( configuration ); } public PaxContext getPaxContext() { return PaxLoggingServiceImpl.this.getPaxContext(); } } return new ManagedPaxLoggingService(); }
java
public Object getService( final Bundle bundle, ServiceRegistration registration ) { class ManagedPaxLoggingService implements PaxLoggingService, LogService, ManagedService { private final String fqcn = getClass().getName(); public void log( int level, String message ) { PaxLoggingServiceImpl.this.log(bundle, level, message, null, fqcn); } public void log( int level, String message, Throwable exception ) { PaxLoggingServiceImpl.this.log(bundle, level, message, exception, fqcn); } public void log( ServiceReference sr, int level, String message ) { Bundle b = bundle == null && sr != null ? sr.getBundle() : bundle; PaxLoggingServiceImpl.this.log(b, level, message, null, fqcn); } public void log( ServiceReference sr, int level, String message, Throwable exception ) { Bundle b = bundle == null && sr != null ? sr.getBundle() : bundle; PaxLoggingServiceImpl.this.log(b, level, message, exception, fqcn); } public int getLogLevel() { return PaxLoggingServiceImpl.this.getLogLevel(); } public PaxLogger getLogger( Bundle myBundle, String category, String fqcn ) { return PaxLoggingServiceImpl.this.getLogger( myBundle, category, fqcn ); } public void updated( Dictionary<String, ?> configuration ) throws ConfigurationException { PaxLoggingServiceImpl.this.updated( configuration ); } public PaxContext getPaxContext() { return PaxLoggingServiceImpl.this.getPaxContext(); } } return new ManagedPaxLoggingService(); }
[ "public", "Object", "getService", "(", "final", "Bundle", "bundle", ",", "ServiceRegistration", "registration", ")", "{", "class", "ManagedPaxLoggingService", "implements", "PaxLoggingService", ",", "LogService", ",", "ManagedService", "{", "private", "final", "String",...
/* use local class to delegate calls to underlying instance while keeping bundle reference
[ "/", "*", "use", "local", "class", "to", "delegate", "calls", "to", "underlying", "instance", "while", "keeping", "bundle", "reference" ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/ops4j/pax/logging/log4j2/internal/PaxLoggingServiceImpl.java#L384-L436
aol/cyclops
cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java
Monos.firstSuccess
@SafeVarargs public static <T> Mono<T> firstSuccess(Mono<T>... fts) { return Mono.from(Future.firstSuccess(futures(fts))); }
java
@SafeVarargs public static <T> Mono<T> firstSuccess(Mono<T>... fts) { return Mono.from(Future.firstSuccess(futures(fts))); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Mono", "<", "T", ">", "firstSuccess", "(", "Mono", "<", "T", ">", "...", "fts", ")", "{", "return", "Mono", ".", "from", "(", "Future", ".", "firstSuccess", "(", "futures", "(", "fts", ")", ")...
Select the first Future to return with a successful result <pre> {@code Mono<Integer> ft = Mono.empty(); Mono<Integer> result = Monos.firstSuccess(Mono.deferred(()->1),ft); ft.complete(10); result.get() //1 } </pre> @param fts Monos to race @return First Mono to return with a result
[ "Select", "the", "first", "Future", "to", "return", "with", "a", "successful", "result" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-reactor-integration/src/main/java/cyclops/companion/reactor/Monos.java#L192-L196
jbundle/jbundle
thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/multitask/CalendarProduct.java
CalendarProduct.changeRemoteDate
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd) { productItem.setStatus(productItem.getStatus() | (1 << 3) | (1 << 2) | (1 << 1)); if (application == null) application = BaseApplet.getSharedInstance().getApplication(); application.getTaskScheduler().addTask(new CalendarDateChangeTask(application, strParams, productItem, dateStart, dateEnd)); }
java
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd) { productItem.setStatus(productItem.getStatus() | (1 << 3) | (1 << 2) | (1 << 1)); if (application == null) application = BaseApplet.getSharedInstance().getApplication(); application.getTaskScheduler().addTask(new CalendarDateChangeTask(application, strParams, productItem, dateStart, dateEnd)); }
[ "public", "void", "changeRemoteDate", "(", "Application", "application", ",", "String", "strParams", ",", "CachedItem", "productItem", ",", "Date", "dateStart", ",", "Date", "dateEnd", ")", "{", "productItem", ".", "setStatus", "(", "productItem", ".", "getStatus"...
Change the date of the actual data. Override this to change the date.
[ "Change", "the", "date", "of", "the", "actual", "data", ".", "Override", "this", "to", "change", "the", "date", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/multitask/CalendarProduct.java#L93-L100
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.getList
public List<T> getList(InputStream stream, OnJsonObjectAddListener listener) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return getList(parser, listener); }
java
public List<T> getList(InputStream stream, OnJsonObjectAddListener listener) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(stream); return getList(parser, listener); }
[ "public", "List", "<", "T", ">", "getList", "(", "InputStream", "stream", ",", "OnJsonObjectAddListener", "listener", ")", "throws", "IOException", ",", "JsonFormatException", "{", "JsonPullParser", "parser", "=", "JsonPullParser", ".", "newParser", "(", "stream", ...
Attempts to parse the given data as {@link List} of objects. Accepts {@link OnJsonObjectAddListener}; allows you to peek various intermittent instances as parsing goes. @param stream JSON-formatted data @param listener {@link OnJsonObjectAddListener} to notify @return {@link List} of objects @throws IOException @throws JsonFormatException The given data is malformed, or its type is unexpected
[ "Attempts", "to", "parse", "the", "given", "data", "as", "{", "@link", "List", "}", "of", "objects", ".", "Accepts", "{", "@link", "OnJsonObjectAddListener", "}", ";", "allows", "you", "to", "peek", "various", "intermittent", "instances", "as", "parsing", "g...
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L98-L102
real-logic/agrona
agrona/src/main/java/org/agrona/generation/CompilerUtil.java
CompilerUtil.compileInMemory
public static Class<?> compileInMemory(final String className, final Map<String, CharSequence> sources) throws ClassNotFoundException { final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (null == compiler) { throw new IllegalStateException("JDK required to run tests. JRE is not sufficient."); } final JavaFileManager fileManager = new ClassFileManager<>( compiler.getStandardFileManager(null, null, null)); final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); final JavaCompiler.CompilationTask task = compiler.getTask( null, fileManager, diagnostics, null, null, wrap(sources)); return compileAndLoad(className, diagnostics, fileManager, task); }
java
public static Class<?> compileInMemory(final String className, final Map<String, CharSequence> sources) throws ClassNotFoundException { final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (null == compiler) { throw new IllegalStateException("JDK required to run tests. JRE is not sufficient."); } final JavaFileManager fileManager = new ClassFileManager<>( compiler.getStandardFileManager(null, null, null)); final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); final JavaCompiler.CompilationTask task = compiler.getTask( null, fileManager, diagnostics, null, null, wrap(sources)); return compileAndLoad(className, diagnostics, fileManager, task); }
[ "public", "static", "Class", "<", "?", ">", "compileInMemory", "(", "final", "String", "className", ",", "final", "Map", "<", "String", ",", "CharSequence", ">", "sources", ")", "throws", "ClassNotFoundException", "{", "final", "JavaCompiler", "compiler", "=", ...
Compile a {@link Map} of source files in-memory resulting in a {@link Class} which is named. @param className to return after compilation. @param sources to be compiled. @return the named class that is the result of the compilation. @throws ClassNotFoundException of the named class cannot be found.
[ "Compile", "a", "{", "@link", "Map", "}", "of", "source", "files", "in", "-", "memory", "resulting", "in", "a", "{", "@link", "Class", "}", "which", "is", "named", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/generation/CompilerUtil.java#L50-L66
drewnoakes/metadata-extractor
Source/com/drew/lang/RandomAccessReader.java
RandomAccessReader.getNullTerminatedString
@NotNull public String getNullTerminatedString(int index, int maxLengthBytes, @NotNull Charset charset) throws IOException { return new String(getNullTerminatedBytes(index, maxLengthBytes), charset.name()); }
java
@NotNull public String getNullTerminatedString(int index, int maxLengthBytes, @NotNull Charset charset) throws IOException { return new String(getNullTerminatedBytes(index, maxLengthBytes), charset.name()); }
[ "@", "NotNull", "public", "String", "getNullTerminatedString", "(", "int", "index", ",", "int", "maxLengthBytes", ",", "@", "NotNull", "Charset", "charset", ")", "throws", "IOException", "{", "return", "new", "String", "(", "getNullTerminatedBytes", "(", "index", ...
Creates a String from the _data buffer starting at the specified index, and ending where <code>byte=='\0'</code> or where <code>length==maxLength</code>. @param index The index within the buffer at which to start reading the string. @param maxLengthBytes The maximum number of bytes to read. If a zero-byte is not reached within this limit, reading will stop and the string will be truncated to this length. @return The read string. @throws IOException The buffer does not contain enough bytes to satisfy this request.
[ "Creates", "a", "String", "from", "the", "_data", "buffer", "starting", "at", "the", "specified", "index", "and", "ending", "where", "<code", ">", "byte", "==", "\\", "0", "<", "/", "code", ">", "or", "where", "<code", ">", "length", "==", "maxLength<", ...
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/lang/RandomAccessReader.java#L404-L408
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java
Partitioner.getGlobalPartition
public Partition getGlobalPartition(long previousWatermark) { ExtractType extractType = ExtractType.valueOf(state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_EXTRACT_TYPE).toUpperCase()); WatermarkType watermarkType = WatermarkType.valueOf( state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, ConfigurationKeys.DEFAULT_WATERMARK_TYPE) .toUpperCase()); WatermarkPredicate watermark = new WatermarkPredicate(null, watermarkType); int deltaForNextWatermark = watermark.getDeltaNumForNextWatermark(); long lowWatermark = getLowWatermark(extractType, watermarkType, previousWatermark, deltaForNextWatermark); long highWatermark = getHighWatermark(extractType, watermarkType); return new Partition(lowWatermark, highWatermark, true, hasUserSpecifiedHighWatermark); }
java
public Partition getGlobalPartition(long previousWatermark) { ExtractType extractType = ExtractType.valueOf(state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_EXTRACT_TYPE).toUpperCase()); WatermarkType watermarkType = WatermarkType.valueOf( state.getProp(ConfigurationKeys.SOURCE_QUERYBASED_WATERMARK_TYPE, ConfigurationKeys.DEFAULT_WATERMARK_TYPE) .toUpperCase()); WatermarkPredicate watermark = new WatermarkPredicate(null, watermarkType); int deltaForNextWatermark = watermark.getDeltaNumForNextWatermark(); long lowWatermark = getLowWatermark(extractType, watermarkType, previousWatermark, deltaForNextWatermark); long highWatermark = getHighWatermark(extractType, watermarkType); return new Partition(lowWatermark, highWatermark, true, hasUserSpecifiedHighWatermark); }
[ "public", "Partition", "getGlobalPartition", "(", "long", "previousWatermark", ")", "{", "ExtractType", "extractType", "=", "ExtractType", ".", "valueOf", "(", "state", ".", "getProp", "(", "ConfigurationKeys", ".", "SOURCE_QUERYBASED_EXTRACT_TYPE", ")", ".", "toUpper...
Get the global partition of the whole data set, which has the global low and high watermarks @param previousWatermark previous watermark for computing the low watermark of current run @return a Partition instance
[ "Get", "the", "global", "partition", "of", "the", "whole", "data", "set", "which", "has", "the", "global", "low", "and", "high", "watermarks" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java#L95-L108
aws/aws-sdk-java
aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextResult.java
PostTextResult.withSessionAttributes
public PostTextResult withSessionAttributes(java.util.Map<String, String> sessionAttributes) { setSessionAttributes(sessionAttributes); return this; }
java
public PostTextResult withSessionAttributes(java.util.Map<String, String> sessionAttributes) { setSessionAttributes(sessionAttributes); return this; }
[ "public", "PostTextResult", "withSessionAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sessionAttributes", ")", "{", "setSessionAttributes", "(", "sessionAttributes", ")", ";", "return", "this", ";", "}" ]
<p> A map of key-value pairs representing the session-specific context information. </p> @param sessionAttributes A map of key-value pairs representing the session-specific context information. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "key", "-", "value", "pairs", "representing", "the", "session", "-", "specific", "context", "information", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextResult.java#L368-L371
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java
ExpressRouteGatewaysInner.createOrUpdate
public ExpressRouteGatewayInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().last().body(); }
java
public ExpressRouteGatewayInner createOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().last().body(); }
[ "public", "ExpressRouteGatewayInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ",", "ExpressRouteGatewayInner", "putExpressRouteGatewayParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGro...
Creates or updates a ExpressRoute gateway in a specified resource group. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param putExpressRouteGatewayParameters Parameters required in an ExpressRoute gateway PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteGatewayInner object if successful.
[ "Creates", "or", "updates", "a", "ExpressRoute", "gateway", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java#L270-L272
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepository.java
MarkLogicRepository.getMarkLogicClient
@Override public synchronized MarkLogicClient getMarkLogicClient() { if(null != databaseClient){ this.client = new MarkLogicClient(databaseClient); }else{ this.client = new MarkLogicClient(host, port, user, password, auth); } return this.client; }
java
@Override public synchronized MarkLogicClient getMarkLogicClient() { if(null != databaseClient){ this.client = new MarkLogicClient(databaseClient); }else{ this.client = new MarkLogicClient(host, port, user, password, auth); } return this.client; }
[ "@", "Override", "public", "synchronized", "MarkLogicClient", "getMarkLogicClient", "(", ")", "{", "if", "(", "null", "!=", "databaseClient", ")", "{", "this", ".", "client", "=", "new", "MarkLogicClient", "(", "databaseClient", ")", ";", "}", "else", "{", "...
returns MarkLogicClient object which manages communication to ML server via Java api client @return MarkLogicClient
[ "returns", "MarkLogicClient", "object", "which", "manages", "communication", "to", "ML", "server", "via", "Java", "api", "client" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepository.java#L231-L239
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPOptionLocalServiceBaseImpl.java
CPOptionLocalServiceBaseImpl.getCPOptionByUuidAndGroupId
@Override public CPOption getCPOptionByUuidAndGroupId(String uuid, long groupId) throws PortalException { return cpOptionPersistence.findByUUID_G(uuid, groupId); }
java
@Override public CPOption getCPOptionByUuidAndGroupId(String uuid, long groupId) throws PortalException { return cpOptionPersistence.findByUUID_G(uuid, groupId); }
[ "@", "Override", "public", "CPOption", "getCPOptionByUuidAndGroupId", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "PortalException", "{", "return", "cpOptionPersistence", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the cp option matching the UUID and group. @param uuid the cp option's UUID @param groupId the primary key of the group @return the matching cp option @throws PortalException if a matching cp option could not be found
[ "Returns", "the", "cp", "option", "matching", "the", "UUID", "and", "group", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPOptionLocalServiceBaseImpl.java#L425-L429
undertow-io/undertow
core/src/main/java/io/undertow/websockets/client/WebSocketClient.java
WebSocketClient.connectionBuilder
public static ConnectionBuilder connectionBuilder(XnioWorker worker, ByteBufferPool bufferPool, URI uri) { return new ConnectionBuilder(worker, bufferPool, uri); }
java
public static ConnectionBuilder connectionBuilder(XnioWorker worker, ByteBufferPool bufferPool, URI uri) { return new ConnectionBuilder(worker, bufferPool, uri); }
[ "public", "static", "ConnectionBuilder", "connectionBuilder", "(", "XnioWorker", "worker", ",", "ByteBufferPool", "bufferPool", ",", "URI", "uri", ")", "{", "return", "new", "ConnectionBuilder", "(", "worker", ",", "bufferPool", ",", "uri", ")", ";", "}" ]
Creates a new connection builder that can be used to create a web socket connection. @param worker The XnioWorker to use for the connection @param bufferPool The buffer pool @param uri The connection URI @return The connection builder
[ "Creates", "a", "new", "connection", "builder", "that", "can", "be", "used", "to", "create", "a", "web", "socket", "connection", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/client/WebSocketClient.java#L386-L388
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.getPhoto
public Photo getPhoto(String id, String secret) throws FlickrException { return getInfo(id, secret); }
java
public Photo getPhoto(String id, String secret) throws FlickrException { return getInfo(id, secret); }
[ "public", "Photo", "getPhoto", "(", "String", "id", ",", "String", "secret", ")", "throws", "FlickrException", "{", "return", "getInfo", "(", "id", ",", "secret", ")", ";", "}" ]
Get the photo for the specified ID with the given secret. Currently maps to the getInfo() method. @param id The ID @param secret The secret @return The Photo
[ "Get", "the", "photo", "for", "the", "specified", "ID", "with", "the", "given", "secret", ".", "Currently", "maps", "to", "the", "getInfo", "()", "method", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1324-L1326
Impetus/Kundera
src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java
SparkClient.executeQuery
public List executeQuery(String query, EntityMetadata m, KunderaQuery kunderaQuery) { DataFrame dataFrame = getDataFrame(query, m, kunderaQuery); // dataFrame.show(); return dataHandler.loadDataAndPopulateResults(dataFrame, m, kunderaQuery); }
java
public List executeQuery(String query, EntityMetadata m, KunderaQuery kunderaQuery) { DataFrame dataFrame = getDataFrame(query, m, kunderaQuery); // dataFrame.show(); return dataHandler.loadDataAndPopulateResults(dataFrame, m, kunderaQuery); }
[ "public", "List", "executeQuery", "(", "String", "query", ",", "EntityMetadata", "m", ",", "KunderaQuery", "kunderaQuery", ")", "{", "DataFrame", "dataFrame", "=", "getDataFrame", "(", "query", ",", "m", ",", "kunderaQuery", ")", ";", "// dataFrame.show();", "re...
Execute query. @param query the query @param m the m @param kunderaQuery the kundera query @return the list
[ "Execute", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-spark/spark-core/src/main/java/com/impetus/spark/client/SparkClient.java#L314-L320
Azure/azure-sdk-for-java
features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeaturesInner.java
FeaturesInner.getAsync
public Observable<FeatureResultInner> getAsync(String resourceProviderNamespace, String featureName) { return getWithServiceResponseAsync(resourceProviderNamespace, featureName).map(new Func1<ServiceResponse<FeatureResultInner>, FeatureResultInner>() { @Override public FeatureResultInner call(ServiceResponse<FeatureResultInner> response) { return response.body(); } }); }
java
public Observable<FeatureResultInner> getAsync(String resourceProviderNamespace, String featureName) { return getWithServiceResponseAsync(resourceProviderNamespace, featureName).map(new Func1<ServiceResponse<FeatureResultInner>, FeatureResultInner>() { @Override public FeatureResultInner call(ServiceResponse<FeatureResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FeatureResultInner", ">", "getAsync", "(", "String", "resourceProviderNamespace", ",", "String", "featureName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceProviderNamespace", ",", "featureName", ")", ".", "map", "(", ...
Gets the preview feature with the specified name. @param resourceProviderNamespace The resource provider namespace for the feature. @param featureName The name of the feature to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FeatureResultInner object
[ "Gets", "the", "preview", "feature", "with", "the", "specified", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/features/resource-manager/v2015_12_01/src/main/java/com/microsoft/azure/management/features/v2015_12_01/implementation/FeaturesInner.java#L344-L351
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Expression.java
Expression.lessThanOrEqualTo
@NonNull public Expression lessThanOrEqualTo(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThanOrEqualTo); }
java
@NonNull public Expression lessThanOrEqualTo(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThanOrEqualTo); }
[ "@", "NonNull", "public", "Expression", "lessThanOrEqualTo", "(", "@", "NonNull", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expression cannot be null.\"", ")", ";", "}...
Create a less than or equal to expression that evaluates whether or not the current expression is less than or equal to the given expression. @param expression the expression to compare with the current expression. @return a less than or equal to expression.
[ "Create", "a", "less", "than", "or", "equal", "to", "expression", "that", "evaluates", "whether", "or", "not", "the", "current", "expression", "is", "less", "than", "or", "equal", "to", "the", "given", "expression", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L630-L636
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java
ImageClient.insertImage
@BetaApi public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) { InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder() .setForceCreate(forceCreate) .setProject(project) .setImageResource(imageResource) .build(); return insertImage(request); }
java
@BetaApi public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) { InsertImageHttpRequest request = InsertImageHttpRequest.newBuilder() .setForceCreate(forceCreate) .setProject(project) .setImageResource(imageResource) .build(); return insertImage(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertImage", "(", "Boolean", "forceCreate", ",", "String", "project", ",", "Image", "imageResource", ")", "{", "InsertImageHttpRequest", "request", "=", "InsertImageHttpRequest", ".", "newBuilder", "(", ")", ".", "...
Creates an image in the specified project using the data included in the request. <p>Sample code: <pre><code> try (ImageClient imageClient = ImageClient.create()) { Boolean forceCreate = false; ProjectName project = ProjectName.of("[PROJECT]"); Image imageResource = Image.newBuilder().build(); Operation response = imageClient.insertImage(forceCreate, project.toString(), imageResource); } </code></pre> @param forceCreate Force image creation if true. @param project Project ID for this request. @param imageResource An Image resource. (== resource_for beta.images ==) (== resource_for v1.images ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "image", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java#L715-L725
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java
StringUtils.substituteValueInExpression
public static String substituteValueInExpression(String expression, String newValue) { ExpressionTemplate t = new ExpressionTemplate(expression); if (newValue != null && (getExpressionKey(t.getTemplate()) == null || (t.isComplex() && !newValue.equals(t.getValue())))) return newValue; String result = t.getSubstitution(); if (!t.isComplex() && newValue != null) { int start = result.lastIndexOf(":$"); start = result.indexOf(":", start + 1); int end = result.indexOf("}", start + 1); if (start < 0 || end < 0 || start == result.lastIndexOf("${:}") + 2) return result; result = result.substring(0, start + 1) + newValue + result.substring(end); } return result; }
java
public static String substituteValueInExpression(String expression, String newValue) { ExpressionTemplate t = new ExpressionTemplate(expression); if (newValue != null && (getExpressionKey(t.getTemplate()) == null || (t.isComplex() && !newValue.equals(t.getValue())))) return newValue; String result = t.getSubstitution(); if (!t.isComplex() && newValue != null) { int start = result.lastIndexOf(":$"); start = result.indexOf(":", start + 1); int end = result.indexOf("}", start + 1); if (start < 0 || end < 0 || start == result.lastIndexOf("${:}") + 2) return result; result = result.substring(0, start + 1) + newValue + result.substring(end); } return result; }
[ "public", "static", "String", "substituteValueInExpression", "(", "String", "expression", ",", "String", "newValue", ")", "{", "ExpressionTemplate", "t", "=", "new", "ExpressionTemplate", "(", "expression", ")", ";", "if", "(", "newValue", "!=", "null", "&&", "(...
Substitutes a default value in expression by a new one @param expression to check @param newValue to substitute @return resulting expression
[ "Substitutes", "a", "default", "value", "in", "expression", "by", "a", "new", "one" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java#L73-L93
jblas-project/jblas
src/main/java/org/jblas/Eigen.java
Eigen.symmetricGeneralizedEigenvalues
public static DoubleMatrix symmetricGeneralizedEigenvalues(DoubleMatrix A, DoubleMatrix B) { A.assertSquare(); B.assertSquare(); DoubleMatrix W = new DoubleMatrix(A.rows); SimpleBlas.sygvd(1, 'N', 'U', A.dup(), B.dup(), W); return W; }
java
public static DoubleMatrix symmetricGeneralizedEigenvalues(DoubleMatrix A, DoubleMatrix B) { A.assertSquare(); B.assertSquare(); DoubleMatrix W = new DoubleMatrix(A.rows); SimpleBlas.sygvd(1, 'N', 'U', A.dup(), B.dup(), W); return W; }
[ "public", "static", "DoubleMatrix", "symmetricGeneralizedEigenvalues", "(", "DoubleMatrix", "A", ",", "DoubleMatrix", "B", ")", "{", "A", ".", "assertSquare", "(", ")", ";", "B", ".", "assertSquare", "(", ")", ";", "DoubleMatrix", "W", "=", "new", "DoubleMatri...
Compute generalized eigenvalues of the problem A x = L B x. @param A symmetric Matrix A. Only the upper triangle will be considered. @param B symmetric Matrix B. Only the upper triangle will be considered. @return a vector of eigenvalues L.
[ "Compute", "generalized", "eigenvalues", "of", "the", "problem", "A", "x", "=", "L", "B", "x", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Eigen.java#L134-L140
OpenLiberty/open-liberty
dev/com.ibm.ws.junit.extensions/src/com/ibm/websphere/ras/CapturedOutputHolder.java
CapturedOutputHolder.writeCapturedData
private synchronized ByteArrayOutputStream writeCapturedData(SystemLogHolder holder, String txt, ByteArrayOutputStream capturedStream) { try { capturedStream.write(txt.getBytes()); // If we're running in an Eclipse GUI, tee the output for usability if (IS_RUNNING_IN_ECLIPSE) { if (holder == systemErr && err != null) { err.println(txt); } else if (out != null) { out.println(txt); } } capturedStream.write(nl.getBytes()); return capturedStream; } catch (IOException ioe) { super.writeStreamOutput(systemErr, "Unable to write/contain captured trace data", true); super.writeStreamOutput(holder, txt, false); return null; } }
java
private synchronized ByteArrayOutputStream writeCapturedData(SystemLogHolder holder, String txt, ByteArrayOutputStream capturedStream) { try { capturedStream.write(txt.getBytes()); // If we're running in an Eclipse GUI, tee the output for usability if (IS_RUNNING_IN_ECLIPSE) { if (holder == systemErr && err != null) { err.println(txt); } else if (out != null) { out.println(txt); } } capturedStream.write(nl.getBytes()); return capturedStream; } catch (IOException ioe) { super.writeStreamOutput(systemErr, "Unable to write/contain captured trace data", true); super.writeStreamOutput(holder, txt, false); return null; } }
[ "private", "synchronized", "ByteArrayOutputStream", "writeCapturedData", "(", "SystemLogHolder", "holder", ",", "String", "txt", ",", "ByteArrayOutputStream", "capturedStream", ")", "{", "try", "{", "capturedStream", ".", "write", "(", "txt", ".", "getBytes", "(", "...
Write the text from the string (and the text for a newline) into the captured byte array. If all is well, return the hushed stream for the next write. If there is an exception writing to the stream, return null to disable subsequent writes. @param holder LogHolder : system err or system out @param txt Text to be logged @param capturedStream stream holding captured data @return capturedStream if all is well, null if an exception occurred writing to the stream
[ "Write", "the", "text", "from", "the", "string", "(", "and", "the", "text", "for", "a", "newline", ")", "into", "the", "captured", "byte", "array", ".", "If", "all", "is", "well", "return", "the", "hushed", "stream", "for", "the", "next", "write", ".",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.junit.extensions/src/com/ibm/websphere/ras/CapturedOutputHolder.java#L192-L211
liferay/com-liferay-commerce
commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java
CommerceCurrencyPersistenceImpl.removeByG_P_A
@Override public void removeByG_P_A(long groupId, boolean primary, boolean active) { for (CommerceCurrency commerceCurrency : findByG_P_A(groupId, primary, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCurrency); } }
java
@Override public void removeByG_P_A(long groupId, boolean primary, boolean active) { for (CommerceCurrency commerceCurrency : findByG_P_A(groupId, primary, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCurrency); } }
[ "@", "Override", "public", "void", "removeByG_P_A", "(", "long", "groupId", ",", "boolean", "primary", ",", "boolean", "active", ")", "{", "for", "(", "CommerceCurrency", "commerceCurrency", ":", "findByG_P_A", "(", "groupId", ",", "primary", ",", "active", ",...
Removes all the commerce currencies where groupId = &#63; and primary = &#63; and active = &#63; from the database. @param groupId the group ID @param primary the primary @param active the active
[ "Removes", "all", "the", "commerce", "currencies", "where", "groupId", "=", "&#63", ";", "and", "primary", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L3847-L3853
opoo/opoopress
core/src/main/java/org/opoo/util/ArrayUtils.java
ArrayUtils.find
public static <T> T find(T[] array, Predicate<T> predicate){ if(array == null){ return null; } for(T t: array){ if(predicate.apply(t)){ return t; } } return null; }
java
public static <T> T find(T[] array, Predicate<T> predicate){ if(array == null){ return null; } for(T t: array){ if(predicate.apply(t)){ return t; } } return null; }
[ "public", "static", "<", "T", ">", "T", "find", "(", "T", "[", "]", "array", ",", "Predicate", "<", "T", ">", "predicate", ")", "{", "if", "(", "array", "==", "null", ")", "{", "return", "null", ";", "}", "for", "(", "T", "t", ":", "array", "...
Returns the first element in {@code array} that satisfies the given predicate. @param array @param predicate @param <T> @return
[ "Returns", "the", "first", "element", "in", "{", "@code", "array", "}", "that", "satisfies", "the", "given", "predicate", "." ]
train
https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/util/ArrayUtils.java#L36-L46
codeprimate-software/cp-elements
src/main/java/org/cp/elements/beans/AbstractBean.java
AbstractBean.changeState
void changeState(String propertyName, Object newValue) { try { ObjectUtils.setField(this, getFieldName(propertyName), newValue); } catch (IllegalArgumentException e) { throw new PropertyNotFoundException(String.format( "The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!", propertyName, getFieldName(propertyName), getClass().getName()), e); } }
java
void changeState(String propertyName, Object newValue) { try { ObjectUtils.setField(this, getFieldName(propertyName), newValue); } catch (IllegalArgumentException e) { throw new PropertyNotFoundException(String.format( "The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!", propertyName, getFieldName(propertyName), getClass().getName()), e); } }
[ "void", "changeState", "(", "String", "propertyName", ",", "Object", "newValue", ")", "{", "try", "{", "ObjectUtils", ".", "setField", "(", "this", ",", "getFieldName", "(", "propertyName", ")", ",", "newValue", ")", ";", "}", "catch", "(", "IllegalArgumentE...
Changes the value of the given property, referenced by name, to the new Object value, effectively modifying the internal state of this Bean. This method uses the Java reflective APIs to set the field corresponding to the specified property. @param propertyName a String value specifying the name of the property (internally, the field) to set to the new Object value. @param newValue an Object containing the new value for the given property (internally, the field). @throws PropertyNotFoundException if property referenced by name is not a property of this Bean. This Exception occurs when the field for the corresponding property does not exist. @see #getFieldName(String)
[ "Changes", "the", "value", "of", "the", "given", "property", "referenced", "by", "name", "to", "the", "new", "Object", "value", "effectively", "modifying", "the", "internal", "state", "of", "this", "Bean", ".", "This", "method", "uses", "the", "Java", "refle...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L444-L453
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java
HttpUtils.executeGet
public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters) { try { return executeGet(url, basicAuthUsername, basicAuthPassword, parameters, new HashMap<>()); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
java
public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters) { try { return executeGet(url, basicAuthUsername, basicAuthPassword, parameters, new HashMap<>()); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
[ "public", "static", "HttpResponse", "executeGet", "(", "final", "String", "url", ",", "final", "String", "basicAuthUsername", ",", "final", "String", "basicAuthPassword", ",", "final", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "try", "{...
Execute get http response. @param url the url @param basicAuthUsername the basic auth username @param basicAuthPassword the basic auth password @param parameters the parameters @return the http response
[ "Execute", "get", "http", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java#L195-L205
casmi/casmi
src/main/java/casmi/graphics/material/Material.java
Material.setSpecular
public void setSpecular(float red, float green, float blue){ specular[0] = red; specular[1] = green; specular[2] = blue; Sp = true; }
java
public void setSpecular(float red, float green, float blue){ specular[0] = red; specular[1] = green; specular[2] = blue; Sp = true; }
[ "public", "void", "setSpecular", "(", "float", "red", ",", "float", "green", ",", "float", "blue", ")", "{", "specular", "[", "0", "]", "=", "red", ";", "specular", "[", "1", "]", "=", "green", ";", "specular", "[", "2", "]", "=", "blue", ";", "S...
Sets the specular color of the materials used for shapes drawn to the screen. @param red The red color of the specular. @param green The green color of the specular. @param blue The blue color of the specular.
[ "Sets", "the", "specular", "color", "of", "the", "materials", "used", "for", "shapes", "drawn", "to", "the", "screen", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/material/Material.java#L168-L173
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_PUT
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, OvhOvhPabxDialplanExtension body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, OvhOvhPabxDialplanExtension body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "OvhOvhPabxDialplanExtension", "body", ")", "throws",...
Alter this object properties REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7051-L7055
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.setFieldValue
public static void setFieldValue(Object object, Class<?> clazz, String fieldName, Object value) { Field field = getField(clazz, fieldName); if(object == null ^ Modifier.isStatic(field.getModifiers())) { throw new BugError("Cannot access static field |%s| from instance |%s|.", fieldName, clazz); } setFieldValue(object, field, value); }
java
public static void setFieldValue(Object object, Class<?> clazz, String fieldName, Object value) { Field field = getField(clazz, fieldName); if(object == null ^ Modifier.isStatic(field.getModifiers())) { throw new BugError("Cannot access static field |%s| from instance |%s|.", fieldName, clazz); } setFieldValue(object, field, value); }
[ "public", "static", "void", "setFieldValue", "(", "Object", "object", ",", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ",", "Object", "value", ")", "{", "Field", "field", "=", "getField", "(", "clazz", ",", "fieldName", ")", ";", "if", ...
Set instance field declared into superclass. Try to set field value throwing exception if field is not declared into superclass; if field is static object instance should be null. @param object instance to set field value to or null if field is static, @param clazz instance superclass where field is declared, @param fieldName field name, @param value field value. @throws NoSuchBeingException if field not found. @throws BugError if object is null and field is not static or if object is not null and field is static.
[ "Set", "instance", "field", "declared", "into", "superclass", ".", "Try", "to", "set", "field", "value", "throwing", "exception", "if", "field", "is", "not", "declared", "into", "superclass", ";", "if", "field", "is", "static", "object", "instance", "should", ...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L888-L895
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java
MinimizeEnergyPrune.computeSegmentEnergy
protected double computeSegmentEnergy(GrowQueue_I32 corners, int cornerA, int cornerB) { int indexA = corners.get(cornerA); int indexB = corners.get(cornerB); if( indexA == indexB ) { return 100000.0; } Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); line.p.x = a.x; line.p.y = a.y; line.slope.set(b.x-a.x,b.y-a.y); double total = 0; int length = circularDistance(indexA,indexB); for (int k = 1; k < length; k++) { Point2D_I32 c = getContour(indexA + 1 + k); point.set(c.x, c.y); total += Distance2D_F64.distanceSq(line, point); } return (total+ splitPenalty)/a.distance2(b); }
java
protected double computeSegmentEnergy(GrowQueue_I32 corners, int cornerA, int cornerB) { int indexA = corners.get(cornerA); int indexB = corners.get(cornerB); if( indexA == indexB ) { return 100000.0; } Point2D_I32 a = contour.get(indexA); Point2D_I32 b = contour.get(indexB); line.p.x = a.x; line.p.y = a.y; line.slope.set(b.x-a.x,b.y-a.y); double total = 0; int length = circularDistance(indexA,indexB); for (int k = 1; k < length; k++) { Point2D_I32 c = getContour(indexA + 1 + k); point.set(c.x, c.y); total += Distance2D_F64.distanceSq(line, point); } return (total+ splitPenalty)/a.distance2(b); }
[ "protected", "double", "computeSegmentEnergy", "(", "GrowQueue_I32", "corners", ",", "int", "cornerA", ",", "int", "cornerB", ")", "{", "int", "indexA", "=", "corners", ".", "get", "(", "cornerA", ")", ";", "int", "indexB", "=", "corners", ".", "get", "(",...
Computes the energy for a segment defined by the two corner indexes
[ "Computes", "the", "energy", "for", "a", "segment", "defined", "by", "the", "two", "corner", "indexes" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/MinimizeEnergyPrune.java#L210-L236
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getObtainJSONData
public LRResult getObtainJSONData(String resumptionToken) throws LRException { return getObtainJSONData(null, null, null, null, resumptionToken); }
java
public LRResult getObtainJSONData(String resumptionToken) throws LRException { return getObtainJSONData(null, null, null, null, resumptionToken); }
[ "public", "LRResult", "getObtainJSONData", "(", "String", "resumptionToken", ")", "throws", "LRException", "{", "return", "getObtainJSONData", "(", "null", ",", "null", ",", "null", ",", "null", ",", "resumptionToken", ")", ";", "}" ]
Get a result from an obtain request @param resumptionToken the "resumption_token" value to use for this request @return the result from this request
[ "Get", "a", "result", "from", "an", "obtain", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L217-L220
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/calls/LocalCall.java
LocalCall.callAsync
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target, AuthMethod auth, Batch batch) { return callAsync(client, target, auth, Optional.of(batch)); }
java
public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target, AuthMethod auth, Batch batch) { return callAsync(client, target, auth, Optional.of(batch)); }
[ "public", "CompletionStage", "<", "Optional", "<", "LocalAsyncResult", "<", "R", ">", ">", ">", "callAsync", "(", "final", "SaltClient", "client", ",", "Target", "<", "?", ">", "target", ",", "AuthMethod", "auth", ",", "Batch", "batch", ")", "{", "return",...
Calls a execution module function on the given target asynchronously and returns information about the scheduled job that can be used to query the result. Authentication is done with the token therefore you have to login prior to using this function. @param client SaltClient instance @param target the target for the function @param auth authentication credentials to use @param batch parameter for enabling and configuring batching @return information about the scheduled job
[ "Calls", "a", "execution", "module", "function", "on", "the", "given", "target", "asynchronously", "and", "returns", "information", "about", "the", "scheduled", "job", "that", "can", "be", "used", "to", "query", "the", "result", ".", "Authentication", "is", "d...
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L128-L131
alb-i986/selenium-tinafw
src/main/java/me/alb_i986/selenium/tinafw/ui/PageHelper.java
PageHelper.assertElementIsNotDisplayed
public static void assertElementIsNotDisplayed(By locator, WebDriver driver) { try { waitUntil(ExpectedConditions.visibilityOfElementLocated(locator), driver); throw new AssertionError("[assert KO] element " + locator + " is displayed; expected: NOT displayed"); } catch(TimeoutException e) { logger.info("[assert OK] element " + locator + " is NOT displayed as expected"); } }
java
public static void assertElementIsNotDisplayed(By locator, WebDriver driver) { try { waitUntil(ExpectedConditions.visibilityOfElementLocated(locator), driver); throw new AssertionError("[assert KO] element " + locator + " is displayed; expected: NOT displayed"); } catch(TimeoutException e) { logger.info("[assert OK] element " + locator + " is NOT displayed as expected"); } }
[ "public", "static", "void", "assertElementIsNotDisplayed", "(", "By", "locator", ",", "WebDriver", "driver", ")", "{", "try", "{", "waitUntil", "(", "ExpectedConditions", ".", "visibilityOfElementLocated", "(", "locator", ")", ",", "driver", ")", ";", "throw", "...
Explicitly wait until the given element is visible. If it is, throw {@link AssertionError}; else, do nothing. @param locator @param driver @throws AssertionError if element is visible
[ "Explicitly", "wait", "until", "the", "given", "element", "is", "visible", ".", "If", "it", "is", "throw", "{", "@link", "AssertionError", "}", ";", "else", "do", "nothing", "." ]
train
https://github.com/alb-i986/selenium-tinafw/blob/91c66720cda9f69751f96c58c0a0624b2222186e/src/main/java/me/alb_i986/selenium/tinafw/ui/PageHelper.java#L94-L101
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/modules/CmsModulesUploadFromServer.java
CmsModulesUploadFromServer.getModulesFromServer
private List getModulesFromServer() { List result = new ArrayList(); // get the systems-exportpath String exportpath = OpenCms.getSystemInfo().getPackagesRfsPath(); exportpath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(exportpath + "modules"); File folder = new File(exportpath); // get a list of all files String[] list = folder.list(); for (int i = 0; i < list.length; i++) { try { File diskFile = new File(exportpath, list[i]); // check if it is a file and ends with zip -> this is a module if (diskFile.isFile() && diskFile.getName().endsWith(".zip")) { result.add(new CmsSelectWidgetOption(diskFile.getName())); } else if (diskFile.isDirectory() && ((new File(diskFile + File.separator + "manifest.xml")).exists())) { // this is a folder with manifest file -> this a module result.add(new CmsSelectWidgetOption(diskFile.getName())); } } catch (Throwable t) { // ignore and continue } } Collections.sort(result, new ComparatorSelectWidgetOption()); return result; }
java
private List getModulesFromServer() { List result = new ArrayList(); // get the systems-exportpath String exportpath = OpenCms.getSystemInfo().getPackagesRfsPath(); exportpath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(exportpath + "modules"); File folder = new File(exportpath); // get a list of all files String[] list = folder.list(); for (int i = 0; i < list.length; i++) { try { File diskFile = new File(exportpath, list[i]); // check if it is a file and ends with zip -> this is a module if (diskFile.isFile() && diskFile.getName().endsWith(".zip")) { result.add(new CmsSelectWidgetOption(diskFile.getName())); } else if (diskFile.isDirectory() && ((new File(diskFile + File.separator + "manifest.xml")).exists())) { // this is a folder with manifest file -> this a module result.add(new CmsSelectWidgetOption(diskFile.getName())); } } catch (Throwable t) { // ignore and continue } } Collections.sort(result, new ComparatorSelectWidgetOption()); return result; }
[ "private", "List", "getModulesFromServer", "(", ")", "{", "List", "result", "=", "new", "ArrayList", "(", ")", ";", "// get the systems-exportpath", "String", "exportpath", "=", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "getPackagesRfsPath", "(", ")", ";",...
Returns the list of all modules available on the server in prepared CmsSelectWidgetOption objects.<p> @return List of module names in CmsSelectWidgetOption objects
[ "Returns", "the", "list", "of", "all", "modules", "available", "on", "the", "server", "in", "prepared", "CmsSelectWidgetOption", "objects", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsModulesUploadFromServer.java#L258-L287
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static int encodeDesc(byte[] value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } return encode(value, 0, value.length, dst, dstOffset, -1); }
java
public static int encodeDesc(byte[] value, byte[] dst, int dstOffset) { if (value == null) { dst[dstOffset] = NULL_BYTE_LOW; return 1; } return encode(value, 0, value.length, dst, dstOffset, -1); }
[ "public", "static", "int", "encodeDesc", "(", "byte", "[", "]", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "if", "(", "value", "==", "null", ")", "{", "dst", "[", "dstOffset", "]", "=", "NULL_BYTE_LOW", ";", "return", ...
Encodes the given optional unsigned byte array into a variable amount of bytes for descending order. If the byte array is null, exactly 1 byte is written. Otherwise, the amount written is determined by calling calculateEncodedLength. @param value byte array value to encode, may be null @param dst destination for encoded bytes @param dstOffset offset into destination array @return amount of bytes written
[ "Encodes", "the", "given", "optional", "unsigned", "byte", "array", "into", "a", "variable", "amount", "of", "bytes", "for", "descending", "order", ".", "If", "the", "byte", "array", "is", "null", "exactly", "1", "byte", "is", "written", ".", "Otherwise", ...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L728-L734
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.fromCallable
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> fromCallable(Callable<? extends T> supplier) { ObjectHelper.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new FlowableFromCallable<T>(supplier)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.FULL) @SchedulerSupport(SchedulerSupport.NONE) public static <T> Flowable<T> fromCallable(Callable<? extends T> supplier) { ObjectHelper.requireNonNull(supplier, "supplier is null"); return RxJavaPlugins.onAssembly(new FlowableFromCallable<T>(supplier)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "FULL", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "static", "<", "T", ">", "Flowable", "<", "T", ">", "fromCallable", "(", "Callable", "...
Returns a Flowable that, when a Subscriber subscribes to it, invokes a function you specify and then emits the value returned from that function. <p> <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.png" alt=""> <p> This allows you to defer the execution of the function you specify until a Subscriber subscribes to the Publisher. That is to say, it makes the function "lazy." <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd> <dt><b>Error handling:</b></dt> <dd> If the {@link Callable} throws an exception, the respective {@link Throwable} is delivered to the downstream via {@link Subscriber#onError(Throwable)}, except when the downstream has canceled this {@code Flowable} source. In this latter case, the {@code Throwable} is delivered to the global error handler via {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}. </dd> </dl> @param supplier a function, the execution of which should be deferred; {@code fromCallable} will invoke this function only when a Subscriber subscribes to the Publisher that {@code fromCallable} returns @param <T> the type of the item emitted by the Publisher @return a Flowable whose {@link Subscriber}s' subscriptions trigger an invocation of the given function @see #defer(Callable) @since 2.0
[ "Returns", "a", "Flowable", "that", "when", "a", "Subscriber", "subscribes", "to", "it", "invokes", "a", "function", "you", "specify", "and", "then", "emits", "the", "value", "returned", "from", "that", "function", ".", "<p", ">", "<img", "width", "=", "64...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L1976-L1982
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/StreamHandler.java
StreamHandler.setEncoding
@Override public synchronized void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException { super.setEncoding(encoding); if (output == null) { return; } // Replace the current writer with a writer for the new encoding. flush(); if (encoding == null) { writer = new OutputStreamWriter(output); } else { writer = new OutputStreamWriter(output, encoding); } }
java
@Override public synchronized void setEncoding(String encoding) throws SecurityException, java.io.UnsupportedEncodingException { super.setEncoding(encoding); if (output == null) { return; } // Replace the current writer with a writer for the new encoding. flush(); if (encoding == null) { writer = new OutputStreamWriter(output); } else { writer = new OutputStreamWriter(output, encoding); } }
[ "@", "Override", "public", "synchronized", "void", "setEncoding", "(", "String", "encoding", ")", "throws", "SecurityException", ",", "java", ".", "io", ".", "UnsupportedEncodingException", "{", "super", ".", "setEncoding", "(", "encoding", ")", ";", "if", "(", ...
Set (or change) the character encoding used by this <tt>Handler</tt>. <p> The encoding should be set before any <tt>LogRecords</tt> are written to the <tt>Handler</tt>. @param encoding The name of a supported character encoding. May be null, to indicate the default platform encoding. @exception SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>. @exception UnsupportedEncodingException if the named encoding is not supported.
[ "Set", "(", "or", "change", ")", "the", "character", "encoding", "used", "by", "this", "<tt", ">", "Handler<", "/", "tt", ">", ".", "<p", ">", "The", "encoding", "should", "be", "set", "before", "any", "<tt", ">", "LogRecords<", "/", "tt", ">", "are"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/StreamHandler.java#L171-L185
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java
CirculantTracker.get_subwindow
protected void get_subwindow( T image , GrayF64 output ) { // copy the target region interp.setImage(image); int index = 0; for( int y = 0; y < workRegionSize; y++ ) { float yy = regionTrack.y0 + y*stepY; for( int x = 0; x < workRegionSize; x++ ) { float xx = regionTrack.x0 + x*stepX; if( interp.isInFastBounds(xx,yy)) output.data[index++] = interp.get_fast(xx,yy); else if( BoofMiscOps.checkInside(image, xx, yy)) output.data[index++] = interp.get(xx, yy); else { // randomize to make pixels outside the image poorly correlate. It will then focus on matching // what's inside the image since it has structure output.data[index++] = rand.nextFloat()*maxPixelValue; } } } // normalize values to be from -0.5 to 0.5 PixelMath.divide(output, maxPixelValue, output); PixelMath.plus(output, -0.5f, output); // apply the cosine window to it PixelMath.multiply(output,cosine,output); }
java
protected void get_subwindow( T image , GrayF64 output ) { // copy the target region interp.setImage(image); int index = 0; for( int y = 0; y < workRegionSize; y++ ) { float yy = regionTrack.y0 + y*stepY; for( int x = 0; x < workRegionSize; x++ ) { float xx = regionTrack.x0 + x*stepX; if( interp.isInFastBounds(xx,yy)) output.data[index++] = interp.get_fast(xx,yy); else if( BoofMiscOps.checkInside(image, xx, yy)) output.data[index++] = interp.get(xx, yy); else { // randomize to make pixels outside the image poorly correlate. It will then focus on matching // what's inside the image since it has structure output.data[index++] = rand.nextFloat()*maxPixelValue; } } } // normalize values to be from -0.5 to 0.5 PixelMath.divide(output, maxPixelValue, output); PixelMath.plus(output, -0.5f, output); // apply the cosine window to it PixelMath.multiply(output,cosine,output); }
[ "protected", "void", "get_subwindow", "(", "T", "image", ",", "GrayF64", "output", ")", "{", "// copy the target region", "interp", ".", "setImage", "(", "image", ")", ";", "int", "index", "=", "0", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<",...
Copies the target into the output image and applies the cosine window to it.
[ "Copies", "the", "target", "into", "the", "output", "image", "and", "applies", "the", "cosine", "window", "to", "it", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java#L577-L606
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_user_GET
public ArrayList<OvhUser> project_serviceName_user_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/user"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<OvhUser> project_serviceName_user_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/user"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhUser", ">", "project_serviceName_user_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/user\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", ...
Get all users REST: GET /cloud/project/{serviceName}/user @param serviceName [required] Service name
[ "Get", "all", "users" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L493-L498
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java
AppClassLoader.definePackage
@FFDCIgnore(value = { IllegalArgumentException.class }) private void definePackage(ByteResourceInformation byteResourceInformation, String packageName) { // If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got Manifest manifest = byteResourceInformation.getManifest(); try { // The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest if (manifest == null) { definePackage(packageName, null, null, null, null, null, null, null); } else { definePackage(packageName, manifest, byteResourceInformation.getResourceUrl()); } } catch (IllegalArgumentException e) { // Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See: // http://bugs.sun.com/view_bug.do?bug_id=4841786 } }
java
@FFDCIgnore(value = { IllegalArgumentException.class }) private void definePackage(ByteResourceInformation byteResourceInformation, String packageName) { // If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got Manifest manifest = byteResourceInformation.getManifest(); try { // The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest if (manifest == null) { definePackage(packageName, null, null, null, null, null, null, null); } else { definePackage(packageName, manifest, byteResourceInformation.getResourceUrl()); } } catch (IllegalArgumentException e) { // Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See: // http://bugs.sun.com/view_bug.do?bug_id=4841786 } }
[ "@", "FFDCIgnore", "(", "value", "=", "{", "IllegalArgumentException", ".", "class", "}", ")", "private", "void", "definePackage", "(", "ByteResourceInformation", "byteResourceInformation", ",", "String", "packageName", ")", "{", "// If the package is in a JAR then we can...
This method will define the package using the byteResourceInformation for a class to get the URL for this package to try to load a manifest. If a manifest can't be loaded from the URL it will create the package with no package versioning or sealing information. @param byteResourceInformation The information about the class file @param packageName The name of the package to create
[ "This", "method", "will", "define", "the", "package", "using", "the", "byteResourceInformation", "for", "a", "class", "to", "get", "the", "URL", "for", "this", "package", "to", "try", "to", "load", "a", "manifest", ".", "If", "a", "manifest", "can", "t", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L439-L455
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java
SessionContext.remoteInvalidate
public void remoteInvalidate(String sessionId, boolean backendUpdate) { IStore iStore = _coreHttpSessionManager.getIStore(); ((MemoryStore) iStore).remoteInvalidate(sessionId, backendUpdate); }
java
public void remoteInvalidate(String sessionId, boolean backendUpdate) { IStore iStore = _coreHttpSessionManager.getIStore(); ((MemoryStore) iStore).remoteInvalidate(sessionId, backendUpdate); }
[ "public", "void", "remoteInvalidate", "(", "String", "sessionId", ",", "boolean", "backendUpdate", ")", "{", "IStore", "iStore", "=", "_coreHttpSessionManager", ".", "getIStore", "(", ")", ";", "(", "(", "MemoryStore", ")", "iStore", ")", ".", "remoteInvalidate"...
/* For remote InvalidateAll processing...calls remoteInvalidate method on the store
[ "/", "*", "For", "remote", "InvalidateAll", "processing", "...", "calls", "remoteInvalidate", "method", "on", "the", "store" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java#L1069-L1072
b3dgs/lionengine
lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java
ServerImpl.receiveConnecting
private void receiveConnecting(ClientSocket client, DataInputStream buffer, byte from, StateConnection expected) throws IOException { if (ServerImpl.checkValidity(client, from, expected)) { // Receive the name final byte[] name = new byte[buffer.readByte()]; if (buffer.read(name) == -1) { throw new IOException("Unable to read client name !"); } client.setName(new String(name, NetworkMessage.CHARSET)); // Send new state client.setState(StateConnection.CONNECTED); client.getOut().writeByte(NetworkMessageSystemId.CONNECTED); client.getOut().writeByte(client.getId()); client.getOut().writeByte(clientsNumber - 1); // Send the list of other clients for (final ClientSocket other : clients.values()) { if (other.getId() != from) { ServerImpl.writeIdAndName(client, other.getId(), other.getName()); } } // Send message of the day if has if (messageOfTheDay != null) { final byte[] motd = messageOfTheDay.getBytes(NetworkMessage.CHARSET); client.getOut().writeByte(motd.length); client.getOut().write(motd); } // Send client.getOut().flush(); } }
java
private void receiveConnecting(ClientSocket client, DataInputStream buffer, byte from, StateConnection expected) throws IOException { if (ServerImpl.checkValidity(client, from, expected)) { // Receive the name final byte[] name = new byte[buffer.readByte()]; if (buffer.read(name) == -1) { throw new IOException("Unable to read client name !"); } client.setName(new String(name, NetworkMessage.CHARSET)); // Send new state client.setState(StateConnection.CONNECTED); client.getOut().writeByte(NetworkMessageSystemId.CONNECTED); client.getOut().writeByte(client.getId()); client.getOut().writeByte(clientsNumber - 1); // Send the list of other clients for (final ClientSocket other : clients.values()) { if (other.getId() != from) { ServerImpl.writeIdAndName(client, other.getId(), other.getName()); } } // Send message of the day if has if (messageOfTheDay != null) { final byte[] motd = messageOfTheDay.getBytes(NetworkMessage.CHARSET); client.getOut().writeByte(motd.length); client.getOut().write(motd); } // Send client.getOut().flush(); } }
[ "private", "void", "receiveConnecting", "(", "ClientSocket", "client", ",", "DataInputStream", "buffer", ",", "byte", "from", ",", "StateConnection", "expected", ")", "throws", "IOException", "{", "if", "(", "ServerImpl", ".", "checkValidity", "(", "client", ",", ...
Update the receive connecting state. @param client The current client. @param buffer The data buffer. @param from The id from. @param expected The expected client state. @throws IOException If error.
[ "Update", "the", "receive", "connecting", "state", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ServerImpl.java#L206-L243
stapler/stapler
core/src/main/java/org/kohsuke/stapler/Facet.java
Facet.createRequestDispatcher
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException { return null; // should be really abstract, but not }
java
public RequestDispatcher createRequestDispatcher(RequestImpl request, Klass<?> type, Object it, String viewName) throws IOException { return null; // should be really abstract, but not }
[ "public", "RequestDispatcher", "createRequestDispatcher", "(", "RequestImpl", "request", ",", "Klass", "<", "?", ">", "type", ",", "Object", "it", ",", "String", "viewName", ")", "throws", "IOException", "{", "return", "null", ";", "// should be really abstract, but...
Creates a {@link RequestDispatcher} that handles the given view, or return null if no such view was found. @param type If "it" is non-null, {@code it.getClass()}. Otherwise the class from which the view is searched.
[ "Creates", "a", "{", "@link", "RequestDispatcher", "}", "that", "handles", "the", "given", "view", "or", "return", "null", "if", "no", "such", "view", "was", "found", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/Facet.java#L123-L125
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateCertificatePolicyAsync
public Observable<CertificatePolicy> updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) { return updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy).map(new Func1<ServiceResponse<CertificatePolicy>, CertificatePolicy>() { @Override public CertificatePolicy call(ServiceResponse<CertificatePolicy> response) { return response.body(); } }); }
java
public Observable<CertificatePolicy> updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) { return updateCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName, certificatePolicy).map(new Func1<ServiceResponse<CertificatePolicy>, CertificatePolicy>() { @Override public CertificatePolicy call(ServiceResponse<CertificatePolicy> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificatePolicy", ">", "updateCertificatePolicyAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "CertificatePolicy", "certificatePolicy", ")", "{", "return", "updateCertificatePolicyWithServiceResponseAsync", "(", "...
Updates the policy for a certificate. Set specified members in the certificate policy. Leave others as null. This operation requires the certificates/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate in the given vault. @param certificatePolicy The policy for the certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificatePolicy object
[ "Updates", "the", "policy", "for", "a", "certificate", ".", "Set", "specified", "members", "in", "the", "certificate", "policy", ".", "Leave", "others", "as", "null", ".", "This", "operation", "requires", "the", "certificates", "/", "update", "permission", "."...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7270-L7277
reapzor/FiloFirmata
src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java
Firmata.addListener
private void addListener(Integer channel, Class<? extends Message> messageClass, MessageListener messageListener) { // Build up the empty class listener map if not already there if (!messageListenerMap.containsKey(messageClass)) { messageListenerMap.put(messageClass, ArrayListMultimap.create()); } // Get the message listener map for the given class ArrayListMultimap<Integer, MessageListener> listenerMap = messageListenerMap.get(messageClass); // Get the message listener array for the given channel List<MessageListener> messageListeners = listenerMap.get(channel); if (!messageListeners.contains(messageListener)) { messageListeners.add(messageListener); } }
java
private void addListener(Integer channel, Class<? extends Message> messageClass, MessageListener messageListener) { // Build up the empty class listener map if not already there if (!messageListenerMap.containsKey(messageClass)) { messageListenerMap.put(messageClass, ArrayListMultimap.create()); } // Get the message listener map for the given class ArrayListMultimap<Integer, MessageListener> listenerMap = messageListenerMap.get(messageClass); // Get the message listener array for the given channel List<MessageListener> messageListeners = listenerMap.get(channel); if (!messageListeners.contains(messageListener)) { messageListeners.add(messageListener); } }
[ "private", "void", "addListener", "(", "Integer", "channel", ",", "Class", "<", "?", "extends", "Message", ">", "messageClass", ",", "MessageListener", "messageListener", ")", "{", "// Build up the empty class listener map if not already there", "if", "(", "!", "message...
Add a messageListener to the Firmata object which will fire whenever a matching message is received over the SerialPort that corresponds to the given channel. If the channel is null, the listener will fire regardless of which channel (pin) the message is coming from. @param channel Integer indicating the specific channel or pin to listen on, or null to listen to all messages regardless of channel/pin. @param messageClass Class indicating the message type to listen to. @param messageListener MessageListener object to handle a received Message event over the SerialPort.
[ "Add", "a", "messageListener", "to", "the", "Firmata", "object", "which", "will", "fire", "whenever", "a", "matching", "message", "is", "received", "over", "the", "SerialPort", "that", "corresponds", "to", "the", "given", "channel", ".", "If", "the", "channel"...
train
https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L119-L133
realtime-framework/RealtimeMessaging-Android
library/src/main/java/ibt/ortc/extensibility/OrtcClient.java
OrtcClient.subscribeWithNotifications
public void subscribeWithNotifications(String channel, boolean subscribeOnReconnect, OnMessageWithPayload onMessageWithPayload){ _subscribeWithNotifications(channel, subscribeOnReconnect, onMessageWithPayload, false); }
java
public void subscribeWithNotifications(String channel, boolean subscribeOnReconnect, OnMessageWithPayload onMessageWithPayload){ _subscribeWithNotifications(channel, subscribeOnReconnect, onMessageWithPayload, false); }
[ "public", "void", "subscribeWithNotifications", "(", "String", "channel", ",", "boolean", "subscribeOnReconnect", ",", "OnMessageWithPayload", "onMessageWithPayload", ")", "{", "_subscribeWithNotifications", "(", "channel", ",", "subscribeOnReconnect", ",", "onMessageWithPayl...
Subscribe the specified channel in order to receive messages in that channel with a support of Google Cloud Messaging (with access to notification payload). @param channel Channel to be subscribed @param subscribeOnReconnect Indicates if the channel should be subscribe if the event on reconnected is fired @param onMessageWithPayload Event handler that will be called when a message will be received on the subscribed channel, if notification contains payload it will also be provided
[ "Subscribe", "the", "specified", "channel", "in", "order", "to", "receive", "messages", "in", "that", "channel", "with", "a", "support", "of", "Google", "Cloud", "Messaging", "(", "with", "access", "to", "notification", "payload", ")", "." ]
train
https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/extensibility/OrtcClient.java#L910-L912
morimekta/utils
console-util/src/main/java/net/morimekta/console/terminal/InputLine.java
InputLine.handleInterrupt
private void handleInterrupt(int ch, Char c) throws IOException { if (ch == Char.ESC || ch == Char.ABR || ch == Char.EOF) { throw new IOException("User interrupted: " + c.asString()); } }
java
private void handleInterrupt(int ch, Char c) throws IOException { if (ch == Char.ESC || ch == Char.ABR || ch == Char.EOF) { throw new IOException("User interrupted: " + c.asString()); } }
[ "private", "void", "handleInterrupt", "(", "int", "ch", ",", "Char", "c", ")", "throws", "IOException", "{", "if", "(", "ch", "==", "Char", ".", "ESC", "||", "ch", "==", "Char", ".", "ABR", "||", "ch", "==", "Char", ".", "EOF", ")", "{", "throw", ...
Handle user interrupts. @param ch The character code point. @param c The char instance. @throws IOException
[ "Handle", "user", "interrupts", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/console-util/src/main/java/net/morimekta/console/terminal/InputLine.java#L281-L285
davidmoten/grumpy
grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java
Position.getPositionAlongPath
public final Position getPositionAlongPath(Position position, double proportion) { if (proportion >= 0 && proportion <= 1) { // Get bearing degrees for course double courseDegrees = this.getBearingDegrees(position); // Get distance from position arg and this objects location double distanceKm = this.getDistanceToKm(position); // Predict the position for a proportion of the course // where this object is the start position and the arg // is the destination position. Position retPosition = this.predict(proportion * distanceKm, courseDegrees); return retPosition; } else throw new RuntimeException("Proportion must be between 0 and 1 inclusive"); }
java
public final Position getPositionAlongPath(Position position, double proportion) { if (proportion >= 0 && proportion <= 1) { // Get bearing degrees for course double courseDegrees = this.getBearingDegrees(position); // Get distance from position arg and this objects location double distanceKm = this.getDistanceToKm(position); // Predict the position for a proportion of the course // where this object is the start position and the arg // is the destination position. Position retPosition = this.predict(proportion * distanceKm, courseDegrees); return retPosition; } else throw new RuntimeException("Proportion must be between 0 and 1 inclusive"); }
[ "public", "final", "Position", "getPositionAlongPath", "(", "Position", "position", ",", "double", "proportion", ")", "{", "if", "(", "proportion", ">=", "0", "&&", "proportion", "<=", "1", ")", "{", "// Get bearing degrees for course", "double", "courseDegrees", ...
Returns a position along a path according to the proportion value @param position @param proportion is between 0 and 1 inclusive @return
[ "Returns", "a", "position", "along", "a", "path", "according", "to", "the", "proportion", "value" ]
train
https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java#L387-L405
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.getDeleted
public DeletedVaultInner getDeleted(String vaultName, String location) { return getDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); }
java
public DeletedVaultInner getDeleted(String vaultName, String location) { return getDeletedWithServiceResponseAsync(vaultName, location).toBlocking().single().body(); }
[ "public", "DeletedVaultInner", "getDeleted", "(", "String", "vaultName", ",", "String", "location", ")", "{", "return", "getDeletedWithServiceResponseAsync", "(", "vaultName", ",", "location", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body...
Gets the deleted Azure key vault. @param vaultName The name of the vault. @param location The location of the deleted vault. @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 DeletedVaultInner object if successful.
[ "Gets", "the", "deleted", "Azure", "key", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L1168-L1170
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.findCell
public static Cell findCell(Sheet sheet, String cellReference, String searchKey) { if (isFullCellReference(cellReference)) { return findCell(sheet, cellReference); } if (isColReference(cellReference)) { val cellRef = new CellReference(cellReference + "1"); return searchColCell(sheet, cellRef.getCol(), searchKey); } if (isRowReference(cellReference)) { val cellRef = new CellReference("A" + cellReference); return searchRowCell(sheet, cellRef.getRow(), searchKey); } return searchCell(sheet, searchKey); }
java
public static Cell findCell(Sheet sheet, String cellReference, String searchKey) { if (isFullCellReference(cellReference)) { return findCell(sheet, cellReference); } if (isColReference(cellReference)) { val cellRef = new CellReference(cellReference + "1"); return searchColCell(sheet, cellRef.getCol(), searchKey); } if (isRowReference(cellReference)) { val cellRef = new CellReference("A" + cellReference); return searchRowCell(sheet, cellRef.getRow(), searchKey); } return searchCell(sheet, searchKey); }
[ "public", "static", "Cell", "findCell", "(", "Sheet", "sheet", ",", "String", "cellReference", ",", "String", "searchKey", ")", "{", "if", "(", "isFullCellReference", "(", "cellReference", ")", ")", "{", "return", "findCell", "(", "sheet", ",", "cellReference"...
查找单元格。 @param sheet 表单 @param cellReference 单元格索引 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null
[ "查找单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L300-L316
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/ApplicationWindowSetter.java
ApplicationWindowSetter.postProcessBeforeInitialization
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ApplicationWindowAware) { ((ApplicationWindowAware)bean).setApplicationWindow(window); } return bean; }
java
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ApplicationWindowAware) { ((ApplicationWindowAware)bean).setApplicationWindow(window); } return bean; }
[ "public", "Object", "postProcessBeforeInitialization", "(", "Object", "bean", ",", "String", "beanName", ")", "throws", "BeansException", "{", "if", "(", "bean", "instanceof", "ApplicationWindowAware", ")", "{", "(", "(", "ApplicationWindowAware", ")", "bean", ")", ...
If the given bean is an implementation of {@link ApplicationWindowAware}, it will have its application window set to the window provided to this instance at construction time.
[ "If", "the", "given", "bean", "is", "an", "implementation", "of", "{", "@link", "ApplicationWindowAware", "}", "it", "will", "have", "its", "application", "window", "set", "to", "the", "window", "provided", "to", "this", "instance", "at", "construction", "time...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/ApplicationWindowSetter.java#L61-L66
korpling/ANNIS
annis-service/src/main/java/annis/security/ANNISUserConfigurationManager.java
ANNISUserConfigurationManager.writeUser
public boolean writeUser(User user) { // save user info to file if (resourcePath != null) { lock.writeLock().lock(); try { File userDir = new File(resourcePath, "users"); if (userDir.isDirectory()) { // get the file which corresponds to the user File userFile = new File(userDir.getAbsolutePath(), user.getName()); Properties props = user.toProperties(); try (FileOutputStream out = new FileOutputStream(userFile)) { props.store(out, ""); return true; } catch (IOException ex) { log.error("Could not write users file", ex); } } } finally { lock.writeLock().unlock(); } } // end if resourcePath not null return false; }
java
public boolean writeUser(User user) { // save user info to file if (resourcePath != null) { lock.writeLock().lock(); try { File userDir = new File(resourcePath, "users"); if (userDir.isDirectory()) { // get the file which corresponds to the user File userFile = new File(userDir.getAbsolutePath(), user.getName()); Properties props = user.toProperties(); try (FileOutputStream out = new FileOutputStream(userFile)) { props.store(out, ""); return true; } catch (IOException ex) { log.error("Could not write users file", ex); } } } finally { lock.writeLock().unlock(); } } // end if resourcePath not null return false; }
[ "public", "boolean", "writeUser", "(", "User", "user", ")", "{", "// save user info to file", "if", "(", "resourcePath", "!=", "null", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "File", "userDir", "=", "new", ...
Writes the user to the disk @param user @return True if successful.
[ "Writes", "the", "user", "to", "the", "disk" ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/security/ANNISUserConfigurationManager.java#L173-L196
Coolerfall/Android-HttpDownloadManager
library/src/main/java/com/coolerfall/download/DownloadDelivery.java
DownloadDelivery.postFailure
void postFailure(final DownloadRequest request, final int statusCode, final String errMsg) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onFailure(request.downloadId(), statusCode, errMsg); } }); }
java
void postFailure(final DownloadRequest request, final int statusCode, final String errMsg) { downloadPoster.execute(new Runnable() { @Override public void run() { request.downloadCallback().onFailure(request.downloadId(), statusCode, errMsg); } }); }
[ "void", "postFailure", "(", "final", "DownloadRequest", "request", ",", "final", "int", "statusCode", ",", "final", "String", "errMsg", ")", "{", "downloadPoster", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run...
Post download failure event. @param request download request @param statusCode status code @param errMsg error message
[ "Post", "download", "failure", "event", "." ]
train
https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L85-L91
alkacon/opencms-core
src/org/opencms/jsp/decorator/CmsDecorationObject.java
CmsDecorationObject.getContentDecoration
public String getContentDecoration(I_CmsDecoratorConfiguration config, String text, String contentLocale) { StringBuffer content = new StringBuffer(); // TODO: we have to handle with word phrases, too // add the pretext if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) { content.append(m_decorationDefinition.getPreTextFirst()); } else { content.append(m_decorationDefinition.getPreText()); } // now add the original word content.append(text); // add the posttext if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) { content.append(m_decorationDefinition.getPostTextFirst()); config.markAsUsed(m_decorationKey); } else { content.append(m_decorationDefinition.getPostText()); } // replace the occurance of the ${decoration} makro in the decorated text return replaceMacros(content.toString(), contentLocale); }
java
public String getContentDecoration(I_CmsDecoratorConfiguration config, String text, String contentLocale) { StringBuffer content = new StringBuffer(); // TODO: we have to handle with word phrases, too // add the pretext if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) { content.append(m_decorationDefinition.getPreTextFirst()); } else { content.append(m_decorationDefinition.getPreText()); } // now add the original word content.append(text); // add the posttext if (!config.hasUsed(m_decorationKey) && m_decorationDefinition.isMarkFirst()) { content.append(m_decorationDefinition.getPostTextFirst()); config.markAsUsed(m_decorationKey); } else { content.append(m_decorationDefinition.getPostText()); } // replace the occurance of the ${decoration} makro in the decorated text return replaceMacros(content.toString(), contentLocale); }
[ "public", "String", "getContentDecoration", "(", "I_CmsDecoratorConfiguration", "config", ",", "String", "text", ",", "String", "contentLocale", ")", "{", "StringBuffer", "content", "=", "new", "StringBuffer", "(", ")", ";", "// TODO: we have to handle with word phrases, ...
Gets the decorated content for this decoration object.<p> @param config the configuration used @param text the text to be decorated @param contentLocale the locale of the content to be decorated @return decorated content
[ "Gets", "the", "decorated", "content", "for", "this", "decoration", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsDecorationObject.java#L101-L125
samskivert/samskivert
src/main/java/com/samskivert/util/PropertiesUtil.java
PropertiesUtil.requireProperty
public static String requireProperty (Properties props, String key, String missingMessage) { String value = props.getProperty(key); if (StringUtil.isBlank(value)) { throw new MissingPropertyException(key, missingMessage); } return value; }
java
public static String requireProperty (Properties props, String key, String missingMessage) { String value = props.getProperty(key); if (StringUtil.isBlank(value)) { throw new MissingPropertyException(key, missingMessage); } return value; }
[ "public", "static", "String", "requireProperty", "(", "Properties", "props", ",", "String", "key", ",", "String", "missingMessage", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "key", ")", ";", "if", "(", "StringUtil", ".", "isBlank", ...
Returns the specified property from the supplied properties object. @throws MissingPropertyException with the supplied message if the property does not exist or is the empty string.
[ "Returns", "the", "specified", "property", "from", "the", "supplied", "properties", "object", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L222-L229
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java
FileSystemUtil.supportsRename
public static boolean supportsRename(URI fsUri, Configuration conf) { String fsUriScheme = fsUri.getScheme(); // Only S3 is known to not support renaming, but allow configuration override. // This logic is intended as a temporary placeholder solution and should // be revisited once HADOOP-9565 has been completed. return conf.getBoolean(FileSystemProperties.SUPPORTS_RENAME_PROP, !(fsUriScheme.equalsIgnoreCase("s3n") || fsUriScheme.equalsIgnoreCase("s3a"))); }
java
public static boolean supportsRename(URI fsUri, Configuration conf) { String fsUriScheme = fsUri.getScheme(); // Only S3 is known to not support renaming, but allow configuration override. // This logic is intended as a temporary placeholder solution and should // be revisited once HADOOP-9565 has been completed. return conf.getBoolean(FileSystemProperties.SUPPORTS_RENAME_PROP, !(fsUriScheme.equalsIgnoreCase("s3n") || fsUriScheme.equalsIgnoreCase("s3a"))); }
[ "public", "static", "boolean", "supportsRename", "(", "URI", "fsUri", ",", "Configuration", "conf", ")", "{", "String", "fsUriScheme", "=", "fsUri", ".", "getScheme", "(", ")", ";", "// Only S3 is known to not support renaming, but allow configuration override.", "// This...
Determine whether a FileSystem that supports efficient file renaming is being used. Two known FileSystem implementations that currently lack this feature are S3N and S3A. @param fsUri the FileSystem URI @param conf the FileSystem Configuration @return {@code true} if the FileSystem URI or {@link FileSystemProperties#SUPPORTS_RENAME_PROP configuration override} indicates that the FileSystem implementation supports efficient rename operations, {@code false} otherwise.
[ "Determine", "whether", "a", "FileSystem", "that", "supports", "efficient", "file", "renaming", "is", "being", "used", ".", "Two", "known", "FileSystem", "implementations", "that", "currently", "lack", "this", "feature", "are", "S3N", "and", "S3A", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemUtil.java#L710-L718
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java
BootstrapContextImpl.stopTask
private void stopTask(ThreadContextDescriptor raThreadContextDescriptor, ArrayList<ThreadContext> threadContext) { if (raThreadContextDescriptor != null) raThreadContextDescriptor.taskStopping(threadContext); }
java
private void stopTask(ThreadContextDescriptor raThreadContextDescriptor, ArrayList<ThreadContext> threadContext) { if (raThreadContextDescriptor != null) raThreadContextDescriptor.taskStopping(threadContext); }
[ "private", "void", "stopTask", "(", "ThreadContextDescriptor", "raThreadContextDescriptor", ",", "ArrayList", "<", "ThreadContext", ">", "threadContext", ")", "{", "if", "(", "raThreadContextDescriptor", "!=", "null", ")", "raThreadContextDescriptor", ".", "taskStopping",...
Stop the resource adapter context descriptor task if one was started. @param raThreadContextDescriptor @param threadContext
[ "Stop", "the", "resource", "adapter", "context", "descriptor", "task", "if", "one", "was", "started", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/internal/BootstrapContextImpl.java#L1142-L1145
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.setKeywordValue
public ULocale setKeywordValue(String keyword, String value) { return new ULocale(setKeywordValue(localeID, keyword, value), (Locale)null); }
java
public ULocale setKeywordValue(String keyword, String value) { return new ULocale(setKeywordValue(localeID, keyword, value), (Locale)null); }
[ "public", "ULocale", "setKeywordValue", "(", "String", "keyword", ",", "String", "value", ")", "{", "return", "new", "ULocale", "(", "setKeywordValue", "(", "localeID", ",", "keyword", ",", "value", ")", ",", "(", "Locale", ")", "null", ")", ";", "}" ]
<strong>[icu]</strong> Given a keyword and a value, return a new locale with an updated keyword and value. If the keyword is null, this removes all keywords from the locale id. Otherwise, if the value is null, this removes the value for this keyword from the locale id. Otherwise, this adds/replaces the value for this keyword in the locale id. The keyword and value must not be empty. <p>Related: {@link #getBaseName()} returns the locale ID string with all keywords removed. @param keyword the keyword to add/remove, or null to remove all keywords. @param value the value to add/set, or null to remove this particular keyword. @return the updated locale
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Given", "a", "keyword", "and", "a", "value", "return", "a", "new", "locale", "with", "an", "updated", "keyword", "and", "value", ".", "If", "the", "keyword", "is", "null", "this", "removes", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1231-L1233
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.setAttribute
public void setAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notEmpty(value, "Attribute value"); if(value != null) { attributes.put(name, value); } else { attributes.remove(name); } }
java
public void setAttribute(String name, String value) { Params.notNullOrEmpty(name, "Attribute name"); Params.notEmpty(value, "Attribute value"); if(value != null) { attributes.put(name, value); } else { attributes.remove(name); } }
[ "public", "void", "setAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Attribute name\"", ")", ";", "Params", ".", "notEmpty", "(", "value", ",", "\"Attribute value\"", ")", ";", "if",...
Set configuration object attribute. If attribute already exists overwrite old value. Empty value is not accepted but null is considered indication to remove attribute. So that, an existing attribute cannot be either null or empty. @param name attribute name, @param value attribute value, null ignored. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>value</code> argument is empty.
[ "Set", "configuration", "object", "attribute", ".", "If", "attribute", "already", "exists", "overwrite", "old", "value", ".", "Empty", "value", "is", "not", "accepted", "but", "null", "is", "considered", "indication", "to", "remove", "attribute", ".", "So", "t...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L116-L126
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_POST
public OvhTaskPop domain_account_POST(String domain, String accountName, String description, String password, Long size) throws IOException { String qPath = "/email/domain/{domain}/account"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accountName", accountName); addBody(o, "description", description); addBody(o, "password", password); addBody(o, "size", size); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskPop.class); }
java
public OvhTaskPop domain_account_POST(String domain, String accountName, String description, String password, Long size) throws IOException { String qPath = "/email/domain/{domain}/account"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accountName", accountName); addBody(o, "description", description); addBody(o, "password", password); addBody(o, "size", size); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskPop.class); }
[ "public", "OvhTaskPop", "domain_account_POST", "(", "String", "domain", ",", "String", "accountName", ",", "String", "description", ",", "String", "password", ",", "Long", "size", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/a...
Create new mailbox in server REST: POST /email/domain/{domain}/account @param accountName [required] Account name @param password [required] Account password @param description [required] Description Account @param size [required] Account size in bytes (default : 5000000000) (possible values : /email/domain/{domain}/allowedAccountSize ) @param domain [required] Name of your domain name
[ "Create", "new", "mailbox", "in", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L890-L900
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java
SystemConfiguration.validateOutputPath
private void validateOutputPath(final File path) { if (path.canWrite()) return; // If the path doesn't exist... if (!path.exists()) { // ... try creating it... if (!path.mkdirs()) { // ... or die trying. String err = DIRECTORY_CREATION_FAILED.concat(path.toString()); throw new BELRuntimeException(err, UNRECOVERABLE_ERROR); } return; } // ... can't write to it. String err = CANT_WRITE_TO_PATH.concat(path.toString()); throw new BELRuntimeException(err, UNRECOVERABLE_ERROR); }
java
private void validateOutputPath(final File path) { if (path.canWrite()) return; // If the path doesn't exist... if (!path.exists()) { // ... try creating it... if (!path.mkdirs()) { // ... or die trying. String err = DIRECTORY_CREATION_FAILED.concat(path.toString()); throw new BELRuntimeException(err, UNRECOVERABLE_ERROR); } return; } // ... can't write to it. String err = CANT_WRITE_TO_PATH.concat(path.toString()); throw new BELRuntimeException(err, UNRECOVERABLE_ERROR); }
[ "private", "void", "validateOutputPath", "(", "final", "File", "path", ")", "{", "if", "(", "path", ".", "canWrite", "(", ")", ")", "return", ";", "// If the path doesn't exist...", "if", "(", "!", "path", ".", "exists", "(", ")", ")", "{", "// ... try cre...
Throws a system configuration error if the {@code path} cannot be written to. If {@code path} does not exist, an attempt to create it will be made. @param path Path for validation
[ "Throws", "a", "system", "configuration", "error", "if", "the", "{", "@code", "path", "}", "cannot", "be", "written", "to", ".", "If", "{", "@code", "path", "}", "does", "not", "exist", "an", "attempt", "to", "create", "it", "will", "be", "made", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/cfg/SystemConfiguration.java#L598-L615
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vpc/VpcClient.java
VpcClient.createVpc
public CreateVpcResponse createVpc(CreateVpcRequest request) throws BceClientException { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getName(), "name should not be empty"); checkStringNotEmpty(request.getCidr(), "cidr should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VPC_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateVpcResponse.class); }
java
public CreateVpcResponse createVpc(CreateVpcRequest request) throws BceClientException { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getName(), "name should not be empty"); checkStringNotEmpty(request.getCidr(), "cidr should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VPC_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateVpcResponse.class); }
[ "public", "CreateVpcResponse", "createVpc", "(", "CreateVpcRequest", "request", ")", "throws", "BceClientException", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "request", ".",...
Create a vpc with the specified options. You must fill the field of clientToken,which is especially for keeping idempotent. <p/> @param request The request containing all options for creating a vpc. @return List of vpcId newly created @throws BceClientException
[ "Create", "a", "vpc", "with", "the", "specified", "options", ".", "You", "must", "fill", "the", "field", "of", "clientToken", "which", "is", "especially", "for", "keeping", "idempotent", ".", "<p", "/", ">" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L170-L183
alkacon/opencms-core
src/org/opencms/gwt/CmsIconUtil.java
CmsIconUtil.getDisplayType
public static String getDisplayType(CmsObject cms, CmsResource resource) { String result; if (CmsJspNavBuilder.isNavLevelFolder(cms, resource)) { result = CmsGwtConstants.TYPE_NAVLEVEL; } else if (CmsResourceTypeXmlContainerPage.isModelCopyGroup(cms, resource)) { result = CmsGwtConstants.TYPE_MODELGROUP_COPY; } else { result = OpenCms.getResourceManager().getResourceType(resource).getTypeName(); } return result; }
java
public static String getDisplayType(CmsObject cms, CmsResource resource) { String result; if (CmsJspNavBuilder.isNavLevelFolder(cms, resource)) { result = CmsGwtConstants.TYPE_NAVLEVEL; } else if (CmsResourceTypeXmlContainerPage.isModelCopyGroup(cms, resource)) { result = CmsGwtConstants.TYPE_MODELGROUP_COPY; } else { result = OpenCms.getResourceManager().getResourceType(resource).getTypeName(); } return result; }
[ "public", "static", "String", "getDisplayType", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "String", "result", ";", "if", "(", "CmsJspNavBuilder", ".", "isNavLevelFolder", "(", "cms", ",", "resource", ")", ")", "{", "result", "=", "Cm...
Returns the resource type name used to display the resource icon. This may differ from the actual resource type in case of navigation level folders and model groups.<p> @param cms the cms context @param resource the resource @return the display type name
[ "Returns", "the", "resource", "type", "name", "used", "to", "display", "the", "resource", "icon", ".", "This", "may", "differ", "from", "the", "actual", "resource", "type", "in", "case", "of", "navigation", "level", "folders", "and", "model", "groups", ".", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L302-L313
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.consumeProcessErrorStream
public static Thread consumeProcessErrorStream(Process self, OutputStream err) { Thread thread = new Thread(new ByteDumper(self.getErrorStream(), err)); thread.start(); return thread; }
java
public static Thread consumeProcessErrorStream(Process self, OutputStream err) { Thread thread = new Thread(new ByteDumper(self.getErrorStream(), err)); thread.start(); return thread; }
[ "public", "static", "Thread", "consumeProcessErrorStream", "(", "Process", "self", ",", "OutputStream", "err", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", "new", "ByteDumper", "(", "self", ".", "getErrorStream", "(", ")", ",", "err", ")", ")", ...
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied OutputStream. A new Thread is started, so this method will return immediately. @param self a Process @param err an OutputStream to capture the process stderr @return the Thread @since 1.5.2
[ "Gets", "the", "error", "stream", "from", "a", "process", "and", "reads", "it", "to", "keep", "the", "process", "from", "blocking", "due", "to", "a", "full", "buffer", ".", "The", "processed", "stream", "data", "is", "appended", "to", "the", "supplied", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L283-L287
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.asString_ApiPlanBeans
public static String asString_ApiPlanBeans(Set<ApiPlanBean> plans) { TreeSet<ApiPlanBean> sortedPlans = new TreeSet<>(new Comparator<ApiPlanBean>() { @Override public int compare(ApiPlanBean o1, ApiPlanBean o2) { String p1 = o1.getPlanId() + ":" + o1.getVersion(); //$NON-NLS-1$ String p2 = o2.getPlanId() + ":" + o2.getVersion(); //$NON-NLS-1$ return p1.compareTo(p2); } }); sortedPlans.addAll(plans); StringBuilder builder = new StringBuilder(); boolean first = true; if (plans != null) { for (ApiPlanBean plan : sortedPlans) { if (!first) { builder.append(", "); //$NON-NLS-1$ } builder.append(plan.getPlanId()).append(":").append(plan.getVersion()); //$NON-NLS-1$ first = false; } } return builder.toString(); }
java
public static String asString_ApiPlanBeans(Set<ApiPlanBean> plans) { TreeSet<ApiPlanBean> sortedPlans = new TreeSet<>(new Comparator<ApiPlanBean>() { @Override public int compare(ApiPlanBean o1, ApiPlanBean o2) { String p1 = o1.getPlanId() + ":" + o1.getVersion(); //$NON-NLS-1$ String p2 = o2.getPlanId() + ":" + o2.getVersion(); //$NON-NLS-1$ return p1.compareTo(p2); } }); sortedPlans.addAll(plans); StringBuilder builder = new StringBuilder(); boolean first = true; if (plans != null) { for (ApiPlanBean plan : sortedPlans) { if (!first) { builder.append(", "); //$NON-NLS-1$ } builder.append(plan.getPlanId()).append(":").append(plan.getVersion()); //$NON-NLS-1$ first = false; } } return builder.toString(); }
[ "public", "static", "String", "asString_ApiPlanBeans", "(", "Set", "<", "ApiPlanBean", ">", "plans", ")", "{", "TreeSet", "<", "ApiPlanBean", ">", "sortedPlans", "=", "new", "TreeSet", "<>", "(", "new", "Comparator", "<", "ApiPlanBean", ">", "(", ")", "{", ...
Converts the list of plans to a string for display/comparison. @param plans the plans @return the plans as a string
[ "Converts", "the", "list", "of", "plans", "to", "a", "string", "for", "display", "/", "comparison", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L806-L829
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertTrue
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
java
public static Boolean assertTrue(Boolean value, String message) { if (!Boolean.valueOf(value)) throw new IllegalStateException(message); return value; }
[ "public", "static", "Boolean", "assertTrue", "(", "Boolean", "value", ",", "String", "message", ")", "{", "if", "(", "!", "Boolean", ".", "valueOf", "(", "value", ")", ")", "throw", "new", "IllegalStateException", "(", "message", ")", ";", "return", "value...
Throws an IllegalStateException when the given value is not true.
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "value", "is", "not", "true", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L57-L62
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/RowCountOutputHandler.java
RowCountOutputHandler.handle
public T handle(List<QueryParameters> outputList) { Number result = 0; if (outputList == null || outputList.isEmpty() == true) { throw new IllegalArgumentException("Error! Output should always contain at least one element"); } QueryParameters stmtParams = outputList.get(0); if (stmtParams.containsKey(HandlersConstants.STMT_UPDATE_COUNT) == false) { throw new IllegalArgumentException("Error! Expected to get update count, but key wasn't found!"); } result = (Integer) stmtParams.getValue(HandlersConstants.STMT_UPDATE_COUNT); return (T) result; }
java
public T handle(List<QueryParameters> outputList) { Number result = 0; if (outputList == null || outputList.isEmpty() == true) { throw new IllegalArgumentException("Error! Output should always contain at least one element"); } QueryParameters stmtParams = outputList.get(0); if (stmtParams.containsKey(HandlersConstants.STMT_UPDATE_COUNT) == false) { throw new IllegalArgumentException("Error! Expected to get update count, but key wasn't found!"); } result = (Integer) stmtParams.getValue(HandlersConstants.STMT_UPDATE_COUNT); return (T) result; }
[ "public", "T", "handle", "(", "List", "<", "QueryParameters", ">", "outputList", ")", "{", "Number", "result", "=", "0", ";", "if", "(", "outputList", "==", "null", "||", "outputList", ".", "isEmpty", "(", ")", "==", "true", ")", "{", "throw", "new", ...
Returns amount of records updated (value is calculated by JDBC Driver) @param outputList Query output @return
[ "Returns", "amount", "of", "records", "updated", "(", "value", "is", "calculated", "by", "JDBC", "Driver", ")" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/RowCountOutputHandler.java#L45-L61
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonErrorResponseWriter.java
JsonErrorResponseWriter.getJsonError
public String getJsonError(ODataException exception) throws ODataRenderException { checkNotNull(exception); LOG.debug("Start building Json error document"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { JsonGenerator jsonGenerator = JSON_FACTORY.createGenerator(outputStream, JsonEncoding.UTF8); jsonGenerator.writeStartObject(); jsonGenerator.writeObjectFieldStart(ERROR); jsonGenerator.writeStringField(CODE, String.valueOf(exception.getCode().getCode())); jsonGenerator.writeStringField(MESSAGE, String.valueOf(exception.getMessage())); // optional if (exception.getTarget() != null) { jsonGenerator.writeStringField(TARGET, String.valueOf(exception.getTarget()).replace("\"", "'")); } jsonGenerator.writeEndObject(); jsonGenerator.close(); return outputStream.toString(); } catch (IOException e) { LOG.error("Not possible to write error JSON."); throw new ODataRenderException("Not possible to write error JSON: ", e); } }
java
public String getJsonError(ODataException exception) throws ODataRenderException { checkNotNull(exception); LOG.debug("Start building Json error document"); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { JsonGenerator jsonGenerator = JSON_FACTORY.createGenerator(outputStream, JsonEncoding.UTF8); jsonGenerator.writeStartObject(); jsonGenerator.writeObjectFieldStart(ERROR); jsonGenerator.writeStringField(CODE, String.valueOf(exception.getCode().getCode())); jsonGenerator.writeStringField(MESSAGE, String.valueOf(exception.getMessage())); // optional if (exception.getTarget() != null) { jsonGenerator.writeStringField(TARGET, String.valueOf(exception.getTarget()).replace("\"", "'")); } jsonGenerator.writeEndObject(); jsonGenerator.close(); return outputStream.toString(); } catch (IOException e) { LOG.error("Not possible to write error JSON."); throw new ODataRenderException("Not possible to write error JSON: ", e); } }
[ "public", "String", "getJsonError", "(", "ODataException", "exception", ")", "throws", "ODataRenderException", "{", "checkNotNull", "(", "exception", ")", ";", "LOG", ".", "debug", "(", "\"Start building Json error document\"", ")", ";", "ByteArrayOutputStream", "output...
Gets the json error output according to ODataException. @param exception ODataException @return errorJsonResponse @throws ODataRenderException If unable to render the json error message
[ "Gets", "the", "json", "error", "output", "according", "to", "ODataException", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonErrorResponseWriter.java#L52-L79
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setCost
public void setCost(int index, Number value) { set(selectField(ResourceFieldLists.CUSTOM_COST, index), value); }
java
public void setCost(int index, Number value) { set(selectField(ResourceFieldLists.CUSTOM_COST, index), value); }
[ "public", "void", "setCost", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_COST", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a cost value. @param index cost index (1-10) @param value cost value
[ "Set", "a", "cost", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1705-L1708
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java
AutocompleteUtil.getCombinedForSection
public static String getCombinedForSection(final String sectionName, final String... args) { return getCombinedAutocomplete(getNamedSection(sectionName), args); }
java
public static String getCombinedForSection(final String sectionName, final String... args) { return getCombinedAutocomplete(getNamedSection(sectionName), args); }
[ "public", "static", "String", "getCombinedForSection", "(", "final", "String", "sectionName", ",", "final", "String", "...", "args", ")", "{", "return", "getCombinedAutocomplete", "(", "getNamedSection", "(", "sectionName", ")", ",", "args", ")", ";", "}" ]
Combine autocomplete values into a single String suitable to apply to a named auto-fill section. @param sectionName the name of the autocomplete section @param args any other valid autocomplete values @return a single attribute value useful to apply an autocomplete helper to a named section
[ "Combine", "autocomplete", "values", "into", "a", "single", "String", "suitable", "to", "apply", "to", "a", "named", "auto", "-", "fill", "section", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/autocomplete/AutocompleteUtil.java#L116-L118
matthewhorridge/mdock
src/main/java/org/coode/mdock/SplitterNode.java
SplitterNode.insertNodeBefore
public void insertNodeBefore(Node insert, Node before, int direction) { if (isSplitterDirection(direction)) { double split = getSplit(before) / 2; setSplit(before, split); addChild(insert, children.indexOf(before), split); } else { pushDown(before, insert, before); } notifyStateChange(); }
java
public void insertNodeBefore(Node insert, Node before, int direction) { if (isSplitterDirection(direction)) { double split = getSplit(before) / 2; setSplit(before, split); addChild(insert, children.indexOf(before), split); } else { pushDown(before, insert, before); } notifyStateChange(); }
[ "public", "void", "insertNodeBefore", "(", "Node", "insert", ",", "Node", "before", ",", "int", "direction", ")", "{", "if", "(", "isSplitterDirection", "(", "direction", ")", ")", "{", "double", "split", "=", "getSplit", "(", "before", ")", "/", "2", ";...
Inserts a node before (left of or top of) a given node by splitting the inserted node with the given node. @param insert The node to be inserted @param before The node that the inserted node will be split with. @param direction The direction of the split
[ "Inserts", "a", "node", "before", "(", "left", "of", "or", "top", "of", ")", "a", "given", "node", "by", "splitting", "the", "inserted", "node", "with", "the", "given", "node", "." ]
train
https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L252-L262
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.typesIn
public static Set<TypeElement> typesIn(Set<? extends Element> elements) { return setFilter(elements, TYPE_KINDS, TypeElement.class); }
java
public static Set<TypeElement> typesIn(Set<? extends Element> elements) { return setFilter(elements, TYPE_KINDS, TypeElement.class); }
[ "public", "static", "Set", "<", "TypeElement", ">", "typesIn", "(", "Set", "<", "?", "extends", "Element", ">", "elements", ")", "{", "return", "setFilter", "(", "elements", ",", "TYPE_KINDS", ",", "TypeElement", ".", "class", ")", ";", "}" ]
Returns a set of types in {@code elements}. @return a set of types in {@code elements} @param elements the elements to filter
[ "Returns", "a", "set", "of", "types", "in", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L162-L165
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureMate.java
FeatureMate.intersects
public boolean intersects( Geometry geometry, boolean usePrepared ) { if (!getEnvelope().intersects(geometry.getEnvelopeInternal())) { return false; } if (usePrepared) { if (preparedGeometry == null) { preparedGeometry = PreparedGeometryFactory.prepare(getGeometry()); } return preparedGeometry.intersects(geometry); } else { return getGeometry().intersects(geometry); } }
java
public boolean intersects( Geometry geometry, boolean usePrepared ) { if (!getEnvelope().intersects(geometry.getEnvelopeInternal())) { return false; } if (usePrepared) { if (preparedGeometry == null) { preparedGeometry = PreparedGeometryFactory.prepare(getGeometry()); } return preparedGeometry.intersects(geometry); } else { return getGeometry().intersects(geometry); } }
[ "public", "boolean", "intersects", "(", "Geometry", "geometry", ",", "boolean", "usePrepared", ")", "{", "if", "(", "!", "getEnvelope", "(", ")", ".", "intersects", "(", "geometry", ".", "getEnvelopeInternal", "(", ")", ")", ")", "{", "return", "false", ";...
Check for intersection. @param geometry the geometry to check against. @param usePrepared use prepared geometry. @return true if the geometries intersect.
[ "Check", "for", "intersection", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureMate.java#L186-L198
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.writePropertyObjects
public void writePropertyObjects(CmsResource res, List<CmsProperty> properties) throws CmsException { getResourceType(res).writePropertyObjects(this, m_securityManager, res, properties); }
java
public void writePropertyObjects(CmsResource res, List<CmsProperty> properties) throws CmsException { getResourceType(res).writePropertyObjects(this, m_securityManager, res, properties); }
[ "public", "void", "writePropertyObjects", "(", "CmsResource", "res", ",", "List", "<", "CmsProperty", ">", "properties", ")", "throws", "CmsException", "{", "getResourceType", "(", "res", ")", ".", "writePropertyObjects", "(", "this", ",", "m_securityManager", ","...
Writes a list of properties for a specified resource.<p> Code calling this method has to ensure that the no properties <code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>, otherwise an exception is thrown.<p> @param res the resource @param properties the list of properties to write @throws CmsException if something goes wrong
[ "Writes", "a", "list", "of", "properties", "for", "a", "specified", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4086-L4089
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tools/StringTools.java
StringTools.readStream
public static String readStream(InputStream stream, String encoding) throws IOException { InputStreamReader isr = null; StringBuilder sb = new StringBuilder(); try { if (encoding == null) { isr = new InputStreamReader(stream); } else { isr = new InputStreamReader(stream, encoding); } try (BufferedReader br = new BufferedReader(isr)) { String line; while ((line = br.readLine()) != null) { sb.append(line); sb.append('\n'); } } } finally { if (isr != null) { isr.close(); } } return sb.toString(); }
java
public static String readStream(InputStream stream, String encoding) throws IOException { InputStreamReader isr = null; StringBuilder sb = new StringBuilder(); try { if (encoding == null) { isr = new InputStreamReader(stream); } else { isr = new InputStreamReader(stream, encoding); } try (BufferedReader br = new BufferedReader(isr)) { String line; while ((line = br.readLine()) != null) { sb.append(line); sb.append('\n'); } } } finally { if (isr != null) { isr.close(); } } return sb.toString(); }
[ "public", "static", "String", "readStream", "(", "InputStream", "stream", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStreamReader", "isr", "=", "null", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{",...
Read the text stream using the given encoding. @param stream InputStream the stream to be read @param encoding the stream's character encoding, e.g. {@code utf-8}, or {@code null} to use the system encoding @return a string with the stream's content, lines separated by {@code \n} (note that {@code \n} will be added to the last line even if it is not in the stream) @since 2.3
[ "Read", "the", "text", "stream", "using", "the", "given", "encoding", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/StringTools.java#L98-L120
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getInstanceStackLocation
public int getInstanceStackLocation(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins); } return numConsumed - 1; }
java
public int getInstanceStackLocation(Instruction ins, ConstantPoolGen cpg) throws DataflowAnalysisException { int numConsumed = ins.consumeStack(cpg); if (numConsumed == Const.UNPREDICTABLE) { throw new DataflowAnalysisException("Unpredictable stack consumption in " + ins); } return numConsumed - 1; }
[ "public", "int", "getInstanceStackLocation", "(", "Instruction", "ins", ",", "ConstantPoolGen", "cpg", ")", "throws", "DataflowAnalysisException", "{", "int", "numConsumed", "=", "ins", ".", "consumeStack", "(", "cpg", ")", ";", "if", "(", "numConsumed", "==", "...
Get the stack location (counting down from top of stack, starting at 0) containing the object instance referred to by given instruction. This relies on the observation that in instructions which use an object instance (such as getfield, invokevirtual, etc.), the object instance is the first operand used by the instruction. <p> The value returned may be passed to getStackValue(int). </p> @param ins the Instruction @param cpg the ConstantPoolGen for the method @return stack location (counting down from top of stack, starting at 0) containing the object instance @throws DataflowAnalysisException
[ "Get", "the", "stack", "location", "(", "counting", "down", "from", "top", "of", "stack", "starting", "at", "0", ")", "containing", "the", "object", "instance", "referred", "to", "by", "given", "instruction", ".", "This", "relies", "on", "the", "observation"...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L305-L311
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getMapKeyFieldType
public static Class<?> getMapKeyFieldType(Field mapField, int nestingLevel, Map<Integer, Integer> typeIndexesPerLevel) { return getGenericFieldType(mapField, Map.class, 0, typeIndexesPerLevel, nestingLevel); }
java
public static Class<?> getMapKeyFieldType(Field mapField, int nestingLevel, Map<Integer, Integer> typeIndexesPerLevel) { return getGenericFieldType(mapField, Map.class, 0, typeIndexesPerLevel, nestingLevel); }
[ "public", "static", "Class", "<", "?", ">", "getMapKeyFieldType", "(", "Field", "mapField", ",", "int", "nestingLevel", ",", "Map", "<", "Integer", ",", "Integer", ">", "typeIndexesPerLevel", ")", "{", "return", "getGenericFieldType", "(", "mapField", ",", "Ma...
Determine the generic key type of the given Map field. @param mapField the map field to introspect @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @param typeIndexesPerLevel Map keyed by nesting level, with each value expressing the type index for traversal at that level @return the generic type, or {@code null} if none
[ "Determine", "the", "generic", "key", "type", "of", "the", "given", "Map", "field", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L139-L141
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.EL2_L3
@Pure public static Point2d EL2_L3(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2E_N, LAMBERT_2E_C, LAMBERT_2E_XS, LAMBERT_2E_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
java
@Pure public static Point2d EL2_L3(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2E_N, LAMBERT_2E_C, LAMBERT_2E_XS, LAMBERT_2E_YS); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); }
[ "@", "Pure", "public", "static", "Point2d", "EL2_L3", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2E_N", ",", "LAMBERT_2E_C", ",", "LAMBERT_2E_XS", ",...
This function convert extended France Lambert II coordinate to France Lambert III coordinate. @param x is the coordinate in extended France Lambert II @param y is the coordinate in extended France Lambert II @return the France Lambert III coordinate.
[ "This", "function", "convert", "extended", "France", "Lambert", "II", "coordinate", "to", "France", "Lambert", "III", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L219-L232
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.createCollector
protected ClassCollector createCollector(CompilationUnit unit, SourceUnit su) { InnerLoader loader = AccessController.doPrivileged(new PrivilegedAction<InnerLoader>() { public InnerLoader run() { return new InnerLoader(GroovyClassLoader.this); } }); return new ClassCollector(loader, unit, su); }
java
protected ClassCollector createCollector(CompilationUnit unit, SourceUnit su) { InnerLoader loader = AccessController.doPrivileged(new PrivilegedAction<InnerLoader>() { public InnerLoader run() { return new InnerLoader(GroovyClassLoader.this); } }); return new ClassCollector(loader, unit, su); }
[ "protected", "ClassCollector", "createCollector", "(", "CompilationUnit", "unit", ",", "SourceUnit", "su", ")", "{", "InnerLoader", "loader", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "InnerLoader", ">", "(", ")", "{", "pub...
creates a ClassCollector for a new compilation. @param unit the compilationUnit @param su the SourceUnit @return the ClassCollector
[ "creates", "a", "ClassCollector", "for", "a", "new", "compilation", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L557-L564
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java
HTTPBatchClientConnectionInterceptor.prepareClientSSL
public SSLConnectionSocketFactory prepareClientSSL() { try { String path = Config.getProperty(Config.PROXY_KEYSTORE_PATH); String pass = Config.getProperty(Config.PROXY_KEYSTORE_PASSWORD); KeyStore trustStore = null; if (path != null && pass != null) { trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); FileInputStream instream = new FileInputStream(new File(path)); try { trustStore.load(instream, pass.toCharArray()); } finally { instream.close(); } } SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStore, new TrustSelfSignedStrategy()).build(); String tlsVersion = Config.getProperty(Config.TLS_VERSION); SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslContext, new String[]{tlsVersion}, null, new NoopHostnameVerifier()); return sslConnectionFactory; } catch (Exception ex) { LOG.error("couldn't create httpClient!! {}", ex.getMessage(), ex); return null; } }
java
public SSLConnectionSocketFactory prepareClientSSL() { try { String path = Config.getProperty(Config.PROXY_KEYSTORE_PATH); String pass = Config.getProperty(Config.PROXY_KEYSTORE_PASSWORD); KeyStore trustStore = null; if (path != null && pass != null) { trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); FileInputStream instream = new FileInputStream(new File(path)); try { trustStore.load(instream, pass.toCharArray()); } finally { instream.close(); } } SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStore, new TrustSelfSignedStrategy()).build(); String tlsVersion = Config.getProperty(Config.TLS_VERSION); SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory(sslContext, new String[]{tlsVersion}, null, new NoopHostnameVerifier()); return sslConnectionFactory; } catch (Exception ex) { LOG.error("couldn't create httpClient!! {}", ex.getMessage(), ex); return null; } }
[ "public", "SSLConnectionSocketFactory", "prepareClientSSL", "(", ")", "{", "try", "{", "String", "path", "=", "Config", ".", "getProperty", "(", "Config", ".", "PROXY_KEYSTORE_PATH", ")", ";", "String", "pass", "=", "Config", ".", "getProperty", "(", "Config", ...
Configures proxy if this is applicable to connection @throws FMSException
[ "Configures", "proxy", "if", "this", "is", "applicable", "to", "connection" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L177-L200
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/ServletContextFacesContextFactory.java
ServletContextFacesContextFactory.getFacesContext
@Override public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException { FacesContext result = null; if (null != initContextServletContextMap && !initContextServletContextMap.isEmpty()) { ServletContext servletContext = (ServletContext) FactoryFinder.FACTORIES_CACHE.getServletContextForCurrentClassLoader(); if (null != servletContext) { for (Map.Entry<FacesContext, ServletContext> entry : initContextServletContextMap.entrySet()) { if (servletContext.equals(entry.getValue())) { result = entry.getKey(); break; } } } } return result; }
java
@Override public FacesContext getFacesContext(Object context, Object request, Object response, Lifecycle lifecycle) throws FacesException { FacesContext result = null; if (null != initContextServletContextMap && !initContextServletContextMap.isEmpty()) { ServletContext servletContext = (ServletContext) FactoryFinder.FACTORIES_CACHE.getServletContextForCurrentClassLoader(); if (null != servletContext) { for (Map.Entry<FacesContext, ServletContext> entry : initContextServletContextMap.entrySet()) { if (servletContext.equals(entry.getValue())) { result = entry.getKey(); break; } } } } return result; }
[ "@", "Override", "public", "FacesContext", "getFacesContext", "(", "Object", "context", ",", "Object", "request", ",", "Object", "response", ",", "Lifecycle", "lifecycle", ")", "throws", "FacesException", "{", "FacesContext", "result", "=", "null", ";", "if", "(...
/* Consult the initContextServletContextMap (reflectively obtained from the FacesContext in our ctor). If it is non-empty, obtain the ServletContext corresponding to the current Thread's context ClassLoader. If found, use the initContextServletContextMap to find the FacesContext corresponding to that ServletContext.
[ "/", "*", "Consult", "the", "initContextServletContextMap", "(", "reflectively", "obtained", "from", "the", "FacesContext", "in", "our", "ctor", ")", ".", "If", "it", "is", "non", "-", "empty", "obtain", "the", "ServletContext", "corresponding", "to", "the", "...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/ServletContextFacesContextFactory.java#L138-L154
jpmml/jpmml-evaluator
pmml-evaluator/src/main/java/org/jpmml/evaluator/TypeUtil.java
TypeUtil.toFloat
static private Float toFloat(Object value){ if(value instanceof Float){ return (Float)value; } else if(value instanceof Double){ Number number = (Number)value; return toFloat(number.floatValue()); } else if((value instanceof Long) || (value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)){ Number number = (Number)value; return toFloat(number.floatValue()); } else if(value instanceof Boolean){ Boolean flag = (Boolean)value; return (flag.booleanValue() ? Numbers.FLOAT_ONE : Numbers.FLOAT_ZERO); } else if((value instanceof DaysSinceDate) || (value instanceof SecondsSinceDate) || (value instanceof SecondsSinceMidnight)){ Number number = (Number)value; return toFloat(number.floatValue()); } throw new TypeCheckException(DataType.FLOAT, value); }
java
static private Float toFloat(Object value){ if(value instanceof Float){ return (Float)value; } else if(value instanceof Double){ Number number = (Number)value; return toFloat(number.floatValue()); } else if((value instanceof Long) || (value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)){ Number number = (Number)value; return toFloat(number.floatValue()); } else if(value instanceof Boolean){ Boolean flag = (Boolean)value; return (flag.booleanValue() ? Numbers.FLOAT_ONE : Numbers.FLOAT_ZERO); } else if((value instanceof DaysSinceDate) || (value instanceof SecondsSinceDate) || (value instanceof SecondsSinceMidnight)){ Number number = (Number)value; return toFloat(number.floatValue()); } throw new TypeCheckException(DataType.FLOAT, value); }
[ "static", "private", "Float", "toFloat", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Float", ")", "{", "return", "(", "Float", ")", "value", ";", "}", "else", "if", "(", "value", "instanceof", "Double", ")", "{", "Number", "num...
<p> Casts the specified value to Float data type. </p> @see DataType#FLOAT
[ "<p", ">", "Casts", "the", "specified", "value", "to", "Float", "data", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/jpmml/jpmml-evaluator/blob/ac8a48775877b6fa9dbc5f259871f3278489cc61/pmml-evaluator/src/main/java/org/jpmml/evaluator/TypeUtil.java#L629-L661
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedConnection.java
MemcachedConnection.dbgBuffer
static String dbgBuffer(ByteBuffer b, int size) { StringBuilder sb = new StringBuilder(); byte[] bytes = b.array(); for (int i = 0; i < size; i++) { char ch = (char) bytes[i]; if (Character.isWhitespace(ch) || Character.isLetterOrDigit(ch)) { sb.append(ch); } else { sb.append("\\x"); sb.append(Integer.toHexString(bytes[i] & 0xff)); } } return sb.toString(); }
java
static String dbgBuffer(ByteBuffer b, int size) { StringBuilder sb = new StringBuilder(); byte[] bytes = b.array(); for (int i = 0; i < size; i++) { char ch = (char) bytes[i]; if (Character.isWhitespace(ch) || Character.isLetterOrDigit(ch)) { sb.append(ch); } else { sb.append("\\x"); sb.append(Integer.toHexString(bytes[i] & 0xff)); } } return sb.toString(); }
[ "static", "String", "dbgBuffer", "(", "ByteBuffer", "b", ",", "int", "size", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "byte", "[", "]", "bytes", "=", "b", ".", "array", "(", ")", ";", "for", "(", "int", "i", "=",...
Convert the {@link ByteBuffer} into a string for easier debugging. @param b the buffer to debug. @param size the size of the buffer. @return the stringified {@link ByteBuffer}.
[ "Convert", "the", "{", "@link", "ByteBuffer", "}", "into", "a", "string", "for", "easier", "debugging", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedConnection.java#L936-L949
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java
DriverRestartManager.onRestart
public synchronized void onRestart(final StartTime startTime, final List<EventHandler<DriverRestarted>> orderedHandlers) { if (this.state == DriverRestartState.BEGAN) { restartEvaluators = driverRuntimeRestartManager.getPreviousEvaluators(); final DriverRestarted restartedInfo = new DriverRestartedImpl(resubmissionAttempts, startTime, restartEvaluators); for (final EventHandler<DriverRestarted> handler : orderedHandlers) { handler.onNext(restartedInfo); } this.state = DriverRestartState.IN_PROGRESS; } else { final String errMsg = "Should not be setting the set of expected alive evaluators more than once."; LOG.log(Level.SEVERE, errMsg); throw new DriverFatalRuntimeException(errMsg); } driverRuntimeRestartManager.informAboutEvaluatorFailures(getFailedEvaluators()); if (driverRestartEvaluatorRecoverySeconds != Integer.MAX_VALUE) { // Don't use Clock here because if there is an event scheduled, the driver will not be idle, even if // driver restart has already completed, and we cannot cancel the event. restartCompletedTimer.schedule(new TimerTask() { @Override public void run() { onDriverRestartCompleted(true); } }, driverRestartEvaluatorRecoverySeconds * 1000L); } }
java
public synchronized void onRestart(final StartTime startTime, final List<EventHandler<DriverRestarted>> orderedHandlers) { if (this.state == DriverRestartState.BEGAN) { restartEvaluators = driverRuntimeRestartManager.getPreviousEvaluators(); final DriverRestarted restartedInfo = new DriverRestartedImpl(resubmissionAttempts, startTime, restartEvaluators); for (final EventHandler<DriverRestarted> handler : orderedHandlers) { handler.onNext(restartedInfo); } this.state = DriverRestartState.IN_PROGRESS; } else { final String errMsg = "Should not be setting the set of expected alive evaluators more than once."; LOG.log(Level.SEVERE, errMsg); throw new DriverFatalRuntimeException(errMsg); } driverRuntimeRestartManager.informAboutEvaluatorFailures(getFailedEvaluators()); if (driverRestartEvaluatorRecoverySeconds != Integer.MAX_VALUE) { // Don't use Clock here because if there is an event scheduled, the driver will not be idle, even if // driver restart has already completed, and we cannot cancel the event. restartCompletedTimer.schedule(new TimerTask() { @Override public void run() { onDriverRestartCompleted(true); } }, driverRestartEvaluatorRecoverySeconds * 1000L); } }
[ "public", "synchronized", "void", "onRestart", "(", "final", "StartTime", "startTime", ",", "final", "List", "<", "EventHandler", "<", "DriverRestarted", ">", ">", "orderedHandlers", ")", "{", "if", "(", "this", ".", "state", "==", "DriverRestartState", ".", "...
Recovers the list of alive and failed evaluators and inform the driver restart handlers and inform the evaluator failure handlers based on the specific runtime. Also sets the expected amount of evaluators to report back as alive to the job driver.
[ "Recovers", "the", "list", "of", "alive", "and", "failed", "evaluators", "and", "inform", "the", "driver", "restart", "handlers", "and", "inform", "the", "evaluator", "failure", "handlers", "based", "on", "the", "specific", "runtime", ".", "Also", "sets", "the...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L111-L140
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java
Utility.checkCompare
public static <T extends Comparable<T>> int checkCompare(T a, T b) { return a == null ? b == null ? 0 : -1 : b == null ? 1 : a.compareTo(b); }
java
public static <T extends Comparable<T>> int checkCompare(T a, T b) { return a == null ? b == null ? 0 : -1 : b == null ? 1 : a.compareTo(b); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "int", "checkCompare", "(", "T", "a", ",", "T", "b", ")", "{", "return", "a", "==", "null", "?", "b", "==", "null", "?", "0", ":", "-", "1", ":", "b", "==", "null", "?...
Convenience utility. Does null checks on objects, then calls compare.
[ "Convenience", "utility", ".", "Does", "null", "checks", "on", "objects", "then", "calls", "compare", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L200-L204
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolRequest.java
UpdateIdentityPoolRequest.withIdentityPoolTags
public UpdateIdentityPoolRequest withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
java
public UpdateIdentityPoolRequest withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
[ "public", "UpdateIdentityPoolRequest", "withIdentityPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "identityPoolTags", ")", "{", "setIdentityPoolTags", "(", "identityPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param identityPoolTags The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "are", "assigned", "to", "the", "identity", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "apply", "to", "identity", "pools", "to", "categorize", "and", "manage", "them", "in", "different", "ways", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolRequest.java#L571-L574
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UIInput.java
UIInput.compareValues
protected boolean compareValues(Object previous, Object value) { boolean result = true; if (previous == null) { result = (value != null); } else if (value == null) { result = true; } else { boolean previousEqualsValue = previous.equals(value); if (!previousEqualsValue && previous instanceof Comparable && value instanceof Comparable) { try { result = !(0 == ((Comparable) previous). compareTo((Comparable) value)); } catch (ClassCastException cce) { // Comparable throws CCE if the types prevent a comparison result = true; } } else { result = !previousEqualsValue; } } return result; }
java
protected boolean compareValues(Object previous, Object value) { boolean result = true; if (previous == null) { result = (value != null); } else if (value == null) { result = true; } else { boolean previousEqualsValue = previous.equals(value); if (!previousEqualsValue && previous instanceof Comparable && value instanceof Comparable) { try { result = !(0 == ((Comparable) previous). compareTo((Comparable) value)); } catch (ClassCastException cce) { // Comparable throws CCE if the types prevent a comparison result = true; } } else { result = !previousEqualsValue; } } return result; }
[ "protected", "boolean", "compareValues", "(", "Object", "previous", ",", "Object", "value", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "previous", "==", "null", ")", "{", "result", "=", "(", "value", "!=", "null", ")", ";", "}", "else"...
<p>Return <code>true</code> if the new value is different from the previous value. First compare the two values by passing <em>value</em> to the <code>equals</code> method on argument <em>previous</em>. If that method returns <code>true</code>, return <code>true</code>. If that method returns <code>false</code>, and both arguments implement <code>java.lang.Comparable</code>, compare the two values by passing <em>value</em> to the <code>compareTo</code> method on argument <em>previous</em>. Return <code>true</code> if this method returns <code>0</code>, <code>false</code> otherwise.</p> @param previous old value of this component (if any) @param value new value of this component (if any)
[ "<p", ">", "Return", "<code", ">", "true<", "/", "code", ">", "if", "the", "new", "value", "is", "different", "from", "the", "previous", "value", ".", "First", "compare", "the", "two", "values", "by", "passing", "<em", ">", "value<", "/", "em", ">", ...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIInput.java#L1216-L1240
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_region_regionName_workflow_backup_GET
public ArrayList<OvhBackup> project_serviceName_region_regionName_workflow_backup_GET(String serviceName, String regionName) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup"; StringBuilder sb = path(qPath, serviceName, regionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhBackup> project_serviceName_region_regionName_workflow_backup_GET(String serviceName, String regionName) throws IOException { String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup"; StringBuilder sb = path(qPath, serviceName, regionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhBackup", ">", "project_serviceName_region_regionName_workflow_backup_GET", "(", "String", "serviceName", ",", "String", "regionName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/region/{regionName}/w...
List your automated backups REST: GET /cloud/project/{serviceName}/region/{regionName}/workflow/backup @param regionName [required] Public Cloud region @param serviceName [required] Public Cloud project API beta
[ "List", "your", "automated", "backups" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L170-L175
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/user/screen/UserPasswordChange.java
UserPasswordChange.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { boolean bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (bFlag) return super.doCommand(MenuConstants.HOME, sourceSField, iCommandOptions); return bFlag; }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { boolean bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (bFlag) return super.doCommand(MenuConstants.HOME, sourceSField, iCommandOptions); return bFlag; }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "boolean", "bFlag", "=", "super", ".", "doCommand", "(", "strCommand", ",", "sourceSField", ",", "iCommandOptions", ")", "...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserPasswordChange.java#L124-L131
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java
XmlRpcRemoteRunner.runSpecification
public Execution runSpecification(String projectName, String sutName, String repositoryId, String specificationName, boolean implementedVersion, String locale) throws GreenPepperServerException { SystemUnderTest sut = SystemUnderTest.newInstance(sutName); sut.setProject(Project.newInstance(projectName)); Specification specification = Specification.newInstance(specificationName); specification.setRepository(Repository.newInstance(repositoryId)); return runSpecification(sut, specification, implementedVersion, locale); }
java
public Execution runSpecification(String projectName, String sutName, String repositoryId, String specificationName, boolean implementedVersion, String locale) throws GreenPepperServerException { SystemUnderTest sut = SystemUnderTest.newInstance(sutName); sut.setProject(Project.newInstance(projectName)); Specification specification = Specification.newInstance(specificationName); specification.setRepository(Repository.newInstance(repositoryId)); return runSpecification(sut, specification, implementedVersion, locale); }
[ "public", "Execution", "runSpecification", "(", "String", "projectName", ",", "String", "sutName", ",", "String", "repositoryId", ",", "String", "specificationName", ",", "boolean", "implementedVersion", ",", "String", "locale", ")", "throws", "GreenPepperServerExceptio...
<p>runSpecification.</p> @param projectName a {@link java.lang.String} object. @param sutName a {@link java.lang.String} object. @param repositoryId a {@link java.lang.String} object. @param specificationName a {@link java.lang.String} object. @param implementedVersion a boolean. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Execution} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "runSpecification", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java#L99-L110