Datasets:
method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Override public void enterVarDefinition(@NotNull JavaParser.VarDefinitionContext ctx) { } | @Override public void enterVarDefinition(@NotNull JavaParser.VarDefinitionContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitVarType | {
"repo_name": "ChShersh/university-courses",
"path": "parsing-course/03/src/com/kovanikov/parser/JavaBaseListener.java",
"license": "mit",
"size": 10426
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,569,144 |
protected void addCodePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AddressLongitudeDirectionType_code_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_AddressLongitudeDirectionType_code_feature", "_UI_AddressLongitudeDirectionType_type"),
XALPackage.eINSTANCE.getAddressLongitudeDirectionType_Code(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), XALPackage.eINSTANCE.getAddressLongitudeDirectionType_Code(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Code feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Code feature. | addCodePropertyDescriptor | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/org/oasis/xAL/provider/AddressLongitudeDirectionTypeItemProvider.java",
"license": "apache-2.0",
"size": 8377
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.oasis.xAL.XALPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.oasis.xAL.XALPackage; | import org.eclipse.emf.edit.provider.*; import org.oasis.*; | [
"org.eclipse.emf",
"org.oasis"
] | org.eclipse.emf; org.oasis; | 386,587 |
protected void undeferChildren(Node node) {
Node top = node;
while (null != node) {
if (((NodeImpl)node).needsSyncData()) {
((NodeImpl)node).synchronizeData();
}
NamedNodeMap attributes = node.getAttributes();
if (attributes != null) {
int length = attributes.getLength();
for (int i = 0; i < length; ++i) {
undeferChildren(attributes.item(i));
}
}
Node nextNode = null;
nextNode = node.getFirstChild();
while (null == nextNode) {
if (top.equals(node))
break;
nextNode = node.getNextSibling();
if (null == nextNode) {
node = node.getParentNode();
if ((null == node) || (top.equals(node))) {
nextNode = null;
break;
}
}
}
node = nextNode;
}
} | void function(Node node) { Node top = node; while (null != node) { if (((NodeImpl)node).needsSyncData()) { ((NodeImpl)node).synchronizeData(); } NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { int length = attributes.getLength(); for (int i = 0; i < length; ++i) { undeferChildren(attributes.item(i)); } } Node nextNode = null; nextNode = node.getFirstChild(); while (null == nextNode) { if (top.equals(node)) break; nextNode = node.getNextSibling(); if (null == nextNode) { node = node.getParentNode(); if ((null == node) (top.equals(node))) { nextNode = null; break; } } } node = nextNode; } } | /**
* Traverses the DOM Tree and expands deferred nodes and their
* children.
*
*/ | Traverses the DOM Tree and expands deferred nodes and their children | undeferChildren | {
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java",
"license": "gpl-2.0",
"size": 98527
} | [
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node"
] | import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,125,071 |
private void setSchemaResult(AssertionResult result, String xmlStr, String xsdFileName) {
try {
// boolean toReturn = true;
// Document doc = null;
DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance();
parserFactory.setValidating(true);
parserFactory.setNamespaceAware(true);
parserFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
parserFactory.setAttribute(JAXP_SCHEMA_SOURCE, xsdFileName);
// create a parser:
DocumentBuilder parser = parserFactory.newDocumentBuilder();
parser.setErrorHandler(new SAXErrorHandler(result));
// doc =
parser.parse(new InputSource(new StringReader(xmlStr)));
// if everything went fine then xml schema validation is valid
} catch (SAXParseException e) {
// Only set message if error not yet flagged
if (!result.isError() && !result.isFailure()) {
result.setError(true);
result.setFailureMessage(errorDetails(e));
}
} catch (SAXException e) {
log.warn(e.toString());
result.setResultForFailure(e.getMessage());
} catch (IOException e) {
log.warn("IO error", e);
result.setResultForFailure(e.getMessage());
} catch (ParserConfigurationException e) {
log.warn("Problem with Parser Config", e);
result.setResultForFailure(e.getMessage());
}
} | void function(AssertionResult result, String xmlStr, String xsdFileName) { try { DocumentBuilderFactory parserFactory = DocumentBuilderFactory.newInstance(); parserFactory.setValidating(true); parserFactory.setNamespaceAware(true); parserFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); parserFactory.setAttribute(JAXP_SCHEMA_SOURCE, xsdFileName); DocumentBuilder parser = parserFactory.newDocumentBuilder(); parser.setErrorHandler(new SAXErrorHandler(result)); parser.parse(new InputSource(new StringReader(xmlStr))); } catch (SAXParseException e) { if (!result.isError() && !result.isFailure()) { result.setError(true); result.setFailureMessage(errorDetails(e)); } } catch (SAXException e) { log.warn(e.toString()); result.setResultForFailure(e.getMessage()); } catch (IOException e) { log.warn(STR, e); result.setResultForFailure(e.getMessage()); } catch (ParserConfigurationException e) { log.warn(STR, e); result.setResultForFailure(e.getMessage()); } } | /**
* set Schema result
*
* @param result
* @param xmlStr
* @param xsdFileName
*/ | set Schema result | setSchemaResult | {
"repo_name": "Nachiket90/jmeter-sample",
"path": "src/components/org/apache/jmeter/assertions/XMLSchemaAssertion.java",
"license": "apache-2.0",
"size": 7145
} | [
"java.io.IOException",
"java.io.StringReader",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.xml.sax.InputSource",
"org.xml.sax.SAXException",
"org.xml.sax.SAXParseException"
] | import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; | import java.io.*; import javax.xml.parsers.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.xml.sax"
] | java.io; javax.xml; org.xml.sax; | 2,312,659 |
public Value getStaticFieldInternal(Env env, StringValue name)
{
StringValue staticName = _staticFieldNameMap.get(name);
if (staticName != null)
return env.getStaticValue(staticName);
else
return null;
}
//
// Constructors
//
/*
public Value callNew(Env env, Expr []args)
{
Value object = _classDef.callNew(env, args);
if (object != null)
return object;
object = newInstance(env);
AbstractFunction fun = findConstructor();
if (fun != null) {
fun.callMethod(env, object, args);
}
return object;
} | Value function(Env env, StringValue name) { StringValue staticName = _staticFieldNameMap.get(name); if (staticName != null) return env.getStaticValue(staticName); else return null; } /* public Value callNew(Env env, Expr []args) { Value object = _classDef.callNew(env, args); if (object != null) return object; object = newInstance(env); AbstractFunction fun = findConstructor(); if (fun != null) { fun.callMethod(env, object, args); } return object; } | /**
* For Reflection.
*/ | For Reflection | getStaticFieldInternal | {
"repo_name": "WelcomeHUME/svn-caucho-com-resin",
"path": "modules/quercus/src/com/caucho/quercus/env/QuercusClass.java",
"license": "gpl-2.0",
"size": 70646
} | [
"com.caucho.quercus.expr.Expr",
"com.caucho.quercus.function.AbstractFunction"
] | import com.caucho.quercus.expr.Expr; import com.caucho.quercus.function.AbstractFunction; | import com.caucho.quercus.expr.*; import com.caucho.quercus.function.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 1,775,163 |
public String getDelimiter(int type) {
ICUResourceBundle delimitersBundle = (ICUResourceBundle) bundle.get("delimiters");
// Only some of the quotation marks may be here. So we make sure that we do a multilevel fallback.
ICUResourceBundle stringBundle = delimitersBundle.getWithFallback(DELIMITER_TYPES[type]);
if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) {
return null;
}
return stringBundle.getString();
} | String function(int type) { ICUResourceBundle delimitersBundle = (ICUResourceBundle) bundle.get(STR); ICUResourceBundle stringBundle = delimitersBundle.getWithFallback(DELIMITER_TYPES[type]); if (noSubstitute && !bundle.isRoot() && stringBundle.isRoot()) { return null; } return stringBundle.getString(); } | /**
* Retrieves a delimiter string from the locale data.
*
* @param type The type of delimiter string desired. Currently,
* the valid choices are QUOTATION_START, QUOTATION_END,
* ALT_QUOTATION_START, or ALT_QUOTATION_END.
* @return The desired delimiter string.
* @stable ICU 3.4
*/ | Retrieves a delimiter string from the locale data | getDelimiter | {
"repo_name": "abhijitvalluri/fitnotifications",
"path": "icu4j/src/main/java/com/ibm/icu/util/LocaleData.java",
"license": "apache-2.0",
"size": 18169
} | [
"com.ibm.icu.impl.ICUResourceBundle"
] | import com.ibm.icu.impl.ICUResourceBundle; | import com.ibm.icu.impl.*; | [
"com.ibm.icu"
] | com.ibm.icu; | 144,899 |
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key, sequenceNumber);
} | Editor function() throws IOException { return DiskLruCache.this.edit(key, sequenceNumber); } | /**
* Returns an editor for this snapshot's entry, or null if either the
* entry has changed since this snapshot was created or if another edit
* is in progress.
*/ | Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress | edit | {
"repo_name": "aoenang/seny-devpkg",
"path": "devpkg-android/src/main/java/org/senydevpkg/net/DiskLruCache.java",
"license": "apache-2.0",
"size": 33890
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 620,130 |
protected String getComponentName(EJBMethodMetaData methodMetaData) {
return methodMetaData.getEJBComponentMetaData().getJ2EEName().getComponent();
} | String function(EJBMethodMetaData methodMetaData) { return methodMetaData.getEJBComponentMetaData().getJ2EEName().getComponent(); } | /**
* Get the name of the component/bean currently executing
*
* @return the component/bean name
*/ | Get the name of the component/bean currently executing | getComponentName | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java",
"license": "epl-1.0",
"size": 39724
} | [
"com.ibm.ws.ejbcontainer.EJBMethodMetaData"
] | import com.ibm.ws.ejbcontainer.EJBMethodMetaData; | import com.ibm.ws.ejbcontainer.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,249,370 |
@Test
public void firstDivideSecondCheckResult() {
final double num1 = 56.00;
final double num2 = 8.00;
final double expected = 7.00;
final double prec = 0.01;
Calculator calc = new Calculator();
calc.div(num1, num2);
double result = calc.getResult();
assertEquals(expected, result, prec);
} | void function() { final double num1 = 56.00; final double num2 = 8.00; final double expected = 7.00; final double prec = 0.01; Calculator calc = new Calculator(); calc.div(num1, num2); double result = calc.getResult(); assertEquals(expected, result, prec); } | /**
* First number / second compare result with expected number.
*/ | First number / second compare result with expected number | firstDivideSecondCheckResult | {
"repo_name": "kuznetsovsergeyymailcom/homework",
"path": "chapter_001/calculator/src/test/java/ru/skuznetsov/calculator/CalculatorTest.java",
"license": "apache-2.0",
"size": 2115
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,383,543 |
public long getAndAdd(final long increment)
{
return UnsafeAccess.UNSAFE.getAndAddLong(byteArray, addressOffset, increment);
} | long function(final long increment) { return UnsafeAccess.UNSAFE.getAndAddLong(byteArray, addressOffset, increment); } | /**
* Add an increment to the counter that will not lose updates across threads.
*
* @param increment to be added.
* @return the previous value of the counter
*/ | Add an increment to the counter that will not lose updates across threads | getAndAdd | {
"repo_name": "real-logic/Agrona",
"path": "agrona/src/main/java/org/agrona/concurrent/status/AtomicCounter.java",
"license": "apache-2.0",
"size": 12038
} | [
"org.agrona.UnsafeAccess"
] | import org.agrona.UnsafeAccess; | import org.agrona.*; | [
"org.agrona"
] | org.agrona; | 979,334 |
@Adjacency(label = SCAN_JAVA_PACKAGES, direction = Direction.OUT)
Iterable<PackageModel> getScanJavaPackages(); | @Adjacency(label = SCAN_JAVA_PACKAGES, direction = Direction.OUT) Iterable<PackageModel> getScanJavaPackages(); | /**
* Specifies which Java packages should be scanned by windup
*/ | Specifies which Java packages should be scanned by windup | getScanJavaPackages | {
"repo_name": "bradsdavis/windup",
"path": "rules-java/src/main/java/org/jboss/windup/rules/apps/java/model/WindupJavaConfigurationModel.java",
"license": "epl-1.0",
"size": 4690
} | [
"com.tinkerpop.blueprints.Direction",
"com.tinkerpop.frames.Adjacency"
] | import com.tinkerpop.blueprints.Direction; import com.tinkerpop.frames.Adjacency; | import com.tinkerpop.blueprints.*; import com.tinkerpop.frames.*; | [
"com.tinkerpop.blueprints",
"com.tinkerpop.frames"
] | com.tinkerpop.blueprints; com.tinkerpop.frames; | 637,675 |
@Test
public void saveInsertedRows() {
final Iterable<Map<String, String>> rows = new IterableOf<>(
Arrays.asList(
new MapOf<String, String>(
new MapEntry<String, String>(
"key2",
"value2"
)
)
)
);
final TableFakeInsert fake = new TableFakeInsert(
new IterableOf<Map<String, String>>(),
new TableSimple(
() -> "public.saveInsertedRows",
new DbDefault(
new JdbcSession(new BoneCPDataSource())
)
)
);
fake.insert(
rows
);
MatcherAssert.assertThat(
fake.rows(),
Matchers.equalTo(
rows
)
);
} | void function() { final Iterable<Map<String, String>> rows = new IterableOf<>( Arrays.asList( new MapOf<String, String>( new MapEntry<String, String>( "key2", STR ) ) ) ); final TableFakeInsert fake = new TableFakeInsert( new IterableOf<Map<String, String>>(), new TableSimple( () -> STR, new DbDefault( new JdbcSession(new BoneCPDataSource()) ) ) ); fake.insert( rows ); MatcherAssert.assertThat( fake.rows(), Matchers.equalTo( rows ) ); } | /**
* Check TableFakeInsert can save inserted rows.
*/ | Check TableFakeInsert can save inserted rows | saveInsertedRows | {
"repo_name": "smallcreep/cucumber-seeds",
"path": "seeds-db/src/test/java/com/github/smallcreep/cucumber/seeds/table/TableFakeInsertTest.java",
"license": "mit",
"size": 4368
} | [
"com.github.smallcreep.cucumber.seeds.db.DbDefault",
"com.jcabi.jdbc.JdbcSession",
"com.jolbox.bonecp.BoneCPDataSource",
"java.util.Arrays",
"java.util.Map",
"org.cactoos.iterable.IterableOf",
"org.cactoos.map.MapEntry",
"org.cactoos.map.MapOf",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import com.github.smallcreep.cucumber.seeds.db.DbDefault; import com.jcabi.jdbc.JdbcSession; import com.jolbox.bonecp.BoneCPDataSource; import java.util.Arrays; import java.util.Map; import org.cactoos.iterable.IterableOf; import org.cactoos.map.MapEntry; import org.cactoos.map.MapOf; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import com.github.smallcreep.cucumber.seeds.db.*; import com.jcabi.jdbc.*; import com.jolbox.bonecp.*; import java.util.*; import org.cactoos.iterable.*; import org.cactoos.map.*; import org.hamcrest.*; | [
"com.github.smallcreep",
"com.jcabi.jdbc",
"com.jolbox.bonecp",
"java.util",
"org.cactoos.iterable",
"org.cactoos.map",
"org.hamcrest"
] | com.github.smallcreep; com.jcabi.jdbc; com.jolbox.bonecp; java.util; org.cactoos.iterable; org.cactoos.map; org.hamcrest; | 536,752 |
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
}
}
return actions;
} | Collection<IAction> function(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); } } return actions; } | /**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This generates a <code>org.eclipse.emf.edit.ui.action.CreateChildAction</code> for each object in <code>descriptors</code>, and returns the collection of these actions. | generateCreateChildActions | {
"repo_name": "patrickneubauer/XMLIntellEdit",
"path": "xmlintelledit/classes.editor/src/org_eclipse_smarthome_schemas_config_description_v1__0Simplified/presentation/org_eclipse_smarthome_schemas_config_description_v1__0SimplifiedActionBarContributor.java",
"license": "mit",
"size": 14853
} | [
"java.util.ArrayList",
"java.util.Collection",
"org.eclipse.emf.edit.ui.action.CreateChildAction",
"org.eclipse.jface.action.IAction",
"org.eclipse.jface.viewers.ISelection"
] | import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; | import java.util.*; import org.eclipse.emf.edit.ui.action.*; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.jface"
] | java.util; org.eclipse.emf; org.eclipse.jface; | 395,414 |
private void initView() {
View.inflate(getContext(), R.layout.vector_ongoing_conference_call, this); | void function() { View.inflate(getContext(), R.layout.vector_ongoing_conference_call, this); | /**
* Common initialisation method.
*/ | Common initialisation method | initView | {
"repo_name": "noepitome/neon-android",
"path": "neon/src/main/java/im/neon/view/VectorOngoingConferenceCallView.java",
"license": "apache-2.0",
"size": 6648
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,691,888 |
public void log (String message, Throwable e)
{
if (e == null)
log.warning (message);
log.log(Level.SEVERE, message, e);
} // log
| void function (String message, Throwable e) { if (e == null) log.warning (message); log.log(Level.SEVERE, message, e); } | /**
* Log error/warning
* @param message message
* @param e exception
*/ | Log error/warning | log | {
"repo_name": "erpcya/adempierePOS",
"path": "serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitor.java",
"license": "gpl-2.0",
"size": 29228
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,056,189 |
JsonSchema answer = null;
Enumeration<URL> resources = classLoader.getResources(ENVIRONMENT_SCHEMA_FILE);
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
JsonSchema schema = loadSchema(url);
answer = combineSchemas(answer, schema);
}
for (String folderPath : folderPaths) {
File file = new File(folderPath, ENVIRONMENT_SCHEMA_FILE);
if (file.isFile()) {
JsonSchema schema = loadSchema(file);
answer = combineSchemas(answer, schema);
}
}
return answer;
} | JsonSchema answer = null; Enumeration<URL> resources = classLoader.getResources(ENVIRONMENT_SCHEMA_FILE); while (resources.hasMoreElements()) { URL url = resources.nextElement(); JsonSchema schema = loadSchema(url); answer = combineSchemas(answer, schema); } for (String folderPath : folderPaths) { File file = new File(folderPath, ENVIRONMENT_SCHEMA_FILE); if (file.isFile()) { JsonSchema schema = loadSchema(file); answer = combineSchemas(answer, schema); } } return answer; } | /**
* Finds all of the environment json schemas and combines them together
*/ | Finds all of the environment json schemas and combines them together | loadEnvironmentSchemas | {
"repo_name": "zmhassan/fabric8",
"path": "fabric8-maven-plugin/src/main/java/io/fabric8/maven/support/JsonSchemas.java",
"license": "apache-2.0",
"size": 4774
} | [
"java.io.File",
"java.util.Enumeration"
] | import java.io.File; import java.util.Enumeration; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 712,624 |
Assert.isTrue(isOther());
fData = data;
} | Assert.isTrue(isOther()); fData = data; } | /**
* Re-initializes the data of this token. The token may not represent
* undefined, whitespace, or EOF.
*
* @param data to be attached to the token
* @since 2.0
*/ | Re-initializes the data of this token. The token may not represent undefined, whitespace, or EOF | setData | {
"repo_name": "fabioz/Pydev",
"path": "plugins/org.python.pydev.shared_core/src/org/python/pydev/shared_core/partitioner/Token.java",
"license": "epl-1.0",
"size": 2560
} | [
"org.eclipse.core.runtime.Assert"
] | import org.eclipse.core.runtime.Assert; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,049,055 |
public void askForSaving() {
if (wasEdited) {
Shell dialog = askForSavingGUI();
dialog.addDisposeListener(new DisposeListener() { | void function() { if (wasEdited) { Shell dialog = askForSavingGUI(); dialog.addDisposeListener(new DisposeListener() { | /**
* Ask the user for saving if the content was edited
*/ | Ask the user for saving if the content was edited | askForSaving | {
"repo_name": "sizuest/EMod",
"path": "ch.ethz.inspire.emod/src/ch/ethz/inspire/emod/gui/AConfigGUI.java",
"license": "gpl-3.0",
"size": 7188
} | [
"org.eclipse.swt.events.DisposeListener",
"org.eclipse.swt.widgets.Shell"
] | import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.widgets.Shell; | import org.eclipse.swt.events.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 279,550 |
@Override
public OrderingSpecification computeRequiredOrdering(OrderingSpecification ordering) {
LinkedHashMap<String, Ordering.Direction> directionMap = new LinkedHashMap<>();
// Add first the required order from the requested specification.
AbstractDatasetOperation childOperation = getChild();
for (String column : ordering.columns()) {
if (groupByColumns.contains(column)) {
directionMap.put(column, ordering.getDirection(column));
}
}
// Then add remaining columns from the groupByColumns.
for (String groupByColumn : groupByColumns) {
directionMap.putIfAbsent(groupByColumn, Ordering.Direction.ASC);
}
DataStructure childStructure = childOperation.getDataStructure();
return new VtlOrdering(directionMap, childStructure);
} | OrderingSpecification function(OrderingSpecification ordering) { LinkedHashMap<String, Ordering.Direction> directionMap = new LinkedHashMap<>(); AbstractDatasetOperation childOperation = getChild(); for (String column : ordering.columns()) { if (groupByColumns.contains(column)) { directionMap.put(column, ordering.getDirection(column)); } } for (String groupByColumn : groupByColumns) { directionMap.putIfAbsent(groupByColumn, Ordering.Direction.ASC); } DataStructure childStructure = childOperation.getDataStructure(); return new VtlOrdering(directionMap, childStructure); } | /**
* Convert the ordering so that is compatible with this group by operation.
*/ | Convert the ordering so that is compatible with this group by operation | computeRequiredOrdering | {
"repo_name": "statisticsnorway/java-vtl",
"path": "java-vtl-script/src/main/java/no/ssb/vtl/script/operations/aggregation/AggregationOperation.java",
"license": "apache-2.0",
"size": 10071
} | [
"java.util.LinkedHashMap",
"no.ssb.vtl.model.DataStructure",
"no.ssb.vtl.model.Ordering",
"no.ssb.vtl.model.OrderingSpecification",
"no.ssb.vtl.model.VtlOrdering",
"no.ssb.vtl.script.operations.AbstractDatasetOperation"
] | import java.util.LinkedHashMap; import no.ssb.vtl.model.DataStructure; import no.ssb.vtl.model.Ordering; import no.ssb.vtl.model.OrderingSpecification; import no.ssb.vtl.model.VtlOrdering; import no.ssb.vtl.script.operations.AbstractDatasetOperation; | import java.util.*; import no.ssb.vtl.model.*; import no.ssb.vtl.script.operations.*; | [
"java.util",
"no.ssb.vtl"
] | java.util; no.ssb.vtl; | 1,897,021 |
@Test
public void missingCurrentContext() {
String nullCurrentContext = null;
KubeConfig kubeConfig = kubeConfig(//
clusterEntries( //
clusterEntry("cluster1", clusterCaCertPath("https://apiserver1", CA_CERT_PATH)),
clusterEntry("cluster2", clusterCaCertPath("https://apiserver2", CA_CERT_PATH))),
userEntries( //
userEntry("user1", certAuthUserByPath(CLIENT_CERT_PATH, CLIENT_KEY_PATH)),
userEntry("user2", certAuthUserByPath(CLIENT_CERT_PATH, CLIENT_KEY_PATH))), //
contextEntries(//
contextEntry("cluster1-context", context("cluster1", "user1")),
contextEntry("cluster2-context", context("cluster2", "user2"))), //
nullCurrentContext);
try {
kubeConfig.validate();
fail("expected to fail validation");
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), is("kubeconfig: missing current-context"));
}
} | void function() { String nullCurrentContext = null; KubeConfig kubeConfig = kubeConfig( clusterEntry(STR, clusterCaCertPath(STRcluster2STRhttps: userEntries( userEntry("user2", certAuthUserByPath(CLIENT_CERT_PATH, CLIENT_KEY_PATH))), contextEntry(STR, context(STR, "user1")), contextEntry(STR, context(STR, "user2"))), try { kubeConfig.validate(); fail(STR); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } } | /**
* A current context must be specified in kubeconfig for it to be useful as
* an auth source for the {@link KubernetesCloudPool}.
*/ | A current context must be specified in kubeconfig for it to be useful as an auth source for the <code>KubernetesCloudPool</code> | missingCurrentContext | {
"repo_name": "elastisys/scale.cloudpool",
"path": "kubernetes/src/test/java/com/elastisys/scale/cloudpool/kubernetes/config/kubeconfig/TestKubeConfig.java",
"license": "apache-2.0",
"size": 16900
} | [
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestCluster",
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestClusterEntry",
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestContext",
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestContextEntry",
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestUser",
"com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestUserEntry",
"org.hamcrest.CoreMatchers",
"org.junit.Assert"
] | import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestCluster; import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestClusterEntry; import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestContext; import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestContextEntry; import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestUser; import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.TestUserEntry; import org.hamcrest.CoreMatchers; import org.junit.Assert; | import com.elastisys.scale.cloudpool.kubernetes.config.kubeconfig.*; import org.hamcrest.*; import org.junit.*; | [
"com.elastisys.scale",
"org.hamcrest",
"org.junit"
] | com.elastisys.scale; org.hamcrest; org.junit; | 1,757,804 |
File resourceFile = new File( resource );
String entryName = "";
FileInputStream fis = null;
byte[] content = null;
try {
fis = new FileInputStream( resourceFile );
content = new byte[(int) resourceFile.length()];
if (fis.read( content ) != -1) {
if (pack.length() > 0) {
entryName = pack + "/";
}
entryName += resourceFile.getName();
if (jarEntryContents.containsKey( entryName )) {
if (!collisionAllowed)
throw new JclException( "Resource " + entryName + " already loaded" );
else {
if (logger.isLoggable( Level.FINEST ))
logger.finest( "Resource " + entryName + " already loaded; ignoring entry..." );
return;
}
}
if (logger.isLoggable( Level.FINEST ))
logger.finest( "Loading resource: " + entryName );
jarEntryContents.put( entryName, content );
}
} catch (IOException e) {
throw new JclException( e );
} finally {
try {
fis.close();
} catch (IOException e) {
throw new JclException( e );
}
}
} | File resourceFile = new File( resource ); String entryName = STR/STRResource STR already loadedSTRResource STR already loaded; ignoring entry...STRLoading resource: " + entryName ); jarEntryContents.put( entryName, content ); } } catch (IOException e) { throw new JclException( e ); } finally { try { fis.close(); } catch (IOException e) { throw new JclException( e ); } } } | /**
* Reads the resource content
*
* @param resource
*/ | Reads the resource content | loadResourceContent | {
"repo_name": "agilesites/agilesites2-lib",
"path": "core/src/main/java/org/xeustechnologies/jcl/ClasspathResources.java",
"license": "mit",
"size": 9755
} | [
"java.io.File",
"java.io.IOException",
"org.xeustechnologies.jcl.exception.JclException"
] | import java.io.File; import java.io.IOException; import org.xeustechnologies.jcl.exception.JclException; | import java.io.*; import org.xeustechnologies.jcl.exception.*; | [
"java.io",
"org.xeustechnologies.jcl"
] | java.io; org.xeustechnologies.jcl; | 556,530 |
public Iterator getFilterIterator() {
return children.iterator();
} | Iterator function() { return children.iterator(); } | /**
* Gets an iterator for the filters held by this logic filter.
*
* @return the iterator of the filters.
*/ | Gets an iterator for the filters held by this logic filter | getFilterIterator | {
"repo_name": "geotools/geotools",
"path": "modules/library/main/src/main/java/org/geotools/filter/LogicFilterImpl.java",
"license": "lgpl-2.1",
"size": 5759
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,044,529 |
public void send(ClusterMessage msg) {
send(msg, null);
} | void function(ClusterMessage msg) { send(msg, null); } | /**
* send message to all cluster members
* @param msg message to transfer
*
* @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage)
*/ | send message to all cluster members | send | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.0/SimpleTcpCluster.java",
"license": "mit",
"size": 32852
} | [
"org.apache.catalina.ha.ClusterMessage"
] | import org.apache.catalina.ha.ClusterMessage; | import org.apache.catalina.ha.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 635,467 |
@Test(timeout = 60000)
public void testRoutingExclusivity() throws Exception {
// Create Address with both ANYCAST and MULTICAST enabled
String testAddress = "testRoutingExclusivity-mixed-mode";
SimpleString ssTestAddress = new SimpleString(testAddress);
AddressInfo addressInfo = new AddressInfo(ssTestAddress);
addressInfo.addRoutingType(RoutingType.MULTICAST);
addressInfo.addRoutingType(RoutingType.ANYCAST);
server.addAddressInfo(addressInfo);
server.createQueue(ssTestAddress, RoutingType.ANYCAST, ssTestAddress, null, true, false);
Connection connection = createConnection(UUIDGenerator.getInstance().generateStringUUID());
try {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic topic = session.createTopic(testAddress);
javax.jms.Queue queue = session.createQueue(testAddress);
MessageProducer producer = session.createProducer(topic);
MessageConsumer queueConsumer = session.createConsumer(queue);
MessageConsumer topicConsumer = session.createConsumer(topic);
producer.send(session.createTextMessage("testMessage"));
assertNotNull(topicConsumer.receive(1000));
assertNull(queueConsumer.receive(1000));
} finally {
connection.close();
}
} | @Test(timeout = 60000) void function() throws Exception { String testAddress = STR; SimpleString ssTestAddress = new SimpleString(testAddress); AddressInfo addressInfo = new AddressInfo(ssTestAddress); addressInfo.addRoutingType(RoutingType.MULTICAST); addressInfo.addRoutingType(RoutingType.ANYCAST); server.addAddressInfo(addressInfo); server.createQueue(ssTestAddress, RoutingType.ANYCAST, ssTestAddress, null, true, false); Connection connection = createConnection(UUIDGenerator.getInstance().generateStringUUID()); try { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(testAddress); javax.jms.Queue queue = session.createQueue(testAddress); MessageProducer producer = session.createProducer(topic); MessageConsumer queueConsumer = session.createConsumer(queue); MessageConsumer topicConsumer = session.createConsumer(topic); producer.send(session.createTextMessage(STR)); assertNotNull(topicConsumer.receive(1000)); assertNull(queueConsumer.receive(1000)); } finally { connection.close(); } } | /**
* If we have an address configured with both ANYCAST and MULTICAST routing types enabled, we must ensure that any
* messages sent specifically to MULTICAST (e.g. JMS TopicProducer) are only delivered to MULTICAST queues (e.g.
* i.e. subscription queues) and **NOT** to ANYCAST queues (e.g. JMS Queue).
*
* @throws Exception
*/ | If we have an address configured with both ANYCAST and MULTICAST routing types enabled, we must ensure that any messages sent specifically to MULTICAST (e.g. JMS TopicProducer) are only delivered to MULTICAST queues (e.g. i.e. subscription queues) and **NOT** to ANYCAST queues (e.g. JMS Queue) | testRoutingExclusivity | {
"repo_name": "cshannon/activemq-artemis",
"path": "tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpMessageRoutingTest.java",
"license": "apache-2.0",
"size": 7510
} | [
"javax.jms.Connection",
"javax.jms.MessageConsumer",
"javax.jms.MessageProducer",
"javax.jms.Session",
"javax.jms.Topic",
"org.apache.activemq.artemis.api.core.RoutingType",
"org.apache.activemq.artemis.api.core.SimpleString",
"org.apache.activemq.artemis.core.server.impl.AddressInfo",
"org.apache.activemq.artemis.utils.UUIDGenerator",
"org.junit.Test"
] | import javax.jms.Connection; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.Topic; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.core.server.impl.AddressInfo; import org.apache.activemq.artemis.utils.UUIDGenerator; import org.junit.Test; | import javax.jms.*; import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.core.server.impl.*; import org.apache.activemq.artemis.utils.*; import org.junit.*; | [
"javax.jms",
"org.apache.activemq",
"org.junit"
] | javax.jms; org.apache.activemq; org.junit; | 208,047 |
public final ImmutableSetMultimap<ComponentRequirement, Element>
unvalidatedRequirementElements() {
// ComponentCreatorValidator ensures that there are either setter methods or factory method
// parameters, but not both, so we can cheat a little here since we know that only one of
// the two multimaps will be non-empty.
return ImmutableSetMultimap.copyOf( // no actual copy
unvalidatedSetterMethods().isEmpty()
? unvalidatedFactoryParameters()
: unvalidatedSetterMethods());
} | final ImmutableSetMultimap<ComponentRequirement, Element> function() { return ImmutableSetMultimap.copyOf( unvalidatedSetterMethods().isEmpty() ? unvalidatedFactoryParameters() : unvalidatedSetterMethods()); } | /**
* Multimap of component requirements to elements (methods or parameters) that set that
* requirement.
*
* <p>In a valid creator, there will be exactly one element per component requirement, so this
* method should only be called when validating the descriptor.
*/ | Multimap of component requirements to elements (methods or parameters) that set that requirement. In a valid creator, there will be exactly one element per component requirement, so this method should only be called when validating the descriptor | unvalidatedRequirementElements | {
"repo_name": "dushmis/dagger",
"path": "java/dagger/internal/codegen/binding/ComponentCreatorDescriptor.java",
"license": "apache-2.0",
"size": 9637
} | [
"com.google.common.collect.ImmutableSetMultimap",
"javax.lang.model.element.Element"
] | import com.google.common.collect.ImmutableSetMultimap; import javax.lang.model.element.Element; | import com.google.common.collect.*; import javax.lang.model.element.*; | [
"com.google.common",
"javax.lang"
] | com.google.common; javax.lang; | 2,568,636 |
public void exitEveryRule(ParserRuleContext ctx) { } | public void exitEveryRule(ParserRuleContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterEveryRule | {
"repo_name": "HEIG-GAPS/slasher",
"path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java",
"license": "mit",
"size": 73849
} | [
"org.antlr.v4.runtime.ParserRuleContext"
] | import org.antlr.v4.runtime.ParserRuleContext; | import org.antlr.v4.runtime.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 761,401 |
private void restoreFromLastProcessedFile(final long zoneId,
final ZoneReencryptionStatus zs)
throws IOException, InterruptedException {
final INodeDirectory parent;
final byte[] startAfter;
final INodesInPath lpfIIP =
dir.getINodesInPath(zs.getLastCheckpointFile(), FSDirectory.DirOp.READ);
parent = lpfIIP.getLastINode().getParent();
startAfter = lpfIIP.getLastINode().getLocalNameBytes();
traverser.traverseDir(parent, zoneId, startAfter,
new ZoneTraverseInfo(zs.getEzKeyVersionName()));
}
final class ReencryptionBatch {
// First file's path, for logging purpose.
private String firstFilePath;
private final List<FileEdekInfo> batch;
ReencryptionBatch() {
this(reencryptBatchSize);
}
ReencryptionBatch(int initialCapacity) {
batch = new ArrayList<>(initialCapacity);
} | void function(final long zoneId, final ZoneReencryptionStatus zs) throws IOException, InterruptedException { final INodeDirectory parent; final byte[] startAfter; final INodesInPath lpfIIP = dir.getINodesInPath(zs.getLastCheckpointFile(), FSDirectory.DirOp.READ); parent = lpfIIP.getLastINode().getParent(); startAfter = lpfIIP.getLastINode().getLocalNameBytes(); traverser.traverseDir(parent, zoneId, startAfter, new ZoneTraverseInfo(zs.getEzKeyVersionName())); } final class ReencryptionBatch { private String firstFilePath; private final List<FileEdekInfo> batch; ReencryptionBatch() { this(reencryptBatchSize); } ReencryptionBatch(int initialCapacity) { batch = new ArrayList<>(initialCapacity); } | /**
* Restore the re-encryption from the progress inside ReencryptionStatus.
* This means start from exactly the lastProcessedFile (LPF), skipping all
* earlier paths in lexicographic order. Lexicographically-later directories
* on the LPF parent paths are added to subdirs.
*/ | Restore the re-encryption from the progress inside ReencryptionStatus. This means start from exactly the lastProcessedFile (LPF), skipping all earlier paths in lexicographic order. Lexicographically-later directories on the LPF parent paths are added to subdirs | restoreFromLastProcessedFile | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ReencryptionHandler.java",
"license": "apache-2.0",
"size": 30868
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.hdfs.protocol.ZoneReencryptionStatus",
"org.apache.hadoop.hdfs.server.namenode.ReencryptionUpdater"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hdfs.protocol.ZoneReencryptionStatus; import org.apache.hadoop.hdfs.server.namenode.ReencryptionUpdater; | import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.namenode.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,437,508 |
public void addMapMarkers() {
touch = 0;
mapOverlay.clearLocationList();
mapOverlay.currentlocation = new GeoPoint((int) (ctx.curLoc.getLatitude() * 1E6), (int) (ctx.curLoc.getLongitude() * 1E6));
for (int i = 0; i < arMarkers.size(); i++) {
if (arMarkers.get(i).mGeoLoc.getDistance() <= arSettings.getInt(InitActivity.SETUP_SEARCH_RADIUS, InitActivity.DEFAULT_SEARCH_RADIUS))
mapOverlay.setLocationList(arMarkers.get(i));
}
mapOverlay.setSearchedLocation();
touch = 1;
}
| void function() { touch = 0; mapOverlay.clearLocationList(); mapOverlay.currentlocation = new GeoPoint((int) (ctx.curLoc.getLatitude() * 1E6), (int) (ctx.curLoc.getLongitude() * 1E6)); for (int i = 0; i < arMarkers.size(); i++) { if (arMarkers.get(i).mGeoLoc.getDistance() <= arSettings.getInt(InitActivity.SETUP_SEARCH_RADIUS, InitActivity.DEFAULT_SEARCH_RADIUS)) mapOverlay.setLocationList(arMarkers.get(i)); } mapOverlay.setSearchedLocation(); touch = 1; } | /**
* adding of map overlay markers
*/ | adding of map overlay markers | addMapMarkers | {
"repo_name": "sanyaade-augmented-reality/android-argame",
"path": "src/org/mixare/MixView.java",
"license": "gpl-3.0",
"size": 60659
} | [
"com.google.android.maps.GeoPoint",
"edu.fsu.cs.argame.InitActivity"
] | import com.google.android.maps.GeoPoint; import edu.fsu.cs.argame.InitActivity; | import com.google.android.maps.*; import edu.fsu.cs.argame.*; | [
"com.google.android",
"edu.fsu.cs"
] | com.google.android; edu.fsu.cs; | 179,071 |
private int getPositionForSectionView(SectionView sectionView) {
for (Pair<Integer, SectionView> section : mSectionViews) {
if (sectionView == section.second) {
return section.first;
}
}
return -1;
} | int function(SectionView sectionView) { for (Pair<Integer, SectionView> section : mSectionViews) { if (sectionView == section.second) { return section.first; } } return -1; } | /**
* Get the adapter position of the header corresponding to the given section view
*
* @param sectionView section view
* @return adapter position
*/ | Get the adapter position of the header corresponding to the given section view | getPositionForSectionView | {
"repo_name": "vector-im/riot-android",
"path": "vector/src/main/java/im/vector/util/StickySectionHelper.java",
"license": "apache-2.0",
"size": 11484
} | [
"android.util.Pair",
"im.vector.view.SectionView"
] | import android.util.Pair; import im.vector.view.SectionView; | import android.util.*; import im.vector.view.*; | [
"android.util",
"im.vector.view"
] | android.util; im.vector.view; | 2,884,284 |
@SuppressLint("NewApi")
private void addFilePreference(File iFile, PreferenceGroup oGroup, int iIconResId)
{
Preference aPref = new Preference(_context);
aPref.setPersistent(false);
aPref.setTitle(iFile.getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
aPref.setIcon(iIconResId);
// Use an intent to open with external text editor
Intent aIntent = new Intent();
aIntent.setAction(android.content.Intent.ACTION_VIEW);
aIntent.setDataAndType(Uri.fromFile(iFile), "text/plain");
aPref.setIntent(aIntent);
oGroup.addPreference(aPref);
} | @SuppressLint(STR) void function(File iFile, PreferenceGroup oGroup, int iIconResId) { Preference aPref = new Preference(_context); aPref.setPersistent(false); aPref.setTitle(iFile.getName()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) aPref.setIcon(iIconResId); Intent aIntent = new Intent(); aIntent.setAction(android.content.Intent.ACTION_VIEW); aIntent.setDataAndType(Uri.fromFile(iFile), STR); aPref.setIntent(aIntent); oGroup.addPreference(aPref); } | /**
* Low-level addition of a item to the menu.
* @param iFile
* @param oGroup
* @param iIconResId
*/ | Low-level addition of a item to the menu | addFilePreference | {
"repo_name": "culugyx/tinc_gui",
"path": "app/src/main/java/org/poirsouille/tinc_gui/SettingsTools.java",
"license": "gpl-3.0",
"size": 7569
} | [
"android.annotation.SuppressLint",
"android.content.Intent",
"android.net.Uri",
"android.os.Build",
"android.preference.Preference",
"android.preference.PreferenceGroup",
"java.io.File"
] | import android.annotation.SuppressLint; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.preference.Preference; import android.preference.PreferenceGroup; import java.io.File; | import android.annotation.*; import android.content.*; import android.net.*; import android.os.*; import android.preference.*; import java.io.*; | [
"android.annotation",
"android.content",
"android.net",
"android.os",
"android.preference",
"java.io"
] | android.annotation; android.content; android.net; android.os; android.preference; java.io; | 408,663 |
@Test
public void testComparisonIPv6() {
Ip6Address addr1, addr2, addr3, addr4;
addr1 = Ip6Address.valueOf("1111:2222:3333:4444:5555:6666:7777:8888");
addr2 = Ip6Address.valueOf("1111:2222:3333:4444:5555:6666:7777:8888");
addr3 = Ip6Address.valueOf("1111:2222:3333:4444:5555:6666:7777:8887");
addr4 = Ip6Address.valueOf("1111:2222:3333:4444:5555:6666:7777:8889");
assertTrue(addr1.compareTo(addr2) == 0);
assertTrue(addr1.compareTo(addr3) > 0);
assertTrue(addr1.compareTo(addr4) < 0);
addr1 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8888");
addr2 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8888");
addr3 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8887");
addr4 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8889");
assertTrue(addr1.compareTo(addr2) == 0);
assertTrue(addr1.compareTo(addr3) > 0);
assertTrue(addr1.compareTo(addr4) < 0);
addr1 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8888");
addr2 = Ip6Address.valueOf("ffff:2222:3333:4444:5555:6666:7777:8888");
addr3 = Ip6Address.valueOf("ffff:2222:3333:4443:5555:6666:7777:8888");
addr4 = Ip6Address.valueOf("ffff:2222:3333:4445:5555:6666:7777:8888");
assertTrue(addr1.compareTo(addr2) == 0);
assertTrue(addr1.compareTo(addr3) > 0);
assertTrue(addr1.compareTo(addr4) < 0);
} | void function() { Ip6Address addr1, addr2, addr3, addr4; addr1 = Ip6Address.valueOf(STR); addr2 = Ip6Address.valueOf(STR); addr3 = Ip6Address.valueOf(STR); addr4 = Ip6Address.valueOf(STR); assertTrue(addr1.compareTo(addr2) == 0); assertTrue(addr1.compareTo(addr3) > 0); assertTrue(addr1.compareTo(addr4) < 0); addr1 = Ip6Address.valueOf(STR); addr2 = Ip6Address.valueOf(STR); addr3 = Ip6Address.valueOf(STR); addr4 = Ip6Address.valueOf(STR); assertTrue(addr1.compareTo(addr2) == 0); assertTrue(addr1.compareTo(addr3) > 0); assertTrue(addr1.compareTo(addr4) < 0); addr1 = Ip6Address.valueOf(STR); addr2 = Ip6Address.valueOf(STR); addr3 = Ip6Address.valueOf(STR); addr4 = Ip6Address.valueOf(STR); assertTrue(addr1.compareTo(addr2) == 0); assertTrue(addr1.compareTo(addr3) > 0); assertTrue(addr1.compareTo(addr4) < 0); } | /**
* Tests comparison of {@link Ip6Address} for IPv6.
*/ | Tests comparison of <code>Ip6Address</code> for IPv6 | testComparisonIPv6 | {
"repo_name": "jinlongliu/onos",
"path": "utils/misc/src/test/java/org/onlab/packet/Ip6AddressTest.java",
"license": "apache-2.0",
"size": 17756
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 420,807 |
public void setObjectStore(ObjectStore objectStore) {
if (alias != null) {
throw new BuildException("set one of alias and objectStore, not both");
}
this.objectStore = objectStore;
} | void function(ObjectStore objectStore) { if (alias != null) { throw new BuildException(STR); } this.objectStore = objectStore; } | /**
* Set the ObjectStore to use. Can be set instead of alias.
*
* @param objectStore ObjectStore to create indexes on
*/ | Set the ObjectStore to use. Can be set instead of alias | setObjectStore | {
"repo_name": "drhee/toxoMine",
"path": "intermine/integrate/main/src/org/intermine/task/CreateIndexesTask.java",
"license": "lgpl-2.1",
"size": 29942
} | [
"org.apache.tools.ant.BuildException",
"org.intermine.objectstore.ObjectStore"
] | import org.apache.tools.ant.BuildException; import org.intermine.objectstore.ObjectStore; | import org.apache.tools.ant.*; import org.intermine.objectstore.*; | [
"org.apache.tools",
"org.intermine.objectstore"
] | org.apache.tools; org.intermine.objectstore; | 580,723 |
public static void debug(Logger log, String message, Exception exception) {
// Log the error with a message-safe exception.
if (log.isDebugEnabled()) {
Exception loggingException = createLoggingException(exception);
log.debug(message, loggingException);
}
} | static void function(Logger log, String message, Exception exception) { if (log.isDebugEnabled()) { Exception loggingException = createLoggingException(exception); log.debug(message, loggingException); } } | /**
* Write the appropriate debug message to the log file
*
* @param log
* logger to write the message
* @param message
* specific message to write to the log file
* @param exception
* the exception which caused the log file entry
*/ | Write the appropriate debug message to the log file | debug | {
"repo_name": "inbloom/ingestion-validation",
"path": "ingestion/ingestion-base/src/main/java/org/slc/sli/ingestion/util/LogUtil.java",
"license": "apache-2.0",
"size": 5172
} | [
"org.slf4j.Logger"
] | import org.slf4j.Logger; | import org.slf4j.*; | [
"org.slf4j"
] | org.slf4j; | 1,801,460 |
public int maxSaslEncryptedBlockSize() {
return Ints.checkedCast(JavaUtils.byteStringAsBytes(
conf.get("spark.network.sasl.maxEncryptedBlockSize", "64k")));
} | int function() { return Ints.checkedCast(JavaUtils.byteStringAsBytes( conf.get(STR, "64k"))); } | /**
* Maximum number of bytes to be encrypted at a time when SASL encryption is used.
*/ | Maximum number of bytes to be encrypted at a time when SASL encryption is used | maxSaslEncryptedBlockSize | {
"repo_name": "bravo-zhang/spark",
"path": "common/network-common/src/main/java/org/apache/spark/network/util/TransportConf.java",
"license": "apache-2.0",
"size": 10738
} | [
"com.google.common.primitives.Ints"
] | import com.google.common.primitives.Ints; | import com.google.common.primitives.*; | [
"com.google.common"
] | com.google.common; | 2,296,104 |
public static String getClientIP(HttpRequestInfo request)
{
final String xForwardedFor = request.getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_FOR);
String clientIP;
if (xForwardedFor == null) {
clientIP = request.getClientIp();
} else {
clientIP = extractClientIpFromXForwardedFor(xForwardedFor);
}
return clientIP;
} | static String function(HttpRequestInfo request) { final String xForwardedFor = request.getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_FOR); String clientIP; if (xForwardedFor == null) { clientIP = request.getClientIp(); } else { clientIP = extractClientIpFromXForwardedFor(xForwardedFor); } return clientIP; } | /**
* Get the IP address of client making the request.
*
* Uses the "x-forwarded-for" HTTP header if available, otherwise uses the remote
* IP of requester.
*
* @param request <code>HttpRequestMessage</code>
* @return <code>String</code> IP address
*/ | Get the IP address of client making the request. Uses the "x-forwarded-for" HTTP header if available, otherwise uses the remote IP of requester | getClientIP | {
"repo_name": "Netflix/zuul",
"path": "zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java",
"license": "apache-2.0",
"size": 6295
} | [
"com.netflix.zuul.message.http.HttpHeaderNames",
"com.netflix.zuul.message.http.HttpRequestInfo"
] | import com.netflix.zuul.message.http.HttpHeaderNames; import com.netflix.zuul.message.http.HttpRequestInfo; | import com.netflix.zuul.message.http.*; | [
"com.netflix.zuul"
] | com.netflix.zuul; | 2,022,235 |
private DefinitionProvider constructDefinitionProvider(Node externsRoot,
Node jsRoot) {
SimpleDefinitionFinder defFinder = new SimpleDefinitionFinder(compiler);
defFinder.process(externsRoot, jsRoot);
return defFinder;
} | DefinitionProvider function(Node externsRoot, Node jsRoot) { SimpleDefinitionFinder defFinder = new SimpleDefinitionFinder(compiler); defFinder.process(externsRoot, jsRoot); return defFinder; } | /**
* Constructs a DefinitionProvider that can be used to determine the
* targets of callsites.
*
* We use SimpleNameFinder because in practice it does
* not appear to be less precise than NameReferenceGraph and is at least an
* order of magnitude faster on large compiles.
*/ | Constructs a DefinitionProvider that can be used to determine the targets of callsites. We use SimpleNameFinder because in practice it does not appear to be less precise than NameReferenceGraph and is at least an order of magnitude faster on large compiles | constructDefinitionProvider | {
"repo_name": "vrkansagara/closure-compiler",
"path": "src/com/google/javascript/jscomp/CallGraph.java",
"license": "apache-2.0",
"size": 24020
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,527,982 |
protected EObject createInitialModel() {
EClass eClass = (EClass)emfFragPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
EObject rootObject = emfFragFactory.create(eClass);
return rootObject;
} | EObject function() { EClass eClass = (EClass)emfFragPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = emfFragFactory.create(eClass); return rootObject; } | /**
* Create a new model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Create a new model. | createInitialModel | {
"repo_name": "srirammails/emf-fragments",
"path": "de.hub.emffrag.editor/src/de/hub/emffrag/model/emffrag/presentation/EmfFragModelWizard.java",
"license": "apache-2.0",
"size": 18340
} | [
"org.eclipse.emf.ecore.EClass",
"org.eclipse.emf.ecore.EObject"
] | import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,103,954 |
private Document createDocumentFromFile(String fileName)
throws Exception
{
Guard.check(fileName);
File file = new File(fileName);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(file);
document.getDocumentElement().normalize();
return document;
} | Document function(String fileName) throws Exception { Guard.check(fileName); File file = new File(fileName); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(file); document.getDocumentElement().normalize(); return document; } | /**
* Creates a document object model from file.
*
* @param fileName The file name
* @return The document
* @throws Exception
*/ | Creates a document object model from file | createDocumentFromFile | {
"repo_name": "snoozesoftware/snoozeclient",
"path": "src/main/java/org/inria/myriads/snoozeclient/database/api/impl/ClientXMLRepository.java",
"license": "gpl-2.0",
"size": 49726
} | [
"java.io.File",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"org.inria.myriads.snoozecommon.guard.Guard",
"org.w3c.dom.Document"
] | import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.inria.myriads.snoozecommon.guard.Guard; import org.w3c.dom.Document; | import java.io.*; import javax.xml.parsers.*; import org.inria.myriads.snoozecommon.guard.*; import org.w3c.dom.*; | [
"java.io",
"javax.xml",
"org.inria.myriads",
"org.w3c.dom"
] | java.io; javax.xml; org.inria.myriads; org.w3c.dom; | 2,550,103 |
public ObjectPidsPath getObjectPidsPath() {
return objectPidsPath;
} | ObjectPidsPath function() { return objectPidsPath; } | /**
* Gets object's pids path
*
* @return Pids path
*/ | Gets object's pids path | getObjectPidsPath | {
"repo_name": "ceskaexpedice/kramerius",
"path": "shared/common/src/main/java/cz/incad/kramerius/document/model/PreparedDocument.java",
"license": "gpl-3.0",
"size": 8014
} | [
"cz.incad.kramerius.ObjectPidsPath"
] | import cz.incad.kramerius.ObjectPidsPath; | import cz.incad.kramerius.*; | [
"cz.incad.kramerius"
] | cz.incad.kramerius; | 455,513 |
public List<String> getClusters() {
List<String> list = new ArrayList<>();
list.addAll(config.getClusters().keySet());
return list;
}
| List<String> function() { List<String> list = new ArrayList<>(); list.addAll(config.getClusters().keySet()); return list; } | /**
* Get cluster list
* @return
*/ | Get cluster list | getClusters | {
"repo_name": "ameba-proteus/triton-server",
"path": "src/main/java/com/amebame/triton/service/cassandra/TritonCassandraClient.java",
"license": "bsd-3-clause",
"size": 6901
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 91,024 |
private void validateConstructor(Validator<?> validator) {
if (javaClass.getDeclaredConstructors().length != 1) {
// constructor count is validated with the class
return;
}
Constructor<?> constructor = javaClass.getDeclaredConstructors()[0];
ClassExecutableValidator v = new ClassExecutableValidator(constructor);
v.withModifiers(Modifier.PRIVATE).parameterCount(0);
// check: constructor throws new
// UnsupportedOperationException("Static class")
Throwable exception = null;
try {
// call the private ctor
constructor.setAccessible(true);
constructor.newInstance();
} catch (Exception ex) {
exception = ex.getCause();
} finally {
// restore visibility
constructor.setAccessible(false);
}
if (exception == null || !exception.getClass().equals(UnsupportedOperationException.class)
|| !exception.getMessage().equals("Static class")) {
v.addError("The constructor must throw an "
+ "UnsupportedOperationException with the message \"Static class\"");
}
validator.addChildIfInvalid(v);
} | void function(Validator<?> validator) { if (javaClass.getDeclaredConstructors().length != 1) { return; } Constructor<?> constructor = javaClass.getDeclaredConstructors()[0]; ClassExecutableValidator v = new ClassExecutableValidator(constructor); v.withModifiers(Modifier.PRIVATE).parameterCount(0); Throwable exception = null; try { constructor.setAccessible(true); constructor.newInstance(); } catch (Exception ex) { exception = ex.getCause(); } finally { constructor.setAccessible(false); } if (exception == null !exception.getClass().equals(UnsupportedOperationException.class) !exception.getMessage().equals(STR)) { v.addError(STR + STRStatic class\""); } validator.addChildIfInvalid(v); } | /**
* Validates the constructor of the class.
*
* @param validationContext
* a validation context
*/ | Validates the constructor of the class | validateConstructor | {
"repo_name": "SETTE-Testing/sette-tool",
"path": "src/sette-core/src/hu/bme/mit/sette/core/model/snippet/SnippetInputFactoryContainer.java",
"license": "apache-2.0",
"size": 8142
} | [
"hu.bme.mit.sette.core.validator.ClassExecutableValidator",
"hu.bme.mit.sette.core.validator.Validator",
"java.lang.reflect.Constructor",
"java.lang.reflect.Modifier"
] | import hu.bme.mit.sette.core.validator.ClassExecutableValidator; import hu.bme.mit.sette.core.validator.Validator; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; | import hu.bme.mit.sette.core.validator.*; import java.lang.reflect.*; | [
"hu.bme.mit",
"java.lang"
] | hu.bme.mit; java.lang; | 1,545,530 |
public SFTPv3FileHandle createFileTruncate(String fileName) throws IOException
{
return createFileTruncate(fileName, null);
}
/**
* reate a file (truncate it if it already exists) and open it for reading and writing.
* You can specify the default attributes of the file (the server may or may
* not respect your wishes).
*
* @param fileName See the {@link SFTPv3Client comment} for the class for more details.
* @param attr may be <code>null</code> to use server defaults. Probably only
* the <code>uid</code>, <code>gid</code> and <code>permissions</code>
* (remember the server may apply a umask) entries of the {@link SFTPv3FileHandle} | SFTPv3FileHandle function(String fileName) throws IOException { return createFileTruncate(fileName, null); } /** * reate a file (truncate it if it already exists) and open it for reading and writing. * You can specify the default attributes of the file (the server may or may * not respect your wishes). * * @param fileName See the {@link SFTPv3Client comment} for the class for more details. * @param attr may be <code>null</code> to use server defaults. Probably only * the <code>uid</code>, <code>gid</code> and <code>permissions</code> * (remember the server may apply a umask) entries of the {@link SFTPv3FileHandle} | /**
* Create a file (truncate it if it already exists) and open it for reading and writing.
* Same as {@link #createFileTruncate(String, SFTPv3FileAttributes) createFileTruncate(fileName, null)}.
*
* @param fileName See the {@link SFTPv3Client comment} for the class for more details.
* @return a SFTPv3FileHandle handle
* @throws IOException
*/ | Create a file (truncate it if it already exists) and open it for reading and writing. Same as <code>#createFileTruncate(String, SFTPv3FileAttributes) createFileTruncate(fileName, null)</code> | createFileTruncate | {
"repo_name": "handong106324/sqLogWeb",
"path": "src/ch/ethz/ssh2/SFTPv3Client.java",
"license": "lgpl-2.1",
"size": 37667
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,118,025 |
static Element findStorageElement( final Packet packet )
{
if ( packet instanceof IQ )
{
final IQ iq = (IQ) packet;
final Element childElement = iq.getChildElement();
if ( childElement == null || iq.getType() != IQ.Type.result )
{
return null;
}
switch ( childElement.getNamespaceURI() )
{
// A "Private XML Storage (XEP-0049) Bookmarks" result stanza.
case "jabber:iq:private":
return findStorageElementInPrivateXmlStorage( childElement );
// a "Persistent Storage of Private Data via PubSub (XEP-0048 / XEP-0223)" Bookmarks result.
case "http://jabber.org/protocol/pubsub":
return findStorageElementInPubsub( childElement );
default:
return null;
}
}
if ( packet instanceof Message )
{
final Message message = (Message) packet;
// Check for a "Persistent Storage of Private Data via PubSub (XEP-0048 / XEP-0223)" Bookmarks event notification.
return findStorageElementInPubsub( message.getChildElement( "event", "http://jabber.org/protocol/pubsub#event" ) );
}
return null;
} | static Element findStorageElement( final Packet packet ) { if ( packet instanceof IQ ) { final IQ iq = (IQ) packet; final Element childElement = iq.getChildElement(); if ( childElement == null iq.getType() != IQ.Type.result ) { return null; } switch ( childElement.getNamespaceURI() ) { case STR: return findStorageElementInPrivateXmlStorage( childElement ); case STReventSTRhttp: } return null; } | /**
* XEP-0048 'Bookmarks' describes a storage element that contains the list of bookmarks that we intend to
* add to in this method. Such a storage element can be transmitted in a number of different ways, including
* XEP-0049 "Private XML Storage" and XEP-0223 "Persistent Storage of Private Data via PubSub".
*
* @param packet The packet in which to search for a 'storage' element (cannot be null).
* @return The storage element, or null when no such element was found.
*/ | XEP-0048 'Bookmarks' describes a storage element that contains the list of bookmarks that we intend to add to in this method. Such a storage element can be transmitted in a number of different ways, including XEP-0049 "Private XML Storage" and XEP-0223 "Persistent Storage of Private Data via PubSub" | findStorageElement | {
"repo_name": "igniterealtime/ofmeet-openfire-plugin",
"path": "ofmeet/src/java/org/jivesoftware/openfire/plugin/ofmeet/BookmarkInterceptor.java",
"license": "apache-2.0",
"size": 7975
} | [
"org.dom4j.Element",
"org.xmpp.packet.Packet"
] | import org.dom4j.Element; import org.xmpp.packet.Packet; | import org.dom4j.*; import org.xmpp.packet.*; | [
"org.dom4j",
"org.xmpp.packet"
] | org.dom4j; org.xmpp.packet; | 2,357,053 |
void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception;
| void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception; | /**
* Given a DOM element, return a list of errors in the resource
* with regard to the specified profile
*
* @param errors
* @param element
* @param profile
* @- if the underlying infrastructure fails (not if the resource is invalid)
*/ | Given a DOM element, return a list of errors in the resource with regard to the specified profile | validate | {
"repo_name": "eug48/hapi-fhir",
"path": "hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/IResourceValidator.java",
"license": "apache-2.0",
"size": 7998
} | [
"com.google.gson.JsonObject",
"java.util.List",
"org.hl7.fhir.instance.model.StructureDefinition",
"org.hl7.fhir.utilities.validation.ValidationMessage"
] | import com.google.gson.JsonObject; import java.util.List; import org.hl7.fhir.instance.model.StructureDefinition; import org.hl7.fhir.utilities.validation.ValidationMessage; | import com.google.gson.*; import java.util.*; import org.hl7.fhir.instance.model.*; import org.hl7.fhir.utilities.validation.*; | [
"com.google.gson",
"java.util",
"org.hl7.fhir"
] | com.google.gson; java.util; org.hl7.fhir; | 1,694,291 |
@Override
public void close() {
CloseableReference.closeSafely(mPooledByteBufferRef);
} | void function() { CloseableReference.closeSafely(mPooledByteBufferRef); } | /**
* Closes the buffer enclosed by this class.
*/ | Closes the buffer enclosed by this class | close | {
"repo_name": "kaoree/fresco",
"path": "imagepipeline/src/main/java/com/facebook/imagepipeline/image/EncodedImage.java",
"license": "bsd-3-clause",
"size": 8924
} | [
"com.facebook.common.references.CloseableReference"
] | import com.facebook.common.references.CloseableReference; | import com.facebook.common.references.*; | [
"com.facebook.common"
] | com.facebook.common; | 2,567,621 |
@ApiModelProperty(example = "null", required = true, value = "market_group_id integer")
public Integer getMarketGroupId() {
return marketGroupId;
} | @ApiModelProperty(example = "null", required = true, value = STR) Integer function() { return marketGroupId; } | /**
* market_group_id integer
* @return marketGroupId
**/ | market_group_id integer | getMarketGroupId | {
"repo_name": "Tmin10/EVE-Security-Service",
"path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/model/GetMarketsGroupsMarketGroupIdOk.java",
"license": "gpl-3.0",
"size": 5113
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 85,437 |
private String getStyleName(Edge edge) {
String styleName = edge.getStyleName();
// If the style is null, use a blank string
styleName = (styleName == null ? "" : styleName);
return isSelected(m_graphContainer.getSelectionManager(), edge) ? styleName + " selected" : styleName;
} | String function(Edge edge) { String styleName = edge.getStyleName(); styleName = (styleName == null ? STR selected" : styleName; } | /**
* Cannot return null
*/ | Cannot return null | getStyleName | {
"repo_name": "RangerRick/opennms",
"path": "features/topology-map/org.opennms.features.topology.app/src/main/java/org/opennms/features/topology/app/internal/GraphPainter.java",
"license": "gpl-2.0",
"size": 4697
} | [
"org.opennms.features.topology.api.topo.Edge"
] | import org.opennms.features.topology.api.topo.Edge; | import org.opennms.features.topology.api.topo.*; | [
"org.opennms.features"
] | org.opennms.features; | 796,922 |
public void setSavePageAction(IDisplayableAction savePageAction) {
this.savePageAction = savePageAction;
} | void function(IDisplayableAction savePageAction) { this.savePageAction = savePageAction; } | /**
* Sets save page action.
*
* @param savePageAction
* the save page action
*/ | Sets save page action | setSavePageAction | {
"repo_name": "jspresso/jspresso-ce",
"path": "remote/application/src/main/java/org/jspresso/framework/view/remote/mobile/MobileRemoteViewFactory.java",
"license": "lgpl-3.0",
"size": 49973
} | [
"org.jspresso.framework.view.action.IDisplayableAction"
] | import org.jspresso.framework.view.action.IDisplayableAction; | import org.jspresso.framework.view.action.*; | [
"org.jspresso.framework"
] | org.jspresso.framework; | 2,706,015 |
protected void sequence_Table(EObject context, Table semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
/**
* Constraint:
* {Tags} | void function(EObject context, Table semanticObject) { genericSequencer.createSequence(context, semanticObject); } /** * Constraint: * {Tags} | /**
* Constraint:
* (heading=TableRow rows+=TableRow+)
*/ | Constraint: (heading=TableRow rows+=TableRow+) | sequence_Table | {
"repo_name": "getgauge/Gauge-Eclipse",
"path": "io.getgauge/src-gen/io/getgauge/serializer/SpecSemanticSequencer.java",
"license": "gpl-3.0",
"size": 8245
} | [
"io.getgauge.spec.Table",
"io.getgauge.spec.Tags",
"org.eclipse.emf.ecore.EObject"
] | import io.getgauge.spec.Table; import io.getgauge.spec.Tags; import org.eclipse.emf.ecore.EObject; | import io.getgauge.spec.*; import org.eclipse.emf.ecore.*; | [
"io.getgauge.spec",
"org.eclipse.emf"
] | io.getgauge.spec; org.eclipse.emf; | 1,256,892 |
AuthenticationBuilder setSuccesses(Map<String, HandlerResult> successes); | AuthenticationBuilder setSuccesses(Map<String, HandlerResult> successes); | /**
* Set successes authentication builder.
*
* @param successes the successes
* @return the authentication builder
* @since 4.2.0
*/ | Set successes authentication builder | setSuccesses | {
"repo_name": "PetrGasparik/cas",
"path": "cas-server-core-api-authentication/src/main/java/org/jasig/cas/authentication/AuthenticationBuilder.java",
"license": "apache-2.0",
"size": 4727
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,098,381 |
@Override
void recordEventState(InternalDistributedMember sender, Map eventState) {
if (eventState != null && this.owningQueue != null) {
this.owningQueue.recordEventState(sender, eventState);
}
} | void recordEventState(InternalDistributedMember sender, Map eventState) { if (eventState != null && this.owningQueue != null) { this.owningQueue.recordEventState(sender, eventState); } } | /**
* Record cache event state for a potential initial image provider. This is used to install event
* state when the sender is selected as initial image provider.
*
*
*/ | Record cache event state for a potential initial image provider. This is used to install event state when the sender is selected as initial image provider | recordEventState | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/HARegion.java",
"license": "apache-2.0",
"size": 19109
} | [
"java.util.Map",
"org.apache.geode.distributed.internal.membership.InternalDistributedMember"
] | import java.util.Map; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; | import java.util.*; import org.apache.geode.distributed.internal.membership.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 1,534,754 |
@Test
public void testIdVendor()
{
assertEquals(ID_VENDOR, descriptor.idVendor());
} | void function() { assertEquals(ID_VENDOR, descriptor.idVendor()); } | /**
* Tests the {@link SimpleUsbDeviceDescriptor#idVendor()} method.
*/ | Tests the <code>SimpleUsbDeviceDescriptor#idVendor()</code> method | testIdVendor | {
"repo_name": "usb4java/usb4java-javax",
"path": "src/test/java/org/usb4java/javax/descriptors/SimpleUsbDeviceDescriptorTest.java",
"license": "mit",
"size": 11588
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,524,461 |
public String getIconsPath() {
ResourceLocator generalSettings = new ResourceLocator(
"com.stratelia.webactiv.general", "fr");
String ip = generalSettings.getString("ApplicationURL")
+ GraphicElementFactory.getSettings().getString("IconsPath");
if (ip == null) {
return (ip);
}
if (!ip.endsWith("/")) {
return (ip + "/");
}
return (ip);
} | String function() { ResourceLocator generalSettings = new ResourceLocator( STR, "fr"); String ip = generalSettings.getString(STR) + GraphicElementFactory.getSettings().getString(STR); if (ip == null) { return (ip); } if (!ip.endsWith("/")) { return (ip + "/"); } return (ip); } | /**
* Method declaration
* @return
* @see
*/ | Method declaration | getIconsPath | {
"repo_name": "stephaneperry/Silverpeas-Core",
"path": "web-core/src/main/java/com/stratelia/webactiv/util/viewGenerator/html/arrayPanes/ArrayPaneWithDataSource.java",
"license": "agpl-3.0",
"size": 25563
} | [
"com.stratelia.webactiv.util.ResourceLocator",
"com.stratelia.webactiv.util.viewGenerator.html.GraphicElementFactory"
] | import com.stratelia.webactiv.util.ResourceLocator; import com.stratelia.webactiv.util.viewGenerator.html.GraphicElementFactory; | import com.stratelia.webactiv.util.*; | [
"com.stratelia.webactiv"
] | com.stratelia.webactiv; | 2,508,668 |
NextFilter getNextFilter(String name);
/**
* Returns the {@link NextFilter} of the specified {@link IoFilter} | NextFilter getNextFilter(String name); /** * Returns the {@link NextFilter} of the specified {@link IoFilter} | /**
* Returns the {@link NextFilter} of the {@link IoFilter} with the
* specified <tt>name</tt> in this chain.
*
* @param name The filter's name we want the next filter
* @return <tt>null</tt> if there's no such name in this chain
*/ | Returns the <code>NextFilter</code> of the <code>IoFilter</code> with the specified name in this chain | getNextFilter | {
"repo_name": "DL7AD/SSR-Receiver",
"path": "src/org/apache/mina/core/filterchain/IoFilterChain.java",
"license": "gpl-3.0",
"size": 12009
} | [
"org.apache.mina.core.filterchain.IoFilter"
] | import org.apache.mina.core.filterchain.IoFilter; | import org.apache.mina.core.filterchain.*; | [
"org.apache.mina"
] | org.apache.mina; | 1,258,200 |
public static String parse(String strVal, Object props, Set<String> visitedHolders,
boolean ignoreBadHolders) {
StringBuffer buf = new StringBuffer(strVal);
int startIndex = strVal.indexOf(DEF_HOLDER_PREFIX);
while (startIndex != -1) {
int endIndex = findHolderEndIndex(buf, startIndex);
if (endIndex != -1) {
String holder = buf.substring(startIndex + DEF_HOLDER_PREFIX_LEN, endIndex);
String defValue = null;
int defIndex = StringUtils.lastIndexOf(holder, ":");
if (defIndex >= 0) {
defValue = StringUtils.trim(holder.substring(defIndex + 1));
holder = StringUtils.trim(holder.substring(0, defIndex));
}
if (!visitedHolders.add(holder)) {
throw new RuntimeException("Circular PlaceHolder reference '"
+ holder + "' in property definitions");
}
// Recursive invocation, parsing Holders contained in the Holder keyValue.
holder = parse(holder, props, visitedHolders, ignoreBadHolders);
// Now obtain the value for the fully resolved keyValue...
String propVal = resolveHolder(holder, props, SYS_PROPS_MODE_FALLBACK, defValue);
if (propVal != null) {
// Recursive invocation, parsing Holders contained in the
// previously resolved Holder value.
propVal = parse(propVal, props, visitedHolders, ignoreBadHolders);
buf.replace(startIndex, endIndex + DEF_HOLDER_SUFFIX_LEN, propVal);
startIndex = buf.indexOf(DEF_HOLDER_PREFIX, startIndex + propVal.length());
} else if (ignoreBadHolders) {
// Proceed with unprocessed value.
startIndex = buf.indexOf(DEF_HOLDER_PREFIX, endIndex + DEF_HOLDER_SUFFIX_LEN);
} else {
throw new RuntimeException("Could not resolve Placeholder '" + holder + "'");
}
visitedHolders.remove(holder);
} else {
startIndex = -1;
}
}
return buf.toString();
} | static String function(String strVal, Object props, Set<String> visitedHolders, boolean ignoreBadHolders) { StringBuffer buf = new StringBuffer(strVal); int startIndex = strVal.indexOf(DEF_HOLDER_PREFIX); while (startIndex != -1) { int endIndex = findHolderEndIndex(buf, startIndex); if (endIndex != -1) { String holder = buf.substring(startIndex + DEF_HOLDER_PREFIX_LEN, endIndex); String defValue = null; int defIndex = StringUtils.lastIndexOf(holder, ":"); if (defIndex >= 0) { defValue = StringUtils.trim(holder.substring(defIndex + 1)); holder = StringUtils.trim(holder.substring(0, defIndex)); } if (!visitedHolders.add(holder)) { throw new RuntimeException(STR + holder + STR); } holder = parse(holder, props, visitedHolders, ignoreBadHolders); String propVal = resolveHolder(holder, props, SYS_PROPS_MODE_FALLBACK, defValue); if (propVal != null) { propVal = parse(propVal, props, visitedHolders, ignoreBadHolders); buf.replace(startIndex, endIndex + DEF_HOLDER_SUFFIX_LEN, propVal); startIndex = buf.indexOf(DEF_HOLDER_PREFIX, startIndex + propVal.length()); } else if (ignoreBadHolders) { startIndex = buf.indexOf(DEF_HOLDER_PREFIX, endIndex + DEF_HOLDER_SUFFIX_LEN); } else { throw new RuntimeException(STR + holder + "'"); } visitedHolders.remove(holder); } else { startIndex = -1; } } return buf.toString(); } | /**
* Parse the given String value recursively, to be able to resolve
* nested Holders (when resolved property values in turn contain
* Holders again).
*
* @param strVal the String value to parse
* @param props the Properties to resolve Holders against
* @param visitedHolders the Holders that have already been visited
* @param ignoreBadHolders during the current resolution attempt (used to detect circular references
* between Holders). Only non-null if we're parsing a nested Holder.
* @return 进行值填充后的字符串
*/ | Parse the given String value recursively, to be able to resolve nested Holders (when resolved property values in turn contain Holders again) | parse | {
"repo_name": "bingoohuang/java-utils",
"path": "src/main/java/com/github/bingoohuang/utils/lang/Substituters.java",
"license": "apache-2.0",
"size": 14051
} | [
"java.util.Set",
"org.apache.commons.lang3.StringUtils"
] | import java.util.Set; import org.apache.commons.lang3.StringUtils; | import java.util.*; import org.apache.commons.lang3.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 1,525,251 |
public List<Tag> getTagsByType(String tagType) {
if (tagType == null) {
throw new IllegalArgumentException(
"tagType must not be null. Please specify a valid tag type.");
}
return getTags(null, null, tagType, null);
} | List<Tag> function(String tagType) { if (tagType == null) { throw new IllegalArgumentException( STR); } return getTags(null, null, tagType, null); } | /**
* Return all tags of given type.
* @param tagType The type of tag to return. Must not be null.
* @return A List of tags.
*/ | Return all tags of given type | getTagsByType | {
"repo_name": "zebrafishmine/intermine",
"path": "intermine/api/main/src/org/intermine/api/profile/TagManager.java",
"license": "lgpl-2.1",
"size": 29543
} | [
"java.util.List",
"org.intermine.model.userprofile.Tag"
] | import java.util.List; import org.intermine.model.userprofile.Tag; | import java.util.*; import org.intermine.model.userprofile.*; | [
"java.util",
"org.intermine.model"
] | java.util; org.intermine.model; | 1,553,575 |
private void spiStop0(boolean disconnect) throws IgniteSpiException {
if (log.isDebugEnabled()) {
if (disconnect)
log.debug("Disconnecting SPI.");
else
log.debug("Preparing to start local node stop procedure.");
}
if (disconnect) {
synchronized (mux) {
spiState = DISCONNECTING;
}
}
if (msgWorker != null && msgWorker.runner() != null && msgWorker.runner().isAlive() && !disconnect) {
// Send node left message only if it is final stop.
msgWorker.addMessage(new TcpDiscoveryNodeLeftMessage(locNode.id()));
synchronized (mux) {
long timeout = spi.netTimeout;
long thresholdNanos = System.nanoTime() + U.millisToNanos(timeout);
while (spiState != LEFT && timeout > 0) {
try {
mux.wait(timeout);
timeout = U.nanosToMillis(thresholdNanos - System.nanoTime());
}
catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
break;
}
}
if (spiState == LEFT) {
if (log.isDebugEnabled())
log.debug("Verification for local node leave has been received from coordinator" +
" (continuing stop procedure).");
}
else if (log.isInfoEnabled()) {
log.info("No verification for local node leave has been received from coordinator" +
" (will stop node anyway).");
}
}
}
if (tcpSrvr != null)
tcpSrvr.stop();
tcpSrvr = null;
Collection<SocketReader> tmp;
synchronized (mux) {
tmp = U.arrayList(readers);
}
U.interrupt(tmp);
U.joinThreads(tmp, log);
U.interrupt(ipFinderCleaner);
U.join(ipFinderCleaner, log);
U.cancel(msgWorker);
U.join(msgWorker, log);
for (ClientMessageWorker clientWorker : clientMsgWorkers.values()) {
if (clientWorker != null) {
U.interrupt(clientWorker.runner());
U.join(clientWorker.runner(), log);
}
}
clientMsgWorkers.clear();
IgniteUtils.shutdownNow(ServerImpl.class, utilityPool, log);
U.interrupt(statsPrinter);
U.join(statsPrinter, log);
Collection<TcpDiscoveryNode> nodes = null;
if (!disconnect)
spi.printStopInfo();
else {
spi.getSpiContext().deregisterPorts();
nodes = ring.visibleNodes();
}
long topVer = ring.topologyVersion();
ring.clear();
if (nodes != null) {
// This is restart/disconnection and we need to fire FAIL event for each remote node.
DiscoverySpiListener lsnr = spi.lsnr;
if (lsnr != null) {
Collection<ClusterNode> processed = new HashSet<>(nodes.size());
for (TcpDiscoveryNode n : nodes) {
if (n.isLocal())
continue;
assert n.visible();
processed.add(n);
List<ClusterNode> top = U.arrayList(nodes, F.notIn(processed));
topVer++;
Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer,
Collections.unmodifiableList(top));
lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, hist, null).get();
}
}
}
printStatistics();
spi.stats.clear();
synchronized (mux) {
// Clear stored data.
leavingNodes.clear();
failedNodes.clear();
spiState = DISCONNECTED;
}
} | void function(boolean disconnect) throws IgniteSpiException { if (log.isDebugEnabled()) { if (disconnect) log.debug(STR); else log.debug(STR); } if (disconnect) { synchronized (mux) { spiState = DISCONNECTING; } } if (msgWorker != null && msgWorker.runner() != null && msgWorker.runner().isAlive() && !disconnect) { msgWorker.addMessage(new TcpDiscoveryNodeLeftMessage(locNode.id())); synchronized (mux) { long timeout = spi.netTimeout; long thresholdNanos = System.nanoTime() + U.millisToNanos(timeout); while (spiState != LEFT && timeout > 0) { try { mux.wait(timeout); timeout = U.nanosToMillis(thresholdNanos - System.nanoTime()); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); break; } } if (spiState == LEFT) { if (log.isDebugEnabled()) log.debug(STR + STR); } else if (log.isInfoEnabled()) { log.info(STR + STR); } } } if (tcpSrvr != null) tcpSrvr.stop(); tcpSrvr = null; Collection<SocketReader> tmp; synchronized (mux) { tmp = U.arrayList(readers); } U.interrupt(tmp); U.joinThreads(tmp, log); U.interrupt(ipFinderCleaner); U.join(ipFinderCleaner, log); U.cancel(msgWorker); U.join(msgWorker, log); for (ClientMessageWorker clientWorker : clientMsgWorkers.values()) { if (clientWorker != null) { U.interrupt(clientWorker.runner()); U.join(clientWorker.runner(), log); } } clientMsgWorkers.clear(); IgniteUtils.shutdownNow(ServerImpl.class, utilityPool, log); U.interrupt(statsPrinter); U.join(statsPrinter, log); Collection<TcpDiscoveryNode> nodes = null; if (!disconnect) spi.printStopInfo(); else { spi.getSpiContext().deregisterPorts(); nodes = ring.visibleNodes(); } long topVer = ring.topologyVersion(); ring.clear(); if (nodes != null) { DiscoverySpiListener lsnr = spi.lsnr; if (lsnr != null) { Collection<ClusterNode> processed = new HashSet<>(nodes.size()); for (TcpDiscoveryNode n : nodes) { if (n.isLocal()) continue; assert n.visible(); processed.add(n); List<ClusterNode> top = U.arrayList(nodes, F.notIn(processed)); topVer++; Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer, Collections.unmodifiableList(top)); lsnr.onDiscovery(EVT_NODE_FAILED, topVer, n, top, hist, null).get(); } } } printStatistics(); spi.stats.clear(); synchronized (mux) { leavingNodes.clear(); failedNodes.clear(); spiState = DISCONNECTED; } } | /**
* Stops SPI finally or stops SPI for restart.
*
* @param disconnect {@code True} if SPI is being disconnected.
* @throws IgniteSpiException If failed.
*/ | Stops SPI finally or stops SPI for restart | spiStop0 | {
"repo_name": "SomeFire/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java",
"license": "apache-2.0",
"size": 319423
} | [
"java.util.Collection",
"java.util.Collections",
"java.util.HashSet",
"java.util.List",
"java.util.Map",
"org.apache.ignite.cluster.ClusterNode",
"org.apache.ignite.internal.util.IgniteUtils",
"org.apache.ignite.internal.util.typedef.F",
"org.apache.ignite.internal.util.typedef.internal.U",
"org.apache.ignite.spi.IgniteSpiException",
"org.apache.ignite.spi.discovery.DiscoverySpiListener",
"org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode",
"org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage"
] | import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.IgniteUtils; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.discovery.DiscoverySpiListener; import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeLeftMessage; | import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.discovery.*; import org.apache.ignite.spi.discovery.tcp.internal.*; import org.apache.ignite.spi.discovery.tcp.messages.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,653,576 |
public void addProblem(String title, String attributeName){
if (problemMessage.containsKey(title)) {
Set<String> attributes = problemMessage.get(title);
if (attributeName != null && attributeName.length() > 0) attributes.add(attributeName);
} else {
Set<String> attributes = new HashSet<String>();
if (attributeName != null && attributeName.length() > 0) attributes.add(attributeName);
problemMessage.put(title, attributes );
}
verdict = false;
} | void function(String title, String attributeName){ if (problemMessage.containsKey(title)) { Set<String> attributes = problemMessage.get(title); if (attributeName != null && attributeName.length() > 0) attributes.add(attributeName); } else { Set<String> attributes = new HashSet<String>(); if (attributeName != null && attributeName.length() > 0) attributes.add(attributeName); problemMessage.put(title, attributes ); } verdict = false; } | /**
* Add a new problem to the list
* @param title message
* @param attributeName name of attribute
*/ | Add a new problem to the list | addProblem | {
"repo_name": "Orange-OpenSource/matos-tool",
"path": "matos/src/main/java/com/orange/analysis/headers/Checker.java",
"license": "apache-2.0",
"size": 2971
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,857,825 |
public void testASCII() throws Exception {
Logger root = Logger.getRootLogger();
configure(root, "output/ascii.log", "US-ASCII");
common(root);
assertTrue(BinaryCompare.compare("output/ascii.log",
"witness/encoding/ascii.log"));
} | void function() throws Exception { Logger root = Logger.getRootLogger(); configure(root, STR, STR); common(root); assertTrue(BinaryCompare.compare(STR, STR)); } | /**
* Test us-ascii encoding.
* @throws Exception if test failure
*/ | Test us-ascii encoding | testASCII | {
"repo_name": "prmsheriff/log4j",
"path": "tests/src/java/org/apache/log4j/EncodingTest.java",
"license": "apache-2.0",
"size": 4741
} | [
"org.apache.log4j.util.BinaryCompare"
] | import org.apache.log4j.util.BinaryCompare; | import org.apache.log4j.util.*; | [
"org.apache.log4j"
] | org.apache.log4j; | 1,389,301 |
private String getUserLanguage() throws Exception {
String language = getRequestedLanguage();
Identity identity = getEnvironment().getIdentity();
String userID = identity.getUsername(); // WARN: Do not use the protected method getUsername(), because it might be overwritten and hence backwards compatibility might fail!
if (userID != null) {
if (getRealm().getIdentityManager().getUserManager().existsUser(userID)) { // INFO: It might be possible that a user ID is still referenced by a session, but has been deleted "persistently" in the meantime
String userLanguage = getRealm().getIdentityManager().getUserManager().getUser(userID).getLanguage();
//log.debug("User language: " + userLanguage);
if(userLanguage != null) {
language = userLanguage;
log.debug("Use user profile language: " + language);
} else {
log.debug("Use requested language: " + language);
}
} else {
log.warn("No such user '" + userID + "', hence use requested language: " + language);
}
}
return language;
} | String function() throws Exception { String language = getRequestedLanguage(); Identity identity = getEnvironment().getIdentity(); String userID = identity.getUsername(); if (userID != null) { if (getRealm().getIdentityManager().getUserManager().existsUser(userID)) { String userLanguage = getRealm().getIdentityManager().getUserManager().getUser(userID).getLanguage(); if(userLanguage != null) { language = userLanguage; log.debug(STR + language); } else { log.debug(STR + language); } } else { log.warn(STR + userID + STR + language); } } return language; } | /**
* Get user language (order: profile, browser, ...)
*/ | Get user language (order: profile, browser, ...) | getUserLanguage | {
"repo_name": "baszero/yanel",
"path": "src/resources/translation/src/java/org/wyona/yanel/impl/resources/TranslationResource.java",
"license": "apache-2.0",
"size": 17621
} | [
"org.wyona.security.core.api.Identity"
] | import org.wyona.security.core.api.Identity; | import org.wyona.security.core.api.*; | [
"org.wyona.security"
] | org.wyona.security; | 672,076 |
public void testGetObjectInstance_NoBuilder_ReferenceReturnNull()
throws Exception {
log.setMethod("testGetObjectInstance_NoBuilder_ReferenceReturnNull()");
Hashtable<Object, Object> env = new Hashtable<Object, Object>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"dazzle.jndi.testing.spi.DazzleContextFactory");
Reference r = new Reference(
null,
"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockObjectFactory",
null);
indicateReturnNull(env);
Object obj = NamingManager.getObjectInstance(r, null, null, env);
assertNull(obj);
// test Referenceable
MockReferenceable mr = new MockReferenceable(r);
indicateReturnNull(env);
obj = NamingManager.getObjectInstance(mr, null, null, env);
assertNull(obj);
} | void function() throws Exception { log.setMethod(STR); Hashtable<Object, Object> env = new Hashtable<Object, Object>(); env.put(Context.INITIAL_CONTEXT_FACTORY, STR); Reference r = new Reference( null, STR, null); indicateReturnNull(env); Object obj = NamingManager.getObjectInstance(r, null, null, env); assertNull(obj); MockReferenceable mr = new MockReferenceable(r); indicateReturnNull(env); obj = NamingManager.getObjectInstance(mr, null, null, env); assertNull(obj); } | /**
* When no factory builder is set and the fed object is Reference with a
* valid factory name but the factory returns null. Should return null.
*
* Try the same when the fed object is Referenceable.
*/ | When no factory builder is set and the fed object is Reference with a valid factory name but the factory returns null. Should return null. Try the same when the fed object is Referenceable | testGetObjectInstance_NoBuilder_ReferenceReturnNull | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java",
"license": "apache-2.0",
"size": 73817
} | [
"java.util.Hashtable",
"javax.naming.Context",
"javax.naming.Reference",
"javax.naming.spi.NamingManager"
] | import java.util.Hashtable; import javax.naming.Context; import javax.naming.Reference; import javax.naming.spi.NamingManager; | import java.util.*; import javax.naming.*; import javax.naming.spi.*; | [
"java.util",
"javax.naming"
] | java.util; javax.naming; | 216,777 |
@Test
public void test_folders_inherit_the_filetypes_of_their_parents() throws DotDataException, DotSecurityException {
final Host newHost = new SiteDataGen().nextPersisted();
final long currentTime = System.currentTimeMillis();
final ContentType fileAssetType = contentTypeAPI.find(FileAssetAPI.DEFAULT_FILE_ASSET_STRUCTURE_VELOCITY_VAR_NAME);
ContentType newFileAssetType = ContentTypeBuilder
.builder(fileAssetType)
.id(null)
.variable("fileAsset" + currentTime)
.name("fileAsset" + currentTime)
.build();
newFileAssetType = contentTypeAPI.save(newFileAssetType);
assertEquals(newFileAssetType.variable(),"fileAsset" + currentTime);
assert(newFileAssetType.id()!=null);
final Folder parentFolder = new FolderDataGen().defaultFileType(newFileAssetType.id()).site(newHost).nextPersisted();
assertEquals(parentFolder.getDefaultFileType(), newFileAssetType.id());
final String folderPath = parentFolder.getPath() + "folder1/folder2/folder3";
folderAPI.createFolders(folderPath, newHost, user, false);
// /path/folder1
Folder folder1 = folderAPI.findFolderByPath(parentFolder.getPath() + "/folder1", newHost, user, false);
assert(folder1!=null);
assertEquals(folder1.getDefaultFileType(), newFileAssetType.id());
// /path/folder2
Folder folder2 = folderAPI.findFolderByPath(parentFolder.getPath() + "/folder1/folder2", newHost, user, false);
assert(folder2!=null);
assertEquals(folder2.getDefaultFileType(), newFileAssetType.id());
// /path/folder3
Folder folder3 = folderAPI.findFolderByPath(parentFolder.getPath() + "/folder1/folder2/folder3", newHost, user, false);
assert(folder3!=null);
assertEquals(folder3.getDefaultFileType(), newFileAssetType.id());
}
| void function() throws DotDataException, DotSecurityException { final Host newHost = new SiteDataGen().nextPersisted(); final long currentTime = System.currentTimeMillis(); final ContentType fileAssetType = contentTypeAPI.find(FileAssetAPI.DEFAULT_FILE_ASSET_STRUCTURE_VELOCITY_VAR_NAME); ContentType newFileAssetType = ContentTypeBuilder .builder(fileAssetType) .id(null) .variable(STR + currentTime) .name(STR + currentTime) .build(); newFileAssetType = contentTypeAPI.save(newFileAssetType); assertEquals(newFileAssetType.variable(),STR + currentTime); assert(newFileAssetType.id()!=null); final Folder parentFolder = new FolderDataGen().defaultFileType(newFileAssetType.id()).site(newHost).nextPersisted(); assertEquals(parentFolder.getDefaultFileType(), newFileAssetType.id()); final String folderPath = parentFolder.getPath() + STR; folderAPI.createFolders(folderPath, newHost, user, false); Folder folder1 = folderAPI.findFolderByPath(parentFolder.getPath() + STR, newHost, user, false); assert(folder1!=null); assertEquals(folder1.getDefaultFileType(), newFileAssetType.id()); Folder folder2 = folderAPI.findFolderByPath(parentFolder.getPath() + STR, newHost, user, false); assert(folder2!=null); assertEquals(folder2.getDefaultFileType(), newFileAssetType.id()); Folder folder3 = folderAPI.findFolderByPath(parentFolder.getPath() + STR, newHost, user, false); assert(folder3!=null); assertEquals(folder3.getDefaultFileType(), newFileAssetType.id()); } | /**
* this method tests that when you create a folder with a default file type and then create folders
* underneith it, that the children folders inherit the parent's default file type. This is
* especially used when creating folders via webdav
*
* @throws DotDataException
* @throws DotSecurityException
*/ | this method tests that when you create a folder with a default file type and then create folders underneith it, that the children folders inherit the parent's default file type. This is especially used when creating folders via webdav | test_folders_inherit_the_filetypes_of_their_parents | {
"repo_name": "dotCMS/core",
"path": "dotCMS/src/integration-test/java/com/dotmarketing/portlets/folders/business/FolderAPITest.java",
"license": "gpl-3.0",
"size": 57765
} | [
"com.dotcms.contenttype.model.type.ContentType",
"com.dotcms.contenttype.model.type.ContentTypeBuilder",
"com.dotcms.datagen.FolderDataGen",
"com.dotcms.datagen.SiteDataGen",
"com.dotmarketing.beans.Host",
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.exception.DotSecurityException",
"com.dotmarketing.portlets.fileassets.business.FileAssetAPI",
"com.dotmarketing.portlets.folders.model.Folder",
"org.junit.Assert"
] | import com.dotcms.contenttype.model.type.ContentType; import com.dotcms.contenttype.model.type.ContentTypeBuilder; import com.dotcms.datagen.FolderDataGen; import com.dotcms.datagen.SiteDataGen; import com.dotmarketing.beans.Host; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.dotmarketing.portlets.fileassets.business.FileAssetAPI; import com.dotmarketing.portlets.folders.model.Folder; import org.junit.Assert; | import com.dotcms.contenttype.model.type.*; import com.dotcms.datagen.*; import com.dotmarketing.beans.*; import com.dotmarketing.exception.*; import com.dotmarketing.portlets.fileassets.business.*; import com.dotmarketing.portlets.folders.model.*; import org.junit.*; | [
"com.dotcms.contenttype",
"com.dotcms.datagen",
"com.dotmarketing.beans",
"com.dotmarketing.exception",
"com.dotmarketing.portlets",
"org.junit"
] | com.dotcms.contenttype; com.dotcms.datagen; com.dotmarketing.beans; com.dotmarketing.exception; com.dotmarketing.portlets; org.junit; | 2,876,267 |
@Test
@Feature({"NFCTest"})
public void testMakeReadOnlyWhenOperationsAreSuspended() {
TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate);
nfc.suspendNfcOperations();
mDelegate.invokeCallback();
MakeReadOnly_Response mockCallback = mock(MakeReadOnly_Response.class);
nfc.makeReadOnly(mockCallback);
// Check that makeReadOnly request was cancelled with OPERATION_CANCELLED.
verify(mockCallback).call(mErrorCaptor.capture());
assertNotNull(mErrorCaptor.getValue());
assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType);
} | @Feature({STR}) void function() { TestNfcImpl nfc = new TestNfcImpl(mContext, mDelegate); nfc.suspendNfcOperations(); mDelegate.invokeCallback(); MakeReadOnly_Response mockCallback = mock(MakeReadOnly_Response.class); nfc.makeReadOnly(mockCallback); verify(mockCallback).call(mErrorCaptor.capture()); assertNotNull(mErrorCaptor.getValue()); assertEquals(NdefErrorType.OPERATION_CANCELLED, mErrorCaptor.getValue().errorType); } | /**
* Test that Nfc.makeReadOnly() fails if NFC operations are already suspended.
*/ | Test that Nfc.makeReadOnly() fails if NFC operations are already suspended | testMakeReadOnlyWhenOperationsAreSuspended | {
"repo_name": "chromium/chromium",
"path": "services/device/nfc/android/junit/src/org/chromium/device/nfc/NFCTest.java",
"license": "bsd-3-clause",
"size": 95069
} | [
"org.chromium.base.test.util.Feature",
"org.chromium.device.mojom.NdefErrorType",
"org.junit.Assert",
"org.mockito.Mockito"
] | import org.chromium.base.test.util.Feature; import org.chromium.device.mojom.NdefErrorType; import org.junit.Assert; import org.mockito.Mockito; | import org.chromium.base.test.util.*; import org.chromium.device.mojom.*; import org.junit.*; import org.mockito.*; | [
"org.chromium.base",
"org.chromium.device",
"org.junit",
"org.mockito"
] | org.chromium.base; org.chromium.device; org.junit; org.mockito; | 2,739,567 |
private int computeCost(int[] solution, int index, int current_cost, int grip){
// If we are finished, just output the cost.
if( index < 0 ) {
return current_cost;
}
switch (solution[index]){
case 0: // U'
return computeCost(solution, index - 1, current_cost + cost_U3, grip);
case 1: // U2
return computeCost(solution, index - 1, current_cost + cost_U2, grip);
case 2: // U
if( grip == 0) {
return computeCost(solution, index - 1, current_cost + cost_U, 0);
} else if( grip == -1 ){
return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_U, 0),
computeCost(solution, index - 1, current_cost + cost_U_low, grip));
} else {
return computeCost(solution, index - 1, current_cost + cost_regrip + cost_U, 0);
}
case 3: // R'
if( grip > -1){
return computeCost(solution, index - 1, current_cost + cost_R3, grip - 1);
} else {
return computeCost(solution, index - 1, current_cost + cost_regrip + cost_R3, -1);
}
case 4: // R2
if( grip != 0){
return computeCost(solution, index - 1, current_cost + cost_R2, -grip);
} else {
return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_R2, -1),
computeCost(solution, index - 1, current_cost + cost_regrip + cost_R2, 1));
}
case 5: // R
if( grip < 1){
return computeCost(solution, index - 1, current_cost + cost_R, grip + 1);
} else {
return computeCost(solution, index - 1, current_cost + cost_regrip + cost_R, 1);
}
case 6: // F'
if (grip != 0) {
return computeCost(solution, index - 1, current_cost + cost_F3, grip);
} else {
return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_F3, -1),
computeCost(solution, index - 1, current_cost + cost_regrip + cost_F3, 1));
}
case 7: // F2
if (grip == -1) {
return computeCost(solution, index - 1, current_cost + cost_F2, -1);
} else {
return computeCost(solution, index - 1, current_cost + cost_regrip + cost_F2, -1);
}
case 8: // F
if (grip == -1) {
return computeCost(solution, index - 1, current_cost + cost_F, -1);
} else {
return computeCost(solution, index - 1, current_cost + cost_regrip + cost_F, -1);
}
default:
azzert(false);
break;
}
return -1;
} | int function(int[] solution, int index, int current_cost, int grip){ if( index < 0 ) { return current_cost; } switch (solution[index]){ case 0: return computeCost(solution, index - 1, current_cost + cost_U3, grip); case 1: return computeCost(solution, index - 1, current_cost + cost_U2, grip); case 2: if( grip == 0) { return computeCost(solution, index - 1, current_cost + cost_U, 0); } else if( grip == -1 ){ return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_U, 0), computeCost(solution, index - 1, current_cost + cost_U_low, grip)); } else { return computeCost(solution, index - 1, current_cost + cost_regrip + cost_U, 0); } case 3: if( grip > -1){ return computeCost(solution, index - 1, current_cost + cost_R3, grip - 1); } else { return computeCost(solution, index - 1, current_cost + cost_regrip + cost_R3, -1); } case 4: if( grip != 0){ return computeCost(solution, index - 1, current_cost + cost_R2, -grip); } else { return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_R2, -1), computeCost(solution, index - 1, current_cost + cost_regrip + cost_R2, 1)); } case 5: if( grip < 1){ return computeCost(solution, index - 1, current_cost + cost_R, grip + 1); } else { return computeCost(solution, index - 1, current_cost + cost_regrip + cost_R, 1); } case 6: if (grip != 0) { return computeCost(solution, index - 1, current_cost + cost_F3, grip); } else { return Math.min( computeCost(solution, index - 1, current_cost + cost_regrip + cost_F3, -1), computeCost(solution, index - 1, current_cost + cost_regrip + cost_F3, 1)); } case 7: if (grip == -1) { return computeCost(solution, index - 1, current_cost + cost_F2, -1); } else { return computeCost(solution, index - 1, current_cost + cost_regrip + cost_F2, -1); } case 8: if (grip == -1) { return computeCost(solution, index - 1, current_cost + cost_F, -1); } else { return computeCost(solution, index - 1, current_cost + cost_regrip + cost_F, -1); } default: azzert(false); break; } return -1; } | /**
* Try to evaluate the cost of applying a scramble
* @param solution the solution found by the solver, we need to read it backward and inverting the moves
* @param index current position of reading. Starts at the length-1 of the solution, and decrease by 1 every call
* @param current_cost current cost of the sequence that has been already read
* @param grip state of the grip of the right hand. -1: thumb on D, 0: thumb on F, 1: thumb on U
* @return returns the cost of the whole sequence
*/ | Try to evaluate the cost of applying a scramble | computeCost | {
"repo_name": "pedrosino/tnoodle",
"path": "scrambles/src/puzzle/TwoByTwoSolver.java",
"license": "gpl-3.0",
"size": 18768
} | [
"net.gnehzr.tnoodle.utils.GwtSafeUtils"
] | import net.gnehzr.tnoodle.utils.GwtSafeUtils; | import net.gnehzr.tnoodle.utils.*; | [
"net.gnehzr.tnoodle"
] | net.gnehzr.tnoodle; | 174,678 |
public PointF getDrawablePointFromTouchPoint(float x, float y) {
return transformCoordTouchToBitmap(x, y, true);
} | PointF function(float x, float y) { return transformCoordTouchToBitmap(x, y, true); } | /**
* For a given point on the view (ie, a touch event), returns the
* point relative to the original drawable's coordinate system.
* @param x
* @param y
* @return PointF relative to original drawable's coordinate system.
*/ | For a given point on the view (ie, a touch event), returns the point relative to the original drawable's coordinate system | getDrawablePointFromTouchPoint | {
"repo_name": "oshepherd/Impeller",
"path": "src/eu/e43/impeller/uikit/TouchImageView.java",
"license": "apache-2.0",
"size": 32406
} | [
"android.graphics.PointF"
] | import android.graphics.PointF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 481,248 |
FileChannel testSetCrfChannel(FileChannel ch) {
FileChannel chPrev = crf.channel;
crf.channel = ch;
return chPrev;
} | FileChannel testSetCrfChannel(FileChannel ch) { FileChannel chPrev = crf.channel; crf.channel = ch; return chPrev; } | /**
* Method to be used only for testing
*
* @param ch Object to replace the channel in the Oplog.crf
* @return original channel object
*/ | Method to be used only for testing | testSetCrfChannel | {
"repo_name": "jdeppe-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java",
"license": "apache-2.0",
"size": 52066
} | [
"java.nio.channels.FileChannel"
] | import java.nio.channels.FileChannel; | import java.nio.channels.*; | [
"java.nio"
] | java.nio; | 2,321,607 |
private List<List<Annotation>> arrangeIntoRows(Annotation tSpanAnn, List<Annotation> nestedAnnList)
{
int tSpanSize = tSpanAnn.getCoveredText().length();
List<BitSet> maskAtRowList = new ArrayList<BitSet>();
maskAtRowList.add(new BitSet(tSpanSize));
List<List<Annotation>> annotsAtRowList = new ArrayList<List<Annotation>>();
// divide parse annotations into rows
while (nestedAnnList.size() != 0)
{
// pop annotation off
Annotation ann = (Annotation) nestedAnnList.remove(0);
BitSet annBitSet = new BitSet(tSpanSize);
annBitSet.set(ann.getBegin() - tSpanAnn.getBegin(), ann.getEnd()
- tSpanAnn.getBegin());
// figure out which TR to place it in
int idx = 0;
boolean rowFound = false;
while (!rowFound)
{
BitSet trBitSet = (BitSet) maskAtRowList.get(idx);
// interset BitSets to determine if annotation will fit
// in this row
while (trBitSet.intersects(annBitSet))
{
idx++;
if ((idx + 1) > maskAtRowList.size())
{
trBitSet = new BitSet(tSpanSize);
maskAtRowList.add(trBitSet);
} else
{
trBitSet = (BitSet) maskAtRowList.get(idx);
}
}
trBitSet.or(annBitSet);
rowFound = true;
}
List<Annotation> annList = null;
if ((idx + 1) > annotsAtRowList.size())
{
annList = new ArrayList<Annotation>();
annList.add(ann);
annotsAtRowList.add(annList);
} else
{
annList = annotsAtRowList.get(idx);
annList.add(ann);
}
}
return annotsAtRowList;
} | List<List<Annotation>> function(Annotation tSpanAnn, List<Annotation> nestedAnnList) { int tSpanSize = tSpanAnn.getCoveredText().length(); List<BitSet> maskAtRowList = new ArrayList<BitSet>(); maskAtRowList.add(new BitSet(tSpanSize)); List<List<Annotation>> annotsAtRowList = new ArrayList<List<Annotation>>(); while (nestedAnnList.size() != 0) { Annotation ann = (Annotation) nestedAnnList.remove(0); BitSet annBitSet = new BitSet(tSpanSize); annBitSet.set(ann.getBegin() - tSpanAnn.getBegin(), ann.getEnd() - tSpanAnn.getBegin()); int idx = 0; boolean rowFound = false; while (!rowFound) { BitSet trBitSet = (BitSet) maskAtRowList.get(idx); while (trBitSet.intersects(annBitSet)) { idx++; if ((idx + 1) > maskAtRowList.size()) { trBitSet = new BitSet(tSpanSize); maskAtRowList.add(trBitSet); } else { trBitSet = (BitSet) maskAtRowList.get(idx); } } trBitSet.or(annBitSet); rowFound = true; } List<Annotation> annList = null; if ((idx + 1) > annotsAtRowList.size()) { annList = new ArrayList<Annotation>(); annList.add(ann); annotsAtRowList.add(annList); } else { annList = annotsAtRowList.get(idx); annList.add(ann); } } return annotsAtRowList; } | /**
* Arranges the list of annotations into one or more rows. Each element of
* the return List represents a row. Each row is represented as a row of
* Annotation objects that below to that row.
*
* @param tSpanAnn
* @param nestedAnnList
* @return
*/ | Arranges the list of annotations into one or more rows. Each element of the return List represents a row. Each row is represented as a row of Annotation objects that below to that row | arrangeIntoRows | {
"repo_name": "TCU-MI/ctakes",
"path": "ctakes-core/src/main/java/org/apache/ctakes/core/cc/HtmlTableCasConsumer.java",
"license": "apache-2.0",
"size": 14252
} | [
"java.util.ArrayList",
"java.util.BitSet",
"java.util.List",
"org.apache.uima.jcas.tcas.Annotation"
] | import java.util.ArrayList; import java.util.BitSet; import java.util.List; import org.apache.uima.jcas.tcas.Annotation; | import java.util.*; import org.apache.uima.jcas.tcas.*; | [
"java.util",
"org.apache.uima"
] | java.util; org.apache.uima; | 2,767,054 |
ChainedOptionsBuilder timeUnit(TimeUnit tu); | ChainedOptionsBuilder timeUnit(TimeUnit tu); | /**
* Timeunit to use in results
* @param tu time unit
* @return builder
* @see org.openjdk.jmh.annotations.OutputTimeUnit
*/ | Timeunit to use in results | timeUnit | {
"repo_name": "lewadik/jhmbe",
"path": "jmh-core/src/main/java/org/openjdk/jmh/runner/options/ChainedOptionsBuilder.java",
"license": "gpl-2.0",
"size": 9278
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 850,621 |
private String getAxisTitleSVG( double x, double y, String titlefontSVG, int titleRot, String scriptTitle )
{
StringBuffer svg = new StringBuffer();
svg.append( "<g>\r\n" );
svg.append( "<text " + getScript( scriptTitle ) + " x='" + x + "' y='" + y +
((titleRot == 0) ? "" : ("' transform='rotate(-" + titleRot + ", " + x + " ," + y + ")")) +
"' style='text-anchor: middle;' " + titlefontSVG + ">" + getTitle() + "</text>\r\n" );
svg.append( "</g>\r\n" );
return svg.toString();
}
}
class Scaling implements OOXMLElement
{
private static final Logger log = LoggerFactory.getLogger( Scaling.class );
private String logBase;
private String max;
private String min;
private String orientation;
public Scaling()
{ // no-param constructor, set up common defaults
}
public Scaling( String logBase, String max, String min, String orientation )
{
this.logBase = logBase;
this.max = max;
this.min = min;
this.orientation = orientation;
}
public Scaling( Scaling sc )
{
logBase = sc.logBase;
max = sc.max;
min = sc.min;
orientation = sc.orientation;
} | String function( double x, double y, String titlefontSVG, int titleRot, String scriptTitle ) { StringBuffer svg = new StringBuffer(); svg.append( STR ); svg.append( STR + getScript( scriptTitle ) + STR + x + STR + y + ((titleRot == 0) ? STR' transform='rotate(-STR, STR ,STR)STR' style='text-anchor: middle;' STR>STR</text>\r\nSTR</g>\r\n" ); return svg.toString(); } } class Scaling implements OOXMLElement { private static final Logger log = LoggerFactory.getLogger( Scaling.class ); private String logBase; private String max; private String min; private String orientation; public Scaling() { } public Scaling( String logBase, String max, String min, String orientation ) { this.logBase = logBase; this.max = max; this.min = min; this.orientation = orientation; } public Scaling( Scaling sc ) { logBase = sc.logBase; max = sc.max; min = sc.min; orientation = sc.orientation; } | /**
* return the svg necessary to display an axis title
*
* @param x
* @param y
* @param titlefontSVG
* @param titleRot 0, 45 or -90 degrees
* @param scriptTitle either "xaxistitle", "yaxistitle" or "zaxistitle"
* @return
*/ | return the svg necessary to display an axis title | getAxisTitleSVG | {
"repo_name": "Maxels88/openxls",
"path": "src/main/java/org/openxls/formats/XLS/charts/Axis.java",
"license": "gpl-3.0",
"size": 92982
} | [
"org.openxls.formats.OOXML",
"org.slf4j.Logger",
"org.slf4j.LoggerFactory"
] | import org.openxls.formats.OOXML; import org.slf4j.Logger; import org.slf4j.LoggerFactory; | import org.openxls.formats.*; import org.slf4j.*; | [
"org.openxls.formats",
"org.slf4j"
] | org.openxls.formats; org.slf4j; | 786,035 |
public void setSettlementDate(ZonedDateTime settlementDate) {
this._settlementDate = settlementDate;
} | void function(ZonedDateTime settlementDate) { this._settlementDate = settlementDate; } | /**
* Sets the settlement date.
* @param settlementDate the new value of the property
*/ | Sets the settlement date | setSettlementDate | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/option/SwaptionSecurity.java",
"license": "apache-2.0",
"size": 25234
} | [
"org.threeten.bp.ZonedDateTime"
] | import org.threeten.bp.ZonedDateTime; | import org.threeten.bp.*; | [
"org.threeten.bp"
] | org.threeten.bp; | 1,354,964 |
public List<UnknownParameterInformation> getUnknownParameters() {
return this.unknownParameterInformation;
} | List<UnknownParameterInformation> function() { return this.unknownParameterInformation; } | /**
* Delivers the information about unknown parameter types which occurred during process creation
* (from streams or files).
*/ | Delivers the information about unknown parameter types which occurred during process creation (from streams or files) | getUnknownParameters | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/Process.java",
"license": "agpl-3.0",
"size": 50917
} | [
"com.rapidminer.operator.UnknownParameterInformation",
"java.util.List"
] | import com.rapidminer.operator.UnknownParameterInformation; import java.util.List; | import com.rapidminer.operator.*; import java.util.*; | [
"com.rapidminer.operator",
"java.util"
] | com.rapidminer.operator; java.util; | 862,907 |
public ImageData createResourceImageData(String name) throws IOException {
ImageData data = new ImageData();
if (!loadCachedImage(data, name)) {
createImageFromStream(data,
ImageData.class.getResourceAsStream(name));
}
return data;
} | ImageData function(String name) throws IOException { ImageData data = new ImageData(); if (!loadCachedImage(data, name)) { createImageFromStream(data, ImageData.class.getResourceAsStream(name)); } return data; } | /**
* Creates an immutable <code>ImageData</code>
* from decoded image data obtained from the
* named resource. The name parameter is a resource name as defined by
* {@link Class#getResourceAsStream(String)
* Class.getResourceAsStream(name)}. The rules for resolving resource
* names are defined in the
* <a href="../../../java/lang/package-summary.html">
* Application Resource Files</a> section of the
* <code>java.lang</code> package documentation.
*
* @param name the name of the resource containing the image data in one of
* the supported image formats
* @return the created image data
* @throws NullPointerException if <code>name</code> is <code>null</code>
* @throws java.io.IOException if the resource does not exist,
* the data cannot
* be loaded, or the image data cannot be decoded
*/ | Creates an immutable <code>ImageData</code> from decoded image data obtained from the named resource. The name parameter is a resource name as defined by <code>Class#getResourceAsStream(String) Class.getResourceAsStream(name)</code>. The rules for resolving resource names are defined in the Application Resource Files section of the <code>java.lang</code> package documentation | createResourceImageData | {
"repo_name": "tommythorn/yari",
"path": "shared/cacao-related/phoneme_feature/midp/src/lowlevelui/graphics/putpixel/classes/javax/microedition/lcdui/ImageDataFactory.java",
"license": "gpl-2.0",
"size": 31269
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,540,836 |
// --------------------- actions
private void initFocusBindings() {
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
new TreeSet<KeyStroke>());
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
new TreeSet<KeyStroke>());
getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
KeyStroke.getKeyStroke("ctrl TAB"), FOCUS_NEXT_COMPONENT);
getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
KeyStroke.getKeyStroke("shift ctrl TAB"),
FOCUS_PREVIOUS_COMPONENT);
getActionMap().put(FOCUS_NEXT_COMPONENT,
createFocusTransferAction(true));
getActionMap().put(FOCUS_PREVIOUS_COMPONENT,
createFocusTransferAction(false));
} | void function() { setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, new TreeSet<KeyStroke>()); setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, new TreeSet<KeyStroke>()); getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(STR), FOCUS_NEXT_COMPONENT); getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(STR), FOCUS_PREVIOUS_COMPONENT); getActionMap().put(FOCUS_NEXT_COMPONENT, createFocusTransferAction(true)); getActionMap().put(FOCUS_PREVIOUS_COMPONENT, createFocusTransferAction(false)); } | /**
* Take over ctrl-tab.
*
*/ | Take over ctrl-tab | initFocusBindings | {
"repo_name": "trejkaz/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXTable.java",
"license": "lgpl-2.1",
"size": 163623
} | [
"java.awt.KeyboardFocusManager",
"java.util.TreeSet",
"javax.swing.KeyStroke"
] | import java.awt.KeyboardFocusManager; import java.util.TreeSet; import javax.swing.KeyStroke; | import java.awt.*; import java.util.*; import javax.swing.*; | [
"java.awt",
"java.util",
"javax.swing"
] | java.awt; java.util; javax.swing; | 1,953,440 |
private void appendAtEnd(final List<T> data) throws TimeStampedCacheException {
// append data at end
boolean appended = false;
final long qn = latestQuantum.get();
final int n = cache.size();
for (int i = data.size() - 1; i >= 0; --i) {
final long quantum = quantum(data.get(i).getDate());
if (quantum > qn) {
cache.add(n, new Entry(data.get(i), quantum));
appended = true;
} else {
break;
}
}
if (!appended) {
throw new TimeStampedCacheException(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER,
cache.get(cache.size() - 1).getData().getDate());
}
// evict excess data at start
final AbsoluteDate tn = cache.get(cache.size() - 1).getData().getDate();
while (cache.size() > neighborsSize &&
tn.durationFrom(cache.get(0).getData().getDate()) > maxSpan) {
cache.remove(0);
}
// update boundaries
earliestQuantum.set(cache.get(0).getQuantum());
latestQuantum.set(cache.get(cache.size() - 1).getQuantum());
} | void function(final List<T> data) throws TimeStampedCacheException { boolean appended = false; final long qn = latestQuantum.get(); final int n = cache.size(); for (int i = data.size() - 1; i >= 0; --i) { final long quantum = quantum(data.get(i).getDate()); if (quantum > qn) { cache.add(n, new Entry(data.get(i), quantum)); appended = true; } else { break; } } if (!appended) { throw new TimeStampedCacheException(OrekitMessages.UNABLE_TO_GENERATE_NEW_DATA_AFTER, cache.get(cache.size() - 1).getData().getDate()); } final AbsoluteDate tn = cache.get(cache.size() - 1).getData().getDate(); while (cache.size() > neighborsSize && tn.durationFrom(cache.get(0).getData().getDate()) > maxSpan) { cache.remove(0); } earliestQuantum.set(cache.get(0).getQuantum()); latestQuantum.set(cache.get(cache.size() - 1).getQuantum()); } | /** Append data at slot end.
* @param data data to append
* @exception TimeStampedCacheException if new data cannot be generated
*/ | Append data at slot end | appendAtEnd | {
"repo_name": "treeform/orekit",
"path": "src/main/java/org/orekit/utils/GenericTimeStampedCache.java",
"license": "apache-2.0",
"size": 34018
} | [
"java.util.List",
"org.orekit.errors.OrekitMessages",
"org.orekit.errors.TimeStampedCacheException",
"org.orekit.time.AbsoluteDate"
] | import java.util.List; import org.orekit.errors.OrekitMessages; import org.orekit.errors.TimeStampedCacheException; import org.orekit.time.AbsoluteDate; | import java.util.*; import org.orekit.errors.*; import org.orekit.time.*; | [
"java.util",
"org.orekit.errors",
"org.orekit.time"
] | java.util; org.orekit.errors; org.orekit.time; | 136,906 |
@Override
public void runCheck() throws MojoExecutionException, MojoFailureException {
Engine engine = null;
try {
engine = initializeEngine();
} catch (DatabaseException ex) {
if (getLog().isDebugEnabled()) {
getLog().debug("Database connection error", ex);
}
final String msg = "An exception occurred connecting to the local database. Please see the log file for more details.";
if (this.isFailOnError()) {
throw new MojoExecutionException(msg, ex);
}
getLog().error(msg);
}
if (engine != null) {
ExceptionCollection exCol = scanArtifacts(getProject(), engine);
if (engine.getDependencies().isEmpty()) {
getLog().info("No dependencies were identified that could be analyzed by dependency-check");
}
try {
engine.analyzeDependencies();
} catch (ExceptionCollection ex) {
if (this.isFailOnError() && ex.isFatal()) {
throw new MojoExecutionException("One or more exceptions occurred during analysis", ex);
}
exCol = ex;
}
if (exCol == null || !exCol.isFatal()) {
try {
final MavenProject p = this.getProject();
engine.writeReports(p.getName(), p.getGroupId(), p.getArtifactId(), p.getVersion(), getCorrectOutputDirectory(), getFormat());
} catch (ReportException ex) {
if (this.isFailOnError()) {
if (exCol != null) {
exCol.addException(ex);
} else {
exCol = new ExceptionCollection("Unable to write the dependency-check report", ex);
}
}
}
showSummary(getProject(), engine.getDependencies());
checkForFailure(engine.getDependencies());
if (exCol != null && this.isFailOnError()) {
throw new MojoExecutionException("One or more exceptions occurred during dependency-check analysis", exCol);
}
}
engine.cleanup();
}
Settings.cleanup();
} | void function() throws MojoExecutionException, MojoFailureException { Engine engine = null; try { engine = initializeEngine(); } catch (DatabaseException ex) { if (getLog().isDebugEnabled()) { getLog().debug(STR, ex); } final String msg = STR; if (this.isFailOnError()) { throw new MojoExecutionException(msg, ex); } getLog().error(msg); } if (engine != null) { ExceptionCollection exCol = scanArtifacts(getProject(), engine); if (engine.getDependencies().isEmpty()) { getLog().info(STR); } try { engine.analyzeDependencies(); } catch (ExceptionCollection ex) { if (this.isFailOnError() && ex.isFatal()) { throw new MojoExecutionException(STR, ex); } exCol = ex; } if (exCol == null !exCol.isFatal()) { try { final MavenProject p = this.getProject(); engine.writeReports(p.getName(), p.getGroupId(), p.getArtifactId(), p.getVersion(), getCorrectOutputDirectory(), getFormat()); } catch (ReportException ex) { if (this.isFailOnError()) { if (exCol != null) { exCol.addException(ex); } else { exCol = new ExceptionCollection(STR, ex); } } } showSummary(getProject(), engine.getDependencies()); checkForFailure(engine.getDependencies()); if (exCol != null && this.isFailOnError()) { throw new MojoExecutionException(STR, exCol); } } engine.cleanup(); } Settings.cleanup(); } | /**
* Executes the dependency-check engine on the project's dependencies and
* generates the report.
*
* @throws MojoExecutionException thrown if there is an exception executing
* the goal
* @throws MojoFailureException thrown if dependency-check is configured to
* fail the build
*/ | Executes the dependency-check engine on the project's dependencies and generates the report | runCheck | {
"repo_name": "colezlaw/DependencyCheck",
"path": "dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/CheckMojo.java",
"license": "apache-2.0",
"size": 6057
} | [
"org.apache.maven.plugin.MojoExecutionException",
"org.apache.maven.plugin.MojoFailureException",
"org.apache.maven.project.MavenProject",
"org.owasp.dependencycheck.Engine",
"org.owasp.dependencycheck.data.nvdcve.DatabaseException",
"org.owasp.dependencycheck.exception.ExceptionCollection",
"org.owasp.dependencycheck.exception.ReportException",
"org.owasp.dependencycheck.utils.Settings"
] | import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.data.nvdcve.DatabaseException; import org.owasp.dependencycheck.exception.ExceptionCollection; import org.owasp.dependencycheck.exception.ReportException; import org.owasp.dependencycheck.utils.Settings; | import org.apache.maven.plugin.*; import org.apache.maven.project.*; import org.owasp.dependencycheck.*; import org.owasp.dependencycheck.data.nvdcve.*; import org.owasp.dependencycheck.exception.*; import org.owasp.dependencycheck.utils.*; | [
"org.apache.maven",
"org.owasp.dependencycheck"
] | org.apache.maven; org.owasp.dependencycheck; | 1,229,829 |
public static String nameHash(X509Name subjectDN) {
try {
return hash(encodePrincipal(subjectDN));
} catch (Exception e) {
logger.error("", e);
return null;
}
} | static String function(X509Name subjectDN) { try { return hash(encodePrincipal(subjectDN)); } catch (Exception e) { logger.error("", e); return null; } } | /**
* Returns equivalent of: openssl x509 -in "cert-file" -hash -noout
*
* @param subjectDN
* @return hash for certificate names
*/ | Returns equivalent of: openssl x509 -in "cert-file" -hash -noout | nameHash | {
"repo_name": "romainreuillon/JGlobus",
"path": "ssl-proxies/src/main/java/org/globus/gsi/util/CertificateIOUtil.java",
"license": "apache-2.0",
"size": 5834
} | [
"org.bouncycastle.asn1.x509.X509Name"
] | import org.bouncycastle.asn1.x509.X509Name; | import org.bouncycastle.asn1.x509.*; | [
"org.bouncycastle.asn1"
] | org.bouncycastle.asn1; | 1,156,591 |
return new PreparedBinder();
}
public static class PreparedGetExecutor {
private final BoundStatement bound;
private final CassandraFactory factory;
private final CQuery cQuery;
private final Function<Row, ValueTuple> converter;
public PreparedGetExecutor(final CassandraFactory factory,
final BoundStatement bound,
final CQuery cQuery,
final TableScheme scheme) {
this.bound = bound;
this.factory = factory;
this.cQuery = cQuery;
// FIXME: validate column by scheme!
this.converter = input -> {
final Map<String, Value<?>> keyColumns = new HashMap<>();
for (final CColumn<?, ?> column : cQuery.getExpectedColumnsCollection()) {
keyColumns.put(column.getName(), column.getValue(input));
}
return new ValueTuple(keyColumns);
};
}
/**
* Get one row. <br>
* Similar to {@link org.nohope.cassandra.mapservice.CMapSync#getOne(CQuery, com.datastax.driver.core.ConsistencyLevel)}
*
* @return {@link org.nohope.cassandra.mapservice.ValueTuple valueTuple} | return new PreparedBinder(); } public static class PreparedGetExecutor { private final BoundStatement bound; private final CassandraFactory factory; private final CQuery cQuery; private final Function<Row, ValueTuple> converter; public PreparedGetExecutor(final CassandraFactory factory, final BoundStatement bound, final CQuery cQuery, final TableScheme scheme) { this.bound = bound; this.factory = factory; this.cQuery = cQuery; this.converter = input -> { final Map<String, Value<?>> keyColumns = new HashMap<>(); for (final CColumn<?, ?> column : cQuery.getExpectedColumnsCollection()) { keyColumns.put(column.getName(), column.getValue(input)); } return new ValueTuple(keyColumns); }; } /** * Get one row. <br> * Similar to {@link org.nohope.cassandra.mapservice.CMapSync#getOne(CQuery, com.datastax.driver.core.ConsistencyLevel)} * * @return {@link org.nohope.cassandra.mapservice.ValueTuple valueTuple} | /**
* Bind new values to pattern.
*
* @return the prepared binder
*/ | Bind new values to pattern | bind | {
"repo_name": "no-hope/java-toolkit",
"path": "projects/cassandra-map-service/src/main/java/org/nohope/cassandra/mapservice/CPreparedGet.java",
"license": "apache-2.0",
"size": 4139
} | [
"com.datastax.driver.core.BoundStatement",
"com.datastax.driver.core.Row",
"com.google.common.base.Function",
"java.util.HashMap",
"java.util.Map",
"org.nohope.cassandra.factory.CassandraFactory",
"org.nohope.cassandra.mapservice.columns.CColumn"
] | import com.datastax.driver.core.BoundStatement; import com.datastax.driver.core.Row; import com.google.common.base.Function; import java.util.HashMap; import java.util.Map; import org.nohope.cassandra.factory.CassandraFactory; import org.nohope.cassandra.mapservice.columns.CColumn; | import com.datastax.driver.core.*; import com.google.common.base.*; import java.util.*; import org.nohope.cassandra.factory.*; import org.nohope.cassandra.mapservice.columns.*; | [
"com.datastax.driver",
"com.google.common",
"java.util",
"org.nohope.cassandra"
] | com.datastax.driver; com.google.common; java.util; org.nohope.cassandra; | 2,143,804 |
@Transient @Deprecated
public Boolean getMedwatchPDFType() {
return getReportFormat(ReportFormatType.MEDWATCHPDF) != null;
}
| @Transient Boolean function() { return getReportFormat(ReportFormatType.MEDWATCHPDF) != null; } | /**
* Gets the medwatch pdf type.
*
* @return the medwatch pdf type
*/ | Gets the medwatch pdf type | getMedwatchPDFType | {
"repo_name": "CBIIT/caaers",
"path": "caAERS/software/core/src/main/java/gov/nih/nci/cabig/caaers/domain/Study.java",
"license": "bsd-3-clause",
"size": 80505
} | [
"javax.persistence.Transient"
] | import javax.persistence.Transient; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 832,129 |
public static String customDirectoryLogFileName(@Nullable String dir, String fileName) {
assert fileName != null;
if (dir == null)
return fileName;
int sep = fileName.lastIndexOf(File.separator);
return dir + (sep < 0 ? File.separator + fileName : fileName.substring(sep));
} | static String function(@Nullable String dir, String fileName) { assert fileName != null; if (dir == null) return fileName; int sep = fileName.lastIndexOf(File.separator); return dir + (sep < 0 ? File.separator + fileName : fileName.substring(sep)); } | /**
* Substitutes log directory with a custom one.
*
* @param dir Directory.
* @param fileName Original path.
* @return New path.
*/ | Substitutes log directory with a custom one | customDirectoryLogFileName | {
"repo_name": "mcherkasov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 316648
} | [
"java.io.File",
"org.jetbrains.annotations.Nullable"
] | import java.io.File; import org.jetbrains.annotations.Nullable; | import java.io.*; import org.jetbrains.annotations.*; | [
"java.io",
"org.jetbrains.annotations"
] | java.io; org.jetbrains.annotations; | 2,321,828 |
TreeNode<Resource> getResultTree(); | TreeNode<Resource> getResultTree(); | /**
* Obtain the results of the request invocation as a Tree structure.
*
* @return the results of the request as a Tree structure
*/ | Obtain the results of the request invocation as a Tree structure | getResultTree | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/api/services/Result.java",
"license": "apache-2.0",
"size": 1683
} | [
"org.apache.ambari.server.api.util.TreeNode",
"org.apache.ambari.server.controller.spi.Resource"
] | import org.apache.ambari.server.api.util.TreeNode; import org.apache.ambari.server.controller.spi.Resource; | import org.apache.ambari.server.api.util.*; import org.apache.ambari.server.controller.spi.*; | [
"org.apache.ambari"
] | org.apache.ambari; | 68,532 |
public int hashCode() {
int result = 193;
long temp = Double.doubleToLongBits(this.angle);
result = 37 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(this.tipRadius);
result = 37 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(this.baseRadius);
result = 37 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(this.arrowLength);
result = 37 * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(this.arrowWidth);
result = 37 * result + (int) (temp ^ (temp >>> 32));
result = 37 * result + HashUtilities.hashCodeForPaint(this.arrowPaint);
result = 37 * result + this.arrowStroke.hashCode();
temp = Double.doubleToLongBits(this.labelOffset);
result = 37 * result + (int) (temp ^ (temp >>> 32));
return result;
} | int function() { int result = 193; long temp = Double.doubleToLongBits(this.angle); result = 37 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(this.tipRadius); result = 37 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(this.baseRadius); result = 37 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(this.arrowLength); result = 37 * result + (int) (temp ^ (temp >>> 32)); temp = Double.doubleToLongBits(this.arrowWidth); result = 37 * result + (int) (temp ^ (temp >>> 32)); result = 37 * result + HashUtilities.hashCodeForPaint(this.arrowPaint); result = 37 * result + this.arrowStroke.hashCode(); temp = Double.doubleToLongBits(this.labelOffset); result = 37 * result + (int) (temp ^ (temp >>> 32)); return result; } | /**
* Returns a hash code for this instance.
*
* @return A hash code.
*/ | Returns a hash code for this instance | hashCode | {
"repo_name": "JSansalone/JFreeChart",
"path": "source/org/jfree/chart/annotations/CategoryPointerAnnotation.java",
"license": "lgpl-2.1",
"size": 17232
} | [
"org.jfree.chart.HashUtilities"
] | import org.jfree.chart.HashUtilities; | import org.jfree.chart.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,456,414 |
public void hasColumnFamilyAccess(String columnFamily, Permission perm)
throws InvalidRequestException {
validateLogin();
validateKeyspace();
resourceClear();
resource.add(keyspace);
resource.add(columnFamily);
Set<Permission> perms = DatabaseDescriptor.getAuthority().authorize(
user, resource);
hasAccess(user, perms, perm, resource);
} | void function(String columnFamily, Permission perm) throws InvalidRequestException { validateLogin(); validateKeyspace(); resourceClear(); resource.add(keyspace); resource.add(columnFamily); Set<Permission> perms = DatabaseDescriptor.getAuthority().authorize( user, resource); hasAccess(user, perms, perm, resource); } | /**
* Confirms that the client thread has the given Permission in the context of the given
* ColumnFamily and the current keyspace.
*/ | Confirms that the client thread has the given Permission in the context of the given ColumnFamily and the current keyspace | hasColumnFamilyAccess | {
"repo_name": "devdattakulkarni/Cassandra-KVAC",
"path": "src/java/org/apache/cassandra/service/ClientState.java",
"license": "apache-2.0",
"size": 7311
} | [
"java.util.Set",
"org.apache.cassandra.auth.Permission",
"org.apache.cassandra.config.DatabaseDescriptor",
"org.apache.cassandra.thrift.InvalidRequestException"
] | import java.util.Set; import org.apache.cassandra.auth.Permission; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.thrift.InvalidRequestException; | import java.util.*; import org.apache.cassandra.auth.*; import org.apache.cassandra.config.*; import org.apache.cassandra.thrift.*; | [
"java.util",
"org.apache.cassandra"
] | java.util; org.apache.cassandra; | 1,501,117 |
public static synchronized String getLogoImage() {
Element globalLogoImage = (Element)generatedModel.selectSingleNode(
"//adminconsole/global/logo-image");
if (globalLogoImage != null) {
String pluginName = globalLogoImage.attributeValue("plugin");
return getAdminText(globalLogoImage.getText(), pluginName);
}
else {
return null;
}
} | static synchronized String function() { Element globalLogoImage = (Element)generatedModel.selectSingleNode( STRplugin"); return getAdminText(globalLogoImage.getText(), pluginName); } else { return null; } } | /**
* Returns the URL of the main logo image for the admin console.
*
* @return the logo image.
*/ | Returns the URL of the main logo image for the admin console | getLogoImage | {
"repo_name": "coodeer/g3server",
"path": "src/java/org/jivesoftware/admin/AdminConsole.java",
"license": "apache-2.0",
"size": 21207
} | [
"org.dom4j.Element"
] | import org.dom4j.Element; | import org.dom4j.*; | [
"org.dom4j"
] | org.dom4j; | 363,719 |
protected void load(ApplicationContext context, Object[] sources) {
if (logger.isDebugEnabled()) {
logger.debug(
"Loading source " + StringUtils.arrayToCommaDelimitedString(sources));
}
BeanDefinitionLoader loader = createBeanDefinitionLoader(
getBeanDefinitionRegistry(context), sources);
if (this.beanNameGenerator != null) {
loader.setBeanNameGenerator(this.beanNameGenerator);
}
if (this.resourceLoader != null) {
loader.setResourceLoader(this.resourceLoader);
}
if (this.environment != null) {
loader.setEnvironment(this.environment);
}
loader.load();
} | void function(ApplicationContext context, Object[] sources) { if (logger.isDebugEnabled()) { logger.debug( STR + StringUtils.arrayToCommaDelimitedString(sources)); } BeanDefinitionLoader loader = createBeanDefinitionLoader( getBeanDefinitionRegistry(context), sources); if (this.beanNameGenerator != null) { loader.setBeanNameGenerator(this.beanNameGenerator); } if (this.resourceLoader != null) { loader.setResourceLoader(this.resourceLoader); } if (this.environment != null) { loader.setEnvironment(this.environment); } loader.load(); } | /**
* Load beans into the application context.
* @param context the context to load beans into
* @param sources the sources to load
*/ | Load beans into the application context | load | {
"repo_name": "bijukunjummen/spring-boot",
"path": "spring-boot/src/main/java/org/springframework/boot/SpringApplication.java",
"license": "apache-2.0",
"size": 44386
} | [
"org.springframework.context.ApplicationContext",
"org.springframework.util.StringUtils"
] | import org.springframework.context.ApplicationContext; import org.springframework.util.StringUtils; | import org.springframework.context.*; import org.springframework.util.*; | [
"org.springframework.context",
"org.springframework.util"
] | org.springframework.context; org.springframework.util; | 1,991,287 |
public byte[] readRawBytes(final int size) throws IOException {
if (size < 0) {
throw InvalidProtocolBufferMicroException.negativeSize();
}
if (totalBytesRetired + bufferPos + size > currentLimit) {
// Read to the end of the stream anyway.
skipRawBytes(currentLimit - totalBytesRetired - bufferPos);
// Then fail.
throw InvalidProtocolBufferMicroException.truncatedMessage();
}
if (size <= bufferSize - bufferPos) {
// We have all the bytes we need already.
final byte[] bytes = new byte[size];
System.arraycopy(buffer, bufferPos, bytes, 0, size);
bufferPos += size;
return bytes;
} else if (size < BUFFER_SIZE) {
// Reading more bytes than are in the buffer, but not an excessive number
// of bytes. We can safely allocate the resulting array ahead of time.
// First copy what we have.
final byte[] bytes = new byte[size];
int pos = bufferSize - bufferPos;
System.arraycopy(buffer, bufferPos, bytes, 0, pos);
bufferPos = bufferSize;
// We want to use refillBuffer() and then copy from the buffer into our
// byte array rather than reading directly into our byte array because
// the input may be unbuffered.
refillBuffer(true);
while (size - pos > bufferSize) {
System.arraycopy(buffer, 0, bytes, pos, bufferSize);
pos += bufferSize;
bufferPos = bufferSize;
refillBuffer(true);
}
System.arraycopy(buffer, 0, bytes, pos, size - pos);
bufferPos = size - pos;
return bytes;
} else {
// The size is very large. For security reasons, we can't allocate the
// entire byte array yet. The size comes directly from the input, so a
// maliciously-crafted message could provide a bogus very large size in
// order to trick the app into allocating a lot of memory. We avoid this
// by allocating and reading only a small chunk at a time, so that the
// malicious message must actually *be* extremely large to cause
// problems. Meanwhile, we limit the allowed size of a message elsewhere.
// Remember the buffer markers since we'll have to copy the bytes out of
// it later.
final int originalBufferPos = bufferPos;
final int originalBufferSize = bufferSize;
// Mark the current buffer consumed.
totalBytesRetired += bufferSize;
bufferPos = 0;
bufferSize = 0;
// Read all the rest of the bytes we need.
int sizeLeft = size - (originalBufferSize - originalBufferPos);
// For compatibility with Java 1.3 use Vector
final java.util.Vector chunks = new java.util.Vector();
while (sizeLeft > 0) {
final byte[] chunk = new byte[Math.min(sizeLeft, BUFFER_SIZE)];
int pos = 0;
while (pos < chunk.length) {
final int n = (input == null) ? -1 :
input.read(chunk, pos, chunk.length - pos);
if (n == -1) {
throw InvalidProtocolBufferMicroException.truncatedMessage();
}
totalBytesRetired += n;
pos += n;
}
sizeLeft -= chunk.length;
chunks.addElement(chunk);
}
// OK, got everything. Now concatenate it all into one buffer.
final byte[] bytes = new byte[size];
// Start by copying the leftover bytes from this.buffer.
int pos = originalBufferSize - originalBufferPos;
System.arraycopy(buffer, originalBufferPos, bytes, 0, pos);
// And now all the chunks.
for (int i = 0; i < chunks.size(); i++) {
byte [] chunk = (byte [])chunks.elementAt(i);
System.arraycopy(chunk, 0, bytes, pos, chunk.length);
pos += chunk.length;
}
// Done.
return bytes;
}
} | byte[] function(final int size) throws IOException { if (size < 0) { throw InvalidProtocolBufferMicroException.negativeSize(); } if (totalBytesRetired + bufferPos + size > currentLimit) { skipRawBytes(currentLimit - totalBytesRetired - bufferPos); throw InvalidProtocolBufferMicroException.truncatedMessage(); } if (size <= bufferSize - bufferPos) { final byte[] bytes = new byte[size]; System.arraycopy(buffer, bufferPos, bytes, 0, size); bufferPos += size; return bytes; } else if (size < BUFFER_SIZE) { final byte[] bytes = new byte[size]; int pos = bufferSize - bufferPos; System.arraycopy(buffer, bufferPos, bytes, 0, pos); bufferPos = bufferSize; refillBuffer(true); while (size - pos > bufferSize) { System.arraycopy(buffer, 0, bytes, pos, bufferSize); pos += bufferSize; bufferPos = bufferSize; refillBuffer(true); } System.arraycopy(buffer, 0, bytes, pos, size - pos); bufferPos = size - pos; return bytes; } else { final int originalBufferPos = bufferPos; final int originalBufferSize = bufferSize; totalBytesRetired += bufferSize; bufferPos = 0; bufferSize = 0; int sizeLeft = size - (originalBufferSize - originalBufferPos); final java.util.Vector chunks = new java.util.Vector(); while (sizeLeft > 0) { final byte[] chunk = new byte[Math.min(sizeLeft, BUFFER_SIZE)]; int pos = 0; while (pos < chunk.length) { final int n = (input == null) ? -1 : input.read(chunk, pos, chunk.length - pos); if (n == -1) { throw InvalidProtocolBufferMicroException.truncatedMessage(); } totalBytesRetired += n; pos += n; } sizeLeft -= chunk.length; chunks.addElement(chunk); } final byte[] bytes = new byte[size]; int pos = originalBufferSize - originalBufferPos; System.arraycopy(buffer, originalBufferPos, bytes, 0, pos); for (int i = 0; i < chunks.size(); i++) { byte [] chunk = (byte [])chunks.elementAt(i); System.arraycopy(chunk, 0, bytes, pos, chunk.length); pos += chunk.length; } return bytes; } } | /**
* Read a fixed size of bytes from the input.
*
* @throws InvalidProtocolBufferMicroException The end of the stream or the current
* limit was reached.
*/ | Read a fixed size of bytes from the input | readRawBytes | {
"repo_name": "FreezeOrange/ProtobufJavaMicro",
"path": "protobuf_project/protobuf/java/src/main/java/com/google/protobuf/micro/CodedInputStreamMicro.java",
"license": "apache-2.0",
"size": 27119
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 5,172 |
public boolean exists(GetRequest getRequest, Header... headers) throws IOException {
return performRequest(getRequest, Request::exists, RestHighLevelClient::convertExistsResponse, emptySet(), headers);
} | boolean function(GetRequest getRequest, Header... headers) throws IOException { return performRequest(getRequest, Request::exists, RestHighLevelClient::convertExistsResponse, emptySet(), headers); } | /**
* Checks for the existence of a document. Returns true if it exists, false otherwise
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
*/ | Checks for the existence of a document. Returns true if it exists, false otherwise See Get API on elastic.co | exists | {
"repo_name": "nezirus/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java",
"license": "apache-2.0",
"size": 35540
} | [
"java.io.IOException",
"java.util.Collections",
"org.apache.http.Header",
"org.elasticsearch.action.get.GetRequest"
] | import java.io.IOException; import java.util.Collections; import org.apache.http.Header; import org.elasticsearch.action.get.GetRequest; | import java.io.*; import java.util.*; import org.apache.http.*; import org.elasticsearch.action.get.*; | [
"java.io",
"java.util",
"org.apache.http",
"org.elasticsearch.action"
] | java.io; java.util; org.apache.http; org.elasticsearch.action; | 1,557,379 |
private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
String tmpRelationId, tmpRelationTypeName, tmpRoleName;
ObjectName tmpRelationObjName;
List<ObjectName> tmpNewRoleValue, tmpOldRoleValue, tmpUnregMBeanList;
ObjectInputStream.GetField fields = in.readFields();
if (compat) {
tmpRelationId = (String)fields.get("myRelId", null);
tmpRelationTypeName = (String)fields.get("myRelTypeName", null);
tmpRoleName = (String)fields.get("myRoleName", null);
tmpRelationObjName = (ObjectName)fields.get("myRelObjName", null);
tmpNewRoleValue = cast(fields.get("myNewRoleValue", null));
tmpOldRoleValue = cast(fields.get("myOldRoleValue", null));
tmpUnregMBeanList = cast(fields.get("myUnregMBeanList", null));
}
else {
tmpRelationId = (String)fields.get("relationId", null);
tmpRelationTypeName = (String)fields.get("relationTypeName", null);
tmpRoleName = (String)fields.get("roleName", null);
tmpRelationObjName = (ObjectName)fields.get("relationObjName", null);
tmpNewRoleValue = cast(fields.get("newRoleValue", null));
tmpOldRoleValue = cast(fields.get("oldRoleValue", null));
tmpUnregMBeanList = cast(fields.get("unregisterMBeanList", null));
}
// Validate fields we just read, throw InvalidObjectException
// if something goes wrong
String notifType = super.getType();
if (!isValidBasic(notifType,super.getSource(),tmpRelationId,tmpRelationTypeName) ||
(!isValidCreate(notifType) &&
!isValidUpdate(notifType,tmpRoleName,tmpNewRoleValue,tmpOldRoleValue))) {
super.setSource(null);
throw new InvalidObjectException("Invalid object read");
}
// assign deserialized vaules to object fields
relationObjName = safeGetObjectName(tmpRelationObjName);
newRoleValue = safeGetObjectNameList(tmpNewRoleValue);
oldRoleValue = safeGetObjectNameList(tmpOldRoleValue);
unregisterMBeanList = safeGetObjectNameList(tmpUnregMBeanList);
relationId = tmpRelationId;
relationTypeName = tmpRelationTypeName;
roleName = tmpRoleName;
} | void function(ObjectInputStream in) throws IOException, ClassNotFoundException { String tmpRelationId, tmpRelationTypeName, tmpRoleName; ObjectName tmpRelationObjName; List<ObjectName> tmpNewRoleValue, tmpOldRoleValue, tmpUnregMBeanList; ObjectInputStream.GetField fields = in.readFields(); if (compat) { tmpRelationId = (String)fields.get(STR, null); tmpRelationTypeName = (String)fields.get(STR, null); tmpRoleName = (String)fields.get(STR, null); tmpRelationObjName = (ObjectName)fields.get(STR, null); tmpNewRoleValue = cast(fields.get(STR, null)); tmpOldRoleValue = cast(fields.get(STR, null)); tmpUnregMBeanList = cast(fields.get(STR, null)); } else { tmpRelationId = (String)fields.get(STR, null); tmpRelationTypeName = (String)fields.get(STR, null); tmpRoleName = (String)fields.get(STR, null); tmpRelationObjName = (ObjectName)fields.get(STR, null); tmpNewRoleValue = cast(fields.get(STR, null)); tmpOldRoleValue = cast(fields.get(STR, null)); tmpUnregMBeanList = cast(fields.get(STR, null)); } String notifType = super.getType(); if (!isValidBasic(notifType,super.getSource(),tmpRelationId,tmpRelationTypeName) (!isValidCreate(notifType) && !isValidUpdate(notifType,tmpRoleName,tmpNewRoleValue,tmpOldRoleValue))) { super.setSource(null); throw new InvalidObjectException(STR); } relationObjName = safeGetObjectName(tmpRelationObjName); newRoleValue = safeGetObjectNameList(tmpNewRoleValue); oldRoleValue = safeGetObjectNameList(tmpOldRoleValue); unregisterMBeanList = safeGetObjectNameList(tmpUnregMBeanList); relationId = tmpRelationId; relationTypeName = tmpRelationTypeName; roleName = tmpRoleName; } | /**
* Deserializes a {@link RelationNotification} from an {@link ObjectInputStream}.
*/ | Deserializes a <code>RelationNotification</code> from an <code>ObjectInputStream</code> | readObject | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/javax/management/relation/RelationNotification.java",
"license": "apache-2.0",
"size": 22152
} | [
"com.sun.jmx.mbeanserver.Util",
"java.io.IOException",
"java.io.InvalidObjectException",
"java.io.ObjectInputStream",
"java.util.List",
"javax.management.ObjectName"
] | import com.sun.jmx.mbeanserver.Util; import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.util.List; import javax.management.ObjectName; | import com.sun.jmx.mbeanserver.*; import java.io.*; import java.util.*; import javax.management.*; | [
"com.sun.jmx",
"java.io",
"java.util",
"javax.management"
] | com.sun.jmx; java.io; java.util; javax.management; | 1,710,256 |
public void
addIIOWriteProgressListener(IIOWriteProgressListener listener) {
if (listener == null) {
return;
}
progressListeners = ImageReader.addToList(progressListeners, listener);
} | void function(IIOWriteProgressListener listener) { if (listener == null) { return; } progressListeners = ImageReader.addToList(progressListeners, listener); } | /**
* Adds an {@code IIOWriteProgressListener} to the list of
* registered progress listeners. If {@code listener} is
* {@code null}, no exception will be thrown and no action
* will be taken.
*
* @param listener an {@code IIOWriteProgressListener} to be
* registered.
*
* @see #removeIIOWriteProgressListener
*/ | Adds an IIOWriteProgressListener to the list of registered progress listeners. If listener is null, no exception will be thrown and no action will be taken | addIIOWriteProgressListener | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.desktop/share/classes/javax/imageio/ImageWriter.java",
"license": "gpl-2.0",
"size": 79746
} | [
"javax.imageio.event.IIOWriteProgressListener"
] | import javax.imageio.event.IIOWriteProgressListener; | import javax.imageio.event.*; | [
"javax.imageio"
] | javax.imageio; | 2,100,997 |
protected void addTextEdit(Expression expression, int extraOffset, String oldValue, String newValue) {
TextEdit textEdit = buildTextEdit(
reposition(expression.getOffset() + extraOffset),
oldValue,
newValue
);
textEdits.add(textEdit);
} | void function(Expression expression, int extraOffset, String oldValue, String newValue) { TextEdit textEdit = buildTextEdit( reposition(expression.getOffset() + extraOffset), oldValue, newValue ); textEdits.add(textEdit); } | /**
* Adds a new {@link TextEdit} with the given information.
*
* @param expression The {@link Expression} which should be refactored, it will be used to
* retrieve the offset of the change
* @param extraOffset Additional offset that will be added to the given {@link Expression}'s
* offset, which is the length of the string representation of what is before it
* @param oldValue The old value to change to the new one
* @param newValue The new value
*/ | Adds a new <code>TextEdit</code> with the given information | addTextEdit | {
"repo_name": "gameduell/eclipselink.runtime",
"path": "jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/tools/BasicRefactoringTool.java",
"license": "epl-1.0",
"size": 36866
} | [
"org.eclipse.persistence.jpa.jpql.parser.Expression"
] | import org.eclipse.persistence.jpa.jpql.parser.Expression; | import org.eclipse.persistence.jpa.jpql.parser.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 1,227,458 |
public void invokeMethod(String method, @Nullable Object arguments, Result callback) {
messenger.send(name, codec.encodeMethodCall(new MethodCall(method, arguments)),
callback == null ? null : new IncomingResultHandler(callback));
} | void function(String method, @Nullable Object arguments, Result callback) { messenger.send(name, codec.encodeMethodCall(new MethodCall(method, arguments)), callback == null ? null : new IncomingResultHandler(callback)); } | /**
* Invokes a method on this channel, optionally expecting a result.
*
* <p>Any uncaught exception thrown by the result callback will be caught and logged.</p>
*
* @param method the name String of the method.
* @param arguments the arguments for the invocation, possibly null.
* @param callback a {@link Result} callback for the invocation result, or null.
*/ | Invokes a method on this channel, optionally expecting a result. Any uncaught exception thrown by the result callback will be caught and logged | invokeMethod | {
"repo_name": "krisgiesing/sky_engine",
"path": "shell/platform/android/io/flutter/plugin/common/MethodChannel.java",
"license": "bsd-3-clause",
"size": 9058
} | [
"android.support.annotation.Nullable"
] | import android.support.annotation.Nullable; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 1,865,532 |
public ImmutableList<String> getCopts() {
if (variables.isAvailable(CppModel.USER_COMPILE_FLAGS_VARIABLE_NAME)) {
return Variables.toStringList(variables, CppModel.USER_COMPILE_FLAGS_VARIABLE_NAME);
} else {
return ImmutableList.of();
}
} | ImmutableList<String> function() { if (variables.isAvailable(CppModel.USER_COMPILE_FLAGS_VARIABLE_NAME)) { return Variables.toStringList(variables, CppModel.USER_COMPILE_FLAGS_VARIABLE_NAME); } else { return ImmutableList.of(); } } | /**
* Returns all user provided copts flags.
*
* TODO(b/64108724): Get rid of this method when we don't need to parse copts to collect include
* directories anymore (meaning there is a way of specifying include directories using an
* explicit attribute, not using platform-dependent garbage bag that copts is).
*/ | Returns all user provided copts flags. TODO(b/64108724): Get rid of this method when we don't need to parse copts to collect include directories anymore (meaning there is a way of specifying include directories using an explicit attribute, not using platform-dependent garbage bag that copts is) | getCopts | {
"repo_name": "spxtr/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLine.java",
"license": "apache-2.0",
"size": 8935
} | [
"com.google.common.collect.ImmutableList",
"com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures"
] | import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures; | import com.google.common.collect.*; import com.google.devtools.build.lib.rules.cpp.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 2,190,073 |
public int getMaxSupportedInstances() {
return (Util.SDK_INT < 23 || capabilities == null)
? MAX_SUPPORTED_INSTANCES_UNKNOWN
: getMaxSupportedInstancesV23(capabilities);
} | int function() { return (Util.SDK_INT < 23 capabilities == null) ? MAX_SUPPORTED_INSTANCES_UNKNOWN : getMaxSupportedInstancesV23(capabilities); } | /**
* Returns an upper bound on the maximum number of supported instances, or {@link
* #MAX_SUPPORTED_INSTANCES_UNKNOWN} if unknown. Applications should not expect to operate more
* instances than the returned maximum.
*
* @see CodecCapabilities#getMaxSupportedInstances()
*/ | Returns an upper bound on the maximum number of supported instances, or <code>#MAX_SUPPORTED_INSTANCES_UNKNOWN</code> if unknown. Applications should not expect to operate more instances than the returned maximum | getMaxSupportedInstances | {
"repo_name": "ebr11/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java",
"license": "apache-2.0",
"size": 15261
} | [
"com.google.android.exoplayer2.util.Util"
] | import com.google.android.exoplayer2.util.Util; | import com.google.android.exoplayer2.util.*; | [
"com.google.android"
] | com.google.android; | 2,098,152 |
public static void decodeBase64ToStream(final String inString, final OutputStream out) throws IOException {
Base64InputStream in = null;
try {
in = new Base64InputStream(new ByteArrayInputStream(inString.getBytes(TextUtils.CHARSET_ASCII)), Base64.DEFAULT);
IOUtils.copy(in, out);
} finally {
IOUtils.closeQuietly(in);
}
} | static void function(final String inString, final OutputStream out) throws IOException { Base64InputStream in = null; try { in = new Base64InputStream(new ByteArrayInputStream(inString.getBytes(TextUtils.CHARSET_ASCII)), Base64.DEFAULT); IOUtils.copy(in, out); } finally { IOUtils.closeQuietly(in); } } | /**
* Decode a base64-encoded string and save the result into a stream.
*
* @param inString
* the encoded string
* @param out
* the stream to save the decoded result into
*/ | Decode a base64-encoded string and save the result into a stream | decodeBase64ToStream | {
"repo_name": "SammysHP/cgeo",
"path": "main/src/cgeo/geocaching/utils/ImageUtils.java",
"license": "apache-2.0",
"size": 19511
} | [
"android.util.Base64",
"android.util.Base64InputStream",
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.io.OutputStream",
"org.apache.commons.io.IOUtils"
] | import android.util.Base64; import android.util.Base64InputStream; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.io.IOUtils; | import android.util.*; import java.io.*; import org.apache.commons.io.*; | [
"android.util",
"java.io",
"org.apache.commons"
] | android.util; java.io; org.apache.commons; | 2,065,323 |
public double anovaFValue(Collection<double[]> categoryData)
throws IllegalArgumentException, MathException {
AnovaStats a = anovaStats(categoryData);
return a.F;
} | double function(Collection<double[]> categoryData) throws IllegalArgumentException, MathException { AnovaStats a = anovaStats(categoryData); return a.F; } | /**
* {@inheritDoc}<p>
* This implementation computes the F statistic using the definitional
* formula<pre>
* F = msbg/mswg</pre>
* where<pre>
* msbg = between group mean square
* mswg = within group mean square</pre>
* are as defined <a href="http://faculty.vassar.edu/lowry/ch13pt1.html">
* here</a></p>
*/ | This implementation computes the F statistic using the definitional formula<code> F = msbg/mswg</code> where<code> msbg = between group mean square mswg = within group mean square</code> are as defined here | anovaFValue | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_76/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java",
"license": "gpl-2.0",
"size": 7413
} | [
"java.util.Collection",
"org.apache.commons.math.MathException"
] | import java.util.Collection; import org.apache.commons.math.MathException; | import java.util.*; import org.apache.commons.math.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 2,047,362 |
public CheckBox createEnableMaintenanceWindowToggle(final Binder<ProxyAssignmentWindow> binder) {
final CheckBox maintenanceWindowToggle = FormComponentBuilder.createCheckBox(
i18n.getMessage("caption.maintenancewindow.enabled"),
UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID, binder,
ProxyAssignmentWindow::isMaintenanceWindowEnabled, ProxyAssignmentWindow::setMaintenanceWindowEnabled);
maintenanceWindowToggle.addStyleName(ValoTheme.CHECKBOX_SMALL);
maintenanceWindowToggle.addStyleName("dist-window-maintenance-window-enable");
return maintenanceWindowToggle;
} | CheckBox function(final Binder<ProxyAssignmentWindow> binder) { final CheckBox maintenanceWindowToggle = FormComponentBuilder.createCheckBox( i18n.getMessage(STR), UIComponentIdProvider.MAINTENANCE_WINDOW_ENABLED_ID, binder, ProxyAssignmentWindow::isMaintenanceWindowEnabled, ProxyAssignmentWindow::setMaintenanceWindowEnabled); maintenanceWindowToggle.addStyleName(ValoTheme.CHECKBOX_SMALL); maintenanceWindowToggle.addStyleName(STR); return maintenanceWindowToggle; } | /**
* Create toggle for maintenance window
*
* @param binder
* Proxy assignment window binder
*
* @return Maintenance window checkbox
*/ | Create toggle for maintenance window | createEnableMaintenanceWindowToggle | {
"repo_name": "eclipse/hawkbit",
"path": "hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/miscs/AssignmentWindowLayoutComponentBuilder.java",
"license": "epl-1.0",
"size": 9296
} | [
"com.vaadin.data.Binder",
"com.vaadin.ui.CheckBox",
"com.vaadin.ui.themes.ValoTheme",
"org.eclipse.hawkbit.ui.common.builder.FormComponentBuilder",
"org.eclipse.hawkbit.ui.common.data.proxies.ProxyAssignmentWindow",
"org.eclipse.hawkbit.ui.utils.UIComponentIdProvider"
] | import com.vaadin.data.Binder; import com.vaadin.ui.CheckBox; import com.vaadin.ui.themes.ValoTheme; import org.eclipse.hawkbit.ui.common.builder.FormComponentBuilder; import org.eclipse.hawkbit.ui.common.data.proxies.ProxyAssignmentWindow; import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider; | import com.vaadin.data.*; import com.vaadin.ui.*; import com.vaadin.ui.themes.*; import org.eclipse.hawkbit.ui.common.builder.*; import org.eclipse.hawkbit.ui.common.data.proxies.*; import org.eclipse.hawkbit.ui.utils.*; | [
"com.vaadin.data",
"com.vaadin.ui",
"org.eclipse.hawkbit"
] | com.vaadin.data; com.vaadin.ui; org.eclipse.hawkbit; | 2,837,164 |
End of preview. Expand
in Dataset Viewer.
Dataset Card for FudanSELab CodeGen4Libs Code Retrieval Library
Dataset Summary
This dataset is the code retrieval library used in the ASE2023 paper titled "CodeGen4Libs: A Two-stage Approach for Library-oriented Code Generation".
Additional Information
Citation Information
@inproceedings{ase2023codegen4libs,
author = {Mingwei Liu and Tianyong Yang and Yiling Lou and Xueying Du and Ying Wang and and Xin Peng},
title = {{CodeGen4Libs}: A Two-stage Approach for Library-oriented Code Generation},
booktitle = {38th {IEEE/ACM} International Conference on Automated Software Engineering,
{ASE} 2023, Kirchberg, Luxembourg, September 11-15, 2023},
pages = {0--0},
publisher = {{IEEE}},
year = {2023},
}
- Downloads last month
- 184