method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public StringValue client_encoding(Env env) { return character_set_name(env); }
StringValue function(Env env) { return character_set_name(env); }
/** * Alias for character_set_name */
Alias for character_set_name
client_encoding
{ "repo_name": "dlitz/resin", "path": "modules/quercus/src/com/caucho/quercus/lib/db/Mysqli.java", "license": "gpl-2.0", "size": 42236 }
[ "com.caucho.quercus.env.Env", "com.caucho.quercus.env.StringValue" ]
import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
451,507
public static boolean isSignedIn(HttpServletRequest request) { return request.getSession().getAttribute("signedInOperatorId") != null; }
static boolean function(HttpServletRequest request) { return request.getSession().getAttribute(STR) != null; }
/** * This function checks if an operator is signed in * * @param request * @return */
This function checks if an operator is signed in
isSignedIn
{ "repo_name": "ixasuhan/easyrec", "path": "easyrec-web/src/main/java/org/easyrec/utils/Security.java", "license": "gpl-3.0", "size": 8391 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
417,919
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<NetAppAccountInner> createOrUpdateAsync( String resourceGroupName, String accountName, NetAppAccountInner body) { return beginCreateOrUpdateAsync(resourceGroupName, accountName, body) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<NetAppAccountInner> function( String resourceGroupName, String accountName, NetAppAccountInner body) { return beginCreateOrUpdateAsync(resourceGroupName, accountName, body) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Create or update the specified NetApp account within the resource group. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. * @param body NetApp Account object supplied in the body of the operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return netApp account resource on successful completion of {@link Mono}. */
Create or update the specified NetApp account within the resource group
createOrUpdateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/implementation/AccountsClientImpl.java", "license": "mit", "size": 75086 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.netapp.fluent.models.NetAppAccountInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.netapp.fluent.models.NetAppAccountInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.netapp.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,807,795
public Double getValue(int number) { GpioPin pin = pins.get(number); if(pin != null) { if(pin instanceof GpioPinAnalog) { return Double.valueOf(gpio.getValue((GpioPinAnalog) pin)); } } return null; }
Double function(int number) { GpioPin pin = pins.get(number); if(pin != null) { if(pin instanceof GpioPinAnalog) { return Double.valueOf(gpio.getValue((GpioPinAnalog) pin)); } } return null; }
/** * Returns the actual value of the analog input pin * @param number of the pin * @return value as <code>Double</code> or null if the pin does not exist or is not a analog */
Returns the actual value of the analog input pin
getValue
{ "repo_name": "skoeber/RestPi", "path": "RestPi/src/de/skoeber/environment/GpioEnvironment.java", "license": "gpl-3.0", "size": 4891 }
[ "com.pi4j.io.gpio.GpioPin", "com.pi4j.io.gpio.GpioPinAnalog" ]
import com.pi4j.io.gpio.GpioPin; import com.pi4j.io.gpio.GpioPinAnalog;
import com.pi4j.io.gpio.*;
[ "com.pi4j.io" ]
com.pi4j.io;
2,335,537
public Operand findOperandByName(String operandName) { QualifiedName qualifiedOperandName = QualifiedName.parseName(operandName, operandMap.getQualifiedContextname()); Operand operand = operandMap.get(qualifiedOperandName); if ((operand == null) && !qualifiedOperandName.getTemplate().isEmpty()) { qualifiedOperandName.clearTemplate(); operand = operandMap.get(qualifiedOperandName); } if ((operand == null) && !qualifiedOperandName.getScope().isEmpty()) { qualifiedOperandName.clearScope(); operand = operandMap.get(qualifiedOperandName); } return operand; }
Operand function(String operandName) { QualifiedName qualifiedOperandName = QualifiedName.parseName(operandName, operandMap.getQualifiedContextname()); Operand operand = operandMap.get(qualifiedOperandName); if ((operand == null) && !qualifiedOperandName.getTemplate().isEmpty()) { qualifiedOperandName.clearTemplate(); operand = operandMap.get(qualifiedOperandName); } if ((operand == null) && !qualifiedOperandName.getScope().isEmpty()) { qualifiedOperandName.clearScope(); operand = operandMap.get(qualifiedOperandName); } return operand; }
/** * Returns operand identified by name * @param operandName * @return Operand object from same scope or global scope or null if not found */
Returns operand identified by name
findOperandByName
{ "repo_name": "andrew-bowley/xpl", "path": "parser/src/main/java/au/com/cybersearch2/classy_logic/compile/ParserAssembler.java", "license": "gpl-3.0", "size": 37201 }
[ "au.com.cybersearch2.classy_logic.helper.QualifiedName", "au.com.cybersearch2.classy_logic.interfaces.Operand" ]
import au.com.cybersearch2.classy_logic.helper.QualifiedName; import au.com.cybersearch2.classy_logic.interfaces.Operand;
import au.com.cybersearch2.classy_logic.helper.*; import au.com.cybersearch2.classy_logic.interfaces.*;
[ "au.com.cybersearch2" ]
au.com.cybersearch2;
881,148
public void setCacheManager(net.sf.ehcache.CacheManager manager) { this.manager = manager; }
void function(net.sf.ehcache.CacheManager manager) { this.manager = manager; }
/** * Sets the wrapped Ehcache {@link net.sf.ehcache.CacheManager CacheManager} instance. * * @param manager the wrapped Ehcache {@link net.sf.ehcache.CacheManager CacheManager} instance. */
Sets the wrapped Ehcache <code>net.sf.ehcache.CacheManager CacheManager</code> instance
setCacheManager
{ "repo_name": "mugenya/arch_app", "path": "src/main/java/lab/s2jh/core/security/SharedEhCacheManager.java", "license": "lgpl-3.0", "size": 9605 }
[ "org.apache.shiro.cache.CacheManager" ]
import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.cache.*;
[ "org.apache.shiro" ]
org.apache.shiro;
2,514,203
// --------------------------------------------------------------------------------------------------------|| // ClassName: FaceletTaglibTagAttributeType ElementName: javaee:generic-booleanType ElementType : required // MaxOccurs: - isGeneric: true isAttribute: false isEnum: true isDataType: false // --------------------------------------------------------------------------------------------------------|| public FaceletTaglibTagAttributeType<T> required(GenericBooleanType required); public FaceletTaglibTagAttributeType<T> required(String required);
FaceletTaglibTagAttributeType<T> function(GenericBooleanType required); FaceletTaglibTagAttributeType<T> function(String required);
/** * Sets the <code>required</code> element * @param required the value for the element <code>required</code> * @return the current instance of <code>FaceletTaglibTagAttributeType<T></code> */
Sets the <code>required</code> element
required
{ "repo_name": "forge/javaee-descriptors", "path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/facelettaglibrary20/FaceletTaglibTagAttributeType.java", "license": "epl-1.0", "size": 8945 }
[ "org.jboss.shrinkwrap.descriptor.api.javaee5.GenericBooleanType" ]
import org.jboss.shrinkwrap.descriptor.api.javaee5.GenericBooleanType;
import org.jboss.shrinkwrap.descriptor.api.javaee5.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
227,528
public RatingCompat getRating(String key) { RatingCompat rating = null; try { rating = mBundle.getParcelable(key); } catch (Exception e) { // ignore, value was not a bitmap Log.w(TAG, "Failed to retrieve a key as Rating.", e); } return rating; }
RatingCompat function(String key) { RatingCompat rating = null; try { rating = mBundle.getParcelable(key); } catch (Exception e) { Log.w(TAG, STR, e); } return rating; }
/** * Return a {@link RatingCompat} for the given key or null if no rating exists for * the given key. * * @param key The key the value is stored under * @return A {@link RatingCompat} or null */
Return a <code>RatingCompat</code> for the given key or null if no rating exists for the given key
getRating
{ "repo_name": "kingargyle/adt-leanback-support", "path": "support-v4/src/main/java/android/support/v4/media/MediaMetadataCompat.java", "license": "apache-2.0", "size": 23582 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,615,871
@Override public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
void function(String parameterName, InputStream x, long length) throws SQLException { setAsciiStream(getIndexForName(parameterName), x, length); }
/** * Sets the value of a parameter as an ASCII stream. * This method does not close the stream. * The stream may be closed after executing the statement. * * @param parameterName the parameter name * @param x the value * @param length the maximum number of bytes * @throws SQLException if this object is closed */
Sets the value of a parameter as an ASCII stream. This method does not close the stream. The stream may be closed after executing the statement
setAsciiStream
{ "repo_name": "vdr007/ThriftyPaxos", "path": "src/applications/h2/src/main/org/h2/jdbc/JdbcCallableStatement.java", "license": "apache-2.0", "size": 53148 }
[ "java.io.InputStream", "java.sql.SQLException" ]
import java.io.InputStream; import java.sql.SQLException;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
2,447,691
public static GQuery $(Event event) { return event == null ? $() : $((Element) event.getCurrentEventTarget().cast()); }
public static GQuery $(Event event) { return event == null ? $() : $((Element) event.getCurrentEventTarget().cast()); }
/** * Wrap a GQuery around an event's target element. */
Wrap a GQuery around an event's target element
$
{ "repo_name": "stori-es/stori_es", "path": "dashboard/src/main/java/com/google/gwt/query/client/GQuery.java", "license": "apache-2.0", "size": 177285 }
[ "com.google.gwt.dom.client.Element", "com.google.gwt.user.client.Event" ]
import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.Event;
import com.google.gwt.dom.client.*; import com.google.gwt.user.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,364,237
@Override public void launch(ISelection selection, String mode) { if (! (selection instanceof IStructuredSelection)) { return; } IStructuredSelection structuredSelection = (IStructuredSelection) selection; List<IFile> files = new LinkedList<IFile>(); for (Object object : structuredSelection.toList()) { if (object instanceof IAdaptable) { IResource resource = (IResource) ((IAdaptable)object).getAdapter(IResource.class); if (resource != null) { if (resource instanceof IProject) { final IProject project = (IProject)resource; Module mod = LaunchHelper.getDefaultOrOnlyModule(project, true); if (mod == null) { mod = LaunchHelper.chooseModule(project, true); } if (mod != null) { launchModule(mod, resource, mode); return; // do not look at other parts of the selection } else { return; } } else if (resource instanceof IFolder && LaunchHelper.getModule((IFolder)resource) != null) { //check for module launchModule(LaunchHelper.getModule((IFolder)resource), resource, mode); return; } else { LaunchHelper.addFiles(files, resource); } } } } searchAndLaunch(files, mode); }
void function(ISelection selection, String mode) { if (! (selection instanceof IStructuredSelection)) { return; } IStructuredSelection structuredSelection = (IStructuredSelection) selection; List<IFile> files = new LinkedList<IFile>(); for (Object object : structuredSelection.toList()) { if (object instanceof IAdaptable) { IResource resource = (IResource) ((IAdaptable)object).getAdapter(IResource.class); if (resource != null) { if (resource instanceof IProject) { final IProject project = (IProject)resource; Module mod = LaunchHelper.getDefaultOrOnlyModule(project, true); if (mod == null) { mod = LaunchHelper.chooseModule(project, true); } if (mod != null) { launchModule(mod, resource, mode); return; } else { return; } } else if (resource instanceof IFolder && LaunchHelper.getModule((IFolder)resource) != null) { launchModule(LaunchHelper.getModule((IFolder)resource), resource, mode); return; } else { LaunchHelper.addFiles(files, resource); } } } } searchAndLaunch(files, mode); }
/** * Launch from a Navigation selection - right-click, run-as or debug-as */
Launch from a Navigation selection - right-click, run-as or debug-as
launch
{ "repo_name": "ceylon/ceylon-ide-eclipse", "path": "plugins/org.eclipse.ceylon.ide.eclipse.ui/src/org/eclipse/ceylon/ide/eclipse/core/launch/CeylonModuleLaunchShortcut.java", "license": "epl-1.0", "size": 17415 }
[ "java.util.LinkedList", "java.util.List", "org.eclipse.ceylon.model.typechecker.model.Module", "org.eclipse.core.resources.IFile", "org.eclipse.core.resources.IFolder", "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IResource", "org.eclipse.core.runtime.IAdaptable", "org.eclipse.jface.viewers.ISelection", "org.eclipse.jface.viewers.IStructuredSelection" ]
import java.util.LinkedList; import java.util.List; import org.eclipse.ceylon.model.typechecker.model.Module; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection;
import java.util.*; import org.eclipse.ceylon.model.typechecker.model.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jface.viewers.*;
[ "java.util", "org.eclipse.ceylon", "org.eclipse.core", "org.eclipse.jface" ]
java.util; org.eclipse.ceylon; org.eclipse.core; org.eclipse.jface;
520,345
public Instant getStopTime() { return internal.getStopTime(); }
Instant function() { return internal.getStopTime(); }
/** * Returns the time when this recording was stopped. * * @return the time, or {@code null} if this recording is not stopped */
Returns the time when this recording was stopped
getStopTime
{ "repo_name": "md-5/jdk10", "path": "src/jdk.jfr/share/classes/jdk/jfr/Recording.java", "license": "gpl-2.0", "size": 24253 }
[ "java.time.Instant" ]
import java.time.Instant;
import java.time.*;
[ "java.time" ]
java.time;
1,172,057
public void assertExists(String message, Path path) throws IOException { FileSystemTestUtils.assertPathExists(sFileSystem, message, path); }
void function(String message, Path path) throws IOException { FileSystemTestUtils.assertPathExists(sFileSystem, message, path); }
/** * assert that a path exists * @param message message to use in an assertion * @param path path to probe * @throws IOException IO problems */
assert that a path exists
assertExists
{ "repo_name": "SparkTC/stocator", "path": "src/test/java/com/ibm/stocator/fs/swift2d/systemtests/SwiftFileSystemBaseTest.java", "license": "apache-2.0", "size": 3815 }
[ "com.ibm.stocator.fs.common.FileSystemTestUtils", "java.io.IOException", "org.apache.hadoop.fs.Path" ]
import com.ibm.stocator.fs.common.FileSystemTestUtils; import java.io.IOException; import org.apache.hadoop.fs.Path;
import com.ibm.stocator.fs.common.*; import java.io.*; import org.apache.hadoop.fs.*;
[ "com.ibm.stocator", "java.io", "org.apache.hadoop" ]
com.ibm.stocator; java.io; org.apache.hadoop;
1,089,516
@SneakyThrows(IOException.class) public IndexedNodeType[] findReplacementForNode(String nodeTemplateName, Topology topology) { NodeTemplate nodeTemplate = topology.getNodeTemplates().get(nodeTemplateName); Map<String, Map<String, Set<String>>> nodeTemplatesToFilters = Maps.newHashMap(); Entry<String, NodeTemplate> nodeTempEntry = Maps.immutableEntry(nodeTemplateName, nodeTemplate); IndexedNodeType indexedNodeType = csarRepoSearchService.getRequiredElementInDependencies(IndexedNodeType.class, nodeTemplate.getType(), topology.getDependencies()); processNodeTemplate(topology, nodeTempEntry, nodeTemplatesToFilters); List<SuggestionsTask> topoTasks = searchForNodeTypes(nodeTemplatesToFilters, MapUtil.newHashMap(new String[] { nodeTemplateName }, new IndexedNodeType[] { indexedNodeType })); if (CollectionUtils.isEmpty(topoTasks)) { return null; } return topoTasks.get(0).getSuggestedNodeTypes(); }
@SneakyThrows(IOException.class) IndexedNodeType[] function(String nodeTemplateName, Topology topology) { NodeTemplate nodeTemplate = topology.getNodeTemplates().get(nodeTemplateName); Map<String, Map<String, Set<String>>> nodeTemplatesToFilters = Maps.newHashMap(); Entry<String, NodeTemplate> nodeTempEntry = Maps.immutableEntry(nodeTemplateName, nodeTemplate); IndexedNodeType indexedNodeType = csarRepoSearchService.getRequiredElementInDependencies(IndexedNodeType.class, nodeTemplate.getType(), topology.getDependencies()); processNodeTemplate(topology, nodeTempEntry, nodeTemplatesToFilters); List<SuggestionsTask> topoTasks = searchForNodeTypes(nodeTemplatesToFilters, MapUtil.newHashMap(new String[] { nodeTemplateName }, new IndexedNodeType[] { indexedNodeType })); if (CollectionUtils.isEmpty(topoTasks)) { return null; } return topoTasks.get(0).getSuggestedNodeTypes(); }
/** * Find replacements nodes for a node template * * @param nodeTemplateName the node to search for replacements * @param topology the topology * @return all possible replacement types for this node */
Find replacements nodes for a node template
findReplacementForNode
{ "repo_name": "xdegenne/alien4cloud", "path": "alien4cloud-core/src/main/java/alien4cloud/topology/TopologyService.java", "license": "apache-2.0", "size": 24083 }
[ "com.google.common.collect.Maps", "java.io.IOException", "java.util.List", "java.util.Map", "java.util.Set", "org.apache.commons.collections4.CollectionUtils" ]
import com.google.common.collect.Maps; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.collections4.CollectionUtils;
import com.google.common.collect.*; import java.io.*; import java.util.*; import org.apache.commons.collections4.*;
[ "com.google.common", "java.io", "java.util", "org.apache.commons" ]
com.google.common; java.io; java.util; org.apache.commons;
1,723,206
public void setStartDate(LocalDate startDate) { // CONVERT LocalDate args into MS DateFromat String Instant instant = startDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant(); long timeInMillis = instant.toEpochMilli(); this.startDate = "/Date(" + Long.toString(timeInMillis) + "+0000)/"; }
void function(LocalDate startDate) { Instant instant = startDate.atStartOfDay(ZoneId.of("UTC").normalized()).toInstant(); long timeInMillis = instant.toEpochMilli(); this.startDate = STR + Long.toString(timeInMillis) + STR; }
/** * Period start date (YYYY-MM-DD) * * @param startDate LocalDateTime */
Period start date (YYYY-MM-DD)
setStartDate
{ "repo_name": "XeroAPI/Xero-Java", "path": "src/main/java/com/xero/models/payrollau/Timesheet.java", "license": "mit", "size": 12424 }
[ "org.threeten.bp.Instant", "org.threeten.bp.LocalDate", "org.threeten.bp.ZoneId" ]
import org.threeten.bp.Instant; import org.threeten.bp.LocalDate; import org.threeten.bp.ZoneId;
import org.threeten.bp.*;
[ "org.threeten.bp" ]
org.threeten.bp;
837,931
public static Color lighten( final int r, final int g, final int b, final double percent ) throws IllegalArgumentException { GeneralUtils.checkValidPercent(percent); int r2, g2, b2; r2 = r + (int)((255 - r) * percent ); g2 = g + (int)((255 - g) * percent ); b2 = b + (int)((255 - b) * percent ); return new Color( r2, g2, b2 ); }
static Color function( final int r, final int g, final int b, final double percent ) throws IllegalArgumentException { GeneralUtils.checkValidPercent(percent); int r2, g2, b2; r2 = r + (int)((255 - r) * percent ); g2 = g + (int)((255 - g) * percent ); b2 = b + (int)((255 - b) * percent ); return new Color( r2, g2, b2 ); }
/** * Lightens a given color by the specified percentage. * @param r The red component of the color to lighten. * @param g The green component of the color to lighten. * @param b The blue component of the color to lighten. * @param percent percentage to lighten. Needs to be <= 1 && >= 0. * @return a new Color with the desired characteristics. * @exception IllegalArgumentException * if the specified percentage value is unacceptable */
Lightens a given color by the specified percentage
lighten
{ "repo_name": "theanuradha/debrief", "path": "org.mwc.cmap.legacy/src/MWC/GUI/TabPanel/ColorUtils.java", "license": "epl-1.0", "size": 7080 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,152,097
public List getMeasureHeadersAfter(int number) { List headers = new ArrayList(); Iterator it = getSong().getMeasureHeaders(); while(it.hasNext()){ TGMeasureHeader header = (TGMeasureHeader)it.next(); if (header.getNumber() > number) { headers.add(header); } } return headers; }
List function(int number) { List headers = new ArrayList(); Iterator it = getSong().getMeasureHeaders(); while(it.hasNext()){ TGMeasureHeader header = (TGMeasureHeader)it.next(); if (header.getNumber() > number) { headers.add(header); } } return headers; }
/** * Retorna Todos los desde Start hasta el final del compas */
Retorna Todos los desde Start hasta el final del compas
getMeasureHeadersAfter
{ "repo_name": "Partysun/SE452-Tux-Guitar", "path": "TuxGuitar/src/org/herac/tuxguitar/song/managers/TGSongManager.java", "license": "lgpl-2.1", "size": 27305 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.herac.tuxguitar.song.models.TGMeasureHeader" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.herac.tuxguitar.song.models.TGMeasureHeader;
import java.util.*; import org.herac.tuxguitar.song.models.*;
[ "java.util", "org.herac.tuxguitar" ]
java.util; org.herac.tuxguitar;
2,425,725
protected void onWhitelisted(HttpServletRequest request, String origin, IRequestablePage page) { }
void function(HttpServletRequest request, String origin, IRequestablePage page) { }
/** * Called when the origin was available in the whitelist. Override this method to implement your * own custom action. * * @param request * the request * @param origin * the contents of the {@code Origin} HTTP header * @param page * the page that is targeted with this request */
Called when the origin was available in the whitelist. Override this method to implement your own custom action
onWhitelisted
{ "repo_name": "AlienQueen/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/protocol/http/CsrfPreventionRequestCycleListener.java", "license": "apache-2.0", "size": 24027 }
[ "javax.servlet.http.HttpServletRequest", "org.apache.wicket.request.component.IRequestablePage" ]
import javax.servlet.http.HttpServletRequest; import org.apache.wicket.request.component.IRequestablePage;
import javax.servlet.http.*; import org.apache.wicket.request.component.*;
[ "javax.servlet", "org.apache.wicket" ]
javax.servlet; org.apache.wicket;
797,284
private ResultSet executeSqlQueryWithTimer(String space, PreparedStatement stmt, Connection conn, String sql, @Nullable Collection<Object> params, int timeoutMillis, @Nullable GridQueryCancel cancel) throws IgniteCheckedException { long start = U.currentTimeMillis(); try { ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis, cancel); long time = U.currentTimeMillis() - start; long longQryExecTimeout = schemas.get(schema(space)).ccfg.getLongQueryWarningTimeout(); if (time > longQryExecTimeout) { String msg = "Query execution is too long (" + time + " ms): " + sql; ResultSet plan = executeSqlQuery(conn, preparedStatementWithParams(conn, "EXPLAIN " + sql, params, false), 0, null); plan.next(); // Add SQL explain result message into log. String longMsg = "Query execution is too long [time=" + time + " ms, sql='" + sql + '\'' + ", plan=" + U.nl() + plan.getString(1) + U.nl() + ", parameters=" + params + "]"; LT.warn(log, longMsg, msg); } return rs; } catch (SQLException e) { onSqlException(); throw new IgniteCheckedException(e); } }
ResultSet function(String space, PreparedStatement stmt, Connection conn, String sql, @Nullable Collection<Object> params, int timeoutMillis, @Nullable GridQueryCancel cancel) throws IgniteCheckedException { long start = U.currentTimeMillis(); try { ResultSet rs = executeSqlQuery(conn, stmt, timeoutMillis, cancel); long time = U.currentTimeMillis() - start; long longQryExecTimeout = schemas.get(schema(space)).ccfg.getLongQueryWarningTimeout(); if (time > longQryExecTimeout) { String msg = STR + time + STR + sql; ResultSet plan = executeSqlQuery(conn, preparedStatementWithParams(conn, STR + sql, params, false), 0, null); plan.next(); String longMsg = STR + time + STR + sql + '\'' + STR + U.nl() + plan.getString(1) + U.nl() + STR + params + "]"; LT.warn(log, longMsg, msg); } return rs; } catch (SQLException e) { onSqlException(); throw new IgniteCheckedException(e); } }
/** * Executes sql query and prints warning if query is too slow. * * @param space Space name. * @param stmt Prepared statement for query. * @param conn Connection. * @param sql Sql query. * @param params Parameters. * @param cancel Query cancel. * @return Result. * @throws IgniteCheckedException If failed. */
Executes sql query and prints warning if query is too slow
executeSqlQueryWithTimer
{ "repo_name": "vldpyatkov/ignite", "path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java", "license": "apache-2.0", "size": 103303 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.Collection", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.IgniteSystemProperties", "org.apache.ignite.internal.processors.query.GridQueryCancel", "org.apache.ignite.internal.util.typedef.internal.LT", "org.apache.ignite.internal.util.typedef.internal.U", "org.jetbrains.annotations.Nullable" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.internal.processors.query.GridQueryCancel; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable;
import java.sql.*; import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*;
[ "java.sql", "java.util", "org.apache.ignite", "org.jetbrains.annotations" ]
java.sql; java.util; org.apache.ignite; org.jetbrains.annotations;
2,872,747
public Map<String, Slice> getSlicesMap() { return slices; }
Map<String, Slice> function() { return slices; }
/** * Get the map of all slices (sliceName-&gt;Slice) for this collection. */
Get the map of all slices (sliceName-&gt;Slice) for this collection
getSlicesMap
{ "repo_name": "DavidGutknecht/elexis-3-base", "path": "bundles/org.apache.solr/src/org/apache/solr/common/cloud/DocCollection.java", "license": "epl-1.0", "size": 14101 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
802,440
public Intent getPersistentNotificationIntent(int id) { return null; }
Intent function(int id) { return null; }
/** * Return the intent for the persistent notification. This is called every * time {@link #show(int)} is called. * * <p> * The returned intent will be packaged into a {@link PendingIntent} to be * invoked when the user clicks the notification. * * @param id * The id of the window shown. * @return The intent for the persistent notification. */
Return the intent for the persistent notification. This is called every time <code>#show(int)</code> is called. The returned intent will be packaged into a <code>PendingIntent</code> to be invoked when the user clicks the notification
getPersistentNotificationIntent
{ "repo_name": "juoni/StandOut", "path": "library/src/wei/mark/standout/StandOutWindow.java", "license": "mit", "size": 59449 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
287,875
static long findMinOrd(BytesRef key, SortedSetDocValues delegate) throws IOException { long low = 0; long high = delegate.getValueCount() - 1; long result = -1; while (low <= high) { long mid = (low + high) >>> 1; final BytesRef term = delegate.lookupOrd(mid); int cmp = compare(key, term); if (cmp == 0) { result = mid; high = mid - 1; } else if (cmp < 0) { high = mid - 1; } else { low = mid + 1; } } return result; }
static long findMinOrd(BytesRef key, SortedSetDocValues delegate) throws IOException { long low = 0; long high = delegate.getValueCount() - 1; long result = -1; while (low <= high) { long mid = (low + high) >>> 1; final BytesRef term = delegate.lookupOrd(mid); int cmp = compare(key, term); if (cmp == 0) { result = mid; high = mid - 1; } else if (cmp < 0) { high = mid - 1; } else { low = mid + 1; } } return result; }
/** * Performs a binary search to find the first term with 'key' as a prefix. */
Performs a binary search to find the first term with 'key' as a prefix
findMinOrd
{ "repo_name": "nknize/elasticsearch", "path": "x-pack/plugin/mapper-flattened/src/main/java/org/elasticsearch/xpack/flattened/mapper/KeyedFlattenedLeafFieldData.java", "license": "apache-2.0", "size": 8093 }
[ "java.io.IOException", "org.apache.lucene.index.SortedSetDocValues", "org.apache.lucene.util.BytesRef" ]
import java.io.IOException; import org.apache.lucene.index.SortedSetDocValues; import org.apache.lucene.util.BytesRef;
import java.io.*; import org.apache.lucene.index.*; import org.apache.lucene.util.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
1,584,271
public Iterator subclasses() { return this.getRepository().subclassesOf(this); }
Iterator function() { return this.getRepository().subclassesOf(this); }
/** * return the immediate [loaded] subclasses of the class */
return the immediate [loaded] subclasses of the class
subclasses
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "utils/eclipselink.utils.workbench/mappingsmodel/source/org/eclipse/persistence/tools/workbench/mappingsmodel/meta/MWClass.java", "license": "epl-1.0", "size": 110145 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,842,482
@Override public DistributedLockService getPartitionedRegionLockService() { synchronized (this.prLockServiceLock) { this.stopper.checkCancelInProgress(null); if (this.prLockService == null) { try { this.prLockService = DLockService.create(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME, getInternalDistributedSystem(), true , true , true ); } catch (IllegalArgumentException e) { this.prLockService = DistributedLockService .getServiceNamed(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME); if (this.prLockService == null) { throw e; // PARTITION_LOCK_SERVICE_NAME must be illegal! } } } return this.prLockService; } }
DistributedLockService function() { synchronized (this.prLockServiceLock) { this.stopper.checkCancelInProgress(null); if (this.prLockService == null) { try { this.prLockService = DLockService.create(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME, getInternalDistributedSystem(), true , true , true ); } catch (IllegalArgumentException e) { this.prLockService = DistributedLockService .getServiceNamed(PartitionedRegionHelper.PARTITION_LOCK_SERVICE_NAME); if (this.prLockService == null) { throw e; } } } return this.prLockService; } }
/** * Gets or lazily creates the PartitionedRegion distributed lock service. This call will * synchronize on this GemFireCache. * * @return the PartitionedRegion distributed lock service */
Gets or lazily creates the PartitionedRegion distributed lock service. This call will synchronize on this GemFireCache
getPartitionedRegionLockService
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java", "license": "apache-2.0", "size": 187237 }
[ "org.apache.geode.distributed.DistributedLockService", "org.apache.geode.distributed.internal.locks.DLockService" ]
import org.apache.geode.distributed.DistributedLockService; import org.apache.geode.distributed.internal.locks.DLockService;
import org.apache.geode.distributed.*; import org.apache.geode.distributed.internal.locks.*;
[ "org.apache.geode" ]
org.apache.geode;
1,349,495
public static VirtualChannel start(final TaskListener listener, final String rootUsername, final String rootPassword) throws IOException, InterruptedException { if(File.pathSeparatorChar==';') // on Windows return newLocalChannel(); // TODO: perhaps use RunAs to run as an Administrator?
static VirtualChannel function(final TaskListener listener, final String rootUsername, final String rootPassword) throws IOException, InterruptedException { if(File.pathSeparatorChar==';') return newLocalChannel();
/** * Returns a {@link VirtualChannel} that's connected to the priviledge-escalated environment. * * @return * Never null. This may represent a channel to a separate JVM, or just {@link LocalChannel}. * Close this channel and the SU environment will be shut down. */
Returns a <code>VirtualChannel</code> that's connected to the priviledge-escalated environment
start
{ "repo_name": "sincere520/testGitRepo", "path": "hudson-core/src/main/java/hudson/os/SU.java", "license": "mit", "size": 7185 }
[ "hudson.model.TaskListener", "hudson.remoting.VirtualChannel", "java.io.File", "java.io.IOException" ]
import hudson.model.TaskListener; import hudson.remoting.VirtualChannel; import java.io.File; import java.io.IOException;
import hudson.model.*; import hudson.remoting.*; import java.io.*;
[ "hudson.model", "hudson.remoting", "java.io" ]
hudson.model; hudson.remoting; java.io;
1,997,982
protected void applySingleCursorTransform() { if (controlledSpatial == null) { return; } int previousPostionIndex = 0; if (getScreenCursorByIndex(0).getCurrentPositionIndex() > 0) { previousPostionIndex = getScreenCursorByIndex(0) .getCurrentPositionIndex() - 1; } Vector2f originalScreenPosCursor1 = getScreenCursorByIndex(0) .getPositionAtIndex(previousPostionIndex).getPosition(); Vector2f screenPosCursor1 = getScreenCursorByIndex(0) .getCurrentCursorScreenPosition().getPosition(); Vector2f cursor1ToSpatial = screenPosCursor1 .subtract(originalScreenPosCursor1); if (screenAngle != 0) { cursor1ToSpatial.rotateAroundOrigin(screenAngle, true); } if (camNode != null) { Vector3f viewUp = camNode.getCamera().getUp(); Vector3f viewLeft = camNode.getCamera().getLeft(); if (this.mode.equals(MODE_CAMERAMANIPULATION)) { Quaternion qLeft = new Quaternion(); qLeft.fromAngleAxis(-cursor1ToSpatial.y / 300, viewLeft); qLeft.multLocal(camNode.getLocalRotation()); camNode.setLocalRotation(qLeft); Quaternion qUp = new Quaternion(); qUp.fromAngleAxis(-cursor1ToSpatial.x / 300, viewUp); qUp.multLocal(camNode.getLocalRotation()); camNode.setLocalRotation(qUp); // picking object in scence pickResults.clear(); pickRootNode = camNode.getParent(); Ray ray = new Ray(camNode.getCamera().getLocation(), camNode .getCamera().getDirection()); pickRootNode.calculatePick(ray, pickResults); int pickedObjectNumber = pickResults.getNumber(); Spatial pickedObject = null; for (int i = 0; i < pickedObjectNumber; i++) { if (pickResults.getPickData(i).getTargetMesh().getParent() .getClass() != CameraModel.class) { pickedObject = pickResults.getPickData(i) .getTargetMesh(); break; } } System.out.println("selected object = " + pickRootNode); if (pickedObject == null) { return; } if (pickResults.getNumber() <= 0) { this.setControlledSpatial(null); } else if (manipulatableOjbects.contains(pickedObject)) { this.setControlledSpatial(pickedObject); } else if (manipulatableOjbects.contains(pickedObject .getParent())) { this.setControlledSpatial(pickedObject.getParent()); } else { this.setControlledSpatial(null); } System.out.println("selected object = " + pickedObject); System.out.println("camera direction is " + camNode.getCamera().getDirection()); } else { Quaternion qLeft = new Quaternion(); qLeft.fromAngleAxis(cursor1ToSpatial.y / 100, viewLeft); qLeft.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(qLeft); Quaternion qUp = new Quaternion(); qUp.fromAngleAxis(cursor1ToSpatial.x / 100, viewUp); qUp.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(qUp); } } else { float[] angles = { -cursor1ToSpatial.y / 100, cursor1ToSpatial.x / 100, 0 }; Quaternion q = new Quaternion(); q.fromAngles(angles); q.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(q); } }
void function() { if (controlledSpatial == null) { return; } int previousPostionIndex = 0; if (getScreenCursorByIndex(0).getCurrentPositionIndex() > 0) { previousPostionIndex = getScreenCursorByIndex(0) .getCurrentPositionIndex() - 1; } Vector2f originalScreenPosCursor1 = getScreenCursorByIndex(0) .getPositionAtIndex(previousPostionIndex).getPosition(); Vector2f screenPosCursor1 = getScreenCursorByIndex(0) .getCurrentCursorScreenPosition().getPosition(); Vector2f cursor1ToSpatial = screenPosCursor1 .subtract(originalScreenPosCursor1); if (screenAngle != 0) { cursor1ToSpatial.rotateAroundOrigin(screenAngle, true); } if (camNode != null) { Vector3f viewUp = camNode.getCamera().getUp(); Vector3f viewLeft = camNode.getCamera().getLeft(); if (this.mode.equals(MODE_CAMERAMANIPULATION)) { Quaternion qLeft = new Quaternion(); qLeft.fromAngleAxis(-cursor1ToSpatial.y / 300, viewLeft); qLeft.multLocal(camNode.getLocalRotation()); camNode.setLocalRotation(qLeft); Quaternion qUp = new Quaternion(); qUp.fromAngleAxis(-cursor1ToSpatial.x / 300, viewUp); qUp.multLocal(camNode.getLocalRotation()); camNode.setLocalRotation(qUp); pickResults.clear(); pickRootNode = camNode.getParent(); Ray ray = new Ray(camNode.getCamera().getLocation(), camNode .getCamera().getDirection()); pickRootNode.calculatePick(ray, pickResults); int pickedObjectNumber = pickResults.getNumber(); Spatial pickedObject = null; for (int i = 0; i < pickedObjectNumber; i++) { if (pickResults.getPickData(i).getTargetMesh().getParent() .getClass() != CameraModel.class) { pickedObject = pickResults.getPickData(i) .getTargetMesh(); break; } } System.out.println(STR + pickRootNode); if (pickedObject == null) { return; } if (pickResults.getNumber() <= 0) { this.setControlledSpatial(null); } else if (manipulatableOjbects.contains(pickedObject)) { this.setControlledSpatial(pickedObject); } else if (manipulatableOjbects.contains(pickedObject .getParent())) { this.setControlledSpatial(pickedObject.getParent()); } else { this.setControlledSpatial(null); } System.out.println(STR + pickedObject); System.out.println(STR + camNode.getCamera().getDirection()); } else { Quaternion qLeft = new Quaternion(); qLeft.fromAngleAxis(cursor1ToSpatial.y / 100, viewLeft); qLeft.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(qLeft); Quaternion qUp = new Quaternion(); qUp.fromAngleAxis(cursor1ToSpatial.x / 100, viewUp); qUp.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(qUp); } } else { float[] angles = { -cursor1ToSpatial.y / 100, cursor1ToSpatial.x / 100, 0 }; Quaternion q = new Quaternion(); q.fromAngles(angles); q.multLocal(this.controlledSpatial.getLocalRotation()); this.controlledSpatial.setLocalRotation(q); } }
/** * Apply single cursor transform. */
Apply single cursor transform
applySingleCursorTransform
{ "repo_name": "synergynet/synergynet2.5", "path": "synergynet2.5/src/main/java/apps/threedmanipulation/gestures/OjbectManipulation.java", "license": "bsd-3-clause", "size": 22911 }
[ "com.jme.math.Quaternion", "com.jme.math.Ray", "com.jme.math.Vector2f", "com.jme.math.Vector3f", "com.jme.scene.Spatial" ]
import com.jme.math.Quaternion; import com.jme.math.Ray; import com.jme.math.Vector2f; import com.jme.math.Vector3f; import com.jme.scene.Spatial;
import com.jme.math.*; import com.jme.scene.*;
[ "com.jme.math", "com.jme.scene" ]
com.jme.math; com.jme.scene;
2,763,193
public boolean test(Object o) { Collection domainObjects = (Collection)o; distinctValueTable = new HashMap((int)(domainObjects.size() * .75)); Iterator it = domainObjects.iterator(); MutablePropertyAccessStrategy accessor = null; while (it.hasNext()) { Object domainObject = it.next(); if (accessor == null) { accessor = createPropertyAccessStrategy(domainObject); } else { accessor.getDomainObjectHolder().setValue(domainObject); } Object propertyValue = accessor.getPropertyValue(propertyName); Integer hashCode; if (propertyValue == null) { hashCode = new Integer(0); } else { hashCode = new Integer(propertyValue.hashCode()); } if (distinctValueTable.containsKey(hashCode)) { return false; } distinctValueTable.put(hashCode, propertyValue); } return true; }
boolean function(Object o) { Collection domainObjects = (Collection)o; distinctValueTable = new HashMap((int)(domainObjects.size() * .75)); Iterator it = domainObjects.iterator(); MutablePropertyAccessStrategy accessor = null; while (it.hasNext()) { Object domainObject = it.next(); if (accessor == null) { accessor = createPropertyAccessStrategy(domainObject); } else { accessor.getDomainObjectHolder().setValue(domainObject); } Object propertyValue = accessor.getPropertyValue(propertyName); Integer hashCode; if (propertyValue == null) { hashCode = new Integer(0); } else { hashCode = new Integer(propertyValue.hashCode()); } if (distinctValueTable.containsKey(hashCode)) { return false; } distinctValueTable.put(hashCode, propertyValue); } return true; }
/** * Returns <code>true</code> if each domain object in the provided collection has a unique * value for the configured property. */
Returns <code>true</code> if each domain object in the provided collection has a unique value for the configured property
test
{ "repo_name": "springrichclient/springrcp", "path": "spring-richclient-core/src/main/java/org/springframework/rules/constraint/property/UniquePropertyValueConstraint.java", "license": "apache-2.0", "size": 2595 }
[ "java.util.Collection", "java.util.HashMap", "java.util.Iterator", "org.springframework.binding.MutablePropertyAccessStrategy" ]
import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import org.springframework.binding.MutablePropertyAccessStrategy;
import java.util.*; import org.springframework.binding.*;
[ "java.util", "org.springframework.binding" ]
java.util; org.springframework.binding;
2,328,997
public TaskId getTaskId() { return taskId; }
TaskId function() { return taskId; }
/** * The {@link TaskId} of the async execution in the task manager. */
The <code>TaskId</code> of the async execution in the task manager
getTaskId
{ "repo_name": "GlenRSmith/elasticsearch", "path": "x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/async/AsyncExecutionId.java", "license": "apache-2.0", "size": 3695 }
[ "org.elasticsearch.tasks.TaskId" ]
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.tasks.*;
[ "org.elasticsearch.tasks" ]
org.elasticsearch.tasks;
1,385,421
public void scheduleOutboundPacket(Packet p_150725_1_, GenericFutureListener ... p_150725_2_) { if (this.channel != null && this.channel.isOpen()) { this.flushOutboundQueue(); this.dispatchPacket(p_150725_1_, p_150725_2_); } else { this.outboundPacketsQueue.add(new NetworkManager.InboundHandlerTuplePacketListener(p_150725_1_, p_150725_2_)); } }
void function(Packet p_150725_1_, GenericFutureListener ... p_150725_2_) { if (this.channel != null && this.channel.isOpen()) { this.flushOutboundQueue(); this.dispatchPacket(p_150725_1_, p_150725_2_); } else { this.outboundPacketsQueue.add(new NetworkManager.InboundHandlerTuplePacketListener(p_150725_1_, p_150725_2_)); } }
/** * Will flush the outbound queue and dispatch the supplied Packet if the channel is ready, otherwise it adds the * packet to the outbound queue and registers the GenericFutureListener to fire after transmission */
Will flush the outbound queue and dispatch the supplied Packet if the channel is ready, otherwise it adds the packet to the outbound queue and registers the GenericFutureListener to fire after transmission
scheduleOutboundPacket
{ "repo_name": "mviitanen/marsmod", "path": "mcp/src/minecraft/net/minecraft/network/NetworkManager.java", "license": "gpl-2.0", "size": 15098 }
[ "io.netty.util.concurrent.GenericFutureListener" ]
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.*;
[ "io.netty.util" ]
io.netty.util;
1,378,896
public void setCompletedEvents(List<HabitEvent> completions) { this.completions = completions; }
void function(List<HabitEvent> completions) { this.completions = completions; }
/** * Sets the list of habits that are completed (i.e they're now habit events). * I.e replace our old list of habit events with our new one * * @param[in] completions - list of habit events */
Sets the list of habits that are completed (i.e they're now habit events). I.e replace our old list of habit events with our new one
setCompletedEvents
{ "repo_name": "CMPUT301F17T20/Habitivity", "path": "app/src/main/java/main/habitivity/habits/Habit.java", "license": "mit", "size": 11810 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,126,847
@NonNull public Builder setClaimsLocalesValues(@Nullable Iterable<String> claimsLocalesValues) { mClaimsLocales = AsciiStringListUtil.iterableToString(claimsLocalesValues); return this; }
Builder function(@Nullable Iterable<String> claimsLocalesValues) { mClaimsLocales = AsciiStringListUtil.iterableToString(claimsLocalesValues); return this; }
/** * End-User's preferred languages and scripts for Claims being returned, represented as a * space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. * * @see "OpenID Connect Core 1.0, Section 5.2 * <https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.5.2>" */
End-User's preferred languages and scripts for Claims being returned, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference
setClaimsLocalesValues
{ "repo_name": "openid/AppAuth-Android", "path": "library/java/net/openid/appauth/AuthorizationRequest.java", "license": "apache-2.0", "size": 54568 }
[ "androidx.annotation.Nullable" ]
import androidx.annotation.Nullable;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
552,180
public void setIndeterminateTintList(@Nullable ColorStateList tint) { this.ensureTintInfo(); mTintInfo.indeterminateTintList = tint; mTintInfo.hasIndeterminateTintList = true; this.applyIndeterminateTint(); }
void function(@Nullable ColorStateList tint) { this.ensureTintInfo(); mTintInfo.indeterminateTintList = tint; mTintInfo.hasIndeterminateTintList = true; this.applyIndeterminateTint(); }
/** * Applies a tint to the indeterminate graphics of the drawable, if specified. This call does not * modify the current tint mode, which is {@link android.graphics.PorterDuff.Mode#SRC_IN} by default. * <p> * Subsequent calls to {@link #setDrawable(ProgressDrawable)} will automatically mutate the drawable * and apply the specified tint and tint mode using {@link ProgressDrawable#setIndeterminateTintList(android.content.res.ColorStateList)}. * * @param tint The tint to apply, may be {@code null} to clear the current tint. * @see R.attr#uiIndeterminateTint ui:uiIndeterminateTint * @see #getIndeterminateTintList() * @see ProgressDrawable#setIndeterminateTintList(android.content.res.ColorStateList) */
Applies a tint to the indeterminate graphics of the drawable, if specified. This call does not modify the current tint mode, which is <code>android.graphics.PorterDuff.Mode#SRC_IN</code> by default. Subsequent calls to <code>#setDrawable(ProgressDrawable)</code> will automatically mutate the drawable and apply the specified tint and tint mode using <code>ProgressDrawable#setIndeterminateTintList(android.content.res.ColorStateList)</code>
setIndeterminateTintList
{ "repo_name": "android-libraries/android_ui", "path": "library/src/widget/common/progress/java/com/albedinsky/android/ui/widget/BaseProgressBar.java", "license": "apache-2.0", "size": 53206 }
[ "android.content.res.ColorStateList", "android.support.annotation.Nullable" ]
import android.content.res.ColorStateList; import android.support.annotation.Nullable;
import android.content.res.*; import android.support.annotation.*;
[ "android.content", "android.support" ]
android.content; android.support;
2,423,841
public static Runnable create(Runnable delegate, SecurityContext securityContext) { Assert.notNull(delegate, "delegate cannot be null"); return securityContext == null ? new DelegatingSecurityContextRunnable(delegate) : new DelegatingSecurityContextRunnable(delegate, securityContext); }
static Runnable function(Runnable delegate, SecurityContext securityContext) { Assert.notNull(delegate, STR); return securityContext == null ? new DelegatingSecurityContextRunnable(delegate) : new DelegatingSecurityContextRunnable(delegate, securityContext); }
/** * Factory method for creating a {@link DelegatingSecurityContextRunnable}. * * @param delegate the original {@link Runnable} that will be delegated to after * establishing a {@link SecurityContext} on the {@link SecurityContextHolder}. Cannot * have null. * @param securityContext the {@link SecurityContext} to establish before invoking the * delegate {@link Runnable}. If null, the current {@link SecurityContext} from the * {@link SecurityContextHolder} will be used. * @return */
Factory method for creating a <code>DelegatingSecurityContextRunnable</code>
create
{ "repo_name": "eddumelendez/spring-security", "path": "core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnable.java", "license": "apache-2.0", "size": 4181 }
[ "org.springframework.security.core.context.SecurityContext", "org.springframework.util.Assert" ]
import org.springframework.security.core.context.SecurityContext; import org.springframework.util.Assert;
import org.springframework.security.core.context.*; import org.springframework.util.*;
[ "org.springframework.security", "org.springframework.util" ]
org.springframework.security; org.springframework.util;
1,559,630
public synchronized File getFile( int minBytes, boolean block ) throws IOException { while (bytes < minBytes && state.ordinal() < State.FINISHED.ordinal()) { Log.d( LOG, "getFile(): bytes=" + bytes + " < minBytes=" + minBytes ); if (block) try { wait();} catch (InterruptedException e) {} else return null; } switch (state) { case STARTED: case RUNNING: state = State.FLUSHING; // no break here case FLUSHING: if (!block) return null; while (state == State.FLUSHING) { try { wait();} catch (InterruptedException e) {} } if (state != State.FLUSHED) return null; // no break here case FLUSHED: if (out != null) try { out.close();} catch (IOException e){} File ret = file; createOutput(); state = State.RUNNING; notify(); return ret; case FINISHED: ret = file; file = null; return ret; } return null; }
synchronized File function( int minBytes, boolean block ) throws IOException { while (bytes < minBytes && state.ordinal() < State.FINISHED.ordinal()) { Log.d( LOG, STR + bytes + STR + minBytes ); if (block) try { wait();} catch (InterruptedException e) {} else return null; } switch (state) { case STARTED: case RUNNING: state = State.FLUSHING; case FLUSHING: if (!block) return null; while (state == State.FLUSHING) { try { wait();} catch (InterruptedException e) {} } if (state != State.FLUSHED) return null; case FLUSHED: if (out != null) try { out.close();} catch (IOException e){} File ret = file; createOutput(); state = State.RUNNING; notify(); return ret; case FINISHED: ret = file; file = null; return ret; } return null; }
/** * Returns the downloaded part. * This method can be called multiple times. */
Returns the downloaded part. This method can be called multiple times
getFile
{ "repo_name": "sonbt56/aacplayer-android", "path": "src/com/spoledge/aacplayer/AACFileChunkPlayer.java", "license": "gpl-3.0", "size": 12457 }
[ "android.util.Log", "java.io.File", "java.io.IOException" ]
import android.util.Log; import java.io.File; import java.io.IOException;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
1,584,803
public String toString() { StringBuilder sb = new StringBuilder (); Formatter formatter = new Formatter (sb, Locale.US); formatter.format ("%s%n", getClass ().getSimpleName ()); formatter.format ("%s : %s%n", "value", "cdf"); for (int i = 0; i < nVal - 1; i++) formatter.format ("%f : %f%n", sortedVal[i], cdf[i]); formatter.format ("%f : %f%n", sortedVal[nVal-1], 1.0); return sb.toString (); }
String function() { StringBuilder sb = new StringBuilder (); Formatter formatter = new Formatter (sb, Locale.US); formatter.format ("%s%n", getClass ().getSimpleName ()); formatter.format (STR, "value", "cdf"); for (int i = 0; i < nVal - 1; i++) formatter.format (STR, sortedVal[i], cdf[i]); formatter.format (STR, sortedVal[nVal-1], 1.0); return sb.toString (); }
/** * Returns a <TT>String</TT> containing information about the current distribution. * */
Returns a String containing information about the current distribution
toString
{ "repo_name": "csmith932/uas-schedule-generator", "path": "swac-common/src/main/java/gov/faa/ang/swac/common/random/distributions/DiscreteDistribution.java", "license": "apache-2.0", "size": 12283 }
[ "java.util.Formatter", "java.util.Locale" ]
import java.util.Formatter; import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
1,347,215
@Test void testNonPushableFilterSortDesc() { final String sql = "select \"product_name\" from \"foodmart\"\n" + "where cast(\"product_id\" as integer) - 1500 BETWEEN 0 AND 2\n" + "order by \"state_province\" desc, \"product_id\""; final String druidQuery = "{'queryType':'scan','dataSource':'foodmart'," + "'intervals':['1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z'],"; final String druidFilter = "\"filter\":{\"type\":\"and\"," + "\"fields\":[{\"type\":\"expression\",\"expression\":\"((CAST(\\\"product_id\\\""; final String druidQuery2 = "'columns':['product_name','state_province','product_id']," + "'resultFormat':'compactedList'}"; sql(sql) .limit(4) .returns(resultSet -> { try { for (int i = 0; i < 4; i++) { assertTrue(resultSet.next()); assertThat(resultSet.getString("product_name"), is("Fort West Dried Apricots")); } assertFalse(resultSet.next()); } catch (SQLException e) { throw TestUtil.rethrow(e); } }) .queryContains(new DruidChecker(druidQuery, druidFilter, druidQuery2)); }
@Test void testNonPushableFilterSortDesc() { final String sql = STRproduct_name\STRfoodmart\"\n" + STRproduct_id\STR + STRstate_province\STRproduct_id\STR{'queryType':'scan','dataSource':'foodmart',STR'intervals':['1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z'],STR\STR:{\"type\":\"and\",STR\STR:[{\"type\":\STR,\STR:\STRproduct_id\\\STR'columns':['product_name','state_province','product_id'],STR'resultFormat':'compactedList'}STRproduct_nameSTRFort West Dried Apricots")); } assertFalse(resultSet.next()); } catch (SQLException e) { throw TestUtil.rethrow(e); } }) .queryContains(new DruidChecker(druidQuery, druidFilter, druidQuery2)); }
/** As {@link #testFilterSortDescNumeric()} but with a filter that cannot * be pushed down to Druid. */
As <code>#testFilterSortDescNumeric()</code> but with a filter that cannot
testNonPushableFilterSortDesc
{ "repo_name": "jcamachor/calcite", "path": "druid/src/test/java/org/apache/calcite/test/DruidAdapter2IT.java", "license": "apache-2.0", "size": 201537 }
[ "java.sql.SQLException", "org.apache.calcite.util.TestUtil", "org.junit.jupiter.api.Assertions", "org.junit.jupiter.api.Test" ]
import java.sql.SQLException; import org.apache.calcite.util.TestUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test;
import java.sql.*; import org.apache.calcite.util.*; import org.junit.jupiter.api.*;
[ "java.sql", "org.apache.calcite", "org.junit.jupiter" ]
java.sql; org.apache.calcite; org.junit.jupiter;
2,228,623
void setCacheColorHint(int color) { if (mViewTypeCount == 1) { final ArrayList<View> scrap = mCurrentScrap; final int scrapCount = scrap.size(); for (int i = 0; i < scrapCount; i++) { scrap.get(i).setDrawingCacheBackgroundColor(color); } } else { final int typeCount = mViewTypeCount; for (int i = 0; i < typeCount; i++) { final ArrayList<View> scrap = mScrapViews[i]; final int scrapCount = scrap.size(); for (int j = 0; j < scrapCount; j++) { scrap.get(i).setDrawingCacheBackgroundColor(color); } } } // Just in case this is called during a layout pass final View[] activeViews = mActiveViews; final int count = activeViews.length; for (int i = 0; i < count; ++i) { final View victim = activeViews[i]; if (victim != null) { victim.setDrawingCacheBackgroundColor(color); } } } } ///////////////////////////////////////////////////// //Newly Added Methods. /////////////////////////////////////////////////////
void setCacheColorHint(int color) { if (mViewTypeCount == 1) { final ArrayList<View> scrap = mCurrentScrap; final int scrapCount = scrap.size(); for (int i = 0; i < scrapCount; i++) { scrap.get(i).setDrawingCacheBackgroundColor(color); } } else { final int typeCount = mViewTypeCount; for (int i = 0; i < typeCount; i++) { final ArrayList<View> scrap = mScrapViews[i]; final int scrapCount = scrap.size(); for (int j = 0; j < scrapCount; j++) { scrap.get(i).setDrawingCacheBackgroundColor(color); } } } final View[] activeViews = mActiveViews; final int count = activeViews.length; for (int i = 0; i < count; ++i) { final View victim = activeViews[i]; if (victim != null) { victim.setDrawingCacheBackgroundColor(color); } } } }
/** * Updates the cache color hint of all known views. * * @param color The new cache color hint. */
Updates the cache color hint of all known views
setCacheColorHint
{ "repo_name": "daimajia/EverMemo", "path": "libraries/ExGridView/src/com/huewu/pla/lib/internal/PLA_AbsListView.java", "license": "mit", "size": 91245 }
[ "android.view.View", "java.util.ArrayList" ]
import android.view.View; import java.util.ArrayList;
import android.view.*; import java.util.*;
[ "android.view", "java.util" ]
android.view; java.util;
2,368,041
this.mQueryMap = new HashMap<String, String>(source.mQueryMap); this.mBodyMap = new LinkedHashMap<String, Object>(source.mBodyMap); }
this.mQueryMap = new HashMap<String, String>(source.mQueryMap); this.mBodyMap = new LinkedHashMap<String, Object>(source.mBodyMap); }
/** * Copies data from query and body maps into the current request. * @param source the request to copy data from. */
Copies data from query and body maps into the current request
importRequestContentMapsFrom
{ "repo_name": "seema-at-box/box-android-sdk", "path": "box-content-sdk/src/main/java/com/box/androidsdk/content/requests/BoxRequest.java", "license": "apache-2.0", "size": 38081 }
[ "java.util.HashMap", "java.util.LinkedHashMap" ]
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.*;
[ "java.util" ]
java.util;
115,022
@Test public void testStartRangeForeachNOSchema() throws IOException, ParserException { String query; // without aliases query = " l1 = load '" + INP_FILE_5FIELDS + "';" + "f = foreach l1 generate ..$3 as (a,b,c,d);" ; compileAndCompareSchema("a : bytearray,b : bytearray,c : bytearray,d : bytearray", query, "f"); Util.registerMultiLineQuery(pigServer, query); pigServer.explain("f", System.err); Iterator<Tuple> it = pigServer.openIterator("f"); List<Tuple> expectedRes = Util.getTuplesFromConstantTupleStringAsByteArray( new String[] { "('10','20','30','40')", "('11','21','31','41')", }); Util.checkQueryOutputsAfterSort(it, expectedRes); }
void function() throws IOException, ParserException { String query; query = STR + INP_FILE_5FIELDS + "';" + STR ; compileAndCompareSchema(STR, query, "f"); Util.registerMultiLineQuery(pigServer, query); pigServer.explain("f", System.err); Iterator<Tuple> it = pigServer.openIterator("f"); List<Tuple> expectedRes = Util.getTuplesFromConstantTupleStringAsByteArray( new String[] { STR, STR, }); Util.checkQueryOutputsAfterSort(it, expectedRes); }
/** * Test foreach without schema * @throws IOException * @throws ParserException */
Test foreach without schema
testStartRangeForeachNOSchema
{ "repo_name": "hxquangnhat/PIG-ROLLUP-MRCUBE", "path": "test/org/apache/pig/test/TestProjectRange.java", "license": "apache-2.0", "size": 46304 }
[ "java.io.IOException", "java.util.Iterator", "java.util.List", "org.apache.pig.data.Tuple", "org.apache.pig.parser.ParserException" ]
import java.io.IOException; import java.util.Iterator; import java.util.List; import org.apache.pig.data.Tuple; import org.apache.pig.parser.ParserException;
import java.io.*; import java.util.*; import org.apache.pig.data.*; import org.apache.pig.parser.*;
[ "java.io", "java.util", "org.apache.pig" ]
java.io; java.util; org.apache.pig;
2,639,691
public static Calendar getBillDay(final int period, final long start, final Calendar now, final boolean next) { Calendar s = Calendar.getInstance(); s.setTimeInMillis(start); return getBillDay(period, s, now, next); }
static Calendar function(final int period, final long start, final Calendar now, final boolean next) { Calendar s = Calendar.getInstance(); s.setTimeInMillis(start); return getBillDay(period, s, now, next); }
/** * Get the first bill day of this period. * * @param period type of period * @param start first bill day set. * @param now move now to some other time, null == real now * @param next get the next, not the current one * @return {@link Calendar} with current first bill day */
Get the first bill day of this period
getBillDay
{ "repo_name": "xerosanyam/callmeter", "path": "CallMeter3G/src/main/java/de/ub0r/android/callmeter/data/DataProvider.java", "license": "gpl-3.0", "size": 171284 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,209,292
private void saveNewDate(String fileName, String date) throws IOException { if (!dataFolder.exists()){ dataFolder.mkdirs(); } File file=new File(dataFolder, fileName + ".dat"); BufferedWriter bw = getWriter(file.getAbsolutePath()); bw.append(date); bw.append("\r\n"); bw.close(); bw=null; }
void function(String fileName, String date) throws IOException { if (!dataFolder.exists()){ dataFolder.mkdirs(); } File file=new File(dataFolder, fileName + ".dat"); BufferedWriter bw = getWriter(file.getAbsolutePath()); bw.append(date); bw.append("\r\n"); bw.close(); bw=null; }
/** * Save new date. * * @param fileName the file name * @param date the date * @throws IOException Signals that an I/O exception has occurred. */
Save new date
saveNewDate
{ "repo_name": "termMed/sct-descriptive-statistics-generator", "path": "src/main/java/com/termmed/statistics/db/importer/ImportManager.java", "license": "apache-2.0", "size": 27271 }
[ "java.io.BufferedWriter", "java.io.File", "java.io.IOException" ]
import java.io.BufferedWriter; import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,820,211
public boolean cancelRecoveriesForShard(ShardId shardId, String reason) { boolean cancelled = false; List<RecoveryTarget> matchedRecoveries = new ArrayList<>(); synchronized (onGoingRecoveries) { for (Iterator<RecoveryTarget> it = onGoingRecoveries.values().iterator(); it.hasNext();) { RecoveryTarget status = it.next(); if (status.shardId().equals(shardId)) { matchedRecoveries.add(status); it.remove(); } } } for (RecoveryTarget removed : matchedRecoveries) { logger.trace( "{} canceled recovery from {}, id [{}] (reason [{}])", removed.shardId(), removed.sourceNode(), removed.recoveryId(), reason ); removed.cancel(reason); cancelled = true; } return cancelled; } public static class RecoveryRef implements AutoCloseable { private final RecoveryTarget status; private final AtomicBoolean closed = new AtomicBoolean(false); public RecoveryRef(RecoveryTarget status) { this.status = status; this.status.setLastAccessTime(); }
boolean function(ShardId shardId, String reason) { boolean cancelled = false; List<RecoveryTarget> matchedRecoveries = new ArrayList<>(); synchronized (onGoingRecoveries) { for (Iterator<RecoveryTarget> it = onGoingRecoveries.values().iterator(); it.hasNext();) { RecoveryTarget status = it.next(); if (status.shardId().equals(shardId)) { matchedRecoveries.add(status); it.remove(); } } } for (RecoveryTarget removed : matchedRecoveries) { logger.trace( STR, removed.shardId(), removed.sourceNode(), removed.recoveryId(), reason ); removed.cancel(reason); cancelled = true; } return cancelled; } public static class RecoveryRef implements AutoCloseable { private final RecoveryTarget status; private final AtomicBoolean closed = new AtomicBoolean(false); public RecoveryRef(RecoveryTarget status) { this.status = status; this.status.setLastAccessTime(); }
/** * cancel all ongoing recoveries for the given shard * * @param reason reason for cancellation * @param shardId shardId for which to cancel recoveries * @return true if a recovery was cancelled */
cancel all ongoing recoveries for the given shard
cancelRecoveriesForShard
{ "repo_name": "jmluy/elasticsearch", "path": "server/src/main/java/org/elasticsearch/indices/recovery/RecoveriesCollection.java", "license": "apache-2.0", "size": 13192 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "java.util.concurrent.atomic.AtomicBoolean", "org.elasticsearch.index.shard.ShardId" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import org.elasticsearch.index.shard.ShardId;
import java.util.*; import java.util.concurrent.atomic.*; import org.elasticsearch.index.shard.*;
[ "java.util", "org.elasticsearch.index" ]
java.util; org.elasticsearch.index;
1,891,573
public static IntValuedEnum<RTresult> rtContextGetPrintEnabled(RTcontext context, Pointer<Integer> enabled) { return FlagSet.fromValue(rtContextGetPrintEnabled(Pointer.getPeer(context), Pointer.getPeer(enabled)), RTresult.class); }
static IntValuedEnum<RTresult> function(RTcontext context, Pointer<Integer> enabled) { return FlagSet.fromValue(rtContextGetPrintEnabled(Pointer.getPeer(context), Pointer.getPeer(enabled)), RTresult.class); }
/** * Original signature : <code>RTresult rtContextGetPrintEnabled(RTcontext, int*)</code><br> * <i>native declaration : include\optix_host.h:2392</i> */
Original signature : <code>RTresult rtContextGetPrintEnabled(RTcontext, int*)</code> native declaration : include\optix_host.h:2392
rtContextGetPrintEnabled
{ "repo_name": "fetox74/optix-wrapper", "path": "src/main/java/com/fetoxdevelopments/optix/api/RT.java", "license": "mit", "size": 162970 }
[ "com.fetoxdevelopments.optix.api.enumeration.RTresult", "com.fetoxdevelopments.optix.api.struct.RTcontext", "org.bridj.FlagSet", "org.bridj.IntValuedEnum", "org.bridj.Pointer" ]
import com.fetoxdevelopments.optix.api.enumeration.RTresult; import com.fetoxdevelopments.optix.api.struct.RTcontext; import org.bridj.FlagSet; import org.bridj.IntValuedEnum; import org.bridj.Pointer;
import com.fetoxdevelopments.optix.api.enumeration.*; import com.fetoxdevelopments.optix.api.struct.*; import org.bridj.*;
[ "com.fetoxdevelopments.optix", "org.bridj" ]
com.fetoxdevelopments.optix; org.bridj;
861,122
public void testValidateOptimisticWriteLocked() { final StampedLock lock = new StampedLock(); final long p = assertValid(lock, lock.tryOptimisticRead()); final long s = assertValid(lock, lock.writeLock()); assertFalse(lock.validate(p)); assertEquals(0L, lock.tryOptimisticRead()); assertTrue(lock.validate(s)); lock.unlockWrite(s); }
void function() { final StampedLock lock = new StampedLock(); final long p = assertValid(lock, lock.tryOptimisticRead()); final long s = assertValid(lock, lock.writeLock()); assertFalse(lock.validate(p)); assertEquals(0L, lock.tryOptimisticRead()); assertTrue(lock.validate(s)); lock.unlockWrite(s); }
/** * tryOptimisticRead stamp does not validate if a write lock intervenes */
tryOptimisticRead stamp does not validate if a write lock intervenes
testValidateOptimisticWriteLocked
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/java/util/concurrent/tck/StampedLockTest.java", "license": "gpl-2.0", "size": 45302 }
[ "java.util.concurrent.locks.StampedLock" ]
import java.util.concurrent.locks.StampedLock;
import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
1,074,234
public static void setUniqueId(Object theObj, String uniqueId) { Method annotatedMethod = ResourceInspector.findUniqueIdMethod(theObj.getClass()); if (annotatedMethod != null) { PropertyDescriptor pDesc = BeanUtils.findPropertyForMethod(annotatedMethod); if (pDesc != null) { Method writeMethod = pDesc.getWriteMethod(); if (writeMethod != null) { try { writeMethod.invoke(theObj, uniqueId); if (logger.isDebugEnabled()) { logger.debug("Unique id set for property: " + pDesc.getName()); } } catch (IllegalArgumentException error) { logger.warn("Invocation error", error); } catch (IllegalAccessException error) { logger.warn("IllegalAccessException", error); } catch (InvocationTargetException error) { logger.warn("InvocationTargetException", error); } } else { logger.warn("No setter method for property: " + pDesc.getName()); } } } } // // public static void renderResponseDep(Map<String, Object> response, Object result) // { // // if (result == null) { return; } // // if (result instanceof Collection) // { // response.put("list", result); // } // else if (result instanceof CollectionWithPagingInfo) // { // CollectionWithPagingInfo<?> col = (CollectionWithPagingInfo<?>) result; // if (col.getCollection() !=null && !col.getCollection().isEmpty()) // { // response.put("list", col); // } // } // else if (result instanceof Pair<?,?>) // { // Pair<?,?> aPair = (Pair<?, ?>) result; // response.put("entry", aPair.getFirst()); // response.put("relations", aPair.getSecond()); // } // else // { // response.put("entry", result); // } // }
static void function(Object theObj, String uniqueId) { Method annotatedMethod = ResourceInspector.findUniqueIdMethod(theObj.getClass()); if (annotatedMethod != null) { PropertyDescriptor pDesc = BeanUtils.findPropertyForMethod(annotatedMethod); if (pDesc != null) { Method writeMethod = pDesc.getWriteMethod(); if (writeMethod != null) { try { writeMethod.invoke(theObj, uniqueId); if (logger.isDebugEnabled()) { logger.debug(STR + pDesc.getName()); } } catch (IllegalArgumentException error) { logger.warn(STR, error); } catch (IllegalAccessException error) { logger.warn(STR, error); } catch (InvocationTargetException error) { logger.warn(STR, error); } } else { logger.warn(STR + pDesc.getName()); } } } }
/** * Set the id of theObj to the uniqueId. Attempts to find a set method and * invoke it. If it fails it just swallows the exceptions and doesn't throw * them further. * * @param theObj * @param uniqueId */
Set the id of theObj to the uniqueId. Attempts to find a set method and invoke it. If it fails it just swallows the exceptions and doesn't throw them further
setUniqueId
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/remote-api/source/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptHelper.java", "license": "lgpl-3.0", "size": 27085 }
[ "java.beans.PropertyDescriptor", "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method", "org.alfresco.rest.framework.core.ResourceInspector", "org.springframework.beans.BeanUtils" ]
import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.alfresco.rest.framework.core.ResourceInspector; import org.springframework.beans.BeanUtils;
import java.beans.*; import java.lang.reflect.*; import org.alfresco.rest.framework.core.*; import org.springframework.beans.*;
[ "java.beans", "java.lang", "org.alfresco.rest", "org.springframework.beans" ]
java.beans; java.lang; org.alfresco.rest; org.springframework.beans;
1,420,079
public static int getCodePoint(char lead, char trail) { if (UTF16.isLeadSurrogate(lead) && UTF16.isTrailSurrogate(trail)) { return UCharacterProperty.getRawSupplementary(lead, trail); } throw new IllegalArgumentException("Illegal surrogate characters"); }
static int function(char lead, char trail) { if (UTF16.isLeadSurrogate(lead) && UTF16.isTrailSurrogate(trail)) { return UCharacterProperty.getRawSupplementary(lead, trail); } throw new IllegalArgumentException(STR); }
/** * {@icu} Returns a code point corresponding to the two UTF16 characters. * @param lead the lead char * @param trail the trail char * @return code point if surrogate characters are valid. * @exception IllegalArgumentException thrown when argument characters do * not form a valid codepoint * @stable ICU 2.1 */
Returns a code point corresponding to the two UTF16 characters
getCodePoint
{ "repo_name": "UweTrottmann/QuickDic-Dictionary", "path": "jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/lang/UCharacter.java", "license": "apache-2.0", "size": 218725 }
[ "com.ibm.icu.impl.UCharacterProperty" ]
import com.ibm.icu.impl.UCharacterProperty;
import com.ibm.icu.impl.*;
[ "com.ibm.icu" ]
com.ibm.icu;
2,610,691
Filter createFilter(boolean preparing) { return source.createFilter(preparing); } abstract static class MeasuringIterator extends AbstractIterator<ResultRowImpl> { private Iterator<ResultRowImpl> delegate; private Query query; private List<ResultRowImpl> results; private boolean init; MeasuringIterator(Query query, Iterator<ResultRowImpl> delegate) { this.query = query; this.delegate = delegate; results = Lists.newArrayList(); }
Filter createFilter(boolean preparing) { return source.createFilter(preparing); } abstract static class MeasuringIterator extends AbstractIterator<ResultRowImpl> { private Iterator<ResultRowImpl> delegate; private Query query; private List<ResultRowImpl> results; private boolean init; MeasuringIterator(Query query, Iterator<ResultRowImpl> delegate) { this.query = query; this.delegate = delegate; results = Lists.newArrayList(); }
/** * <b>!Test purpose only! <b> * * this creates a filter for the given query * */
!Test purpose only! this creates a filter for the given query
createFilter
{ "repo_name": "yesil/jackrabbit-oak", "path": "oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java", "license": "apache-2.0", "size": 45577 }
[ "com.google.common.collect.AbstractIterator", "com.google.common.collect.Lists", "java.util.Iterator", "java.util.List", "org.apache.jackrabbit.oak.spi.query.Filter" ]
import com.google.common.collect.AbstractIterator; import com.google.common.collect.Lists; import java.util.Iterator; import java.util.List; import org.apache.jackrabbit.oak.spi.query.Filter;
import com.google.common.collect.*; import java.util.*; import org.apache.jackrabbit.oak.spi.query.*;
[ "com.google.common", "java.util", "org.apache.jackrabbit" ]
com.google.common; java.util; org.apache.jackrabbit;
2,022,417
EDataType getCostPerHeatUnit();
EDataType getCostPerHeatUnit();
/** * Returns the meta object for data type '<em>Cost Per Heat Unit</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for data type '<em>Cost Per Heat Unit</em>'. * @model instanceClass="float" * extendedMetaData="baseType='http://www.w3.org/2001/XMLSchema#float'" * annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='Cost, in units of currency, per quantity of heat generated'" * annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='Cost, in units of currency, per quantity of heat generated'" * @generated */
Returns the meta object for data type 'Cost Per Heat Unit'.
getCostPerHeatUnit
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/Production/ProductionPackage.java", "license": "mit", "size": 499866 }
[ "org.eclipse.emf.ecore.EDataType" ]
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
806,858
public BinarySchemaRegistry schemaRegistry(int typeId) { Map<Integer, BinarySchemaRegistry> schemas0 = schemas; if (schemas0 == null) { synchronized (this) { schemas0 = schemas; if (schemas0 == null) { schemas0 = new HashMap<>(); BinarySchemaRegistry reg = new BinarySchemaRegistry(); schemas0.put(typeId, reg); schemas = schemas0; return reg; } } } BinarySchemaRegistry reg = schemas0.get(typeId); if (reg == null) { synchronized (this) { reg = schemas.get(typeId); if (reg == null) { reg = new BinarySchemaRegistry(); schemas0 = new HashMap<>(schemas); schemas0.put(typeId, reg); schemas = schemas0; } } } return reg; }
BinarySchemaRegistry function(int typeId) { Map<Integer, BinarySchemaRegistry> schemas0 = schemas; if (schemas0 == null) { synchronized (this) { schemas0 = schemas; if (schemas0 == null) { schemas0 = new HashMap<>(); BinarySchemaRegistry reg = new BinarySchemaRegistry(); schemas0.put(typeId, reg); schemas = schemas0; return reg; } } } BinarySchemaRegistry reg = schemas0.get(typeId); if (reg == null) { synchronized (this) { reg = schemas.get(typeId); if (reg == null) { reg = new BinarySchemaRegistry(); schemas0 = new HashMap<>(schemas); schemas0.put(typeId, reg); schemas = schemas0; } } } return reg; }
/** * Get schema registry for type ID. * * @param typeId Type ID. * @return Schema registry for type ID. */
Get schema registry for type ID
schemaRegistry
{ "repo_name": "chandresh-pancholi/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java", "license": "apache-2.0", "size": 55662 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
951,996
public void testZeroAssociatedObjectsNestedSearch1() throws Exception { Class targetClass = Person.class; Person criteria = new Person(); criteria.setId(new Integer(4)); Object[] results = getQueryObjectResults(targetClass, criteria); assertNotNull(results); assertEquals(1,results.length); Person result = (Person)results[0]; assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getName()); Object[] addressResults = getAssociationResults(result, "livesAt", 0); assertEquals(0,addressResults.length); }
void function() throws Exception { Class targetClass = Person.class; Person criteria = new Person(); criteria.setId(new Integer(4)); Object[] results = getQueryObjectResults(targetClass, criteria); assertNotNull(results); assertEquals(1,results.length); Person result = (Person)results[0]; assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getName()); Object[] addressResults = getAssociationResults(result, STR, 0); assertEquals(0,addressResults.length); }
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set * erifies that the associated object is null * * @throws Exception */
Uses Nested Search Criteria for search Verifies that the results are returned Verifies size of the result set erifies that the associated object is null
testZeroAssociatedObjectsNestedSearch1
{ "repo_name": "NCIP/cacore-sdk", "path": "sdk-toolkit/example-project/junit/src/test/ws/O2OUnidirectionalSelfassociationWSTest.java", "license": "bsd-3-clause", "size": 6168 }
[ "gov.nih.nci.cacoresdk.domain.onetoone.unidirectional.Person" ]
import gov.nih.nci.cacoresdk.domain.onetoone.unidirectional.Person;
import gov.nih.nci.cacoresdk.domain.onetoone.unidirectional.*;
[ "gov.nih.nci" ]
gov.nih.nci;
429,223
public static void createAndFailSilent(ZooKeeperWatcher zkw, String znode) throws KeeperException { createAndFailSilent(zkw, znode, new byte[0]); }
static void function(ZooKeeperWatcher zkw, String znode) throws KeeperException { createAndFailSilent(zkw, znode, new byte[0]); }
/** * Creates the specified node, iff the node does not exist. Does not set a * watch and fails silently if the node already exists. * * The node created is persistent and open access. * * @param zkw zk reference * @param znode path of node * @throws KeeperException if unexpected zookeeper exception */
Creates the specified node, iff the node does not exist. Does not set a watch and fails silently if the node already exists. The node created is persistent and open access
createAndFailSilent
{ "repo_name": "grokcoder/pbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java", "license": "apache-2.0", "size": 73599 }
[ "org.apache.zookeeper.KeeperException" ]
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.*;
[ "org.apache.zookeeper" ]
org.apache.zookeeper;
2,250,885
public void setValue(long val) { if (!OPTIMIZE_RUNTIME) { checkReadOnly(); } if (_objectValue == null) { _objectValue = new SPOTPrintableString(); } if (_objectValue instanceof aSPOTElement) { ((aSPOTElement) _objectValue).setValue(val); } else { _objectValue.spot_setValue(SNumber.toString(val)); } _objectValue.spot_setParent(this); }
void function(long val) { if (!OPTIMIZE_RUNTIME) { checkReadOnly(); } if (_objectValue == null) { _objectValue = new SPOTPrintableString(); } if (_objectValue instanceof aSPOTElement) { ((aSPOTElement) _objectValue).setValue(val); } else { _objectValue.spot_setValue(SNumber.toString(val)); } _objectValue.spot_setParent(this); }
/** * Sets the value * * @param val the value */
Sets the value
setValue
{ "repo_name": "appnativa/rare", "path": "source/spot/src/com/appnativa/spot/SPOTAny.java", "license": "gpl-3.0", "size": 21237 }
[ "com.appnativa.util.SNumber" ]
import com.appnativa.util.SNumber;
import com.appnativa.util.*;
[ "com.appnativa.util" ]
com.appnativa.util;
1,362,961
@Test public void testGoalId() { request.setGoalId(1); assertEquals(Integer.valueOf(1), request.getGoalId()); }
void function() { request.setGoalId(1); assertEquals(Integer.valueOf(1), request.getGoalId()); }
/** * Test of getGoalId method, of class PiwikRequest. */
Test of getGoalId method, of class PiwikRequest
testGoalId
{ "repo_name": "piwik/piwik-java-tracker", "path": "src/test/java/org/piwik/java/tracking/PiwikRequestTest.java", "license": "bsd-3-clause", "size": 46898 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
460,234
@Override public boolean deleteRepository(String repositoryName) { RepositoryModel repository = repositoryManager.getRepositoryModel(repositoryName); return deleteRepositoryModel(repository); }
boolean function(String repositoryName) { RepositoryModel repository = repositoryManager.getRepositoryModel(repositoryName); return deleteRepositoryModel(repository); }
/** * Delete the repository and all associated tickets. */
Delete the repository and all associated tickets
deleteRepository
{ "repo_name": "firateren52/gitblit", "path": "src/main/java/com/gitblit/GitBlit.java", "license": "apache-2.0", "size": 13076 }
[ "com.gitblit.models.RepositoryModel" ]
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.*;
[ "com.gitblit.models" ]
com.gitblit.models;
1,548,509
public Timestamp getUpdated(); public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR;
/** Get Updated. * Date this record was updated */
Get Updated. Date this record was updated
getUpdated
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/I_C_ValidCombination.java", "license": "gpl-2.0", "size": 11118 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
417,631
@SuppressWarnings("unchecked") public void negateCustomerInvoiceDetailUnitPrices() { CustomerInvoiceDetail customerInvoiceDetail; for (Iterator i = getSourceAccountingLines().iterator(); i.hasNext();) { customerInvoiceDetail = (CustomerInvoiceDetail) i.next(); customerInvoiceDetail.setInvoiceItemUnitPrice(customerInvoiceDetail.getInvoiceItemUnitPrice().negate()); //clear the old CustomerInvoiceDocument customerInvoiceDetail.setCustomerInvoiceDocument(null); // revert changes for custom invoice error correction //SpringContext.getBean(CustomerInvoiceDetailService.class).prepareCustomerInvoiceDetailForErrorCorrection(customerInvoiceDetail, this); } }
@SuppressWarnings(STR) void function() { CustomerInvoiceDetail customerInvoiceDetail; for (Iterator i = getSourceAccountingLines().iterator(); i.hasNext();) { customerInvoiceDetail = (CustomerInvoiceDetail) i.next(); customerInvoiceDetail.setInvoiceItemUnitPrice(customerInvoiceDetail.getInvoiceItemUnitPrice().negate()); customerInvoiceDetail.setCustomerInvoiceDocument(null); } }
/** * This method... */
This method..
negateCustomerInvoiceDetailUnitPrices
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/ar/document/CustomerInvoiceDocument.java", "license": "apache-2.0", "size": 76460 }
[ "java.util.Iterator", "org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail" ]
import java.util.Iterator; import org.kuali.kfs.module.ar.businessobject.CustomerInvoiceDetail;
import java.util.*; import org.kuali.kfs.module.ar.businessobject.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,754,878
public ServiceFuture<DiagnoseVirtualNetworkResultInner> diagnoseVirtualNetworkAsync(String resourceGroupName, String clusterName, final ServiceCallback<DiagnoseVirtualNetworkResultInner> serviceCallback) { return ServiceFuture.fromResponse(diagnoseVirtualNetworkWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); }
ServiceFuture<DiagnoseVirtualNetworkResultInner> function(String resourceGroupName, String clusterName, final ServiceCallback<DiagnoseVirtualNetworkResultInner> serviceCallback) { return ServiceFuture.fromResponse(diagnoseVirtualNetworkWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); }
/** * Diagnoses network connectivity status for external resources on which the service is dependent on. * * @param resourceGroupName The name of the resource group containing the Kusto cluster. * @param clusterName The name of the Kusto cluster. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Diagnoses network connectivity status for external resources on which the service is dependent on
diagnoseVirtualNetworkAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/kusto/mgmt-v2020_02_15/src/main/java/com/microsoft/azure/management/kusto/v2020_02_15/implementation/ClustersInner.java", "license": "mit", "size": 159457 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,251,732
protected void write(byte[] data) throws java.io.IOException { write(data, data.length); }
void function(byte[] data) throws java.io.IOException { write(data, data.length); }
/** * Write bytes to the stream. * * @param data all bytes of this array are written to the stream * @throws java.io.IOException if there was a problem writing the data */
Write bytes to the stream
write
{ "repo_name": "arunasujith/wso2-axis2", "path": "modules/saaj/src/org/apache/axis2/saaj/util/SAAJDataSource.java", "license": "apache-2.0", "size": 22099 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
415,762
public final byte[] doFinal() throws IllegalBlockSizeException, BadPaddingException { return doFinal(null, 0, 0); }
final byte[] function() throws IllegalBlockSizeException, BadPaddingException { return doFinal(null, 0, 0); }
/** * Finish a multiple-part encryption or decryption operation (depending on * how this cipher was initialized). * * @return a new buffer with the result * @throws IllegalBlockSizeException if this cipher is a block cipher and the total input * length is not a multiple of the block size (for * encryption when no padding is used or for decryption). * @throws BadPaddingException if this cipher is a block cipher and unpadding fails. */
Finish a multiple-part encryption or decryption operation (depending on how this cipher was initialized)
doFinal
{ "repo_name": "ripple/ripple-lib-java", "path": "ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/jcajce/provider/util/CipherSpiExt.java", "license": "isc", "size": 26448 }
[ "javax.crypto.BadPaddingException", "javax.crypto.IllegalBlockSizeException" ]
import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException;
import javax.crypto.*;
[ "javax.crypto" ]
javax.crypto;
1,241,665
@Override public void afterPropertiesSet() throws Exception { nbrDaysForLastBucket = getParameterService().getParameterValueAsString(CustomerAgingReportDetail.class, ArConstants.CUSTOMER_INVOICE_AGE); // default is 120 days cutoffdate91toSYSPRlabel = "91-" + nbrDaysForLastBucket + " days"; cutoffdateSYSPRplus1orMorelabel = Integer.toString((Integer.parseInt(nbrDaysForLastBucket)) + 1) + "+ days"; }
void function() throws Exception { nbrDaysForLastBucket = getParameterService().getParameterValueAsString(CustomerAgingReportDetail.class, ArConstants.CUSTOMER_INVOICE_AGE); cutoffdate91toSYSPRlabel = "91-" + nbrDaysForLastBucket + STR; cutoffdateSYSPRplus1orMorelabel = Integer.toString((Integer.parseInt(nbrDaysForLastBucket)) + 1) + STR; }
/** * Sets properties which are parameter based - this is just the easiest place to set their values * * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */
Sets properties which are parameter based - this is just the easiest place to set their values
afterPropertiesSet
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/businessobject/lookup/CustomerAgingReportLookupableHelperServiceImpl.java", "license": "agpl-3.0", "size": 48795 }
[ "org.kuali.kfs.module.ar.ArConstants", "org.kuali.kfs.module.ar.businessobject.CustomerAgingReportDetail" ]
import org.kuali.kfs.module.ar.ArConstants; import org.kuali.kfs.module.ar.businessobject.CustomerAgingReportDetail;
import org.kuali.kfs.module.ar.*; import org.kuali.kfs.module.ar.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,182,861
@SuppressWarnings("unchecked") public static void clear(IgniteFileSystem igfs) throws Exception { Field workerMapFld = IgfsImpl.class.getDeclaredField("workerMap"); workerMapFld.setAccessible(true); // Wait for all workers to finish. Map<IgfsPath, IgfsFileWorkerBatch> workerMap = (Map<IgfsPath, IgfsFileWorkerBatch>)workerMapFld.get(igfs); for (Map.Entry<IgfsPath, IgfsFileWorkerBatch> entry : workerMap.entrySet()) { entry.getValue().cancel(); try { entry.getValue().await(); } catch (IgniteCheckedException e) { if (!(e instanceof IgfsFileWorkerBatchCancelledException)) throw e; } } // Clear igfs. igfs.clear(); int prevDifferentSize = Integer.MAX_VALUE; // Previous different size. int constCnt = 0, totalCnt = 0; final int constThreshold = 20; final long sleepPeriod = 500L; final long totalThreshold = CACHE_EMPTY_TIMEOUT / sleepPeriod; while (true) { int metaSize = 0; for (IgniteUuid metaId : getMetaCache(igfs).keySet()) { if (!IgfsUtils.isRootOrTrashId(metaId)) metaSize++; } int dataSize = getDataCache(igfs).size(); int size = metaSize + dataSize; if (size <= 2) return; // Caches are cleared, we're done. (2 because ROOT & TRASH always exist). X.println("Sum size: " + size); if (size > prevDifferentSize) { X.println("Summary cache size has grown unexpectedly: size=" + size + ", prevSize=" + prevDifferentSize); break; } if (totalCnt > totalThreshold) { X.println("Timeout exceeded."); break; } if (size == prevDifferentSize) { constCnt++; if (constCnt == constThreshold) { X.println("Summary cache size stays unchanged for too long: size=" + size); break; } } else { constCnt = 0; prevDifferentSize = size; // renew; } Thread.sleep(sleepPeriod); totalCnt++; } dumpCache("MetaCache" , getMetaCache(igfs)); dumpCache("DataCache" , getDataCache(igfs)); fail("Caches are not empty."); }
@SuppressWarnings(STR) static void function(IgniteFileSystem igfs) throws Exception { Field workerMapFld = IgfsImpl.class.getDeclaredField(STR); workerMapFld.setAccessible(true); Map<IgfsPath, IgfsFileWorkerBatch> workerMap = (Map<IgfsPath, IgfsFileWorkerBatch>)workerMapFld.get(igfs); for (Map.Entry<IgfsPath, IgfsFileWorkerBatch> entry : workerMap.entrySet()) { entry.getValue().cancel(); try { entry.getValue().await(); } catch (IgniteCheckedException e) { if (!(e instanceof IgfsFileWorkerBatchCancelledException)) throw e; } } igfs.clear(); int prevDifferentSize = Integer.MAX_VALUE; int constCnt = 0, totalCnt = 0; final int constThreshold = 20; final long sleepPeriod = 500L; final long totalThreshold = CACHE_EMPTY_TIMEOUT / sleepPeriod; while (true) { int metaSize = 0; for (IgniteUuid metaId : getMetaCache(igfs).keySet()) { if (!IgfsUtils.isRootOrTrashId(metaId)) metaSize++; } int dataSize = getDataCache(igfs).size(); int size = metaSize + dataSize; if (size <= 2) return; X.println(STR + size); if (size > prevDifferentSize) { X.println(STR + size + STR + prevDifferentSize); break; } if (totalCnt > totalThreshold) { X.println(STR); break; } if (size == prevDifferentSize) { constCnt++; if (constCnt == constThreshold) { X.println(STR + size); break; } } else { constCnt = 0; prevDifferentSize = size; } Thread.sleep(sleepPeriod); totalCnt++; } dumpCache(STR , getMetaCache(igfs)); dumpCache(STR , getDataCache(igfs)); fail(STR); }
/** * Clear particular IGFS. * * @param igfs IGFS. * @throws Exception If failed. */
Clear particular IGFS
clear
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractBaseSelfTest.java", "license": "apache-2.0", "size": 33672 }
[ "java.lang.reflect.Field", "java.util.Map", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.IgniteFileSystem", "org.apache.ignite.igfs.IgfsPath", "org.apache.ignite.internal.util.typedef.X", "org.apache.ignite.lang.IgniteUuid" ]
import java.lang.reflect.Field; import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteFileSystem; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.lang.IgniteUuid;
import java.lang.reflect.*; import java.util.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*;
[ "java.lang", "java.util", "org.apache.ignite" ]
java.lang; java.util; org.apache.ignite;
536,155
protected void updateTitle() { if (!m_TitleGenerator.isEnabled()) return; SwingUtilities.invokeLater(() -> { String title = m_TitleGenerator.generate(m_TextPanel.getCurrentFile(), m_TextPanel.isModified()); setParentTitle(title); }); }
void function() { if (!m_TitleGenerator.isEnabled()) return; SwingUtilities.invokeLater(() -> { String title = m_TitleGenerator.generate(m_TextPanel.getCurrentFile(), m_TextPanel.isModified()); setParentTitle(title); }); }
/** * Updates the title of the dialog. */
Updates the title of the dialog
updateTitle
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/gui/dialog/TextPanel.java", "license": "gpl-3.0", "size": 21902 }
[ "javax.swing.SwingUtilities" ]
import javax.swing.SwingUtilities;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,831,667
MultiSurfacePropertyType getLod1MultiSurface();
MultiSurfacePropertyType getLod1MultiSurface();
/** * Returns the value of the '<em><b>Lod1 Multi Surface</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Lod1 Multi Surface</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Lod1 Multi Surface</em>' containment reference. * @see #setLod1MultiSurface(MultiSurfacePropertyType) * @see net.opengis.citygml.transportation.TransportationPackage#getTransportationComplexType_Lod1MultiSurface() * @model containment="true" * extendedMetaData="kind='element' name='lod1MultiSurface' namespace='##targetNamespace'" * @generated */
Returns the value of the 'Lod1 Multi Surface' containment reference. If the meaning of the 'Lod1 Multi Surface' containment reference isn't clear, there really should be more of a description here...
getLod1MultiSurface
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore/src/net/opengis/citygml/transportation/TransportationComplexType.java", "license": "apache-2.0", "size": 13757 }
[ "net.opengis.gml.MultiSurfacePropertyType" ]
import net.opengis.gml.MultiSurfacePropertyType;
import net.opengis.gml.*;
[ "net.opengis.gml" ]
net.opengis.gml;
1,908,924
protected IFigure setupContentPane(IFigure nodeShape) { return nodeShape; // use nodeShape itself as contentPane }
IFigure function(IFigure nodeShape) { return nodeShape; }
/** * Default implementation treats passed figure as content pane. * Respects layout one may have set for generated figure. * @param nodeShape instance of generated figure class * @generated */
Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure
setupContentPane
{ "repo_name": "rajeevanv89/developer-studio", "path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/parts/EntitlementMediatorOnAcceptOutputConnectorEditPart.java", "license": "apache-2.0", "size": 20754 }
[ "org.eclipse.draw2d.IFigure" ]
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
1,990,582
final String value = System.getProperty(key); if (Strings.isNullOrEmpty(value)) { return valueIfNull; } return value; }
final String value = System.getProperty(key); if (Strings.isNullOrEmpty(value)) { return valueIfNull; } return value; }
/** * Gets a system property string, or a replacement value if the property is * null or blank. * * @param key * @param valueIfNull * @return */
Gets a system property string, or a replacement value if the property is null or blank
getString
{ "repo_name": "datacleaner/DataCleaner", "path": "engine/core/src/main/java/org/datacleaner/util/SystemProperties.java", "license": "lgpl-3.0", "size": 7246 }
[ "com.google.common.base.Strings" ]
import com.google.common.base.Strings;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
253,689
public static Object readStaticField(Class cls, String fieldName, boolean forceAccess) throws IllegalAccessException { Field field = getField(cls, fieldName, forceAccess); if (field == null) { throw new IllegalArgumentException("Cannot locate field " + fieldName + " on " + cls); } //already forced access above, don't repeat it here: return readStaticField(field, false); }
static Object function(Class cls, String fieldName, boolean forceAccess) throws IllegalAccessException { Field field = getField(cls, fieldName, forceAccess); if (field == null) { throw new IllegalArgumentException(STR + fieldName + STR + cls); } return readStaticField(field, false); }
/** * Read the named static field. Superclasses will be considered. * @param cls the class to reflect, must not be null * @param fieldName the field name to obtain * @param forceAccess whether to break scope restrictions using the * <code>setAccessible</code> method. <code>False</code> will only * match public fields. * @return the Field object * @throws IllegalArgumentException if the class or field name is null * @throws IllegalAccessException if the field is not made accessible */
Read the named static field. Superclasses will be considered
readStaticField
{ "repo_name": "glorycloud/GloryMail", "path": "CloudyMail/lib_src/org/apache/commons/lang/reflect/FieldUtils.java", "license": "apache-2.0", "size": 26754 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,602,406
protected void initInternalFrame(JInternalFrameOperator intOper) { if (!intOper.isSelected()) { intOper.activate(); } }
void function(JInternalFrameOperator intOper) { if (!intOper.isSelected()) { intOper.activate(); } }
/** * Inits an internal frame. * * @param intOper an operator representing the frame. */
Inits an internal frame
initInternalFrame
{ "repo_name": "md-5/jdk10", "path": "test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DefaultVisualizer.java", "license": "gpl-2.0", "size": 9071 }
[ "org.netbeans.jemmy.operators.JInternalFrameOperator" ]
import org.netbeans.jemmy.operators.JInternalFrameOperator;
import org.netbeans.jemmy.operators.*;
[ "org.netbeans.jemmy" ]
org.netbeans.jemmy;
1,319,594
protected void initTMailTemplateDefs() { if (collTMailTemplateDefs == null) { collTMailTemplateDefs = new ArrayList<TMailTemplateDef>(); } }
void function() { if (collTMailTemplateDefs == null) { collTMailTemplateDefs = new ArrayList<TMailTemplateDef>(); } }
/** * Temporary storage of collTMailTemplateDefs to save a possible db hit in * the event objects are add to the collection, but the * complete collection is never requested. */
Temporary storage of collTMailTemplateDefs to save a possible db hit in the event objects are add to the collection, but the complete collection is never requested
initTMailTemplateDefs
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTMailTemplate.java", "license": "gpl-3.0", "size": 52679 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,315,570
private void skipInternal() throws IOException { if (bytesSkipped == bytesToSkip) { return; } // Acquire the shared skip buffer. byte[] skipBuffer = skipBufferReference.getAndSet(null); if (skipBuffer == null) { skipBuffer = new byte[4096]; } while (bytesSkipped != bytesToSkip) { int readLength = (int) Math.min(bytesToSkip - bytesSkipped, skipBuffer.length); int read = inputStream.read(skipBuffer, 0, readLength); if (Thread.currentThread().isInterrupted()) { throw new InterruptedIOException(); } if (read == -1) { throw new EOFException(); } bytesSkipped += read; bytesTransferred(read); } // Release the shared skip buffer. skipBufferReference.set(skipBuffer); }
void function() throws IOException { if (bytesSkipped == bytesToSkip) { return; } byte[] skipBuffer = skipBufferReference.getAndSet(null); if (skipBuffer == null) { skipBuffer = new byte[4096]; } while (bytesSkipped != bytesToSkip) { int readLength = (int) Math.min(bytesToSkip - bytesSkipped, skipBuffer.length); int read = inputStream.read(skipBuffer, 0, readLength); if (Thread.currentThread().isInterrupted()) { throw new InterruptedIOException(); } if (read == -1) { throw new EOFException(); } bytesSkipped += read; bytesTransferred(read); } skipBufferReference.set(skipBuffer); }
/** * Skips any bytes that need skipping. Else does nothing. * <p> * This implementation is based roughly on {@code libcore.io.Streams.skipByReading()}. * * @throws InterruptedIOException If the thread is interrupted during the operation. * @throws EOFException If the end of the input stream is reached before the bytes are skipped. */
Skips any bytes that need skipping. Else does nothing. This implementation is based roughly on libcore.io.Streams.skipByReading()
skipInternal
{ "repo_name": "slp/Telegram-FOSS", "path": "TMessagesProj/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java", "license": "gpl-2.0", "size": 30106 }
[ "java.io.EOFException", "java.io.IOException", "java.io.InterruptedIOException" ]
import java.io.EOFException; import java.io.IOException; import java.io.InterruptedIOException;
import java.io.*;
[ "java.io" ]
java.io;
167,137
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { if (false) { } else if (qName.equals("IBANDetail")) { setCc (attrs.getValue("cc")); setWidth (Integer.parseInt(attrs.getValue("width"))); setBbidStart (Integer.parseInt(attrs.getValue("bbidStart"))); setBbidLen (Integer.parseInt(attrs.getValue("bbidLen"))); setAcctStart (Integer.parseInt(attrs.getValue("acctStart"))); setAcctLen (Integer.parseInt(attrs.getValue("acctLen"))); setChkMethod (Integer.parseInt(attrs.getValue("chkMethod"))); setChkStart (Integer.parseInt(attrs.getValue("chkStart"))); setChkLen (Integer.parseInt(attrs.getValue("chkLen"))); } else { // silently ignore other elements } } catch (Exception exc) { throw new SAXException("invalid attribute value ", exc); } } // startElement
void function(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { if (false) { } else if (qName.equals(STR)) { setCc (attrs.getValue("cc")); setWidth (Integer.parseInt(attrs.getValue("width"))); setBbidStart (Integer.parseInt(attrs.getValue(STR))); setBbidLen (Integer.parseInt(attrs.getValue(STR))); setAcctStart (Integer.parseInt(attrs.getValue(STR))); setAcctLen (Integer.parseInt(attrs.getValue(STR))); setChkMethod (Integer.parseInt(attrs.getValue(STR))); setChkStart (Integer.parseInt(attrs.getValue(STR))); setChkLen (Integer.parseInt(attrs.getValue(STR))); } else { } } catch (Exception exc) { throw new SAXException(STR, exc); } }
/** Receive notification of the start of an element. * Looks for the element which contains encoded strings. * @param uri The Namespace URI, or the empty string if the element has no Namespace URI * or if Namespace processing is not being performed. * @param localName the local name (without prefix), * or the empty string if Namespace processing is not being performed. * @param qName the qualified name (with prefix), * or the empty string if qualified names are not available. * @param attrs the attributes attached to the element. * If there are no attributes, it shall be an empty Attributes object. * @throws SAXException for SAX errors */
Receive notification of the start of an element. Looks for the element which contains encoded strings
startElement
{ "repo_name": "gfis/checkdig", "path": "src/main/java/org/teherba/checkdig/account/IBANDetailBeanBase.java", "license": "apache-2.0", "size": 9380 }
[ "org.xml.sax.Attributes", "org.xml.sax.SAXException" ]
import org.xml.sax.Attributes; import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
2,249,831
@Override public Request<DescribeInstancesRequest> getDryRunRequest() { Request<DescribeInstancesRequest> request = new DescribeInstancesRequestMarshaller() .marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; }
Request<DescribeInstancesRequest> function() { Request<DescribeInstancesRequest> request = new DescribeInstancesRequestMarshaller() .marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; }
/** * This method is intended for internal use only. Returns the marshaled * request configured with additional parameters to enable operation * dry-run. */
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run
getDryRunRequest
{ "repo_name": "nterry/aws-sdk-java", "path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeInstancesRequest.java", "license": "apache-2.0", "size": 169607 }
[ "com.amazonaws.Request", "com.amazonaws.services.ec2.model.transform.DescribeInstancesRequestMarshaller" ]
import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.DescribeInstancesRequestMarshaller;
import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*;
[ "com.amazonaws", "com.amazonaws.services" ]
com.amazonaws; com.amazonaws.services;
284,970
protected static SearchContext createSearchContext(IndexService indexService) { BigArrays bigArrays = indexService.injector().getInstance(BigArrays.class); ThreadPool threadPool = indexService.injector().getInstance(ThreadPool.class); PageCacheRecycler pageCacheRecycler = indexService.injector().getInstance(PageCacheRecycler.class); return new TestSearchContext(threadPool, pageCacheRecycler, bigArrays, indexService, indexService.cache().query(), indexService.fieldData()); }
static SearchContext function(IndexService indexService) { BigArrays bigArrays = indexService.injector().getInstance(BigArrays.class); ThreadPool threadPool = indexService.injector().getInstance(ThreadPool.class); PageCacheRecycler pageCacheRecycler = indexService.injector().getInstance(PageCacheRecycler.class); return new TestSearchContext(threadPool, pageCacheRecycler, bigArrays, indexService, indexService.cache().query(), indexService.fieldData()); }
/** * Create a new search context. */
Create a new search context
createSearchContext
{ "repo_name": "zeroctu/elasticsearch", "path": "core/src/test/java/org/elasticsearch/test/ESSingleNodeTestCase.java", "license": "apache-2.0", "size": 10894 }
[ "org.elasticsearch.cache.recycler.PageCacheRecycler", "org.elasticsearch.common.util.BigArrays", "org.elasticsearch.index.IndexService", "org.elasticsearch.search.internal.SearchContext", "org.elasticsearch.threadpool.ThreadPool" ]
import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.index.IndexService; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.cache.recycler.*; import org.elasticsearch.common.util.*; import org.elasticsearch.index.*; import org.elasticsearch.search.internal.*; import org.elasticsearch.threadpool.*;
[ "org.elasticsearch.cache", "org.elasticsearch.common", "org.elasticsearch.index", "org.elasticsearch.search", "org.elasticsearch.threadpool" ]
org.elasticsearch.cache; org.elasticsearch.common; org.elasticsearch.index; org.elasticsearch.search; org.elasticsearch.threadpool;
1,120,734
@Override public void enterNo_brackets_curlies_or_squares(@NotNull FunctionParser.No_brackets_curlies_or_squaresContext ctx) { }
@Override public void enterNo_brackets_curlies_or_squares(@NotNull FunctionParser.No_brackets_curlies_or_squaresContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitNo_brackets
{ "repo_name": "octopus-platform/joern", "path": "projects/extensions/joern-fuzzyc/src/main/java/antlr/FunctionBaseListener.java", "license": "lgpl-3.0", "size": 42232 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
647,274
public float getLayoutAlignmentY(Container target) { return target.getAlignmentY(); }
float function(Container target) { return target.getAlignmentY(); }
/** * This specifies how a component is aligned with respect to other * components in the y direction. * * @param target The container. * * @return The component's alignment. */
This specifies how a component is aligned with respect to other components in the y direction
getLayoutAlignmentY
{ "repo_name": "aosm/gcc_40", "path": "libjava/javax/swing/plaf/basic/BasicSplitPaneUI.java", "license": "gpl-2.0", "size": 41958 }
[ "java.awt.Container" ]
import java.awt.Container;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,754,458
private boolean elementIsWithinReach(Element currentElement, Property target) { boolean withinReach = false; if(currentElement == target) withinReach = true; else { for(Iterator<Element> iter = currentElement.getOwnedElement().iterator(); iter.hasNext(); ) { Element nextElement = iter.next(); if(nextElement instanceof Property && ModelCenterPlugin.getMDModelHandlerInstance().isModelCenterDataModel(((Property)nextElement).getType())) { withinReach = elementIsWithinReach(nextElement, target); if(withinReach == true) { break; } } } } return withinReach; }
boolean function(Element currentElement, Property target) { boolean withinReach = false; if(currentElement == target) withinReach = true; else { for(Iterator<Element> iter = currentElement.getOwnedElement().iterator(); iter.hasNext(); ) { Element nextElement = iter.next(); if(nextElement instanceof Property && ModelCenterPlugin.getMDModelHandlerInstance().isModelCenterDataModel(((Property)nextElement).getType())) { withinReach = elementIsWithinReach(nextElement, target); if(withinReach == true) { break; } } } } return withinReach; }
/** * Check whether a given element (targetElement) is within reach from the currentElement * * @param currentElement * @param target * @return */
Check whether a given element (targetElement) is within reach from the currentElement
elementIsWithinReach
{ "repo_name": "sherzig/SyMo", "path": "src/edu/gatech/mbse/plugins/mdmc/controller/SynchronizationEngine.java", "license": "mit", "size": 32067 }
[ "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property", "java.util.Iterator" ]
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element; import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property; import java.util.Iterator;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.*; import java.util.*;
[ "com.nomagic.uml2", "java.util" ]
com.nomagic.uml2; java.util;
2,884,887
public Properties getMetaData() { return(new Properties(metaData)); }
Properties function() { return(new Properties(metaData)); }
/** * Get the meta data associated with this classloader * * @return A Properties object representing any meta data associated with * this classloader. A new Properties object is created each time */
Get the meta data associated with this classloader
getMetaData
{ "repo_name": "s13372/SORCER", "path": "tools/sorcer-boot/src/main/java/sorcer/provider/boot/ServiceClassLoader.java", "license": "apache-2.0", "size": 7262 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,025,193
private void addMenuItems(Menu mMenu, boolean subMenu) { int groupId = R.id.material_drawer_menu_default_group; for (int i = 0; i < mMenu.size(); i++) { MenuItem mMenuItem = mMenu.getItem(i); IDrawerItem iDrawerItem; if (!subMenu && mMenuItem.getGroupId() != groupId && mMenuItem.getGroupId() != 0) { groupId = mMenuItem.getGroupId(); iDrawerItem = new DividerDrawerItem(); getAdapter().addDrawerItems(iDrawerItem); } if (mMenuItem.hasSubMenu()) { iDrawerItem = new PrimaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()) .withSelectable(false); getAdapter().addDrawerItems(iDrawerItem); addMenuItems(mMenuItem.getSubMenu(), true); } else if (mMenuItem.getGroupId() != 0 || subMenu) { iDrawerItem = new SecondaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()); getAdapter().addDrawerItems(iDrawerItem); } else { iDrawerItem = new PrimaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()); getAdapter().addDrawerItems(iDrawerItem); } } } // close drawer on click protected boolean mCloseOnClick = true;
void function(Menu mMenu, boolean subMenu) { int groupId = R.id.material_drawer_menu_default_group; for (int i = 0; i < mMenu.size(); i++) { MenuItem mMenuItem = mMenu.getItem(i); IDrawerItem iDrawerItem; if (!subMenu && mMenuItem.getGroupId() != groupId && mMenuItem.getGroupId() != 0) { groupId = mMenuItem.getGroupId(); iDrawerItem = new DividerDrawerItem(); getAdapter().addDrawerItems(iDrawerItem); } if (mMenuItem.hasSubMenu()) { iDrawerItem = new PrimaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()) .withSelectable(false); getAdapter().addDrawerItems(iDrawerItem); addMenuItems(mMenuItem.getSubMenu(), true); } else if (mMenuItem.getGroupId() != 0 subMenu) { iDrawerItem = new SecondaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()); getAdapter().addDrawerItems(iDrawerItem); } else { iDrawerItem = new PrimaryDrawerItem() .withName(mMenuItem.getTitle().toString()) .withIcon(mMenuItem.getIcon()) .withIdentifier(mMenuItem.getItemId()) .withEnabled(mMenuItem.isEnabled()); getAdapter().addDrawerItems(iDrawerItem); } } } protected boolean mCloseOnClick = true;
/** * helper method to init the drawerItems from a menu * * @param mMenu * @param subMenu */
helper method to init the drawerItems from a menu
addMenuItems
{ "repo_name": "hanhailong/MaterialDrawer", "path": "library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java", "license": "apache-2.0", "size": 55591 }
[ "android.view.Menu", "android.view.MenuItem", "com.mikepenz.materialdrawer.model.DividerDrawerItem", "com.mikepenz.materialdrawer.model.PrimaryDrawerItem", "com.mikepenz.materialdrawer.model.SecondaryDrawerItem", "com.mikepenz.materialdrawer.model.interfaces.IDrawerItem" ]
import android.view.Menu; import android.view.MenuItem; import com.mikepenz.materialdrawer.model.DividerDrawerItem; import com.mikepenz.materialdrawer.model.PrimaryDrawerItem; import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import android.view.*; import com.mikepenz.materialdrawer.model.*; import com.mikepenz.materialdrawer.model.interfaces.*;
[ "android.view", "com.mikepenz.materialdrawer" ]
android.view; com.mikepenz.materialdrawer;
1,188,393
@Override public void writeToParcel(Parcel dest, int flags) { dest.writeSerializable(mFile); if (mInfo != null) { dest.writeByte((byte) 1); dest.writeBundle(mInfo.getBundle()); } else { dest.writeByte((byte) 0); } } private BackupFileDetails(Parcel in) { mFile = (File) in.readSerializable(); byte infoFlag = in.readByte(); if (infoFlag != (byte)0) { mInfo = new BackupInfo(in.readBundle()); } else { mInfo = null; } }
void function(Parcel dest, int flags) { dest.writeSerializable(mFile); if (mInfo != null) { dest.writeByte((byte) 1); dest.writeBundle(mInfo.getBundle()); } else { dest.writeByte((byte) 0); } } private BackupFileDetails(Parcel in) { mFile = (File) in.readSerializable(); byte infoFlag = in.readByte(); if (infoFlag != (byte)0) { mInfo = new BackupInfo(in.readBundle()); } else { mInfo = null; } }
/** * PARCELLABLE INTERFACE. * * Save all fields that must be persisted. */
PARCELLABLE INTERFACE. Save all fields that must be persisted
writeToParcel
{ "repo_name": "GuillaumeSmaha/Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/filechooser/BackupFileDetails.java", "license": "gpl-3.0", "size": 4502 }
[ "android.os.Parcel", "com.eleybourn.bookcatalogue.backup.BackupInfo", "java.io.File" ]
import android.os.Parcel; import com.eleybourn.bookcatalogue.backup.BackupInfo; import java.io.File;
import android.os.*; import com.eleybourn.bookcatalogue.backup.*; import java.io.*;
[ "android.os", "com.eleybourn.bookcatalogue", "java.io" ]
android.os; com.eleybourn.bookcatalogue; java.io;
1,088,446
public AppendBlobAccessConditions withAppendPositionAccessConditions( AppendPositionAccessConditions appendPositionAccessConditions) { this.appendPositionAccessConditions = appendPositionAccessConditions; return this; }
AppendBlobAccessConditions function( AppendPositionAccessConditions appendPositionAccessConditions) { this.appendPositionAccessConditions = appendPositionAccessConditions; return this; }
/** * Access conditions used for appending data only if the operation meets the provided conditions related to the * size of the append blob. */
Access conditions used for appending data only if the operation meets the provided conditions related to the size of the append blob
withAppendPositionAccessConditions
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java", "license": "mit", "size": 3584 }
[ "com.microsoft.azure.storage.blob.models.AppendPositionAccessConditions" ]
import com.microsoft.azure.storage.blob.models.AppendPositionAccessConditions;
import com.microsoft.azure.storage.blob.models.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,293,323
public void addGroupRole(String groupname, String rolename) { UserDatabase database = (UserDatabase) this.resource; Group group = database.findGroup(groupname); Role role = database.findRole(rolename); if (group != null && role != null) { group.addRole(role); } }
void function(String groupname, String rolename) { UserDatabase database = (UserDatabase) this.resource; Group group = database.findGroup(groupname); Role role = database.findRole(rolename); if (group != null && role != null) { group.addRole(role); } }
/** * Add role to a group. * @param groupname The group name * @param rolename The role name */
Add role to a group
addGroupRole
{ "repo_name": "apache/tomcat", "path": "java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java", "license": "apache-2.0", "size": 11097 }
[ "org.apache.catalina.Group", "org.apache.catalina.Role", "org.apache.catalina.UserDatabase" ]
import org.apache.catalina.Group; import org.apache.catalina.Role; import org.apache.catalina.UserDatabase;
import org.apache.catalina.*;
[ "org.apache.catalina" ]
org.apache.catalina;
1,589,239
public void writeContent(final OutputStream result) throws IOException { if(!inHeader) { if(this.offset != -1) { result.write(RtfFont.FONT_SIZE); result.write(intToByteArray(this.offset)); } result.write(RtfParagraph.PARAGRAPH); } for(int i = 0; i < this.rows.size(); i++) { RtfElement re = (RtfElement)this.rows.get(i); //.result.write(re.write()); re.writeContent(result); } result.write(RtfParagraph.PARAGRAPH_DEFAULTS); }
void function(final OutputStream result) throws IOException { if(!inHeader) { if(this.offset != -1) { result.write(RtfFont.FONT_SIZE); result.write(intToByteArray(this.offset)); } result.write(RtfParagraph.PARAGRAPH); } for(int i = 0; i < this.rows.size(); i++) { RtfElement re = (RtfElement)this.rows.get(i); re.writeContent(result); } result.write(RtfParagraph.PARAGRAPH_DEFAULTS); }
/** * Writes the content of this RtfTable */
Writes the content of this RtfTable
writeContent
{ "repo_name": "yogthos/itext", "path": "src/com/lowagie/text/rtf/table/RtfTable.java", "license": "lgpl-3.0", "size": 11503 }
[ "com.lowagie.text.rtf.RtfElement", "com.lowagie.text.rtf.style.RtfFont", "com.lowagie.text.rtf.text.RtfParagraph", "java.io.IOException", "java.io.OutputStream" ]
import com.lowagie.text.rtf.RtfElement; import com.lowagie.text.rtf.style.RtfFont; import com.lowagie.text.rtf.text.RtfParagraph; import java.io.IOException; import java.io.OutputStream;
import com.lowagie.text.rtf.*; import com.lowagie.text.rtf.style.*; import com.lowagie.text.rtf.text.*; import java.io.*;
[ "com.lowagie.text", "java.io" ]
com.lowagie.text; java.io;
2,202,180
private String[] getMappedServers(final ServerInformationCatalog serverInformationCatalog, final Map<String, String> mappedServers) { if (serverInformationCatalog.containsServer(HadoopResource.DEFAULT_CLUSTERREFERENCE)) { mappedServers.put("(default)", HadoopResource.DEFAULT_CLUSTERREFERENCE); } final String[] serverNames = serverInformationCatalog.getServerNames(); for (int i = 0; i < serverNames.length; i++) { final String serverName = serverNames[i]; if (!serverName.equals(HadoopResource.DEFAULT_CLUSTERREFERENCE)) { mappedServers.put(serverName, serverName); } } return mappedServers.keySet().toArray(new String[serverNames.length]); }
String[] function(final ServerInformationCatalog serverInformationCatalog, final Map<String, String> mappedServers) { if (serverInformationCatalog.containsServer(HadoopResource.DEFAULT_CLUSTERREFERENCE)) { mappedServers.put(STR, HadoopResource.DEFAULT_CLUSTERREFERENCE); } final String[] serverNames = serverInformationCatalog.getServerNames(); for (int i = 0; i < serverNames.length; i++) { final String serverName = serverNames[i]; if (!serverName.equals(HadoopResource.DEFAULT_CLUSTERREFERENCE)) { mappedServers.put(serverName, serverName); } } return mappedServers.keySet().toArray(new String[serverNames.length]); }
/** * We avoid having HadoopResource.DEFAULT_CLUSTERREFERENCE( * "org.datacleaner.hadoop.environment") as a server name. We write * "default" instead. */
We avoid having HadoopResource.DEFAULT_CLUSTERREFERENCE( "org.datacleaner.hadoop.environment") as a server name. We write "default" instead
getMappedServers
{ "repo_name": "kaspersorensen/DataCleaner", "path": "desktop/ui/src/main/java/org/datacleaner/windows/SelectHadoopClusterDialog.java", "license": "lgpl-3.0", "size": 6556 }
[ "java.util.Map", "org.datacleaner.configuration.ServerInformationCatalog", "org.datacleaner.util.HadoopResource" ]
import java.util.Map; import org.datacleaner.configuration.ServerInformationCatalog; import org.datacleaner.util.HadoopResource;
import java.util.*; import org.datacleaner.configuration.*; import org.datacleaner.util.*;
[ "java.util", "org.datacleaner.configuration", "org.datacleaner.util" ]
java.util; org.datacleaner.configuration; org.datacleaner.util;
2,909,971
public static void registerMBean(ConnectionInfo connectionInfo, Database database) throws JMException { String path = connectionInfo.getName(); if (!MBEANS.containsKey(path)) { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); String name = database.getShortName(); ObjectName mbeanObjectName = getObjectName(name, path); MBEANS.put(path, mbeanObjectName); DatabaseInfo info = new DatabaseInfo(database); Object mbean = new DocumentedMBean(info, DatabaseInfoMBean.class); mbeanServer.registerMBean(mbean, mbeanObjectName); } }
static void function(ConnectionInfo connectionInfo, Database database) throws JMException { String path = connectionInfo.getName(); if (!MBEANS.containsKey(path)) { MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); String name = database.getShortName(); ObjectName mbeanObjectName = getObjectName(name, path); MBEANS.put(path, mbeanObjectName); DatabaseInfo info = new DatabaseInfo(database); Object mbean = new DocumentedMBean(info, DatabaseInfoMBean.class); mbeanServer.registerMBean(mbean, mbeanObjectName); } }
/** * Registers an MBean for the database. * * @param connectionInfo connection info * @param database database */
Registers an MBean for the database
registerMBean
{ "repo_name": "miloszpiglas/h2mod", "path": "src/main/org/h2/jmx/DatabaseInfo.java", "license": "mpl-2.0", "size": 8383 }
[ "java.lang.management.ManagementFactory", "javax.management.JMException", "javax.management.MBeanServer", "javax.management.ObjectName", "org.h2.engine.ConnectionInfo", "org.h2.engine.Database" ]
import java.lang.management.ManagementFactory; import javax.management.JMException; import javax.management.MBeanServer; import javax.management.ObjectName; import org.h2.engine.ConnectionInfo; import org.h2.engine.Database;
import java.lang.management.*; import javax.management.*; import org.h2.engine.*;
[ "java.lang", "javax.management", "org.h2.engine" ]
java.lang; javax.management; org.h2.engine;
2,720,204
public void populateDocumentAfterInit(VendorCreditMemoDocument cmDocument);
void function(VendorCreditMemoDocument cmDocument);
/** * Populates the document from either the associated payment request document, purchase order document, or vendor detail based * on the credit memo type. * * @param cmDocument - Credit Memo Document to Populate */
Populates the document from either the associated payment request document, purchase order document, or vendor detail based on the credit memo type
populateDocumentAfterInit
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/purap/document/service/CreditMemoService.java", "license": "apache-2.0", "size": 6949 }
[ "org.kuali.kfs.module.purap.document.VendorCreditMemoDocument" ]
import org.kuali.kfs.module.purap.document.VendorCreditMemoDocument;
import org.kuali.kfs.module.purap.document.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,460,889
protected String getSubjectPrefix() { return hudson.mail.Messages.hudson_email_subject_prefix(); }
String function() { return hudson.mail.Messages.hudson_email_subject_prefix(); }
/** * Returns prefix for subject of automatically generated emails. * * @return prefix for subject. */
Returns prefix for subject of automatically generated emails
getSubjectPrefix
{ "repo_name": "sincere520/testGitRepo", "path": "hudson-core/src/main/java/hudson/tasks/mail/impl/BaseBuildResultMail.java", "license": "mit", "size": 10014 }
[ "hudson.tasks.Messages" ]
import hudson.tasks.Messages;
import hudson.tasks.*;
[ "hudson.tasks" ]
hudson.tasks;
2,665,363
private void unpackStream(InputStream is, OutputStream os, String unpackDir) throws IOException { if (null == is) { throw new IllegalArgumentException("InputStream is null"); } if (null == os && null == unpackDir) { throw new IllegalArgumentException("OutputStream and unpackDir are both null. One or the other must be valid"); } boolean writeFiles = false; if (null == os) { writeFiles = true; File unpackDirectory = new File(unpackDir); if (!unpackDirectory.isDirectory()) { throw new RuntimeException("Unpack directory is not a directory: " + unpackDir); } if (LOG.isInfoEnabled()) { LOG.info("Unpack directory: " + unpackDirectory.getAbsolutePath()); } } byte[] buffer = new byte[blockSize]; byte[] chunkHeader = new byte[16]; JFastLZ jfastlz = new JFastLZ(); // added null != unpackDir if (null != unpackDir && !jfastlz.detectMagic(is)) { throw new IllegalArgumentException("File is not a FastLZ archive"); } int chunkId; int chunkOptions; long chunkSize; long chunkChecksum; long chunkExtra; long checksum; long decompressedSize = 0l; long totalExtracted = 0l; byte[] compressedBuffer = null; byte[] decompressedBuffer = null; long compressedBufsize = 0; long decompressedBufsize = 0; int nameLength; String outputFileName = null; while (true) { // read chunk header. 16 bytes. int bytesRead = is.read(chunkHeader); if (bytesRead <= 0) { // end of file if (LOG.isDebugEnabled()) { LOG.debug("No bytes read. End of stream."); } break; } // 2 bytes - chunkId // 2 bytes - chunkOptions // 4 bytes - chunkSize // 4 bytes - chunkChecksum // 4 bytes - chunkExtra chunkId = readChunkHeaderId(chunkHeader); chunkOptions = readChunkHeaderOptions(chunkHeader); chunkSize = readChunkHeaderSize(chunkHeader); chunkChecksum = readChunkHeaderChecksum(chunkHeader); chunkExtra = readChunkHeaderExtra(chunkHeader); // chunk contains: // - self checksum // - decompressedSize // - compressed file name length & name if (chunkId == 1 && chunkSize > 10 && chunkSize < blockSize) { outputFileName = null; // close current file, if any if (writeFiles && null != os) { os.close(); os = null; } is.read(buffer, 0, (int)chunkSize); checksum = JFastLZ.updateAdler32(1L, buffer, (int)chunkSize); if(checksum != chunkChecksum) { LOG.error("Checksum mismatch. Got " + checksum + " Expecting " + chunkChecksum); throw new RuntimeException("Error: checksum mismatch!"); } decompressedSize = JFastLZ.readU32(buffer); totalExtracted = 0; nameLength = (int)JFastLZ.readU16(buffer, 8); if(nameLength > (int)chunkSize - 10) { nameLength = (int)chunkSize - 10; } // trim() b/c ...well it had whitespace in my tests outputFileName = new String(buffer, 10, nameLength).trim(); if (LOG.isDebugEnabled()){ LOG.debug("decompressedSize: " + decompressedSize); LOG.debug("outputFileName: " + outputFileName); } if (writeFiles) { File outputFile = new File(unpackDir + File.separator + outputFileName); // check if file exists if (outputFile.exists()) { throw new RuntimeException("output file already exists: " + outputFile.getAbsolutePath()); } if (LOG.isInfoEnabled()) { LOG.info("Unpacking file to: " + outputFile.getAbsolutePath()); } os = new BufferedOutputStream(new FileOutputStream(outputFile), blockSize*2); } } if(chunkId == 17 && outputFileName != null && decompressedSize > 0){ long remaining = 0l; switch(chunkOptions) { case 0: totalExtracted += chunkSize; remaining = chunkSize; checksum = 1L; while(true) { long r = (blockSize < remaining) ? blockSize: remaining; int chunkBytesRead = is.read(buffer, 0, (int) r); if(chunkBytesRead == 0) { break; } os.write(buffer, 0, chunkBytesRead); checksum = JFastLZ.updateAdler32(checksum, buffer, chunkBytesRead); remaining -= chunkBytesRead; } if(checksum != chunkChecksum) { outputFileName = null; LOG.error("Error: checksum mismatch. Got " + checksum + " Expecting " + chunkChecksum + ". Aborted."); throw new RuntimeException("Error: checksum mismatch!"); } break; case 1: if(chunkSize > compressedBufsize){ compressedBufsize = chunkSize; compressedBuffer = new byte[(int)compressedBufsize]; } if(chunkExtra > decompressedBufsize) { decompressedBufsize = chunkExtra; decompressedBuffer = new byte[(int)decompressedBufsize]; } is.read(compressedBuffer, 0, (int)chunkSize); checksum = JFastLZ.updateAdler32(1L, compressedBuffer, (int)chunkSize); totalExtracted += chunkExtra; if(checksum != chunkChecksum) { LOG.error("Error: checksum mismatch. Got " + checksum + " Expecting " + chunkChecksum + ". Skipping..."); outputFileName = null; } else { remaining = jfastlz.fastlzDecompress(compressedBuffer, 0, (int)chunkSize, decompressedBuffer, 0, (int)chunkExtra); if(remaining != chunkExtra){ LOG.error("Error: decompression failed. decompressed length (" + remaining + ") does not match header value (" + chunkExtra + "). Skipping..."); outputFileName = null; } else { os.write(decompressedBuffer, 0, (int)chunkExtra); } } break; default: LOG.error("Error: unknown compression method: " + chunkOptions); outputFileName = null; break; } } } // close os if we created the os via FileOuputStream if (writeFiles && null != os) { os.close(); } }
void function(InputStream is, OutputStream os, String unpackDir) throws IOException { if (null == is) { throw new IllegalArgumentException(STR); } if (null == os && null == unpackDir) { throw new IllegalArgumentException(STR); } boolean writeFiles = false; if (null == os) { writeFiles = true; File unpackDirectory = new File(unpackDir); if (!unpackDirectory.isDirectory()) { throw new RuntimeException(STR + unpackDir); } if (LOG.isInfoEnabled()) { LOG.info(STR + unpackDirectory.getAbsolutePath()); } } byte[] buffer = new byte[blockSize]; byte[] chunkHeader = new byte[16]; JFastLZ jfastlz = new JFastLZ(); if (null != unpackDir && !jfastlz.detectMagic(is)) { throw new IllegalArgumentException(STR); } int chunkId; int chunkOptions; long chunkSize; long chunkChecksum; long chunkExtra; long checksum; long decompressedSize = 0l; long totalExtracted = 0l; byte[] compressedBuffer = null; byte[] decompressedBuffer = null; long compressedBufsize = 0; long decompressedBufsize = 0; int nameLength; String outputFileName = null; while (true) { int bytesRead = is.read(chunkHeader); if (bytesRead <= 0) { if (LOG.isDebugEnabled()) { LOG.debug(STR); } break; } chunkId = readChunkHeaderId(chunkHeader); chunkOptions = readChunkHeaderOptions(chunkHeader); chunkSize = readChunkHeaderSize(chunkHeader); chunkChecksum = readChunkHeaderChecksum(chunkHeader); chunkExtra = readChunkHeaderExtra(chunkHeader); if (chunkId == 1 && chunkSize > 10 && chunkSize < blockSize) { outputFileName = null; if (writeFiles && null != os) { os.close(); os = null; } is.read(buffer, 0, (int)chunkSize); checksum = JFastLZ.updateAdler32(1L, buffer, (int)chunkSize); if(checksum != chunkChecksum) { LOG.error(STR + checksum + STR + chunkChecksum); throw new RuntimeException(STR); } decompressedSize = JFastLZ.readU32(buffer); totalExtracted = 0; nameLength = (int)JFastLZ.readU16(buffer, 8); if(nameLength > (int)chunkSize - 10) { nameLength = (int)chunkSize - 10; } outputFileName = new String(buffer, 10, nameLength).trim(); if (LOG.isDebugEnabled()){ LOG.debug(STR + decompressedSize); LOG.debug(STR + outputFileName); } if (writeFiles) { File outputFile = new File(unpackDir + File.separator + outputFileName); if (outputFile.exists()) { throw new RuntimeException(STR + outputFile.getAbsolutePath()); } if (LOG.isInfoEnabled()) { LOG.info(STR + outputFile.getAbsolutePath()); } os = new BufferedOutputStream(new FileOutputStream(outputFile), blockSize*2); } } if(chunkId == 17 && outputFileName != null && decompressedSize > 0){ long remaining = 0l; switch(chunkOptions) { case 0: totalExtracted += chunkSize; remaining = chunkSize; checksum = 1L; while(true) { long r = (blockSize < remaining) ? blockSize: remaining; int chunkBytesRead = is.read(buffer, 0, (int) r); if(chunkBytesRead == 0) { break; } os.write(buffer, 0, chunkBytesRead); checksum = JFastLZ.updateAdler32(checksum, buffer, chunkBytesRead); remaining -= chunkBytesRead; } if(checksum != chunkChecksum) { outputFileName = null; LOG.error(STR + checksum + STR + chunkChecksum + STR); throw new RuntimeException(STR); } break; case 1: if(chunkSize > compressedBufsize){ compressedBufsize = chunkSize; compressedBuffer = new byte[(int)compressedBufsize]; } if(chunkExtra > decompressedBufsize) { decompressedBufsize = chunkExtra; decompressedBuffer = new byte[(int)decompressedBufsize]; } is.read(compressedBuffer, 0, (int)chunkSize); checksum = JFastLZ.updateAdler32(1L, compressedBuffer, (int)chunkSize); totalExtracted += chunkExtra; if(checksum != chunkChecksum) { LOG.error(STR + checksum + STR + chunkChecksum + STR); outputFileName = null; } else { remaining = jfastlz.fastlzDecompress(compressedBuffer, 0, (int)chunkSize, decompressedBuffer, 0, (int)chunkExtra); if(remaining != chunkExtra){ LOG.error(STR + remaining + STR + chunkExtra + STR); outputFileName = null; } else { os.write(decompressedBuffer, 0, (int)chunkExtra); } } break; default: LOG.error(STR + chunkOptions); outputFileName = null; break; } } } if (writeFiles && null != os) { os.close(); } }
/** * Unpacks input stream to the output stream. If output stream is null, output is written * to files in the unpackDir argument, utilizing file names stored in the archive. * * * @see JFastLZ#fastlzDecompress(byte[], int, byte[], int, JFastLZLevel) * * @param is * @param inputSize * @param os * @param unpackDir * @throws IOException */
Unpacks input stream to the output stream. If output stream is null, output is written to files in the unpackDir argument, utilizing file names stored in the archive
unpackStream
{ "repo_name": "maji-KY/jfastlz", "path": "src/org/jfastlz/JFastLZUnpack.java", "license": "mit", "size": 24101 }
[ "java.io.BufferedOutputStream", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
805,583
public double totalSeconds() { final double nanoSecondsPerSecond = 1E9; Duration thisDuration = this.timeUnit.getDuration(); double seconds = thisDuration.getSeconds() * this.length; double nanos = thisDuration.getNano(); nanos = (nanos * this.length); nanos = (nanos / nanoSecondsPerSecond); return seconds + nanos; }
double function() { final double nanoSecondsPerSecond = 1E9; Duration thisDuration = this.timeUnit.getDuration(); double seconds = thisDuration.getSeconds() * this.length; double nanos = thisDuration.getNano(); nanos = (nanos * this.length); nanos = (nanos / nanoSecondsPerSecond); return seconds + nanos; }
/** * The total amount of time in this time period measured in seconds, the base SI unit of time. * * @return the total amount of time in this time period measured in seconds. */
The total amount of time in this time period measured in seconds, the base SI unit of time
totalSeconds
{ "repo_name": "jrachiele/java-timeseries", "path": "timeseries/src/main/java/com/github/signaflo/timeseries/TimePeriod.java", "license": "mit", "size": 9718 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
676,573
public Graphics create() { AbstractGraphics2D copy = (AbstractGraphics2D) clone(); return copy; }
Graphics function() { AbstractGraphics2D copy = (AbstractGraphics2D) clone(); return copy; }
/** * Creates a copy of this graphics object. * * @return a copy of this graphics object */
Creates a copy of this graphics object
create
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java", "license": "gpl-2.0", "size": 64351 }
[ "java.awt.Graphics" ]
import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
15,781
public BeanDefinitionDefaults getBeanDefinitionDefaults() { BeanDefinitionDefaults bdd = new BeanDefinitionDefaults(); bdd.setLazyInit("TRUE".equalsIgnoreCase(this.defaults.getLazyInit())); bdd.setDependencyCheck(this.getDependencyCheck(DEFAULT_VALUE)); bdd.setAutowireMode(this.getAutowireMode(DEFAULT_VALUE)); bdd.setInitMethodName(this.defaults.getInitMethod()); bdd.setDestroyMethodName(this.defaults.getDestroyMethod()); return bdd; }
BeanDefinitionDefaults function() { BeanDefinitionDefaults bdd = new BeanDefinitionDefaults(); bdd.setLazyInit("TRUE".equalsIgnoreCase(this.defaults.getLazyInit())); bdd.setDependencyCheck(this.getDependencyCheck(DEFAULT_VALUE)); bdd.setAutowireMode(this.getAutowireMode(DEFAULT_VALUE)); bdd.setInitMethodName(this.defaults.getInitMethod()); bdd.setDestroyMethodName(this.defaults.getDestroyMethod()); return bdd; }
/** * Return the default settings for bean definitions as indicated within * the attributes of the top-level {@code <beans/>} element. */
Return the default settings for bean definitions as indicated within the attributes of the top-level element
getBeanDefinitionDefaults
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/spring/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java", "license": "gpl-2.0", "size": 54915 }
[ "org.springframework.beans.factory.support.BeanDefinitionDefaults" ]
import org.springframework.beans.factory.support.BeanDefinitionDefaults;
import org.springframework.beans.factory.support.*;
[ "org.springframework.beans" ]
org.springframework.beans;
1,778,387
@Override public ResourceLocator getResourceLocator() { return MCLEVPlugin.INSTANCE; }
ResourceLocator function() { return MCLEVPlugin.INSTANCE; }
/** * Return the resource locator for this item provider's resources. * @generated */
Return the resource locator for this item provider's resources
getResourceLocator
{ "repo_name": "parraman/micobs", "path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevcmp/provider/MInternalComponentPlatformSwitchCaseItemProvider.java", "license": "epl-1.0", "size": 9719 }
[ "es.uah.aut.srg.micobs.mclev.plugin.MCLEVPlugin", "org.eclipse.emf.common.util.ResourceLocator" ]
import es.uah.aut.srg.micobs.mclev.plugin.MCLEVPlugin; import org.eclipse.emf.common.util.ResourceLocator;
import es.uah.aut.srg.micobs.mclev.plugin.*; import org.eclipse.emf.common.util.*;
[ "es.uah.aut", "org.eclipse.emf" ]
es.uah.aut; org.eclipse.emf;
1,754,559
public Adapter createProbabilityAdapter() { return null; }
Adapter function() { return null; }
/** * Creates a new adapter for an object of class '{@link metamodel.Probability <em>Probability</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see metamodel.Probability * @generated */
Creates a new adapter for an object of class '<code>metamodel.Probability Probability</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
createProbabilityAdapter
{ "repo_name": "jesusc/bento", "path": "tests/bento.sirius.tests.metamodels/src/metamodel/util/MetamodelAdapterFactory.java", "license": "epl-1.0", "size": 13960 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,728,984
@Override public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE); }
String function() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.DEFAULT_STYLE); }
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * */
Generates a String representation of the contents of this type. This is an extension method, produced by the 'ts' xjc plugin
toString
{ "repo_name": "fpompermaier/onvif", "path": "onvif-ws-client/src/main/java/org/onvif/ver10/recording/wsdl/GetRecordingOptions.java", "license": "apache-2.0", "size": 2025 }
[ "org.apache.commons.lang3.builder.ToStringBuilder", "org.apache.cxf.xjc.runtime.JAXBToStringStyle" ]
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle;
import org.apache.commons.lang3.builder.*; import org.apache.cxf.xjc.runtime.*;
[ "org.apache.commons", "org.apache.cxf" ]
org.apache.commons; org.apache.cxf;
2,268,608
@Nonnull Iterator<? extends PrimaryEntity> filterByVisibility( @Nullable Iterator<? extends PrimaryEntity> entities, @Nullable Visibility requiredVisibility);
Iterator<? extends PrimaryEntity> filterByVisibility( @Nullable Iterator<? extends PrimaryEntity> entities, @Nullable Visibility requiredVisibility);
/** * Receives a collection of {@link PrimaryEntity} and returns an iterator that will filter only those with * {@code visibility >= requiredVisibility}. * * @param entities an iterator over a collection of entities * @param requiredVisibility minimum level of visibility required for entities * @return an iterator returning only the entities with {@code visibility >= requiredVisibility}; may be empty; * preserves the order of the input iterator; if the threshold visibility is {@code null}, the input is * returned unaltered */
Receives a collection of <code>PrimaryEntity</code> and returns an iterator that will filter only those with visibility >= requiredVisibility
filterByVisibility
{ "repo_name": "phenotips/phenotips", "path": "components/entity-access-rules/api/src/main/java/org/phenotips/data/permissions/internal/EntityVisibilityManager.java", "license": "agpl-3.0", "size": 5191 }
[ "java.util.Iterator", "javax.annotation.Nullable", "org.phenotips.data.permissions.Visibility", "org.phenotips.entities.PrimaryEntity" ]
import java.util.Iterator; import javax.annotation.Nullable; import org.phenotips.data.permissions.Visibility; import org.phenotips.entities.PrimaryEntity;
import java.util.*; import javax.annotation.*; import org.phenotips.data.permissions.*; import org.phenotips.entities.*;
[ "java.util", "javax.annotation", "org.phenotips.data", "org.phenotips.entities" ]
java.util; javax.annotation; org.phenotips.data; org.phenotips.entities;
1,763,551
@Test public void oneFalseThreeArguments() { assertFalse(oneFalse(false, false, false)); assertFalse(oneFalse(false, false, true)); assertFalse(oneFalse(false, true, false)); assertTrue(oneFalse(false, true, true)); assertFalse(oneFalse(true, false, false)); assertTrue(oneFalse(true, false, true)); assertTrue(oneFalse(true, true, false)); assertFalse(oneFalse(true, true, true)); } /** * Test invoking the protected {@link Object#clone()} via reflection. * <p> * On the surface, this seems to not be possible to invoke {@link Object#clone()} * outside the scope of the class being cloned, because {@link Class#getMethods()}
void function() { assertFalse(oneFalse(false, false, false)); assertFalse(oneFalse(false, false, true)); assertFalse(oneFalse(false, true, false)); assertTrue(oneFalse(false, true, true)); assertFalse(oneFalse(true, false, false)); assertTrue(oneFalse(true, false, true)); assertTrue(oneFalse(true, true, false)); assertFalse(oneFalse(true, true, true)); } /** * Test invoking the protected {@link Object#clone()} via reflection. * <p> * On the surface, this seems to not be possible to invoke {@link Object#clone()} * outside the scope of the class being cloned, because {@link Class#getMethods()}
/** * Test the adjoint generalized exclusive OR. */
Test the adjoint generalized exclusive OR
oneFalseThreeArguments
{ "repo_name": "openfurther/further-open-core", "path": "core/core-api/src/test/java/edu/utah/further/core/api/lang/UTestCoreUtil.java", "license": "apache-2.0", "size": 4850 }
[ "org.junit.Assert", "org.junit.Test" ]
import org.junit.Assert; import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
881,569
public boolean sendMoxMessage(byte[] messageBytes, long timeoutMillis) { if (messageBytes == null) throw new IllegalArgumentException("Bytes to send were null."); if (timeoutMillis < 0) { throw new IllegalArgumentException("Timeout can not be < 0, was " + timeoutMillis); } if (!rateLimiter.tryAcquire(timeoutMillis, TimeUnit.MILLISECONDS)) { logger.error( "Could not send message due to rate limitation. Current send rate: {} per second", rateLimiter.getRate()); logger.debug("Message that could not be sent: {}", messageBytes); return false; } return sendMoxMessageInternal(messageBytes); }
boolean function(byte[] messageBytes, long timeoutMillis) { if (messageBytes == null) throw new IllegalArgumentException(STR); if (timeoutMillis < 0) { throw new IllegalArgumentException(STR + timeoutMillis); } if (!rateLimiter.tryAcquire(timeoutMillis, TimeUnit.MILLISECONDS)) { logger.error( STR, rateLimiter.getRate()); logger.debug(STR, messageBytes); return false; } return sendMoxMessageInternal(messageBytes); }
/** * Like {sendMoxMessage(byte[])} this method send the bytes of a MoxMessage, * but with an own timout value. You can set {timeoutMillis} to 0 to get immediately * false, if instant sending is not possible. * @param messageBytes MoxMessage * @param timeoutMillis Timeout for send * @return True on successful send, false on timeout or sending problems. */
Like {sendMoxMessage(byte[])} this method send the bytes of a MoxMessage, but with an own timout value. You can set {timeoutMillis} to 0 to get immediately false, if instant sending is not possible
sendMoxMessage
{ "repo_name": "Neulinet/openhab2", "path": "addons/binding/org.openhab.binding.mox/src/main/java/org/openhab/binding/mox/handler/MoxGatewaySendHandler.java", "license": "epl-1.0", "size": 4173 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
236,431
public boolean isEventPast(String mDate) { try { SimpleDateFormat simpleDateFormat; Calendar calendar_current = Calendar.getInstance(); Calendar calendar_event = Calendar.getInstance(); if (mDate.contains("T")) { simpleDateFormat = new SimpleDateFormat( Constants.DATE_PATTERN_TIMEZONE); Date date = simpleDateFormat.parse(mDate); calendar_event.setTime(date); } else { simpleDateFormat = new SimpleDateFormat( Constants.SIMPLE_DATE_PATTERN); Date date = simpleDateFormat.parse(mDate); calendar_event.set(Calendar.DATE, date.getDate()); calendar_event.set(Calendar.MONTH, date.getMonth()); calendar_event.set(Calendar.YEAR, date.getYear() + 1900); if (calendar_current.get(Calendar.YEAR) == calendar_event .get(Calendar.YEAR)) if (calendar_current.get(Calendar.MONTH) == calendar_event .get(Calendar.MONTH)) if (calendar_current.get(Calendar.DATE) == calendar_event .get(Calendar.DATE)) return false; } if (calendar_event.before(calendar_current)) return true; } catch (ParseException e) { Log.d(Constants.LOG_TAG_EVENTS, "ParseException -->" + e); ExceptionHandler.makeExceptionAlert(BTEEventDetails.this, new org.apache.http.ParseException(e.getMessage())); } return false; }
boolean function(String mDate) { try { SimpleDateFormat simpleDateFormat; Calendar calendar_current = Calendar.getInstance(); Calendar calendar_event = Calendar.getInstance(); if (mDate.contains("T")) { simpleDateFormat = new SimpleDateFormat( Constants.DATE_PATTERN_TIMEZONE); Date date = simpleDateFormat.parse(mDate); calendar_event.setTime(date); } else { simpleDateFormat = new SimpleDateFormat( Constants.SIMPLE_DATE_PATTERN); Date date = simpleDateFormat.parse(mDate); calendar_event.set(Calendar.DATE, date.getDate()); calendar_event.set(Calendar.MONTH, date.getMonth()); calendar_event.set(Calendar.YEAR, date.getYear() + 1900); if (calendar_current.get(Calendar.YEAR) == calendar_event .get(Calendar.YEAR)) if (calendar_current.get(Calendar.MONTH) == calendar_event .get(Calendar.MONTH)) if (calendar_current.get(Calendar.DATE) == calendar_event .get(Calendar.DATE)) return false; } if (calendar_event.before(calendar_current)) return true; } catch (ParseException e) { Log.d(Constants.LOG_TAG_EVENTS, STR + e); ExceptionHandler.makeExceptionAlert(BTEEventDetails.this, new org.apache.http.ParseException(e.getMessage())); } return false; }
/** * This method checks if Event has passed. * * @param mDate * @return */
This method checks if Event has passed
isEventPast
{ "repo_name": "gscreativelab/BTE_Android", "path": "app/src/main/java/com/cts/jnjbridgetoemploymentpoc/ui/activity/BTEEventDetails.java", "license": "mit", "size": 19630 }
[ "android.util.Log", "com.cts.jnjbridgetoemploymentpoc.exception.ExceptionHandler", "com.cts.jnjbridgetoemploymentpoc.utils.Constants", "java.text.ParseException", "java.text.SimpleDateFormat", "java.util.Calendar", "java.util.Date" ]
import android.util.Log; import com.cts.jnjbridgetoemploymentpoc.exception.ExceptionHandler; import com.cts.jnjbridgetoemploymentpoc.utils.Constants; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date;
import android.util.*; import com.cts.jnjbridgetoemploymentpoc.exception.*; import com.cts.jnjbridgetoemploymentpoc.utils.*; import java.text.*; import java.util.*;
[ "android.util", "com.cts.jnjbridgetoemploymentpoc", "java.text", "java.util" ]
android.util; com.cts.jnjbridgetoemploymentpoc; java.text; java.util;
111,904
public TProtocol getOutputProtocol() { return this.oprot_; }
TProtocol function() { return this.oprot_; }
/** * Get the TProtocol being used as the output (write) protocol. * @return the TProtocol being used as the output (write) protocol. */
Get the TProtocol being used as the output (write) protocol
getOutputProtocol
{ "repo_name": "Jimdo/thrift", "path": "lib/java/src/org/apache/thrift/TServiceClient.java", "license": "apache-2.0", "size": 2899 }
[ "org.apache.thrift.protocol.TProtocol" ]
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.*;
[ "org.apache.thrift" ]
org.apache.thrift;
1,933,980
private void initGui(boolean isObjectBased) { // Initialise skins factory. skinsFactory = SkinsFactory.getInstance(applicationProperties); // Set Skinned Look and Feel. LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel"); try { UIManager.setLookAndFeel(lookAndFeel); } catch (UnsupportedLookAndFeelException e) { log.error("Unable to set skinned LookAndFeel", e); } this.setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel commonPropertiesContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesCommonPanel"); commonPropertiesContainer.setLayout(new GridBagLayout()); JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesMetadataPanel"); metadataContainer.setLayout(new GridBagLayout()); JPanel grantsContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesGrantsPanel"); grantsContainer.setLayout(new GridBagLayout()); if (!isObjectBased) { // Display bucket details. JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel"); bucketNameLabel.setText("Bucket name:"); bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField"); bucketNameTextField.setEditable(false); JLabel bucketLocationLabel = skinsFactory.createSkinnedJHtmlLabel("BucketLocationLabel"); bucketLocationLabel.setText("Location:"); bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField"); bucketLocationTextField.setEditable(false); JLabel bucketCreationDateLabel = skinsFactory.createSkinnedJHtmlLabel("BucketCreationDateLabel"); bucketCreationDateLabel.setText("Creation date:"); bucketCreationDateTextField = skinsFactory.createSkinnedJTextField("BucketCreationDateTextField"); bucketCreationDateTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel"); ownerNameLabel.setText("Owner name:"); ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField"); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel"); ownerIdLabel.setText("Owner ID:"); ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField"); ownerIdTextField.setEditable(false); int row = 0; commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); } else { // Display object details. JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel"); objectKeyLabel.setText("Object key:"); objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField"); objectKeyTextField.setEditable(false); JLabel objectContentTypeLabel = skinsFactory.createSkinnedJHtmlLabel("ContentTypeLabel"); objectContentTypeLabel.setText("Content type:"); objectContentTypeTextField = skinsFactory.createSkinnedJTextField("ContentTypeTextField"); objectContentTypeTextField.setEditable(false); JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel"); objectContentLengthLabel.setText("Size:"); objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField"); objectContentLengthTextField.setEditable(false); JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel"); objectLastModifiedLabel.setText("Last modified:"); objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField"); objectLastModifiedTextField.setEditable(false); JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel"); objectETagLabel.setText("ETag:"); objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField"); objectETagTextField.setEditable(false); JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel"); bucketNameLabel.setText("Bucket name:"); bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField"); bucketNameTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel"); ownerNameLabel.setText("Owner name:"); ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField"); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel"); ownerIdLabel.setText("Owner ID:"); ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField"); ownerIdTextField.setEditable(false); commonPropertiesContainer.add(objectKeyLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectKeyTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthTextField, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedTextField, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagTextField, new GridBagConstraints(1, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, 5, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, 7, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, 7, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, 8, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, 8, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Build metadata table. objectMetadataTableModel = new DefaultTableModel(new Object[] {"Name", "Value" }, 0) { private static final long serialVersionUID = -3762866886166776851L;
void function(boolean isObjectBased) { skinsFactory = SkinsFactory.getInstance(applicationProperties); LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme(STR); try { UIManager.setLookAndFeel(lookAndFeel); } catch (UnsupportedLookAndFeelException e) { log.error(STR, e); } this.setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel commonPropertiesContainer = skinsFactory.createSkinnedJPanel(STR); commonPropertiesContainer.setLayout(new GridBagLayout()); JPanel metadataContainer = skinsFactory.createSkinnedJPanel(STR); metadataContainer.setLayout(new GridBagLayout()); JPanel grantsContainer = skinsFactory.createSkinnedJPanel(STR); grantsContainer.setLayout(new GridBagLayout()); if (!isObjectBased) { JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel(STR); bucketNameLabel.setText(STR); bucketNameTextField = skinsFactory.createSkinnedJTextField(STR); bucketNameTextField.setEditable(false); JLabel bucketLocationLabel = skinsFactory.createSkinnedJHtmlLabel(STR); bucketLocationLabel.setText(STR); bucketLocationTextField = skinsFactory.createSkinnedJTextField(STR); bucketLocationTextField.setEditable(false); JLabel bucketCreationDateLabel = skinsFactory.createSkinnedJHtmlLabel(STR); bucketCreationDateLabel.setText(STR); bucketCreationDateTextField = skinsFactory.createSkinnedJTextField(STR); bucketCreationDateTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel(STR); ownerNameLabel.setText(STR); ownerNameTextField = skinsFactory.createSkinnedJTextField(STR); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel(STR); ownerIdLabel.setText(STR); ownerIdTextField = skinsFactory.createSkinnedJTextField(STR); ownerIdTextField.setEditable(false); int row = 0; commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketCreationDateTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); } else { JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel(STR); objectKeyLabel.setText(STR); objectKeyTextField = skinsFactory.createSkinnedJTextField(STR); objectKeyTextField.setEditable(false); JLabel objectContentTypeLabel = skinsFactory.createSkinnedJHtmlLabel(STR); objectContentTypeLabel.setText(STR); objectContentTypeTextField = skinsFactory.createSkinnedJTextField(STR); objectContentTypeTextField.setEditable(false); JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel(STR); objectContentLengthLabel.setText("Size:"); objectContentLengthTextField = skinsFactory.createSkinnedJTextField(STR); objectContentLengthTextField.setEditable(false); JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel(STR); objectLastModifiedLabel.setText(STR); objectLastModifiedTextField = skinsFactory.createSkinnedJTextField(STR); objectLastModifiedTextField.setEditable(false); JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel(STR); objectETagLabel.setText("ETag:"); objectETagTextField = skinsFactory.createSkinnedJTextField(STR); objectETagTextField.setEditable(false); JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel(STR); bucketNameLabel.setText(STR); bucketNameTextField = skinsFactory.createSkinnedJTextField(STR); bucketNameTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel(STR); ownerNameLabel.setText(STR); ownerNameTextField = skinsFactory.createSkinnedJTextField(STR); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel(STR); ownerIdLabel.setText(STR); ownerIdTextField = skinsFactory.createSkinnedJTextField(STR); ownerIdTextField.setEditable(false); commonPropertiesContainer.add(objectKeyLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectKeyTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentTypeTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectContentLengthTextField, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectLastModifiedTextField, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(objectETagTextField, new GridBagConstraints(1, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, 5, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, 5, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, 7, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, 7, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, 8, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, 8, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); objectMetadataTableModel = new DefaultTableModel(new Object[] {"Name", "Value" }, 0) { private static final long serialVersionUID = -3762866886166776851L;
/** * Initialise the GUI elements to display the given item. * * @param s3Item * the S3Bucket or an S3Object whose details will be displayed */
Initialise the GUI elements to display the given item
initGui
{ "repo_name": "ind9/jets3t", "path": "src/org/jets3t/gui/ItemPropertiesDialog.java", "license": "apache-2.0", "size": 28319 }
[ "java.awt.GridBagConstraints", "java.awt.GridBagLayout", "javax.swing.JDialog", "javax.swing.JLabel", "javax.swing.JPanel", "javax.swing.LookAndFeel", "javax.swing.UIManager", "javax.swing.UnsupportedLookAndFeelException", "javax.swing.table.DefaultTableModel", "org.jets3t.gui.skins.SkinsFactory" ]
import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.LookAndFeel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; import org.jets3t.gui.skins.SkinsFactory;
import java.awt.*; import javax.swing.*; import javax.swing.table.*; import org.jets3t.gui.skins.*;
[ "java.awt", "javax.swing", "org.jets3t.gui" ]
java.awt; javax.swing; org.jets3t.gui;
2,611,094
@Override public final synchronized Stream<AbstractFeature> features(final boolean parallel) throws DataStoreException { if (dissociate) { return StreamSupport.stream(new FeatureIterator(this), parallel); } if (movingFeatures == null) try { final MovingFeatureIterator iter = new MovingFeatureIterator(this); iter.readMoving(null, true); movingFeatures = UnmodifiableArrayList.wrap(iter.createMovingFeatures()); } catch (IOException | IllegalArgumentException | DateTimeException e) { throw new DataStoreException(canNotParseFile(), e); } return movingFeatures.stream(); }
final synchronized Stream<AbstractFeature> function(final boolean parallel) throws DataStoreException { if (dissociate) { return StreamSupport.stream(new FeatureIterator(this), parallel); } if (movingFeatures == null) try { final MovingFeatureIterator iter = new MovingFeatureIterator(this); iter.readMoving(null, true); movingFeatures = UnmodifiableArrayList.wrap(iter.createMovingFeatures()); } catch (IOException IllegalArgumentException DateTimeException e) { throw new DataStoreException(canNotParseFile(), e); } return movingFeatures.stream(); }
/** * Returns the stream of features. * * @param parallel {@code true} for a parallel stream, or {@code false} for a sequential stream. * @return a stream over all features in the CSV file. * @throws DataStoreException if an error occurred while creating the feature stream. * * @todo Need to reset the position when doing another pass on the features. See {@link #rewind()}. * @todo If sequential order, publish Feature as soon as identifier changed. */
Returns the stream of features
features
{ "repo_name": "apache/sis", "path": "storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java", "license": "apache-2.0", "size": 38921 }
[ "java.io.IOException", "java.time.DateTimeException", "java.util.stream.Stream", "java.util.stream.StreamSupport", "org.apache.sis.feature.AbstractFeature", "org.apache.sis.internal.util.UnmodifiableArrayList", "org.apache.sis.storage.DataStoreException" ]
import java.io.IOException; import java.time.DateTimeException; import java.util.stream.Stream; import java.util.stream.StreamSupport; import org.apache.sis.feature.AbstractFeature; import org.apache.sis.internal.util.UnmodifiableArrayList; import org.apache.sis.storage.DataStoreException;
import java.io.*; import java.time.*; import java.util.stream.*; import org.apache.sis.feature.*; import org.apache.sis.internal.util.*; import org.apache.sis.storage.*;
[ "java.io", "java.time", "java.util", "org.apache.sis" ]
java.io; java.time; java.util; org.apache.sis;
1,413,091
void onNotchFilterChanged(@Nullable NotchFilter filter);
void onNotchFilterChanged(@Nullable NotchFilter filter);
/** * Listener that is invoked when notch filter is set/unset. * * @param filter Set filter. */
Listener that is invoked when notch filter is set/unset
onNotchFilterChanged
{ "repo_name": "BackyardBrains/Backyard-Brains-Android-App", "path": "app/src/main/java/com/backyardbrains/view/SettingsView.java", "license": "gpl-3.0", "size": 7227 }
[ "androidx.annotation.Nullable", "com.backyardbrains.filters.NotchFilter" ]
import androidx.annotation.Nullable; import com.backyardbrains.filters.NotchFilter;
import androidx.annotation.*; import com.backyardbrains.filters.*;
[ "androidx.annotation", "com.backyardbrains.filters" ]
androidx.annotation; com.backyardbrains.filters;
1,169,805