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 synchronized String substitute(String str) {
return IvyPatternHelper.substituteVariables(str, variableContainer);
} | synchronized String function(String str) { return IvyPatternHelper.substituteVariables(str, variableContainer); } | /**
* Substitute variables in the given string by their value found in the current set of variables
*
* @param str
* the string in which substitution should be made
* @return the string where all current ivy variables have been substituted by their value If
* the input str doesn't use any variable, the same object is returned
*/ | Substitute variables in the given string by their value found in the current set of variables | substitute | {
"repo_name": "jaikiran/ant-ivy",
"path": "src/java/org/apache/ivy/core/settings/IvySettings.java",
"license": "apache-2.0",
"size": 59796
} | [
"org.apache.ivy.core.IvyPatternHelper"
] | import org.apache.ivy.core.IvyPatternHelper; | import org.apache.ivy.core.*; | [
"org.apache.ivy"
] | org.apache.ivy; | 825,207 |
private static boolean checkAcceptableForTestFragment(JMeterTreeNode[] nodes) {
return Arrays.stream(nodes).map(DefaultMutableTreeNode::getUserObject)
.noneMatch(o -> o instanceof ThreadGroup || o instanceof TestPlan);
} | static boolean function(JMeterTreeNode[] nodes) { return Arrays.stream(nodes).map(DefaultMutableTreeNode::getUserObject) .noneMatch(o -> o instanceof ThreadGroup o instanceof TestPlan); } | /**
* Check nodes does not contain a node of type TestPlan or ThreadGroup
*
* @param nodes
* the nodes to check for TestPlans or ThreadGroups
*/ | Check nodes does not contain a node of type TestPlan or ThreadGroup | checkAcceptableForTestFragment | {
"repo_name": "vherilier/jmeter",
"path": "src/core/org/apache/jmeter/gui/action/Save.java",
"license": "apache-2.0",
"size": 19587
} | [
"java.util.Arrays",
"javax.swing.tree.DefaultMutableTreeNode",
"org.apache.jmeter.gui.tree.JMeterTreeNode",
"org.apache.jmeter.testelement.TestPlan",
"org.apache.jmeter.threads.ThreadGroup"
] | import java.util.Arrays; import javax.swing.tree.DefaultMutableTreeNode; import org.apache.jmeter.gui.tree.JMeterTreeNode; import org.apache.jmeter.testelement.TestPlan; import org.apache.jmeter.threads.ThreadGroup; | import java.util.*; import javax.swing.tree.*; import org.apache.jmeter.gui.tree.*; import org.apache.jmeter.testelement.*; import org.apache.jmeter.threads.*; | [
"java.util",
"javax.swing",
"org.apache.jmeter"
] | java.util; javax.swing; org.apache.jmeter; | 1,072,857 |
public LifecycleCallbackType<InterceptorType<T>> getOrCreatePostActivate()
{
List<Node> nodeList = childNode.get("post-activate");
if (nodeList != null && nodeList.size() > 0)
{
return new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, "post-activate", childNode, nodeList.get(0));
}
return createPostActivate();
} | LifecycleCallbackType<InterceptorType<T>> function() { List<Node> nodeList = childNode.get(STR); if (nodeList != null && nodeList.size() > 0) { return new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, STR, childNode, nodeList.get(0)); } return createPostActivate(); } | /**
* If not already created, a new <code>post-activate</code> element will be created and returned.
* Otherwise, the first existing <code>post-activate</code> element will be returned.
* @return the instance defined for the element <code>post-activate</code>
*/ | If not already created, a new <code>post-activate</code> element will be created and returned. Otherwise, the first existing <code>post-activate</code> element will be returned | getOrCreatePostActivate | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/InterceptorTypeImpl.java",
"license": "epl-1.0",
"size": 39854
} | [
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType",
"org.jboss.shrinkwrap.descriptor.api.javaee5.LifecycleCallbackType",
"org.jboss.shrinkwrap.descriptor.impl.javaee5.LifecycleCallbackTypeImpl",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.List; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaee5.LifecycleCallbackType; import org.jboss.shrinkwrap.descriptor.impl.javaee5.LifecycleCallbackTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.*; import org.jboss.shrinkwrap.descriptor.api.javaee5.*; import org.jboss.shrinkwrap.descriptor.impl.javaee5.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 2,516,234 |
public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException {
try (CharacterReader reader = new CharacterReader(this.resource)) {
Map<String, OriginTrackedValue> result = new LinkedHashMap<>();
StringBuilder buffer = new StringBuilder();
while (reader.read()) {
String key = loadKey(buffer, reader).trim();
if (expandLists && key.endsWith("[]")) {
key = key.substring(0, key.length() - 2);
int index = 0;
do {
OriginTrackedValue value = loadValue(buffer, reader, true);
put(result, key + "[" + (index++) + "]", value);
if (!reader.isEndOfLine()) {
reader.read();
}
}
while (!reader.isEndOfLine());
}
else {
OriginTrackedValue value = loadValue(buffer, reader, false);
put(result, key, value);
}
}
return result;
}
} | Map<String, OriginTrackedValue> function(boolean expandLists) throws IOException { try (CharacterReader reader = new CharacterReader(this.resource)) { Map<String, OriginTrackedValue> result = new LinkedHashMap<>(); StringBuilder buffer = new StringBuilder(); while (reader.read()) { String key = loadKey(buffer, reader).trim(); if (expandLists && key.endsWith("[]")) { key = key.substring(0, key.length() - 2); int index = 0; do { OriginTrackedValue value = loadValue(buffer, reader, true); put(result, key + "[" + (index++) + "]", value); if (!reader.isEndOfLine()) { reader.read(); } } while (!reader.isEndOfLine()); } else { OriginTrackedValue value = loadValue(buffer, reader, false); put(result, key, value); } } return result; } } | /**
* Load {@code .properties} data and return a map of {@code String} ->
* {@link OriginTrackedValue}.
* @param expandLists if list {@code name[]=a,b,c} shortcuts should be expanded
* @return the loaded properties
* @throws IOException on read error
*/ | Load .properties data and return a map of String -> <code>OriginTrackedValue</code> | load | {
"repo_name": "bclozel/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java",
"license": "apache-2.0",
"size": 7773
} | [
"java.io.IOException",
"java.util.LinkedHashMap",
"java.util.Map",
"org.springframework.boot.origin.OriginTrackedValue"
] | import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; import org.springframework.boot.origin.OriginTrackedValue; | import java.io.*; import java.util.*; import org.springframework.boot.origin.*; | [
"java.io",
"java.util",
"org.springframework.boot"
] | java.io; java.util; org.springframework.boot; | 2,558,458 |
public final String toString(final int kSize) {
final StringBuilder sb = new StringBuilder(kSize);
// we'll produce the string in reverse order and reverse it at the end
long val = valLow;
for (int idx = 0; idx != kSize; ++idx) {
// grab the two least significant bits to index into the BASE_CHARS array
sb.append(BaseUtils.BASE_CHARS[(int) val & 3]);
// roll the whole mess down two bits
val >>= 2;
}
// we built the string in least-significant to most-significant bit order. reverse it now.
return sb.reverse().toString();
} | final String function(final int kSize) { final StringBuilder sb = new StringBuilder(kSize); long val = valLow; for (int idx = 0; idx != kSize; ++idx) { sb.append(BaseUtils.BASE_CHARS[(int) val & 3]); val >>= 2; } return sb.reverse().toString(); } | /**
* Not an override. An SVKmerShort doesn't know what K is, so it has to be supplied.
*/ | Not an override. An SVKmerShort doesn't know what K is, so it has to be supplied | toString | {
"repo_name": "broadinstitute/hellbender",
"path": "src/main/java/org/broadinstitute/hellbender/tools/spark/sv/utils/SVKmerShort.java",
"license": "bsd-3-clause",
"size": 7628
} | [
"org.broadinstitute.hellbender.utils.BaseUtils"
] | import org.broadinstitute.hellbender.utils.BaseUtils; | import org.broadinstitute.hellbender.utils.*; | [
"org.broadinstitute.hellbender"
] | org.broadinstitute.hellbender; | 203,397 |
public Locale getLocale() {
return locale;
} | Locale function() { return locale; } | /**
* Return the locale (language and country) of the user.
*
* @hibernate.property
*
* @return Locale
*/ | Return the locale (language and country) of the user | getLocale | {
"repo_name": "ModelN/build-management",
"path": "mn-build-core/src/main/java/com/modeln/build/common/data/account/CMnUser.java",
"license": "mit",
"size": 3631
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,526,515 |
public final synchronized long getRecomputedActualSizeInBytes() throws IOException {
if (!(in instanceof RAMDirectory))
return sizeInBytes();
long size = 0;
for (final RAMFile file : ((RAMDirectory)in).fileMap.values())
size += file.length;
return size;
}
// NOTE: This is off by default; see LUCENE-5574
private boolean assertNoUnreferencedFilesOnClose; | final synchronized long function() throws IOException { if (!(in instanceof RAMDirectory)) return sizeInBytes(); long size = 0; for (final RAMFile file : ((RAMDirectory)in).fileMap.values()) size += file.length; return size; } private boolean assertNoUnreferencedFilesOnClose; | /** Like getRecomputedSizeInBytes(), but, uses actual file
* lengths rather than buffer allocations (which are
* quantized up to nearest
* RAMOutputStream.BUFFER_SIZE (now 1024) bytes.
*/ | Like getRecomputedSizeInBytes(), but, uses actual file lengths rather than buffer allocations (which are quantized up to nearest RAMOutputStream.BUFFER_SIZE (now 1024) bytes | getRecomputedActualSizeInBytes | {
"repo_name": "smartan/lucene",
"path": "src/main/java/org/apache/lucene/store/MockDirectoryWrapper.java",
"license": "apache-2.0",
"size": 34963
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 320,679 |
public IUnaryFlowFunction getNormalFlowFunction(final BasicBlockInContext<IExplodedBasicBlock> src,
BasicBlockInContext<IExplodedBasicBlock> dest) {
final IExplodedBasicBlock ebb = src.getDelegate();
SSAInstruction instruction = ebb.getInstruction();
if (instruction instanceof SSAPutInstruction) {
final SSAPutInstruction putInstr = (SSAPutInstruction) instruction;
if (putInstr.isStatic()) {
return new IUnaryFlowFunction() { | IUnaryFlowFunction function(final BasicBlockInContext<IExplodedBasicBlock> src, BasicBlockInContext<IExplodedBasicBlock> dest) { final IExplodedBasicBlock ebb = src.getDelegate(); SSAInstruction instruction = ebb.getInstruction(); if (instruction instanceof SSAPutInstruction) { final SSAPutInstruction putInstr = (SSAPutInstruction) instruction; if (putInstr.isStatic()) { return new IUnaryFlowFunction() { | /**
* flow function for normal intraprocedural edges
*/ | flow function for normal intraprocedural edges | getNormalFlowFunction | {
"repo_name": "nithinvnath/PAVProject",
"path": "com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/dataflow/StaticInitializer.java",
"license": "mit",
"size": 15957
} | [
"com.ibm.wala.dataflow.IFDS",
"com.ibm.wala.ipa.cfg.BasicBlockInContext",
"com.ibm.wala.ssa.SSAInstruction",
"com.ibm.wala.ssa.SSAPutInstruction",
"com.ibm.wala.ssa.analysis.IExplodedBasicBlock"
] | import com.ibm.wala.dataflow.IFDS; import com.ibm.wala.ipa.cfg.BasicBlockInContext; import com.ibm.wala.ssa.SSAInstruction; import com.ibm.wala.ssa.SSAPutInstruction; import com.ibm.wala.ssa.analysis.IExplodedBasicBlock; | import com.ibm.wala.dataflow.*; import com.ibm.wala.ipa.cfg.*; import com.ibm.wala.ssa.*; import com.ibm.wala.ssa.analysis.*; | [
"com.ibm.wala"
] | com.ibm.wala; | 1,271,209 |
protected EntityType getElementType(Object entity) {
if (JsonSerializable.class.isAssignableFrom(entity.getClass())) {
return JSON_SERIALIZABLE;
}
if (String.class.isAssignableFrom(entity.getClass())) {
return STRING;
}
return UNKNOWN;
} | EntityType function(Object entity) { if (JsonSerializable.class.isAssignableFrom(entity.getClass())) { return JSON_SERIALIZABLE; } if (String.class.isAssignableFrom(entity.getClass())) { return STRING; } return UNKNOWN; } | /**
* Helper method for getting the type of the JSON entity
*
* @param entity the entity object
* @return the type of the element
*/ | Helper method for getting the type of the JSON entity | getElementType | {
"repo_name": "akervern/che",
"path": "core/che-core-api-core/src/main/java/org/eclipse/che/api/core/rest/DownloadFileResponseFilter.java",
"license": "epl-1.0",
"size": 3385
} | [
"org.eclipse.che.dto.server.JsonSerializable"
] | import org.eclipse.che.dto.server.JsonSerializable; | import org.eclipse.che.dto.server.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 1,838,894 |
protected void initializeProperties( )
{
WebArtifactUtil.setContextParamValue( properties,
BIRT_RESOURCE_FOLDER_SETTING, txtResourceFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_WORKING_FOLDER_SETTING, txtWorkingFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_DOCUMENT_FOLDER_SETTING, txtDocumentFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_REPORT_ACCESSONLY_SETTING, BLANK_STRING
+ btAccessOnly.getSelection( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_IMAGE_FOLDER_SETTING, txtImageFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_SCRIPTLIB_FOLDER_SETTING, txtScriptlibFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_LOG_FOLDER_SETTING, txtLogFolder.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_MAX_ROWS_SETTING, DataUtil.getNumberSetting( txtMaxRows
.getText( ) ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_MAX_ROWLEVELS_SETTING, DataUtil
.getNumberSetting( txtMaxRowLevels.getText( ) ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_MAX_COLUMNLEVELS_SETTING, DataUtil
.getNumberSetting( txtMaxColumnLevels.getText( ) ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_CUBE_MEMORYSIZE_SETTING, DataUtil
.getNumberSetting( txtCubeMemorySize.getText( ) ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_LOG_LEVEL_SETTING, cbLogLevel.getText( ) );
WebArtifactUtil.setContextParamValue( properties,
BIRT_PRINT_SERVER_SETTING, cbPrintServer.getText( ) );
} | void function( ) { WebArtifactUtil.setContextParamValue( properties, BIRT_RESOURCE_FOLDER_SETTING, txtResourceFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_WORKING_FOLDER_SETTING, txtWorkingFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_DOCUMENT_FOLDER_SETTING, txtDocumentFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_REPORT_ACCESSONLY_SETTING, BLANK_STRING + btAccessOnly.getSelection( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_IMAGE_FOLDER_SETTING, txtImageFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_SCRIPTLIB_FOLDER_SETTING, txtScriptlibFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_LOG_FOLDER_SETTING, txtLogFolder.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_MAX_ROWS_SETTING, DataUtil.getNumberSetting( txtMaxRows .getText( ) ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_MAX_ROWLEVELS_SETTING, DataUtil .getNumberSetting( txtMaxRowLevels.getText( ) ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_MAX_COLUMNLEVELS_SETTING, DataUtil .getNumberSetting( txtMaxColumnLevels.getText( ) ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_CUBE_MEMORYSIZE_SETTING, DataUtil .getNumberSetting( txtCubeMemorySize.getText( ) ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_LOG_LEVEL_SETTING, cbLogLevel.getText( ) ); WebArtifactUtil.setContextParamValue( properties, BIRT_PRINT_SERVER_SETTING, cbPrintServer.getText( ) ); } | /**
* Do initialize page properties map
*
*/ | Do initialize page properties map | initializeProperties | {
"repo_name": "sguan-actuate/birt",
"path": "viewer/org.eclipse.birt.integration.wtp.ui/src/org/eclipse/birt/integration/wtp/ui/internal/dialogs/BirtConfigurationDialog.java",
"license": "epl-1.0",
"size": 8818
} | [
"org.eclipse.birt.integration.wtp.ui.internal.util.DataUtil",
"org.eclipse.birt.integration.wtp.ui.internal.util.WebArtifactUtil"
] | import org.eclipse.birt.integration.wtp.ui.internal.util.DataUtil; import org.eclipse.birt.integration.wtp.ui.internal.util.WebArtifactUtil; | import org.eclipse.birt.integration.wtp.ui.internal.util.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,951,068 |
private void restoreStatus() {
if (!stack.isEmpty()) {
status = stack.pop();
defaultUC = (String) status.get("defaultUC"); //$NON-NLS-1$
defaultFont = (String) status.get("defaultFont"); //$NON-NLS-1$
defaultAF = (String) status.get("defaultAF"); //$NON-NLS-1$
defaultLang = (String) status.get("defaultLang"); //$NON-NLS-1$
srcEncoding = (String) status.get("srcEncoding"); //$NON-NLS-1$
defaultCpg = (String) status.get("defaultCpg"); //$NON-NLS-1$
inLOCH = ((Boolean) status.get("inLOCH")).booleanValue(); //$NON-NLS-1$
inHICH = ((Boolean) status.get("inHICH")).booleanValue(); //$NON-NLS-1$
inDBCH = ((Boolean) status.get("inDBCH")).booleanValue(); //$NON-NLS-1$
} else {
status = new Hashtable<String, Object>();
status.put("defaultUC", defaultUC); //$NON-NLS-1$
status.put("defaultFont", defaultFont); //$NON-NLS-1$
status.put("defaultLang", defaultLang); //$NON-NLS-1$
status.put("srcEncoding", srcEncoding); //$NON-NLS-1$
status.put("defaultCpg", defaultCpg); //$NON-NLS-1$
status.put("defaultAF", defaultAF); //$NON-NLS-1$
status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$
status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$
status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$
}
}
| void function() { if (!stack.isEmpty()) { status = stack.pop(); defaultUC = (String) status.get(STR); defaultFont = (String) status.get(STR); defaultAF = (String) status.get(STR); defaultLang = (String) status.get(STR); srcEncoding = (String) status.get(STR); defaultCpg = (String) status.get(STR); inLOCH = ((Boolean) status.get(STR)).booleanValue(); inHICH = ((Boolean) status.get(STR)).booleanValue(); inDBCH = ((Boolean) status.get(STR)).booleanValue(); } else { status = new Hashtable<String, Object>(); status.put(STR, defaultUC); status.put(STR, defaultFont); status.put(STR, defaultLang); status.put(STR, srcEncoding); status.put(STR, defaultCpg); status.put(STR, defaultAF); status.put(STR, new Boolean(inLOCH)); status.put(STR, new Boolean(inHICH)); status.put(STR, new Boolean(inDBCH)); } } | /**
* Restore status.
*/ | Restore status | restoreStatus | {
"repo_name": "heartsome/tmxeditor8",
"path": "hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Rtf2Xliff.java",
"license": "gpl-2.0",
"size": 96309
} | [
"java.util.Hashtable"
] | import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 2,540,797 |
IAction[] getActions();
| IAction[] getActions(); | /**
* Returns the actions of the replay.
* @return the actions of the replay
*/ | Returns the actions of the replay | getActions | {
"repo_name": "icza/sc2gears",
"path": "src-sc2gearspluginapi/hu/belicza/andras/sc2gearspluginapi/api/sc2replay/IGameEvents.java",
"license": "apache-2.0",
"size": 3332
} | [
"hu.belicza.andras.sc2gearspluginapi.api.sc2replay.action.IAction"
] | import hu.belicza.andras.sc2gearspluginapi.api.sc2replay.action.IAction; | import hu.belicza.andras.sc2gearspluginapi.api.sc2replay.action.*; | [
"hu.belicza.andras"
] | hu.belicza.andras; | 1,559,907 |
public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
Element element, String baseURI, StorageResolver storage
) {
return null;
} | javax.crypto.SecretKey function( Element element, String baseURI, StorageResolver storage ) { return null; } | /**
* Method engineResolveSecretKey
* @inheritDoc
* @param element
* @param baseURI
* @param storage
*
*/ | Method engineResolveSecretKey | engineLookupAndResolveSecretKey | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/X509SKIResolver.java",
"license": "mit",
"size": 5631
} | [
"com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver",
"org.w3c.dom.Element"
] | import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver; import org.w3c.dom.Element; | import com.sun.org.apache.xml.internal.security.keys.storage.*; import org.w3c.dom.*; | [
"com.sun.org",
"org.w3c.dom"
] | com.sun.org; org.w3c.dom; | 1,039,026 |
private void deleteEntity(Exercise entity) {
EntityManager em = PersistenceService.getInstance().getEntityManager();
em.remove(entity);
} | void function(Exercise entity) { EntityManager em = PersistenceService.getInstance().getEntityManager(); em.remove(entity); } | /**
* Deletes the entity.
*
* @param entity the entity to deletle
*/ | Deletes the entity | deleteEntity | {
"repo_name": "OSEHRA/HealtheMe",
"path": "src/main/java/com/krminc/phr/api/service/ExerciseResource.java",
"license": "apache-2.0",
"size": 7045
} | [
"com.krminc.phr.dao.PersistenceService",
"com.krminc.phr.domain.Exercise",
"javax.persistence.EntityManager"
] | import com.krminc.phr.dao.PersistenceService; import com.krminc.phr.domain.Exercise; import javax.persistence.EntityManager; | import com.krminc.phr.dao.*; import com.krminc.phr.domain.*; import javax.persistence.*; | [
"com.krminc.phr",
"javax.persistence"
] | com.krminc.phr; javax.persistence; | 2,771,953 |
public void startEntity(String name,
XMLResourceIdentifier identifier,
String encoding, Augmentations augs) throws XNIException {
// keep track of the entity depth
fEntityDepth++;
// must reset entity scanner
fEntityScanner = fEntityManager.getEntityScanner();
fEntityStore = fEntityManager.getEntityStore() ;
} // startEntity(String,XMLResourceIdentifier,String) | void function(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException { fEntityDepth++; fEntityScanner = fEntityManager.getEntityScanner(); fEntityStore = fEntityManager.getEntityStore() ; } | /**
* This method notifies of the start of an entity. The document entity
* has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]"
* parameter entity names start with '%'; and general entities are just
* specified by their name.
*
* @param name The name of the entity.
* @param identifier The resource identifier.
* @param encoding The auto-detected IANA encoding name of the entity
* stream. This value will be null in those situations
* where the entity encoding is not auto-detected (e.g.
* internal entities or a document entity that is
* parsed from a java.io.Reader).
*
* @throws XNIException Thrown by handler to signal an error.
*/ | This method notifies of the start of an entity. The document entity has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]" parameter entity names start with '%'; and general entities are just specified by their name | startEntity | {
"repo_name": "openjdk/jdk7u",
"path": "jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java",
"license": "gpl-2.0",
"size": 61515
} | [
"com.sun.org.apache.xerces.internal.xni.Augmentations",
"com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier",
"com.sun.org.apache.xerces.internal.xni.XNIException"
] | import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; import com.sun.org.apache.xerces.internal.xni.XNIException; | import com.sun.org.apache.xerces.internal.xni.*; | [
"com.sun.org"
] | com.sun.org; | 1,084,407 |
public static long generateLocalTime2UTCTime(long localTime) {
// float f = DateUtils.getCurrentTimeZone2Int() * 60 * 60;
// long utcTime = localTime - (int) f;
long utcTime = localTime - getRawOffset();
Log.d("####", "generateLocalTime2UTCTime: localTime--" + localTime + "--utcTime--" + utcTime);
return utcTime;
} | static long function(long localTime) { long utcTime = localTime - getRawOffset(); Log.d("####", STR + localTime + STR + utcTime); return utcTime; } | /**
* Local time to UTC time
*
* @param localTime localTime
* @return utcTime
*/ | Local time to UTC time | generateLocalTime2UTCTime | {
"repo_name": "Jusenr/androidtools",
"path": "toolslibrary/src/main/java/com/jusenr/toolslibrary/utils/DateUtils.java",
"license": "apache-2.0",
"size": 18924
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 848,468 |
private SelectionBuilder buildQuerySelection(Uri uri, int match) {
final SelectionBuilder builder = new SelectionBuilder();
switch (match) {
case HOSTS_LIST: {
return builder.table(MediaDatabase.Tables.HOSTS);
}
case HOSTS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.HOSTS)
.where(BaseColumns._ID + "=?", hostId);
}
case MOVIES_ALL: {
return builder.table(MediaDatabase.Tables.MOVIES);
}
case MOVIES_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.MOVIES)
.where(MediaContract.Movies.HOST_ID + "=?", hostId);
}
case MOVIES_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String movieId = MediaContract.Movies.getMovieId(uri);
return builder.table(MediaDatabase.Tables.MOVIES)
.where(MediaContract.Movies.HOST_ID + "=?", hostId)
.where(MediaContract.Movies.MOVIEID + "=?", movieId);
}
case MOVIE_CAST_ALL: {
return builder.table(MediaDatabase.Tables.MOVIE_CAST);
}
case MOVIE_CAST_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String movieId = MediaContract.Movies.getMovieId(uri);
return builder.table(MediaDatabase.Tables.MOVIE_CAST)
.where(MediaContract.MovieCast.HOST_ID + "=?", hostId)
.where(MediaContract.MovieCast.MOVIEID + "=?", movieId);
}
case TVSHOWS_ALL: {
return builder.table(MediaDatabase.Tables.TVSHOWS);
}
case TVSHOWS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.TVSHOWS)
.where(MediaContract.TVShows.HOST_ID + "=?", hostId);
}
case TVSHOWS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
return builder.table(MediaDatabase.Tables.TVSHOWS)
.where(MediaContract.TVShows.HOST_ID + "=?", hostId)
.where(MediaContract.TVShows.TVSHOWID + "=?", tvshowId);
}
case TVSHOWS_CAST_ALL: {
return builder.table(MediaDatabase.Tables.TVSHOWS_CAST);
}
case TVSHOWS_CAST_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
return builder.table(MediaDatabase.Tables.TVSHOWS_CAST)
.where(MediaContract.TVShowCast.HOST_ID + "=?", hostId)
.where(MediaContract.TVShowCast.TVSHOWID + "=?", tvshowId);
}
case SEASONS_ALL: {
return builder.table(MediaDatabase.Tables.SEASONS);
}
case TVSHOW_SEASONS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
return builder.table(MediaDatabase.Tables.SEASONS)
.where(MediaContract.Seasons.HOST_ID + "=?", hostId)
.where(MediaContract.Seasons.TVSHOWID + "=?", tvshowId);
}
case TVSHOW_SEASONS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
final String season = MediaContract.Seasons.getTVShowSeasonId(uri);
return builder.table(MediaDatabase.Tables.SEASONS)
.where(MediaContract.Seasons.HOST_ID + "=?", hostId)
.where(MediaContract.Seasons.TVSHOWID + "=?", tvshowId)
.where(MediaContract.Seasons.SEASON + "=?", season);
}
case EPISODES_ALL: {
return builder.table(MediaDatabase.Tables.EPISODES);
}
case TVSHOW_EPISODES_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
return builder.table(MediaDatabase.Tables.EPISODES)
.where(MediaContract.Episodes.HOST_ID + "=?", hostId)
.where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId);
}
case TVSHOW_EPISODES_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
final String episodeId = MediaContract.Episodes.getTVShowEpisodeId(uri);
return builder.table(MediaDatabase.Tables.EPISODES)
.where(MediaContract.Episodes.HOST_ID + "=?", hostId)
.where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId)
.where(MediaContract.Episodes.EPISODEID + "=?", episodeId);
}
case TVSHOW_SEASON_EPISODES_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
final String season = MediaContract.Seasons.getTVShowSeasonId(uri);
return builder.table(MediaDatabase.Tables.EPISODES)
.where(MediaContract.Episodes.HOST_ID + "=?", hostId)
.where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId)
.where(MediaContract.Episodes.SEASON + "=?", season);
}
case TVSHOW_SEASON_EPISODES_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String tvshowId = MediaContract.TVShows.getTVShowId(uri);
final String season = MediaContract.Seasons.getTVShowSeasonId(uri);
final String episodeId = MediaContract.Episodes.getTVShowSeasonEpisodeId(uri);
return builder.table(MediaDatabase.Tables.EPISODES)
.where(MediaContract.Episodes.HOST_ID + "=?", hostId)
.where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId)
.where(MediaContract.Episodes.SEASON + "=?", season)
.where(MediaContract.Episodes.EPISODEID + "=?", episodeId);
}
case ARTISTS_ALL: {
return builder.table(MediaDatabase.Tables.ARTISTS);
}
case ARTISTS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.ARTISTS)
.where(MediaContract.Artists.HOST_ID + "=?", hostId);
}
case ARTISTS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String artistId = MediaContract.Artists.getArtistId(uri);
return builder.table(MediaDatabase.Tables.ARTISTS)
.where(MediaContract.Artists.HOST_ID + "=?", hostId)
.where(MediaContract.Artists.ARTISTID + "=?", artistId);
}
case ALBUMS_ALL: {
return builder.table(MediaDatabase.Tables.ALBUMS);
}
case ALBUMS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.ALBUMS)
.where(MediaContract.Albums.HOST_ID + "=?", hostId);
}
case ALBUMS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String albumId = MediaContract.Albums.getAlbumId(uri);
return builder.table(MediaDatabase.Tables.ALBUMS)
.where(MediaContract.Albums.HOST_ID + "=?", hostId)
.where(MediaContract.Albums.ALBUMID + "=?", albumId);
}
case SONGS_ALL: {
return builder.table(MediaDatabase.Tables.SONGS);
}
case SONGS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.SONGS_FOR_ARTIST_AND_OR_ALBUM_JOIN)
.mapToTable(MediaContract.Songs.SONGID, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.TITLE, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.ALBUMID, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.THUMBNAIL, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.DISPLAYARTIST, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS)
.mapToTable(MediaContract.SongArtists.ARTISTID, MediaDatabase.Tables.SONG_ARTISTS)
.where(Qualified.SONGS_HOST_ID + "=?", hostId)
.groupBy(Qualified.SONGS_SONGID);
}
case SONGS_ALBUM: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String albumId = MediaContract.Albums.getAlbumId(uri);
return builder.table(MediaDatabase.Tables.SONGS)
.where(Qualified.SONGS_HOST_ID + "=?", hostId)
.where(Qualified.SONGS_ALBUMID + "=?", albumId);
}
case SONGS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String albumId = MediaContract.Albums.getAlbumId(uri);
final String songId = MediaContract.Songs.getSongId(uri);
return builder.table(MediaDatabase.Tables.SONGS)
.where(MediaContract.Songs.HOST_ID + "=?", hostId)
.where(MediaContract.Songs.ALBUMID + "=?", albumId)
.where(MediaContract.Songs.SONGID + "=?", songId);
}
case AUDIO_GENRES_ALL: {
return builder.table(MediaDatabase.Tables.AUDIO_GENRES);
}
case AUDIO_GENRES_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.AUDIO_GENRES)
.where(MediaContract.AudioGenres.HOST_ID + "=?", hostId);
}
case AUDIO_GENRES_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String audioGenreId = MediaContract.AudioGenres.getAudioGenreId(uri);
return builder.table(MediaDatabase.Tables.AUDIO_GENRES)
.where(MediaContract.AudioGenres.HOST_ID + "=?", hostId)
.where(MediaContract.AudioGenres.GENREID + "=?", audioGenreId);
}
case ALBUM_ARTISTS_ALL: {
return builder.table(MediaDatabase.Tables.ALBUM_ARTISTS);
}
case SONG_ARTISTS_ALL: {
return builder.table(MediaDatabase.Tables.SONG_ARTISTS);
}
case ALBUM_GENRES_ALL: {
return builder.table(MediaDatabase.Tables.ALBUM_GENRES);
}
case ARTIST_ALBUMS_LIST: {
// Albums for Artists
final String hostId = MediaContract.Hosts.getHostId(uri);
final String artistId = MediaContract.Artists.getArtistId(uri);
return builder.table(MediaDatabase.Tables.ALBUMS_FOR_ARTIST_JOIN)
.mapToTable(MediaContract.Albums._ID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.Albums.HOST_ID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.Albums.ALBUMID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS)
.where(Qualified.ALBUM_ARTISTS_HOST_ID + "=?", hostId)
.where(Qualified.ALBUM_ARTISTS_ARTISTID + "=?", artistId);
}
case ARTIST_SONGS_LIST: {
// Songs for Artists
final String hostId = MediaContract.Hosts.getHostId(uri);
final String artistId = MediaContract.Artists.getArtistId(uri);
return builder.table(MediaDatabase.Tables.SONGS_FOR_ARTIST_AND_OR_ALBUM_JOIN)
.mapToTable(MediaContract.Songs.SONGID, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.TITLE, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.ALBUMID, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.Songs.DISPLAYARTIST, MediaDatabase.Tables.SONGS)
.mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS)
.mapToTable(MediaContract.SongArtists.ARTISTID, MediaDatabase.Tables.SONG_ARTISTS)
.where(Qualified.SONG_ARTISTS_HOST_ID + "=?", hostId)
.where(Qualified.SONG_ARTISTS_ARTISTID + "=?"
+ " OR " +
Qualified.ALBUM_ARTISTS_ARTISTID + "=?", artistId, artistId)
.groupBy(Qualified.SONGS_ID);
}
case ALBUM_ARTISTS_LIST: {
// Artists for Album
final String hostId = MediaContract.Hosts.getHostId(uri);
final String albumId = MediaContract.Albums.getAlbumId(uri);
return builder.table(MediaDatabase.Tables.ARTISTS_FOR_ALBUM_JOIN)
.mapToTable(MediaContract.Artists._ID, MediaDatabase.Tables.ARTISTS)
.mapToTable(MediaContract.Artists.HOST_ID, MediaDatabase.Tables.ARTISTS)
.mapToTable(MediaContract.Artists.ARTISTID, MediaDatabase.Tables.ARTISTS)
.mapToTable(MediaContract.AlbumArtists.ALBUMID, MediaDatabase.Tables.ALBUM_ARTISTS)
.where(Qualified.ALBUM_ARTISTS_HOST_ID + "=?", hostId)
.where(Qualified.ALBUM_ARTISTS_ALBUMID + "=?", albumId);
}
case ALBUM_GENRES_LIST: {
// Genres for Album
final String hostId = MediaContract.Hosts.getHostId(uri);
final String albumId = MediaContract.Albums.getAlbumId(uri);
return builder.table(MediaDatabase.Tables.GENRES_FOR_ALBUM_JOIN)
.mapToTable(MediaContract.AudioGenres._ID, MediaDatabase.Tables.AUDIO_GENRES)
.mapToTable(MediaContract.AudioGenres.HOST_ID, MediaDatabase.Tables.AUDIO_GENRES)
.mapToTable(MediaContract.AudioGenres.GENREID, MediaDatabase.Tables.AUDIO_GENRES)
.mapToTable(MediaContract.AlbumGenres.ALBUMID, MediaDatabase.Tables.ALBUM_GENRES)
.where(Qualified.ALBUM_GENRES_HOST_ID + "=?", hostId)
.where(Qualified.ALBUM_GENRES_ALBUMID + "=?", albumId);
}
case AUDIO_GENRE_ALBUMS_LIST: {
// Album for a Genre
final String hostId = MediaContract.Hosts.getHostId(uri);
final String genreId = MediaContract.AudioGenres.getAudioGenreId(uri);
return builder.table(MediaDatabase.Tables.ALBUMS_FOR_GENRE_JOIN)
.mapToTable(MediaContract.Albums._ID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.Albums.HOST_ID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.Albums.ALBUMID, MediaDatabase.Tables.ALBUMS)
.mapToTable(MediaContract.AlbumGenres.GENREID, MediaDatabase.Tables.ALBUM_GENRES)
.where(Qualified.ALBUM_GENRES_HOST_ID + "=?", hostId)
.where(Qualified.ALBUM_GENRES_GENREID + "=?", genreId);
}
case MUSIC_VIDEOS_ALL: {
return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS);
}
case MUSIC_VIDEOS_LIST: {
final String hostId = MediaContract.Hosts.getHostId(uri);
return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS)
.where(MediaContract.MusicVideos.HOST_ID + "=?", hostId);
}
case MUSIC_VIDEOS_ID: {
final String hostId = MediaContract.Hosts.getHostId(uri);
final String musicVideoId = MediaContract.MusicVideos.getMusicVideoId(uri);
return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS)
.where(MediaContract.MusicVideos.HOST_ID + "=?", hostId)
.where(MediaContract.MusicVideos.MUSICVIDEOID + "=?", musicVideoId);
}
default: {
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
}
}
public interface Qualified {
String ALBUMS_TITLE =
MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.TITLE;
String ALBUMS_GENRE =
MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.GENRE;
String ALBUMS_YEAR =
MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.YEAR;
String ALBUMS_THUMBNAIL =
MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.THUMBNAIL;
String ALBUMS_DISPLAYARTIST =
MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.DISPLAYARTIST;
String ALBUM_ARTISTS_HOST_ID =
MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.HOST_ID;
String ALBUM_ARTISTS_ARTISTID =
MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.ARTISTID;
String ALBUM_ARTISTS_ALBUMID =
MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.ALBUMID;
String ALBUM_GENRES_HOST_ID =
MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.HOST_ID;
String ALBUM_GENRES_GENREID =
MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.GENREID;
String ALBUM_GENRES_ALBUMID =
MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.ALBUMID;
String SONGS_ID =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs._ID;
String SONGS_TRACK =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.TRACK;
String SONGS_DURATION =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.DURATION;
String SONGS_FILE =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.FILE;
String SONGS_HOST_ID =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.HOST_ID;
String SONGS_SONGID =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.SONGID;
String SONGS_DISPLAYARTIST =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.DISPLAYARTIST;
String SONGS_TITLE =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.TITLE;
String SONGS_ALBUMID =
MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.ALBUMID;
String SONG_ARTISTS_HOST_ID =
MediaDatabase.Tables.SONG_ARTISTS + "." + MediaContract.SongArtists.HOST_ID;
String SONG_ARTISTS_ARTISTID =
MediaDatabase.Tables.SONG_ARTISTS + "." + MediaContract.SongArtists.ARTISTID;
} | SelectionBuilder function(Uri uri, int match) { final SelectionBuilder builder = new SelectionBuilder(); switch (match) { case HOSTS_LIST: { return builder.table(MediaDatabase.Tables.HOSTS); } case HOSTS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.HOSTS) .where(BaseColumns._ID + "=?", hostId); } case MOVIES_ALL: { return builder.table(MediaDatabase.Tables.MOVIES); } case MOVIES_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.MOVIES) .where(MediaContract.Movies.HOST_ID + "=?", hostId); } case MOVIES_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String movieId = MediaContract.Movies.getMovieId(uri); return builder.table(MediaDatabase.Tables.MOVIES) .where(MediaContract.Movies.HOST_ID + "=?", hostId) .where(MediaContract.Movies.MOVIEID + "=?", movieId); } case MOVIE_CAST_ALL: { return builder.table(MediaDatabase.Tables.MOVIE_CAST); } case MOVIE_CAST_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String movieId = MediaContract.Movies.getMovieId(uri); return builder.table(MediaDatabase.Tables.MOVIE_CAST) .where(MediaContract.MovieCast.HOST_ID + "=?", hostId) .where(MediaContract.MovieCast.MOVIEID + "=?", movieId); } case TVSHOWS_ALL: { return builder.table(MediaDatabase.Tables.TVSHOWS); } case TVSHOWS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.TVSHOWS) .where(MediaContract.TVShows.HOST_ID + "=?", hostId); } case TVSHOWS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); return builder.table(MediaDatabase.Tables.TVSHOWS) .where(MediaContract.TVShows.HOST_ID + "=?", hostId) .where(MediaContract.TVShows.TVSHOWID + "=?", tvshowId); } case TVSHOWS_CAST_ALL: { return builder.table(MediaDatabase.Tables.TVSHOWS_CAST); } case TVSHOWS_CAST_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); return builder.table(MediaDatabase.Tables.TVSHOWS_CAST) .where(MediaContract.TVShowCast.HOST_ID + "=?", hostId) .where(MediaContract.TVShowCast.TVSHOWID + "=?", tvshowId); } case SEASONS_ALL: { return builder.table(MediaDatabase.Tables.SEASONS); } case TVSHOW_SEASONS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); return builder.table(MediaDatabase.Tables.SEASONS) .where(MediaContract.Seasons.HOST_ID + "=?", hostId) .where(MediaContract.Seasons.TVSHOWID + "=?", tvshowId); } case TVSHOW_SEASONS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); final String season = MediaContract.Seasons.getTVShowSeasonId(uri); return builder.table(MediaDatabase.Tables.SEASONS) .where(MediaContract.Seasons.HOST_ID + "=?", hostId) .where(MediaContract.Seasons.TVSHOWID + "=?", tvshowId) .where(MediaContract.Seasons.SEASON + "=?", season); } case EPISODES_ALL: { return builder.table(MediaDatabase.Tables.EPISODES); } case TVSHOW_EPISODES_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); return builder.table(MediaDatabase.Tables.EPISODES) .where(MediaContract.Episodes.HOST_ID + "=?", hostId) .where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId); } case TVSHOW_EPISODES_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); final String episodeId = MediaContract.Episodes.getTVShowEpisodeId(uri); return builder.table(MediaDatabase.Tables.EPISODES) .where(MediaContract.Episodes.HOST_ID + "=?", hostId) .where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId) .where(MediaContract.Episodes.EPISODEID + "=?", episodeId); } case TVSHOW_SEASON_EPISODES_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); final String season = MediaContract.Seasons.getTVShowSeasonId(uri); return builder.table(MediaDatabase.Tables.EPISODES) .where(MediaContract.Episodes.HOST_ID + "=?", hostId) .where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId) .where(MediaContract.Episodes.SEASON + "=?", season); } case TVSHOW_SEASON_EPISODES_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String tvshowId = MediaContract.TVShows.getTVShowId(uri); final String season = MediaContract.Seasons.getTVShowSeasonId(uri); final String episodeId = MediaContract.Episodes.getTVShowSeasonEpisodeId(uri); return builder.table(MediaDatabase.Tables.EPISODES) .where(MediaContract.Episodes.HOST_ID + "=?", hostId) .where(MediaContract.Episodes.TVSHOWID + "=?", tvshowId) .where(MediaContract.Episodes.SEASON + "=?", season) .where(MediaContract.Episodes.EPISODEID + "=?", episodeId); } case ARTISTS_ALL: { return builder.table(MediaDatabase.Tables.ARTISTS); } case ARTISTS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.ARTISTS) .where(MediaContract.Artists.HOST_ID + "=?", hostId); } case ARTISTS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String artistId = MediaContract.Artists.getArtistId(uri); return builder.table(MediaDatabase.Tables.ARTISTS) .where(MediaContract.Artists.HOST_ID + "=?", hostId) .where(MediaContract.Artists.ARTISTID + "=?", artistId); } case ALBUMS_ALL: { return builder.table(MediaDatabase.Tables.ALBUMS); } case ALBUMS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.ALBUMS) .where(MediaContract.Albums.HOST_ID + "=?", hostId); } case ALBUMS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String albumId = MediaContract.Albums.getAlbumId(uri); return builder.table(MediaDatabase.Tables.ALBUMS) .where(MediaContract.Albums.HOST_ID + "=?", hostId) .where(MediaContract.Albums.ALBUMID + "=?", albumId); } case SONGS_ALL: { return builder.table(MediaDatabase.Tables.SONGS); } case SONGS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.SONGS_FOR_ARTIST_AND_OR_ALBUM_JOIN) .mapToTable(MediaContract.Songs.SONGID, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.TITLE, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.ALBUMID, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.THUMBNAIL, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.DISPLAYARTIST, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS) .mapToTable(MediaContract.SongArtists.ARTISTID, MediaDatabase.Tables.SONG_ARTISTS) .where(Qualified.SONGS_HOST_ID + "=?", hostId) .groupBy(Qualified.SONGS_SONGID); } case SONGS_ALBUM: { final String hostId = MediaContract.Hosts.getHostId(uri); final String albumId = MediaContract.Albums.getAlbumId(uri); return builder.table(MediaDatabase.Tables.SONGS) .where(Qualified.SONGS_HOST_ID + "=?", hostId) .where(Qualified.SONGS_ALBUMID + "=?", albumId); } case SONGS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String albumId = MediaContract.Albums.getAlbumId(uri); final String songId = MediaContract.Songs.getSongId(uri); return builder.table(MediaDatabase.Tables.SONGS) .where(MediaContract.Songs.HOST_ID + "=?", hostId) .where(MediaContract.Songs.ALBUMID + "=?", albumId) .where(MediaContract.Songs.SONGID + "=?", songId); } case AUDIO_GENRES_ALL: { return builder.table(MediaDatabase.Tables.AUDIO_GENRES); } case AUDIO_GENRES_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.AUDIO_GENRES) .where(MediaContract.AudioGenres.HOST_ID + "=?", hostId); } case AUDIO_GENRES_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String audioGenreId = MediaContract.AudioGenres.getAudioGenreId(uri); return builder.table(MediaDatabase.Tables.AUDIO_GENRES) .where(MediaContract.AudioGenres.HOST_ID + "=?", hostId) .where(MediaContract.AudioGenres.GENREID + "=?", audioGenreId); } case ALBUM_ARTISTS_ALL: { return builder.table(MediaDatabase.Tables.ALBUM_ARTISTS); } case SONG_ARTISTS_ALL: { return builder.table(MediaDatabase.Tables.SONG_ARTISTS); } case ALBUM_GENRES_ALL: { return builder.table(MediaDatabase.Tables.ALBUM_GENRES); } case ARTIST_ALBUMS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String artistId = MediaContract.Artists.getArtistId(uri); return builder.table(MediaDatabase.Tables.ALBUMS_FOR_ARTIST_JOIN) .mapToTable(MediaContract.Albums._ID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.Albums.HOST_ID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.Albums.ALBUMID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS) .where(Qualified.ALBUM_ARTISTS_HOST_ID + "=?", hostId) .where(Qualified.ALBUM_ARTISTS_ARTISTID + "=?", artistId); } case ARTIST_SONGS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String artistId = MediaContract.Artists.getArtistId(uri); return builder.table(MediaDatabase.Tables.SONGS_FOR_ARTIST_AND_OR_ALBUM_JOIN) .mapToTable(MediaContract.Songs.SONGID, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.TITLE, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.ALBUMID, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.Songs.DISPLAYARTIST, MediaDatabase.Tables.SONGS) .mapToTable(MediaContract.AlbumArtists.ARTISTID, MediaDatabase.Tables.ALBUM_ARTISTS) .mapToTable(MediaContract.SongArtists.ARTISTID, MediaDatabase.Tables.SONG_ARTISTS) .where(Qualified.SONG_ARTISTS_HOST_ID + "=?", hostId) .where(Qualified.SONG_ARTISTS_ARTISTID + "=?" + STR + Qualified.ALBUM_ARTISTS_ARTISTID + "=?", artistId, artistId) .groupBy(Qualified.SONGS_ID); } case ALBUM_ARTISTS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String albumId = MediaContract.Albums.getAlbumId(uri); return builder.table(MediaDatabase.Tables.ARTISTS_FOR_ALBUM_JOIN) .mapToTable(MediaContract.Artists._ID, MediaDatabase.Tables.ARTISTS) .mapToTable(MediaContract.Artists.HOST_ID, MediaDatabase.Tables.ARTISTS) .mapToTable(MediaContract.Artists.ARTISTID, MediaDatabase.Tables.ARTISTS) .mapToTable(MediaContract.AlbumArtists.ALBUMID, MediaDatabase.Tables.ALBUM_ARTISTS) .where(Qualified.ALBUM_ARTISTS_HOST_ID + "=?", hostId) .where(Qualified.ALBUM_ARTISTS_ALBUMID + "=?", albumId); } case ALBUM_GENRES_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String albumId = MediaContract.Albums.getAlbumId(uri); return builder.table(MediaDatabase.Tables.GENRES_FOR_ALBUM_JOIN) .mapToTable(MediaContract.AudioGenres._ID, MediaDatabase.Tables.AUDIO_GENRES) .mapToTable(MediaContract.AudioGenres.HOST_ID, MediaDatabase.Tables.AUDIO_GENRES) .mapToTable(MediaContract.AudioGenres.GENREID, MediaDatabase.Tables.AUDIO_GENRES) .mapToTable(MediaContract.AlbumGenres.ALBUMID, MediaDatabase.Tables.ALBUM_GENRES) .where(Qualified.ALBUM_GENRES_HOST_ID + "=?", hostId) .where(Qualified.ALBUM_GENRES_ALBUMID + "=?", albumId); } case AUDIO_GENRE_ALBUMS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); final String genreId = MediaContract.AudioGenres.getAudioGenreId(uri); return builder.table(MediaDatabase.Tables.ALBUMS_FOR_GENRE_JOIN) .mapToTable(MediaContract.Albums._ID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.Albums.HOST_ID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.Albums.ALBUMID, MediaDatabase.Tables.ALBUMS) .mapToTable(MediaContract.AlbumGenres.GENREID, MediaDatabase.Tables.ALBUM_GENRES) .where(Qualified.ALBUM_GENRES_HOST_ID + "=?", hostId) .where(Qualified.ALBUM_GENRES_GENREID + "=?", genreId); } case MUSIC_VIDEOS_ALL: { return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS); } case MUSIC_VIDEOS_LIST: { final String hostId = MediaContract.Hosts.getHostId(uri); return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS) .where(MediaContract.MusicVideos.HOST_ID + "=?", hostId); } case MUSIC_VIDEOS_ID: { final String hostId = MediaContract.Hosts.getHostId(uri); final String musicVideoId = MediaContract.MusicVideos.getMusicVideoId(uri); return builder.table(MediaDatabase.Tables.MUSIC_VIDEOS) .where(MediaContract.MusicVideos.HOST_ID + "=?", hostId) .where(MediaContract.MusicVideos.MUSICVIDEOID + "=?", musicVideoId); } default: { throw new UnsupportedOperationException(STR + uri); } } } public interface Qualified { String ALBUMS_TITLE = MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.TITLE; String ALBUMS_GENRE = MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.GENRE; String ALBUMS_YEAR = MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.YEAR; String ALBUMS_THUMBNAIL = MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.THUMBNAIL; String ALBUMS_DISPLAYARTIST = MediaDatabase.Tables.ALBUMS + "." + MediaContract.Albums.DISPLAYARTIST; String ALBUM_ARTISTS_HOST_ID = MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.HOST_ID; String ALBUM_ARTISTS_ARTISTID = MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.ARTISTID; String ALBUM_ARTISTS_ALBUMID = MediaDatabase.Tables.ALBUM_ARTISTS + "." + MediaContract.AlbumArtists.ALBUMID; String ALBUM_GENRES_HOST_ID = MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.HOST_ID; String ALBUM_GENRES_GENREID = MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.GENREID; String ALBUM_GENRES_ALBUMID = MediaDatabase.Tables.ALBUM_GENRES + "." + MediaContract.AlbumGenres.ALBUMID; String SONGS_ID = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs._ID; String SONGS_TRACK = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.TRACK; String SONGS_DURATION = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.DURATION; String SONGS_FILE = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.FILE; String SONGS_HOST_ID = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.HOST_ID; String SONGS_SONGID = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.SONGID; String SONGS_DISPLAYARTIST = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.DISPLAYARTIST; String SONGS_TITLE = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.TITLE; String SONGS_ALBUMID = MediaDatabase.Tables.SONGS + "." + MediaContract.Songs.ALBUMID; String SONG_ARTISTS_HOST_ID = MediaDatabase.Tables.SONG_ARTISTS + "." + MediaContract.SongArtists.HOST_ID; String SONG_ARTISTS_ARTISTID = MediaDatabase.Tables.SONG_ARTISTS + "." + MediaContract.SongArtists.ARTISTID; } | /**
* Build an advanced {@link SelectionBuilder} to match the requested
* {@link Uri}. This is usually only used by {@link #query}, since it
* performs table joins useful for {@link Cursor} data.
*/ | Build an advanced <code>SelectionBuilder</code> to match the requested <code>Uri</code>. This is usually only used by <code>#query</code>, since it performs table joins useful for <code>Cursor</code> data | buildQuerySelection | {
"repo_name": "xbmc/Kore",
"path": "app/src/main/java/org/xbmc/kore/provider/MediaProvider.java",
"license": "apache-2.0",
"size": 42867
} | [
"android.net.Uri",
"android.provider.BaseColumns",
"org.xbmc.kore.utils.SelectionBuilder"
] | import android.net.Uri; import android.provider.BaseColumns; import org.xbmc.kore.utils.SelectionBuilder; | import android.net.*; import android.provider.*; import org.xbmc.kore.utils.*; | [
"android.net",
"android.provider",
"org.xbmc.kore"
] | android.net; android.provider; org.xbmc.kore; | 240,408 |
@SmallTest
public void testSharedBufferCreation() {
Core core = CoreImpl.getInstance();
// Test creation with empty options.
core.createSharedBuffer(null, 8).close();
// Test creation with default options.
core.createSharedBuffer(new SharedBufferHandle.CreateOptions(), 8).close();
} | void function() { Core core = CoreImpl.getInstance(); core.createSharedBuffer(null, 8).close(); core.createSharedBuffer(new SharedBufferHandle.CreateOptions(), 8).close(); } | /**
* Testing {@link SharedBufferHandle}.
*/ | Testing <code>SharedBufferHandle</code> | testSharedBufferCreation | {
"repo_name": "danakj/chromium",
"path": "mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java",
"license": "bsd-3-clause",
"size": 26623
} | [
"org.chromium.mojo.system.Core",
"org.chromium.mojo.system.SharedBufferHandle"
] | import org.chromium.mojo.system.Core; import org.chromium.mojo.system.SharedBufferHandle; | import org.chromium.mojo.system.*; | [
"org.chromium.mojo"
] | org.chromium.mojo; | 2,886,381 |
public void setAttributeAsNumberMatrix (String key, List<List<Number>> vals)
{
checkAttachedToNetPlanObject();
netPlan.checkIsModifiable();
final StringBuffer st = new StringBuffer ();
for (int row = 0; row < vals.size() ; row ++)
{
final List<Number> rowVals = vals.get(row);
for (int col = 0; col < rowVals.size() ; col ++)
{
st.append(rowVals.get(col));
if (col != rowVals.size()-1) st.append(MATRIX_COLSEPARATOR);
}
if (row != vals.size()-1) st.append(MATRIX_ROWSEPARATOR);
}
attributes.put (key,st.toString());
} | void function (String key, List<List<Number>> vals) { checkAttachedToNetPlanObject(); netPlan.checkIsModifiable(); final StringBuffer st = new StringBuffer (); for (int row = 0; row < vals.size() ; row ++) { final List<Number> rowVals = vals.get(row); for (int col = 0; col < rowVals.size() ; col ++) { st.append(rowVals.get(col)); if (col != rowVals.size()-1) st.append(MATRIX_COLSEPARATOR); } if (row != vals.size()-1) st.append(MATRIX_ROWSEPARATOR); } attributes.put (key,st.toString()); } | /**
* Sets an attribute for this element, storing the values of the given matrix, so it can be read with setAttributeAsNumberMatrix method.
* If it already exists, previous value is lost.
* @param key Attribute name
* @param vals Attribute vals
*/ | Sets an attribute for this element, storing the values of the given matrix, so it can be read with setAttributeAsNumberMatrix method. If it already exists, previous value is lost | setAttributeAsNumberMatrix | {
"repo_name": "girtel/Net2Plan",
"path": "Net2Plan-Core/src/main/java/com/net2plan/interfaces/networkDesign/NetworkElement.java",
"license": "bsd-2-clause",
"size": 21575
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,265,176 |
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedFlux<SourceControlInner> listSourceControlsAsync(); | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<SourceControlInner> listSourceControlsAsync(); | /**
* Description for Gets the source controls available for Azure websites.
*
* @throws com.azure.resourcemanager.appservice.models.DefaultErrorResponseErrorException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return collection of source controls.
*/ | Description for Gets the source controls available for Azure websites | listSourceControlsAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/fluent/ResourceProvidersClient.java",
"license": "mit",
"size": 46577
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.appservice.fluent.models.SourceControlInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.appservice.fluent.models.SourceControlInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.appservice.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,824,529 |
public Set<Account.Id> findAllByNameOrEmail(String nameOrEmail) throws OrmException, IOException {
int lt = nameOrEmail.indexOf('<');
int gt = nameOrEmail.indexOf('>');
if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) {
Set<Account.Id> ids = emails.getAccountFor(nameOrEmail.substring(lt + 1, gt));
if (ids.isEmpty() || ids.size() == 1) {
return ids;
}
// more than one match, try to return the best one
String name = nameOrEmail.substring(0, lt - 1);
Set<Account.Id> nameMatches = new HashSet<>();
for (Account.Id id : ids) {
Optional<Account> a = byId.get(id).map(AccountState::getAccount);
if (a.isPresent() && name.equals(a.get().getFullName())) {
nameMatches.add(id);
}
}
return nameMatches.isEmpty() ? ids : nameMatches;
}
if (nameOrEmail.contains("@")) {
return emails.getAccountFor(nameOrEmail);
}
Account.Id id = realm.lookup(nameOrEmail);
if (id != null) {
return Collections.singleton(id);
}
List<AccountState> m = accountQueryProvider.get().byFullName(nameOrEmail);
if (m.size() == 1) {
return Collections.singleton(m.get(0).getAccount().getId());
}
// At this point we have no clue. Just perform a whole bunch of suggestions
// and pray we come up with a reasonable result list.
// TODO(dborowitz): This doesn't match the documentation; consider whether it's possible to be
// more strict here.
return accountQueryProvider.get().byDefault(nameOrEmail).stream()
.map(a -> a.getAccount().getId())
.collect(toSet());
} | Set<Account.Id> function(String nameOrEmail) throws OrmException, IOException { int lt = nameOrEmail.indexOf('<'); int gt = nameOrEmail.indexOf('>'); if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) { Set<Account.Id> ids = emails.getAccountFor(nameOrEmail.substring(lt + 1, gt)); if (ids.isEmpty() ids.size() == 1) { return ids; } String name = nameOrEmail.substring(0, lt - 1); Set<Account.Id> nameMatches = new HashSet<>(); for (Account.Id id : ids) { Optional<Account> a = byId.get(id).map(AccountState::getAccount); if (a.isPresent() && name.equals(a.get().getFullName())) { nameMatches.add(id); } } return nameMatches.isEmpty() ? ids : nameMatches; } if (nameOrEmail.contains("@")) { return emails.getAccountFor(nameOrEmail); } Account.Id id = realm.lookup(nameOrEmail); if (id != null) { return Collections.singleton(id); } List<AccountState> m = accountQueryProvider.get().byFullName(nameOrEmail); if (m.size() == 1) { return Collections.singleton(m.get(0).getAccount().getId()); } return accountQueryProvider.get().byDefault(nameOrEmail).stream() .map(a -> a.getAccount().getId()) .collect(toSet()); } | /**
* Locate exactly one account matching the name or name/email string.
*
* @param nameOrEmail a string of the format "Full Name <email@example>", just the email
* address ("email@example"), a full name ("Full Name").
* @return the accounts that match, empty collection if none. Never null.
*/ | Locate exactly one account matching the name or name/email string | findAllByNameOrEmail | {
"repo_name": "WANdisco/gerrit",
"path": "java/com/google/gerrit/server/account/AccountResolver.java",
"license": "apache-2.0",
"size": 10892
} | [
"com.google.gerrit.reviewdb.client.Account",
"com.google.gwtorm.server.OrmException",
"java.io.IOException",
"java.util.Collections",
"java.util.HashSet",
"java.util.List",
"java.util.Optional",
"java.util.Set"
] | import com.google.gerrit.reviewdb.client.Account; import com.google.gwtorm.server.OrmException; import java.io.IOException; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; | import com.google.gerrit.reviewdb.client.*; import com.google.gwtorm.server.*; import java.io.*; import java.util.*; | [
"com.google.gerrit",
"com.google.gwtorm",
"java.io",
"java.util"
] | com.google.gerrit; com.google.gwtorm; java.io; java.util; | 339,076 |
public synchronized E peek()
{
if (size == 0) { throw new EmptyStackException(); }
return this.elementData[size - 1];
}
| synchronized E function() { if (size == 0) { throw new EmptyStackException(); } return this.elementData[size - 1]; } | /**
* Looks at the object at the top of this stack without removing it from the
* stack.
*
* @return the object at the top of this stack.
* @exception EmptyStackException
* if this stack is empty.
*/ | Looks at the object at the top of this stack without removing it from the stack | peek | {
"repo_name": "Spacecraft-Code/SPELL",
"path": "src/spel-gui/com.astra.ses.spell.language/src/com/astra/ses/spell/language/common/FastStack.java",
"license": "lgpl-3.0",
"size": 6035
} | [
"java.util.EmptyStackException"
] | import java.util.EmptyStackException; | import java.util.*; | [
"java.util"
] | java.util; | 1,874,205 |
@Override public void exitType(@NotNull BindingExpressionParser.TypeContext ctx) { } | @Override public void exitType(@NotNull BindingExpressionParser.TypeContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterType | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/databinding/parser/BindingExpressionBaseListener.java",
"license": "gpl-3.0",
"size": 14237
} | [
"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; | 486,121 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName, String resourceName, DigitalTwinsPatchDescription digitalTwinsPatchDescription) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (resourceName == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null."));
}
if (digitalTwinsPatchDescription == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter digitalTwinsPatchDescription is required and cannot be null."));
} else {
digitalTwinsPatchDescription.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
resourceName,
digitalTwinsPatchDescription,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String resourceName, DigitalTwinsPatchDescription digitalTwinsPatchDescription) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (resourceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (digitalTwinsPatchDescription == null) { return Mono .error( new IllegalArgumentException( STR)); } else { digitalTwinsPatchDescription.validate(); } final String accept = STR; return FluxUtil .withContext( context -> service .update( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, resourceName, digitalTwinsPatchDescription, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Update metadata of DigitalTwinsInstance.
*
* @param resourceGroupName The name of the resource group that contains the DigitalTwinsInstance.
* @param resourceName The name of the DigitalTwinsInstance.
* @param digitalTwinsPatchDescription The DigitalTwinsInstance and security metadata.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the description of the DigitalTwins service along with {@link Response} on successful completion of
* {@link Mono}.
*/ | Update metadata of DigitalTwinsInstance | updateWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/digitaltwins/azure-resourcemanager-digitaltwins/src/main/java/com/azure/resourcemanager/digitaltwins/implementation/DigitalTwinsClientImpl.java",
"license": "mit",
"size": 93292
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.digitaltwins.models.DigitalTwinsPatchDescription",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.digitaltwins.models.DigitalTwinsPatchDescription; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.digitaltwins.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 1,090,870 |
static <T, E extends Throwable> ToIntFunctionWithThrowable<T, E> asToIntFunctionWithThrowable(final ToIntFunction<T> tointfunction) {
return tointfunction::applyAsInt;
} | static <T, E extends Throwable> ToIntFunctionWithThrowable<T, E> asToIntFunctionWithThrowable(final ToIntFunction<T> tointfunction) { return tointfunction::applyAsInt; } | /**
* Utility method to convert ToIntFunctionWithThrowable
* @param tointfunction The interface instance
* @param <T> Generic that corresponds to the same generic on ToIntFunction
* @param <E> The type this interface is allowed to throw
* @return the cast interface
*/ | Utility method to convert ToIntFunctionWithThrowable | asToIntFunctionWithThrowable | {
"repo_name": "tisoft/throwable-interfaces",
"path": "src/main/java/org/slieb/throwables/ToIntFunctionWithThrowable.java",
"license": "mit",
"size": 6950
} | [
"java.lang.Throwable",
"java.util.function.ToIntFunction"
] | import java.lang.Throwable; import java.util.function.ToIntFunction; | import java.lang.*; import java.util.function.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,809,597 |
@Override
public int hashCode() {
return hashCode;
}
protected int totalBlocks;
protected int successfulBlocks;
protected Date latestSuccess = CurrentTimeUTC.get();
protected int failedBlocks;
protected int fatallyFailedBlocks;
protected Date latestFailure = null;
protected int minSuccessBlocks;
protected boolean blockSetFinalized;
protected boolean sentToNetwork;
| int function() { return hashCode; } protected int totalBlocks; protected int successfulBlocks; protected Date latestSuccess = CurrentTimeUTC.get(); protected int failedBlocks; protected int fatallyFailedBlocks; protected Date latestFailure = null; protected int minSuccessBlocks; protected boolean blockSetFinalized; protected boolean sentToNetwork; | /**
* We need a hash code that persists across restarts.
*/ | We need a hash code that persists across restarts | hashCode | {
"repo_name": "Juiceman/fred",
"path": "src/freenet/client/async/ClientRequester.java",
"license": "gpl-2.0",
"size": 17180
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,875,304 |
public static final void resetHelp() {
commandHelpInitialized = false;
commandHelp = null;
commandBriefHelpInitialized = false;
commandBriefHelp = null;
}
// #########################################################################
private transient MidiPlayer midiPlayer;
public ShufflePlaylistAction(MidiPlayer midiPlayer,
IJssController shellController, String... args) {
super(ACTION_LABEL, shellController, args);
if (midiPlayer == null) {
throw new IllegalArgumentException("Midi player is null");
}
this.midiPlayer = midiPlayer;
putValue(Action.ACTION_COMMAND_KEY, getDefaultCommandIdentifier());
localeChanged();
}
public ShufflePlaylistAction(MidiPlayer midiPlayer,
IJssController shellController) {
this(midiPlayer, shellController, (String[]) null);
}
public ShufflePlaylistAction(MidiPlayer midiPlayer) {
this(midiPlayer, null, (String[]) null);
} | static final void function() { commandHelpInitialized = false; commandHelp = null; commandBriefHelpInitialized = false; commandBriefHelp = null; } private transient MidiPlayer midiPlayer; public ShufflePlaylistAction(MidiPlayer midiPlayer, IJssController shellController, String... args) { super(ACTION_LABEL, shellController, args); if (midiPlayer == null) { throw new IllegalArgumentException(STR); } this.midiPlayer = midiPlayer; putValue(Action.ACTION_COMMAND_KEY, getDefaultCommandIdentifier()); localeChanged(); } public ShufflePlaylistAction(MidiPlayer midiPlayer, IJssController shellController) { this(midiPlayer, shellController, (String[]) null); } public ShufflePlaylistAction(MidiPlayer midiPlayer) { this(midiPlayer, null, (String[]) null); } | /**
* Reset the static help to force reconstruction on shuffle call.
*
* @since 1.4
*/ | Reset the static help to force reconstruction on shuffle call | resetHelp | {
"repo_name": "madmath03/MidiPlayer",
"path": "src/main/java/midiplayer/frame/action/ShufflePlaylistAction.java",
"license": "mit",
"size": 6856
} | [
"javax.swing.Action"
] | import javax.swing.Action; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,533,585 |
public void logout(String authToken) throws GeneralSecurityException {
if (isAuthTokenValid(authToken)) {
throw new GeneralSecurityException("Invalid service key and authorization token match.");
}
authorizationTokensStorage.remove(authToken);
} | void function(String authToken) throws GeneralSecurityException { if (isAuthTokenValid(authToken)) { throw new GeneralSecurityException(STR); } authorizationTokensStorage.remove(authToken); } | /**
* Invalidate the token
* @param authToken
* @throws GeneralSecurityException
*/ | Invalidate the token | logout | {
"repo_name": "thomasleduc/caveavin",
"path": "src/main/java/net/epita/caveavin/tools/Authenticator.java",
"license": "mit",
"size": 2630
} | [
"java.security.GeneralSecurityException"
] | import java.security.GeneralSecurityException; | import java.security.*; | [
"java.security"
] | java.security; | 1,301,445 |
public void forEachEntry(long parallelismThreshold,
Consumer<? super Map.Entry<K,V>> action) {
if (action == null) throw new NullPointerException();
new ForEachEntryTask<K,V>(null, batchFor(parallelismThreshold), 0, 0, table,
action).invoke();
} | void function(long parallelismThreshold, Consumer<? super Map.Entry<K,V>> action) { if (action == null) throw new NullPointerException(); new ForEachEntryTask<K,V>(null, batchFor(parallelismThreshold), 0, 0, table, action).invoke(); } | /**
* Performs the given action for each entry.
*
* @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel
* @param action the action
* @since 1.8
*/ | Performs the given action for each entry | forEachEntry | {
"repo_name": "dmlloyd/openjdk-modules",
"path": "jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java",
"license": "gpl-2.0",
"size": 267888
} | [
"java.util.Map",
"java.util.function.Consumer"
] | import java.util.Map; import java.util.function.Consumer; | import java.util.*; import java.util.function.*; | [
"java.util"
] | java.util; | 1,077,002 |
public void stop() throws IOException {
logger.info("Stopping storage process...");
ProcessBuilder stopBuilder = process(getStopCommand());
Process stopper = stopBuilder.start();
sleeper.sleepQuietly(SCRIPT_EXECUTE_WAIT_TIME_MS);
try {
int code = stopper.exitValue();
if (code == 0) {
logger.info("Storage process has been stopped");
instanceState.setStorageProxyAlive(false);
} else {
logger.error("Unable to stop storage process. Error code: {}", code);
logProcessOutput(stopper);
}
} catch (Exception e) {
logger.warn("Could not shut down storage process correctly: ", e);
}
} | void function() throws IOException { logger.info(STR); ProcessBuilder stopBuilder = process(getStopCommand()); Process stopper = stopBuilder.start(); sleeper.sleepQuietly(SCRIPT_EXECUTE_WAIT_TIME_MS); try { int code = stopper.exitValue(); if (code == 0) { logger.info(STR); instanceState.setStorageProxyAlive(false); } else { logger.error(STR, code); logProcessOutput(stopper); } } catch (Exception e) { logger.warn(STR, e); } } | /**
* Stop the storage engine (Redis, Memcached).
*
* @throws IOException
*/ | Stop the storage engine (Redis, Memcached) | stop | {
"repo_name": "diegopacheco/dynomite-manager-1",
"path": "dynomitemanager-core/src/main/java/com/netflix/dynomitemanager/storage/StorageProcessManager.java",
"license": "apache-2.0",
"size": 4885
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 921,936 |
public DefaultAuthenticationSequence getDefaultAuthenticationSeq(String sequenceName)
throws DefaultAuthSeqMgtException {
try {
authenticationSeqMgtService = DefaultAuthSeqMgtServiceImpl.getInstance();
return authenticationSeqMgtService.getDefaultAuthenticationSeq(sequenceName, getTenantDomain());
} catch (DefaultAuthSeqMgtServerException e) {
log.error("Error while retrieving default authentication sequence of tenant: " + getTenantDomain(), e);
throw new DefaultAuthSeqMgtException("Server error occurred.");
}
} | DefaultAuthenticationSequence function(String sequenceName) throws DefaultAuthSeqMgtException { try { authenticationSeqMgtService = DefaultAuthSeqMgtServiceImpl.getInstance(); return authenticationSeqMgtService.getDefaultAuthenticationSeq(sequenceName, getTenantDomain()); } catch (DefaultAuthSeqMgtServerException e) { log.error(STR + getTenantDomain(), e); throw new DefaultAuthSeqMgtException(STR); } } | /**
* Retrieve default authentication sequence.
*
* @param sequenceName name of the default authentication sequence
* @return default authentication sequence
* @throws DefaultAuthSeqMgtException
*/ | Retrieve default authentication sequence | getDefaultAuthenticationSeq | {
"repo_name": "omindu/carbon-identity-framework",
"path": "components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/defaultsequence/DefaultAuthSeqMgtAdminService.java",
"license": "apache-2.0",
"size": 7176
} | [
"org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence"
] | import org.wso2.carbon.identity.application.common.model.DefaultAuthenticationSequence; | import org.wso2.carbon.identity.application.common.model.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,474,321 |
ReplicaInfo getReplicaInfo(ExtendedBlock b)
throws ReplicaNotFoundException {
ReplicaInfo info = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
if (info == null) {
throw new ReplicaNotFoundException(
ReplicaNotFoundException.NON_EXISTENT_REPLICA + b);
}
return info;
} | ReplicaInfo getReplicaInfo(ExtendedBlock b) throws ReplicaNotFoundException { ReplicaInfo info = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock()); if (info == null) { throw new ReplicaNotFoundException( ReplicaNotFoundException.NON_EXISTENT_REPLICA + b); } return info; } | /**
* Get the meta info of a block stored in volumeMap. To find a block,
* block pool Id, block Id and generation stamp must match.
* @param b extended block
* @return the meta replica information
* @throws ReplicaNotFoundException if no entry is in the map or
* there is a generation stamp mismatch
*/ | Get the meta info of a block stored in volumeMap. To find a block, block pool Id, block Id and generation stamp must match | getReplicaInfo | {
"repo_name": "odpi/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java",
"license": "apache-2.0",
"size": 113008
} | [
"org.apache.hadoop.hdfs.protocol.ExtendedBlock",
"org.apache.hadoop.hdfs.server.datanode.ReplicaInfo",
"org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException"
] | import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo; import org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException; | import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.datanode.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 397,469 |
boolean contains(T name, T value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator); | boolean contains(T name, T value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator); | /**
* Returns {@code true} if a header with the name and value exists.
*
* @param name the header name
* @param value the header value
* @param keyComparator The comparator to use when comparing {@code name} to names in this map
* @param valueComparator The comparator to use when comparing {@code value} to values in this map
* @return {@code true} if it contains it {@code false} otherwise
*/ | Returns true if a header with the name and value exists | contains | {
"repo_name": "Sandyarathi/Lab2gRPC",
"path": "lib/netty/codec/src/main/java/io/netty/handler/codec/Headers.java",
"license": "bsd-3-clause",
"size": 42328
} | [
"java.util.Comparator"
] | import java.util.Comparator; | import java.util.*; | [
"java.util"
] | java.util; | 1,539,962 |
private void expectCallToHasPermissionForPerson(Person person, boolean hasPermission) throws AuthenticationException {
expect(authorizer.hasPermission(PROJECT_ID,
person.getId(),
"system.project",
PROJECT_ID,
"read%")).andReturn(hasPermission);
} | void function(Person person, boolean hasPermission) throws AuthenticationException { expect(authorizer.hasPermission(PROJECT_ID, person.getId(), STR, PROJECT_ID, "read%")).andReturn(hasPermission); } | /** Expect call to has permission for person.
*
* @param person
* the person
* @param hasPermission
* the has permission
* @throws AuthenticationException
* the authentication exception
*/ | Expect call to has permission for person | expectCallToHasPermissionForPerson | {
"repo_name": "alarulrajan/CodeFest",
"path": "test/com/technoetic/xplanner/security/auth/TestPermissionHelper.java",
"license": "gpl-2.0",
"size": 4528
} | [
"com.technoetic.xplanner.security.AuthenticationException",
"net.sf.xplanner.domain.Person",
"org.easymock.EasyMock"
] | import com.technoetic.xplanner.security.AuthenticationException; import net.sf.xplanner.domain.Person; import org.easymock.EasyMock; | import com.technoetic.xplanner.security.*; import net.sf.xplanner.domain.*; import org.easymock.*; | [
"com.technoetic.xplanner",
"net.sf.xplanner",
"org.easymock"
] | com.technoetic.xplanner; net.sf.xplanner; org.easymock; | 76,522 |
public static void saveBitmap(Bitmap bitmap, String fileName) {
File file = new File(fileName);
FileOutputStream out;
try{
out = new FileOutputStream(file);
if (bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out)) {
out.flush();
out.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if(bitmap != null && !bitmap.isRecycled()){
bitmap.recycle();
bitmap = null;
}
System.gc();
}
}
| static void function(Bitmap bitmap, String fileName) { File file = new File(fileName); FileOutputStream out; try{ out = new FileOutputStream(file); if (bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out)) { out.flush(); out.close(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(bitmap != null && !bitmap.isRecycled()){ bitmap.recycle(); bitmap = null; } System.gc(); } } | /**
* <p>Save bitmap to file name<p>
*
* @param bitmap
* @param fileName
* @throws java.io.IOException
*/ | Save bitmap to file name | saveBitmap | {
"repo_name": "ganjpxm/GAppAs",
"path": "glib/src/main/java/org/ganjp/glib/core/util/ImageUtil.java",
"license": "apache-2.0",
"size": 7496
} | [
"android.graphics.Bitmap",
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.IOException"
] | import android.graphics.Bitmap; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; | import android.graphics.*; import java.io.*; | [
"android.graphics",
"java.io"
] | android.graphics; java.io; | 2,596,421 |
@Test
public void testBuffer() { // NOPMD (assert missing)
for (int i=0;i<ARRAY_LENGTH;i++) {
// initialize
MemSwapUsageRecord record = new MemSwapUsageRecord(LONG_VALUES.get(i % LONG_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()));
// check values
Assert.assertEquals("MemSwapUsageRecord.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp());
Assert.assertEquals("MemSwapUsageRecord.hostname values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null?"":STRING_VALUES.get(i % STRING_VALUES.size()), record.getHostname());
Assert.assertEquals("MemSwapUsageRecord.memTotal values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getMemTotal());
Assert.assertEquals("MemSwapUsageRecord.memUsed values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getMemUsed());
Assert.assertEquals("MemSwapUsageRecord.memFree values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getMemFree());
Assert.assertEquals("MemSwapUsageRecord.swapTotal values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getSwapTotal());
Assert.assertEquals("MemSwapUsageRecord.swapUsed values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getSwapUsed());
Assert.assertEquals("MemSwapUsageRecord.swapFree values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getSwapFree());
}
}
| void function() { for (int i=0;i<ARRAY_LENGTH;i++) { MemSwapUsageRecord record = new MemSwapUsageRecord(LONG_VALUES.get(i % LONG_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size())); Assert.assertEquals(STR, (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals(STR, STRING_VALUES.get(i % STRING_VALUES.size()) == null?STRMemSwapUsageRecord.memTotal values are not equal.STRMemSwapUsageRecord.memUsed values are not equal.STRMemSwapUsageRecord.memFree values are not equal.STRMemSwapUsageRecord.swapTotal values are not equal.STRMemSwapUsageRecord.swapUsed values are not equal.STRMemSwapUsageRecord.swapFree values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getSwapFree()); } } | /**
* Tests {@link MemSwapUsageRecord#TestMemSwapUsageRecord(String, String, long, long, long, String, int, int)}.
*/ | Tests <code>MemSwapUsageRecord#TestMemSwapUsageRecord(String, String, long, long, long, String, int, int)</code> | testBuffer | {
"repo_name": "HaStr/kieker",
"path": "kieker-common/test-gen/kieker/test/common/junit/record/system/TestGeneratedMemSwapUsageRecord.java",
"license": "apache-2.0",
"size": 11216
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,150,989 |
private void startSendingEmail() {
Intent it = new Intent(Intent.ACTION_SEND);
it.setType("plain/text");
it.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{emailAddress});
//it.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
it.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(message));
startActivity(Intent.createChooser(it, getString(R.string.choose_email_client)));
finish();
}
private class SAXHandler extends DefaultHandler {
private StringBuilder sb = new StringBuilder(); | void function() { Intent it = new Intent(Intent.ACTION_SEND); it.setType(STR); it.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{emailAddress}); it.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(message)); startActivity(Intent.createChooser(it, getString(R.string.choose_email_client))); finish(); } private class SAXHandler extends DefaultHandler { private StringBuilder sb = new StringBuilder(); | /**
* Starts the standart email client to send email.
*/ | Starts the standart email client to send email | startSendingEmail | {
"repo_name": "iBuildApp/android_module_TapToEmail",
"path": "src/main/java/com/ibuildapp/romanblack/EmailPlugin/EmailPlugin.java",
"license": "apache-2.0",
"size": 5514
} | [
"android.content.Intent",
"android.text.Html",
"org.xml.sax.helpers.DefaultHandler"
] | import android.content.Intent; import android.text.Html; import org.xml.sax.helpers.DefaultHandler; | import android.content.*; import android.text.*; import org.xml.sax.helpers.*; | [
"android.content",
"android.text",
"org.xml.sax"
] | android.content; android.text; org.xml.sax; | 1,135,519 |
public void testQueryContainsKeyOnCharacter()
{
try
{
Gym gym1 = new Gym();
gym1.setName("Cinema");
gym1.setLocation("First floor");
gym1.getCodes().put(new Character('a'), new String("aaaaa"));
PersistenceManager pm = pmf.getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
pm.makePersistent(gym1);
tx.commit();
tx.begin();
Query q = pm.newQuery(Gym.class);
q.setFilter("codes.containsKey('a')");
Collection c = (Collection) q.execute();
assertEquals(1, c.size());
q = pm.newQuery(Gym.class);
q.setFilter("codes.containsKey('b')");
c = (Collection) q.execute();
assertEquals(0, c.size());
tx.commit();
}
finally
{
if (tx.isActive())
{
tx.rollback();
}
pm.close();
}
}
finally
{
// Clean out our data
FitnessHelper.cleanFitnessData(pmf);
}
}
| void function() { try { Gym gym1 = new Gym(); gym1.setName(STR); gym1.setLocation(STR); gym1.getCodes().put(new Character('a'), new String("aaaaa")); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); pm.makePersistent(gym1); tx.commit(); tx.begin(); Query q = pm.newQuery(Gym.class); q.setFilter(STR); Collection c = (Collection) q.execute(); assertEquals(1, c.size()); q = pm.newQuery(Gym.class); q.setFilter(STR); c = (Collection) q.execute(); assertEquals(0, c.size()); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } finally { FitnessHelper.cleanFitnessData(pmf); } } | /**
* Test for the Map.containsKey(Character) method.
*/ | Test for the Map.containsKey(Character) method | testQueryContainsKeyOnCharacter | {
"repo_name": "hopecee/texsts",
"path": "jdo/identity/src/test/org/datanucleus/tests/JDOQLContainerTest.java",
"license": "apache-2.0",
"size": 235732
} | [
"java.util.Collection",
"javax.jdo.PersistenceManager",
"javax.jdo.Query",
"javax.jdo.Transaction",
"org.jpox.samples.models.fitness.FitnessHelper",
"org.jpox.samples.models.fitness.Gym"
] | import java.util.Collection; import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; import org.jpox.samples.models.fitness.FitnessHelper; import org.jpox.samples.models.fitness.Gym; | import java.util.*; import javax.jdo.*; import org.jpox.samples.models.fitness.*; | [
"java.util",
"javax.jdo",
"org.jpox.samples"
] | java.util; javax.jdo; org.jpox.samples; | 1,818,098 |
private static ImageDescriptor getImageDescriptor(String path) {
return ImageDescriptor.createFromURL(Application.class
.getResource(path));
}
| static ImageDescriptor function(String path) { return ImageDescriptor.createFromURL(Application.class .getResource(path)); } | /**
* Returns image descriptor for image at the specified path.
*
* @param path
* the path to an image.
* @return a descriptor for specified image. When image not found returns
* <code>null</code>.
*/ | Returns image descriptor for image at the specified path | getImageDescriptor | {
"repo_name": "mbykovskyy/spritey",
"path": "spritey.ui/src/spritey/ui/Application.java",
"license": "gpl-3.0",
"size": 5850
} | [
"org.eclipse.jface.resource.ImageDescriptor"
] | import org.eclipse.jface.resource.ImageDescriptor; | import org.eclipse.jface.resource.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 118,692 |
public void release() {
CassandraHelper.closeSession(ses);
ses = null;
} | void function() { CassandraHelper.closeSession(ses); ses = null; } | /**
* Closes wrapped Cassandra driver session
*/ | Closes wrapped Cassandra driver session | release | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/cassandra/store/src/main/java/org/apache/ignite/cache/store/cassandra/session/pool/IdleSession.java",
"license": "apache-2.0",
"size": 2298
} | [
"org.apache.ignite.cache.store.cassandra.common.CassandraHelper"
] | import org.apache.ignite.cache.store.cassandra.common.CassandraHelper; | import org.apache.ignite.cache.store.cassandra.common.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,662,458 |
public Class<? extends ValueFinder> getLookupFieldQuickfinderParameterStringBuilderClass(Class businessObjectClass,
String attributeName); | Class<? extends ValueFinder> function(Class businessObjectClass, String attributeName); | /**
* This method returns the quickfinder parameter string builder class for a
* given attribute. See
* {@link FieldDefinition#getQuickfinderParameterStringBuilderClass()}.
*
* @param businessObjectClass
* @param attributeName
* @return value finder class
*/ | This method returns the quickfinder parameter string builder class for a given attribute. See <code>FieldDefinition#getQuickfinderParameterStringBuilderClass()</code> | getLookupFieldQuickfinderParameterStringBuilderClass | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-kns/src/main/java/org/kuali/kfs/kns/service/BusinessObjectMetaDataService.java",
"license": "agpl-3.0",
"size": 7473
} | [
"org.kuali.kfs.krad.valuefinder.ValueFinder"
] | import org.kuali.kfs.krad.valuefinder.ValueFinder; | import org.kuali.kfs.krad.valuefinder.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,147,821 |
private void assertAllContextMenuOptionsArePresent(final String shareableURL,
final String nonShareableURL) {
mAsserter.ok(StringUtils.isShareableUrl(shareableURL), "Ensuring url is shareable", "");
mAsserter.ok(!StringUtils.isShareableUrl(nonShareableURL), "Ensuring url is not shareable", "");
openBookmarkContextMenu(shareableURL);
for (String contextMenuOption : mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
mAsserter.ok(mSolo.searchText(contextMenuOption),
"Checking that the context menu option is present",
contextMenuOption + " is present");
}
// Close the menu.
mSolo.goBack();
openBookmarkContextMenu(nonShareableURL);
for (String contextMenuOption : mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
// This link is not shareable: skip the "Share" option.
if ("Share".equals(contextMenuOption)) {
continue;
}
mAsserter.ok(mSolo.searchText(contextMenuOption),
"Checking that the context menu option is present",
contextMenuOption + " is present");
}
// The use of Solo.searchText is potentially fragile as It will only
// scroll the most recently drawn view. Works fine for now though.
mAsserter.ok(!mSolo.searchText("Share"),
"Checking that the Share option is not present",
"Share option is not present");
// Close the menu.
mSolo.goBack();
} | void function(final String shareableURL, final String nonShareableURL) { mAsserter.ok(StringUtils.isShareableUrl(shareableURL), STR, STREnsuring url is not shareableSTRSTRChecking that the context menu option is presentSTR is presentSTRShareSTRChecking that the context menu option is presentSTR is presentSTRShareSTRChecking that the Share option is not presentSTRShare option is not present"); mSolo.goBack(); } | /**
* Asserts that all context menu items are present on the given links. For one link,
* the context menu is expected to not have the "Share" context menu item.
*
* @param shareableURL A URL that is expected to have the "Share" context menu item
* @param nonShareableURL A URL that is expected not to have the "Share" context menu item.
*/ | Asserts that all context menu items are present on the given links. For one link, the context menu is expected to not have the "Share" context menu item | assertAllContextMenuOptionsArePresent | {
"repo_name": "jrconlin/mc_backup",
"path": "tests/browser/robocop/testBookmarksPanel.java",
"license": "mpl-2.0",
"size": 7754
} | [
"org.mozilla.gecko.util.StringUtils"
] | import org.mozilla.gecko.util.StringUtils; | import org.mozilla.gecko.util.*; | [
"org.mozilla.gecko"
] | org.mozilla.gecko; | 1,558,284 |
public boolean canCreateFileSystem(final FileObject file)
throws FileSystemException
{
return map.getScheme(file) != null;
} | boolean function(final FileObject file) throws FileSystemException { return map.getScheme(file) != null; } | /**
* Determines if a layered file system can be created for a given file.
*
* @param file The file to check for.
* @return true if the FileSystem can be created.
* @throws FileSystemException if an error occurs.
*/ | Determines if a layered file system can be created for a given file | canCreateFileSystem | {
"repo_name": "sandamal/wso2-commons-vfs",
"path": "core/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java",
"license": "apache-2.0",
"size": 38500
} | [
"org.apache.commons.vfs2.FileObject",
"org.apache.commons.vfs2.FileSystemException"
] | import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,108,758 |
void locked(List<String> ids); | void locked(List<String> ids); | /**
* The "locked" notification is provided to notify a client that it has been
* granted a lock that it had previously requested with the "lock" method.
* @param ids the locked ids
*/ | The "locked" notification is provided to notify a client that it has been granted a lock that it had previously requested with the "lock" method | locked | {
"repo_name": "gkatsikas/onos",
"path": "protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/Callback.java",
"license": "apache-2.0",
"size": 1694
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,861,666 |
public void addOption(final PreferencesCategory category) {
this.category = category;
for (final PreferencesSetting setting : category.getSettings()) {
if (settings.get(setting) == null) {
final JComponent component = compFactory.getComponent(setting);
component.setName(setting.getTitle());
settings.put(setting, component);
}
if (setting.isSet()) {
addCurrentOption(settings.get(setting));
} else {
addAddableOption(settings.get(setting));
}
}
} | void function(final PreferencesCategory category) { this.category = category; for (final PreferencesSetting setting : category.getSettings()) { if (settings.get(setting) == null) { final JComponent component = compFactory.getComponent(setting); component.setName(setting.getTitle()); settings.put(setting, component); } if (setting.isSet()) { addCurrentOption(settings.get(setting)); } else { addAddableOption(settings.get(setting)); } } } | /**
* Adds an option to the settings panel.
*
* @param category Category of options to add
*/ | Adds an option to the settings panel | addOption | {
"repo_name": "DMDirc/Plugins",
"path": "ui_swing/src/main/java/com/dmdirc/addons/ui_swing/components/expandingsettings/SettingsPanel.java",
"license": "mit",
"size": 7395
} | [
"com.dmdirc.config.prefs.PreferencesCategory",
"com.dmdirc.config.prefs.PreferencesSetting",
"javax.swing.JComponent"
] | import com.dmdirc.config.prefs.PreferencesCategory; import com.dmdirc.config.prefs.PreferencesSetting; import javax.swing.JComponent; | import com.dmdirc.config.prefs.*; import javax.swing.*; | [
"com.dmdirc.config",
"javax.swing"
] | com.dmdirc.config; javax.swing; | 171,330 |
public IPreset addUserPreset(String name, String description);
| IPreset function(String name, String description); | /**
* Convenience function to simply add a new preset created by a user. This function guarantees the preset will get
* an identifier that is not yet taken, based on the name of the preset.
*
* @param name
* The name of the {@link IPreset}.
* @param description
* The description of the {@link IPreset}.
* @return the {@link IPreset} that was created
*/ | Convenience function to simply add a new preset created by a user. This function guarantees the preset will get an identifier that is not yet taken, based on the name of the preset | addUserPreset | {
"repo_name": "stachch/Privacy_Management_Platform",
"path": "code/PMP/PMP/src/main/java/de/unistuttgart/ipvs/pmp/model/IModel.java",
"license": "apache-2.0",
"size": 8502
} | [
"de.unistuttgart.ipvs.pmp.model.element.preset.IPreset"
] | import de.unistuttgart.ipvs.pmp.model.element.preset.IPreset; | import de.unistuttgart.ipvs.pmp.model.element.preset.*; | [
"de.unistuttgart.ipvs"
] | de.unistuttgart.ipvs; | 599,393 |
public Builder accessUrls(List<String> accessUrls) {
this.accessUrls = accessUrls;
return this;
}
/**
* Returns a {@code Label} built from the parameters previously set.
*
* @return a {@code Label} built with parameters of this {@code Label.Builder} | Builder function(List<String> accessUrls) { this.accessUrls = accessUrls; return this; } /** * Returns a {@code Label} built from the parameters previously set. * * @return a {@code Label} built with parameters of this {@code Label.Builder} | /**
* Sets the {@code accessUrls} and returns a reference to this Builder so that the methods can be chained
* together.
*
* @param accessUrls the {@code accessUrls} to set
* @return a reference to this Builder
*/ | Sets the accessUrls and returns a reference to this Builder so that the methods can be chained together | accessUrls | {
"repo_name": "sambaheerathan/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/models/Label.java",
"license": "apache-2.0",
"size": 3450
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,459,217 |
public Date getTimeBefore(Date endTime) {
// TODO: implement QUARTZ-423
return null;
} | Date function(Date endTime) { return null; } | /**
* NOT YET IMPLEMENTED: Returns the time before the given time
* that the <code>CronExpression</code> matches.
*/ | that the <code>CronExpression</code> matches | getTimeBefore | {
"repo_name": "michelegonella/zen-project",
"path": "zen-core/src/main/java/com/nominanuda/zen/time/CronExpression.java",
"license": "apache-2.0",
"size": 61199
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,684,128 |
Report endAnalysis(@Nullable E oldElement, @Nullable E newElement); | Report endAnalysis(@Nullable E oldElement, @Nullable E newElement); | /**
* Called when the analysis of the two elements ends (i.e. all the children have been visited).
*
* @param oldElement
* the element from the old archives
* @param newElement
* the element from the new archives
*
* @return a report detailing the difference found between these two elements
*/ | Called when the analysis of the two elements ends (i.e. all the children have been visited) | endAnalysis | {
"repo_name": "revapi/revapi",
"path": "revapi/src/main/java/org/revapi/DifferenceAnalyzer.java",
"license": "apache-2.0",
"size": 3032
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 435,459 |
public Select limit(int limit) {
return statement.limit(limit);
}
}
public static class Builder {
protected List<Object> columnNames;
protected Builder() {}
Builder(List<Object> columnNames) {
this.columnNames = columnNames;
} | Select function(int limit) { return statement.limit(limit); } } public static class Builder { protected List<Object> columnNames; protected Builder() {} Builder(List<Object> columnNames) { this.columnNames = columnNames; } | /**
* Adds a LIMIT clause to the SELECT statement this Where clause if
* part of.
*
* @param limit the limit to set.
* @return the select statement this Where clause if part of.
*
* @throws IllegalArgumentException if {@code limit >e; 0}.
* @throws IllegalStateException if a LIMIT clause has already been
* provided.
*/ | Adds a LIMIT clause to the SELECT statement this Where clause if part of | limit | {
"repo_name": "InnovaCo/java-driver",
"path": "driver-core/src/main/java/com/datastax/driver/core/querybuilder/Select.java",
"license": "apache-2.0",
"size": 11068
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,111,066 |
@RequestMapping(method = RequestMethod.GET, value="/status/config")
protected ModelAndView handleRequestInternal(
final HttpServletRequest request, final HttpServletResponse response)
throws Exception {
return new ModelAndView(VIEW_CONFIG);
} | @RequestMapping(method = RequestMethod.GET, value=STR) ModelAndView function( final HttpServletRequest request, final HttpServletResponse response) throws Exception { return new ModelAndView(VIEW_CONFIG); } | /**
* Handle request.
*
* @param request the request
* @param response the response
* @return the model and view
* @throws Exception the exception
*/ | Handle request | handleRequestInternal | {
"repo_name": "moghaddam/cas",
"path": "cas-server-webapp-reports/src/main/java/org/jasig/cas/web/report/InternalConfigStateController.java",
"license": "apache-2.0",
"size": 2135
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.servlet.ModelAndView"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; | import javax.servlet.http.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.springframework.web"
] | javax.servlet; org.springframework.web; | 17,261 |
public static boolean equals(ItemStack first, ItemStack second)
{
return (comparator.compare(first, second) == 0);
} | static boolean function(ItemStack first, ItemStack second) { return (comparator.compare(first, second) == 0); } | /**
* Compares two ItemStacks for equality, testing itemID, metaData, stackSize, and their NBTTagCompounds (if they are
* present)
*
* @param first The first ItemStack being tested for equality
* @param second The second ItemStack being tested for equality
* @return true if the two ItemStacks are equivalent, false otherwise
*/ | Compares two ItemStacks for equality, testing itemID, metaData, stackSize, and their NBTTagCompounds (if they are present) | equals | {
"repo_name": "P3pp3rF1y/BigMachines",
"path": "src/main/java/com/p3pp3rf1y/bigmachines/utility/ItemHelper.java",
"license": "gpl-3.0",
"size": 7078
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 51,141 |
public long getTotalMemoryConsumption() {
long totalDataPagesSize = 0L;
for (MemoryBlock dataPage : dataPages) {
totalDataPagesSize += dataPage.size();
}
return totalDataPagesSize + ((longArray != null) ? longArray.memoryBlock().size() : 0L);
} | long function() { long totalDataPagesSize = 0L; for (MemoryBlock dataPage : dataPages) { totalDataPagesSize += dataPage.size(); } return totalDataPagesSize + ((longArray != null) ? longArray.memoryBlock().size() : 0L); } | /**
* Returns the total amount of memory, in bytes, consumed by this map's managed structures.
*/ | Returns the total amount of memory, in bytes, consumed by this map's managed structures | getTotalMemoryConsumption | {
"repo_name": "apache/spark",
"path": "core/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java",
"license": "apache-2.0",
"size": 34216
} | [
"org.apache.spark.unsafe.memory.MemoryBlock"
] | import org.apache.spark.unsafe.memory.MemoryBlock; | import org.apache.spark.unsafe.memory.*; | [
"org.apache.spark"
] | org.apache.spark; | 2,749,480 |
@Override
public void initialize() {
removeAll();
add(question, "span, wrap 20");
final Player player = getMyPlayer();
final Europe europe = player.getEurope();
// price may have changed
Collections.sort(trainableUnits, unitPriceComparator);
for (UnitType unitType : trainableUnits) {
int price = europe.getUnitPrice(unitType);
JButton newButton = new JButton();
newButton.setLayout(new MigLayout("wrap 2", "[60]", "[30][30]"));
ImageIcon unitIcon = getLibrary().getUnitImageIcon(unitType, (price > player.getGold()));
JLabel unitName = new JLabel(Messages.getName(unitType));
JLabel unitPrice = new JLabel(Messages.message("goldAmount", "%amount%",
String.valueOf(price)));
if (price > player.getGold()) {
unitName.setEnabled(false);
unitPrice.setEnabled(false);
newButton.setEnabled(false);
}
newButton.add(new JLabel(getLibrary().getScaledImageIcon(unitIcon, 0.66f)), "span 1 2");
newButton.add(unitName);
newButton.add(unitPrice);
newButton.setActionCommand(unitType.getId());
newButton.addActionListener(this);
enterPressesWhenFocused(newButton);
add(newButton, "grow");
}
add(done, "newline 20, span, tag ok");
setSize(getPreferredSize());
revalidate();
} | void function() { removeAll(); add(question, STR); final Player player = getMyPlayer(); final Europe europe = player.getEurope(); Collections.sort(trainableUnits, unitPriceComparator); for (UnitType unitType : trainableUnits) { int price = europe.getUnitPrice(unitType); JButton newButton = new JButton(); newButton.setLayout(new MigLayout(STR, "[60]", STR)); ImageIcon unitIcon = getLibrary().getUnitImageIcon(unitType, (price > player.getGold())); JLabel unitName = new JLabel(Messages.getName(unitType)); JLabel unitPrice = new JLabel(Messages.message(STR, STR, String.valueOf(price))); if (price > player.getGold()) { unitName.setEnabled(false); unitPrice.setEnabled(false); newButton.setEnabled(false); } newButton.add(new JLabel(getLibrary().getScaledImageIcon(unitIcon, 0.66f)), STR); newButton.add(unitName); newButton.add(unitPrice); newButton.setActionCommand(unitType.getId()); newButton.addActionListener(this); enterPressesWhenFocused(newButton); add(newButton, "grow"); } add(done, STR); setSize(getPreferredSize()); revalidate(); } | /**
* Updates this panel's labels so that the information it displays is up to
* date.
*/ | Updates this panel's labels so that the information it displays is up to date | initialize | {
"repo_name": "tectronics/reformationofeurope",
"path": "src/net/sf/freecol/client/gui/panel/TrainDialog.java",
"license": "gpl-2.0",
"size": 5534
} | [
"java.util.Collections",
"javax.swing.ImageIcon",
"javax.swing.JButton",
"javax.swing.JLabel",
"net.miginfocom.swing.MigLayout",
"net.sf.freecol.client.gui.i18n.Messages",
"net.sf.freecol.common.model.Europe",
"net.sf.freecol.common.model.Player",
"net.sf.freecol.common.model.UnitType"
] | import java.util.Collections; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import net.miginfocom.swing.MigLayout; import net.sf.freecol.client.gui.i18n.Messages; import net.sf.freecol.common.model.Europe; import net.sf.freecol.common.model.Player; import net.sf.freecol.common.model.UnitType; | import java.util.*; import javax.swing.*; import net.miginfocom.swing.*; import net.sf.freecol.client.gui.i18n.*; import net.sf.freecol.common.model.*; | [
"java.util",
"javax.swing",
"net.miginfocom.swing",
"net.sf.freecol"
] | java.util; javax.swing; net.miginfocom.swing; net.sf.freecol; | 2,373,387 |
private static void registerJavaContext(ContributionContextTypeRegistry registry, String id, TemplateContextType parent) {
TemplateContextType contextType = registry.getContextType(id);
Iterator<TemplateVariableResolver> iter = parent.resolvers();
while (iter.hasNext())
contextType.addResolver(iter.next());
} | static void function(ContributionContextTypeRegistry registry, String id, TemplateContextType parent) { TemplateContextType contextType = registry.getContextType(id); Iterator<TemplateVariableResolver> iter = parent.resolvers(); while (iter.hasNext()) contextType.addResolver(iter.next()); } | /**
* Registers the given Java template context.
*
* @param registry the template context type registry
* @param id the context type id
* @param parent the parent context type
* @since 3.4
*/ | Registers the given Java template context | registerJavaContext | {
"repo_name": "kaloyan-raev/che",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/ui/JavaPlugin.java",
"license": "epl-1.0",
"size": 17632
} | [
"java.util.Iterator",
"org.eclipse.jface.text.templates.TemplateContextType",
"org.eclipse.jface.text.templates.TemplateVariableResolver",
"org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry"
] | import java.util.Iterator; import org.eclipse.jface.text.templates.TemplateContextType; import org.eclipse.jface.text.templates.TemplateVariableResolver; import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry; | import java.util.*; import org.eclipse.jface.text.templates.*; import org.eclipse.ui.editors.text.templates.*; | [
"java.util",
"org.eclipse.jface",
"org.eclipse.ui"
] | java.util; org.eclipse.jface; org.eclipse.ui; | 927,491 |
public YamlConfigurationOptions indent(int value) {
Preconditions.checkArgument(value >= 2, "Indent must be at least 2 characters");
Preconditions.checkArgument(value <= 9, "Indent cannot be greater than 9 characters");
this.indent = value;
return this;
} | YamlConfigurationOptions function(int value) { Preconditions.checkArgument(value >= 2, STR); Preconditions.checkArgument(value <= 9, STR); this.indent = value; return this; } | /**
* Sets how much spaces should be used to indent each line.
* <p/>
* The minimum value this may be is 2, and the maximum is 9.
*
* @param value New indent
* @return This object, for chaining
*/ | Sets how much spaces should be used to indent each line. The minimum value this may be is 2, and the maximum is 9 | indent | {
"repo_name": "Glydar/Glydar.next",
"path": "ParaGlydar/src/main/java/org/glydar/paraglydar/configuration/file/YamlConfigurationOptions.java",
"license": "lgpl-3.0",
"size": 1677
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,207,247 |
public void delete(long app, List<Long> ids) throws DBException {
List<Record> records = new ArrayList<Record>();
for (Long id : ids) {
Record record = new Record();
record.setId(id);
records.add(record);
}
deleteRecords(app, records);
}
| void function(long app, List<Long> ids) throws DBException { List<Record> records = new ArrayList<Record>(); for (Long id : ids) { Record record = new Record(); record.setId(id); records.add(record); } deleteRecords(app, records); } | /**
* Deletes records.
* @param app
* application id
* @param ids
* a list of record numbers to be deleted
* @throws DBException
*/ | Deletes records | delete | {
"repo_name": "kintone/java-sdk",
"path": "kintone-sdk/src/main/java/com/cybozu/kintone/database/Connection.java",
"license": "apache-2.0",
"size": 49879
} | [
"com.cybozu.kintone.database.exception.DBException",
"java.util.ArrayList",
"java.util.List"
] | import com.cybozu.kintone.database.exception.DBException; import java.util.ArrayList; import java.util.List; | import com.cybozu.kintone.database.exception.*; import java.util.*; | [
"com.cybozu.kintone",
"java.util"
] | com.cybozu.kintone; java.util; | 182,089 |
public void addEnum( EnumType enumeration ) {
// Find a random new position. getWidth and getheight return 0
// if we are called on a new diagram.
int fNextNodeX = (int)(Math.random() * Math.max( 100, getWidth() ));
int fNextNodeY = (int)(Math.random() * Math.max( 100, getHeight() ));
EnumNode n = new EnumNode( enumeration, fOpt );
n.setPosition( fNextNodeX, fNextNodeY );
fGraph.add( n );
visibleData.fEnumToNodeMap.put( enumeration, n );
fLayouter = null;
} | void function( EnumType enumeration ) { int fNextNodeX = (int)(Math.random() * Math.max( 100, getWidth() )); int fNextNodeY = (int)(Math.random() * Math.max( 100, getHeight() )); EnumNode n = new EnumNode( enumeration, fOpt ); n.setPosition( fNextNodeX, fNextNodeY ); fGraph.add( n ); visibleData.fEnumToNodeMap.put( enumeration, n ); fLayouter = null; } | /**
* Adds an enumeration to the diagram.
*
* @param enumeration Enumeration to be added.
*/ | Adds an enumeration to the diagram | addEnum | {
"repo_name": "classicwuhao/maxuse",
"path": "src/gui/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java",
"license": "gpl-2.0",
"size": 57937
} | [
"org.tzi.use.uml.ocl.type.EnumType"
] | import org.tzi.use.uml.ocl.type.EnumType; | import org.tzi.use.uml.ocl.type.*; | [
"org.tzi.use"
] | org.tzi.use; | 2,385,663 |
public void toggleAll(boolean b){
Component[] nodes = getComponents();
for(int i = 0; i < nodes.length; i++){
FreeNode n = (FreeNode)nodes[i];
if(b)
n.expand();
else
n.collapse();
}
}
| void function(boolean b){ Component[] nodes = getComponents(); for(int i = 0; i < nodes.length; i++){ FreeNode n = (FreeNode)nodes[i]; if(b) n.expand(); else n.collapse(); } } | /**
* expand/collapse all nodeds
* @param b iff <CODE>true</CODE> then exand all nodes
*/ | expand/collapse all nodeds | toggleAll | {
"repo_name": "akarve/giant.java",
"path": "giantystem/dev/net/giantsystem/sf/FreeTree.java",
"license": "mit",
"size": 4993
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,731,138 |
@Override
public Object callFunction(String name, ArrayList params) throws FSException {
Integer delayTime = 0;
// Funktion call for delay
if (name.toLowerCase().equals("delay")) {
try {
// check for valid parameter
if (params.get(0) instanceof Integer) {
delayTime = (Integer) params.get(0);
Thread.sleep(delayTime.intValue() * 1000);
}
} catch (Exception ex) {
logger.error("failed to parse parameters: " + ex.getMessage());
}
} else {
throw new FSUnsupportedException(name);
}
return null;
} | Object function(String name, ArrayList params) throws FSException { Integer delayTime = 0; if (name.toLowerCase().equals("delay")) { try { if (params.get(0) instanceof Integer) { delayTime = (Integer) params.get(0); Thread.sleep(delayTime.intValue() * 1000); } } catch (Exception ex) { logger.error(STR + ex.getMessage()); } } else { throw new FSUnsupportedException(name); } return null; } | /** Function implements script acees funtions
*
* @param name
* @param params index 0 is device instance name
* index 1 is slot number 1 - 5
* index 2 is relay number 0 - 15 (depends on installed card)
* index 3 is new state 0 / 1
* @return
* @throws murlen.util.fscript.FSException
*
*/ | Function implements script acees funtions | callFunction | {
"repo_name": "oh3ebf/MeasurementToolKit",
"path": "sw/Instrument/src/scriptEngine/SleepExtension.java",
"license": "gpl-2.0",
"size": 2468
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,052,279 |
@Override
public FsVolume rename(String name) {
return new FsVolume(DSL.name(name), null);
} | FsVolume function(String name) { return new FsVolume(DSL.name(name), null); } | /**
* Rename this table
*/ | Rename this table | rename | {
"repo_name": "gchq/stroom",
"path": "stroom-data/stroom-data-store-impl-fs-db-jooq/src/main/java/stroom/data/store/impl/fs/db/jooq/tables/FsVolume.java",
"license": "apache-2.0",
"size": 6718
} | [
"org.jooq.impl.DSL"
] | import org.jooq.impl.DSL; | import org.jooq.impl.*; | [
"org.jooq.impl"
] | org.jooq.impl; | 2,658,418 |
public static IBlock normalizeCourseStructure(CourseStructureV1Model courseStructureV1Model, String courseId){
BlockModel topBlock = courseStructureV1Model.getBlockById(courseStructureV1Model.root);
CourseComponent course = new CourseComponent(topBlock, null);
course.setCourseId(courseId);
for (BlockModel m : courseStructureV1Model.getDescendants(topBlock)) {
normalizeCourseStructure(courseStructureV1Model,m,course);
}
return course;
} | static IBlock function(CourseStructureV1Model courseStructureV1Model, String courseId){ BlockModel topBlock = courseStructureV1Model.getBlockById(courseStructureV1Model.root); CourseComponent course = new CourseComponent(topBlock, null); course.setCourseId(courseId); for (BlockModel m : courseStructureV1Model.getDescendants(topBlock)) { normalizeCourseStructure(courseStructureV1Model,m,course); } return course; } | /**
* Mapping from raw data structure from getCourseStructure() API
* @param courseStructureV1Model
* @return
*/ | Mapping from raw data structure from getCourseStructure() API | normalizeCourseStructure | {
"repo_name": "ahmedaljazzar/edx-app-android",
"path": "OpenEdXMobile/src/main/java/org/edx/mobile/services/CourseManager.java",
"license": "apache-2.0",
"size": 10695
} | [
"org.edx.mobile.model.course.BlockModel",
"org.edx.mobile.model.course.CourseComponent",
"org.edx.mobile.model.course.CourseStructureV1Model",
"org.edx.mobile.model.course.IBlock"
] | import org.edx.mobile.model.course.BlockModel; import org.edx.mobile.model.course.CourseComponent; import org.edx.mobile.model.course.CourseStructureV1Model; import org.edx.mobile.model.course.IBlock; | import org.edx.mobile.model.course.*; | [
"org.edx.mobile"
] | org.edx.mobile; | 1,135,526 |
T createEditorWidget(List<String> editorModes); | T createEditorWidget(List<String> editorModes); | /**
* Create an editor instance.
*
* @param editorModes the editor modes
* @return an editor instance
*/ | Create an editor instance | createEditorWidget | {
"repo_name": "vitaliy0922/cop_che-core",
"path": "ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/texteditor/EditorWidgetFactory.java",
"license": "epl-1.0",
"size": 946
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,274,855 |
public void testCloseActiveConnection_XA_global()
throws SQLException, XAException
{
XADataSource ds = J2EEDataSource.getXADataSource();
XAConnection xa = ds.getXAConnection();
XAResource xar = xa.getXAResource();
Xid xid = new cdsXid(1, (byte) 2, (byte) 3);
xar.start(xid, XAResource.TMNOFLAGS);
// auto-commit is always off in XA transactions, so we expect
// getAutoCommit() to return false without having set it explicitly
testCloseActiveConnection(xa.getConnection(), false, true);
Connection c = xa.getConnection();
c.setAutoCommit(false);
testCloseActiveConnection(c, false, true);
xar.end(xid, XAResource.TMSUCCESS);
xa.close();
} | void function() throws SQLException, XAException { XADataSource ds = J2EEDataSource.getXADataSource(); XAConnection xa = ds.getXAConnection(); XAResource xar = xa.getXAResource(); Xid xid = new cdsXid(1, (byte) 2, (byte) 3); xar.start(xid, XAResource.TMNOFLAGS); testCloseActiveConnection(xa.getConnection(), false, true); Connection c = xa.getConnection(); c.setAutoCommit(false); testCloseActiveConnection(c, false, true); xar.end(xid, XAResource.TMSUCCESS); xa.close(); } | /**
* Test that connections retrieved from {@code XADataSource} that are part
* of a global XA transaction, behave as expected when {@code close()} is
* called and the transaction is active.
*/ | Test that connections retrieved from XADataSource that are part of a global XA transaction, behave as expected when close() is called and the transaction is active | testCloseActiveConnection_XA_global | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java",
"license": "apache-2.0",
"size": 186130
} | [
"java.sql.Connection",
"java.sql.SQLException",
"javax.sql.XAConnection",
"javax.sql.XADataSource",
"javax.transaction.xa.XAException",
"javax.transaction.xa.XAResource",
"javax.transaction.xa.Xid",
"org.apache.derbyTesting.junit.J2EEDataSource"
] | import java.sql.Connection; import java.sql.SQLException; import javax.sql.XAConnection; import javax.sql.XADataSource; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import org.apache.derbyTesting.junit.J2EEDataSource; | import java.sql.*; import javax.sql.*; import javax.transaction.xa.*; import org.apache.*; | [
"java.sql",
"javax.sql",
"javax.transaction",
"org.apache"
] | java.sql; javax.sql; javax.transaction; org.apache; | 1,054,655 |
public void ancestorResized(HierarchyEvent e)
{
if (applet != null)
{
HierarchyBoundsListener[] l = applet.getHierarchyBoundsListeners();
for (int i = 0; i < l.length; i++)
l[i].ancestorResized(e);
}
} | void function(HierarchyEvent e) { if (applet != null) { HierarchyBoundsListener[] l = applet.getHierarchyBoundsListeners(); for (int i = 0; i < l.length; i++) l[i].ancestorResized(e); } } | /**
* Called when an ancestor component is resized.
*
* @param e the event describing the ancestor's resizing
*/ | Called when an ancestor component is resized | ancestorResized | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/tools/gnu/classpath/tools/appletviewer/PluginAppletWindow.java",
"license": "gpl-2.0",
"size": 13105
} | [
"java.awt.event.HierarchyBoundsListener",
"java.awt.event.HierarchyEvent"
] | import java.awt.event.HierarchyBoundsListener; import java.awt.event.HierarchyEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,279,737 |
@SuppressWarnings("rawtypes")
protected SortedMultiset<Revision<L, K, V>> createBackingStore(
Comparator<Revision> comparator) {
return TreeMultiset.create(comparator);
} | @SuppressWarnings(STR) SortedMultiset<Revision<L, K, V>> function( Comparator<Revision> comparator) { return TreeMultiset.create(comparator); } | /**
* Return the backing store to hold revisions that are placed in this Block.
* This is only relevant to use when the Block is {@link #mutable} and not
* yet persisted to disk.
* <p>
* If this Block is to be {@link #concurrent} then override this method and
* return a Concurrent Multiset.
* </p>
*
* @param comparator
* @return the backing store
*/ | Return the backing store to hold revisions that are placed in this Block. This is only relevant to use when the Block is <code>#mutable</code> and not yet persisted to disk. If this Block is to be <code>#concurrent</code> then override this method and return a Concurrent Multiset. | createBackingStore | {
"repo_name": "remiemalik/concourse",
"path": "concourse-server/src/main/java/com/cinchapi/concourse/server/storage/db/Block.java",
"license": "apache-2.0",
"size": 30849
} | [
"com.google.common.collect.SortedMultiset",
"com.google.common.collect.TreeMultiset",
"java.util.Comparator"
] | import com.google.common.collect.SortedMultiset; import com.google.common.collect.TreeMultiset; import java.util.Comparator; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,384,695 |
public Subsidiary getSubsidiary() {
return this.subsidiary;
}
| Subsidiary function() { return this.subsidiary; } | /**
* Missing description at method getSubsidiary.
*
* @return the Subsidiary.
*/ | Missing description at method getSubsidiary | getSubsidiary | {
"repo_name": "NABUCCO/org.nabucco.business.organization",
"path": "org.nabucco.business.organization.facade.message/src/main/gen/org/nabucco/business/organization/facade/message/SubsidiaryMsg.java",
"license": "epl-1.0",
"size": 5617
} | [
"org.nabucco.business.organization.facade.datatype.Subsidiary"
] | import org.nabucco.business.organization.facade.datatype.Subsidiary; | import org.nabucco.business.organization.facade.datatype.*; | [
"org.nabucco.business"
] | org.nabucco.business; | 876,336 |
public void removeTournamentFile(String tournamentName) {
if (!Files.exists(Paths.get(tournamentModuleFolder))) {
return;
}
File tournamentModuleFolder = new File(
PreferencesManager.tournamentModuleFolder); | void function(String tournamentName) { if (!Files.exists(Paths.get(tournamentModuleFolder))) { return; } File tournamentModuleFolder = new File( PreferencesManager.tournamentModuleFolder); | /**
* Remove a tournament file from the preferences folder
*
* @param tournamentName
* Name of the tournament module to be removed
*/ | Remove a tournament file from the preferences folder | removeTournamentFile | {
"repo_name": "Novanoid/Tourney",
"path": "Application/src/usspg31/tourney/controller/PreferencesManager.java",
"license": "gpl-3.0",
"size": 21922
} | [
"java.io.File",
"java.nio.file.Files",
"java.nio.file.Paths"
] | import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; | import java.io.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 197,257 |
public FactSheetResourceModelResponse getFactSheetResourceModel(UUID workspaceId) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/models/factSheetResources".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "workspaceId", workspaceId));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType<FactSheetResourceModelResponse> localVarReturnType = new GenericType<FactSheetResourceModelResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | FactSheetResourceModelResponse function(UUID workspaceId) throws ApiException { Object localVarPostBody = null; String localVarPath = STR.replaceAll(STR,"json"); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); localVarQueryParams.addAll(apiClient.parameterToPairs(STRworkspaceIdSTRapplication/jsonSTRapplication/jsonSTRtokenSTRGET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } | /**
* getFactSheetResourceModel
* Retrieves the fact sheet resource model for a workspace
* @param workspaceId (optional)
* @return FactSheetResourceModelResponse
* @throws ApiException if fails to make API call
*/ | getFactSheetResourceModel Retrieves the fact sheet resource model for a workspace | getFactSheetResourceModel | {
"repo_name": "leanix/leanix-sdk-java",
"path": "src/main/java/net/leanix/api/ModelsApi.java",
"license": "mit",
"size": 40384
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"net.leanix.api.common.ApiException",
"net.leanix.api.common.Pair",
"net.leanix.api.models.FactSheetResourceModelResponse"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import net.leanix.api.common.ApiException; import net.leanix.api.common.Pair; import net.leanix.api.models.FactSheetResourceModelResponse; | import java.util.*; import net.leanix.api.common.*; import net.leanix.api.models.*; | [
"java.util",
"net.leanix.api"
] | java.util; net.leanix.api; | 856,360 |
@Nonnull
@Override
public Entry newEntry(@Nonnull Revision from, @Nonnull Revision to, boolean local) {
if (local) {
return localCache.newEntry(from, to, true);
} else {
return memoryCache.newEntry(from, to, false);
}
} | Entry function(@Nonnull Revision from, @Nonnull Revision to, boolean local) { if (local) { return localCache.newEntry(from, to, true); } else { return memoryCache.newEntry(from, to, false); } } | /**
* Creates a new entry in the {@link LocalDiffCache} for local changes
* and {@link MemoryDiffCache} for external changes
*
* @param from the from revision.
* @param to the to revision.
* @return the new entry.
*/ | Creates a new entry in the <code>LocalDiffCache</code> for local changes and <code>MemoryDiffCache</code> for external changes | newEntry | {
"repo_name": "afilimonov/jackrabbit-oak",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/TieredDiffCache.java",
"license": "apache-2.0",
"size": 2613
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,592,142 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<IpAllocationInner> getByResourceGroupWithResponse(
String resourceGroupName, String ipAllocationName, String expand, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, ipAllocationName, expand, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<IpAllocationInner> function( String resourceGroupName, String ipAllocationName, String expand, Context context) { return getByResourceGroupWithResponseAsync(resourceGroupName, ipAllocationName, expand, context).block(); } | /**
* Gets the specified IpAllocation by resource group.
*
* @param resourceGroupName The name of the resource group.
* @param ipAllocationName The name of the IpAllocation.
* @param expand Expands referenced resources.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified IpAllocation by resource group.
*/ | Gets the specified IpAllocation by resource group | getByResourceGroupWithResponse | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/IpAllocationsClientImpl.java",
"license": "mit",
"size": 68164
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.network.fluent.models.IpAllocationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.network.fluent.models.IpAllocationInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 964,296 |
private void addPolylineToMap() {
line = mMap.addPolyline(new PolylineOptions()
.width(10)
.color(Color.BLUE));
Log.i("Development", "addPolylineToMap");
} | void function() { line = mMap.addPolyline(new PolylineOptions() .width(10) .color(Color.BLUE)); Log.i(STR, STR); } | /**
* This method is an abstraction of code from the onMapReady method
*/ | This method is an abstraction of code from the onMapReady method | addPolylineToMap | {
"repo_name": "fwtrailsapp/Android",
"path": "FW_Trails_App/app/src/main/java/seniordesign/ipfw/fw_trails_app/RecordActivityFragment.java",
"license": "mit",
"size": 42426
} | [
"android.graphics.Color",
"android.util.Log",
"com.google.android.gms.maps.model.PolylineOptions"
] | import android.graphics.Color; import android.util.Log; import com.google.android.gms.maps.model.PolylineOptions; | import android.graphics.*; import android.util.*; import com.google.android.gms.maps.model.*; | [
"android.graphics",
"android.util",
"com.google.android"
] | android.graphics; android.util; com.google.android; | 558,687 |
protected XMLSettingsHandler createSettingsHandler(
final File orderFile, final String name, final String description,
final String seeds, final File newSettingsDir,
final CrawlJobErrorHandler errorHandler,
final String filename, final String seedfile)
throws FatalConfigurationException {
XMLSettingsHandler newHandler = null;
try {
newHandler = new XMLSettingsHandler(orderFile);
if(errorHandler != null){
newHandler.registerValueErrorHandler(errorHandler);
}
newHandler.setErrorReportingLevel(errorHandler.getLevel());
newHandler.initialize();
} catch (InvalidAttributeValueException e2) {
throw new FatalConfigurationException(
"InvalidAttributeValueException occured while creating" +
" new settings handler for new job/profile\n" +
e2.getMessage());
}
// Make sure the directory exists.
newSettingsDir.mkdirs();
try {
// Set the seed file
((ComplexType)newHandler.getOrder().getAttribute("scope"))
.setAttribute(new Attribute("seedsfile", seedfile));
} catch (AttributeNotFoundException e1) {
throw new FatalConfigurationException(
"AttributeNotFoundException occured while setting up" +
"new job/profile\n" + e1.getMessage());
} catch (InvalidAttributeValueException e1) {
throw new FatalConfigurationException(
"InvalidAttributeValueException occured while setting" +
"up new job/profile\n" + e1.getMessage());
} catch (MBeanException e1) {
throw new FatalConfigurationException(
"MBeanException occured while setting up new" +
" job/profile\n" + e1.getMessage());
} catch (ReflectionException e1) {
throw new FatalConfigurationException(
"ReflectionException occured while setting up" +
" new job/profile\n" + e1.getMessage());
}
File newFile = new File(newSettingsDir.getAbsolutePath(), filename);
try {
newHandler.copySettings(newFile, (String)newHandler.getOrder()
.getAttribute(CrawlOrder.ATTR_SETTINGS_DIRECTORY));
} catch (IOException e3) {
// Print stack trace to help debug issue where cannot create
// new job from an old that has overrides.
e3.printStackTrace();
throw new FatalConfigurationException(
"IOException occured while writing new settings files" +
" for new job/profile\n" + e3.getMessage());
} catch (AttributeNotFoundException e) {
throw new FatalConfigurationException(
"AttributeNotFoundException occured while writing new" +
" settings files for new job/profile\n" + e.getMessage());
} catch (MBeanException e) {
throw new FatalConfigurationException(
"MBeanException occured while writing new settings files" +
" for new job/profile\n" + e.getMessage());
} catch (ReflectionException e) {
throw new FatalConfigurationException(
"ReflectionException occured while writing new settings" +
" files for new job/profile\n" + e.getMessage());
}
CrawlerSettings orderfile = newHandler.getSettingsObject(null);
orderfile.setName(name);
orderfile.setDescription(description);
if (seeds != null) {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(
newHandler.getPathRelativeToWorkingDirectory(seedfile)),
"UTF-8"));
try {
writer.write(seeds);
} finally {
writer.close();
}
} catch (IOException e) {
throw new FatalConfigurationException(
"IOException occured while writing seed file for new"
+ " job/profile\n" + e.getMessage());
}
}
return newHandler;
} | XMLSettingsHandler function( final File orderFile, final String name, final String description, final String seeds, final File newSettingsDir, final CrawlJobErrorHandler errorHandler, final String filename, final String seedfile) throws FatalConfigurationException { XMLSettingsHandler newHandler = null; try { newHandler = new XMLSettingsHandler(orderFile); if(errorHandler != null){ newHandler.registerValueErrorHandler(errorHandler); } newHandler.setErrorReportingLevel(errorHandler.getLevel()); newHandler.initialize(); } catch (InvalidAttributeValueException e2) { throw new FatalConfigurationException( STR + STR + e2.getMessage()); } newSettingsDir.mkdirs(); try { ((ComplexType)newHandler.getOrder().getAttribute("scope")) .setAttribute(new Attribute(STR, seedfile)); } catch (AttributeNotFoundException e1) { throw new FatalConfigurationException( STR + STR + e1.getMessage()); } catch (InvalidAttributeValueException e1) { throw new FatalConfigurationException( STR + STR + e1.getMessage()); } catch (MBeanException e1) { throw new FatalConfigurationException( STR + STR + e1.getMessage()); } catch (ReflectionException e1) { throw new FatalConfigurationException( STR + STR + e1.getMessage()); } File newFile = new File(newSettingsDir.getAbsolutePath(), filename); try { newHandler.copySettings(newFile, (String)newHandler.getOrder() .getAttribute(CrawlOrder.ATTR_SETTINGS_DIRECTORY)); } catch (IOException e3) { e3.printStackTrace(); throw new FatalConfigurationException( STR + STR + e3.getMessage()); } catch (AttributeNotFoundException e) { throw new FatalConfigurationException( STR + STR + e.getMessage()); } catch (MBeanException e) { throw new FatalConfigurationException( STR + STR + e.getMessage()); } catch (ReflectionException e) { throw new FatalConfigurationException( STR + STR + e.getMessage()); } CrawlerSettings orderfile = newHandler.getSettingsObject(null); orderfile.setName(name); orderfile.setDescription(description); if (seeds != null) { BufferedWriter writer = null; try { writer = new BufferedWriter( new OutputStreamWriter( new FileOutputStream( newHandler.getPathRelativeToWorkingDirectory(seedfile)), "UTF-8")); try { writer.write(seeds); } finally { writer.close(); } } catch (IOException e) { throw new FatalConfigurationException( STR + STR + e.getMessage()); } } return newHandler; } | /**
* Creates a new settings handler based on an existing job. Basically all
* the settings file for the 'based on' will be copied to the specified
* directory.
*
* @param orderFile Order file to base new order file on. Cannot be null.
* @param name Name for the new settings
* @param description Description of the new settings.
* @param seeds The contents of the new settings' seed file.
* @param newSettingsDir
* @param errorHandler
* @param filename Name of new order file.
* @param seedfile Name of new seeds file.
*
* @return The new settings handler.
* @throws FatalConfigurationException
* If there are problems with reading the 'base on'
* configuration, with writing the new configuration or it's
* seed file.
*/ | Creates a new settings handler based on an existing job. Basically all the settings file for the 'based on' will be copied to the specified directory | createSettingsHandler | {
"repo_name": "gaowangyizu/myHeritrix",
"path": "myHeritrix/src/org/archive/crawler/admin/CrawlJobHandler.java",
"license": "apache-2.0",
"size": 53640
} | [
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.OutputStreamWriter",
"javax.management.Attribute",
"javax.management.AttributeNotFoundException",
"javax.management.InvalidAttributeValueException",
"javax.management.MBeanException",
"javax.management.ReflectionException",
"org.archive.crawler.datamodel.CrawlOrder",
"org.archive.crawler.framework.exceptions.FatalConfigurationException",
"org.archive.crawler.settings.ComplexType",
"org.archive.crawler.settings.CrawlerSettings",
"org.archive.crawler.settings.XMLSettingsHandler"
] | import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import javax.management.Attribute; import javax.management.AttributeNotFoundException; import javax.management.InvalidAttributeValueException; import javax.management.MBeanException; import javax.management.ReflectionException; import org.archive.crawler.datamodel.CrawlOrder; import org.archive.crawler.framework.exceptions.FatalConfigurationException; import org.archive.crawler.settings.ComplexType; import org.archive.crawler.settings.CrawlerSettings; import org.archive.crawler.settings.XMLSettingsHandler; | import java.io.*; import javax.management.*; import org.archive.crawler.datamodel.*; import org.archive.crawler.framework.exceptions.*; import org.archive.crawler.settings.*; | [
"java.io",
"javax.management",
"org.archive.crawler"
] | java.io; javax.management; org.archive.crawler; | 264,442 |
public BusinessObjectFormatEntity createBusinessObjectFormatEntity(String namespaceCode, String businessObjectDefinitionName,
String businessObjectFormatUsage, String fileType, Integer businessObjectFormatVersion, String businessObjectFormatDescription,
String businessObjectFormatDocumentSchema, String businessObjectFormatDocumentSchemaUrl, Boolean businessObjectFormatLatestVersion,
String businessObjectFormatPartitionKey)
{
return createBusinessObjectFormatEntity(namespaceCode, businessObjectDefinitionName, businessObjectFormatUsage, fileType, businessObjectFormatVersion,
businessObjectFormatDescription, businessObjectFormatDocumentSchema, businessObjectFormatDocumentSchemaUrl, businessObjectFormatLatestVersion,
businessObjectFormatPartitionKey, null);
} | BusinessObjectFormatEntity function(String namespaceCode, String businessObjectDefinitionName, String businessObjectFormatUsage, String fileType, Integer businessObjectFormatVersion, String businessObjectFormatDescription, String businessObjectFormatDocumentSchema, String businessObjectFormatDocumentSchemaUrl, Boolean businessObjectFormatLatestVersion, String businessObjectFormatPartitionKey) { return createBusinessObjectFormatEntity(namespaceCode, businessObjectDefinitionName, businessObjectFormatUsage, fileType, businessObjectFormatVersion, businessObjectFormatDescription, businessObjectFormatDocumentSchema, businessObjectFormatDocumentSchemaUrl, businessObjectFormatLatestVersion, businessObjectFormatPartitionKey, null); } | /**
* Creates and persists a new business object format entity.
*
* @return the newly created business object format entity.
*/ | Creates and persists a new business object format entity | createBusinessObjectFormatEntity | {
"repo_name": "FINRAOS/herd",
"path": "herd-code/herd-dao/src/test/java/org/finra/herd/dao/BusinessObjectFormatDaoTestHelper.java",
"license": "apache-2.0",
"size": 26068
} | [
"org.finra.herd.model.jpa.BusinessObjectFormatEntity"
] | import org.finra.herd.model.jpa.BusinessObjectFormatEntity; | import org.finra.herd.model.jpa.*; | [
"org.finra.herd"
] | org.finra.herd; | 2,311,877 |
protected Object loadFromDatasource(
final LoadEvent event,
final EntityPersister persister) {
Object entity = persister.load(
event.getEntityId(),
event.getInstanceToLoad(),
event.getLockOptions(),
event.getSession()
);
if ( event.isAssociationFetch() && event.getSession().getFactory().getStatistics().isStatisticsEnabled() ) {
event.getSession().getFactory().getStatistics().fetchEntity( event.getEntityClassName() );
}
return entity;
} | Object function( final LoadEvent event, final EntityPersister persister) { Object entity = persister.load( event.getEntityId(), event.getInstanceToLoad(), event.getLockOptions(), event.getSession() ); if ( event.isAssociationFetch() && event.getSession().getFactory().getStatistics().isStatisticsEnabled() ) { event.getSession().getFactory().getStatistics().fetchEntity( event.getEntityClassName() ); } return entity; } | /**
* Performs the process of loading an entity from the configured
* underlying datasource.
*
* @param event The load event
* @param persister The persister for the entity being requested for load
*
* @return The object loaded from the datasource, or null if not found.
*/ | Performs the process of loading an entity from the configured underlying datasource | loadFromDatasource | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/hibernate-core/org/hibernate/event/internal/DefaultLoadEventListener.java",
"license": "gpl-2.0",
"size": 26969
} | [
"org.hibernate.event.spi.LoadEvent",
"org.hibernate.persister.entity.EntityPersister"
] | import org.hibernate.event.spi.LoadEvent; import org.hibernate.persister.entity.EntityPersister; | import org.hibernate.event.spi.*; import org.hibernate.persister.entity.*; | [
"org.hibernate.event",
"org.hibernate.persister"
] | org.hibernate.event; org.hibernate.persister; | 872,232 |
public void setWritableLocations(Iterable<DatabaseAccountLocation> locations) {
BridgeInternal.setProperty(this, Constants.Properties.WRITABLE_LOCATIONS, locations);
} | void function(Iterable<DatabaseAccountLocation> locations) { BridgeInternal.setProperty(this, Constants.Properties.WRITABLE_LOCATIONS, locations); } | /**
* Sets the list of writable locations for this database account.
* <p>
* The list of writable locations are returned by the service.
*
* @param locations the list of writable locations.
*/ | Sets the list of writable locations for this database account. The list of writable locations are returned by the service | setWritableLocations | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/DatabaseAccount.java",
"license": "mit",
"size": 9298
} | [
"com.azure.cosmos.BridgeInternal"
] | import com.azure.cosmos.BridgeInternal; | import com.azure.cosmos.*; | [
"com.azure.cosmos"
] | com.azure.cosmos; | 1,066,504 |
public ContainerProcessingResult processPacket(BitBuffer buf, long generationTime, long acquisitionTime) {
return processPacket(buf, generationTime, acquisitionTime, rootContainer);
} | ContainerProcessingResult function(BitBuffer buf, long generationTime, long acquisitionTime) { return processPacket(buf, generationTime, acquisitionTime, rootContainer); } | /**
* Extract one packet, starting at the root sequence container
*/ | Extract one packet, starting at the root sequence container | processPacket | {
"repo_name": "fqqb/yamcs",
"path": "yamcs-core/src/main/java/org/yamcs/xtceproc/XtceTmExtractor.java",
"license": "agpl-3.0",
"size": 6425
} | [
"org.yamcs.utils.BitBuffer"
] | import org.yamcs.utils.BitBuffer; | import org.yamcs.utils.*; | [
"org.yamcs.utils"
] | org.yamcs.utils; | 2,660,948 |
public void cellsRemoved(Object[] cells)
{
if (cells != null && cells.length > 0)
{
double scale = view.getScale();
mxPoint tr = view.getTranslate();
model.beginUpdate();
try
{
for (int i = 0; i < cells.length; i++)
{
// Disconnects edges which are not in cells
Collection<Object> cellSet = new HashSet<Object>();
cellSet.addAll(Arrays.asList(cells));
Object[] edges = getConnections(cells[i]);
for (int j = 0; j < edges.length; j++)
{
if (!cellSet.contains(edges[j]))
{
mxGeometry geo = model.getGeometry(edges[j]);
if (geo != null)
{
mxCellState state = view.getState(edges[j]);
if (state != null)
{
geo = (mxGeometry) geo.clone();
boolean source = state
.getVisibleTerminal(true) == cells[i];
int n = (source) ? 0 : state
.getAbsolutePointCount() - 1;
mxPoint pt = state.getAbsolutePoint(n);
geo.setTerminalPoint(new mxPoint(pt.getX()
/ scale - tr.getX(), pt.getY()
/ scale - tr.getY()), source);
model.setTerminal(edges[j], null, source);
model.setGeometry(edges[j], geo);
}
}
}
}
model.remove(cells[i]);
}
fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED, "cells",
cells));
}
finally
{
model.endUpdate();
}
}
} | void function(Object[] cells) { if (cells != null && cells.length > 0) { double scale = view.getScale(); mxPoint tr = view.getTranslate(); model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { Collection<Object> cellSet = new HashSet<Object>(); cellSet.addAll(Arrays.asList(cells)); Object[] edges = getConnections(cells[i]); for (int j = 0; j < edges.length; j++) { if (!cellSet.contains(edges[j])) { mxGeometry geo = model.getGeometry(edges[j]); if (geo != null) { mxCellState state = view.getState(edges[j]); if (state != null) { geo = (mxGeometry) geo.clone(); boolean source = state .getVisibleTerminal(true) == cells[i]; int n = (source) ? 0 : state .getAbsolutePointCount() - 1; mxPoint pt = state.getAbsolutePoint(n); geo.setTerminalPoint(new mxPoint(pt.getX() / scale - tr.getX(), pt.getY() / scale - tr.getY()), source); model.setTerminal(edges[j], null, source); model.setGeometry(edges[j], geo); } } } } model.remove(cells[i]); } fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED, "cells", cells)); } finally { model.endUpdate(); } } } | /**
* Removes the given cells from the model. This method fires
* mxEvent.CELLS_REMOVED while the transaction is in progress.
*
* @param cells Array of cells to remove.
*/ | Removes the given cells from the model. This method fires mxEvent.CELLS_REMOVED while the transaction is in progress | cellsRemoved | {
"repo_name": "luartmg/WMA",
"path": "WMA/LibreriaJGraphx/src/com/mxgraph/view/mxGraph.java",
"license": "apache-2.0",
"size": 204261
} | [
"com.mxgraph.util.mxEventObject",
"com.mxgraph.util.mxPoint",
"java.util.Arrays",
"java.util.Collection",
"java.util.HashSet"
] | import com.mxgraph.util.mxEventObject; import com.mxgraph.util.mxPoint; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; | import com.mxgraph.util.*; import java.util.*; | [
"com.mxgraph.util",
"java.util"
] | com.mxgraph.util; java.util; | 542,327 |
@SuppressWarnings("GuardedBy")
Map<String, String> getWorkersWithUnacknowledgedTasks()
{
return workersWithUnacknowledgedTask;
} | @SuppressWarnings(STR) Map<String, String> getWorkersWithUnacknowledgedTasks() { return workersWithUnacknowledgedTask; } | /**
* Must not be used outside of this class and {@link HttpRemoteTaskRunnerResource} , used for read only.
*/ | Must not be used outside of this class and <code>HttpRemoteTaskRunnerResource</code> , used for read only | getWorkersWithUnacknowledgedTasks | {
"repo_name": "monetate/druid",
"path": "indexing-service/src/main/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunner.java",
"license": "apache-2.0",
"size": 67030
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,450,690 |
public Paint getQuadrantPaint(int index) {
if (index < 0 || index > 3) {
throw new IllegalArgumentException(
"The index should be in the range 0 to 3."
);
}
return this.quadrantPaint[index];
} | Paint function(int index) { if (index < 0 index > 3) { throw new IllegalArgumentException( STR ); } return this.quadrantPaint[index]; } | /**
* Returns the paint used for the specified quadrant.
*
* @param index the quadrant index (0-3).
*
* @return The paint (possibly <code>null</code>).
*/ | Returns the paint used for the specified quadrant | getQuadrantPaint | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/chart/plot/XYPlot.java",
"license": "lgpl-2.1",
"size": 137931
} | [
"java.awt.Paint"
] | import java.awt.Paint; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,480,585 |
@Test(expectedExceptions = IllegalArgumentException.class)
public void testUriSearchSingleNullUri1() {
DataExchangeSourceUris.uriSearchSingle(null, EIDS);
} | @Test(expectedExceptions = IllegalArgumentException.class) void function() { DataExchangeSourceUris.uriSearchSingle(null, EIDS); } | /**
* Tests that the base URI cannot be null.
*/ | Tests that the base URI cannot be null | testUriSearchSingleNullUri1 | {
"repo_name": "McLeodMoores/starling",
"path": "projects/core-rest-client/src/test/java/com/opengamma/core/exchange/impl/DataExchangeSourceUrisTest.java",
"license": "apache-2.0",
"size": 5336
} | [
"org.testng.annotations.Test"
] | import org.testng.annotations.Test; | import org.testng.annotations.*; | [
"org.testng.annotations"
] | org.testng.annotations; | 1,655,002 |
private void createMetadata(Document doc, Element record, InstitutionalItemVersion institutionalItemVersion)
{
// create the header element of the record
Element metadata = doc.createElement("metadata");
record.appendChild(metadata);
Element oaiDc = doc.createElement("oai_dc:dc");
oaiDc.setAttribute("xmlns:oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/");
oaiDc.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
oaiDc.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
oaiDc.setAttribute("xsi:schemaLocation", "http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
metadata.appendChild(oaiDc);
GenericItem item = institutionalItemVersion.getItem();
addTitle(doc, oaiDc, item);
addDateAvailable(doc, oaiDc, item);
addHandle(doc, oaiDc, institutionalItemVersion);
if( item.isPubliclyViewable() && !item.isEmbargoed() && !institutionalItemVersion.isWithdrawn())
{
addAlternativeTitles(doc, oaiDc, item);
addType(doc, oaiDc, item);
addContributors(doc, oaiDc, item);
addDescription(doc, oaiDc, item);
addAbstract(doc, oaiDc, item);
addIdentifiers(doc, oaiDc, item);
addLanguage(doc, oaiDc, item);
addSubjects(doc, oaiDc, item);
addPublisher(doc, oaiDc, item);
addRights(doc, oaiDc, item);
addAvailable(doc, oaiDc, item);
addCitation(doc, oaiDc, item);
addDateAccepted(doc, oaiDc, institutionalItemVersion);
addDateIssued(doc, oaiDc, item);
addDateModified(doc, oaiDc, institutionalItemVersion);
addExtents(doc, oaiDc, item);
}
}
| void function(Document doc, Element record, InstitutionalItemVersion institutionalItemVersion) { Element metadata = doc.createElement(STR); record.appendChild(metadata); Element oaiDc = doc.createElement(STR); oaiDc.setAttribute(STR, STRxmlns:dc", STRxmlns:xsi", STRxsi:schemaLocationSTRhttp: metadata.appendChild(oaiDc); GenericItem item = institutionalItemVersion.getItem(); addTitle(doc, oaiDc, item); addDateAvailable(doc, oaiDc, item); addHandle(doc, oaiDc, institutionalItemVersion); if( item.isPubliclyViewable() && !item.isEmbargoed() && !institutionalItemVersion.isWithdrawn()) { addAlternativeTitles(doc, oaiDc, item); addType(doc, oaiDc, item); addContributors(doc, oaiDc, item); addDescription(doc, oaiDc, item); addAbstract(doc, oaiDc, item); addIdentifiers(doc, oaiDc, item); addLanguage(doc, oaiDc, item); addSubjects(doc, oaiDc, item); addPublisher(doc, oaiDc, item); addRights(doc, oaiDc, item); addAvailable(doc, oaiDc, item); addCitation(doc, oaiDc, item); addDateAccepted(doc, oaiDc, institutionalItemVersion); addDateIssued(doc, oaiDc, item); addDateModified(doc, oaiDc, institutionalItemVersion); addExtents(doc, oaiDc, item); } } | /**
* Create the metadata section for oai.
*
* @param doc - xml document root
* @param institutionalItemVersion - institutional item version to write
*/ | Create the metadata section for oai | createMetadata | {
"repo_name": "nate-rcl/irplus",
"path": "ir_service/src/edu/ur/ir/oai/metadata/provider/service/DefaultDublinCoreOaiMetadataProvider.java",
"license": "apache-2.0",
"size": 22192
} | [
"edu.ur.ir.institution.InstitutionalItemVersion",
"edu.ur.ir.item.GenericItem",
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import edu.ur.ir.institution.InstitutionalItemVersion; import edu.ur.ir.item.GenericItem; import org.w3c.dom.Document; import org.w3c.dom.Element; | import edu.ur.ir.institution.*; import edu.ur.ir.item.*; import org.w3c.dom.*; | [
"edu.ur.ir",
"org.w3c.dom"
] | edu.ur.ir; org.w3c.dom; | 1,368,186 |
private void drawOnlySignificantHorizontalLabels(Canvas canvas) {
int[] significantValues = {0, statistics.size() / 2, statistics.size() - 1};
for (int value : significantValues) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
float x = (float) (right - left) / (float) (statistics.size() - 1) * value + (float) left;
canvas.rotate(90f, x - 15, bottom + 20);
String print = statistics.get(value).getDate();
canvas.drawText(print, x - 15, bottom + 20, labelPaint);
fitGraphHeight(getShift(statistics.get(value).getDate(), labelPaint));
canvas.restore();
}
} | void function(Canvas canvas) { int[] significantValues = {0, statistics.size() / 2, statistics.size() - 1}; for (int value : significantValues) { canvas.save(Canvas.MATRIX_SAVE_FLAG); float x = (float) (right - left) / (float) (statistics.size() - 1) * value + (float) left; canvas.rotate(90f, x - 15, bottom + 20); String print = statistics.get(value).getDate(); canvas.drawText(print, x - 15, bottom + 20, labelPaint); fitGraphHeight(getShift(statistics.get(value).getDate(), labelPaint)); canvas.restore(); } } | /**
* Sometimes drawing all available dates to the horizontal axis is way to much. This method
* draws only the significant value labels: the date of the first, the middle and the last value
*
* @param canvas The canvas to draw to
*/ | Sometimes drawing all available dates to the horizontal axis is way to much. This method draws only the significant value labels: the date of the first, the middle and the last value | drawOnlySignificantHorizontalLabels | {
"repo_name": "JU5T1C3/StatisticsDemo",
"path": "StatisticsDemo/app/src/main/java/klawisch/jimdo/statistics/statisticsdemo/view/CustomLineGraph.java",
"license": "mit",
"size": 22350
} | [
"android.graphics.Canvas"
] | import android.graphics.Canvas; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,201,950 |
public VoiceServiceOptions getVoiceServiceOptions()
{
if(mVoiceServiceOptions == null)
{
mVoiceServiceOptions = new VoiceServiceOptions(getMessage().getInt(SERVICE_OPTIONS));
}
return mVoiceServiceOptions;
} | VoiceServiceOptions function() { if(mVoiceServiceOptions == null) { mVoiceServiceOptions = new VoiceServiceOptions(getMessage().getInt(SERVICE_OPTIONS)); } return mVoiceServiceOptions; } | /**
* Service options for this channel
*/ | Service options for this channel | getVoiceServiceOptions | {
"repo_name": "ImagoTrigger/sdrtrunk",
"path": "src/main/java/io/github/dsheirer/module/decode/p25/phase1/message/lc/standard/LCGroupVoiceChannelUpdateExplicit.java",
"license": "gpl-3.0",
"size": 4440
} | [
"io.github.dsheirer.module.decode.p25.reference.VoiceServiceOptions"
] | import io.github.dsheirer.module.decode.p25.reference.VoiceServiceOptions; | import io.github.dsheirer.module.decode.p25.reference.*; | [
"io.github.dsheirer"
] | io.github.dsheirer; | 1,221,865 |
@SuppressWarnings("unchecked")
private <T extends IEntity> List<T> getResultEntities(List<IntuitMessage> intuitMessages) {
List<T> resultEntities = new ArrayList<T>();
int i = 0;
for(IntuitMessage intuitMessage : intuitMessages) {
if(!isContainResponse(intuitMessage, i)) {
LOG.warn("Response object with index="+i+" was expected, got nothing.");
} else {
resultEntities.add((T) getReturnEntity(intuitMessage, i));
}
i++;
}
return resultEntities;
} | @SuppressWarnings(STR) <T extends IEntity> List<T> function(List<IntuitMessage> intuitMessages) { List<T> resultEntities = new ArrayList<T>(); int i = 0; for(IntuitMessage intuitMessage : intuitMessages) { if(!isContainResponse(intuitMessage, i)) { LOG.warn(STR+i+STR); } else { resultEntities.add((T) getReturnEntity(intuitMessage, i)); } i++; } return resultEntities; } | /**
* Processes list of intuitMessages and returns list of resultEntities
* @param intuitMessages
* @param <T>
* @return
*/ | Processes list of intuitMessages and returns list of resultEntities | getResultEntities | {
"repo_name": "intuit/QuickBooks-V3-Java-SDK",
"path": "ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java",
"license": "apache-2.0",
"size": 66027
} | [
"com.intuit.ipp.core.IEntity",
"com.intuit.ipp.interceptors.IntuitMessage",
"java.util.ArrayList",
"java.util.List"
] | import com.intuit.ipp.core.IEntity; import com.intuit.ipp.interceptors.IntuitMessage; import java.util.ArrayList; import java.util.List; | import com.intuit.ipp.core.*; import com.intuit.ipp.interceptors.*; import java.util.*; | [
"com.intuit.ipp",
"java.util"
] | com.intuit.ipp; java.util; | 1,888,040 |
public void addRenderingHints(Map<?, ?> hints) {
// Do nothing.
} | void function(Map<?, ?> hints) { } | /**
* Adds rendering hints. These are ignored by EpsGraphics2D.
*/ | Adds rendering hints. These are ignored by EpsGraphics2D | addRenderingHints | {
"repo_name": "OpenSourcePhysics/osp",
"path": "src/org/jibble/epsgraphics/EpsGraphics2D.java",
"license": "gpl-3.0",
"size": 40716
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 117,308 |
@Override
public void setPreferenceSettings(String walletPreferenceSettings, String walletPublicKey) throws CantSaveWalletSettings {
//TODO METODO NO IMPLEMENTADO AUN - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta
} | void function(String walletPreferenceSettings, String walletPublicKey) throws CantSaveWalletSettings { } | /**
* This method let us set the preference settings for a wallet
*
* @param walletPreferenceSettings
* @param walletPublicKey
* @throws CantSetDefaultSkinException
*/ | This method let us set the preference settings for a wallet | setPreferenceSettings | {
"repo_name": "fvasquezjatar/fermat-unused",
"path": "DMP/android/sub_app/fermat-dmp-android-sub-app-wallet-publisher-bitdubai/src/main/java/com/bitdubai/sub_app/wallet_publisher/preference_settings/WalletPublisherPreferenceSettings.java",
"license": "mit",
"size": 3608
} | [
"com.bitdubai.fermat_wpd_api.layer.wpd_middleware.wallet_settings.exceptions.CantSaveWalletSettings"
] | import com.bitdubai.fermat_wpd_api.layer.wpd_middleware.wallet_settings.exceptions.CantSaveWalletSettings; | import com.bitdubai.fermat_wpd_api.layer.wpd_middleware.wallet_settings.exceptions.*; | [
"com.bitdubai.fermat_wpd_api"
] | com.bitdubai.fermat_wpd_api; | 409,362 |
public void setDirectories(List<String> directories) {
this.directories = directories;
} | void function(List<String> directories) { this.directories = directories; } | /**
* Sets the directories attribute value.
*
* @param directories The directories to set.
*/ | Sets the directories attribute value | setDirectories | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-core/src/main/java/org/kuali/kfs/sys/batch/FilePurgeStep.java",
"license": "agpl-3.0",
"size": 3112
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 633,462 |
renderer.setSelected(isSelected);
renderer.setData( value);
return renderer;
}
private static class CustomLabel extends JLabel {
private final int GAP = AppSettings.getInt("Border_Size");
private boolean selected;
private Object data; | renderer.setSelected(isSelected); renderer.setData( value); return renderer; } private static class CustomLabel extends JLabel { private final int GAP = AppSettings.getInt(STR); private boolean selected; private Object data; | /**
* Returns custom renderer for each cell of the list.
*
* @param list list to process
* @param value cell value (CustomData object in our case)
* @param index cell index
* @param isSelected whether cell is selected or not
* @param cellHasFocus whether cell has focus or not
* @return custom renderer for each cell of the list
*/ | Returns custom renderer for each cell of the list | getListCellRendererComponent | {
"repo_name": "Vojta3310/V-Control",
"path": "src/VControl/UI/components/MyCellRenderer.java",
"license": "mit",
"size": 2809
} | [
"javax.swing.JLabel"
] | import javax.swing.JLabel; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,034,734 |
public DateRangeAggregationBuilder addUnboundedFrom(String key, double from) {
addRange(new Range(key, from, null));
return this;
} | DateRangeAggregationBuilder function(String key, double from) { addRange(new Range(key, from, null)); return this; } | /**
* Add a new range with no upper bound.
*
* @param key
* the key to use for this range in the response
* @param from
* the lower bound on the distances, inclusive
*/ | Add a new range with no upper bound | addUnboundedFrom | {
"repo_name": "dpursehouse/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/date/DateRangeAggregationBuilder.java",
"license": "apache-2.0",
"size": 9035
} | [
"org.elasticsearch.search.aggregations.bucket.range.RangeAggregator"
] | import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator; | import org.elasticsearch.search.aggregations.bucket.range.*; | [
"org.elasticsearch.search"
] | org.elasticsearch.search; | 1,528,127 |
int move(String connectionFactory, String source, String destination, String selector, String username, String password) throws MBeanException; | int move(String connectionFactory, String source, String destination, String selector, String username, String password) throws MBeanException; | /**
* Move JMS messages from one queue to another.
*
* @param connectionFactory The JMS connection factory name.
* @param source The source JMS queue name.
* @param destination The destination JMS queue name.
* @param selector A selector to move only certain messages.
* @param username The (optional) username to connect to the JMS broker.
* @param password The (optional) password to connect to the JMS broker.
* @return The number of messages moved.
* @throws MBeanException If the MBean fails.
*/ | Move JMS messages from one queue to another | move | {
"repo_name": "grgrzybek/karaf",
"path": "jms/src/main/java/org/apache/karaf/jms/JmsMBean.java",
"license": "apache-2.0",
"size": 7275
} | [
"javax.management.MBeanException"
] | import javax.management.MBeanException; | import javax.management.*; | [
"javax.management"
] | javax.management; | 1,448,573 |
public static void removeCommonFrames(List causeFrames, List wrapperFrames) {
if (causeFrames == null || wrapperFrames == null) {
throw new IllegalArgumentException("The List must not be null");
}
int causeFrameIndex = causeFrames.size() - 1;
int wrapperFrameIndex = wrapperFrames.size() - 1;
while (causeFrameIndex >= 0 && wrapperFrameIndex >= 0) {
// Remove the frame from the cause trace if it is the same
// as in the wrapper trace
String causeFrame = (String) causeFrames.get(causeFrameIndex);
String wrapperFrame = (String) wrapperFrames.get(wrapperFrameIndex);
if ( causeFrame.equals(wrapperFrame) ) {
causeFrames.remove(causeFrameIndex);
}
causeFrameIndex--;
wrapperFrameIndex--;
}
} | static void function(List causeFrames, List wrapperFrames) { if (causeFrames == null wrapperFrames == null) { throw new IllegalArgumentException(STR); } int causeFrameIndex = causeFrames.size() - 1; int wrapperFrameIndex = wrapperFrames.size() - 1; while (causeFrameIndex >= 0 && wrapperFrameIndex >= 0) { String causeFrame = (String) causeFrames.get(causeFrameIndex); String wrapperFrame = (String) wrapperFrames.get(wrapperFrameIndex); if ( causeFrame.equals(wrapperFrame) ) { causeFrames.remove(causeFrameIndex); } causeFrameIndex--; wrapperFrameIndex--; } } | /**
* <p>Removes common frames from the cause trace given the two stack traces.</p>
*
* @param causeFrames stack trace of a cause throwable
* @param wrapperFrames stack trace of a wrapper throwable
* @throws IllegalArgumentException if either argument is null
* @since 2.0
*/ | Removes common frames from the cause trace given the two stack traces | removeCommonFrames | {
"repo_name": "simeshev/parabuild-ci",
"path": "3rdparty/hibernate218/src/net/sf/hibernate/exception/ExceptionUtils.java",
"license": "lgpl-3.0",
"size": 27459
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,577,349 |
if (System.getProperty("com.google.appengine.runtime.environment") == null) {
return false;
}
try {
// If the current environment is null, we're not inside AppEngine.
return Class.forName("com.google.apphosting.api.ApiProxy")
.getMethod("getCurrentEnvironment")
.invoke(null) != null;
} catch (ClassNotFoundException e) {
// If ApiProxy doesn't exist, we're not on AppEngine at all.
return false;
} catch (InvocationTargetException e) {
// If ApiProxy throws an exception, we're not in a proper AppEngine environment.
return false;
} catch (IllegalAccessException e) {
// If the method isn't accessible, we're not on a supported version of AppEngine;
return false;
} catch (NoSuchMethodException e) {
// If the method doesn't exist, we're not on a supported version of AppEngine;
return false;
}
} | if (System.getProperty(STR) == null) { return false; } try { return Class.forName(STR) .getMethod(STR) .invoke(null) != null; } catch (ClassNotFoundException e) { return false; } catch (InvocationTargetException e) { return false; } catch (IllegalAccessException e) { return false; } catch (NoSuchMethodException e) { return false; } } | /**
* Attempts to detect whether we are inside of AppEngine.
*
* <p>Purposely copied and left private from private <a href="https://code.google.com/p/
* guava-libraries/source/browse/guava/src/com/google/common/util/concurrent/
* MoreExecutors.java#785">code.google.common.util.concurrent.MoreExecutors#isAppEngine</a>.
*
* @return true if we are inside of AppEngine, false otherwise.
*/ | Attempts to detect whether we are inside of AppEngine. Purposely copied and left private from private code.google.common.util.concurrent.MoreExecutors#isAppEngine | isAppEngine | {
"repo_name": "shakamunyi/beam",
"path": "sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/util/AppEngineEnvironment.java",
"license": "apache-2.0",
"size": 2516
} | [
"java.lang.reflect.InvocationTargetException"
] | import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 291,033 |
private boolean checkIfModifiedSince(HttpServletRequest request,
HttpServletResponse response,
ResourceInfo resourceInfo)
throws IOException {
try {
long headerValue = request.getDateHeader("If-Modified-Since");
long lastModified = resourceInfo.date;
if (headerValue != -1) {
// If an If-None-Match header has been specified, if modified since
// is ignored.
if ((request.getHeader("If-None-Match") == null)
&& (lastModified <= headerValue + 1000)) {
// The entity has not been modified since the date
// specified by the client. This is not an error case.
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return false;
}
}
} catch(IllegalArgumentException illegalArgument) {
return false;
}
return true;
}
| boolean function(HttpServletRequest request, HttpServletResponse response, ResourceInfo resourceInfo) throws IOException { try { long headerValue = request.getDateHeader(STR); long lastModified = resourceInfo.date; if (headerValue != -1) { if ((request.getHeader(STR) == null) && (lastModified <= headerValue + 1000)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } } } catch(IllegalArgumentException illegalArgument) { return false; } return true; } | /**
* Check if the if-modified-since condition is satisfied.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
* @param resourceInfo File object
* @return boolean true if the resource meets the specified condition,
* and false if the condition is not satisfied, in which case request
* processing is stopped
*/ | Check if the if-modified-since condition is satisfied | checkIfModifiedSince | {
"repo_name": "c-rainstorm/jerrydog",
"path": "src/main/java/org/apache/catalina/servlets/DefaultServlet.java",
"license": "gpl-3.0",
"size": 79068
} | [
"java.io.IOException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 62,118 |
public TroubleshootingResultInner withResults(List<TroubleshootingDetails> results) {
this.results = results;
return this;
} | TroubleshootingResultInner function(List<TroubleshootingDetails> results) { this.results = results; return this; } | /**
* Set information from troubleshooting.
*
* @param results the results value to set
* @return the TroubleshootingResultInner object itself.
*/ | Set information from troubleshooting | withResults | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/TroubleshootingResultInner.java",
"license": "mit",
"size": 3099
} | [
"com.microsoft.azure.management.network.v2019_11_01.TroubleshootingDetails",
"java.util.List"
] | import com.microsoft.azure.management.network.v2019_11_01.TroubleshootingDetails; import java.util.List; | import com.microsoft.azure.management.network.v2019_11_01.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 312,935 |
public GetOcspResponse getOcspResponse(byte[] ocspRequest) {
checkNotNull(ocspRequest, IotPkiManageConstants.NULL_REQUEST);
String encodedOcspRequest = encodeOcspReqeust(ocspRequest);
InternalRequest internalRequest = createIotPkiManageRequest(
new DefaultIotPkiManageRequest(), HttpMethodName.GET, IotPkiManageConstants.OCSP, encodedOcspRequest);
return this.invokeHttpClient(internalRequest, GetOcspResponse.class);
} | GetOcspResponse function(byte[] ocspRequest) { checkNotNull(ocspRequest, IotPkiManageConstants.NULL_REQUEST); String encodedOcspRequest = encodeOcspReqeust(ocspRequest); InternalRequest internalRequest = createIotPkiManageRequest( new DefaultIotPkiManageRequest(), HttpMethodName.GET, IotPkiManageConstants.OCSP, encodedOcspRequest); return this.invokeHttpClient(internalRequest, GetOcspResponse.class); } | /**
* Standard ocsp query use HTTP GET method.
*
* @param ocspRequest Standard ocsp request.
* @return Standard ocsp response.
*/ | Standard ocsp query use HTTP GET method | getOcspResponse | {
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/iothisk/IotPkiManageClient.java",
"license": "apache-2.0",
"size": 23247
} | [
"com.baidubce.http.HttpMethodName",
"com.baidubce.internal.InternalRequest",
"com.baidubce.services.iothisk.model.DefaultIotPkiManageRequest",
"com.baidubce.services.iothisk.model.GetOcspResponse",
"com.google.common.base.Preconditions"
] | import com.baidubce.http.HttpMethodName; import com.baidubce.internal.InternalRequest; import com.baidubce.services.iothisk.model.DefaultIotPkiManageRequest; import com.baidubce.services.iothisk.model.GetOcspResponse; import com.google.common.base.Preconditions; | import com.baidubce.http.*; import com.baidubce.internal.*; import com.baidubce.services.iothisk.model.*; import com.google.common.base.*; | [
"com.baidubce.http",
"com.baidubce.internal",
"com.baidubce.services",
"com.google.common"
] | com.baidubce.http; com.baidubce.internal; com.baidubce.services; com.google.common; | 924,246 |
public void receivedData(MpowerSocketState socketState) {
for (MpowerBindingProvider provider : providers) {
MpowerBindingConfig bindingCfg = provider
.getConfigForAddress(socketState.getAddress());
int socketNumber = socketState.getSocket();
MpowerSocketState cachedState = bindingCfg
.getCacheForSocket(socketNumber);
long refresh = connectors.get(bindingCfg.getmPowerInstance())
.getRefreshInterval();
boolean needsUpdate = bindingCfg.needsUpdate(socketNumber, refresh);
// only proceed if the data has changed
if (needsUpdate
&& (cachedState == null || !cachedState.equals(socketState))) {
// update consumption today
String consumptionTodayItemName = bindingCfg
.getEnergyTodayItemName(socketState.getSocket());
if (StringUtils.isNotBlank(consumptionTodayItemName)) {
State itemState = new DecimalType(socketState.getEnergy()
- bindingCfg.getConsumptionAtMidnight(socketState
.getSocket()));
eventPublisher.postUpdate(consumptionTodayItemName,
itemState);
}
// update voltage
String volItemName = bindingCfg.getVoltageItemName(socketState
.getSocket());
if (StringUtils.isNotBlank(volItemName)) {
State itemState = new DecimalType(socketState.getVoltage());
eventPublisher.postUpdate(volItemName, itemState);
}
// update power
String powerItemname = bindingCfg.getPowerItemName(socketState
.getSocket());
if (StringUtils.isNotBlank(powerItemname)) {
State itemState = new DecimalType(socketState.getPower());
eventPublisher.postUpdate(powerItemname, itemState);
}
// update energy
String energyItemname = bindingCfg
.getEnergyItemName(socketState.getSocket());
if (StringUtils.isNotBlank(energyItemname)) {
State itemState = new DecimalType(socketState.getEnergy());
eventPublisher.postUpdate(energyItemname, itemState);
}
// update switch
String switchItemname = bindingCfg
.getSwitchItemName(socketState.getSocket());
if (StringUtils.isNotBlank(switchItemname)) {
OnOffType state = socketState.isOn() ? OnOffType.ON
: OnOffType.OFF;
eventPublisher.postUpdate(switchItemname, state);
// update the cache
bindingCfg.setCachedState(socketNumber, socketState);
}
// update the cache
bindingCfg.setCachedState(socketNumber, socketState);
cachedState = bindingCfg.getCacheForSocket(socketNumber);
} else {
logger.trace("suppressing update as socket state has not changed");
}
// switch changes we handle immediately
boolean switchHasChanged = false;
if (cachedState != null) {
switchHasChanged = cachedState.isOn() != socketState.isOn();
}
if (cachedState == null || switchHasChanged) {
// update switch
String switchItemname = bindingCfg
.getSwitchItemName(socketState.getSocket());
if (StringUtils.isNotBlank(switchItemname)) {
OnOffType state = socketState.isOn() ? OnOffType.ON
: OnOffType.OFF;
eventPublisher.postUpdate(switchItemname, state);
// update the cache
bindingCfg.setCachedState(socketNumber, socketState);
}
}
}
}
| void function(MpowerSocketState socketState) { for (MpowerBindingProvider provider : providers) { MpowerBindingConfig bindingCfg = provider .getConfigForAddress(socketState.getAddress()); int socketNumber = socketState.getSocket(); MpowerSocketState cachedState = bindingCfg .getCacheForSocket(socketNumber); long refresh = connectors.get(bindingCfg.getmPowerInstance()) .getRefreshInterval(); boolean needsUpdate = bindingCfg.needsUpdate(socketNumber, refresh); if (needsUpdate && (cachedState == null !cachedState.equals(socketState))) { String consumptionTodayItemName = bindingCfg .getEnergyTodayItemName(socketState.getSocket()); if (StringUtils.isNotBlank(consumptionTodayItemName)) { State itemState = new DecimalType(socketState.getEnergy() - bindingCfg.getConsumptionAtMidnight(socketState .getSocket())); eventPublisher.postUpdate(consumptionTodayItemName, itemState); } String volItemName = bindingCfg.getVoltageItemName(socketState .getSocket()); if (StringUtils.isNotBlank(volItemName)) { State itemState = new DecimalType(socketState.getVoltage()); eventPublisher.postUpdate(volItemName, itemState); } String powerItemname = bindingCfg.getPowerItemName(socketState .getSocket()); if (StringUtils.isNotBlank(powerItemname)) { State itemState = new DecimalType(socketState.getPower()); eventPublisher.postUpdate(powerItemname, itemState); } String energyItemname = bindingCfg .getEnergyItemName(socketState.getSocket()); if (StringUtils.isNotBlank(energyItemname)) { State itemState = new DecimalType(socketState.getEnergy()); eventPublisher.postUpdate(energyItemname, itemState); } String switchItemname = bindingCfg .getSwitchItemName(socketState.getSocket()); if (StringUtils.isNotBlank(switchItemname)) { OnOffType state = socketState.isOn() ? OnOffType.ON : OnOffType.OFF; eventPublisher.postUpdate(switchItemname, state); bindingCfg.setCachedState(socketNumber, socketState); } bindingCfg.setCachedState(socketNumber, socketState); cachedState = bindingCfg.getCacheForSocket(socketNumber); } else { logger.trace(STR); } boolean switchHasChanged = false; if (cachedState != null) { switchHasChanged = cachedState.isOn() != socketState.isOn(); } if (cachedState == null switchHasChanged) { String switchItemname = bindingCfg .getSwitchItemName(socketState.getSocket()); if (StringUtils.isNotBlank(switchItemname)) { OnOffType state = socketState.isOn() ? OnOffType.ON : OnOffType.OFF; eventPublisher.postUpdate(switchItemname, state); bindingCfg.setCachedState(socketNumber, socketState); } } } } | /**
* Called from ssh connector. This method will update the OH items if
*
* a) the refresh time has passed and the item has changed
*
* b) or we run on 'real time mode' and the item has changed
*
* @param state
* new data received from mPower
*/ | Called from ssh connector. This method will update the OH items if a) the refresh time has passed and the item has changed b) or we run on 'real time mode' and the item has changed | receivedData | {
"repo_name": "magcode/openhab",
"path": "bundles/binding/org.openhab.binding.mpower/src/main/java/org/openhab/binding/mpower/internal/MpowerBinding.java",
"license": "epl-1.0",
"size": 9335
} | [
"org.apache.commons.lang.StringUtils",
"org.openhab.binding.mpower.MpowerBindingProvider",
"org.openhab.core.library.types.DecimalType",
"org.openhab.core.library.types.OnOffType",
"org.openhab.core.types.State"
] | import org.apache.commons.lang.StringUtils; import org.openhab.binding.mpower.MpowerBindingProvider; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.types.State; | import org.apache.commons.lang.*; import org.openhab.binding.mpower.*; import org.openhab.core.library.types.*; import org.openhab.core.types.*; | [
"org.apache.commons",
"org.openhab.binding",
"org.openhab.core"
] | org.apache.commons; org.openhab.binding; org.openhab.core; | 946,559 |
public String getScriptPath(HttpServletRequest request) throws ModelAndViewDefiningException;
| String function(HttpServletRequest request) throws ModelAndViewDefiningException; | /**
* Returns the pathname of the script that should run for a particular
* initial HTTP request.
*
* @param request
* the HTTP request that initiates a flow
* @return the path of the script. null can be returned to indicate that
* this strategy is unable to select a script (i.e. because some
* data is missing in the request). The controller will respond to
* this by sending back a HTTP 400 "Bad Request" status.
* Alternatively, the strategy can throw an instance of Spring's
* {@link ModelAndViewDefiningException} to indicate failure.
*/ | Returns the pathname of the script that should run for a particular initial HTTP request | getScriptPath | {
"repo_name": "szegedi/spring-web-jsflow",
"path": "src/main/java/org/szegedi/spring/web/jsflow/ScriptSelectionStrategy.java",
"license": "apache-2.0",
"size": 1148
} | [
"javax.servlet.http.HttpServletRequest",
"org.springframework.web.servlet.ModelAndViewDefiningException"
] | import javax.servlet.http.HttpServletRequest; import org.springframework.web.servlet.ModelAndViewDefiningException; | import javax.servlet.http.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.springframework.web"
] | javax.servlet; org.springframework.web; | 691,711 |
public Proposal propose(Request request) throws XidRolloverException {
if ((request.zxid & 0xffffffffL) == 0xffffffffL) {
String msg =
"zxid lower 32 bits have rolled over, forcing re-election, and therefore new epoch start";
shutdown(msg);
throw new XidRolloverException(msg);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
try {
request.getHdr().serialize(boa, "hdr");
if (request.getTxn() != null) {
request.getTxn().serialize(boa, "txn");
}
baos.close();
} catch (IOException e) {
LOG.warn("This really should be impossible", e);
}
QuorumPacket pp = new QuorumPacket(Leader.PROPOSAL, request.zxid,
baos.toByteArray(), null);
Proposal p = new Proposal();
p.packet = pp;
p.request = request;
synchronized(this) {
p.addQuorumVerifier(self.getQuorumVerifier());
if (request.getHdr().getType() == OpCode.reconfig){
self.setLastSeenQuorumVerifier(request.qv, true);
}
if (self.getQuorumVerifier().getVersion()<self.getLastSeenQuorumVerifier().getVersion()) {
p.addQuorumVerifier(self.getLastSeenQuorumVerifier());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Proposing:: " + request);
}
lastProposed = p.packet.getZxid();
outstandingProposals.put(lastProposed, p);
sendPacket(pp);
}
return p;
} | Proposal function(Request request) throws XidRolloverException { if ((request.zxid & 0xffffffffL) == 0xffffffffL) { String msg = STR; shutdown(msg); throw new XidRolloverException(msg); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos); try { request.getHdr().serialize(boa, "hdr"); if (request.getTxn() != null) { request.getTxn().serialize(boa, "txn"); } baos.close(); } catch (IOException e) { LOG.warn(STR, e); } QuorumPacket pp = new QuorumPacket(Leader.PROPOSAL, request.zxid, baos.toByteArray(), null); Proposal p = new Proposal(); p.packet = pp; p.request = request; synchronized(this) { p.addQuorumVerifier(self.getQuorumVerifier()); if (request.getHdr().getType() == OpCode.reconfig){ self.setLastSeenQuorumVerifier(request.qv, true); } if (self.getQuorumVerifier().getVersion()<self.getLastSeenQuorumVerifier().getVersion()) { p.addQuorumVerifier(self.getLastSeenQuorumVerifier()); } if (LOG.isDebugEnabled()) { LOG.debug(STR + request); } lastProposed = p.packet.getZxid(); outstandingProposals.put(lastProposed, p); sendPacket(pp); } return p; } | /**
* create a proposal and send it out to all the members
*
* @param request
* @return the proposal that is queued to send to all the members
*/ | create a proposal and send it out to all the members | propose | {
"repo_name": "ervinyang/tutorial_zookeeper",
"path": "zookeeper-trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java",
"license": "mit",
"size": 52293
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"org.apache.jute.BinaryOutputArchive",
"org.apache.zookeeper.ZooDefs",
"org.apache.zookeeper.server.Request"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import org.apache.jute.BinaryOutputArchive; import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.server.Request; | import java.io.*; import org.apache.jute.*; import org.apache.zookeeper.*; import org.apache.zookeeper.server.*; | [
"java.io",
"org.apache.jute",
"org.apache.zookeeper"
] | java.io; org.apache.jute; org.apache.zookeeper; | 1,065,463 |
public void setUuid(String v)
{
if (!ObjectUtils.equals(this.uuid, v))
{
this.uuid = v;
setModified(true);
}
}
private TGridLayout aTGridLayout; | void function(String v) { if (!ObjectUtils.equals(this.uuid, v)) { this.uuid = v; setModified(true); } } private TGridLayout aTGridLayout; | /**
* Set the value of Uuid
*
* @param v new value
*/ | Set the value of Uuid | setUuid | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTGridField.java",
"license": "gpl-3.0",
"size": 29803
} | [
"com.aurel.track.persist.TGridLayout",
"org.apache.commons.lang.ObjectUtils"
] | import com.aurel.track.persist.TGridLayout; import org.apache.commons.lang.ObjectUtils; | import com.aurel.track.persist.*; import org.apache.commons.lang.*; | [
"com.aurel.track",
"org.apache.commons"
] | com.aurel.track; org.apache.commons; | 324,370 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.