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 list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static File generateGraphImage(File temp) {
try {
String command = GRAPHVIZ_BIN + File.separator + "dot" + " -Tpng -o " + temp.getAbsolutePath().concat(".png") + " " + temp.getAbsolutePath();
System.out.println("Executing " + command + " ...");
Runtime.getRuntime().exec(command).waitFor();
System.out.println("OK!");
} catch (IOException e) {
System.err.println("Error generating graph " + temp + ".png");
} catch (InterruptedException e) {
}
return new File(temp.getAbsolutePath().concat(".png"));
}
} | static File function(File temp) { try { String command = GRAPHVIZ_BIN + File.separator + "dot" + STR + temp.getAbsolutePath().concat(".png") + " " + temp.getAbsolutePath(); System.out.println(STR + command + STR); Runtime.getRuntime().exec(command).waitFor(); System.out.println("OK!"); } catch (IOException e) { System.err.println(STR + temp + ".png"); } catch (InterruptedException e) { } return new File(temp.getAbsolutePath().concat(".png")); } } | /**
* Generate a graph in the PNG format using the DOT source code in the given
* file.
*
* @param temp The file containing the DOT source code
*/ | Generate a graph in the PNG format using the DOT source code in the given file | generateGraphImage | {
"repo_name": "keskival/2",
"path": "relex/src/java/relex/output/LinkGraphGenerator.java",
"license": "gpl-3.0",
"size": 3674
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 884,500 |
static ErasureCodingPolicyInfo[] getErasureCodingPolicies(
final FSNamesystem fsn) throws IOException {
assert fsn.hasReadLock();
return fsn.getErasureCodingPolicyManager().getPolicies();
} | static ErasureCodingPolicyInfo[] getErasureCodingPolicies( final FSNamesystem fsn) throws IOException { assert fsn.hasReadLock(); return fsn.getErasureCodingPolicyManager().getPolicies(); } | /**
* Get available erasure coding polices.
*
* @param fsn namespace
* @return {@link ErasureCodingPolicyInfo} array
*/ | Get available erasure coding polices | getErasureCodingPolicies | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java",
"license": "apache-2.0",
"size": 17541
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyInfo"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyInfo; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,331,275 |
public void exit () {
try {
if (! debug) {
// Delete all of the files in the temporary directory.
for (Path file: Files.newDirectoryStream (tempDirectory)) {
Files.delete (file);
}
// Delete the temporary directory.
Files.delete (tempDirectory);
}
}
catch (IOException e) {
System.err.println (
"Error deleting the temporary directory: " + e
);
}
} | void function () { try { if (! debug) { for (Path file: Files.newDirectoryStream (tempDirectory)) { Files.delete (file); } Files.delete (tempDirectory); } } catch (IOException e) { System.err.println ( STR + e ); } } | /**
* Delete the temporary directory and its contents.
*/ | Delete the temporary directory and its contents | exit | {
"repo_name": "sandain/es1",
"path": "src/java/MasterVariables.java",
"license": "gpl-3.0",
"size": 9197
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; | import java.io.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 208,625 |
public static List<SystemOverview> listVirtualHosts(User user) {
SelectMode m = ModeFactory.getMode("System_queries",
"virtual_hosts_for_user");
Map<String, Object> params = new HashMap<String, Object>();
params.put("user_id", user.getId());
DataResult<SystemOverview> toReturn = m.execute(params);
toReturn.elaborate();
return toReturn;
} | static List<SystemOverview> function(User user) { SelectMode m = ModeFactory.getMode(STR, STR); Map<String, Object> params = new HashMap<String, Object>(); params.put(STR, user.getId()); DataResult<SystemOverview> toReturn = m.execute(params); toReturn.elaborate(); return toReturn; } | /**
* List all virtual hosts for a user
* @param user the user in question
* @return list of SystemOverview objects
*/ | List all virtual hosts for a user | listVirtualHosts | {
"repo_name": "mcalmer/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java",
"license": "gpl-2.0",
"size": 134651
} | [
"com.redhat.rhn.common.db.datasource.DataResult",
"com.redhat.rhn.common.db.datasource.ModeFactory",
"com.redhat.rhn.common.db.datasource.SelectMode",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.dto.SystemOverview",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.SystemOverview; import java.util.HashMap; import java.util.List; import java.util.Map; | import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.dto.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 1,043,674 |
@Test
public void testGetAllForRoleAndAdElementAndObject() {
permissions result = dao.getForRoleAndAdElementAndObject(ROLE_ID,
AD_ELEMENT_ID, VM_ENTITY_ID);
assertNotNull(result);
assertEquals(ROLE_ID, result.getrole_id());
assertEquals(AD_ELEMENT_ID, result.getad_element_id());
assertEquals(VM_ENTITY_ID, result.getObjectId());
} | void function() { permissions result = dao.getForRoleAndAdElementAndObject(ROLE_ID, AD_ELEMENT_ID, VM_ENTITY_ID); assertNotNull(result); assertEquals(ROLE_ID, result.getrole_id()); assertEquals(AD_ELEMENT_ID, result.getad_element_id()); assertEquals(VM_ENTITY_ID, result.getObjectId()); } | /**
* Ensures that a null object is returned when the role is invalid.
*/ | Ensures that a null object is returned when the role is invalid | testGetAllForRoleAndAdElementAndObject | {
"repo_name": "derekhiggins/ovirt-engine",
"path": "backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/PermissionDAOTest.java",
"license": "apache-2.0",
"size": 18921
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,014,038 |
@Override public void exitCompDescriptorEqual(@NotNull QueryGrammarParser.CompDescriptorEqualContext ctx) { } | @Override public void exitCompDescriptorEqual(@NotNull QueryGrammarParser.CompDescriptorEqualContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterCompDescriptorEqual | {
"repo_name": "pmeisen/dis-timeintervaldataanalyzer",
"path": "src/net/meisen/dissertation/impl/parser/query/generated/QueryGrammarBaseListener.java",
"license": "bsd-3-clause",
"size": 33327
} | [
"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; | 1,760,852 |
public Signature getSignature() {
return sig1;
} | Signature function() { return sig1; } | /**
* Return the signature of the proxied method.
*/ | Return the signature of the proxied method | getSignature | {
"repo_name": "gstamac/powermock",
"path": "powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/repackaged/cglib/proxy/MethodProxy.java",
"license": "apache-2.0",
"size": 7860
} | [
"org.powermock.api.mockito.repackaged.cglib.core.Signature"
] | import org.powermock.api.mockito.repackaged.cglib.core.Signature; | import org.powermock.api.mockito.repackaged.cglib.core.*; | [
"org.powermock.api"
] | org.powermock.api; | 1,924,966 |
private final String deleteToolTip(ITranslationKind kind, Locale locale) {
String oldText = null;
String language = locale.toString();
List<Translation> toolTips = widget.getToolTips();
for (Translation toolTip : toolTips) {
if (language.equals(toolTip.getLanguage())) {
oldText = toolTip.getMessage();
toolTips.remove(toolTip);
updateTranslationId();
fireChangeTranslation(kind, locale, toolTip.getMessage(), null);
break;
}
}
return oldText;
} | final String function(ITranslationKind kind, Locale locale) { String oldText = null; String language = locale.toString(); List<Translation> toolTips = widget.getToolTips(); for (Translation toolTip : toolTips) { if (language.equals(toolTip.getLanguage())) { oldText = toolTip.getMessage(); toolTips.remove(toolTip); updateTranslationId(); fireChangeTranslation(kind, locale, toolTip.getMessage(), null); break; } } return oldText; } | /**
* Delete the designated translation and notify listeners
*
* @param kind
* the translation kind
* @param locale
* the locake
* @return the text of the deleted toolTip
*/ | Delete the designated translation and notify listeners | deleteToolTip | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/page/core/com.odcgroup.page.model/src/main/java/com/odcgroup/page/model/translation/DomainWidgetTranslation.java",
"license": "epl-1.0",
"size": 13198
} | [
"com.odcgroup.page.model.Translation",
"com.odcgroup.translation.core.ITranslationKind",
"java.util.List",
"java.util.Locale"
] | import com.odcgroup.page.model.Translation; import com.odcgroup.translation.core.ITranslationKind; import java.util.List; import java.util.Locale; | import com.odcgroup.page.model.*; import com.odcgroup.translation.core.*; import java.util.*; | [
"com.odcgroup.page",
"com.odcgroup.translation",
"java.util"
] | com.odcgroup.page; com.odcgroup.translation; java.util; | 71,737 |
private synchronized void registerDataChangeListener() {
Preconditions.checkState(this.listenerRegistration == null,
"Topology Listener on topology %s has been registered before.",
this.getInstanceIdentifier());
final InstanceIdentifier<Tables> tablesId = this.locRibReference.getInstanceIdentifier()
.child(LocRib.class).child(Tables.class, new TablesKey(this.afi, this.safi));
final DataTreeIdentifier<T> id = DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
getRouteWildcard(tablesId));
this.listenerRegistration = this.dataProvider.registerDataTreeChangeListener(id, this);
LOG.debug("Registered listener {} on topology {}. Timestamp={}", this, this.getInstanceIdentifier(),
this.listenerScheduledRestartTime);
} | synchronized void function() { Preconditions.checkState(this.listenerRegistration == null, STR, this.getInstanceIdentifier()); final InstanceIdentifier<Tables> tablesId = this.locRibReference.getInstanceIdentifier() .child(LocRib.class).child(Tables.class, new TablesKey(this.afi, this.safi)); final DataTreeIdentifier<T> id = DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, getRouteWildcard(tablesId)); this.listenerRegistration = this.dataProvider.registerDataTreeChangeListener(id, this); LOG.debug(STR, this, this.getInstanceIdentifier(), this.listenerScheduledRestartTime); } | /**
* Register to data tree change listener.
*/ | Register to data tree change listener | registerDataChangeListener | {
"repo_name": "opendaylight/bgpcep",
"path": "bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractTopologyBuilder.java",
"license": "epl-1.0",
"size": 21896
} | [
"com.google.common.base.Preconditions",
"org.opendaylight.mdsal.binding.api.DataTreeIdentifier",
"org.opendaylight.mdsal.common.api.LogicalDatastoreType",
"org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib",
"org.opendaylight.yang.gen.v1.urn.opendaylight.p... | import com.google.common.base.Preconditions; import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.LocRib; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; | import com.google.common.base.*; import org.opendaylight.mdsal.binding.api.*; import org.opendaylight.mdsal.common.api.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.rib.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.*; import org.opendaylight.yangtools.yang.binding.*; | [
"com.google.common",
"org.opendaylight.mdsal",
"org.opendaylight.yang",
"org.opendaylight.yangtools"
] | com.google.common; org.opendaylight.mdsal; org.opendaylight.yang; org.opendaylight.yangtools; | 768,253 |
public boolean unlock (String trxName)
{
// log.warning(trxName);
int index = get_ProcessingIndex();
if (index != -1)
{
m_newValues[index] = Boolean.FALSE; // direct
String sql = "UPDATE " + p_info.getTableName()
+ " SET Processing='N' WHERE " + get_WhereClause(true);
boolean success = false;
if (isUseTimeoutForUpdate())
success = DB.executeUpdateEx(sql, trxName, QUERY_TIME_OUT) == 1;
else
success = DB.executeUpdate(sql, trxName) == 1;
if (success)
log.fine("success" + (trxName == null ? "" : "[" + trxName + "]"));
else
log.log(Level.WARNING, "failed" + (trxName == null ? "" : " [" + trxName + "]"));
return success;
}
return true;
} // unlock
private String m_trxName = null; | boolean function (String trxName) { int index = get_ProcessingIndex(); if (index != -1) { m_newValues[index] = Boolean.FALSE; String sql = STR + p_info.getTableName() + STR + get_WhereClause(true); boolean success = false; if (isUseTimeoutForUpdate()) success = DB.executeUpdateEx(sql, trxName, QUERY_TIME_OUT) == 1; else success = DB.executeUpdate(sql, trxName) == 1; if (success) log.fine(STR + (trxName == null ? STR[STR]STRfailed" + (trxName == null ? STR [STR]")); return success; } return true; } private String m_trxName = null; | /**
* UnLock it
* @param trxName transaction
* @return true if unlocked (false only if unlock fails)
*/ | UnLock it | unlock | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/PO.java",
"license": "gpl-2.0",
"size": 109913
} | [
"org.compiere.util.DB"
] | import org.compiere.util.DB; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,298,743 |
public void focusGained(FocusEvent e) {
} | void function(FocusEvent e) { } | /**
* Implementation of FocusListener
*/ | Implementation of FocusListener | focusGained | {
"repo_name": "Jacksson/mywms",
"path": "rich.client/los.clientsuite/LOS Common/src/de/linogistix/common/gui/component/controls/LOSDateFormattedTextField.java",
"license": "gpl-2.0",
"size": 8867
} | [
"java.awt.event.FocusEvent"
] | import java.awt.event.FocusEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,607,160 |
public VaultInner withProperties(VaultProperties properties) {
this.properties = properties;
return this;
} | VaultInner function(VaultProperties properties) { this.properties = properties; return this; } | /**
* Set the properties property: Properties of the vault.
*
* @param properties the properties value to set.
* @return the VaultInner object itself.
*/ | Set the properties property: Properties of the vault | withProperties | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/src/main/java/com/azure/resourcemanager/keyvault/fluent/models/VaultInner.java",
"license": "mit",
"size": 2160
} | [
"com.azure.resourcemanager.keyvault.models.VaultProperties"
] | import com.azure.resourcemanager.keyvault.models.VaultProperties; | import com.azure.resourcemanager.keyvault.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,863,174 |
public ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> get(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException, IllegalArgumentException {
if (thumbprintAlgorithm == null) {
throw new IllegalArgumentException("Parameter thumbprintAlgorithm is required and cannot be null.");
}
if (thumbprint == null) {
throw new IllegalArgumentException("Parameter thumbprint is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final CertificateGetOptions certificateGetOptions = null;
String select = null;
Integer timeout = null;
String clientRequestId = null;
Boolean returnClientRequestId = null;
DateTime ocpDate = null;
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
Call<ResponseBody> call = service.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent());
return getDelegate(call.execute());
} | ServiceResponseWithHeaders<Certificate, CertificateGetHeaders> function(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException, IllegalArgumentException { if (thumbprintAlgorithm == null) { throw new IllegalArgumentException(STR); } if (thumbprint == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } final CertificateGetOptions certificateGetOptions = null; String select = null; Integer timeout = null; String clientRequestId = null; Boolean returnClientRequestId = null; DateTime ocpDate = null; DateTimeRfc1123 ocpDateConverted = null; if (ocpDate != null) { ocpDateConverted = new DateTimeRfc1123(ocpDate); } Call<ResponseBody> call = service.get(thumbprintAlgorithm, thumbprint, this.client.apiVersion(), this.client.acceptLanguage(), select, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, this.client.userAgent()); return getDelegate(call.execute()); } | /**
* Gets information about the specified certificate.
*
* @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
* @param thumbprint The thumbprint of the certificate to get.
* @throws BatchErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the Certificate object wrapped in {@link ServiceResponseWithHeaders} if successful.
*/ | Gets information about the specified certificate | get | {
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-batch/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java",
"license": "mit",
"size": 72133
} | [
"com.microsoft.azure.batch.protocol.models.BatchErrorException",
"com.microsoft.azure.batch.protocol.models.Certificate",
"com.microsoft.azure.batch.protocol.models.CertificateGetHeaders",
"com.microsoft.azure.batch.protocol.models.CertificateGetOptions",
"com.microsoft.rest.DateTimeRfc1123",
"com.microso... | import com.microsoft.azure.batch.protocol.models.BatchErrorException; import com.microsoft.azure.batch.protocol.models.Certificate; import com.microsoft.azure.batch.protocol.models.CertificateGetHeaders; import com.microsoft.azure.batch.protocol.models.CertificateGetOptions; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException; import org.joda.time.DateTime; | import com.microsoft.azure.batch.protocol.models.*; import com.microsoft.rest.*; import java.io.*; import org.joda.time.*; | [
"com.microsoft.azure",
"com.microsoft.rest",
"java.io",
"org.joda.time"
] | com.microsoft.azure; com.microsoft.rest; java.io; org.joda.time; | 1,138,300 |
public void setCheckingPaths(TreePath[] paths);
| void function(TreePath[] paths); | /**
* Set the checking to paths.
*/ | Set the checking to paths | setCheckingPaths | {
"repo_name": "virtualcitySYSTEMS/importer-exporter",
"path": "src/org/citydb/gui/components/checkboxtree/TreeCheckingModel.java",
"license": "lgpl-3.0",
"size": 7391
} | [
"javax.swing.tree.TreePath"
] | import javax.swing.tree.TreePath; | import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 691,661 |
@Transactional(readOnly = true)
public void validateWorkReportTypeName(String name)
throws IllegalArgumentException {
if ((name == null) || (name.isEmpty())) {
throw new IllegalArgumentException(
_("name cannot be empty"));
}
getWorkReportType().setName(name);
if (!getWorkReportType().isUniqueWorkReportTypeNameConstraint()) {
throw new IllegalArgumentException(
_("There is another timesheet template with the same name"));
}
} | @Transactional(readOnly = true) void function(String name) throws IllegalArgumentException { if ((name == null) (name.isEmpty())) { throw new IllegalArgumentException( _(STR)); } getWorkReportType().setName(name); if (!getWorkReportType().isUniqueWorkReportTypeNameConstraint()) { throw new IllegalArgumentException( _(STR)); } } | /**
* Operations that realize the data validations.
*/ | Operations that realize the data validations | validateWorkReportTypeName | {
"repo_name": "PaulLuchyn/libreplan",
"path": "libreplan-webapp/src/main/java/org/libreplan/web/workreports/WorkReportTypeModel.java",
"license": "agpl-3.0",
"size": 20676
} | [
"org.springframework.transaction.annotation.Transactional"
] | import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.*; | [
"org.springframework.transaction"
] | org.springframework.transaction; | 2,011,452 |
@Override
protected List<ExtensionComponent<D>> load() {
if (jenkins == null) {
// Should never happen on the real instance
LOGGER.log(Level.WARNING, "Cannot load extension components, because Jenkins instance has not been assigned yet");
return Collections.emptyList();
}
return _load(getDescriptorExtensionList().getComponents());
} | List<ExtensionComponent<D>> function() { if (jenkins == null) { LOGGER.log(Level.WARNING, STR); return Collections.emptyList(); } return _load(getDescriptorExtensionList().getComponents()); } | /**
* Loading the descriptors in this case means filtering the descriptor from the master {@link ExtensionList}.
*/ | Loading the descriptors in this case means filtering the descriptor from the master <code>ExtensionList</code> | load | {
"repo_name": "stephenc/jenkins",
"path": "core/src/main/java/hudson/DescriptorExtensionList.java",
"license": "mit",
"size": 9727
} | [
"java.util.Collections",
"java.util.List",
"java.util.logging.Level"
] | import java.util.Collections; import java.util.List; import java.util.logging.Level; | import java.util.*; import java.util.logging.*; | [
"java.util"
] | java.util; | 481,975 |
static int lastInsertCheck(String stmt, int offset) {
offset = indexAfterLastInsertIdFunc(stmt, offset);
if (offset < 0) {
return OTHER;
}
offset = skipAs(stmt, offset);
offset = skipAlias(stmt, offset);
if (offset < 0) {
return OTHER;
}
offset = ParseUtil.move(stmt, offset, 0);
if (offset < stmt.length()) {
return OTHER;
}
return LAST_INSERT_ID;
} | static int lastInsertCheck(String stmt, int offset) { offset = indexAfterLastInsertIdFunc(stmt, offset); if (offset < 0) { return OTHER; } offset = skipAs(stmt, offset); offset = skipAlias(stmt, offset); if (offset < 0) { return OTHER; } offset = ParseUtil.move(stmt, offset, 0); if (offset < stmt.length()) { return OTHER; } return LAST_INSERT_ID; } | /**
* SELECT LAST_INSERT_ID()
*/ | SELECT LAST_INSERT_ID() | lastInsertCheck | {
"repo_name": "fengyapeng/Mycat-Server",
"path": "src/main/java/io/mycat/server/parser/ServerParseSelect.java",
"license": "apache-2.0",
"size": 12815
} | [
"io.mycat.util.ParseUtil"
] | import io.mycat.util.ParseUtil; | import io.mycat.util.*; | [
"io.mycat.util"
] | io.mycat.util; | 229,239 |
public void putBytes(int pos, byte... bs) {
adaptSize(pos + bs.length);
ByteBuffer bb = null;
int i = _bufferSize;
for (byte b : bs) {
if (i == _bufferSize) {
bb = getBuffer(pos);
i = pos % _bufferSize;
}
bb.put(i, b);
++i;
++pos;
}
}
| void function(int pos, byte... bs) { adaptSize(pos + bs.length); ByteBuffer bb = null; int i = _bufferSize; for (byte b : bs) { if (i == _bufferSize) { bb = getBuffer(pos); i = pos % _bufferSize; } bb.put(i, b); ++i; ++pos; } } | /**
* Puts several bytes into the buffer at the given position.
* Does not increase the write position.
* @param pos the position where to put the bytes
* @param bs an array of bytes to put
*/ | Puts several bytes into the buffer at the given position. Does not increase the write position | putBytes | {
"repo_name": "adrianchia/bson4jackson",
"path": "src/main/java/de/undercouch/bson4jackson/io/DynamicOutputBuffer.java",
"license": "apache-2.0",
"size": 18641
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,273,986 |
public String addConnectionRequirement(NodeTemplate target, String type) {
Map<String, String> requirement = new LinkedHashMap();
String requirementName = "endpoint";
requirement.put(requirementName, target.getName());
requirement.put("type", type);
requirements().add(requirement);
return requirementName;
}
| String function(NodeTemplate target, String type) { Map<String, String> requirement = new LinkedHashMap(); String requirementName = STR; requirement.put(requirementName, target.getName()); requirement.put("type", type); requirements().add(requirement); return requirementName; } | /**
* Add an endpoint requirement to a NodeTemplate
* @return name given to the requirement
*/ | Add an endpoint requirement to a NodeTemplate | addConnectionRequirement | {
"repo_name": "rosogon/SeaCloudsPlatform",
"path": "planner/aamwriter/src/main/java/eu/seaclouds/platform/planner/aamwriter/modelaam/NodeTemplate.java",
"license": "apache-2.0",
"size": 4623
} | [
"java.util.LinkedHashMap",
"java.util.Map"
] | import java.util.LinkedHashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,692,665 |
@Override
public Adapter createMatrixChannelAdapter()
{
if (matrixChannelItemProvider == null) {
matrixChannelItemProvider = new MatrixChannelItemProvider(this);
}
return matrixChannelItemProvider;
}
protected FileChannelItemProvider fileChannelItemProvider; | Adapter function() { if (matrixChannelItemProvider == null) { matrixChannelItemProvider = new MatrixChannelItemProvider(this); } return matrixChannelItemProvider; } protected FileChannelItemProvider fileChannelItemProvider; | /**
* This creates an adapter for a {@link org.roboid.robot.MatrixChannel}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.roboid.robot.MatrixChannel</code>. | createMatrixChannelAdapter | {
"repo_name": "roboidstudio/embedded",
"path": "org.roboid.robot.model.edit/src/org/roboid/robot/provider/RobotItemProviderAdapterFactory.java",
"license": "lgpl-2.1",
"size": 17793
} | [
"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,019,609 |
Problem check(Config config, int step, ObservationElements elems, Object state); | Problem check(Config config, int step, ObservationElements elems, Object state); | /**
* Checks the provided configuration for the problem(s) associated with this
* rule.
*
* @param config complete configuration to be sent to the control system
*
* @param step the step count of the sequence to which the configuration
* applies
*
* @param elems collection of nodes and data objects associated with the
* observation
*
* @param state state information needed to apply rules that need to
* examine multiple steps
*
* @return the problem if it applies to the given configuration
*/ | Checks the provided configuration for the problem(s) associated with this rule | check | {
"repo_name": "arturog8m/ocs",
"path": "bundle/edu.gemini.p2checker/src/main/java/edu/gemini/p2checker/api/IConfigRule.java",
"license": "bsd-3-clause",
"size": 1077
} | [
"edu.gemini.spModel.config2.Config"
] | import edu.gemini.spModel.config2.Config; | import edu.gemini.*; | [
"edu.gemini"
] | edu.gemini; | 1,125,529 |
public Set<A> keySet() {
return map.keySet();
} | Set<A> function() { return map.keySet(); } | /**
* Get the keySet.
*/ | Get the keySet | keySet | {
"repo_name": "CURocketry/Ground_Station_GUI",
"path": "src/org/openstreetmap/josm/tools/MultiMap.java",
"license": "gpl-3.0",
"size": 4077
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,063,358 |
public boolean invokeVelocimacro(final String vmName, String logTag,
String[] params, final Context context,
final Writer writer); | boolean function(final String vmName, String logTag, String[] params, final Context context, final Writer writer); | /**
* Invokes a currently registered Velocimacro with the params provided
* and places the rendered stream into the writer.
* <br>
* Note : currently only accepts args to the VM if they are in the context.
*
* @param vmName name of Velocimacro to call
* @param logTag string to be used for template name in case of error. if null,
* the vmName will be used
* @param params keys for args used to invoke Velocimacro, in java format
* rather than VTL (eg "foo" or "bar" rather than "$foo" or "$bar")
* @param context Context object containing data/objects used for rendering.
* @param writer Writer for output stream
* @return true if Velocimacro exists and successfully invoked, false otherwise.
* @since 1.6
*/ | Invokes a currently registered Velocimacro with the params provided and places the rendered stream into the writer. Note : currently only accepts args to the VM if they are in the context | invokeVelocimacro | {
"repo_name": "bbossgroups/bbossgroups-3.5",
"path": "bboss-velocity/src-velocity/bboss/org/apache/velocity/runtime/RuntimeServices.java",
"license": "apache-2.0",
"size": 18983
} | [
"java.io.Writer"
] | import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 1,574,759 |
@SOAPBinding (
style = SOAPBinding.Style.RPC
)
String addInfoSet(String sourceId, InfoSet infoSet) throws ServiceException; | @SOAPBinding ( style = SOAPBinding.Style.RPC ) String addInfoSet(String sourceId, InfoSet infoSet) throws ServiceException; | /**
* Adds an infoset to a specified source.
*
* @param sourceId The id of the source to which to add the infoset.
* @param infoSet The infoset to add to the source.
* @return The id of the infoset that was added.
* @throws ServiceException If the infoset couldn't be added to the source.
*/ | Adds an infoset to a specified source | addInfoSet | {
"repo_name": "nabilzhang/enunciate",
"path": "idl/src/test/samples/com/webcohesion/enunciate/samples/idl/genealogy/services/SourceService.java",
"license": "apache-2.0",
"size": 3257
} | [
"com.webcohesion.enunciate.samples.idl.genealogy.cite.InfoSet",
"javax.jws.soap.SOAPBinding"
] | import com.webcohesion.enunciate.samples.idl.genealogy.cite.InfoSet; import javax.jws.soap.SOAPBinding; | import com.webcohesion.enunciate.samples.idl.genealogy.cite.*; import javax.jws.soap.*; | [
"com.webcohesion.enunciate",
"javax.jws"
] | com.webcohesion.enunciate; javax.jws; | 436,032 |
@Override public Builder<K, V> put(K key, V value) {
builderMultimap.put(checkNotNull(key), checkNotNull(value));
return this;
} | @Override Builder<K, V> function(K key, V value) { builderMultimap.put(checkNotNull(key), checkNotNull(value)); return this; } | /**
* Adds a key-value mapping to the built multimap if it is not already
* present.
*/ | Adds a key-value mapping to the built multimap if it is not already present | put | {
"repo_name": "rowboat/external-guava",
"path": "src/com/google/common/collect/ImmutableSetMultimap.java",
"license": "apache-2.0",
"size": 13563
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 570,899 |
public static void putTranscriptionScore(ClusterSet clusterSet) throws CloneNotSupportedException, DiarizationException {
logger.info("------ Use Transcription ------");
if (parameter.getParameterNamedSpeaker().isUseTranscription()) {
TurnSet turns = clusterSet.getTurns();
boolean isCloseListCheck = parameter.getParameterNamedSpeaker().isCloseListCheck();
for (int i = 0; i < turns.size(); i++) {
Turn currentTurn = turns.get(i);
LinkSet linkSet = currentTurn.getCollapsedLinkSet();
boolean startTurn = true;
boolean endTurn = true;
SpeakerNameUtils.makeLinkSetForSCT(linkSet, startTurn, endTurn);
for (int index = 0; index < linkSet.size(); index++) {
Link link = linkSet.getLink(index);
if (link.haveEntity(EntitySet.TypePersonne) == true) {
SCTProbabilities probabilities = link.getEntity().getScore("SCT");
String speakerName = link.getWord();
if (SpeakerNameUtils.checkSpeakerName(speakerName, isCloseListCheck, nameAndGenderMap, firstNameAndGenderMap) == true) {
String normalizedName;
normalizedName = putMaxSpeakerName(probabilities, speakerName, turns, i);
personneList.add(SpeakerNameUtils.normalizeSpeakerName(normalizedName));
}
}
}
}
}
} | static void function(ClusterSet clusterSet) throws CloneNotSupportedException, DiarizationException { logger.info(STR); if (parameter.getParameterNamedSpeaker().isUseTranscription()) { TurnSet turns = clusterSet.getTurns(); boolean isCloseListCheck = parameter.getParameterNamedSpeaker().isCloseListCheck(); for (int i = 0; i < turns.size(); i++) { Turn currentTurn = turns.get(i); LinkSet linkSet = currentTurn.getCollapsedLinkSet(); boolean startTurn = true; boolean endTurn = true; SpeakerNameUtils.makeLinkSetForSCT(linkSet, startTurn, endTurn); for (int index = 0; index < linkSet.size(); index++) { Link link = linkSet.getLink(index); if (link.haveEntity(EntitySet.TypePersonne) == true) { SCTProbabilities probabilities = link.getEntity().getScore("SCT"); String speakerName = link.getWord(); if (SpeakerNameUtils.checkSpeakerName(speakerName, isCloseListCheck, nameAndGenderMap, firstNameAndGenderMap) == true) { String normalizedName; normalizedName = putMaxSpeakerName(probabilities, speakerName, turns, i); personneList.add(SpeakerNameUtils.normalizeSpeakerName(normalizedName)); } } } } } } | /**
* Put transcription score.
*
* @param clusterSet the cluster set
* @throws CloneNotSupportedException the clone not supported exception
* @throws DiarizationException the diarization exception
*/ | Put transcription score | putTranscriptionScore | {
"repo_name": "Adirockzz95/GenderDetect",
"path": "src/src/fr/lium/experimental/spkDiarization/programs/SpeakerIdenificationDecision15.java",
"license": "gpl-3.0",
"size": 46960
} | [
"fr.lium.experimental.spkDiarization.libClusteringData.transcription.EntitySet",
"fr.lium.experimental.spkDiarization.libClusteringData.transcription.Link",
"fr.lium.experimental.spkDiarization.libClusteringData.transcription.LinkSet",
"fr.lium.experimental.spkDiarization.libClusteringData.turnRepresentation.... | import fr.lium.experimental.spkDiarization.libClusteringData.transcription.EntitySet; import fr.lium.experimental.spkDiarization.libClusteringData.transcription.Link; import fr.lium.experimental.spkDiarization.libClusteringData.transcription.LinkSet; import fr.lium.experimental.spkDiarization.libClusteringData.turnRepresentation.Turn; import fr.lium.experimental.spkDiarization.libClusteringData.turnRepresentation.TurnSet; import fr.lium.experimental.spkDiarization.libNamedSpeaker.SpeakerNameUtils; import fr.lium.experimental.spkDiarization.libSCTree.SCTProbabilities; import fr.lium.spkDiarization.lib.DiarizationException; import fr.lium.spkDiarization.libClusteringData.ClusterSet; | import fr.lium.*; import fr.lium.experimental.*; | [
"fr.lium",
"fr.lium.experimental"
] | fr.lium; fr.lium.experimental; | 233,331 |
public Result select(String query)
throws DatabaseException {
return selectRange(query, null, null);
} | Result function(String query) throws DatabaseException { return selectRange(query, null, null); } | /**
* Performs a "UQI Select" query.
*
* @see Environment#selectRange(String, Cursor, Cursor)
*/ | Performs a "UQI Select" query | select | {
"repo_name": "cruppstahl/upscaledb",
"path": "java/java/de/crupp/upscaledb/Environment.java",
"license": "apache-2.0",
"size": 18630
} | [
"de.crupp.upscaledb.Result"
] | import de.crupp.upscaledb.Result; | import de.crupp.upscaledb.*; | [
"de.crupp.upscaledb"
] | de.crupp.upscaledb; | 830,140 |
private ConcurrentMap<GroupId, StoredGroupEntry>
getGroupIdTable(NetworkId networkId, DeviceId deviceId) {
groupEntriesById.computeIfAbsent(networkId, n -> new ConcurrentHashMap<>());
return groupEntriesById.get(networkId)
.computeIfAbsent(deviceId, k -> new ConcurrentHashMap<>());
} | ConcurrentMap<GroupId, StoredGroupEntry> function(NetworkId networkId, DeviceId deviceId) { groupEntriesById.computeIfAbsent(networkId, n -> new ConcurrentHashMap<>()); return groupEntriesById.get(networkId) .computeIfAbsent(deviceId, k -> new ConcurrentHashMap<>()); } | /**
* Returns the group id table for specified device.
*
* @param networkId identifier of the virtual network
* @param deviceId identifier of the device
* @return Map representing group key table of given device.
*/ | Returns the group id table for specified device | getGroupIdTable | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "incubator/store/src/main/java/org/onosproject/incubator/store/virtual/impl/SimpleVirtualGroupStore.java",
"license": "apache-2.0",
"size": 32276
} | [
"java.util.concurrent.ConcurrentHashMap",
"java.util.concurrent.ConcurrentMap",
"org.onosproject.core.GroupId",
"org.onosproject.incubator.net.virtual.NetworkId",
"org.onosproject.net.DeviceId",
"org.onosproject.net.group.StoredGroupEntry"
] | import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.onosproject.core.GroupId; import org.onosproject.incubator.net.virtual.NetworkId; import org.onosproject.net.DeviceId; import org.onosproject.net.group.StoredGroupEntry; | import java.util.concurrent.*; import org.onosproject.core.*; import org.onosproject.incubator.net.virtual.*; import org.onosproject.net.*; import org.onosproject.net.group.*; | [
"java.util",
"org.onosproject.core",
"org.onosproject.incubator",
"org.onosproject.net"
] | java.util; org.onosproject.core; org.onosproject.incubator; org.onosproject.net; | 2,859,281 |
@Auditable(parameters = {"authority", "state", "lazyInitialization"})
public List<WorkflowTask> getAssignedTasks(String authority, WorkflowTaskState state, boolean lazyInitialization); | @Auditable(parameters = {STR, "state", STR}) List<WorkflowTask> function(String authority, WorkflowTaskState state, boolean lazyInitialization); | /**
* Gets all tasks assigned to the specified authority
*
* @param authority the authority
* @param state filter by specified workflow task state
* @param lazyInitialization hint to the underlying workflow-engine to allow returning {@link WorkflowTask}s which
* aren't fully initialized but will be when the required values are required. If <code>true</code>, the
* returned enities should be used inside of the transaction-boundaries of this service-call.
* If <code>false</code>, fully initialized entities are returned, just as with {@link #getAssignedTasks(String, WorkflowTaskState)}.
* <br>It's a hint to the underlying workflow-engine and may be ignored by the actual implementation.
* @return the list of assigned tasks
*/ | Gets all tasks assigned to the specified authority | getAssignedTasks | {
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/service/cmr/workflow/WorkflowService.java",
"license": "lgpl-3.0",
"size": 25805
} | [
"java.util.List",
"org.alfresco.service.Auditable"
] | import java.util.List; import org.alfresco.service.Auditable; | import java.util.*; import org.alfresco.service.*; | [
"java.util",
"org.alfresco.service"
] | java.util; org.alfresco.service; | 942,629 |
public Set<String> getCapabilities(Connection c) throws
Types.BadServerResponse,
XmlRpcException {
String method_call = "host.get_capabilities";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
if(response.get("Status").equals("Success")) {
Object result = response.get("Value");
return Types.toSetOfString(result);
}
throw new Types.BadServerResponse(response);
} | Set<String> function(Connection c) throws Types.BadServerResponse, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); if(response.get(STR).equals(STR)) { Object result = response.get("Value"); return Types.toSetOfString(result); } throw new Types.BadServerResponse(response); } | /**
* Get the capabilities field of the given host.
*
* @return value of the field
*/ | Get the capabilities field of the given host | getCapabilities | {
"repo_name": "cc14514/hq6",
"path": "hq-plugin/xen-plugin/src/main/java/com/xensource/xenapi/Host.java",
"license": "unlicense",
"size": 71202
} | [
"java.util.Map",
"java.util.Set",
"org.apache.xmlrpc.XmlRpcException"
] | import java.util.Map; import java.util.Set; import org.apache.xmlrpc.XmlRpcException; | import java.util.*; import org.apache.xmlrpc.*; | [
"java.util",
"org.apache.xmlrpc"
] | java.util; org.apache.xmlrpc; | 1,299,815 |
@NonNull
public static HttpQueryParameter newQueryParameter(@NonNull String key, @Nullable String value) {
return new HttpQueryParameter(key, value);
} | static HttpQueryParameter function(@NonNull String key, @Nullable String value) { return new HttpQueryParameter(key, value); } | /**
* Create new query string request parameter
*
* @param key Key
* @param value Value
* @return New query string request parameter
*/ | Create new query string request parameter | newQueryParameter | {
"repo_name": "yuriy-budiyev/Wheels",
"path": "src/main/java/com/budiyev/android/wheels/HttpRequest.java",
"license": "mit",
"size": 9686
} | [
"android.support.annotation.NonNull",
"android.support.annotation.Nullable"
] | import android.support.annotation.NonNull; import android.support.annotation.Nullable; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 1,410,526 |
@Test public void testPushFilterPastAggThree() {
final HepProgram program =
HepProgram.builder()
.addRuleInstance(FilterAggregateTransposeRule.INSTANCE)
.build();
final String sql = "select deptno from emp\n"
+ "group by deptno having count(*) > 1";
checkPlanUnchanged(new HepPlanner(program), sql);
} | @Test void function() { final HepProgram program = HepProgram.builder() .addRuleInstance(FilterAggregateTransposeRule.INSTANCE) .build(); final String sql = STR + STR; checkPlanUnchanged(new HepPlanner(program), sql); } | /** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-799">[CALCITE-799]
* Incorrect result for {@code HAVING count(*) > 1}</a>. */ | Test case for [CALCITE-799] | testPushFilterPastAggThree | {
"repo_name": "wanglan/calcite",
"path": "core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java",
"license": "apache-2.0",
"size": 89190
} | [
"org.apache.calcite.plan.hep.HepPlanner",
"org.apache.calcite.plan.hep.HepProgram",
"org.apache.calcite.rel.rules.FilterAggregateTransposeRule",
"org.junit.Test"
] | import org.apache.calcite.plan.hep.HepPlanner; import org.apache.calcite.plan.hep.HepProgram; import org.apache.calcite.rel.rules.FilterAggregateTransposeRule; import org.junit.Test; | import org.apache.calcite.plan.hep.*; import org.apache.calcite.rel.rules.*; import org.junit.*; | [
"org.apache.calcite",
"org.junit"
] | org.apache.calcite; org.junit; | 474,063 |
public static void upto(Double self, Number to, Closure closure) {
double to1 = to.doubleValue();
if (self <= to1) {
for (double i = self; i <= to1; i++) {
closure.call(i);
}
} else
throw new GroovyRuntimeException("Infinite loop in " + self + ".upto(" + to + ")");
} | static void function(Double self, Number to, Closure closure) { double to1 = to.doubleValue(); if (self <= to1) { for (double i = self; i <= to1; i++) { closure.call(i); } } else throw new GroovyRuntimeException(STR + self + STR + to + ")"); } | /**
* Iterates from this number up to the given number, inclusive,
* incrementing by one each time.
*
* @param self a Double
* @param to the end number
* @param closure the code to execute for each number
* @since 1.0
*/ | Iterates from this number up to the given number, inclusive, incrementing by one each time | upto | {
"repo_name": "xien777/yajsw",
"path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "lgpl-2.1",
"size": 704150
} | [
"groovy.lang.Closure",
"groovy.lang.GroovyRuntimeException"
] | import groovy.lang.Closure; import groovy.lang.GroovyRuntimeException; | import groovy.lang.*; | [
"groovy.lang"
] | groovy.lang; | 2,416,020 |
public SnackbarBuilder actionClickListener(OnClickListener actionClickListener) {
this.actionClickListener = actionClickListener;
return this;
} | SnackbarBuilder function(OnClickListener actionClickListener) { this.actionClickListener = actionClickListener; return this; } | /**
* Set the click listener for the action on the Snackbar.
*
* @param actionClickListener Click listener for the action.
* @return This instance.
*/ | Set the click listener for the action on the Snackbar | actionClickListener | {
"repo_name": "andrewlord1990/SnackbarBuilder",
"path": "snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarBuilder.java",
"license": "apache-2.0",
"size": 20366
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,144,085 |
public String getWarningReport() {
Map<String, List<PropertyMigration>> content = getContent(
LegacyProperties::getRenamed);
if (content.isEmpty()) {
return null;
}
StringBuilder report = new StringBuilder();
report.append(String.format("%nThe use of configuration keys that have been "
+ "renamed was found in the environment:%n%n"));
append(report, content, (metadata) -> "Replacement: "
+ metadata.getDeprecation().getReplacement());
report.append(String.format("%n"));
report.append("Each configuration key has been temporarily mapped to its "
+ "replacement for your convenience. To silence this warning, please "
+ "update your configuration to use the new keys.");
report.append(String.format("%n"));
return report.toString();
} | String function() { Map<String, List<PropertyMigration>> content = getContent( LegacyProperties::getRenamed); if (content.isEmpty()) { return null; } StringBuilder report = new StringBuilder(); report.append(String.format(STR + STR)); append(report, content, (metadata) -> STR + metadata.getDeprecation().getReplacement()); report.append(String.format("%n")); report.append(STR + STR + STR); report.append(String.format("%n")); return report.toString(); } | /**
* Return a report for all the properties that were automatically renamed. If no such
* properties were found, return {@code null}.
* @return a report with the configurations keys that should be renamed
*/ | Return a report for all the properties that were automatically renamed. If no such properties were found, return null | getWarningReport | {
"repo_name": "ptahchiev/spring-boot",
"path": "spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java",
"license": "apache-2.0",
"size": 5774
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,109,686 |
void onInfoBarClosed(boolean explicitly);
}
private final Client mClient;
private AnimatedVectorDrawableCompat mAnimatedDrawable;
private DownloadInfoBarController.DownloadProgressInfoBarData mInfo;
// Indicates whether there is a pending layout update waiting for the currently running
// animation to finish.
private boolean mUpdatePending;
private DownloadProgressInfoBar(
Client client, DownloadInfoBarController.DownloadProgressInfoBarData info) {
super(info.icon, 0, null, null);
mInfo = info;
mClient = client;
} | void onInfoBarClosed(boolean explicitly); } private final Client mClient; private AnimatedVectorDrawableCompat mAnimatedDrawable; private DownloadInfoBarController.DownloadProgressInfoBarData mInfo; private boolean mUpdatePending; private DownloadProgressInfoBar( Client client, DownloadInfoBarController.DownloadProgressInfoBarData info) { super(info.icon, 0, null, null); mInfo = info; mClient = client; } | /**
* Called when the InfoBar is closed either implicitly or explicitly by the user.
* @param explicitly Whether the InfoBar was closed explicitly by the user from close
* button.
*/ | Called when the InfoBar is closed either implicitly or explicitly by the user | onInfoBarClosed | {
"repo_name": "endlessm/chromium-browser",
"path": "chrome/android/java/src/org/chromium/chrome/browser/infobar/DownloadProgressInfoBar.java",
"license": "bsd-3-clause",
"size": 7545
} | [
"androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat",
"org.chromium.chrome.browser.download.DownloadInfoBarController"
] | import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat; import org.chromium.chrome.browser.download.DownloadInfoBarController; | import androidx.vectordrawable.graphics.drawable.*; import org.chromium.chrome.browser.download.*; | [
"androidx.vectordrawable",
"org.chromium.chrome"
] | androidx.vectordrawable; org.chromium.chrome; | 2,896,615 |
public int size() {
return to - from;
}
/**
* Iterate through all indexes in the range in ascending order to be processed by the
* provided {@link IntConsumer integer consumer} lambda function.
*
* <p>
* Exceptions thrown by the execution of the index consumer {@code lambda} | int function() { return to - from; } /** * Iterate through all indexes in the range in ascending order to be processed by the * provided {@link IntConsumer integer consumer} lambda function. * * <p> * Exceptions thrown by the execution of the index consumer {@code lambda} | /**
* Returns number indexes expanded by this range.
*
* @return 0 or greater.
*/ | Returns number indexes expanded by this range | size | {
"repo_name": "BGI-flexlab/SOAPgaeaDevelopment4.0",
"path": "src/main/java/org/bgi/flexlab/gaea/util/IndexRange.java",
"license": "gpl-3.0",
"size": 5072
} | [
"java.util.function.IntConsumer"
] | import java.util.function.IntConsumer; | import java.util.function.*; | [
"java.util"
] | java.util; | 2,496,237 |
public static HRegion openHRegion(final HRegionInfo info,
final HTableDescriptor htd, final HLog wal,
final Configuration conf)
throws IOException {
return openHRegion(info, htd, wal, conf, null, null);
} | static HRegion function(final HRegionInfo info, final HTableDescriptor htd, final HLog wal, final Configuration conf) throws IOException { return openHRegion(info, htd, wal, conf, null, null); } | /**
* Open a Region.
* @param info Info for region to be opened.
* @param wal HLog for region to use. This method will call
* HLog#setSequenceNumber(long) passing the result of the call to
* HRegion#getMinSequenceId() to ensure the log id is properly kept
* up. HRegionStore does this every time it opens a new region.
* @param conf
* @return new HRegion
*
* @throws IOException
*/ | Open a Region | openHRegion | {
"repo_name": "gdweijin/hindex",
"path": "src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 221667
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.HTableDescriptor",
"org.apache.hadoop.hbase.regionserver.wal.HLog"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.regionserver.wal.HLog; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,244,149 |
public void deleteResource(String serverId,String resourcePath, String resourceType, String pathToServersXML) throws CompositeException; | void function(String serverId,String resourcePath, String resourceType, String pathToServersXML) throws CompositeException; | /**
* Delete a resource associated with passed in resource path
* @param serverId target server config name
* @param resourcePath resource path
* @param resourceType ResourceType
* @param pathToServersXML path to the server values xml
* @throws CompositeException if deletion of the resource fails
*/ | Delete a resource associated with passed in resource path | deleteResource | {
"repo_name": "cisco/PDTool",
"path": "src/com/tibco/ps/deploytool/dao/ResourceDAO.java",
"license": "bsd-3-clause",
"size": 10687
} | [
"com.tibco.ps.common.exception.CompositeException"
] | import com.tibco.ps.common.exception.CompositeException; | import com.tibco.ps.common.exception.*; | [
"com.tibco.ps"
] | com.tibco.ps; | 103,099 |
protected final Map mapEntityList(List list) {
Map map = new HashMap();
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
map.put(entity.getId(), entity);
}
return map;
} | final Map function(List list) { Map map = new HashMap(); Iterator iterator = list.iterator(); while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); map.put(entity.getId(), entity); } return map; } | /**
* Method maps a List of Entity objects keyed to their ids.
*
* @param list
* List containing Entity objects
* @return Map containing Entity objects
*/ | Method maps a List of Entity objects keyed to their ids | mapEntityList | {
"repo_name": "baboune/compass",
"path": "samples/petclinic/src/java/org/compass/sample/petclinic/jdbc/AbstractJdbcClinic.java",
"license": "apache-2.0",
"size": 24301
} | [
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"org.compass.sample.petclinic.Entity"
] | import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.compass.sample.petclinic.Entity; | import java.util.*; import org.compass.sample.petclinic.*; | [
"java.util",
"org.compass.sample"
] | java.util; org.compass.sample; | 1,770,843 |
@POST
@Path("setting")
@ApiOperation(httpMethod = "GET", value = "Create new interpreter setting")
@ApiResponses(value = {@ApiResponse(code = 201, message = "On success")})
public Response newSettings(String message) throws InterpreterException, IOException {
NewInterpreterSettingRequest request = gson.fromJson(message,
NewInterpreterSettingRequest.class);
Properties p = new Properties();
p.putAll(request.getProperties());
interpreterFactory.add(request.getName(), request.getGroup(), request.getOption(), p);
return new JsonResponse(Status.CREATED, "").build();
} | @Path(STR) @ApiOperation(httpMethod = "GET", value = STR) @ApiResponses(value = {@ApiResponse(code = 201, message = STR)}) Response function(String message) throws InterpreterException, IOException { NewInterpreterSettingRequest request = gson.fromJson(message, NewInterpreterSettingRequest.class); Properties p = new Properties(); p.putAll(request.getProperties()); interpreterFactory.add(request.getName(), request.getGroup(), request.getOption(), p); return new JsonResponse(Status.CREATED, "").build(); } | /**
* Add new interpreter setting
* @param message
* @return
* @throws IOException
* @throws InterpreterException
*/ | Add new interpreter setting | newSettings | {
"repo_name": "rohit2b/incubator-zeppelin",
"path": "zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java",
"license": "apache-2.0",
"size": 6249
} | [
"com.wordnik.swagger.annotations.ApiOperation",
"com.wordnik.swagger.annotations.ApiResponse",
"com.wordnik.swagger.annotations.ApiResponses",
"java.io.IOException",
"java.util.Properties",
"javax.ws.rs.Path",
"javax.ws.rs.core.Response",
"org.apache.zeppelin.interpreter.InterpreterException",
"org.... | import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiResponse; import com.wordnik.swagger.annotations.ApiResponses; import java.io.IOException; import java.util.Properties; import javax.ws.rs.Path; import javax.ws.rs.core.Response; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.rest.message.NewInterpreterSettingRequest; import org.apache.zeppelin.server.JsonResponse; | import com.wordnik.swagger.annotations.*; import java.io.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.zeppelin.interpreter.*; import org.apache.zeppelin.rest.message.*; import org.apache.zeppelin.server.*; | [
"com.wordnik.swagger",
"java.io",
"java.util",
"javax.ws",
"org.apache.zeppelin"
] | com.wordnik.swagger; java.io; java.util; javax.ws; org.apache.zeppelin; | 858,615 |
public List<Criteria> getOredCriteria() {
return oredCriteria;
} | List<Criteria> function() { return oredCriteria; } | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_crm_case
*
* @mbggenerated Mon Sep 21 13:52:02 ICT 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_crm_case | getOredCriteria | {
"repo_name": "maduhu/mycollab",
"path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/crm/domain/CaseExample.java",
"license": "agpl-3.0",
"size": 43385
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,489,602 |
public EventGridPublisherClientImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
this.httpLogOptions = httpLogOptions;
return this;
}
private RetryPolicy retryPolicy; | EventGridPublisherClientImplBuilder function(HttpLogOptions httpLogOptions) { this.httpLogOptions = httpLogOptions; return this; } private RetryPolicy retryPolicy; | /**
* Sets The logging configuration for HTTP requests and responses.
*
* @param httpLogOptions the httpLogOptions value.
* @return the EventGridPublisherClientImplBuilder.
*/ | Sets The logging configuration for HTTP requests and responses | httpLogOptions | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/eventgrid/azure-messaging-eventgrid/src/main/java/com/azure/messaging/eventgrid/implementation/EventGridPublisherClientImplBuilder.java",
"license": "mit",
"size": 7322
} | [
"com.azure.core.http.policy.HttpLogOptions",
"com.azure.core.http.policy.RetryPolicy"
] | import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.RetryPolicy; | import com.azure.core.http.policy.*; | [
"com.azure.core"
] | com.azure.core; | 2,856,022 |
@Email("http://www.nabble.com/tar.gz-becomes-.gz-after-Hudson-deployment-td25391364.html")
@Bug(3814)
public void testTarGz() throws Exception {
configureDefaultMaven();
MavenModuleSet m2 = createMavenProject();
File repo = createTmpDir();
// a fake build
m2.setScm(new SingleFileSCM("pom.xml",getClass().getResource("targz-artifact.pom")));
m2.getPublishersList().add(new RedeployPublisher("",repo.toURI().toString(),false, false));
MavenModuleSetBuild b = m2.scheduleBuild2(0).get();
assertBuildStatus(Result.SUCCESS, b);
assertTrue("tar.gz doesn't exist",new File(repo,"test/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT-bin.tar.gz").exists());
} | @Email(STRpom.xmlSTRtargz-artifact.pomSTRSTRtar.gz doesn't existSTRtest/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT-bin.tar.gz").exists()); } | /**
* Are we having a problem in handling file names with multiple extensions, like ".tar.gz"?
*/ | Are we having a problem in handling file names with multiple extensions, like ".tar.gz" | testTarGz | {
"repo_name": "vivek/hudson",
"path": "test/src/test/java/hudson/maven/RedeployPublisherTest.java",
"license": "mit",
"size": 5001
} | [
"org.jvnet.hudson.test.Email"
] | import org.jvnet.hudson.test.Email; | import org.jvnet.hudson.test.*; | [
"org.jvnet.hudson"
] | org.jvnet.hudson; | 1,759,143 |
public static Intent createIntent(List<Gist> gists, int position) {
String[] ids = new String[gists.size()];
int index = 0;
for (Gist gist : gists)
ids[index++] = gist.getId();
return new Builder("gists.VIEW")
.add(EXTRA_GIST_IDS, (Serializable) ids)
.add(EXTRA_POSITION, position).toIntent();
}
private ViewPager pager;
private String[] gists;
private Gist gist;
private int initialPosition;
@Inject
private GistStore store;
@Inject
private AvatarLoader avatars;
private GistsPagerAdapter adapter; | static Intent function(List<Gist> gists, int position) { String[] ids = new String[gists.size()]; int index = 0; for (Gist gist : gists) ids[index++] = gist.getId(); return new Builder(STR) .add(EXTRA_GIST_IDS, (Serializable) ids) .add(EXTRA_POSITION, position).toIntent(); } private ViewPager pager; private String[] gists; private Gist gist; private int initialPosition; private GistStore store; private AvatarLoader avatars; private GistsPagerAdapter adapter; | /**
* Create an intent to show gists with an initial selected Gist
*
* @param gists
* @param position
* @return intent
*/ | Create an intent to show gists with an initial selected Gist | createIntent | {
"repo_name": "samuelralak/ForkHub",
"path": "app/src/main/java/com/github/mobile/ui/gist/GistsViewActivity.java",
"license": "apache-2.0",
"size": 6745
} | [
"android.content.Intent",
"com.github.mobile.Intents",
"com.github.mobile.core.gist.GistStore",
"com.github.mobile.ui.ViewPager",
"com.github.mobile.util.AvatarLoader",
"java.io.Serializable",
"java.util.List",
"org.eclipse.egit.github.core.Gist"
] | import android.content.Intent; import com.github.mobile.Intents; import com.github.mobile.core.gist.GistStore; import com.github.mobile.ui.ViewPager; import com.github.mobile.util.AvatarLoader; import java.io.Serializable; import java.util.List; import org.eclipse.egit.github.core.Gist; | import android.content.*; import com.github.mobile.*; import com.github.mobile.core.gist.*; import com.github.mobile.ui.*; import com.github.mobile.util.*; import java.io.*; import java.util.*; import org.eclipse.egit.github.core.*; | [
"android.content",
"com.github.mobile",
"java.io",
"java.util",
"org.eclipse.egit"
] | android.content; com.github.mobile; java.io; java.util; org.eclipse.egit; | 1,159,300 |
protected void parentOfCycleAndErrorInternal(
boolean errorsStoredAlongsideValues,
boolean supportsTransientExceptions,
boolean useTransientError)
throws Exception {
initializeTester();
if (errorsStoredAlongsideValues) {
Preconditions.checkArgument(supportsTransientExceptions);
}
SkyKey cycleKey1 = GraphTester.toSkyKey("cycleKey1");
SkyKey cycleKey2 = GraphTester.toSkyKey("cycleKey2");
SkyKey mid = GraphTester.toSkyKey("mid");
SkyKey errorKey = GraphTester.toSkyKey("errorKey");
tester.getOrCreate(cycleKey1).addDependency(cycleKey2).setComputedValue(COPY);
tester.getOrCreate(cycleKey2).addDependency(cycleKey1).setComputedValue(COPY);
TestFunction errorFunction = tester.getOrCreate(errorKey);
if (useTransientError) {
errorFunction.setHasTransientError(true);
} else {
errorFunction.setHasError(true);
}
tester.getOrCreate(mid).addErrorDependency(errorKey, new StringValue("recovered"))
.setComputedValue(COPY);
SkyKey top = GraphTester.toSkyKey("top");
CountDownLatch topEvaluated = new CountDownLatch(2);
tester.getOrCreate(top).setBuilder(new ChainedFunction(topEvaluated, null, null, false,
new StringValue("unused"), ImmutableList.of(mid, cycleKey1)));
EvaluationResult<StringValue> evalResult = tester.eval(true, top);
assertThatEvaluationResult(evalResult).hasError();
ErrorInfo errorInfo = evalResult.getError(top);
assertThat(topEvaluated.getCount()).isEqualTo(1);
if (errorsStoredAlongsideValues) {
if (useTransientError) {
// The parent should be transitively transient, since it transitively depends on a transient
// error.
assertThat(errorInfo.isTransitivelyTransient()).isTrue();
} else {
assertThatErrorInfo(errorInfo).isNotTransient();
}
assertThat(errorInfo.getException())
.hasMessageThat()
.isEqualTo(NODE_TYPE.getName() + ":errorKey");
assertThat(errorInfo.getRootCauseOfException()).isEqualTo(errorKey);
} else {
// When errors are not stored alongside values, transient errors that are recovered from do
// not make the parent transient
if (supportsTransientExceptions) {
assertThatErrorInfo(errorInfo).isTransient();
assertThatErrorInfo(errorInfo).hasExceptionThat().isNotNull();
} else {
assertThatErrorInfo(errorInfo).isNotTransient();
assertThatErrorInfo(errorInfo).hasExceptionThat().isNull();
}
}
if (cyclesDetected()) {
assertThatErrorInfo(errorInfo)
.hasCycleInfoThat()
.containsExactly(
new CycleInfo(ImmutableList.of(top), ImmutableList.of(cycleKey1, cycleKey2)));
} else {
assertThatErrorInfo(errorInfo).hasCycleInfoThat().hasSize(1);
}
// But the parent itself shouldn't have a direct dep on the special error transience node.
verifyParentDepsForParentOfCycleAndError(
assertThatEvaluationResult(evalResult).hasDirectDepsInGraphThat(top));
} | void function( boolean errorsStoredAlongsideValues, boolean supportsTransientExceptions, boolean useTransientError) throws Exception { initializeTester(); if (errorsStoredAlongsideValues) { Preconditions.checkArgument(supportsTransientExceptions); } SkyKey cycleKey1 = GraphTester.toSkyKey(STR); SkyKey cycleKey2 = GraphTester.toSkyKey(STR); SkyKey mid = GraphTester.toSkyKey("mid"); SkyKey errorKey = GraphTester.toSkyKey(STR); tester.getOrCreate(cycleKey1).addDependency(cycleKey2).setComputedValue(COPY); tester.getOrCreate(cycleKey2).addDependency(cycleKey1).setComputedValue(COPY); TestFunction errorFunction = tester.getOrCreate(errorKey); if (useTransientError) { errorFunction.setHasTransientError(true); } else { errorFunction.setHasError(true); } tester.getOrCreate(mid).addErrorDependency(errorKey, new StringValue(STR)) .setComputedValue(COPY); SkyKey top = GraphTester.toSkyKey("top"); CountDownLatch topEvaluated = new CountDownLatch(2); tester.getOrCreate(top).setBuilder(new ChainedFunction(topEvaluated, null, null, false, new StringValue(STR), ImmutableList.of(mid, cycleKey1))); EvaluationResult<StringValue> evalResult = tester.eval(true, top); assertThatEvaluationResult(evalResult).hasError(); ErrorInfo errorInfo = evalResult.getError(top); assertThat(topEvaluated.getCount()).isEqualTo(1); if (errorsStoredAlongsideValues) { if (useTransientError) { assertThat(errorInfo.isTransitivelyTransient()).isTrue(); } else { assertThatErrorInfo(errorInfo).isNotTransient(); } assertThat(errorInfo.getException()) .hasMessageThat() .isEqualTo(NODE_TYPE.getName() + STR); assertThat(errorInfo.getRootCauseOfException()).isEqualTo(errorKey); } else { if (supportsTransientExceptions) { assertThatErrorInfo(errorInfo).isTransient(); assertThatErrorInfo(errorInfo).hasExceptionThat().isNotNull(); } else { assertThatErrorInfo(errorInfo).isNotTransient(); assertThatErrorInfo(errorInfo).hasExceptionThat().isNull(); } } if (cyclesDetected()) { assertThatErrorInfo(errorInfo) .hasCycleInfoThat() .containsExactly( new CycleInfo(ImmutableList.of(top), ImmutableList.of(cycleKey1, cycleKey2))); } else { assertThatErrorInfo(errorInfo).hasCycleInfoThat().hasSize(1); } verifyParentDepsForParentOfCycleAndError( assertThatEvaluationResult(evalResult).hasDirectDepsInGraphThat(top)); } | /**
* {@link ParallelEvaluator} can be configured to not store errors alongside recovered values.
*
* @param errorsStoredAlongsideValues true if we expect Skyframe to store the error for the
* cycle in ErrorInfo. If true, supportsTransientExceptions must be true as well.
* @param supportsTransientExceptions true if we expect Skyframe to mark an ErrorInfo as transient
* for certain exception types.
* @param useTransientError true if the test should set the {@link TestFunction} it creates to
* throw a transient error.
*/ | <code>ParallelEvaluator</code> can be configured to not store errors alongside recovered values | parentOfCycleAndErrorInternal | {
"repo_name": "werkt/bazel",
"path": "src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java",
"license": "apache-2.0",
"size": 244329
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.ImmutableList",
"com.google.common.truth.Truth",
"com.google.devtools.build.skyframe.ErrorInfoSubjectFactory",
"com.google.devtools.build.skyframe.EvaluationResultSubjectFactory",
"com.google.devtools.build.skyframe.GraphTester",
"java.u... | import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.truth.Truth; import com.google.devtools.build.skyframe.ErrorInfoSubjectFactory; import com.google.devtools.build.skyframe.EvaluationResultSubjectFactory; import com.google.devtools.build.skyframe.GraphTester; import java.util.concurrent.CountDownLatch; | import com.google.common.base.*; import com.google.common.collect.*; import com.google.common.truth.*; import com.google.devtools.build.skyframe.*; import java.util.concurrent.*; | [
"com.google.common",
"com.google.devtools",
"java.util"
] | com.google.common; com.google.devtools; java.util; | 419,772 |
public static String generateCsrPemEncodedString(KeyPair keyPair, String userId)
throws IOException, OperatorCreationException {
PKCS10CertificationRequest csr = CsrHelper.generateCSR(keyPair, userId);
byte[] derCSR = csr.getEncoded();
return "-----BEGIN CERTIFICATE REQUEST-----\n" + android.util.Base64.encodeToString(derCSR,
android.util.Base64.NO_WRAP) + "\n-----END CERTIFICATE REQUEST-----";
} | static String function(KeyPair keyPair, String userId) throws IOException, OperatorCreationException { PKCS10CertificationRequest csr = CsrHelper.generateCSR(keyPair, userId); byte[] derCSR = csr.getEncoded(); return STR + android.util.Base64.encodeToString(derCSR, android.util.Base64.NO_WRAP) + STR; } | /**
* Generate CSR with PEM encoding
*
* @param keyPair the KeyPair with private and public keys
* @param userId userId of CSR owner
* @return PEM encoded CSR string
* @throws IOException thrown if key cannot be created
* @throws OperatorCreationException thrown if contentSigner cannot be build
*/ | Generate CSR with PEM encoding | generateCsrPemEncodedString | {
"repo_name": "nextcloud/android",
"path": "src/main/java/com/owncloud/android/utils/CsrHelper.java",
"license": "gpl-2.0",
"size": 3962
} | [
"java.io.IOException",
"java.security.KeyPair",
"org.bouncycastle.operator.OperatorCreationException",
"org.bouncycastle.pkcs.PKCS10CertificationRequest"
] | import java.io.IOException; import java.security.KeyPair; import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.pkcs.PKCS10CertificationRequest; | import java.io.*; import java.security.*; import org.bouncycastle.operator.*; import org.bouncycastle.pkcs.*; | [
"java.io",
"java.security",
"org.bouncycastle.operator",
"org.bouncycastle.pkcs"
] | java.io; java.security; org.bouncycastle.operator; org.bouncycastle.pkcs; | 1,001,004 |
public Logger getLogger() {
return logger;
} | Logger function() { return logger; } | /**
* Method to get Logger used by this ErrorManager
*
* @return the Logger
*/ | Method to get Logger used by this ErrorManager | getLogger | {
"repo_name": "WPI-AIM/OpenIGTLink-Java",
"path": "lib/OpenIGTLink/src/org/medcare/igtl/util/ErrorManager.java",
"license": "bsd-3-clause",
"size": 3042
} | [
"java.util.logging.Logger"
] | import java.util.logging.Logger; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,006,578 |
@Override
public BigInteger getBigSizeBytes() {
String size;
size = getAddressBlockSizeElement(getNode());
if ((size == null) && (getDerivedFromNode() != null)) {
size = getAddressBlockSizeElement(getDerivedFromNode());
}
if (size != null) {
return SvdUtils.parseScaledNonNegativeBigInteger(size);
}
return null;
} | BigInteger function() { String size; size = getAddressBlockSizeElement(getNode()); if ((size == null) && (getDerivedFromNode() != null)) { size = getAddressBlockSizeElement(getDerivedFromNode()); } if (size != null) { return SvdUtils.parseScaledNonNegativeBigInteger(size); } return null; } | /**
* Get peripheral block length.
*
* @return a big integer value with the length in bytes, or null if not found.
*/ | Get peripheral block length | getBigSizeBytes | {
"repo_name": "gnuarmeclipse/plug-ins",
"path": "plugins/ilg.gnumcueclipse.debug.gdbjtag/src/ilg/gnumcueclipse/debug/gdbjtag/datamodel/SvdPeripheralDMNode.java",
"license": "epl-1.0",
"size": 8478
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 1,162,292 |
private static byte[] toByteArrayInternal(InputStream in, Deque<byte[]> bufs, int totalLen)
throws IOException {
// Starting with an 8k buffer, double the size of each sucessive buffer. Buffers are retained
// in a deque so that there's no copying between buffers while reading and so all of the bytes
// in each new allocated buffer are available for reading from the stream.
for (int bufSize = BUFFER_SIZE;
totalLen < MAX_ARRAY_LEN;
bufSize = IntMath.saturatedMultiply(bufSize, 2)) {
byte[] buf = new byte[Math.min(bufSize, MAX_ARRAY_LEN - totalLen)];
bufs.add(buf);
int off = 0;
while (off < buf.length) {
// always OK to fill buf; its size plus the rest of bufs is never more than MAX_ARRAY_LEN
int r = in.read(buf, off, buf.length - off);
if (r == -1) {
return combineBuffers(bufs, totalLen);
}
off += r;
totalLen += r;
}
}
// read MAX_ARRAY_LEN bytes without seeing end of stream
if (in.read() == -1) {
// oh, there's the end of the stream
return combineBuffers(bufs, MAX_ARRAY_LEN);
} else {
throw new OutOfMemoryError("input is too large to fit in a byte array");
}
} | static byte[] function(InputStream in, Deque<byte[]> bufs, int totalLen) throws IOException { for (int bufSize = BUFFER_SIZE; totalLen < MAX_ARRAY_LEN; bufSize = IntMath.saturatedMultiply(bufSize, 2)) { byte[] buf = new byte[Math.min(bufSize, MAX_ARRAY_LEN - totalLen)]; bufs.add(buf); int off = 0; while (off < buf.length) { int r = in.read(buf, off, buf.length - off); if (r == -1) { return combineBuffers(bufs, totalLen); } off += r; totalLen += r; } } if (in.read() == -1) { return combineBuffers(bufs, MAX_ARRAY_LEN); } else { throw new OutOfMemoryError(STR); } } | /**
* Returns a byte array containing the bytes from the buffers already in {@code bufs} (which have
* a total combined length of {@code totalLen} bytes) followed by all bytes remaining in the given
* input stream.
*/ | Returns a byte array containing the bytes from the buffers already in bufs (which have a total combined length of totalLen bytes) followed by all bytes remaining in the given input stream | toByteArrayInternal | {
"repo_name": "EdwardLee03/guava",
"path": "guava/src/com/google/common/io/ByteStreams.java",
"license": "apache-2.0",
"size": 28650
} | [
"com.google.common.math.IntMath",
"java.io.IOException",
"java.io.InputStream",
"java.util.Deque"
] | import com.google.common.math.IntMath; import java.io.IOException; import java.io.InputStream; import java.util.Deque; | import com.google.common.math.*; import java.io.*; import java.util.*; | [
"com.google.common",
"java.io",
"java.util"
] | com.google.common; java.io; java.util; | 2,908,989 |
public void set_explanation(boolean flag) {
if (flag == true)
pv.set_explanation_value(0);
else
pv.set_explanation_value(BayesNet.INVALID_INDEX);
} | void function(boolean flag) { if (flag == true) pv.set_explanation_value(0); else pv.set_explanation_value(BayesNet.INVALID_INDEX); } | /**
* Set the explanatory status of the node.
*/ | Set the explanatory status of the node | set_explanation | {
"repo_name": "MrSampson/javabayes",
"path": "src/edu/cmu/cs/javabayes/inferencegraphs/InferenceGraphNode.java",
"license": "gpl-2.0",
"size": 15567
} | [
"edu.cmu.cs.javabayes.bayesiannetworks.BayesNet"
] | import edu.cmu.cs.javabayes.bayesiannetworks.BayesNet; | import edu.cmu.cs.javabayes.bayesiannetworks.*; | [
"edu.cmu.cs"
] | edu.cmu.cs; | 1,167,423 |
public SIcon getDefaultLeafIcon() {
return (SIcon) ResourceManager.getObject("TreeCG.leafIcon", SIcon.class);
} | SIcon function() { return (SIcon) ResourceManager.getObject(STR, SIcon.class); } | /**
* Returns the default icon, for the current laf, that is used to
* represent leaf nodes.
*/ | Returns the default icon, for the current laf, that is used to represent leaf nodes | getDefaultLeafIcon | {
"repo_name": "exxcellent/wings3",
"path": "wings/src/java/org/wings/tree/SDefaultTreeCellRenderer.java",
"license": "lgpl-2.1",
"size": 6693
} | [
"org.wings.SIcon",
"org.wings.resource.ResourceManager"
] | import org.wings.SIcon; import org.wings.resource.ResourceManager; | import org.wings.*; import org.wings.resource.*; | [
"org.wings",
"org.wings.resource"
] | org.wings; org.wings.resource; | 996,316 |
public final Properties getProperties() {
Properties props = new Properties();
for (String prop : PLIST) {
props.setProperty(prop, "" + get(prop));
}
return props;
} | final Properties function() { Properties props = new Properties(); for (String prop : PLIST) { props.setProperty(prop, "" + get(prop)); } return props; } | /**
* Create a properties object from tihs config.
*
* @return the properteies that matches this config
*/ | Create a properties object from tihs config | getProperties | {
"repo_name": "PurdueSIGAI/Chess-AI",
"path": "src/com/nullprogram/chess/ai/Config.java",
"license": "mit",
"size": 1520
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,241,754 |
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(RfcPackage.Literals.SERVER_DATA_STORE__ENTRIES);
}
return childrenFeatures;
} | Collection<? extends EStructuralFeature> function(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(RfcPackage.Literals.SERVER_DATA_STORE__ENTRIES); } return childrenFeatures; } | /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>. | getChildrenFeatures | {
"repo_name": "janstey/fuse",
"path": "components/camel-sap/org.fusesource.camel.component.sap.model.edit/src/org/fusesource/camel/component/sap/model/rfc/provider/ServerDataStoreItemProvider.java",
"license": "apache-2.0",
"size": 5638
} | [
"java.util.Collection",
"org.eclipse.emf.ecore.EStructuralFeature",
"org.fusesource.camel.component.sap.model.rfc.RfcPackage"
] | import java.util.Collection; import org.eclipse.emf.ecore.EStructuralFeature; import org.fusesource.camel.component.sap.model.rfc.RfcPackage; | import java.util.*; import org.eclipse.emf.ecore.*; import org.fusesource.camel.component.sap.model.rfc.*; | [
"java.util",
"org.eclipse.emf",
"org.fusesource.camel"
] | java.util; org.eclipse.emf; org.fusesource.camel; | 1,457,764 |
public ClusterInner withSubnet(ResourceId subnet) {
this.subnet = subnet;
return this;
} | ClusterInner function(ResourceId subnet) { this.subnet = subnet; return this; } | /**
* Set the subnet value.
*
* @param subnet the subnet value to set
* @return the ClusterInner object itself.
*/ | Set the subnet value | withSubnet | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/batchai/mgmt-v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/ClusterInner.java",
"license": "mit",
"size": 13447
} | [
"com.microsoft.azure.management.batchai.v2018_03_01.ResourceId"
] | import com.microsoft.azure.management.batchai.v2018_03_01.ResourceId; | import com.microsoft.azure.management.batchai.v2018_03_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,295,258 |
private Optional<InternalRexNode> translateBinary2(String op, RexNode left,
RexNode right, RexNode originNode, KeyMeta keyMeta) {
RexLiteral rightLiteral;
if (right.isA(SqlKind.LITERAL)) {
rightLiteral = (RexLiteral) right;
} else {
// because MySQL's TIMESTAMP is mapped to TIMESTAMP_WITH_TIME_ZONE sql type,
// we should cast the value to literal.
if (right.isA(SqlKind.CAST)
&& isSqlTypeMatch((RexCall) right, SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)) {
rightLiteral = (RexLiteral) ((RexCall) right).operands.get(0);
} else {
return Optional.empty();
}
}
switch (left.getKind()) {
case INPUT_REF:
final RexInputRef left1 = (RexInputRef) left;
String name = fieldNames.get(left1.getIndex());
// filter out field does not show in index column
if (!keyMeta.getKeyColumnNames().contains(name)) {
return Optional.empty();
}
return translateOp2(op, name, rightLiteral, originNode, keyMeta);
case CAST:
return translateBinary2(op, ((RexCall) left).operands.get(0), right,
originNode, keyMeta);
default:
return Optional.empty();
}
} | Optional<InternalRexNode> function(String op, RexNode left, RexNode right, RexNode originNode, KeyMeta keyMeta) { RexLiteral rightLiteral; if (right.isA(SqlKind.LITERAL)) { rightLiteral = (RexLiteral) right; } else { if (right.isA(SqlKind.CAST) && isSqlTypeMatch((RexCall) right, SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)) { rightLiteral = (RexLiteral) ((RexCall) right).operands.get(0); } else { return Optional.empty(); } } switch (left.getKind()) { case INPUT_REF: final RexInputRef left1 = (RexInputRef) left; String name = fieldNames.get(left1.getIndex()); if (!keyMeta.getKeyColumnNames().contains(name)) { return Optional.empty(); } return translateOp2(op, name, rightLiteral, originNode, keyMeta); case CAST: return translateBinary2(op, ((RexCall) left).operands.get(0), right, originNode, keyMeta); default: return Optional.empty(); } } | /**
* Translates a call to a binary operator. Returns null on failure.
*/ | Translates a call to a binary operator. Returns null on failure | translateBinary2 | {
"repo_name": "julianhyde/calcite",
"path": "innodb/src/main/java/org/apache/calcite/adapter/innodb/InnodbFilterTranslator.java",
"license": "apache-2.0",
"size": 19013
} | [
"com.alibaba.innodb.java.reader.schema.KeyMeta",
"java.util.Optional",
"org.apache.calcite.rex.RexCall",
"org.apache.calcite.rex.RexInputRef",
"org.apache.calcite.rex.RexLiteral",
"org.apache.calcite.rex.RexNode",
"org.apache.calcite.sql.SqlKind",
"org.apache.calcite.sql.type.SqlTypeName"
] | import com.alibaba.innodb.java.reader.schema.KeyMeta; import java.util.Optional; import org.apache.calcite.rex.RexCall; import org.apache.calcite.rex.RexInputRef; import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; import org.apache.calcite.sql.SqlKind; import org.apache.calcite.sql.type.SqlTypeName; | import com.alibaba.innodb.java.reader.schema.*; import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.sql.*; import org.apache.calcite.sql.type.*; | [
"com.alibaba.innodb",
"java.util",
"org.apache.calcite"
] | com.alibaba.innodb; java.util; org.apache.calcite; | 1,645,950 |
static <E> boolean setCountImpl(Multiset<E> self, E element, int oldCount, int newCount) {
checkNonnegative(oldCount, "oldCount");
checkNonnegative(newCount, "newCount");
if (self.count(element) == oldCount) {
self.setCount(element, newCount);
return true;
} else {
return false;
}
} | static <E> boolean setCountImpl(Multiset<E> self, E element, int oldCount, int newCount) { checkNonnegative(oldCount, STR); checkNonnegative(newCount, STR); if (self.count(element) == oldCount) { self.setCount(element, newCount); return true; } else { return false; } } | /**
* An implementation of {@link Multiset#setCount(Object, int, int)}.
*/ | An implementation of <code>Multiset#setCount(Object, int, int)</code> | setCountImpl | {
"repo_name": "simonzhangsm/voltdb",
"path": "third_party/java/src/com/google_voltpatches/common/collect/Multisets.java",
"license": "agpl-3.0",
"size": 37236
} | [
"com.google_voltpatches.common.collect.CollectPreconditions"
] | import com.google_voltpatches.common.collect.CollectPreconditions; | import com.google_voltpatches.common.collect.*; | [
"com.google_voltpatches.common"
] | com.google_voltpatches.common; | 2,779,792 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String circuitName, String peeringName, Context context); | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginDelete( String resourceGroupName, String circuitName, String peeringName, Context context); | /**
* Deletes the specified peering from the specified express route circuit.
*
* @param resourceGroupName The name of the resource group.
* @param circuitName The name of the express route circuit.
* @param peeringName The name of the peering.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/ | Deletes the specified peering from the specified express route circuit | beginDelete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/ExpressRouteCircuitPeeringsClient.java",
"license": "mit",
"size": 20443
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.Context",
"com.azure.core.util.polling.SyncPoller"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; | [
"com.azure.core"
] | com.azure.core; | 1,310,422 |
public String acessalogin(HttpServletRequest request, HttpServletResponse response) {
String msg = "Acesso Permitido";
String msg01 = "Acesso Negado";
try {
UsuarioBean usuarioBean = new UsuarioBean();
usuarioBean.setNmlogin(request.getParameter("login"));
usuarioBean.setNmsenha(request.getParameter("senha"));
UsuarioDao usuarioDao = new UsuarioDao();
usuarioBean = usuarioDao.acessalogin(usuarioBean);
if (usuarioBean != null) {
response.sendRedirect("usuario/principal.jsp?idusuario=" + usuarioBean.getIdusuario() + "&msg=" + msg);
HttpSession sessao = request.getSession();
sessao.setAttribute("UsuarioLogado", usuarioBean);
} else {
response.sendRedirect("index.jsp?msg01=" + msg01);
}
} catch (java.lang.Exception e) {
System.out.println(e.getMessage());
}
return "";
}
| String function(HttpServletRequest request, HttpServletResponse response) { String msg = STR; String msg01 = STR; try { UsuarioBean usuarioBean = new UsuarioBean(); usuarioBean.setNmlogin(request.getParameter("login")); usuarioBean.setNmsenha(request.getParameter("senha")); UsuarioDao usuarioDao = new UsuarioDao(); usuarioBean = usuarioDao.acessalogin(usuarioBean); if (usuarioBean != null) { response.sendRedirect(STR + usuarioBean.getIdusuario() + "&msg=" + msg); HttpSession sessao = request.getSession(); sessao.setAttribute(STR, usuarioBean); } else { response.sendRedirect(STR + msg01); } } catch (java.lang.Exception e) { System.out.println(e.getMessage()); } return ""; } | /**
* author Luis 22/02/2010
*
* @param request
* @param response
* @return
*/ | author Luis 22/02/2010 | acessalogin | {
"repo_name": "vitlroth/treinamento",
"path": "src/bean/UsuarioBean.java",
"license": "apache-2.0",
"size": 8840
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.servlet.http.HttpSession"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 1,860,288 |
private void moveToPrevBlock() {
blk = new BlockId(blk.fileName(), blk.number() + 1);
pg.read(blk);
currentRec = 0 + pointerSize;
}
| void function() { blk = new BlockId(blk.fileName(), blk.number() + 1); pg.read(blk); currentRec = 0 + pointerSize; } | /**
* Moves to the previous log block in reverse order, and positions it after
* the last record in that block.
*/ | Moves to the previous log block in reverse order, and positions it after the last record in that block | moveToPrevBlock | {
"repo_name": "vanilladb/vanillacore",
"path": "src/main/java/org/vanilladb/core/storage/log/LogIterator.java",
"license": "apache-2.0",
"size": 4356
} | [
"org.vanilladb.core.storage.file.BlockId"
] | import org.vanilladb.core.storage.file.BlockId; | import org.vanilladb.core.storage.file.*; | [
"org.vanilladb.core"
] | org.vanilladb.core; | 528,118 |
public void deserializeKeyFileds(CloverBuffer buffer,DataRecord record){
for (int i = 0; i < keyFields.length; i++) {
record.getField(keyFields[i]).deserialize(buffer);
}
} | void function(CloverBuffer buffer,DataRecord record){ for (int i = 0; i < keyFields.length; i++) { record.getField(keyFields[i]).deserialize(buffer); } } | /**
* This method deserializes (restores) content of key fields only (for specified record) from
* buffer.
*
* @param buffer ByteBuffer from which deserialize key fields
* @param record data record whose key fields will be deserialized from ByteBuffer
* @since 29.1.2007
*/ | This method deserializes (restores) content of key fields only (for specified record) from buffer | deserializeKeyFileds | {
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.engine/src/org/jetel/data/RecordComparator.java",
"license": "lgpl-2.1",
"size": 15400
} | [
"org.jetel.util.bytes.CloverBuffer"
] | import org.jetel.util.bytes.CloverBuffer; | import org.jetel.util.bytes.*; | [
"org.jetel.util"
] | org.jetel.util; | 590,003 |
public T caseOr(Or object) {
return null;
} | T function(Or object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Or</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Or</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Or'. This implementation returns null; returning a non-null result will terminate the switch. | caseOr | {
"repo_name": "nhnghia/schora",
"path": "src/fr/lri/schora/expr/util/ExprSwitch.java",
"license": "gpl-2.0",
"size": 21477
} | [
"fr.lri.schora.expr.Or"
] | import fr.lri.schora.expr.Or; | import fr.lri.schora.expr.*; | [
"fr.lri.schora"
] | fr.lri.schora; | 1,117,390 |
protected void doMkCol(WebdavRequest request, WebdavResponse response,
DavResource resource) throws IOException, DavException {
DavResource parentResource = resource.getCollection();
if (parentResource == null || !parentResource.exists() || !parentResource.isCollection()) {
// parent does not exist or is not a collection
response.sendError(DavServletResponse.SC_CONFLICT);
return;
}
// shortcut: mkcol is only allowed on deleted/non-existing resources
if (resource.exists()) {
response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
return;
}
if (request.getContentLength() > 0 || request.getHeader("Transfer-Encoding") != null) {
parentResource.addMember(resource, getInputContext(request, request.getInputStream()));
} else {
parentResource.addMember(resource, getInputContext(request, null));
}
response.setStatus(DavServletResponse.SC_CREATED);
} | void function(WebdavRequest request, WebdavResponse response, DavResource resource) throws IOException, DavException { DavResource parentResource = resource.getCollection(); if (parentResource == null !parentResource.exists() !parentResource.isCollection()) { response.sendError(DavServletResponse.SC_CONFLICT); return; } if (resource.exists()) { response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED); return; } if (request.getContentLength() > 0 request.getHeader(STR) != null) { parentResource.addMember(resource, getInputContext(request, request.getInputStream())); } else { parentResource.addMember(resource, getInputContext(request, null)); } response.setStatus(DavServletResponse.SC_CREATED); } | /**
* The MKCOL method
*
* @param request
* @param response
* @param resource
* @throws IOException
* @throws DavException
*/ | The MKCOL method | doMkCol | {
"repo_name": "SylvesterAbreu/jackrabbit",
"path": "jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/server/AbstractWebdavServlet.java",
"license": "apache-2.0",
"size": 51686
} | [
"java.io.IOException",
"org.apache.jackrabbit.webdav.DavException",
"org.apache.jackrabbit.webdav.DavResource",
"org.apache.jackrabbit.webdav.DavServletResponse",
"org.apache.jackrabbit.webdav.WebdavRequest",
"org.apache.jackrabbit.webdav.WebdavResponse"
] | import java.io.IOException; import org.apache.jackrabbit.webdav.DavException; import org.apache.jackrabbit.webdav.DavResource; import org.apache.jackrabbit.webdav.DavServletResponse; import org.apache.jackrabbit.webdav.WebdavRequest; import org.apache.jackrabbit.webdav.WebdavResponse; | import java.io.*; import org.apache.jackrabbit.webdav.*; | [
"java.io",
"org.apache.jackrabbit"
] | java.io; org.apache.jackrabbit; | 2,785,916 |
//--------------------//
// computeBeamPortion //
//--------------------//
public static BeamPortion computeBeamPortion (BeamInter beam,
double xRest,
Scale scale)
{
int maxDx = scale.toPixels(constants.xInGapMax);
double left = beam.getMedian().getX1();
double right = beam.getMedian().getX2();
if (xRest < (left + maxDx)) {
return LEFT;
} else if (xRest > (right - maxDx)) {
return RIGHT;
} else {
return CENTER;
}
}
//~ Inner Classes ------------------------------------------------------------------------------
//-----------//
// Constants //
//-----------//
private static class Constants
extends ConstantSet
{
private final Scale.Fraction xInGapMax = new Scale.Fraction(
1.0,
"Maximum horizontal overlap between rest & beam");
//
// @SuppressWarnings("unused")
// private final Scale.Fraction xInGapMax_p1 = new Scale.Fraction(
// 1.5,
// "Idem for profile 1");
//
// private final Scale.Fraction xOutGapMax = new Scale.Fraction(
// 0.5,
// "Maximum horizontal gap between rest & beam");
//
// @SuppressWarnings("unused")
// private final Scale.Fraction xOutGapMax_p1 = new Scale.Fraction(
// 0.75,
// "Idem for profile 1");
} | static BeamPortion function (BeamInter beam, double xRest, Scale scale) { int maxDx = scale.toPixels(constants.xInGapMax); double left = beam.getMedian().getX1(); double right = beam.getMedian().getX2(); if (xRest < (left + maxDx)) { return LEFT; } else if (xRest > (right - maxDx)) { return RIGHT; } else { return CENTER; } } private static class Constants extends ConstantSet { private final Scale.Fraction xInGapMax = new Scale.Fraction( 1.0, STR); } | /**
* Determine beam portion where rest is linked.
*
* @param beam provided beam
* @param xRest abscissa of rest center
* @param scale scaling information
* @return the beam portion
*/ | Determine beam portion where rest is linked | computeBeamPortion | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/sig/relation/BeamRestRelation.java",
"license": "agpl-3.0",
"size": 7801
} | [
"org.audiveris.omr.constant.ConstantSet",
"org.audiveris.omr.sheet.Scale",
"org.audiveris.omr.sig.inter.BeamInter"
] | import org.audiveris.omr.constant.ConstantSet; import org.audiveris.omr.sheet.Scale; import org.audiveris.omr.sig.inter.BeamInter; | import org.audiveris.omr.constant.*; import org.audiveris.omr.sheet.*; import org.audiveris.omr.sig.inter.*; | [
"org.audiveris.omr"
] | org.audiveris.omr; | 2,602,700 |
public MatchDetail getMatchById(Long matchId) {
Reader json = api.query(versions.get("match") + "/match/" + matchId);
return gson.fromJson(json, MatchDetail.class);
} | MatchDetail function(Long matchId) { Reader json = api.query(versions.get("match") + STR + matchId); return gson.fromJson(json, MatchDetail.class); } | /**
* Queries for a match by its ID.
*
* @param matchId the ID of the match to lookup
* @return a {@link dto.match.MatchDetail} object containing detailed information for the given match
*/ | Queries for a match by its ID | getMatchById | {
"repo_name": "a64adam/ulti",
"path": "src/main/java/api/Ulti.java",
"license": "mit",
"size": 36883
} | [
"java.io.Reader"
] | import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 715,320 |
public void removeAuthorizationByQualifierAndFunction(String qualifierId, String functionId) {
String query="select a from AuthorizationData a where a.qualifierId=? and a.functionId=?";
List l = getHibernateTemplate().find(query, new String[]{qualifierId, functionId});
getHibernateTemplate().deleteAll(l);
} | void function(String qualifierId, String functionId) { String query=STR; List l = getHibernateTemplate().find(query, new String[]{qualifierId, functionId}); getHibernateTemplate().deleteAll(l); } | /**
* Removes an authorization for a specified qualifier and function
* @param qualifierId
* @param functionId
*/ | Removes an authorization for a specified qualifier and function | removeAuthorizationByQualifierAndFunction | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "samigo/samigo-services/src/java/org/sakaiproject/tool/assessment/facade/authz/integrated/AuthzQueriesFacade.java",
"license": "apache-2.0",
"size": 12928
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,859,242 |
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_RESULT && resultCode == RESULT_OK) {
// Initial Bitmap
Bitmap bmp = decodeSampledBitmapFromFile(mCurrentPhotoPath, 1000, 700);
// Use EcifInterface to rotate image
ExifInterface exif = null;
try { exif = new ExifInterface(mCurrentPhotoPath); }
catch (IOException e) { e.printStackTrace(); }
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
// Get rotated image so its in landscape
Bitmap bmRotated = rotateBitmap(bmp, orientation);
// Set ImageView with picture
imageView.setImageBitmap(bmRotated);
imageView.setDrawingCacheEnabled(true);
imageView.buildDrawingCache();
// Change button text
imageBtn.setText("Image loaded!");
imageBtn.setTextColor(Color.parseColor("#12591d"));
}
}
| void function(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CAMERA_RESULT && resultCode == RESULT_OK) { Bitmap bmp = decodeSampledBitmapFromFile(mCurrentPhotoPath, 1000, 700); ExifInterface exif = null; try { exif = new ExifInterface(mCurrentPhotoPath); } catch (IOException e) { e.printStackTrace(); } int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); Bitmap bmRotated = rotateBitmap(bmp, orientation); imageView.setImageBitmap(bmRotated); imageView.setDrawingCacheEnabled(true); imageView.buildDrawingCache(); imageBtn.setText(STR); imageBtn.setTextColor(Color.parseColor(STR)); } } | /**
* onActivityResult(int, int, Intent) overrides the startActivityForResult so that it
* will display the picture taken from the camera as the thumbnail.
* @param requestCode int
* @param resultCode int
* @param data Intent
*/ | onActivityResult(int, int, Intent) overrides the startActivityForResult so that it will display the picture taken from the camera as the thumbnail | onActivityResult | {
"repo_name": "KyleKoschak/skatespots",
"path": "src/main/java/com/main/skatespots/Form.java",
"license": "mit",
"size": 14396
} | [
"android.content.Intent",
"android.graphics.Bitmap",
"android.graphics.Color",
"android.media.ExifInterface",
"java.io.IOException"
] | import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Color; import android.media.ExifInterface; import java.io.IOException; | import android.content.*; import android.graphics.*; import android.media.*; import java.io.*; | [
"android.content",
"android.graphics",
"android.media",
"java.io"
] | android.content; android.graphics; android.media; java.io; | 2,331,668 |
public static List<UserCustomColumn> createRequiredColumns(
boolean autoincrement) {
return createRequiredColumns(null, autoincrement);
} | static List<UserCustomColumn> function( boolean autoincrement) { return createRequiredColumns(null, autoincrement); } | /**
* Create the required table columns
*
* @param autoincrement
* autoincrement id values
* @return user custom columns
* @since 4.0.0
*/ | Create the required table columns | createRequiredColumns | {
"repo_name": "ngageoint/geopackage-core-java",
"path": "src/main/java/mil/nga/geopackage/extension/related/simple/SimpleAttributesTable.java",
"license": "mit",
"size": 9386
} | [
"java.util.List",
"mil.nga.geopackage.user.custom.UserCustomColumn"
] | import java.util.List; import mil.nga.geopackage.user.custom.UserCustomColumn; | import java.util.*; import mil.nga.geopackage.user.custom.*; | [
"java.util",
"mil.nga.geopackage"
] | java.util; mil.nga.geopackage; | 2,752,225 |
public AbstractFASTInstallPage getPage(IFASTInstallType type) {
//IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(JDIDebugUIPlugin.getUniqueIdentifier(), IJavaDebugUIConstants.EXTENSION_POINT_VM_INSTALL_PAGES);
// TODO we do not have contributed installs yet!
StandardFASTPage standardFASTPage = new StandardFASTPage();
standardFASTPage.setExistingNames(fExistingNames);
return standardFASTPage;
} | AbstractFASTInstallPage function(IFASTInstallType type) { StandardFASTPage standardFASTPage = new StandardFASTPage(); standardFASTPage.setExistingNames(fExistingNames); return standardFASTPage; } | /**
* Returns a page to use for editing a FAST install type
*
* @param type
* @return
*/ | Returns a page to use for editing a FAST install type | getPage | {
"repo_name": "cooked/NDT",
"path": "sc.ndt.launching.fast/src/sc/nrel/nwtc/fast/internal/debug/fres/FASTInstallWizard.java",
"license": "gpl-3.0",
"size": 3453
} | [
"sc.nrel.nwtc.fast.debug.ui.launchConfigurations.AbstractFASTInstallPage",
"sc.nrel.nwtc.fast.launching.IFASTInstallType"
] | import sc.nrel.nwtc.fast.debug.ui.launchConfigurations.AbstractFASTInstallPage; import sc.nrel.nwtc.fast.launching.IFASTInstallType; | import sc.nrel.nwtc.fast.debug.ui.*; import sc.nrel.nwtc.fast.launching.*; | [
"sc.nrel.nwtc"
] | sc.nrel.nwtc; | 2,504,034 |
protected void log(int type, Object message, Throwable t) {
// use a string buffer for better performance
StringBuffer buf = new StringBuffer();
// append date-time if so configured
if(showDateTime) {
buf.append(dateFormatter.format(new Date()));
buf.append(" ");
}
// append a readable representation of the log leve
switch(type) {
case SimpleLog.LOG_LEVEL_TRACE: buf.append("[TRACE] "); break;
case SimpleLog.LOG_LEVEL_DEBUG: buf.append("[DEBUG] "); break;
case SimpleLog.LOG_LEVEL_INFO: buf.append("[INFO] "); break;
case SimpleLog.LOG_LEVEL_WARN: buf.append("[WARN] "); break;
case SimpleLog.LOG_LEVEL_ERROR: buf.append("[ERROR] "); break;
case SimpleLog.LOG_LEVEL_FATAL: buf.append("[FATAL] "); break;
}
// append the name of the log instance if so configured
if( showShortName) {
if( prefix==null ) {
// cut all but the last component of the name for both styles
prefix = logName.substring( logName.lastIndexOf(".") +1) + " - ";
prefix = prefix.substring( prefix.lastIndexOf("/") +1) + "-";
}
buf.append( prefix );
} else if(showLogName) {
buf.append(String.valueOf(logName)).append(" - ");
}
// append the message
buf.append(String.valueOf(message));
// append stack trace if not null
if(t != null) {
buf.append(" <");
buf.append(t.toString());
buf.append(">");
java.io.StringWriter sw= new java.io.StringWriter(1024);
java.io.PrintWriter pw= new java.io.PrintWriter(sw);
t.printStackTrace(pw);
pw.close();
buf.append(sw.toString());
}
// print to System.err
System.err.println(buf.toString());
} | void function(int type, Object message, Throwable t) { StringBuffer buf = new StringBuffer(); if(showDateTime) { buf.append(dateFormatter.format(new Date())); buf.append(" "); } switch(type) { case SimpleLog.LOG_LEVEL_TRACE: buf.append(STR); break; case SimpleLog.LOG_LEVEL_DEBUG: buf.append(STR); break; case SimpleLog.LOG_LEVEL_INFO: buf.append(STR); break; case SimpleLog.LOG_LEVEL_WARN: buf.append(STR); break; case SimpleLog.LOG_LEVEL_ERROR: buf.append(STR); break; case SimpleLog.LOG_LEVEL_FATAL: buf.append(STR); break; } if( showShortName) { if( prefix==null ) { prefix = logName.substring( logName.lastIndexOf(".") +1) + STR; prefix = prefix.substring( prefix.lastIndexOf("/") +1) + "-"; } buf.append( prefix ); } else if(showLogName) { buf.append(String.valueOf(logName)).append(STR); } buf.append(String.valueOf(message)); if(t != null) { buf.append(STR); buf.append(t.toString()); buf.append(">"); java.io.StringWriter sw= new java.io.StringWriter(1024); java.io.PrintWriter pw= new java.io.PrintWriter(sw); t.printStackTrace(pw); pw.close(); buf.append(sw.toString()); } System.err.println(buf.toString()); } | /**
* <p> Do the actual logging.
* This method assembles the message
* and then prints to <code>System.err</code>.</p>
*/ | Do the actual logging. This method assembles the message and then prints to <code>System.err</code> | log | {
"repo_name": "knopflerfish/knopflerfish.org",
"path": "osgi/bundles_opt/commons-logging/src/org/apache/commons/logging/impl/SimpleLog.java",
"license": "bsd-3-clause",
"size": 22229
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,605,027 |
public static void setupFlumeNode(LogicalNodeManager nodesMan,
WALManager walMan, DiskFailoverManager dfMan,
CollectorAckListener colAck, LivenessManager liveman) {
try {
tmpdir = FileUtil.mktempdir();
} catch (Exception e) {
Assert.fail("mk temp dir failed");
}
FlumeConfiguration conf = FlumeConfiguration.get();
conf.set(FlumeConfiguration.AGENT_LOG_DIR_NEW, tmpdir.getAbsolutePath());
mock = new MockMasterRPC();
nodesMan = (nodesMan != null) ? nodesMan : new LogicalNodeManager(NetUtils
.localhost());
walMan = (walMan != null) ? walMan : new NaiveFileWALManager(new File(conf
.getAgentLogsDir()));
dfMan = (dfMan != null) ? dfMan : new NaiveFileFailoverManager(new File(
conf.getAgentLogsDir()));
colAck = (colAck != null) ? colAck : new CollectorAckListener(mock);
liveman = (liveman != null) ? liveman : new LivenessManager(nodesMan, mock,
walMan);
node = new FlumeNode(NetUtils.localhost(), mock, nodesMan, walMan, dfMan,
colAck, liveman);
} | static void function(LogicalNodeManager nodesMan, WALManager walMan, DiskFailoverManager dfMan, CollectorAckListener colAck, LivenessManager liveman) { try { tmpdir = FileUtil.mktempdir(); } catch (Exception e) { Assert.fail(STR); } FlumeConfiguration conf = FlumeConfiguration.get(); conf.set(FlumeConfiguration.AGENT_LOG_DIR_NEW, tmpdir.getAbsolutePath()); mock = new MockMasterRPC(); nodesMan = (nodesMan != null) ? nodesMan : new LogicalNodeManager(NetUtils .localhost()); walMan = (walMan != null) ? walMan : new NaiveFileWALManager(new File(conf .getAgentLogsDir())); dfMan = (dfMan != null) ? dfMan : new NaiveFileFailoverManager(new File( conf.getAgentLogsDir())); colAck = (colAck != null) ? colAck : new CollectorAckListener(mock); liveman = (liveman != null) ? liveman : new LivenessManager(nodesMan, mock, walMan); node = new FlumeNode(NetUtils.localhost(), mock, nodesMan, walMan, dfMan, colAck, liveman); } | /**
* This version allows a particular test case to replace the default
* xxxManager with one that is reasonable for the test.
*
* Any args that are null will default to the "normal" version.
*/ | This version allows a particular test case to replace the default xxxManager with one that is reasonable for the test. Any args that are null will default to the "normal" version | setupFlumeNode | {
"repo_name": "yongkun/flume-0.9.3-cdh3u0-rakuten",
"path": "src/javatest/com/cloudera/util/BenchmarkHarness.java",
"license": "apache-2.0",
"size": 9575
} | [
"com.cloudera.flume.agent.FlumeNode",
"com.cloudera.flume.agent.LivenessManager",
"com.cloudera.flume.agent.LogicalNodeManager",
"com.cloudera.flume.agent.MockMasterRPC",
"com.cloudera.flume.agent.diskfailover.DiskFailoverManager",
"com.cloudera.flume.agent.diskfailover.NaiveFileFailoverManager",
"com.c... | import com.cloudera.flume.agent.FlumeNode; import com.cloudera.flume.agent.LivenessManager; import com.cloudera.flume.agent.LogicalNodeManager; import com.cloudera.flume.agent.MockMasterRPC; import com.cloudera.flume.agent.diskfailover.DiskFailoverManager; import com.cloudera.flume.agent.diskfailover.NaiveFileFailoverManager; import com.cloudera.flume.agent.durability.NaiveFileWALManager; import com.cloudera.flume.agent.durability.WALManager; import com.cloudera.flume.conf.FlumeConfiguration; import com.cloudera.flume.handlers.endtoend.CollectorAckListener; import java.io.File; import org.junit.Assert; | import com.cloudera.flume.agent.*; import com.cloudera.flume.agent.diskfailover.*; import com.cloudera.flume.agent.durability.*; import com.cloudera.flume.conf.*; import com.cloudera.flume.handlers.endtoend.*; import java.io.*; import org.junit.*; | [
"com.cloudera.flume",
"java.io",
"org.junit"
] | com.cloudera.flume; java.io; org.junit; | 1,513,108 |
public static boolean isRecoveredEdits(Path path) {
return path.toString().contains(HConstants.RECOVERED_EDITS_DIR);
} | static boolean function(Path path) { return path.toString().contains(HConstants.RECOVERED_EDITS_DIR); } | /**
* Checks if the given path is the one with 'recovered.edits' dir.
* @param path must not be null
* @return True if we recovered edits
*/ | Checks if the given path is the one with 'recovered.edits' dir | isRecoveredEdits | {
"repo_name": "HubSpot/hbase",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java",
"license": "apache-2.0",
"size": 32996
} | [
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HConstants"
] | import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HConstants; | import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 485,588 |
public FlowLogInner withRetentionPolicy(RetentionPolicyParameters retentionPolicy) {
this.retentionPolicy = retentionPolicy;
return this;
} | FlowLogInner function(RetentionPolicyParameters retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } | /**
* Set parameters that define the retention policy for flow log.
*
* @param retentionPolicy the retentionPolicy value to set
* @return the FlowLogInner object itself.
*/ | Set parameters that define the retention policy for flow log | withRetentionPolicy | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/network/v2020_04_01/implementation/FlowLogInner.java",
"license": "mit",
"size": 7272
} | [
"com.microsoft.azure.management.network.v2020_04_01.RetentionPolicyParameters"
] | import com.microsoft.azure.management.network.v2020_04_01.RetentionPolicyParameters; | import com.microsoft.azure.management.network.v2020_04_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,522,361 |
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
BlockPos blockpos;
if (args.length == 0)
{
blockpos = getCommandSenderAsPlayer(sender).getPosition();
}
else
{
if (args.length != 3 || sender.getEntityWorld() == null)
{
throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
}
blockpos = parseBlockPos(sender, args, 0, true);
}
sender.getEntityWorld().setSpawnPoint(blockpos);
server.getPlayerList().sendPacketToAllPlayers(new SPacketSpawnPosition(blockpos));
notifyCommandListener(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
} | void function(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { BlockPos blockpos; if (args.length == 0) { blockpos = getCommandSenderAsPlayer(sender).getPosition(); } else { if (args.length != 3 sender.getEntityWorld() == null) { throw new WrongUsageException(STR, new Object[0]); } blockpos = parseBlockPos(sender, args, 0, true); } sender.getEntityWorld().setSpawnPoint(blockpos); server.getPlayerList().sendPacketToAllPlayers(new SPacketSpawnPosition(blockpos)); notifyCommandListener(sender, this, STR, new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())}); } | /**
* Callback for when the command is executed
*
* @param server The server instance
* @param sender The sender who executed the command
* @param args The arguments that were passed
*/ | Callback for when the command is executed | execute | {
"repo_name": "SuperUnitato/UnLonely",
"path": "build/tmp/recompileMc/sources/net/minecraft/command/server/CommandSetDefaultSpawnpoint.java",
"license": "lgpl-2.1",
"size": 2847
} | [
"net.minecraft.command.CommandException",
"net.minecraft.command.ICommandSender",
"net.minecraft.command.WrongUsageException",
"net.minecraft.network.play.server.SPacketSpawnPosition",
"net.minecraft.server.MinecraftServer",
"net.minecraft.util.math.BlockPos"
] | import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.network.play.server.SPacketSpawnPosition; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; | import net.minecraft.command.*; import net.minecraft.network.play.server.*; import net.minecraft.server.*; import net.minecraft.util.math.*; | [
"net.minecraft.command",
"net.minecraft.network",
"net.minecraft.server",
"net.minecraft.util"
] | net.minecraft.command; net.minecraft.network; net.minecraft.server; net.minecraft.util; | 2,241,510 |
protected void inboundHeadersReceived(Metadata headers) {
if (inboundPhase() == Phase.STATUS) {
log.log(Level.INFO, "Received headers on closed stream {0} {1}",
new Object[]{id(), headers});
}
if (headers.containsKey(GrpcUtil.MESSAGE_ENCODING_KEY)) {
String messageEncoding = headers.get(GrpcUtil.MESSAGE_ENCODING_KEY);
try {
setDecompressor(messageEncoding);
} catch (IllegalArgumentException e) {
// Don't use INVALID_ARGUMENT since that is for servers to send clients.
Status status = Status.INTERNAL.withDescription("Unable to decompress message from server.")
.withCause(e);
// TODO(carl-mastrangelo): look back into tearing down this stream. sendCancel() can be
// buffered.
inboundTransportError(status);
sendCancel(status);
return;
}
}
inboundPhase(Phase.MESSAGE);
listener.headersRead(headers);
} | void function(Metadata headers) { if (inboundPhase() == Phase.STATUS) { log.log(Level.INFO, STR, new Object[]{id(), headers}); } if (headers.containsKey(GrpcUtil.MESSAGE_ENCODING_KEY)) { String messageEncoding = headers.get(GrpcUtil.MESSAGE_ENCODING_KEY); try { setDecompressor(messageEncoding); } catch (IllegalArgumentException e) { Status status = Status.INTERNAL.withDescription(STR) .withCause(e); inboundTransportError(status); sendCancel(status); return; } } inboundPhase(Phase.MESSAGE); listener.headersRead(headers); } | /**
* Called by transport implementations when they receive headers. When receiving headers
* a transport may determine that there is an error in the protocol at this phase which is
* why this method takes an error {@link Status}. If a transport reports an
* {@link io.grpc.Status.Code#INTERNAL} error
*
* @param headers the parsed headers
*/ | Called by transport implementations when they receive headers. When receiving headers a transport may determine that there is an error in the protocol at this phase which is why this method takes an error <code>Status</code>. If a transport reports an <code>io.grpc.Status.Code#INTERNAL</code> error | inboundHeadersReceived | {
"repo_name": "joshuabezaleel/grpc-java",
"path": "core/src/main/java/io/grpc/internal/AbstractClientStream.java",
"license": "bsd-3-clause",
"size": 11257
} | [
"io.grpc.Metadata",
"io.grpc.Status",
"java.util.logging.Level"
] | import io.grpc.Metadata; import io.grpc.Status; import java.util.logging.Level; | import io.grpc.*; import java.util.logging.*; | [
"io.grpc",
"java.util"
] | io.grpc; java.util; | 223,964 |
public int getButtonColor ()
{
final ITrack t = this.getColumnTrack ();
final int color;
if (!t.doesExist ())
color = LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_BLACK;
else if (isSelect)
color = this.model.getColorManager ().getColorIndex (DAWColor.getColorIndex (t.getColor ()));
else
color = t.isRecArm () ? LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_RED : LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_GREY_LO;
return t.isSelected () ? 0x1000 + color : color;
}
| int function () { final ITrack t = this.getColumnTrack (); final int color; if (!t.doesExist ()) color = LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_BLACK; else if (isSelect) color = this.model.getColorManager ().getColorIndex (DAWColor.getColorIndex (t.getColor ())); else color = t.isRecArm () ? LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_RED : LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_GREY_LO; return t.isSelected () ? 0x1000 + color : color; } | /**
* Get the color to use for the button.
*
* @return The color index, negative if track is selected
*/ | Get the color to use for the button | getButtonColor | {
"repo_name": "git-moss/DrivenByMoss",
"path": "src/main/java/de/mossgrabers/controller/novation/launchkey/maxi/command/trigger/ButtonAreaCommand.java",
"license": "lgpl-3.0",
"size": 3204
} | [
"de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ColorManager",
"de.mossgrabers.framework.daw.DAWColor",
"de.mossgrabers.framework.daw.data.ITrack"
] | import de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ColorManager; import de.mossgrabers.framework.daw.DAWColor; import de.mossgrabers.framework.daw.data.ITrack; | import de.mossgrabers.controller.novation.launchkey.maxi.controller.*; import de.mossgrabers.framework.daw.*; import de.mossgrabers.framework.daw.data.*; | [
"de.mossgrabers.controller",
"de.mossgrabers.framework"
] | de.mossgrabers.controller; de.mossgrabers.framework; | 2,856,751 |
public boolean onPressToSpeakBtnTouch(View v, MotionEvent event, EaseVoiceRecorderCallback recorderCallback) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
try {
if (EaseChatRowVoicePlayClickListener.isPlaying)
EaseChatRowVoicePlayClickListener.currentPlayListener.stopPlayVoice();
v.setPressed(true);
startRecording();
} catch (Exception e) {
v.setPressed(false);
}
return true;
case MotionEvent.ACTION_MOVE:
if (event.getY() < 0) {
showReleaseToCancelHint();
} else {
showMoveUpToCancelHint();
}
return true;
case MotionEvent.ACTION_UP:
v.setPressed(false);
if (event.getY() < 0) {
// discard the recorded audio.
discardRecording();
} else {
// stop recording and send voice file
try {
int length = stopRecoding();
if (length > 0) {
if (recorderCallback != null) {
recorderCallback.onVoiceRecordComplete(getVoiceFilePath(), length);
}
} else if (length == EMError.FILE_INVALID) {
Toast.makeText(context, R.string.Recording_without_permission, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(context, R.string.The_recording_time_is_too_short, Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(context, R.string.send_failure_please, Toast.LENGTH_SHORT).show();
}
}
return true;
default:
discardRecording();
return false;
}
} | boolean function(View v, MotionEvent event, EaseVoiceRecorderCallback recorderCallback) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: try { if (EaseChatRowVoicePlayClickListener.isPlaying) EaseChatRowVoicePlayClickListener.currentPlayListener.stopPlayVoice(); v.setPressed(true); startRecording(); } catch (Exception e) { v.setPressed(false); } return true; case MotionEvent.ACTION_MOVE: if (event.getY() < 0) { showReleaseToCancelHint(); } else { showMoveUpToCancelHint(); } return true; case MotionEvent.ACTION_UP: v.setPressed(false); if (event.getY() < 0) { discardRecording(); } else { try { int length = stopRecoding(); if (length > 0) { if (recorderCallback != null) { recorderCallback.onVoiceRecordComplete(getVoiceFilePath(), length); } } else if (length == EMError.FILE_INVALID) { Toast.makeText(context, R.string.Recording_without_permission, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(context, R.string.The_recording_time_is_too_short, Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); Toast.makeText(context, R.string.send_failure_please, Toast.LENGTH_SHORT).show(); } } return true; default: discardRecording(); return false; } } | /**
* on speak button touched
*
* @param v
* @param event
*/ | on speak button touched | onPressToSpeakBtnTouch | {
"repo_name": "Zhangsongsong/GraduationPro",
"path": "毕业设计/code/android/YYFramework/src/com/hyphenate/easeui/widget/EaseVoiceRecorderView.java",
"license": "apache-2.0",
"size": 8119
} | [
"android.view.MotionEvent",
"android.view.View",
"android.widget.Toast",
"com.hyphenate.EMError",
"com.hyphenate.easeui.widget.chatrow.EaseChatRowVoicePlayClickListener"
] | import android.view.MotionEvent; import android.view.View; import android.widget.Toast; import com.hyphenate.EMError; import com.hyphenate.easeui.widget.chatrow.EaseChatRowVoicePlayClickListener; | import android.view.*; import android.widget.*; import com.hyphenate.*; import com.hyphenate.easeui.widget.chatrow.*; | [
"android.view",
"android.widget",
"com.hyphenate",
"com.hyphenate.easeui"
] | android.view; android.widget; com.hyphenate; com.hyphenate.easeui; | 1,907,175 |
public static String getAppVersion() throws IOException{
String versionString = null;
// Load application's properties, we use this class
Properties mainProperties = new Properties();
// Load the file handle for main.properties
try (FileInputStream file = new FileInputStream(path)) {
// Load all the properties from this file
mainProperties.load(file);
file.close();
}
// Retrieve the property we are interested, the app.version
versionString = mainProperties.getProperty("app.version");
return versionString;
}
| static String function() throws IOException{ String versionString = null; Properties mainProperties = new Properties(); try (FileInputStream file = new FileInputStream(path)) { mainProperties.load(file); file.close(); } versionString = mainProperties.getProperty(STR); return versionString; } | /**
* Gets the app.version property value from
* the ./map.properties file of the base folder
*
* @return app.version string
* @throws IOException
*/ | Gets the app.version property value from the ./map.properties file of the base folder | getAppVersion | {
"repo_name": "mars-sim/mars-sim",
"path": "mars-sim-mapdata/src/main/java/org/mars_sim/mapdata/AppVersion.java",
"license": "gpl-3.0",
"size": 4519
} | [
"java.io.FileInputStream",
"java.io.IOException",
"java.util.Properties"
] | import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,807,798 |
public TCatalogObject reloadPartition(Table tbl, List<TPartitionKeyValue> partitionSpec)
throws CatalogException {
if (!tryLockTable(tbl)) {
throw new CatalogException(String.format("Error reloading partition of table %s " +
"due to lock contention", tbl.getFullName()));
}
try {
long newCatalogVersion = incrementAndGetCatalogVersion();
versionLock_.writeLock().unlock();
HdfsTable hdfsTable = (HdfsTable) tbl;
HdfsPartition hdfsPartition = hdfsTable
.getPartitionFromThriftPartitionSpec(partitionSpec);
// Retrieve partition name from existing partition or construct it from
// the partition spec
String partitionName = hdfsPartition == null
? HdfsTable.constructPartitionName(partitionSpec)
: hdfsPartition.getPartitionName();
LOG.info(String.format("Refreshing partition metadata: %s %s",
hdfsTable.getFullName(), partitionName));
try (MetaStoreClient msClient = getMetaStoreClient()) {
org.apache.hadoop.hive.metastore.api.Partition hmsPartition = null;
try {
hmsPartition = msClient.getHiveClient().getPartition(
hdfsTable.getDb().getName(), hdfsTable.getName(), partitionName);
} catch (NoSuchObjectException e) {
// If partition does not exist in Hive Metastore, remove it from the
// catalog
if (hdfsPartition != null) {
hdfsTable.dropPartition(partitionSpec);
hdfsTable.setCatalogVersion(newCatalogVersion);
}
return hdfsTable.toTCatalogObject();
} catch (Exception e) {
throw new CatalogException("Error loading metadata for partition: "
+ hdfsTable.getFullName() + " " + partitionName, e);
}
hdfsTable.reloadPartition(hdfsPartition, hmsPartition);
}
hdfsTable.setCatalogVersion(newCatalogVersion);
LOG.info(String.format("Refreshed partition metadata: %s %s",
hdfsTable.getFullName(), partitionName));
return hdfsTable.toTCatalogObject();
} finally {
Preconditions.checkState(!versionLock_.isWriteLockedByCurrentThread());
tbl.getLock().unlock();
}
}
public CatalogDeltaLog getDeleteLog() { return deleteLog_; } | TCatalogObject function(Table tbl, List<TPartitionKeyValue> partitionSpec) throws CatalogException { if (!tryLockTable(tbl)) { throw new CatalogException(String.format(STR + STR, tbl.getFullName())); } try { long newCatalogVersion = incrementAndGetCatalogVersion(); versionLock_.writeLock().unlock(); HdfsTable hdfsTable = (HdfsTable) tbl; HdfsPartition hdfsPartition = hdfsTable .getPartitionFromThriftPartitionSpec(partitionSpec); String partitionName = hdfsPartition == null ? HdfsTable.constructPartitionName(partitionSpec) : hdfsPartition.getPartitionName(); LOG.info(String.format(STR, hdfsTable.getFullName(), partitionName)); try (MetaStoreClient msClient = getMetaStoreClient()) { org.apache.hadoop.hive.metastore.api.Partition hmsPartition = null; try { hmsPartition = msClient.getHiveClient().getPartition( hdfsTable.getDb().getName(), hdfsTable.getName(), partitionName); } catch (NoSuchObjectException e) { if (hdfsPartition != null) { hdfsTable.dropPartition(partitionSpec); hdfsTable.setCatalogVersion(newCatalogVersion); } return hdfsTable.toTCatalogObject(); } catch (Exception e) { throw new CatalogException(STR + hdfsTable.getFullName() + " " + partitionName, e); } hdfsTable.reloadPartition(hdfsPartition, hmsPartition); } hdfsTable.setCatalogVersion(newCatalogVersion); LOG.info(String.format(STR, hdfsTable.getFullName(), partitionName)); return hdfsTable.toTCatalogObject(); } finally { Preconditions.checkState(!versionLock_.isWriteLockedByCurrentThread()); tbl.getLock().unlock(); } } public CatalogDeltaLog getDeleteLog() { return deleteLog_; } | /**
* Reloads metadata for the partition defined by the partition spec
* 'partitionSpec' in table 'tbl'. Returns the resulting table's TCatalogObject after
* the partition metadata was reloaded.
*/ | Reloads metadata for the partition defined by the partition spec 'partitionSpec' in table 'tbl'. Returns the resulting table's TCatalogObject after the partition metadata was reloaded | reloadPartition | {
"repo_name": "cloudera/Impala",
"path": "fe/src/main/java/org/apache/impala/catalog/CatalogServiceCatalog.java",
"license": "apache-2.0",
"size": 115678
} | [
"com.google.common.base.Preconditions",
"java.util.List",
"org.apache.hadoop.hive.metastore.api.NoSuchObjectException",
"org.apache.hadoop.hive.metastore.api.Partition",
"org.apache.impala.catalog.MetaStoreClientPool",
"org.apache.impala.thrift.TCatalogObject",
"org.apache.impala.thrift.TPartitionKeyVal... | import com.google.common.base.Preconditions; import java.util.List; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.impala.catalog.MetaStoreClientPool; import org.apache.impala.thrift.TCatalogObject; import org.apache.impala.thrift.TPartitionKeyValue; | import com.google.common.base.*; import java.util.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.impala.catalog.*; import org.apache.impala.thrift.*; | [
"com.google.common",
"java.util",
"org.apache.hadoop",
"org.apache.impala"
] | com.google.common; java.util; org.apache.hadoop; org.apache.impala; | 1,844,966 |
@Configurable
public void addWebApp(WebAppConfig config)
throws Exception
{
String contextPath = getContextPath();
String prefix = config.getId();
if (prefix == null || prefix.equals("") || prefix.equals("/"))
throw new ConfigException(L.l("'{0}' is an illegal sub web-app id.",
prefix));
WebAppContainer container = _parent;
DeployContainer<WebAppController> appGenerator;
appGenerator = _parent.getWebAppGenerator();
WebAppSingleDeployGenerator deploy;
deploy = new WebAppSingleDeployGenerator(appGenerator,
container, config);
deploy.setURLPrefix(contextPath + prefix);
// deploy.setParent(_controller);
// XXX: The parent is added in the init()
// _parent.addWebAppDeploy(gen);
deploy.setParentWebApp(_controller);
deploy.setParentClassLoader(getClassLoader());
deploy.setContainer(container);
for (WebAppConfig configDefault : _webAppDefaultList)
deploy.addWebAppDefault(configDefault);
String appDir = config.getRootDirectory();
if (appDir == null)
appDir = "./" + prefix;
Path root = PathBuilder.lookupPath(appDir, null, getRootDirectory());
deploy.setRootDirectory(root);
deploy.init();
_parent.addDeploy(deploy);
//_appGenerators.add(deploy);
//deploy.deploy();
} | void function(WebAppConfig config) throws Exception { String contextPath = getContextPath(); String prefix = config.getId(); if (prefix == null prefix.equals(STR/STR'{0}' is an illegal sub web-app id.STR./" + prefix; Path root = PathBuilder.lookupPath(appDir, null, getRootDirectory()); deploy.setRootDirectory(root); deploy.init(); _parent.addDeploy(deploy); } | /**
* Adds a sub web-app
*/ | Adds a sub web-app | addWebApp | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/server/webapp/WebApp.java",
"license": "gpl-2.0",
"size": 130864
} | [
"com.caucho.config.types.PathBuilder",
"com.caucho.vfs.Path"
] | import com.caucho.config.types.PathBuilder; import com.caucho.vfs.Path; | import com.caucho.config.types.*; import com.caucho.vfs.*; | [
"com.caucho.config",
"com.caucho.vfs"
] | com.caucho.config; com.caucho.vfs; | 116,806 |
static byte[] createCloseRowBefore(byte[] row) {
if (row.length == 0) {
return MAX_BYTE_ARRAY;
}
if (row[row.length - 1] == 0) {
return Arrays.copyOf(row, row.length - 1);
} else {
byte[] nextRow = new byte[row.length + MAX_BYTE_ARRAY.length];
System.arraycopy(row, 0, nextRow, 0, row.length - 1);
nextRow[row.length - 1] = (byte) ((row[row.length - 1] & 0xFF) - 1);
System.arraycopy(MAX_BYTE_ARRAY, 0, nextRow, row.length, MAX_BYTE_ARRAY.length);
return nextRow;
}
} | static byte[] createCloseRowBefore(byte[] row) { if (row.length == 0) { return MAX_BYTE_ARRAY; } if (row[row.length - 1] == 0) { return Arrays.copyOf(row, row.length - 1); } else { byte[] nextRow = new byte[row.length + MAX_BYTE_ARRAY.length]; System.arraycopy(row, 0, nextRow, 0, row.length - 1); nextRow[row.length - 1] = (byte) ((row[row.length - 1] & 0xFF) - 1); System.arraycopy(MAX_BYTE_ARRAY, 0, nextRow, row.length, MAX_BYTE_ARRAY.length); return nextRow; } } | /**
* Create a row before the specified row and very close to the specified row.
*/ | Create a row before the specified row and very close to the specified row | createCloseRowBefore | {
"repo_name": "HubSpot/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionUtils.java",
"license": "apache-2.0",
"size": 27246
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 542,236 |
private static List<InetAddress> buildSnmpAddressList(final Map<String, IfCollector> collectorMap, final IfSnmpCollector snmpc) {
final List<InetAddress> addresses = new ArrayList<InetAddress>();
// Verify that we have SNMP info
if (snmpc == null) {
LOG.debug("buildSnmpAddressList: no SNMP info available...");
return addresses;
}
for (final IfCollector ifc : collectorMap.values()) {
// Add eligible target.
final InetAddress ifaddr = ifc.getTarget();
if (addresses.contains(ifaddr) == false) {
if (SuspectEventProcessor.supportsSnmp(ifc.getSupportedProtocols()) && SuspectEventProcessor.hasIfIndex(ifaddr, snmpc)) {
LOG.debug("buildSnmpAddressList: adding target interface {} temporarily marked as primary!", str(ifaddr));
addresses.add(ifaddr);
}
}
// Now go through list of sub-targets
if (ifc.hasAdditionalTargets()) {
final Map<InetAddress, List<SupportedProtocol>> subTargets = ifc.getAdditionalTargets();
for (final Map.Entry<InetAddress,List<SupportedProtocol>> entry : subTargets.entrySet()) {
final InetAddress xifaddr = entry.getKey();
final List<SupportedProtocol> protocols = entry.getValue();
// Add eligible subtargets.
if (addresses.contains(xifaddr) == false) {
if (SuspectEventProcessor.supportsSnmp(protocols) && SuspectEventProcessor.hasIfIndex(xifaddr, snmpc)) {
LOG.debug("buildSnmpAddressList: adding subtarget interface {} temporarily marked as primary!", str(xifaddr));
addresses.add(xifaddr);
}
}
}
}
}
return addresses;
} | static List<InetAddress> function(final Map<String, IfCollector> collectorMap, final IfSnmpCollector snmpc) { final List<InetAddress> addresses = new ArrayList<InetAddress>(); if (snmpc == null) { LOG.debug(STR); return addresses; } for (final IfCollector ifc : collectorMap.values()) { final InetAddress ifaddr = ifc.getTarget(); if (addresses.contains(ifaddr) == false) { if (SuspectEventProcessor.supportsSnmp(ifc.getSupportedProtocols()) && SuspectEventProcessor.hasIfIndex(ifaddr, snmpc)) { LOG.debug(STR, str(ifaddr)); addresses.add(ifaddr); } } if (ifc.hasAdditionalTargets()) { final Map<InetAddress, List<SupportedProtocol>> subTargets = ifc.getAdditionalTargets(); for (final Map.Entry<InetAddress,List<SupportedProtocol>> entry : subTargets.entrySet()) { final InetAddress xifaddr = entry.getKey(); final List<SupportedProtocol> protocols = entry.getValue(); if (addresses.contains(xifaddr) == false) { if (SuspectEventProcessor.supportsSnmp(protocols) && SuspectEventProcessor.hasIfIndex(xifaddr, snmpc)) { LOG.debug(STR, str(xifaddr)); addresses.add(xifaddr); } } } } } return addresses; } | /**
* Builds a list of InetAddress objects representing each of the interfaces
* from the collector map object which support SNMP and have a valid
* ifIndex.
*
* @param collectorMap
* Map of IfCollector objects containing data collected from all
* of the node's interfaces.
* @param snmpc
* Reference to SNMP collection object
*
* @return List of InetAddress objects.
*/ | Builds a list of InetAddress objects representing each of the interfaces from the collector map object which support SNMP and have a valid ifIndex | buildSnmpAddressList | {
"repo_name": "roskens/opennms-pre-github",
"path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/RescanProcessor.java",
"license": "agpl-3.0",
"size": 151155
} | [
"java.net.InetAddress",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.opennms.core.utils.InetAddressUtils",
"org.opennms.netmgt.capsd.IfCollector"
] | import java.net.InetAddress; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.opennms.core.utils.InetAddressUtils; import org.opennms.netmgt.capsd.IfCollector; | import java.net.*; import java.util.*; import org.opennms.core.utils.*; import org.opennms.netmgt.capsd.*; | [
"java.net",
"java.util",
"org.opennms.core",
"org.opennms.netmgt"
] | java.net; java.util; org.opennms.core; org.opennms.netmgt; | 1,166,148 |
public void setTickMarkPosition(DateTickMarkPosition position) {
if (position == null) {
throw new IllegalArgumentException("Null 'position' argument.");
}
this.tickMarkPosition = position;
notifyListeners(new AxisChangeEvent(this));
} | void function(DateTickMarkPosition position) { if (position == null) { throw new IllegalArgumentException(STR); } this.tickMarkPosition = position; notifyListeners(new AxisChangeEvent(this)); } | /**
* Sets the tick mark position (start, middle or end of the time period)
* and sends an {@link AxisChangeEvent} to all registered listeners.
*
* @param position the position (<code>null</code> not permitted).
*/ | Sets the tick mark position (start, middle or end of the time period) and sends an <code>AxisChangeEvent</code> to all registered listeners | setTickMarkPosition | {
"repo_name": "djun100/afreechart",
"path": "src/org/afree/chart/axis/DateAxis.java",
"license": "lgpl-3.0",
"size": 74566
} | [
"org.afree.chart.event.AxisChangeEvent"
] | import org.afree.chart.event.AxisChangeEvent; | import org.afree.chart.event.*; | [
"org.afree.chart"
] | org.afree.chart; | 2,341,127 |
public boolean email(final Principal principal,
final String attribute,
final String text, final String from,
final String subject,
final String cc, final String bcc) {
if (StringUtils.isNotBlank(attribute) && principal.getAttributes().containsKey(attribute) && isMailSenderDefined()) {
val to = getFirstAttributeByName(principal, attribute);
if (to.isPresent()) {
return email(text, from, subject, to.get().toString(), cc, bcc);
}
}
LOGGER.debug("Email attribute [{}] cannot be found or no configuration for email provider is defined", attribute);
return false;
} | boolean function(final Principal principal, final String attribute, final String text, final String from, final String subject, final String cc, final String bcc) { if (StringUtils.isNotBlank(attribute) && principal.getAttributes().containsKey(attribute) && isMailSenderDefined()) { val to = getFirstAttributeByName(principal, attribute); if (to.isPresent()) { return email(text, from, subject, to.get().toString(), cc, bcc); } } LOGGER.debug(STR, attribute); return false; } | /**
* Email boolean.
*
* @param principal the principal
* @param attribute the email attribute
* @param text the text
* @param from the from
* @param subject the subject
* @param cc the cc
* @param bcc the bcc
* @return true/false
*/ | Email boolean | email | {
"repo_name": "GIP-RECIA/cas",
"path": "core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/io/CommunicationsManager.java",
"license": "apache-2.0",
"size": 5975
} | [
"org.apache.commons.lang3.StringUtils",
"org.apereo.cas.authentication.principal.Principal"
] | import org.apache.commons.lang3.StringUtils; import org.apereo.cas.authentication.principal.Principal; | import org.apache.commons.lang3.*; import org.apereo.cas.authentication.principal.*; | [
"org.apache.commons",
"org.apereo.cas"
] | org.apache.commons; org.apereo.cas; | 377,356 |
public IRandGen getRandgen() {
return randgen;
}
| IRandGen function() { return randgen; } | /**
* <p>
* Returns the random generator used in mutation
* </p>
* @return IRandGen Random generator
*/ | Returns the random generator used in mutation | getRandgen | {
"repo_name": "SCI2SUGR/KEEL",
"path": "src/keel/Algorithms/Neural_Networks/NNEP_Common/mutators/parametric/LinearNeuronParametricMutator.java",
"license": "gpl-3.0",
"size": 6699
} | [
"net.sf.jclec.util.random.IRandGen"
] | import net.sf.jclec.util.random.IRandGen; | import net.sf.jclec.util.random.*; | [
"net.sf.jclec"
] | net.sf.jclec; | 2,134,008 |
@Nonnull
public java.util.concurrent.CompletableFuture<OutlookCategory> deleteAsync() {
return sendAsync(HttpMethod.DELETE, null);
} | java.util.concurrent.CompletableFuture<OutlookCategory> function() { return sendAsync(HttpMethod.DELETE, null); } | /**
* Delete this item from the service
*
* @return a future with the deletion result
*/ | Delete this item from the service | deleteAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/OutlookCategoryRequest.java",
"license": "mit",
"size": 5937
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.OutlookCategory"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.OutlookCategory; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 2,856,210 |
public Iterator<Item> getItemsIterator()
{
if ( _items.size() == 0 )
return emptyItemIterator();
else
return _items.iterator();
} | Iterator<Item> function() { if ( _items.size() == 0 ) return emptyItemIterator(); else return _items.iterator(); } | /**
* Return all possible child items or null
*/ | Return all possible child items or null | getItemsIterator | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/relaxng/program/ChoiceItem.java",
"license": "gpl-2.0",
"size": 11679
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,773,467 |
boolean atBoundary(PlanNode critNode, PlanNode sourceNode) {
// Walk from source node to critNode to check each intervening node
PlanNode currentNode = sourceNode.getParent();
while(currentNode != critNode) {
if(currentNode.getType() != NodeConstants.Types.SELECT) {
return false;
}
currentNode = currentNode.getParent();
}
return true;
} | boolean atBoundary(PlanNode critNode, PlanNode sourceNode) { PlanNode currentNode = sourceNode.getParent(); while(currentNode != critNode) { if(currentNode.getType() != NodeConstants.Types.SELECT) { return false; } currentNode = currentNode.getParent(); } return true; } | /**
* All nodes between critNode and sourceNode must be SELECT nodes.
*/ | All nodes between critNode and sourceNode must be SELECT nodes | atBoundary | {
"repo_name": "kenweezy/teiid",
"path": "engine/src/main/java/org/teiid/query/optimizer/relational/rules/RulePushSelectCriteria.java",
"license": "lgpl-2.1",
"size": 38793
} | [
"org.teiid.query.optimizer.relational.plantree.NodeConstants",
"org.teiid.query.optimizer.relational.plantree.PlanNode"
] | import org.teiid.query.optimizer.relational.plantree.NodeConstants; import org.teiid.query.optimizer.relational.plantree.PlanNode; | import org.teiid.query.optimizer.relational.plantree.*; | [
"org.teiid.query"
] | org.teiid.query; | 1,470,336 |
public static void clearTempFiles() {
String userFolderPath = getUserFolderPath(false);
File file = new File(userFolderPath);
deleteDir(file);
}
| static void function() { String userFolderPath = getUserFolderPath(false); File file = new File(userFolderPath); deleteDir(file); } | /**
* Clear temp files.
*/ | Clear temp files | clearTempFiles | {
"repo_name": "kiswanij/jk-util",
"path": "src/main/java/com/jk/util/JKIOUtil.java",
"license": "mit",
"size": 21956
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,484,789 |
public static APIMonetizationInfoDTO getMonetizedTiersDTO(String uuid, String organization,
Map<String, String> monetizedPoliciesToPlanMapping)
throws APIManagementException {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
API api = apiProvider.getLightweightAPIByUUID(uuid, organization);
APIMonetizationInfoDTO apiMonetizationInfoDTO = new APIMonetizationInfoDTO();
apiMonetizationInfoDTO.setEnabled(api.getMonetizationStatus());
apiMonetizationInfoDTO.setProperties(monetizedPoliciesToPlanMapping);
return apiMonetizationInfoDTO;
} | static APIMonetizationInfoDTO function(String uuid, String organization, Map<String, String> monetizedPoliciesToPlanMapping) throws APIManagementException { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); API api = apiProvider.getLightweightAPIByUUID(uuid, organization); APIMonetizationInfoDTO apiMonetizationInfoDTO = new APIMonetizationInfoDTO(); apiMonetizationInfoDTO.setEnabled(api.getMonetizationStatus()); apiMonetizationInfoDTO.setProperties(monetizedPoliciesToPlanMapping); return apiMonetizationInfoDTO; } | /**
* Get map of monetized policies to plan mapping.
*
* @param uuid apiuuid
* @param organization organization
* @param monetizedPoliciesToPlanMapping map of monetized policies to plan mapping
* @return DTO of map of monetized policies to plan mapping
* @throws APIManagementException if failed to construct the DTO
*/ | Get map of monetized policies to plan mapping | getMonetizedTiersDTO | {
"repo_name": "malinthaprasan/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java",
"license": "apache-2.0",
"size": 149892
} | [
"java.util.Map",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.APIProvider",
"org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil",
"org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIMonetizationInfoDTO"
] | import java.util.Map; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil; import org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.APIMonetizationInfoDTO; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.rest.api.common.*; import org.wso2.carbon.apimgt.rest.api.publisher.v1.dto.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 155,343 |
public static JSONObject deleteImage(String apiKey, String uuid)
throws CatchoomException, IOException, NoSuchAlgorithmException {
return Commons.deleteObject(apiKey, "image", uuid, PROXY);
}
//</editor-fold> | static JSONObject function(String apiKey, String uuid) throws CatchoomException, IOException, NoSuchAlgorithmException { return Commons.deleteObject(apiKey, "image", uuid, PROXY); } | /**
* Delete an image, identified by uuid
*
* @param apiKey your API key
* @param uuid the image uuid
* @return a JSON object with the server response
* @throws CatchoomException if the parameters are incorrect or the server response is not valid
* @throws IOException if something goes wrong in the interaction with the server
* @throws java.security.NoSuchAlgorithmException if TLS 1.2 is not available
*/ | Delete an image, identified by uuid | deleteImage | {
"repo_name": "NoxWizard86/JCraftAR",
"path": "src/main/java/com/noxwizard/jcraftar/Management.java",
"license": "apache-2.0",
"size": 40315
} | [
"java.io.IOException",
"java.security.NoSuchAlgorithmException",
"org.json.JSONObject"
] | import java.io.IOException; import java.security.NoSuchAlgorithmException; import org.json.JSONObject; | import java.io.*; import java.security.*; import org.json.*; | [
"java.io",
"java.security",
"org.json"
] | java.io; java.security; org.json; | 2,623,117 |
public static int convert(EnumSet<XAttrSetFlag> flag) {
int value = 0;
if (flag.contains(XAttrSetFlag.CREATE)) {
value |= XAttrSetFlagProto.XATTR_CREATE.getNumber();
}
if (flag.contains(XAttrSetFlag.REPLACE)) {
value |= XAttrSetFlagProto.XATTR_REPLACE.getNumber();
}
return value;
} | static int function(EnumSet<XAttrSetFlag> flag) { int value = 0; if (flag.contains(XAttrSetFlag.CREATE)) { value = XAttrSetFlagProto.XATTR_CREATE.getNumber(); } if (flag.contains(XAttrSetFlag.REPLACE)) { value = XAttrSetFlagProto.XATTR_REPLACE.getNumber(); } return value; } | /**
* The flag field in PB is a bitmask whose values are the same a the
* emum values of XAttrSetFlag
*/ | The flag field in PB is a bitmask whose values are the same a the emum values of XAttrSetFlag | convert | {
"repo_name": "ZhangXFeng/hadoop",
"path": "src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java",
"license": "apache-2.0",
"size": 115361
} | [
"java.util.EnumSet",
"org.apache.hadoop.fs.XAttrSetFlag",
"org.apache.hadoop.hdfs.protocol.proto.XAttrProtos"
] | import java.util.EnumSet; import org.apache.hadoop.fs.XAttrSetFlag; import org.apache.hadoop.hdfs.protocol.proto.XAttrProtos; | import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.proto.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,175,127 |
public static String getRelativeLinkTo(Item p) {
Map<Object,String> ancestors = new HashMap<>();
View view=null;
StaplerRequest request = Stapler.getCurrentRequest();
for( Ancestor a : request.getAncestors() ) {
ancestors.put(a.getObject(),a.getRelativePath());
if(a.getObject() instanceof View)
view = (View) a.getObject();
}
String path = ancestors.get(p);
if(path!=null) {
return normalizeURI(path + '/');
}
Item i=p;
String url = "";
while(true) {
ItemGroup ig = i.getParent();
url = i.getShortUrl()+url;
if(ig== Jenkins.get() || (view != null && ig == view.getOwner().getItemGroup())) {
assert i instanceof TopLevelItem;
if (view != null) {
// assume p and the current page belong to the same view, so return a relative path
// (even if they did not, View.getItem does not by default verify ownership)
return normalizeURI(ancestors.get(view)+'/'+url);
} else {
// otherwise return a path from the root Hudson
return normalizeURI(request.getContextPath()+'/'+p.getUrl());
}
}
path = ancestors.get(ig);
if(path!=null) {
return normalizeURI(path+'/'+url);
}
assert ig instanceof Item; // if not, ig must have been the Hudson instance
i = (Item) ig;
}
} | static String function(Item p) { Map<Object,String> ancestors = new HashMap<>(); View view=null; StaplerRequest request = Stapler.getCurrentRequest(); for( Ancestor a : request.getAncestors() ) { ancestors.put(a.getObject(),a.getRelativePath()); if(a.getObject() instanceof View) view = (View) a.getObject(); } String path = ancestors.get(p); if(path!=null) { return normalizeURI(path + '/'); } Item i=p; String url = ""; while(true) { ItemGroup ig = i.getParent(); url = i.getShortUrl()+url; if(ig== Jenkins.get() (view != null && ig == view.getOwner().getItemGroup())) { assert i instanceof TopLevelItem; if (view != null) { return normalizeURI(ancestors.get(view)+'/'+url); } else { return normalizeURI(request.getContextPath()+'/'+p.getUrl()); } } path = ancestors.get(ig); if(path!=null) { return normalizeURI(path+'/'+url); } assert ig instanceof Item; i = (Item) ig; } } | /**
* Computes the relative path from the current page to the given item.
*/ | Computes the relative path from the current page to the given item | getRelativeLinkTo | {
"repo_name": "rsandell/jenkins",
"path": "core/src/main/java/hudson/Functions.java",
"license": "mit",
"size": 84169
} | [
"hudson.model.Item",
"hudson.model.ItemGroup",
"hudson.model.TopLevelItem",
"hudson.model.View",
"java.util.HashMap",
"java.util.Map",
"org.kohsuke.stapler.Ancestor",
"org.kohsuke.stapler.Stapler",
"org.kohsuke.stapler.StaplerRequest"
] | import hudson.model.Item; import hudson.model.ItemGroup; import hudson.model.TopLevelItem; import hudson.model.View; import java.util.HashMap; import java.util.Map; import org.kohsuke.stapler.Ancestor; import org.kohsuke.stapler.Stapler; import org.kohsuke.stapler.StaplerRequest; | import hudson.model.*; import java.util.*; import org.kohsuke.stapler.*; | [
"hudson.model",
"java.util",
"org.kohsuke.stapler"
] | hudson.model; java.util; org.kohsuke.stapler; | 2,576,188 |
public static void setScannerCaching(Job job, int batchSize) {
job.getConfiguration().setInt("hbase.client.scanner.caching", batchSize);
} | static void function(Job job, int batchSize) { job.getConfiguration().setInt(STR, batchSize); } | /**
* Sets the number of rows to return and cache with each scanner iteration.
* Higher caching values will enable faster mapreduce jobs at the expense of
* requiring more heap to contain the cached rows.
*
* @param job The current job to adjust.
* @param batchSize The number of rows to return in batch with each scanner
* iteration.
*/ | Sets the number of rows to return and cache with each scanner iteration. Higher caching values will enable faster mapreduce jobs at the expense of requiring more heap to contain the cached rows | setScannerCaching | {
"repo_name": "HubSpot/hbase",
"path": "hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java",
"license": "apache-2.0",
"size": 46774
} | [
"org.apache.hadoop.mapreduce.Job"
] | import org.apache.hadoop.mapreduce.Job; | import org.apache.hadoop.mapreduce.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,374,436 |
public void delete(String storeName)
throws IOException; | void function(String storeName) throws IOException; | /**
* Delete a store.
*
* @param storeName store name
* @throws IOException
*/ | Delete a store | delete | {
"repo_name": "chavdar/gobblin",
"path": "gobblin-metastore/src/main/java/gobblin/metastore/StateStore.java",
"license": "apache-2.0",
"size": 4627
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 780,492 |
public static MPPCostCollector createCollector (MPPOrder order,
int M_Product_ID,
int M_Locator_ID,
int M_AttributeSetInstance_ID,
int S_Resource_ID,
int PP_Order_BOMLine_ID,
int PP_Order_Node_ID,
int C_DocType_ID,
String CostCollectorType,
Timestamp movementdate,
BigDecimal qty,
BigDecimal scrap,
BigDecimal reject,
int durationSetup,
BigDecimal duration
)
{
MPPCostCollector cc = new MPPCostCollector(order);
cc.setPP_Order_BOMLine_ID(PP_Order_BOMLine_ID);
cc.setPP_Order_Node_ID(PP_Order_Node_ID);
cc.setC_DocType_ID(C_DocType_ID);
cc.setC_DocTypeTarget_ID(C_DocType_ID);
cc.setCostCollectorType(CostCollectorType);
cc.setDocAction(MPPCostCollector.DOCACTION_Complete);
cc.setDocStatus(MPPCostCollector.DOCSTATUS_Drafted);
cc.setIsActive(true);
cc.setM_Locator_ID(M_Locator_ID);
cc.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
cc.setS_Resource_ID(S_Resource_ID);
cc.setMovementDate(movementdate);
cc.setDateAcct(movementdate);
cc.setMovementQty(qty);
cc.setScrappedQty(scrap);
cc.setQtyReject(reject);
cc.setSetupTimeReal(new BigDecimal(durationSetup));
cc.setDurationReal(duration);
cc.setPosted(false);
cc.setProcessed(false);
cc.setProcessing(false);
cc.setUser1_ID(order.getUser1_ID());
cc.setUser2_ID(order.getUser2_ID());
cc.setM_Product_ID(M_Product_ID);
if(PP_Order_Node_ID > 0)
{
cc.setIsSubcontracting(PP_Order_Node_ID);
}
// If this is an material issue, we should use BOM Line's UOM
if (PP_Order_BOMLine_ID > 0)
{
cc.setC_UOM_ID(0); // we set the BOM Line UOM on beforeSave
}
cc.saveEx();
if (!cc.processIt(MPPCostCollector.DOCACTION_Complete))
{
throw new AdempiereException(cc.getProcessMsg());
}
cc.saveEx();
return cc;
}
| static MPPCostCollector function (MPPOrder order, int M_Product_ID, int M_Locator_ID, int M_AttributeSetInstance_ID, int S_Resource_ID, int PP_Order_BOMLine_ID, int PP_Order_Node_ID, int C_DocType_ID, String CostCollectorType, Timestamp movementdate, BigDecimal qty, BigDecimal scrap, BigDecimal reject, int durationSetup, BigDecimal duration ) { MPPCostCollector cc = new MPPCostCollector(order); cc.setPP_Order_BOMLine_ID(PP_Order_BOMLine_ID); cc.setPP_Order_Node_ID(PP_Order_Node_ID); cc.setC_DocType_ID(C_DocType_ID); cc.setC_DocTypeTarget_ID(C_DocType_ID); cc.setCostCollectorType(CostCollectorType); cc.setDocAction(MPPCostCollector.DOCACTION_Complete); cc.setDocStatus(MPPCostCollector.DOCSTATUS_Drafted); cc.setIsActive(true); cc.setM_Locator_ID(M_Locator_ID); cc.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID); cc.setS_Resource_ID(S_Resource_ID); cc.setMovementDate(movementdate); cc.setDateAcct(movementdate); cc.setMovementQty(qty); cc.setScrappedQty(scrap); cc.setQtyReject(reject); cc.setSetupTimeReal(new BigDecimal(durationSetup)); cc.setDurationReal(duration); cc.setPosted(false); cc.setProcessed(false); cc.setProcessing(false); cc.setUser1_ID(order.getUser1_ID()); cc.setUser2_ID(order.getUser2_ID()); cc.setM_Product_ID(M_Product_ID); if(PP_Order_Node_ID > 0) { cc.setIsSubcontracting(PP_Order_Node_ID); } if (PP_Order_BOMLine_ID > 0) { cc.setC_UOM_ID(0); } cc.saveEx(); if (!cc.processIt(MPPCostCollector.DOCACTION_Complete)) { throw new AdempiereException(cc.getProcessMsg()); } cc.saveEx(); return cc; } | /**
* Create & Complete Cost Collector
* @param order
* @param M_Product_ID
* @param M_Locator_ID
* @param M_AttributeSetInstance_ID
* @param S_Resource_ID
* @param PP_Order_BOMLine_ID
* @param PP_Order_Node_ID
* @param C_DocType_ID
* @param CostCollectorType
* @param movementdate
* @param qty
* @param scrap
* @param reject
* @param durationSetup
* @param duration
* @param trxName
* @return completed cost collector
*/ | Create & Complete Cost Collector | createCollector | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiereLibero/extension/eevolution/libero/src/main/java/org/eevolution/model/MPPCostCollector.java",
"license": "gpl-2.0",
"size": 29074
} | [
"java.math.BigDecimal",
"java.sql.Timestamp",
"org.adempiere.exceptions.AdempiereException"
] | import java.math.BigDecimal; import java.sql.Timestamp; import org.adempiere.exceptions.AdempiereException; | import java.math.*; import java.sql.*; import org.adempiere.exceptions.*; | [
"java.math",
"java.sql",
"org.adempiere.exceptions"
] | java.math; java.sql; org.adempiere.exceptions; | 2,459,733 |
RegionDigraph getFlatDigraph() throws BundleException, InvalidSyntaxException;
/**
* Returns a mapping between regions and a set of bundle {@link Resource resources} | RegionDigraph getFlatDigraph() throws BundleException, InvalidSyntaxException; /** * Returns a mapping between regions and a set of bundle {@link Resource resources} | /**
* Return directed graph of {@link org.eclipse.equinox.region.Region regions} after resolution.
* @return
* @throws BundleException
* @throws InvalidSyntaxException
*/ | Return directed graph of <code>org.eclipse.equinox.region.Region regions</code> after resolution | getFlatDigraph | {
"repo_name": "grgrzybek/karaf",
"path": "features/core/src/main/java/org/apache/karaf/features/internal/region/SubsystemResolverResult.java",
"license": "apache-2.0",
"size": 2709
} | [
"org.eclipse.equinox.region.RegionDigraph",
"org.osgi.framework.BundleException",
"org.osgi.framework.InvalidSyntaxException",
"org.osgi.resource.Resource"
] | import org.eclipse.equinox.region.RegionDigraph; import org.osgi.framework.BundleException; import org.osgi.framework.InvalidSyntaxException; import org.osgi.resource.Resource; | import org.eclipse.equinox.region.*; import org.osgi.framework.*; import org.osgi.resource.*; | [
"org.eclipse.equinox",
"org.osgi.framework",
"org.osgi.resource"
] | org.eclipse.equinox; org.osgi.framework; org.osgi.resource; | 1,732,925 |
public static void fetchDeferredAppLinkData(Context context, CompletionHandler completionHandler) {
fetchDeferredAppLinkData(context, null, completionHandler);
}
| static void function(Context context, CompletionHandler completionHandler) { fetchDeferredAppLinkData(context, null, completionHandler); } | /**
* Asynchronously fetches app link information that might have been stored for use
* after installation of the app
* @param context The context
* @param completionHandler CompletionHandler to be notified with the AppLinkData object or null if none is
* available. Must not be null.
*/ | Asynchronously fetches app link information that might have been stored for use after installation of the app | fetchDeferredAppLinkData | {
"repo_name": "Ramanujakalyan/Inherit",
"path": "ui/plugins/com.phonegap.plugins.facebookconnect/platforms/android/FacebookLib/src/com/facebook/AppLinkData.java",
"license": "unlicense",
"size": 17545
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 1,903,811 |
private TimePeriod parsePeriod(String periodDef, long defaultValue) {
try {
periodDef = Val.chkStr(periodDef);
if (periodDef.isEmpty()) {
return new TimePeriod(defaultValue);
}
return TimePeriod.parseValue(periodDef);
} catch (IllegalArgumentException ex) {
return new TimePeriod(defaultValue);
}
} | TimePeriod function(String periodDef, long defaultValue) { try { periodDef = Val.chkStr(periodDef); if (periodDef.isEmpty()) { return new TimePeriod(defaultValue); } return TimePeriod.parseValue(periodDef); } catch (IllegalArgumentException ex) { return new TimePeriod(defaultValue); } } | /**
* Safely parses time period giving default value if time period can not be parsed.
* @param periodDef period definition to parse
* @param defaultValue default value if period definition cannot be parsed
* @return time period
*/ | Safely parses time period giving default value if time period can not be parsed | parsePeriod | {
"repo_name": "GeoinformationSystems/geoportal-server",
"path": "geoportal/src/com/esri/gpt/framework/context/ApplicationConfigurationLoader.java",
"license": "apache-2.0",
"size": 57455
} | [
"com.esri.gpt.framework.util.TimePeriod",
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.TimePeriod; import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 2,492,327 |
public static int getStringByteLength(String string) {
CharsetEncoder encoder = Filesystem.getCharset().newEncoder();
try {
return encoder.encode(CharBuffer.wrap(string.toCharArray())).limit();
} catch (CharacterCodingException e) {
throw new RuntimeException(e);
}
} | static int function(String string) { CharsetEncoder encoder = Filesystem.getCharset().newEncoder(); try { return encoder.encode(CharBuffer.wrap(string.toCharArray())).limit(); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } | /**
* Get the length of the java string as it would be encoded on disk.
* Use this because string.length will return the length in characters, which
* happen to be 16Bit unsigned.
*/ | Get the length of the java string as it would be encoded on disk. Use this because string.length will return the length in characters, which happen to be 16Bit unsigned | getStringByteLength | {
"repo_name": "irq0/jext2",
"path": "src/jext2/Ext2fsDataTypes.java",
"license": "gpl-3.0",
"size": 7005
} | [
"java.nio.CharBuffer",
"java.nio.charset.CharacterCodingException",
"java.nio.charset.CharsetEncoder"
] | import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.CharsetEncoder; | import java.nio.*; import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 693,798 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.