method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static void initializeContentModel(final Session session, final URL cndFile) throws RepositoryException {
LOG.info("Initializing JCR Model from File {}", cndFile.getPath());
Reader cndReader;
try {
cndReader = new InputStreamReader(cndFile.openStream(), StandardCharsets.UTF_8);
} catch (final IOException e) {
throw new InkstandRuntimeException("Could not read cndFile " + cndFile, e);
}
final Repository repository = session.getRepository();
final String user = session.getUserID();
final String name = repository.getDescriptor(Repository.REP_NAME_DESC);
LOG.info("Logged in as {} to a {} repository", user, name);
NodeType[] nodeTypes;
try {
nodeTypes = CndImporter.registerNodeTypes(cndReader, session, true);
if (LOG.isDebugEnabled()) {
logRegisteredNodeTypes(nodeTypes);
}
} catch (final ParseException | IOException e) {
throw new InkstandRuntimeException("Could not register node types", e);
}
} | static void function(final Session session, final URL cndFile) throws RepositoryException { LOG.info(STR, cndFile.getPath()); Reader cndReader; try { cndReader = new InputStreamReader(cndFile.openStream(), StandardCharsets.UTF_8); } catch (final IOException e) { throw new InkstandRuntimeException(STR + cndFile, e); } final Repository repository = session.getRepository(); final String user = session.getUserID(); final String name = repository.getDescriptor(Repository.REP_NAME_DESC); LOG.info(STR, user, name); NodeType[] nodeTypes; try { nodeTypes = CndImporter.registerNodeTypes(cndReader, session, true); if (LOG.isDebugEnabled()) { logRegisteredNodeTypes(nodeTypes); } } catch (final ParseException IOException e) { throw new InkstandRuntimeException(STR, e); } } | /**
* Loads the inque nodetype model to the session's repository
*
* @param session
* a session with a user with sufficient privileges
* @param cndFile
* the url to the file containing the node type definitions in CND syntax
* @throws RepositoryException
*/ | Loads the inque nodetype model to the session's repository | initializeContentModel | {
"repo_name": "rolandio/inkstand",
"path": "inkstand-jcr-jackrabbit/src/main/java/io/inkstand/jcr/provider/JackrabbitUtil.java",
"license": "apache-2.0",
"size": 5426
} | [
"io.inkstand.InkstandRuntimeException",
"java.io.IOException",
"java.io.InputStreamReader",
"java.io.Reader",
"java.nio.charset.StandardCharsets",
"javax.jcr.Repository",
"javax.jcr.RepositoryException",
"javax.jcr.Session",
"javax.jcr.nodetype.NodeType",
"org.apache.jackrabbit.commons.cnd.CndImpo... | import io.inkstand.InkstandRuntimeException; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.StandardCharsets; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.nodetype.NodeType; import org.apache.jackrabbit.commons.cnd.CndImporter; import org.apache.jackrabbit.commons.cnd.ParseException; | import io.inkstand.*; import java.io.*; import java.nio.charset.*; import javax.jcr.*; import javax.jcr.nodetype.*; import org.apache.jackrabbit.commons.cnd.*; | [
"io.inkstand",
"java.io",
"java.nio",
"javax.jcr",
"org.apache.jackrabbit"
] | io.inkstand; java.io; java.nio; javax.jcr; org.apache.jackrabbit; | 1,986,051 |
private static String getPropertyFromDeclarationName(String specName)
throws InvalidRequirementSpec {
String[] parts = removeTypeDecl(specName).split("\\.prototype\\.");
Preconditions.checkState(parts.length == 1 || parts.length == 2);
if (parts.length == 2) {
return parts[1];
}
return null;
} | static String function(String specName) throws InvalidRequirementSpec { String[] parts = removeTypeDecl(specName).split(STR); Preconditions.checkState(parts.length == 1 parts.length == 2); if (parts.length == 2) { return parts[1]; } return null; } | /**
* From a provide name extract the method name.
*/ | From a provide name extract the method name | getPropertyFromDeclarationName | {
"repo_name": "mbebenita/closure-compiler",
"path": "src/com/google/javascript/jscomp/ConformanceRules.java",
"license": "apache-2.0",
"size": 50504
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.jscomp.CheckConformance"
] | import com.google.common.base.Preconditions; import com.google.javascript.jscomp.CheckConformance; | import com.google.common.base.*; import com.google.javascript.jscomp.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 1,314,726 |
EAttribute getPackageDef_ImplName(); | EAttribute getPackageDef_ImplName(); | /**
* Returns the meta object for the attribute '{@link com.euclideanspace.spad.editor.PackageDef#getImplName <em>Impl Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Impl Name</em>'.
* @see com.euclideanspace.spad.editor.PackageDef#getImplName()
* @see #getPackageDef()
* @generated
*/ | Returns the meta object for the attribute '<code>com.euclideanspace.spad.editor.PackageDef#getImplName Impl Name</code>'. | getPackageDef_ImplName | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,228,516 |
public String createNode(String url, NameValuePairList clientNodeProperties, Map<String,String> requestHeaders, boolean multiPart,
File localFile, String fieldName, String typeHint)
throws IOException {
final PostMethod post = new PostMethod(url);
post.setFollowRedirects(false);
// create a private copy of the properties to not tamper with
// the properties of the client
NameValuePairList nodeProperties = new NameValuePairList(clientNodeProperties);
// add sling specific properties
nodeProperties.prependIfNew(":redirect", "*");
nodeProperties.prependIfNew(":displayExtension", "");
nodeProperties.prependIfNew(":status", "browser");
// add fake property - otherwise the node is not created
if (clientNodeProperties == null) {
nodeProperties.add("jcr:created", "");
}
// force form encoding to UTF-8, which is what we use to convert the
// string parts into stream data
nodeProperties.addOrReplace("_charset_", "UTF-8");
if( nodeProperties.size() > 0) {
if(multiPart) {
final List<Part> partList = new ArrayList<Part>();
for(NameValuePair e : nodeProperties) {
if (e.getValue() != null) {
partList.add(new StringPart(e.getName(), e.getValue(), "UTF-8"));
}
}
if (localFile != null) {
partList.add(new FilePart(fieldName, localFile));
if (typeHint != null) {
partList.add(new StringPart(fieldName + "@TypeHint", typeHint));
}
}
final Part [] parts = partList.toArray(new Part[partList.size()]);
post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
} else {
post.getParams().setContentCharset("UTF-8");
for(NameValuePair e : nodeProperties) {
post.addParameter(e.getName(),e.getValue());
}
}
}
if(requestHeaders != null) {
for(Map.Entry<String,String> e : requestHeaders.entrySet()) {
post.addRequestHeader(e.getKey(), e.getValue());
}
}
final int expected = 302;
final int status = httpClient.executeMethod(post);
if(status!=expected) {
throw new HttpStatusCodeException(expected, status, "POST", url, HttpTestBase.getResponseBodyAsStream(post, 0));
}
String location = post.getResponseHeader("Location").getValue();
post.releaseConnection();
// simple check if host is missing
if (!location.startsWith("http://")) {
String host = HttpTestBase.HTTP_BASE_URL;
int idx = host.indexOf('/', 8);
if (idx > 0) {
host = host.substring(0, idx);
}
location = host + location;
}
return location;
} | String function(String url, NameValuePairList clientNodeProperties, Map<String,String> requestHeaders, boolean multiPart, File localFile, String fieldName, String typeHint) throws IOException { final PostMethod post = new PostMethod(url); post.setFollowRedirects(false); NameValuePairList nodeProperties = new NameValuePairList(clientNodeProperties); nodeProperties.prependIfNew(STR, "*"); nodeProperties.prependIfNew(STR, STR:statusSTRbrowserSTRjcr:createdSTRSTR_charset_STRUTF-8STRUTF-8STR@TypeHintSTRUTF-8STRPOSTSTRLocationSTRhttp: String host = HttpTestBase.HTTP_BASE_URL; int idx = host.indexOf('/', 8); if (idx > 0) { host = host.substring(0, idx); } location = host + location; } return location; } | /** Create a node under given path, using a POST to Sling
* @param url under which node is created
* @param multiPart if true, does a multipart POST
* @param localFile file to upload
* @param fieldName name of the file field
* @param typeHint typeHint of the file field
* @return the URL that Sling provides to display the node
*/ | Create a node under given path, using a POST to Sling | createNode | {
"repo_name": "Nimco/sling",
"path": "bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/SlingIntegrationTestClient.java",
"license": "apache-2.0",
"size": 11545
} | [
"java.io.File",
"java.io.IOException",
"java.util.Map",
"org.apache.commons.httpclient.methods.PostMethod"
] | import java.io.File; import java.io.IOException; import java.util.Map; import org.apache.commons.httpclient.methods.PostMethod; | import java.io.*; import java.util.*; import org.apache.commons.httpclient.methods.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 1,392,056 |
public Element create(String prefix, Document doc) {
return new SVGOMFontFaceSrcElement(prefix, (AbstractDocument)doc);
}
}
protected static class FontFaceUriElementFactory
implements ElementFactory {
public FontFaceUriElementFactory() {} | Element function(String prefix, Document doc) { return new SVGOMFontFaceSrcElement(prefix, (AbstractDocument)doc); } } protected static class FontFaceUriElementFactory implements ElementFactory { public FontFaceUriElementFactory() {} | /**
* Creates an instance of the associated element type.
*/ | Creates an instance of the associated element type | create | {
"repo_name": "SlavaRa/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/svg/SVGDOMImplementation.java",
"license": "apache-2.0",
"size": 54290
} | [
"org.apache.flex.forks.batik.dom.AbstractDocument",
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import org.apache.flex.forks.batik.dom.AbstractDocument; import org.w3c.dom.Document; import org.w3c.dom.Element; | import org.apache.flex.forks.batik.dom.*; import org.w3c.dom.*; | [
"org.apache.flex",
"org.w3c.dom"
] | org.apache.flex; org.w3c.dom; | 1,786,988 |
InetSocketAddress getAddr(); | InetSocketAddress getAddr(); | /**
* Get Redis node address
*
* @return node address
*/ | Get Redis node address | getAddr | {
"repo_name": "jackygurui/redisson",
"path": "redisson/src/main/java/org/redisson/api/Node.java",
"license": "apache-2.0",
"size": 1549
} | [
"java.net.InetSocketAddress"
] | import java.net.InetSocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 1,091,548 |
@Generated
@Selector("setURL:")
public native void setURL(NSURL value); | @Selector(STR) native void function(NSURL value); | /**
* Get and set the URL of the document referenced from the action.
*/ | Get and set the URL of the document referenced from the action | setURL | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/pdfkit/PDFActionRemoteGoTo.java",
"license": "apache-2.0",
"size": 6407
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 276,045 |
public void write(final char chars[], final int start, final int length)
throws java.io.IOException
{
// send to the real writer
if (m_writer != null)
m_writer.write(chars, start, length);
// from here on just collect for tracing purposes
int lengthx3 = (length << 1) + length;
if (lengthx3 >= buf_length)
{
flushBuffer();
setBufferSize(2 * lengthx3);
}
if (lengthx3 > buf_length - count)
{
flushBuffer();
}
final int n = length + start;
for (int i = start; i < n; i++)
{
final char c = chars[i];
if (c < 0x80)
buf[count++] = (byte) (c);
else if (c < 0x800)
{
buf[count++] = (byte) (0xc0 + (c >> 6));
buf[count++] = (byte) (0x80 + (c & 0x3f));
}
else
{
buf[count++] = (byte) (0xe0 + (c >> 12));
buf[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
buf[count++] = (byte) (0x80 + (c & 0x3f));
}
}
} | void function(final char chars[], final int start, final int length) throws java.io.IOException { if (m_writer != null) m_writer.write(chars, start, length); int lengthx3 = (length << 1) + length; if (lengthx3 >= buf_length) { flushBuffer(); setBufferSize(2 * lengthx3); } if (lengthx3 > buf_length - count) { flushBuffer(); } final int n = length + start; for (int i = start; i < n; i++) { final char c = chars[i]; if (c < 0x80) buf[count++] = (byte) (c); else if (c < 0x800) { buf[count++] = (byte) (0xc0 + (c >> 6)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } else { buf[count++] = (byte) (0xe0 + (c >> 12)); buf[count++] = (byte) (0x80 + ((c >> 6) & 0x3f)); buf[count++] = (byte) (0x80 + (c & 0x3f)); } } } | /**
* Write a portion of an array of characters.
*
* @param chars Array of characters
* @param start Offset from which to start writing characters
* @param length Number of characters to write
*
* @exception IOException If an I/O error occurs
*
* @throws java.io.IOException
*/ | Write a portion of an array of characters | write | {
"repo_name": "md-5/jdk10",
"path": "src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java",
"license": "gpl-2.0",
"size": 10312
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,403,901 |
fTightSourceRangeNodes.add(reference);
List<StructuralPropertyDescriptor> properties = reference.structuralPropertiesForType();
for (Iterator<StructuralPropertyDescriptor> iterator = properties.iterator(); iterator.hasNext(); ) {
StructuralPropertyDescriptor descriptor = iterator.next();
if (descriptor.isChildProperty()) {
ASTNode child = (ASTNode)reference.getStructuralProperty(descriptor);
if (child != null && isExtending(child, reference)) {
addTightSourceNode(child);
}
} else if (descriptor.isChildListProperty()) {
List<? extends ASTNode> children = (List<? extends ASTNode>)reference.getStructuralProperty(descriptor);
for (Iterator<? extends ASTNode> iterator2 = children.iterator(); iterator2.hasNext(); ) {
ASTNode child = iterator2.next();
if (isExtending(child, reference)) {
addTightSourceNode(child);
}
}
}
}
} | fTightSourceRangeNodes.add(reference); List<StructuralPropertyDescriptor> properties = reference.structuralPropertiesForType(); for (Iterator<StructuralPropertyDescriptor> iterator = properties.iterator(); iterator.hasNext(); ) { StructuralPropertyDescriptor descriptor = iterator.next(); if (descriptor.isChildProperty()) { ASTNode child = (ASTNode)reference.getStructuralProperty(descriptor); if (child != null && isExtending(child, reference)) { addTightSourceNode(child); } } else if (descriptor.isChildListProperty()) { List<? extends ASTNode> children = (List<? extends ASTNode>)reference.getStructuralProperty(descriptor); for (Iterator<? extends ASTNode> iterator2 = children.iterator(); iterator2.hasNext(); ) { ASTNode child = iterator2.next(); if (isExtending(child, reference)) { addTightSourceNode(child); } } } } } | /**
* Add the given node to the set of "tight" nodes.
*
* @param reference
* a node
* @since 3.2
*/ | Add the given node to the set of "tight" nodes | addTightSourceNode | {
"repo_name": "riuvshin/che-plugins",
"path": "plugin-java/che-plugin-java-ext-java/src/main/java/org/eclipse/che/ide/ext/java/jdt/internal/corext/refactoring/util/TightSourceRangeComputer.java",
"license": "epl-1.0",
"size": 3686
} | [
"java.util.Iterator",
"java.util.List",
"org.eclipse.che.ide.ext.java.jdt.core.dom.ASTNode",
"org.eclipse.che.ide.ext.java.jdt.core.dom.StructuralPropertyDescriptor"
] | import java.util.Iterator; import java.util.List; import org.eclipse.che.ide.ext.java.jdt.core.dom.ASTNode; import org.eclipse.che.ide.ext.java.jdt.core.dom.StructuralPropertyDescriptor; | import java.util.*; import org.eclipse.che.ide.ext.java.jdt.core.dom.*; | [
"java.util",
"org.eclipse.che"
] | java.util; org.eclipse.che; | 2,214,109 |
@Authorized(PrivilegeConstants.MANAGE_CONCEPT_REFERENCE_TERMS)
public ConceptReferenceTerm retireConceptReferenceTerm(ConceptReferenceTerm conceptReferenceTerm, String retireReason)
throws APIException;
| @Authorized(PrivilegeConstants.MANAGE_CONCEPT_REFERENCE_TERMS) ConceptReferenceTerm function(ConceptReferenceTerm conceptReferenceTerm, String retireReason) throws APIException; | /**
* Retiring a concept reference term essentially removes it from circulation
*
* @param conceptReferenceTerm the concept reference term object to retire
* @param retireReason the reason why the concept reference term is being retired
* @return the retired concept reference term object
* @since 1.9
* @throws APIException
* @should retire the specified concept reference term with the given retire reason
* @should should set the default retire reason if none is given
*/ | Retiring a concept reference term essentially removes it from circulation | retireConceptReferenceTerm | {
"repo_name": "michaelhofer/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/ConceptService.java",
"license": "mpl-2.0",
"size": 72165
} | [
"org.openmrs.ConceptReferenceTerm",
"org.openmrs.annotation.Authorized",
"org.openmrs.util.PrivilegeConstants"
] | import org.openmrs.ConceptReferenceTerm; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants; | import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*; | [
"org.openmrs",
"org.openmrs.annotation",
"org.openmrs.util"
] | org.openmrs; org.openmrs.annotation; org.openmrs.util; | 513,236 |
BufferedImage createZoomedLensImage(BufferedImage image)
{
if (lens == null) return null;
try
{
return lens.createZoomedImage(image);
}
catch(Exception e)
{
return null;
}
} | BufferedImage createZoomedLensImage(BufferedImage image) { if (lens == null) return null; try { return lens.createZoomedImage(image); } catch(Exception e) { return null; } } | /**
* Creates a zoomed version of the passed image.
*
* @param image The image to zoom.
* @return See above.
* @throws Exception
*/ | Creates a zoomed version of the passed image | createZoomedLensImage | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerUI.java",
"license": "gpl-2.0",
"size": 76182
} | [
"java.awt.image.BufferedImage"
] | import java.awt.image.BufferedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 847,260 |
public void changeOrder(final String pageId, final String direction) throws ServiceException {
final Transaction transaction = pageRepository.beginTransaction();
try {
final JSONObject srcPage = pageRepository.get(pageId);
final int srcPageOrder = srcPage.getInt(Page.PAGE_ORDER);
JSONObject targetPage;
if ("up".equals(direction)) {
targetPage = pageRepository.getUpper(pageId);
} else { // Down
targetPage = pageRepository.getUnder(pageId);
}
if (null == targetPage) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.WARN, "Cant not find the target page of source page[order={0}]", srcPageOrder);
return;
}
// Swaps
srcPage.put(Page.PAGE_ORDER, targetPage.getInt(Page.PAGE_ORDER));
targetPage.put(Page.PAGE_ORDER, srcPageOrder);
pageRepository.update(srcPage.getString(Keys.OBJECT_ID), srcPage);
pageRepository.update(targetPage.getString(Keys.OBJECT_ID), targetPage);
transaction.commit();
} catch (final Exception e) {
if (transaction.isActive()) {
transaction.rollback();
}
LOGGER.log(Level.ERROR, "Changes page's order failed", e);
throw new ServiceException(e);
}
} | void function(final String pageId, final String direction) throws ServiceException { final Transaction transaction = pageRepository.beginTransaction(); try { final JSONObject srcPage = pageRepository.get(pageId); final int srcPageOrder = srcPage.getInt(Page.PAGE_ORDER); JSONObject targetPage; if ("up".equals(direction)) { targetPage = pageRepository.getUpper(pageId); } else { targetPage = pageRepository.getUnder(pageId); } if (null == targetPage) { if (transaction.isActive()) { transaction.rollback(); } LOGGER.log(Level.WARN, STR, srcPageOrder); return; } srcPage.put(Page.PAGE_ORDER, targetPage.getInt(Page.PAGE_ORDER)); targetPage.put(Page.PAGE_ORDER, srcPageOrder); pageRepository.update(srcPage.getString(Keys.OBJECT_ID), srcPage); pageRepository.update(targetPage.getString(Keys.OBJECT_ID), targetPage); transaction.commit(); } catch (final Exception e) { if (transaction.isActive()) { transaction.rollback(); } LOGGER.log(Level.ERROR, STR, e); throw new ServiceException(e); } } | /**
* Changes the order of a page specified by the given page id with the specified direction.
*
* @param pageId the given page id
* @param direction the specified direction, "up"/"down"
* @throws ServiceException service exception
*/ | Changes the order of a page specified by the given page id with the specified direction | changeOrder | {
"repo_name": "xiongba-me/solo",
"path": "src/main/java/org/b3log/solo/service/PageMgmtService.java",
"license": "agpl-3.0",
"size": 17026
} | [
"org.b3log.latke.Keys",
"org.b3log.latke.logging.Level",
"org.b3log.latke.repository.Transaction",
"org.b3log.latke.service.ServiceException",
"org.b3log.solo.model.Page",
"org.json.JSONObject"
] | import org.b3log.latke.Keys; import org.b3log.latke.logging.Level; import org.b3log.latke.repository.Transaction; import org.b3log.latke.service.ServiceException; import org.b3log.solo.model.Page; import org.json.JSONObject; | import org.b3log.latke.*; import org.b3log.latke.logging.*; import org.b3log.latke.repository.*; import org.b3log.latke.service.*; import org.b3log.solo.model.*; import org.json.*; | [
"org.b3log.latke",
"org.b3log.solo",
"org.json"
] | org.b3log.latke; org.b3log.solo; org.json; | 742,588 |
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
{
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
if (slot == EntityEquipmentSlot.MAINHAND)
{
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", this.attackDamage, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0));
}
return multimap;
}
| Multimap<String, AttributeModifier> function(EntityEquipmentSlot slot, ItemStack stack) { Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create(); if (slot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, STR, this.attackDamage, 0)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, STR, -2.4000000953674316D, 0)); } return multimap; } | /**
* Override to add custom weapon damage field rather than vanilla ItemSword's field
*/ | Override to add custom weapon damage field rather than vanilla ItemSword's field | getAttributeModifiers | {
"repo_name": "tachyony/NullPower",
"path": "src/main/java/tachyony/nullPower/item/ItemHuntingRifle.java",
"license": "apache-2.0",
"size": 9830
} | [
"com.google.common.collect.HashMultimap",
"com.google.common.collect.Multimap",
"net.minecraft.entity.SharedMonsterAttributes",
"net.minecraft.entity.ai.attributes.AttributeModifier",
"net.minecraft.inventory.EntityEquipmentSlot",
"net.minecraft.item.ItemStack"
] | import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; | import com.google.common.collect.*; import net.minecraft.entity.*; import net.minecraft.entity.ai.attributes.*; import net.minecraft.inventory.*; import net.minecraft.item.*; | [
"com.google.common",
"net.minecraft.entity",
"net.minecraft.inventory",
"net.minecraft.item"
] | com.google.common; net.minecraft.entity; net.minecraft.inventory; net.minecraft.item; | 2,664,804 |
protected Optional<Boolean> checkValidationErrors(String connectorClass, Map<String, String> connConfig,
int numErrors, BiFunction<Integer, Integer, Boolean> comp) {
try {
int numErrorsProduced = connect.validateConnectorConfig(connectorClass, connConfig).errorCount();
return Optional.of(comp.apply(numErrorsProduced, numErrors));
} catch (Exception e) {
log.error("Could not check config validation error count.", e);
return Optional.empty();
}
} | Optional<Boolean> function(String connectorClass, Map<String, String> connConfig, int numErrors, BiFunction<Integer, Integer, Boolean> comp) { try { int numErrorsProduced = connect.validateConnectorConfig(connectorClass, connConfig).errorCount(); return Optional.of(comp.apply(numErrorsProduced, numErrors)); } catch (Exception e) { log.error(STR, e); return Optional.empty(); } } | /**
* Confirm that the requested number of errors are produced by {@link EmbeddedConnectCluster#validateConnectorConfig}.
*
* @param connectorClass the class of the connector to validate
* @param connConfig the intended configuration
* @param numErrors the number of errors expected
* @return true if exactly {@code numErrors} are produced by the validation; false otherwise
*/ | Confirm that the requested number of errors are produced by <code>EmbeddedConnectCluster#validateConnectorConfig</code> | checkValidationErrors | {
"repo_name": "sslavic/kafka",
"path": "connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedConnectClusterAssertions.java",
"license": "apache-2.0",
"size": 14143
} | [
"java.util.Map",
"java.util.Optional",
"java.util.function.BiFunction"
] | import java.util.Map; import java.util.Optional; import java.util.function.BiFunction; | import java.util.*; import java.util.function.*; | [
"java.util"
] | java.util; | 1,874,376 |
@Nonnull
public java.util.concurrent.CompletableFuture<Room> deleteAsync() {
return sendAsync(HttpMethod.DELETE, null);
} | java.util.concurrent.CompletableFuture<Room> function() { return sendAsync(HttpMethod.DELETE, null); } | /**
* Delete this item from the service
*
* @return a future with the deletion result
*/ | Delete this item from the service | deleteAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/RoomRequest.java",
"license": "mit",
"size": 5331
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.Room"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.Room; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 980,496 |
public static void updateCatalogInJar(File jarFileName, Catalog catalog, File...additions) throws Exception {
catalog.serialize();
// Read the old jar file into memory with JarReader.
JarReader reader = new JarReader(jarFileName.getAbsolutePath());
List<String> files = reader.getContentsFromJarfile();
ArrayList<byte[]> bytes = new ArrayList<byte[]>();
for (String file : files) {
bytes.add(JarReader.readFileFromJarAtURL(jarFileName.getAbsolutePath(), file));
}
// Write everything from the old jar except the catalog to the same
// file with JarBuilder.
JarBuilder builder = new JarBuilder(null);
for (int i = 0; i < files.size(); ++i) {
String file = files.get(i);
if (file.equals(CatalogUtil.CATALOG_FILENAME)) {
builder.addEntry(CatalogUtil.CATALOG_FILENAME,
catalog.serialize().getBytes());
}
else {
builder.addEntry(file, bytes.get(i));
}
}
// Add any additions that they want to the root of the the jar structure
for (File f : additions) {
if (f != null) {
builder.addEntry(f.getName(), FileUtil.readBytesFromFile(f.getAbsolutePath()));
}
} // FOR
builder.writeJarToDisk(jarFileName.getAbsolutePath());
} | static void function(File jarFileName, Catalog catalog, File...additions) throws Exception { catalog.serialize(); JarReader reader = new JarReader(jarFileName.getAbsolutePath()); List<String> files = reader.getContentsFromJarfile(); ArrayList<byte[]> bytes = new ArrayList<byte[]>(); for (String file : files) { bytes.add(JarReader.readFileFromJarAtURL(jarFileName.getAbsolutePath(), file)); } JarBuilder builder = new JarBuilder(null); for (int i = 0; i < files.size(); ++i) { String file = files.get(i); if (file.equals(CatalogUtil.CATALOG_FILENAME)) { builder.addEntry(CatalogUtil.CATALOG_FILENAME, catalog.serialize().getBytes()); } else { builder.addEntry(file, bytes.get(i)); } } for (File f : additions) { if (f != null) { builder.addEntry(f.getName(), FileUtil.readBytesFromFile(f.getAbsolutePath())); } } builder.writeJarToDisk(jarFileName.getAbsolutePath()); } | /**
* Updates the catalog file in the Jar.
*
* @param jarFileName
* @param catalog
* @throws Exception (VoltCompilerException DNE?)
*/ | Updates the catalog file in the Jar | updateCatalogInJar | {
"repo_name": "gxyang/hstore",
"path": "src/frontend/edu/brown/catalog/CatalogUtil.java",
"license": "gpl-3.0",
"size": 121408
} | [
"edu.brown.utils.FileUtil",
"java.io.File",
"java.util.ArrayList",
"java.util.List",
"org.voltdb.catalog.Catalog",
"org.voltdb.compiler.JarBuilder",
"org.voltdb.utils.JarReader"
] | import edu.brown.utils.FileUtil; import java.io.File; import java.util.ArrayList; import java.util.List; import org.voltdb.catalog.Catalog; import org.voltdb.compiler.JarBuilder; import org.voltdb.utils.JarReader; | import edu.brown.utils.*; import java.io.*; import java.util.*; import org.voltdb.catalog.*; import org.voltdb.compiler.*; import org.voltdb.utils.*; | [
"edu.brown.utils",
"java.io",
"java.util",
"org.voltdb.catalog",
"org.voltdb.compiler",
"org.voltdb.utils"
] | edu.brown.utils; java.io; java.util; org.voltdb.catalog; org.voltdb.compiler; org.voltdb.utils; | 880,072 |
public static void setShadowDp(Paint paint, float radiusDp, float dxDp, float dyDp, int color) {
float radius = PixelUtils.dpToPix(radiusDp);
float dx = PixelUtils.dpToPix(dxDp);
float dy = PixelUtils.dpToPix(dyDp);
paint.setShadowLayer(radius, dx, dy, color);
} | static void function(Paint paint, float radiusDp, float dxDp, float dyDp, int color) { float radius = PixelUtils.dpToPix(radiusDp); float dx = PixelUtils.dpToPix(dxDp); float dy = PixelUtils.dpToPix(dyDp); paint.setShadowLayer(radius, dx, dy, color); } | /**
* Set a paint instance's shadowing using dp values
* @param paint
* @param radiusDp
* @param dxDp
* @param dyDp
* @param color
*/ | Set a paint instance's shadowing using dp values | setShadowDp | {
"repo_name": "iuridiniz/CheckMyECG",
"path": "androidplot/src/main/java/com/androidplot/util/PaintUtils.java",
"license": "mit",
"size": 1934
} | [
"android.graphics.Paint"
] | import android.graphics.Paint; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,324,001 |
Card update(Card card) throws Exception; | Card update(Card card) throws Exception; | /**
* Saves card.
*
* @param card Card entity instance to be updated.
* @return Card object returned from API.
* @throws Exception
*/ | Saves card | update | {
"repo_name": "Mangopay/mangopay2-java-sdk",
"path": "src/main/java/com/mangopay/core/APIs/CardApi.java",
"license": "mit",
"size": 2305
} | [
"com.mangopay.entities.Card"
] | import com.mangopay.entities.Card; | import com.mangopay.entities.*; | [
"com.mangopay.entities"
] | com.mangopay.entities; | 2,650,184 |
public Date getCreateTime() {
return createTime;
} | Date function() { return createTime; } | /**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dictionary.create_time
*
* @return the value of dictionary.create_time
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method returns the value of the database column dictionary.create_time | getCreateTime | {
"repo_name": "wenjwen/warehouse",
"path": "src/main/java/com/warehouse/pojo/Dictionary.java",
"license": "gpl-2.0",
"size": 6796
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 561,450 |
public void delete(UserInfo userInfo, String id) throws DatastoreException, UnauthorizedException, NotFoundException; | void function(UserInfo userInfo, String id) throws DatastoreException, UnauthorizedException, NotFoundException; | /**
* Delete a Team by its ID
* @param userInfo
* @param id
* @throws DatastoreException
* @throws UnauthorizedException
* @throws NotFoundException
*/ | Delete a Team by its ID | delete | {
"repo_name": "hhu94/Synapse-Repository-Services",
"path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/team/TeamManager.java",
"license": "apache-2.0",
"size": 7193
} | [
"org.sagebionetworks.repo.model.DatastoreException",
"org.sagebionetworks.repo.model.UnauthorizedException",
"org.sagebionetworks.repo.model.UserInfo",
"org.sagebionetworks.repo.web.NotFoundException"
] | import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.web.NotFoundException; | import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*; | [
"org.sagebionetworks.repo"
] | org.sagebionetworks.repo; | 1,016,666 |
public static void extract(File zipfile, File outdir)
{
try
{
ZipInputStream zin = new ZipInputStream(new FileInputStream(zipfile));
ZipEntry entry;
String name, dir;
while ((entry = zin.getNextEntry()) != null)
{
name = entry.getName();
if( entry.isDirectory() )
{
mkdirs(outdir,name);
continue;
}
dir = dirpart(name);
if( dir != null )
mkdirs(outdir,dir);
extractFile(zin, outdir, name);
}
zin.close();
}
catch (IOException e)
{
e.printStackTrace();
}
} | static void function(File zipfile, File outdir) { try { ZipInputStream zin = new ZipInputStream(new FileInputStream(zipfile)); ZipEntry entry; String name, dir; while ((entry = zin.getNextEntry()) != null) { name = entry.getName(); if( entry.isDirectory() ) { mkdirs(outdir,name); continue; } dir = dirpart(name); if( dir != null ) mkdirs(outdir,dir); extractFile(zin, outdir, name); } zin.close(); } catch (IOException e) { e.printStackTrace(); } } | /***
* Extract zipfile to outdir with complete directory structure
* @param zipfile Input .zip file
* @param outdir Output directory
*/ | Extract zipfile to outdir with complete directory structure | extract | {
"repo_name": "lion328/Knot",
"path": "src/main/java/com/lion328/knot/util/ZipUtil.java",
"license": "apache-2.0",
"size": 3351
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.util.zip.ZipEntry",
"java.util.zip.ZipInputStream"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 362,333 |
public void setApplicationContextClass(
Class<? extends ConfigurableApplicationContext> applicationContextClass) {
this.applicationContextClass = applicationContextClass;
if (!isWebApplicationContext(applicationContextClass)) {
this.webEnvironment = false;
}
} | void function( Class<? extends ConfigurableApplicationContext> applicationContextClass) { this.applicationContextClass = applicationContextClass; if (!isWebApplicationContext(applicationContextClass)) { this.webEnvironment = false; } } | /**
* Sets the type of Spring {@link ApplicationContext} that will be created. If not
* specified defaults to {@link #DEFAULT_WEB_CONTEXT_CLASS} for web based applications
* or {@link AnnotationConfigApplicationContext} for non web based applications.
* @param applicationContextClass the context class to set
*/ | Sets the type of Spring <code>ApplicationContext</code> that will be created. If not specified defaults to <code>#DEFAULT_WEB_CONTEXT_CLASS</code> for web based applications or <code>AnnotationConfigApplicationContext</code> for non web based applications | setApplicationContextClass | {
"repo_name": "vgul/spring-boot",
"path": "spring-boot/src/main/java/org/springframework/boot/SpringApplication.java",
"license": "apache-2.0",
"size": 44613
} | [
"org.springframework.context.ConfigurableApplicationContext"
] | import org.springframework.context.ConfigurableApplicationContext; | import org.springframework.context.*; | [
"org.springframework.context"
] | org.springframework.context; | 1,479,648 |
public void setAsText( final String text ) throws IllegalArgumentException {
if ( ElementAlignment.LEFT.toString().equals( text ) ) {
setValue( ElementAlignment.LEFT );
} else if ( ElementAlignment.CENTER.toString().equals( text ) ) {
setValue( ElementAlignment.CENTER );
} else if ( ElementAlignment.RIGHT.toString().equals( text ) ) {
setValue( ElementAlignment.RIGHT );
} else if ( ElementAlignment.JUSTIFY.toString().equals( text ) ) {
setValue( ElementAlignment.JUSTIFY );
} else {
throw new IllegalArgumentException();
}
} | void function( final String text ) throws IllegalArgumentException { if ( ElementAlignment.LEFT.toString().equals( text ) ) { setValue( ElementAlignment.LEFT ); } else if ( ElementAlignment.CENTER.toString().equals( text ) ) { setValue( ElementAlignment.CENTER ); } else if ( ElementAlignment.RIGHT.toString().equals( text ) ) { setValue( ElementAlignment.RIGHT ); } else if ( ElementAlignment.JUSTIFY.toString().equals( text ) ) { setValue( ElementAlignment.JUSTIFY ); } else { throw new IllegalArgumentException(); } } | /**
* Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String
* is badly formatted or if this kind of property can't be expressed as text.
*
* @param text
* The string to be parsed.
*/ | Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text | setAsText | {
"repo_name": "mbatchelor/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/metadata/propertyeditors/HorizontalAlignmentPropertyEditor.java",
"license": "lgpl-2.1",
"size": 9678
} | [
"org.pentaho.reporting.engine.classic.core.ElementAlignment"
] | import org.pentaho.reporting.engine.classic.core.ElementAlignment; | import org.pentaho.reporting.engine.classic.core.*; | [
"org.pentaho.reporting"
] | org.pentaho.reporting; | 976,783 |
public void run()
{
int bytecounter = 0;
try
{
buffer = new byte[BYTE_BUFFER_SIZE];
serversocket = new ServerSocket(port);
socket = serversocket.accept();
FileOutputStream out = null;
InputStream in = socket.getInputStream();
try
{
out = new FileOutputStream(destination);
}
catch (FileNotFoundException ex)
{
boolean success = (new File("remote_files")).mkdir();
if (success)
{
basic.Logger.inf("\"remote_files\" folder was created!");
out = new FileOutputStream(destination);
}
}
int currentbyte=0;
long startTime = System.currentTimeMillis();
while(true)
{
currentbyte = in.read(buffer);
if(currentbyte == -1)
{
status = true;
break;
}
bytecounter+=currentbyte;
out.write(buffer,0,currentbyte);
}
long endTime = System.currentTimeMillis();
if (echo)
{
basic.Logger.appendln("File was successfully received in "+((endTime-startTime)/1000D)+" sec:\n" +
"\tSize:\t"+bytecounter +" bytes"+
"\n\tSender address:\t"+socket.getLocalSocketAddress());
basic.Logger.inf("File was successfully received in: "+destination);
}
in.close();
out.close();
socket.close();
serversocket.close();
}
catch (IOException ex)
{
Logger.getLogger(FileReceiver.class.getName()).log(Level.SEVERE, null, ex);
}
}
public FileReceiver(int port,String destination) throws IOException
{
this.port = port;
this.destination = destination;
}
public FileReceiver(int port,String destination,RemoteNode node) throws IOException
{
this.node = node;
this.port = port;
this.destination = destination;
}
public FileReceiver(int port,String destination,boolean echo)
{
this.port = port;
this.destination = destination;
this.echo = echo;
} | void function() { int bytecounter = 0; try { buffer = new byte[BYTE_BUFFER_SIZE]; serversocket = new ServerSocket(port); socket = serversocket.accept(); FileOutputStream out = null; InputStream in = socket.getInputStream(); try { out = new FileOutputStream(destination); } catch (FileNotFoundException ex) { boolean success = (new File(STR)).mkdir(); if (success) { basic.Logger.inf("\"remote_files\STR); out = new FileOutputStream(destination); } } int currentbyte=0; long startTime = System.currentTimeMillis(); while(true) { currentbyte = in.read(buffer); if(currentbyte == -1) { status = true; break; } bytecounter+=currentbyte; out.write(buffer,0,currentbyte); } long endTime = System.currentTimeMillis(); if (echo) { basic.Logger.appendln(STR+((endTime-startTime)/1000D)+STR + STR+bytecounter +STR+ STR+socket.getLocalSocketAddress()); basic.Logger.inf(STR+destination); } in.close(); out.close(); socket.close(); serversocket.close(); } catch (IOException ex) { Logger.getLogger(FileReceiver.class.getName()).log(Level.SEVERE, null, ex); } } public FileReceiver(int port,String destination) throws IOException { this.port = port; this.destination = destination; } public FileReceiver(int port,String destination,RemoteNode node) throws IOException { this.node = node; this.port = port; this.destination = destination; } public FileReceiver(int port,String destination,boolean echo) { this.port = port; this.destination = destination; this.echo = echo; } | /**
* Is invoked by start().
*/ | Is invoked by start() | run | {
"repo_name": "MasterEx/djchord",
"path": "djchord/src/networking/FileReceiver.java",
"license": "mit",
"size": 5944
} | [
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream",
"java.net.ServerSocket",
"java.util.logging.Level",
"java.util.logging.Logger"
] | import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.ServerSocket; import java.util.logging.Level; import java.util.logging.Logger; | import java.io.*; import java.net.*; import java.util.logging.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 863,675 |
WorkflowResult<Pair<UserPatch, Boolean>> confirmPasswordReset(String userKey, String token, String password); | WorkflowResult<Pair<UserPatch, Boolean>> confirmPasswordReset(String userKey, String token, String password); | /**
* Confirm password reset for an user.
*
* @param userKey user confirming password reset
* @param token security token
* @param password new password value
* @return user just updated and propagations to be performed
*/ | Confirm password reset for an user | confirmPasswordReset | {
"repo_name": "giacomolm/syncope",
"path": "core/workflow-api/src/main/java/org/apache/syncope/core/workflow/api/UserWorkflowAdapter.java",
"license": "apache-2.0",
"size": 4628
} | [
"org.apache.commons.lang3.tuple.Pair",
"org.apache.syncope.common.lib.patch.UserPatch",
"org.apache.syncope.core.provisioning.api.WorkflowResult"
] | import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.common.lib.patch.UserPatch; import org.apache.syncope.core.provisioning.api.WorkflowResult; | import org.apache.commons.lang3.tuple.*; import org.apache.syncope.common.lib.patch.*; import org.apache.syncope.core.provisioning.api.*; | [
"org.apache.commons",
"org.apache.syncope"
] | org.apache.commons; org.apache.syncope; | 2,396,704 |
public AlgorithmParameterSpec getMGFParameters() {
return mgfSpec;
} | AlgorithmParameterSpec function() { return mgfSpec; } | /**
* Returns the parameters for the mask generation function.
*
* @return the parameters for the mask generation function.
*/ | Returns the parameters for the mask generation function | getMGFParameters | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/javax/crypto/spec/OAEPParameterSpec.java",
"license": "gpl-2.0",
"size": 6317
} | [
"java.security.spec.AlgorithmParameterSpec"
] | import java.security.spec.AlgorithmParameterSpec; | import java.security.spec.*; | [
"java.security"
] | java.security; | 1,731,060 |
public void resetSchedulingOpportunities(
SchedulerRequestKey schedulerKey) {
resetSchedulingOpportunities(schedulerKey, System.currentTimeMillis());
} | void function( SchedulerRequestKey schedulerKey) { resetSchedulingOpportunities(schedulerKey, System.currentTimeMillis()); } | /**
* Should be called when an application has successfully scheduled a
* container, or when the scheduling locality threshold is relaxed.
* Reset various internal counters which affect delay scheduling
*
* @param schedulerKey The priority of the container scheduled.
*/ | Should be called when an application has successfully scheduled a container, or when the scheduling locality threshold is relaxed. Reset various internal counters which affect delay scheduling | resetSchedulingOpportunities | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java",
"license": "apache-2.0",
"size": 52892
} | [
"org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey"
] | import org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey; | import org.apache.hadoop.yarn.server.scheduler.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,605,228 |
private String prependLineNumbers(CharSequence src){
StringBuilder sb = new StringBuilder();
Iterable<String> lines = Splitter.on(Pattern.compile("\r\n|\n")).split(src);
int lineNum = 1;
for( String line:lines){
if( lineNum > 0){
sb.append('\n');
}
//sb.append('[');
sb.append(Strings.padEnd(Integer.toString(lineNum) + ".", LINE_NUM_PADDING, ' '));
//sb.append(" ");
sb.append(line);
lineNum++;
}
return sb.toString();
}
| String function(CharSequence src){ StringBuilder sb = new StringBuilder(); Iterable<String> lines = Splitter.on(Pattern.compile(STR)).split(src); int lineNum = 1; for( String line:lines){ if( lineNum > 0){ sb.append('\n'); } sb.append(Strings.padEnd(Integer.toString(lineNum) + ".", LINE_NUM_PADDING, ' ')); sb.append(line); lineNum++; } return sb.toString(); } | /**
* Prepend the line number to each line. Lines are delimited by '\n' or '\r\n'
*/ | Prepend the line number to each line. Lines are delimited by '\n' or '\r\n' | prependLineNumbers | {
"repo_name": "codemucker/codemucker-jmutate",
"path": "src/main/java/org/codemucker/jmutate/ast/DefaultJAstParser.java",
"license": "apache-2.0",
"size": 13195
} | [
"com.google.common.base.Splitter",
"com.google.common.base.Strings",
"java.util.regex.Pattern"
] | import com.google.common.base.Splitter; import com.google.common.base.Strings; import java.util.regex.Pattern; | import com.google.common.base.*; import java.util.regex.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 747,638 |
public Timestamp getCreated();
public static final String COLUMNNAME_CreatedBy = "CreatedBy"; | Timestamp function(); public static final String COLUMNNAME_CreatedBy = STR; | /** Get Created.
* Date this record was created
*/ | Get Created. Date this record was created | getCreated | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_A_Asset_Transfer.java",
"license": "gpl-2.0",
"size": 12916
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,263,618 |
EAttribute getSwitch_SwitchOnCount(); | EAttribute getSwitch_SwitchOnCount(); | /**
* Returns the meta object for the attribute '{@link gluemodel.CIM.IEC61970.Wires.Switch#getSwitchOnCount <em>Switch On Count</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Switch On Count</em>'.
* @see gluemodel.CIM.IEC61970.Wires.Switch#getSwitchOnCount()
* @see #getSwitch()
* @generated
*/ | Returns the meta object for the attribute '<code>gluemodel.CIM.IEC61970.Wires.Switch#getSwitchOnCount Switch On Count</code>'. | getSwitch_SwitchOnCount | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Wires/WiresPackage.java",
"license": "mit",
"size": 669840
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 533,487 |
@Before
public void setUp( ) throws Exception {
logger.debug( TestConstants.setUpMethodLoggerMsg );
sidebarDomain2 = new com.mana.innovative.domain.common.SidebarType( );
sidebarDTO2 = new SidebarType( );
// Set Values for tempValues
sidebarDTO = TestDummyDTOObjectGenerator.getTestSidebarTypeDTOObject( );
sidebarDomain = TestDummyDomainObjectGenerator.getTestSidebarTypeDomainObject( );
} | void function( ) throws Exception { logger.debug( TestConstants.setUpMethodLoggerMsg ); sidebarDomain2 = new com.mana.innovative.domain.common.SidebarType( ); sidebarDTO2 = new SidebarType( ); sidebarDTO = TestDummyDTOObjectGenerator.getTestSidebarTypeDTOObject( ); sidebarDomain = TestDummyDomainObjectGenerator.getTestSidebarTypeDomainObject( ); } | /**
* Sets up.
*
* @throws Exception the exception
*/ | Sets up | setUp | {
"repo_name": "arkoghosh11/bloom-test",
"path": "bloom-converter/src/test/java/com/mana/innovative/converter/response/WhenSidebarConversionThenTestSiderbarConverterDomainDTOMethods.java",
"license": "apache-2.0",
"size": 7879
} | [
"com.mana.innovative.constants.TestConstants",
"com.mana.innovative.converter.TestDummyDTOObjectGenerator",
"com.mana.innovative.converter.TestDummyDomainObjectGenerator",
"com.mana.innovative.dto.common.SidebarType"
] | import com.mana.innovative.constants.TestConstants; import com.mana.innovative.converter.TestDummyDTOObjectGenerator; import com.mana.innovative.converter.TestDummyDomainObjectGenerator; import com.mana.innovative.dto.common.SidebarType; | import com.mana.innovative.constants.*; import com.mana.innovative.converter.*; import com.mana.innovative.dto.common.*; | [
"com.mana.innovative"
] | com.mana.innovative; | 1,569,850 |
public void setRefSubentityInfoValue(YangString refSubentityInfoValue)
throws JNCException {
setLeafValue(Epc.NAMESPACE,
"ref-subentity-info",
refSubentityInfoValue,
childrenNames());
} | void function(YangString refSubentityInfoValue) throws JNCException { setLeafValue(Epc.NAMESPACE, STR, refSubentityInfoValue, childrenNames()); } | /**
* Sets the value for child leaf "ref-subentity-info",
* using instance of generated typedef class.
* @param refSubentityInfoValue The value to set.
* @param refSubentityInfoValue used during instantiation.
*/ | Sets the value for child leaf "ref-subentity-info", using instance of generated typedef class | setRefSubentityInfoValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/statistics/gprsMm/RauFail.java",
"license": "apache-2.0",
"size": 11341
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 2,338,392 |
public String getPodfeedGenerator(String siteId) {
// Generator consists of 3 parts, first 2 pulled from sakai.properties:
// ui.service - institution name
// version.service - version number for the instance
// last part is url of this instance
final String localSakaiName = ServerConfigurationService.getString("ui.service","Sakai"); //localsakainame
final String versionNumber = ServerConfigurationService.getString("version.service", "?");//dev
final String portalUrl = ServerConfigurationService.getPortalUrl(); //last part exactly http://
final String generatorString = localSakaiName + " " + versionNumber + " " +
portalUrl.substring(0, portalUrl.lastIndexOf("/")+1);
return generatorString;
} | String function(String siteId) { final String localSakaiName = ServerConfigurationService.getString(STR,"Sakai"); final String versionNumber = ServerConfigurationService.getString(STR, "?"); final String portalUrl = ServerConfigurationService.getPortalUrl(); final String generatorString = localSakaiName + " " + versionNumber + " " + portalUrl.substring(0, portalUrl.lastIndexOf("/")+1); return generatorString; } | /**
* Returns the global feed generator string.
*
* @param siteId
* The site id to get the feed description from
*
* @return String
* The global feed generator string.
*/ | Returns the global feed generator string | getPodfeedGenerator | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "podcasts/podcasts-impl/impl/src/java/org/sakaiproject/component/app/podcasts/BasicPodfeedService.java",
"license": "apache-2.0",
"size": 29928
} | [
"org.sakaiproject.component.cover.ServerConfigurationService"
] | import org.sakaiproject.component.cover.ServerConfigurationService; | import org.sakaiproject.component.cover.*; | [
"org.sakaiproject.component"
] | org.sakaiproject.component; | 796,365 |
public void log(PerunSession sess, String message) throws InternalErrorException {
if(TransactionSynchronizationManager.isActualTransactionActive()) {
log.trace("Auditer stores audit message to current transaction. Message: {}.", message);
List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this);
if (topLevelTransactions == null) {
newTopLevelTransaction();
topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this);
}
// pick last top-level messages chain
List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1);
// pick last messages in that chain
List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1);
messages.add(new AuditerMessage(sess, message));
} else {
this.storeMessageToDb(sess, message);
}
} | void function(PerunSession sess, String message) throws InternalErrorException { if(TransactionSynchronizationManager.isActualTransactionActive()) { log.trace(STR, message); List<List<List<AuditerMessage>>> topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); if (topLevelTransactions == null) { newTopLevelTransaction(); topLevelTransactions = (List<List<List<AuditerMessage>>>) TransactionSynchronizationManager.getResource(this); } List<List<AuditerMessage>> transactionChain = topLevelTransactions.get(topLevelTransactions.size() - 1); List<AuditerMessage> messages = transactionChain.get(transactionChain.size() - 1); messages.add(new AuditerMessage(sess, message)); } else { this.storeMessageToDb(sess, message); } } | /**
* Log message.
* Message is stored in actual transaction. If no transaction is active message will be immediatelly flushed out.
*
* @param message
* @throws InternalErrorException
*/ | Log message. Message is stored in actual transaction. If no transaction is active message will be immediatelly flushed out | log | {
"repo_name": "ondrocks/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/impl/Auditer.java",
"license": "bsd-2-clause",
"size": 30611
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"java.util.List",
"org.springframework.transaction.support.TransactionSynchronizationManager"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List; import org.springframework.transaction.support.TransactionSynchronizationManager; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; import org.springframework.transaction.support.*; | [
"cz.metacentrum.perun",
"java.util",
"org.springframework.transaction"
] | cz.metacentrum.perun; java.util; org.springframework.transaction; | 850,508 |
public Cursor swapCursor(Cursor newCursor) {
if (newCursor == mCursor) {
return null;
}
Cursor oldCursor = mCursor;
mCursor = newCursor;
if (newCursor != null) {
mDataValid = true;
// notify the observers about the new cursor
notifyDataSetChanged();
} else {
mDataValid = false;
notifyDataSetChanged();
}
return oldCursor;
} | Cursor function(Cursor newCursor) { if (newCursor == mCursor) { return null; } Cursor oldCursor = mCursor; mCursor = newCursor; if (newCursor != null) { mDataValid = true; notifyDataSetChanged(); } else { mDataValid = false; notifyDataSetChanged(); } return oldCursor; } | /**
* Swap in a new Cursor, returning the old Cursor. Unlike
* {@link #changeCursor(Cursor)}, the returned old Cursor is <em>not</em>
* closed.
*
* @param newCursor The new cursor to be used.
* @return Returns the previously set Cursor, or null if there wasa not one.
* If the given new Cursor is the same instance is the previously set
* Cursor, null is also returned.
*/ | Swap in a new Cursor, returning the old Cursor. Unlike <code>#changeCursor(Cursor)</code>, the returned old Cursor is not closed | swapCursor | {
"repo_name": "duanze/PureNote",
"path": "gasst/src/main/java/com/duanze/gasst/ui/adapter/GNoteRVAdapter.java",
"license": "apache-2.0",
"size": 11490
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 1,480,108 |
public PortNumber portNumber() {
return portNum;
} | PortNumber function() { return portNum; } | /**
* Gets port information in this PortNextObjectiveStoreKey.
*
* @return port information
*/ | Gets port information in this PortNextObjectiveStoreKey | portNumber | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java",
"license": "apache-2.0",
"size": 3490
} | [
"org.onosproject.net.PortNumber"
] | import org.onosproject.net.PortNumber; | import org.onosproject.net.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 170,944 |
public void send (String event, String message){
this.client.send(JSONUtils.buildMessage(event, message));
} | void function (String event, String message){ this.client.send(JSONUtils.buildMessage(event, message)); } | /**
* <p>This sends a message to the server whose content is build using the
* maia message format. Messages are built using
* {@link JSONUtils#buildMessage(String, String)}.</p>
*
* <pre>JSONUtils.buildMessage(event, message)</pre>
*
* <p>This method internally uses <code>sendRaw</code> method to send the
* message. See {@link #sendRaw(String)} for further information about
* performance and error handling.</p>
*
* @param event
* the type of the message to send (according to maia's
* message format).
* @param message
* the content of the message (according to maia's
* message format).
*
* @see #sendRaw(String)
*/ | This sends a message to the server whose content is build using the maia message format. Messages are built using <code>JSONUtils#buildMessage(String, String)</code>. <code>JSONUtils.buildMessage(event, message)</code> This method internally uses <code>sendRaw</code> method to send the message. See <code>#sendRaw(String)</code> for further information about performance and error handling | send | {
"repo_name": "gsi-upm/calista-bot",
"path": "solr-elearning/src/main/java/es/upm/dit/gsi/solr/maia/MaiaClientAdapter.java",
"license": "apache-2.0",
"size": 27482
} | [
"es.upm.dit.gsi.solr.maia.utils.JSONUtils"
] | import es.upm.dit.gsi.solr.maia.utils.JSONUtils; | import es.upm.dit.gsi.solr.maia.utils.*; | [
"es.upm.dit"
] | es.upm.dit; | 1,883,765 |
static DataflowWorkUnitClient fromOptions(DataflowWorkerHarnessOptions options) {
return new DataflowWorkUnitClient(
Transport.newDataflowClient(options).build(),
options);
}
DataflowWorkUnitClient(Dataflow dataflow, DataflowWorkerHarnessOptions options) {
this.dataflow = dataflow;
this.options = options;
} | static DataflowWorkUnitClient fromOptions(DataflowWorkerHarnessOptions options) { return new DataflowWorkUnitClient( Transport.newDataflowClient(options).build(), options); } DataflowWorkUnitClient(Dataflow dataflow, DataflowWorkerHarnessOptions options) { this.dataflow = dataflow; this.options = options; } | /**
* Creates a client that fetches WorkItems from the Dataflow service.
*
* @param options The pipeline options.
* @return A WorkItemClient that fetches WorkItems from the Dataflow service.
*/ | Creates a client that fetches WorkItems from the Dataflow service | fromOptions | {
"repo_name": "springml/DataflowJavaSDK",
"path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/runners/worker/DataflowWorkerHarness.java",
"license": "apache-2.0",
"size": 12159
} | [
"com.google.api.services.dataflow.Dataflow",
"com.google.cloud.dataflow.sdk.options.DataflowWorkerHarnessOptions",
"com.google.cloud.dataflow.sdk.util.Transport"
] | import com.google.api.services.dataflow.Dataflow; import com.google.cloud.dataflow.sdk.options.DataflowWorkerHarnessOptions; import com.google.cloud.dataflow.sdk.util.Transport; | import com.google.api.services.dataflow.*; import com.google.cloud.dataflow.sdk.options.*; import com.google.cloud.dataflow.sdk.util.*; | [
"com.google.api",
"com.google.cloud"
] | com.google.api; com.google.cloud; | 1,486,743 |
EClass getFailedJobRetryTimeCycleType(); | EClass getFailedJobRetryTimeCycleType(); | /**
* Returns the meta object for class '{@link org.camunda.bpm.modeler.runtime.engine.model.FailedJobRetryTimeCycleType <em>Failed Job Retry Time Cycle Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Failed Job Retry Time Cycle Type</em>'.
* @see org.camunda.bpm.modeler.runtime.engine.model.FailedJobRetryTimeCycleType
* @generated
*/ | Returns the meta object for class '<code>org.camunda.bpm.modeler.runtime.engine.model.FailedJobRetryTimeCycleType Failed Job Retry Time Cycle Type</code>'. | getFailedJobRetryTimeCycleType | {
"repo_name": "camunda/camunda-eclipse-plugin",
"path": "org.camunda.bpm.modeler/src/org/camunda/bpm/modeler/runtime/engine/model/ModelPackage.java",
"license": "epl-1.0",
"size": 231785
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 171,561 |
private ZapTable getTableExtension() {
if (tableExt == null) {
tableExt =
new ZapTable() {
private static final long serialVersionUID = 1L; | ZapTable function() { if (tableExt == null) { tableExt = new ZapTable() { private static final long serialVersionUID = 1L; | /**
* This method initializes tableAuth
*
* @return javax.swing.JTable
*/ | This method initializes tableAuth | getTableExtension | {
"repo_name": "meitar/zaproxy",
"path": "zap/src/main/java/org/zaproxy/zap/extension/ext/OptionsExtensionPanel.java",
"license": "apache-2.0",
"size": 11394
} | [
"org.zaproxy.zap.view.ZapTable"
] | import org.zaproxy.zap.view.ZapTable; | import org.zaproxy.zap.view.*; | [
"org.zaproxy.zap"
] | org.zaproxy.zap; | 350,085 |
public XMLValue computeSupportedReportSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException {
XMLValue xmlValue = new XMLValue();
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(nsaToken, revisionDescriptors, revisionDescriptor);
Set supportedReportNames = resourceKind.getSupportedReports();
Iterator iterator = supportedReportNames.iterator();
Element supportedReportElement = null;
Element reportElement = null;
Element propertyElement = null;
while (iterator.hasNext()) {
supportedReportElement = new Element(E_SUPPORTED_REPORT, DNSP);
reportElement = new Element(E_REPORT, DNSP);
supportedReportElement.addContent(reportElement);
propertyElement = new Element((String)iterator.next(), DNSP);
reportElement.addContent(propertyElement);
xmlValue.add(supportedReportElement);
}
return xmlValue;
}
/**
* Returns an XMLValue containing <code><href></code> elements
* with the URI of the VCRs that have a <code><checked-out></code>
* property pointing to this VR.
* If the resource is not a VR, the returned XMLValue is empty.
* The difference to the other
* {@link #computeCheckoutSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) computeCheckoutSet()}
* method signature is that the <code><href></code> contain only
* the slide URI and not the complete URI that is to be returned by e.g.
* PROPFIND.
*
* @deprecated use {@link #computeCheckoutSet(NodeRevisionDescriptors, NodeRevisionDescriptor, String)} | XMLValue function(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ObjectLockedException, RevisionDescriptorNotFoundException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException { XMLValue xmlValue = new XMLValue(); ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(nsaToken, revisionDescriptors, revisionDescriptor); Set supportedReportNames = resourceKind.getSupportedReports(); Iterator iterator = supportedReportNames.iterator(); Element supportedReportElement = null; Element reportElement = null; Element propertyElement = null; while (iterator.hasNext()) { supportedReportElement = new Element(E_SUPPORTED_REPORT, DNSP); reportElement = new Element(E_REPORT, DNSP); supportedReportElement.addContent(reportElement); propertyElement = new Element((String)iterator.next(), DNSP); reportElement.addContent(propertyElement); xmlValue.add(supportedReportElement); } return xmlValue; } /** * Returns an XMLValue containing <code><href></code> elements * with the URI of the VCRs that have a <code><checked-out></code> * property pointing to this VR. * If the resource is not a VR, the returned XMLValue is empty. * The difference to the other * {@link #computeCheckoutSet(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) computeCheckoutSet()} * method signature is that the <code><href></code> contain only * the slide URI and not the complete URI that is to be returned by e.g. * PROPFIND. * * @deprecated use {@link #computeCheckoutSet(NodeRevisionDescriptors, NodeRevisionDescriptor, String)} | /**
* Returns an XMLValue containing the <code><supported-report></code>
* elements containing <code><report></code> which are containing
* elements with the name of the report.
* <br></br>
* <i>Note:</i>
* <br></br>
* <i>
* Due to the specification this is <b>not</b> a computed property, but because
* of implementation problems it is not stored.
* </i>
*
* @param revisionDescriptors the NodeRevisionDescriptors of the resource.
* @param revisionDescriptor the NodeRevisionDescriptor of the resource.
* @param contextPath a String , the result of HttpRequest.getContextPath()
* @param servletPath a String, the result of HttpRequest.getServletPath()
*
* @return the supported reports.
*
* @throws ObjectLockedException
* @throws RevisionDescriptorNotFoundException
* @throws ServiceAccessException
* @throws LinkedObjectNotFoundException
* @throws AccessDeniedException
* @throws ObjectNotFoundException
*/ | Returns an XMLValue containing the <code><supported-report></code> elements containing <code><report></code> which are containing elements with the name of the report. Note: Due to the specification this is not a computed property, but because of implementation problems it is not stored. | computeSupportedReportSet | {
"repo_name": "integrated/jakarta-slide-server",
"path": "maven/jakarta-slide-webdavservlet/src/main/java/org/apache/slide/webdav/util/PropertyHelper.java",
"license": "apache-2.0",
"size": 102956
} | [
"java.util.Iterator",
"java.util.Set",
"org.apache.slide.common.ServiceAccessException",
"org.apache.slide.content.NodeRevisionDescriptor",
"org.apache.slide.content.NodeRevisionDescriptors",
"org.apache.slide.content.RevisionDescriptorNotFoundException",
"org.apache.slide.lock.ObjectLockedException",
... | import java.util.Iterator; import java.util.Set; import org.apache.slide.common.ServiceAccessException; import org.apache.slide.content.NodeRevisionDescriptor; import org.apache.slide.content.NodeRevisionDescriptors; import org.apache.slide.content.RevisionDescriptorNotFoundException; import org.apache.slide.lock.ObjectLockedException; import org.apache.slide.security.AccessDeniedException; import org.apache.slide.structure.LinkedObjectNotFoundException; import org.apache.slide.structure.ObjectNotFoundException; import org.apache.slide.util.XMLValue; import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind; import org.apache.slide.webdav.util.resourcekind.ResourceKind; import org.jdom.Element; | import java.util.*; import org.apache.slide.common.*; import org.apache.slide.content.*; import org.apache.slide.lock.*; import org.apache.slide.security.*; import org.apache.slide.structure.*; import org.apache.slide.util.*; import org.apache.slide.webdav.util.resourcekind.*; import org.jdom.*; | [
"java.util",
"org.apache.slide",
"org.jdom"
] | java.util; org.apache.slide; org.jdom; | 417,347 |
public void testZeroAssociatedObjectsNestedSearch1() throws ApplicationException
{
Computer searchObject = new Computer();
Ii ii=new Ii();
ii.setExtension("5");
searchObject.setId(ii);
Collection results = getApplicationService().search("gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.Computer",searchObject );
assertNotNull(results);
assertEquals(1,results.size());
Iterator i = results.iterator();
Computer result = (Computer)i.next();
assertNotNull(result);
assertNotNull(result.getId());
assertEquals(result.getId().getRoot(),II_ROOT_GLOBAL_CONSTANT_VALUE);
assertNotNull(result.getType());
Collection hardDriveCollection = result.getHardDriveCollection();
assertEquals(0,hardDriveCollection.size());
}
| void function() throws ApplicationException { Computer searchObject = new Computer(); Ii ii=new Ii(); ii.setExtension("5"); searchObject.setId(ii); Collection results = getApplicationService().search(STR,searchObject ); assertNotNull(results); assertEquals(1,results.size()); Iterator i = results.iterator(); Computer result = (Computer)i.next(); assertNotNull(result); assertNotNull(result.getId()); assertEquals(result.getId().getRoot(),II_ROOT_GLOBAL_CONSTANT_VALUE); assertNotNull(result.getType()); Collection hardDriveCollection = result.getHardDriveCollection(); assertEquals(0,hardDriveCollection.size()); } | /**
* Uses Nested Search Criteria for search
* Verifies that the results are returned
* Verifies size of the result set
* erifies that the associated object is null
*
* @throws ApplicationException
*/ | Uses Nested Search Criteria for search Verifies that the results are returned Verifies size of the result set erifies that the associated object is null | testZeroAssociatedObjectsNestedSearch1 | {
"repo_name": "NCIP/cacore-sdk",
"path": "sdk-toolkit/iso-example-project/junit/src/test/gov/nih/nci/cacoresdk/domain/onetomany/bidirectional/O2MBidirectionalTest.java",
"license": "bsd-3-clause",
"size": 10055
} | [
"gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.Computer",
"gov.nih.nci.iso21090.Ii",
"gov.nih.nci.system.applicationservice.ApplicationException",
"java.util.Collection",
"java.util.Iterator"
] | import gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.Computer; import gov.nih.nci.iso21090.Ii; import gov.nih.nci.system.applicationservice.ApplicationException; import java.util.Collection; import java.util.Iterator; | import gov.nih.nci.cacoresdk.domain.onetomany.bidirectional.*; import gov.nih.nci.iso21090.*; import gov.nih.nci.system.applicationservice.*; import java.util.*; | [
"gov.nih.nci",
"java.util"
] | gov.nih.nci; java.util; | 2,102,028 |
RouteDefinition getRoute(); | RouteDefinition getRoute(); | /**
* Get the route type
*
* @return the route type
*/ | Get the route type | getRoute | {
"repo_name": "tkopczynski/camel",
"path": "camel-core/src/main/java/org/apache/camel/spi/RouteContext.java",
"license": "apache-2.0",
"size": 5854
} | [
"org.apache.camel.model.RouteDefinition"
] | import org.apache.camel.model.RouteDefinition; | import org.apache.camel.model.*; | [
"org.apache.camel"
] | org.apache.camel; | 392,779 |
public Builder title(@StringRes int titleRes) {
title = context.getText(titleRes);
return this;
} | Builder function(@StringRes int titleRes) { title = context.getText(titleRes); return this; } | /**
* Set title for BottomSheet
*
* @param titleRes title for BottomSheet
* @return This Builder object to allow for chaining of calls to set methods
*/ | Set title for BottomSheet | title | {
"repo_name": "stangls/omim",
"path": "android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java",
"license": "apache-2.0",
"size": 30622
} | [
"android.support.annotation.StringRes"
] | import android.support.annotation.StringRes; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,310,246 |
public void openInUserData(String filename) throws IOException {
File folder = new File(EBusTelegramCSVWriter.CSV_FOLDER);
if (!folder.exists()) {
folder.mkdirs();
}
open(new File(folder, filename));
} | void function(String filename) throws IOException { File folder = new File(EBusTelegramCSVWriter.CSV_FOLDER); if (!folder.exists()) { folder.mkdirs(); } open(new File(folder, filename)); } | /**
* open a csv file user data
*
* @param filename
* @throws IOException
*/ | open a csv file user data | openInUserData | {
"repo_name": "lewie/openhab",
"path": "bundles/binding/org.openhab.binding.ebus/src/main/java/org/openhab/binding/ebus/internal/parser/EBusTelegramCSVWriter.java",
"license": "epl-1.0",
"size": 5321
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,733,618 |
long getDeploymentTime(File file, String configId); | long getDeploymentTime(File file, String configId); | /**
* Called during initialization on previously deployed files.
*
* @return The time that the file was deployed. If the current
* version in the directory is newer, the file will be
* updated on the first pass.
*/ | Called during initialization on previously deployed files | getDeploymentTime | {
"repo_name": "meetdestiny/geronimo-trader",
"path": "modules/hot-deploy/src/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java",
"license": "apache-2.0",
"size": 16121
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,467,241 |
public Collection<WorkerSlot> getUsedSlotsByTopologyId(String topologyId) {
if (!this.assignments.containsKey(topologyId)) {
return null;
}
return this.assignments.get(topologyId).getSlots();
} | Collection<WorkerSlot> function(String topologyId) { if (!this.assignments.containsKey(topologyId)) { return null; } return this.assignments.get(topologyId).getSlots(); } | /**
* get slots used by a topology
*/ | get slots used by a topology | getUsedSlotsByTopologyId | {
"repo_name": "carl34/storm",
"path": "storm-client/src/jvm/org/apache/storm/scheduler/Cluster.java",
"license": "apache-2.0",
"size": 33367
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,577,490 |
@Test
public void shouldFetchPersonAttributesForPersonsThatWereFirstFetchedAsPatients() throws Exception {
Person person = Context.getPersonService().getPerson(2);
Patient patient = Context.getPatientService().getPatient(2);
patient.getAttributes().size();
person.getAttributes().size();
}
| void function() throws Exception { Person person = Context.getPersonService().getPerson(2); Patient patient = Context.getPatientService().getPatient(2); patient.getAttributes().size(); person.getAttributes().size(); } | /**
* This test verifies that {@link PersonAttribute}s are fetched correctly from the hibernate
* cache. (Or really, not fetched from the cache but instead are mapped with lazy=false. For
* some reason Hibernate isn't able to find objects in the cache if a parent object was the one
* that loaded them)
*
* @throws Exception
*/ | This test verifies that <code>PersonAttribute</code>s are fetched correctly from the hibernate cache. (Or really, not fetched from the cache but instead are mapped with lazy=false. For some reason Hibernate isn't able to find objects in the cache if a parent object was the one that loaded them) | shouldFetchPersonAttributesForPersonsThatWereFirstFetchedAsPatients | {
"repo_name": "MitchellBot/openmrs-core",
"path": "api/src/test/java/org/openmrs/api/PatientServiceTest.java",
"license": "mpl-2.0",
"size": 143797
} | [
"org.openmrs.Patient",
"org.openmrs.Person",
"org.openmrs.api.context.Context"
] | import org.openmrs.Patient; import org.openmrs.Person; import org.openmrs.api.context.Context; | import org.openmrs.*; import org.openmrs.api.context.*; | [
"org.openmrs",
"org.openmrs.api"
] | org.openmrs; org.openmrs.api; | 1,941,687 |
public void doSortbydate(RunData rundata, Context context)
{
setupSort(rundata, context, SORT_DATE);
} // doSortbydate
| void function(RunData rundata, Context context) { setupSort(rundata, context, SORT_DATE); } | /**
* Do sort by the date of the announcement.
*/ | Do sort by the date of the announcement | doSortbydate | {
"repo_name": "wfuedu/sakai",
"path": "announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java",
"license": "apache-2.0",
"size": 173293
} | [
"org.sakaiproject.cheftool.Context",
"org.sakaiproject.cheftool.RunData"
] | import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.RunData; | import org.sakaiproject.cheftool.*; | [
"org.sakaiproject.cheftool"
] | org.sakaiproject.cheftool; | 2,845,540 |
public String load() throws IOException {
String text = BaseNoGui.loadFile(file);
if (text == null) {
throw new IOException();
}
if (text.indexOf('\uFFFD') != -1) {
System.err.println(
I18n.format(
tr("\"{0}\" contains unrecognized characters. " +
"If this code was created with an older version of Arduino, " +
"you may need to use Tools -> Fix Encoding & Reload to update " +
"the sketch to use UTF-8 encoding. If not, you may need to " +
"delete the bad characters to get rid of this warning."),
file.getName()
)
);
System.err.println();
}
return text;
} | String function() throws IOException { String text = BaseNoGui.loadFile(file); if (text == null) { throw new IOException(); } if (text.indexOf('\uFFFD') != -1) { System.err.println( I18n.format( tr("\"{0}\STR + STR + STR + STR + STR), file.getName() ) ); System.err.println(); } return text; } | /**
* Load this piece of code from a file and return the contents. This
* completely ignores any changes in the linked storage, if any, and
* just directly reads the file.
*/ | Load this piece of code from a file and return the contents. This completely ignores any changes in the linked storage, if any, and just directly reads the file | load | {
"repo_name": "PaoloP74/Arduino",
"path": "arduino-core/src/processing/app/SketchFile.java",
"license": "lgpl-2.1",
"size": 7948
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,481,839 |
//----------------------------------------------------------------------------
public void disableDispatch(String commandURL) {
if(commandURL == null)
return;
if(disabledCommandURLs == null)
disabledCommandURLs = new TreeSet();
disabledCommandURLs.add(commandURL);
}
| void function(String commandURL) { if(commandURL == null) return; if(disabledCommandURLs == null) disabledCommandURLs = new TreeSet(); disabledCommandURLs.add(commandURL); } | /**
* Disables the command dispatch related to the submitted command URL.
* In order to activate the dispatches you need to call {@link IFrame#updateDispatches()}.
*
* @param commandURL URL of the command
*
* @see GlobalCommands
*
* @author Andreas Bröker
* @author Markus Krüger
* @date 07.07.2006
*/ | Disables the command dispatch related to the submitted command URL. In order to activate the dispatches you need to call <code>IFrame#updateDispatches()</code> | disableDispatch | {
"repo_name": "LibreOffice/noa-libre",
"path": "src/ag/ion/bion/officelayer/internal/desktop/Frame.java",
"license": "lgpl-2.1",
"size": 19751
} | [
"java.util.TreeSet"
] | import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 635,850 |
public Pair<Boolean, Optional<MultifactorAuthenticationProvider>> validate(final Authentication authentication,
final String requestedContext,
final RegisteredService service) {
final Object ctxAttr = authentication.getAttributes().get(this.authenticationContextAttribute);
final Collection<Object> contexts = CollectionUtils.convertValueToCollection(ctxAttr);
logger.debug("Attempting to match requested authentication context {} against {}", requestedContext, contexts);
final Map<String, MultifactorAuthenticationProvider> providerMap =
getAllMultifactorAuthenticationProvidersFromApplicationContext();
if (providerMap == null) {
logger.debug("No providers have been configured");
return new Pair(false, Optional.empty());
}
final Optional<MultifactorAuthenticationProvider> requestedProvider =
locateRequestedProvider(providerMap.values(), requestedContext);
if (!requestedProvider.isPresent()) {
logger.debug("Requested authentication provider cannot be recognized.");
return new Pair(false, Optional.empty());
}
if (contexts.stream().filter(ctx -> ctx.toString().equals(requestedContext)).count() > 0) {
logger.debug("Requested authentication context {} is satisfied", requestedContext);
return new Pair(true, requestedProvider);
}
final Collection<MultifactorAuthenticationProvider> satisfiedProviders =
getSatisfiedAuthenticationProviders(authentication, providerMap.values());
if (satisfiedProviders == null) {
logger.debug("No satisfied multifactor authentication providers are recorded in the current authentication context.");
return new Pair(false, requestedProvider);
}
if (!satisfiedProviders.isEmpty()) {
final MultifactorAuthenticationProvider[] providers = satisfiedProviders.toArray(new MultifactorAuthenticationProvider[]{});
OrderComparator.sortIfNecessary(providers);
final Optional<MultifactorAuthenticationProvider> result = Arrays.stream(providers)
.filter(provider -> provider.equals(requestedProvider.get())
|| provider.getOrder() >= requestedProvider.get().getOrder())
.findFirst();
if (result.isPresent()) {
logger.debug("Current provider {} already satisfies the authentication requirements of {}; proceed with flow normally.",
result.get(), requestedProvider);
return new Pair(true, requestedProvider);
}
}
logger.debug("No multifactor providers could be located to satisfy the requested context for {}", requestedProvider);
final RegisteredServiceMultifactorPolicy.FailureModes mode = getMultifactorFailureModeForService(service);
if (mode == RegisteredServiceMultifactorPolicy.FailureModes.PHANTOM) {
if (!requestedProvider.get().verify(service)) {
logger.debug("Service {} is configured to use a {} failure mode for multifactor authentication policy. "
+ "Since provider {} is unavailable at the moment, CAS will knowingly allow [{}] as a satisfied criteria "
+ "of the present authentication context", service.getServiceId(),
mode, requestedProvider, requestedContext);
return new Pair(true, requestedProvider);
}
}
if (mode == RegisteredServiceMultifactorPolicy.FailureModes.OPEN) {
if (!requestedProvider.get().verify(service)) {
logger.debug("Service {} is configured to use a {} failure mode for multifactor authentication policy and "
+ "since provider {} is unavailable at the moment, CAS will consider the authentication satisfied "
+ "without the presence of {}", service.getServiceId(),
mode, requestedProvider, requestedContext);
return new Pair(true, satisfiedProviders.stream().findFirst());
}
}
return new Pair(false, requestedProvider);
} | Pair<Boolean, Optional<MultifactorAuthenticationProvider>> function(final Authentication authentication, final String requestedContext, final RegisteredService service) { final Object ctxAttr = authentication.getAttributes().get(this.authenticationContextAttribute); final Collection<Object> contexts = CollectionUtils.convertValueToCollection(ctxAttr); logger.debug(STR, requestedContext, contexts); final Map<String, MultifactorAuthenticationProvider> providerMap = getAllMultifactorAuthenticationProvidersFromApplicationContext(); if (providerMap == null) { logger.debug(STR); return new Pair(false, Optional.empty()); } final Optional<MultifactorAuthenticationProvider> requestedProvider = locateRequestedProvider(providerMap.values(), requestedContext); if (!requestedProvider.isPresent()) { logger.debug(STR); return new Pair(false, Optional.empty()); } if (contexts.stream().filter(ctx -> ctx.toString().equals(requestedContext)).count() > 0) { logger.debug(STR, requestedContext); return new Pair(true, requestedProvider); } final Collection<MultifactorAuthenticationProvider> satisfiedProviders = getSatisfiedAuthenticationProviders(authentication, providerMap.values()); if (satisfiedProviders == null) { logger.debug(STR); return new Pair(false, requestedProvider); } if (!satisfiedProviders.isEmpty()) { final MultifactorAuthenticationProvider[] providers = satisfiedProviders.toArray(new MultifactorAuthenticationProvider[]{}); OrderComparator.sortIfNecessary(providers); final Optional<MultifactorAuthenticationProvider> result = Arrays.stream(providers) .filter(provider -> provider.equals(requestedProvider.get()) provider.getOrder() >= requestedProvider.get().getOrder()) .findFirst(); if (result.isPresent()) { logger.debug(STR, result.get(), requestedProvider); return new Pair(true, requestedProvider); } } logger.debug(STR, requestedProvider); final RegisteredServiceMultifactorPolicy.FailureModes mode = getMultifactorFailureModeForService(service); if (mode == RegisteredServiceMultifactorPolicy.FailureModes.PHANTOM) { if (!requestedProvider.get().verify(service)) { logger.debug(STR + STR + STR, service.getServiceId(), mode, requestedProvider, requestedContext); return new Pair(true, requestedProvider); } } if (mode == RegisteredServiceMultifactorPolicy.FailureModes.OPEN) { if (!requestedProvider.get().verify(service)) { logger.debug(STR + STR + STR, service.getServiceId(), mode, requestedProvider, requestedContext); return new Pair(true, satisfiedProviders.stream().findFirst()); } } return new Pair(false, requestedProvider); } | /**
* Validate the authentication context.
*
* @param authentication the authentication
* @param requestedContext the requested context
* @param service the service
* @return the resulting pair indicates whether context is satisfied, and if so, by which provider.
*/ | Validate the authentication context | validate | {
"repo_name": "yisiqi/cas",
"path": "cas-server-core-authentication/src/main/java/org/apereo/cas/authentication/AuthenticationContextValidator.java",
"license": "apache-2.0",
"size": 8976
} | [
"java.util.Arrays",
"java.util.Collection",
"java.util.Map",
"java.util.Optional",
"org.apereo.cas.services.MultifactorAuthenticationProvider",
"org.apereo.cas.services.RegisteredService",
"org.apereo.cas.services.RegisteredServiceMultifactorPolicy",
"org.apereo.cas.util.CollectionUtils",
"org.apere... | import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.Optional; import org.apereo.cas.services.MultifactorAuthenticationProvider; import org.apereo.cas.services.RegisteredService; import org.apereo.cas.services.RegisteredServiceMultifactorPolicy; import org.apereo.cas.util.CollectionUtils; import org.apereo.cas.util.Pair; import org.springframework.core.OrderComparator; | import java.util.*; import org.apereo.cas.services.*; import org.apereo.cas.util.*; import org.springframework.core.*; | [
"java.util",
"org.apereo.cas",
"org.springframework.core"
] | java.util; org.apereo.cas; org.springframework.core; | 2,141,747 |
public boolean isFinal()
{
return Modifier.isFinal(_method.getModifiers());
} | boolean function() { return Modifier.isFinal(_method.getModifiers()); } | /**
* Returns true for a final method.
*/ | Returns true for a final method | isFinal | {
"repo_name": "christianchristensen/resin",
"path": "modules/kernel/src/com/caucho/config/gen/ApiMethod.java",
"license": "gpl-2.0",
"size": 7246
} | [
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 617,253 |
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> rv = new HashMap<String, String[]>();
for (Enumeration<String> keys = getParameterNames(); keys.hasMoreElements(); ) {
String k = keys.nextElement();
String[] v = getParameterValues(k);
if (v != null)
rv.put(k, v);
}
return Collections.unmodifiableMap(rv);
} | Map<String, String[]> function() { Map<String, String[]> rv = new HashMap<String, String[]>(); for (Enumeration<String> keys = getParameterNames(); keys.hasMoreElements(); ) { String k = keys.nextElement(); String[] v = getParameterValues(k); if (v != null) rv.put(k, v); } return Collections.unmodifiableMap(rv); } | /**
* Parameter names starting with "nofilter_" will not be filtered.
*/ | Parameter names starting with "nofilter_" will not be filtered | getParameterMap | {
"repo_name": "nurmuhammad/rvc",
"path": "src/main/java/rvc/http/XSSRequestWrapper.java",
"license": "apache-2.0",
"size": 4360
} | [
"java.util.Collections",
"java.util.Enumeration",
"java.util.HashMap",
"java.util.Map"
] | import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,230,982 |
protected File resolveFile(final String s) {
if(getProject() == null) {
// Note FileUtils.getFileUtils replaces FileUtils.newFileUtils in Ant 1.6.3
return FileUtils.getFileUtils().resolveFile(null, s);
} else {
return FileUtils.getFileUtils().resolveFile(getProject().getBaseDir(), s);
}
} | File function(final String s) { if(getProject() == null) { return FileUtils.getFileUtils().resolveFile(null, s); } else { return FileUtils.getFileUtils().resolveFile(getProject().getBaseDir(), s); } } | /**
* Resolves the relative or absolute pathname correctly
* in both Ant and command-line situations. If Ant launched
* us, we should use the basedir of the current project
* to resolve relative paths.
*
* See Bugzilla 35571.
*
* @param s The file
* @return The file resolved
*/ | Resolves the relative or absolute pathname correctly in both Ant and command-line situations. If Ant launched us, we should use the basedir of the current project to resolve relative paths. See Bugzilla 35571 | resolveFile | {
"repo_name": "Nickname0806/Test_Q4",
"path": "java/org/apache/jasper/JspC.java",
"license": "apache-2.0",
"size": 54741
} | [
"java.io.File",
"org.apache.tools.ant.util.FileUtils"
] | import java.io.File; import org.apache.tools.ant.util.FileUtils; | import java.io.*; import org.apache.tools.ant.util.*; | [
"java.io",
"org.apache.tools"
] | java.io; org.apache.tools; | 744,990 |
@Override
public int getModifiedNoteCount(Date since, Set<SelectOption> noteClass) {
// TODO Auto-generated method stub
return 0;
} | int function(Date since, Set<SelectOption> noteClass) { return 0; } | /**
* Not implemented yet.
*/ | Not implemented yet | getModifiedNoteCount | {
"repo_name": "hyarthi/project-red",
"path": "src/java/org.openntf.red.main/src/org/openntf/red/impl/Database.java",
"license": "apache-2.0",
"size": 36930
} | [
"java.util.Date",
"java.util.Set",
"org.openntf.red.NoteCollection"
] | import java.util.Date; import java.util.Set; import org.openntf.red.NoteCollection; | import java.util.*; import org.openntf.red.*; | [
"java.util",
"org.openntf.red"
] | java.util; org.openntf.red; | 2,729,991 |
public Message requestBypassZone(String zone, String area) {
if (area == null) {
area = "1";
}
String fullCommand = zb_CMD_ZONE_BYPASS_REQUEST + zone + area
+ String.format("%06d", Integer.parseInt(code));
sendCommand(fullCommand);
try {
return readMessages(ZB_REPLY_ZONE_BYPASS_REPORT_DATA);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
} | Message function(String zone, String area) { if (area == null) { area = "1"; } String fullCommand = zb_CMD_ZONE_BYPASS_REQUEST + zone + area + String.format("%06d", Integer.parseInt(code)); sendCommand(fullCommand); try { return readMessages(ZB_REPLY_ZONE_BYPASS_REPORT_DATA); } catch (IOException e) { e.printStackTrace(); } return null; } | /**
* 4.39.1 Zone Bypass Request (zb)
*
* 4.39.2 Reply With Bypassed Zone State (ZB)
*
* @param zone
* @param area
* @return message of type BypassedZoneState
*/ | 4.39.1 Zone Bypass Request (zb) 4.39.2 Reply With Bypassed Zone State (ZB) | requestBypassZone | {
"repo_name": "cdhesse/ElkM1API",
"path": "src/com/elkm1api/ElkM1Controller.java",
"license": "apache-2.0",
"size": 32257
} | [
"com.elkm1api.messages.Message",
"java.io.IOException"
] | import com.elkm1api.messages.Message; import java.io.IOException; | import com.elkm1api.messages.*; import java.io.*; | [
"com.elkm1api.messages",
"java.io"
] | com.elkm1api.messages; java.io; | 2,786,259 |
public Map<String, String> getHeaders() {
return headers;
} | Map<String, String> function() { return headers; } | /**
* Get all headers as a map.
*
* @return all headers
*/ | Get all headers as a map | getHeaders | {
"repo_name": "Comcast/drive-thru",
"path": "src/main/java/com/comcast/drivethru/utils/RestRequest.java",
"license": "apache-2.0",
"size": 4133
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 343,558 |
private void generate() throws IOException {
Map<String, String> deviceKeys = loadDeviceKeys();
for (String lang : LANGUAGES) {
// load datapoint descriptions
Map<String, String> langDescriptions = loadJsonLangDescriptionFile(CCU_URL + DESCRIPTION_KEYS, lang);
for (String fileName : MASTER_LANG_FILES) {
langDescriptions.putAll(loadJsonLangDescriptionFile(CCU_URL + MASTER_LANG_PATH + fileName, lang));
}
// load device descriptions
Map<String, String> deviceDescriptions = loadJsonLangDescriptionFile(CCU_URL + DESCRIPTION_DESCRIPTIONS,
lang);
String langIdent = ("en".equals(lang) ? "" : "_" + lang);
File file = new File("./src/main/resources/homematic/generated-descriptions" + langIdent + ".properties");
System.out.println("Writing file " + file.getAbsolutePath());
if (file.exists()) {
file.delete();
}
file.createNewFile();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "ISO-8859-1"));
// write device descriptions
bw.write("# -------------- generated descriptions " + new Date() + " --------------\n");
bw.write("# DON'T CHANGE THIS FILE!\n\n");
for (Entry<String, String> entry : deviceDescriptions.entrySet()) {
bw.write(entry.getKey());
bw.write("=");
bw.write(entry.getValue());
bw.write("\n");
}
bw.write("\n\n\n");
// write datapoint descriptions
for (Entry<String, String> entry : deviceKeys.entrySet()) {
String description = langDescriptions.get(entry.getValue());
if (description == null) {
System.out.println("WARNING: Can't find a translation for " + entry.getValue());
} else {
bw.write(entry.getKey().toUpperCase());
bw.write("=");
bw.write(description);
bw.write("\n");
}
}
bw.flush();
bw.close();
}
} | void function() throws IOException { Map<String, String> deviceKeys = loadDeviceKeys(); for (String lang : LANGUAGES) { Map<String, String> langDescriptions = loadJsonLangDescriptionFile(CCU_URL + DESCRIPTION_KEYS, lang); for (String fileName : MASTER_LANG_FILES) { langDescriptions.putAll(loadJsonLangDescriptionFile(CCU_URL + MASTER_LANG_PATH + fileName, lang)); } Map<String, String> deviceDescriptions = loadJsonLangDescriptionFile(CCU_URL + DESCRIPTION_DESCRIPTIONS, lang); String langIdent = ("en".equals(lang) ? STR_STR./src/main/resources/homematic/generated-descriptionsSTR.propertiesSTRWriting file STRISO-8859-1STR# -------------- generated descriptions STR --------------\nSTR# DON'T CHANGE THIS FILE!\n\nSTR=STR\nSTR\n\n\nSTRWARNING: Can't find a translation for STR=STR\n"); } } bw.flush(); bw.close(); } } | /**
* Loads the JavaScript file from the CCU and generates the properties file.
*/ | Loads the JavaScript file from the CCU and generates the properties file | generate | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/generator/CcuMetadataExtractor.java",
"license": "epl-1.0",
"size": 8860
} | [
"java.io.IOException",
"java.util.Map"
] | import java.io.IOException; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,870,638 |
public void removeTimedDimension(String timedDimension) throws HiveException {
if (timedDimension == null || timedDimension.isEmpty()) {
throw new HiveException("Invalid timed dimension " + timedDimension);
}
timedDimension = timedDimension.toLowerCase();
Set<String> timeDims = getTimedDimensions();
if (timeDims != null && timeDims.contains(timedDimension)) {
timeDims.remove(timedDimension);
getProperties().put(MetastoreUtil.getCubeTimedDimensionListKey(getName()), StringUtils.join(timeDims, ","));
}
} | void function(String timedDimension) throws HiveException { if (timedDimension == null timedDimension.isEmpty()) { throw new HiveException(STR + timedDimension); } timedDimension = timedDimension.toLowerCase(); Set<String> timeDims = getTimedDimensions(); if (timeDims != null && timeDims.contains(timedDimension)) { timeDims.remove(timedDimension); getProperties().put(MetastoreUtil.getCubeTimedDimensionListKey(getName()), StringUtils.join(timeDims, ",")); } } | /**
* Removes the timed dimension
*
* @param timedDimension
* @throws HiveException
*/ | Removes the timed dimension | removeTimedDimension | {
"repo_name": "prongs/grill",
"path": "lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java",
"license": "apache-2.0",
"size": 13710
} | [
"java.util.Set",
"org.apache.commons.lang.StringUtils",
"org.apache.hadoop.hive.ql.metadata.HiveException"
] | import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.hive.ql.metadata.HiveException; | import java.util.*; import org.apache.commons.lang.*; import org.apache.hadoop.hive.ql.metadata.*; | [
"java.util",
"org.apache.commons",
"org.apache.hadoop"
] | java.util; org.apache.commons; org.apache.hadoop; | 698,865 |
public boolean clearQueues() throws EventException; | boolean function() throws EventException; | /**
* Clear both the submission and the status queues of any pending jobs
*
* @throws EventException if cannot access consumer.
*/ | Clear both the submission and the status queues of any pending jobs | clearQueues | {
"repo_name": "AnthonyHullDiamond/scanning",
"path": "org.eclipse.scanning.api/src/org/eclipse/scanning/api/event/queues/IQueue.java",
"license": "epl-1.0",
"size": 4328
} | [
"org.eclipse.scanning.api.event.EventException"
] | import org.eclipse.scanning.api.event.EventException; | import org.eclipse.scanning.api.event.*; | [
"org.eclipse.scanning"
] | org.eclipse.scanning; | 1,274,643 |
public void setWidth(float width) throws DOMException {
this.w = width;
reset();
} | void function(float width) throws DOMException { this.w = width; reset(); } | /**
* <b>DOM</b>: Implements {@link SVGRect#setWidth(float)}.
*/ | DOM: Implements <code>SVGRect#setWidth(float)</code> | setWidth | {
"repo_name": "git-moss/Push2Display",
"path": "lib/batik-1.8/sources/org/apache/batik/anim/dom/SVGOMAnimatedRect.java",
"license": "lgpl-3.0",
"size": 11359
} | [
"org.w3c.dom.DOMException"
] | import org.w3c.dom.DOMException; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,092,834 |
public String getFormulaString() throws RemoteException; | String function() throws RemoteException; | /**
* Get the formaula for this coverage goal.
*
* @return A string representing the formula of this coverage goal.
*
* @throws RemoteException
* remote communication problem
*/ | Get the formaula for this coverage goal | getFormulaString | {
"repo_name": "jenkinsci/piketec-tpt-plugin",
"path": "src/main/java/com/piketec/tpt/api/tasmo/TasmoCoverageGoal.java",
"license": "mit",
"size": 2436
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 773,370 |
public void test_datatype_unknown() {
fixture.datatypeLiteral2key(new URIImpl("http://www.bigdata.com/foo"),
"foo");
}
| void function() { fixture.datatypeLiteral2key(new URIImpl(STRfoo"); } | /**
* Verify an unknown datatype URI is coded.
*/ | Verify an unknown datatype URI is coded | test_datatype_unknown | {
"repo_name": "blazegraph/database",
"path": "bigdata-rdf-test/src/test/java/com/bigdata/rdf/lexicon/TestLexiconKeyBuilder.java",
"license": "gpl-2.0",
"size": 22639
} | [
"org.openrdf.model.impl.URIImpl"
] | import org.openrdf.model.impl.URIImpl; | import org.openrdf.model.impl.*; | [
"org.openrdf.model"
] | org.openrdf.model; | 1,835,541 |
public void restoreData(Player player) {
String lowerName = player.getName().toLowerCase();
LimboPlayer limbo = entries.remove(lowerName);
if (limbo == null) {
logger.debug("No LimboPlayer found for `{0}` - cannot restore", lowerName);
} else {
player.setOp(limbo.isOperator());
settings.getProperty(RESTORE_ALLOW_FLIGHT).restoreAllowFlight(player, limbo);
settings.getProperty(RESTORE_FLY_SPEED).restoreFlySpeed(player, limbo);
settings.getProperty(RESTORE_WALK_SPEED).restoreWalkSpeed(player, limbo);
limbo.clearTasks();
logger.debug("Restored LimboPlayer stats for `{0}`", lowerName);
persistence.removeLimboPlayer(player);
}
authGroupHandler.setGroup(player, limbo, AuthGroupType.LOGGED_IN);
} | void function(Player player) { String lowerName = player.getName().toLowerCase(); LimboPlayer limbo = entries.remove(lowerName); if (limbo == null) { logger.debug(STR, lowerName); } else { player.setOp(limbo.isOperator()); settings.getProperty(RESTORE_ALLOW_FLIGHT).restoreAllowFlight(player, limbo); settings.getProperty(RESTORE_FLY_SPEED).restoreFlySpeed(player, limbo); settings.getProperty(RESTORE_WALK_SPEED).restoreWalkSpeed(player, limbo); limbo.clearTasks(); logger.debug(STR, lowerName); persistence.removeLimboPlayer(player); } authGroupHandler.setGroup(player, limbo, AuthGroupType.LOGGED_IN); } | /**
* Restores the limbo data and subsequently deletes the entry.
* <p>
* Note that teleportation on the player is performed by {@link fr.xephi.authme.service.TeleportationService} and
* changing the permission group is handled by {@link fr.xephi.authme.data.limbo.AuthGroupHandler}.
*
* @param player the player whose data should be restored
*/ | Restores the limbo data and subsequently deletes the entry. Note that teleportation on the player is performed by <code>fr.xephi.authme.service.TeleportationService</code> and changing the permission group is handled by <code>fr.xephi.authme.data.limbo.AuthGroupHandler</code> | restoreData | {
"repo_name": "AuthMe/AuthMeReloaded",
"path": "src/main/java/fr/xephi/authme/data/limbo/LimboService.java",
"license": "gpl-3.0",
"size": 7263
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 258,098 |
public DateTime usageEnd() {
return this.usageEnd;
} | DateTime function() { return this.usageEnd; } | /**
* Get the usageEnd value.
*
* @return the usageEnd value
*/ | Get the usageEnd value | usageEnd | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-consumption/src/main/java/com/microsoft/azure/management/consumption/implementation/UsageDetailInner.java",
"license": "mit",
"size": 6548
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,648,490 |
@Override
public List<CoordinatorJob> getCoordJobsInfo(String filter, int start, int len) throws OozieClientException {
try {
CoordinatorJobInfo info = coordEngine.getCoordJobs(filter, start, len);
List<CoordinatorJob> jobs = new ArrayList<CoordinatorJob>();
List<CoordinatorJobBean> jobBeans = info.getCoordJobs();
for (CoordinatorJobBean jobBean : jobBeans) {
jobs.add(jobBean);
}
return jobs;
}
catch (CoordinatorEngineException ex) {
throw new OozieClientException(ex.getErrorCode().toString(), ex);
}
} | List<CoordinatorJob> function(String filter, int start, int len) throws OozieClientException { try { CoordinatorJobInfo info = coordEngine.getCoordJobs(filter, start, len); List<CoordinatorJob> jobs = new ArrayList<CoordinatorJob>(); List<CoordinatorJobBean> jobBeans = info.getCoordJobs(); for (CoordinatorJobBean jobBean : jobBeans) { jobs.add(jobBean); } return jobs; } catch (CoordinatorEngineException ex) { throw new OozieClientException(ex.getErrorCode().toString(), ex); } } | /**
* Return the info of the coordinator jobs that match the filter.
*
* @param filter job filter. Refer to the {@link OozieClient} for the filter
* syntax.
* @param start jobs offset, base 1.
* @param len number of jobs to return.
* @return a list with the coordinator jobs info
* @throws OozieClientException thrown if the jobs info could not be
* retrieved.
*/ | Return the info of the coordinator jobs that match the filter | getCoordJobsInfo | {
"repo_name": "sunmeng007/oozie",
"path": "core/src/main/java/org/apache/oozie/LocalOozieClientCoord.java",
"license": "apache-2.0",
"size": 14269
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.oozie.client.CoordinatorJob",
"org.apache.oozie.client.OozieClientException"
] | import java.util.ArrayList; import java.util.List; import org.apache.oozie.client.CoordinatorJob; import org.apache.oozie.client.OozieClientException; | import java.util.*; import org.apache.oozie.client.*; | [
"java.util",
"org.apache.oozie"
] | java.util; org.apache.oozie; | 2,075,172 |
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
public Subscription[] getAllLocalTempQueueSubscriptions() throws BrokerManagerAdminException {
List<Subscription> allSubscriptions = new ArrayList<Subscription>();
Subscription[] subscriptionsDTO;
try {
SubscriptionManagerService subscriptionManagerService =
AndesBrokerManagerAdminServiceDSHolder.getInstance().getSubscriptionManagerService();
List<org.wso2.carbon.andes.core.types.Subscription> subscriptions = subscriptionManagerService
.getAllLocalTempQueueSubscriptions();
subscriptionsDTO = new Subscription[subscriptions.size()];
for (org.wso2.carbon.andes.core.types.Subscription sub : subscriptions) {
Subscription subscriptionDTO = new Subscription();
subscriptionDTO.setSubscriptionIdentifier(sub.getSubscriptionIdentifier());
subscriptionDTO.setSubscribedQueueOrTopicName(sub.getSubscribedQueueOrTopicName());
subscriptionDTO.setSubscriberQueueBoundExchange(sub.getSubscriberQueueBoundExchange());
subscriptionDTO.setSubscriberQueueName(sub.getSubscriberQueueName());
subscriptionDTO.setDurable(sub.isDurable());
subscriptionDTO.setActive(sub.isActive());
subscriptionDTO.setNumberOfMessagesRemainingForSubscriber(
sub.getNumberOfMessagesRemainingForSubscriber());
subscriptionDTO.setSubscriberNodeAddress(sub.getSubscriberNodeAddress());
allSubscriptions.add(subscriptionDTO);
}
CustomSubscriptionComparator comparator = new CustomSubscriptionComparator();
Collections.sort(allSubscriptions, Collections.reverseOrder(comparator));
allSubscriptions.toArray(subscriptionsDTO);
} catch (SubscriptionManagerException e) {
String errorMessage = e.getMessage();
log.error(errorMessage, e);
throw new BrokerManagerAdminException(errorMessage, e);
}
return subscriptionsDTO;
} | @SuppressWarnings(STR) Subscription[] function() throws BrokerManagerAdminException { List<Subscription> allSubscriptions = new ArrayList<Subscription>(); Subscription[] subscriptionsDTO; try { SubscriptionManagerService subscriptionManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance().getSubscriptionManagerService(); List<org.wso2.carbon.andes.core.types.Subscription> subscriptions = subscriptionManagerService .getAllLocalTempQueueSubscriptions(); subscriptionsDTO = new Subscription[subscriptions.size()]; for (org.wso2.carbon.andes.core.types.Subscription sub : subscriptions) { Subscription subscriptionDTO = new Subscription(); subscriptionDTO.setSubscriptionIdentifier(sub.getSubscriptionIdentifier()); subscriptionDTO.setSubscribedQueueOrTopicName(sub.getSubscribedQueueOrTopicName()); subscriptionDTO.setSubscriberQueueBoundExchange(sub.getSubscriberQueueBoundExchange()); subscriptionDTO.setSubscriberQueueName(sub.getSubscriberQueueName()); subscriptionDTO.setDurable(sub.isDurable()); subscriptionDTO.setActive(sub.isActive()); subscriptionDTO.setNumberOfMessagesRemainingForSubscriber( sub.getNumberOfMessagesRemainingForSubscriber()); subscriptionDTO.setSubscriberNodeAddress(sub.getSubscriberNodeAddress()); allSubscriptions.add(subscriptionDTO); } CustomSubscriptionComparator comparator = new CustomSubscriptionComparator(); Collections.sort(allSubscriptions, Collections.reverseOrder(comparator)); allSubscriptions.toArray(subscriptionsDTO); } catch (SubscriptionManagerException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new BrokerManagerAdminException(errorMessage, e); } return subscriptionsDTO; } | /**
* Gets all local temporary queue subscriptions
* Suppressing 'MismatchedQueryAndUpdateOfCollection' as 'allSubscriptions' is used to convert
* to an array.
*
* @return An array of {@link Subscription}.
* @throws BrokerManagerAdminException
*/ | Gets all local temporary queue subscriptions Suppressing 'MismatchedQueryAndUpdateOfCollection' as 'allSubscriptions' is used to convert to an array | getAllLocalTempQueueSubscriptions | {
"repo_name": "ThilankaBowala/carbon-business-messaging",
"path": "components/andes/org.wso2.carbon.andes.admin/src/main/java/org/wso2/carbon/andes/admin/AndesAdminService.java",
"license": "apache-2.0",
"size": 57298
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.wso2.carbon.andes.admin.internal.Exception",
"org.wso2.carbon.andes.admin.internal.Subscription",
"org.wso2.carbon.andes.admin.util.AndesBrokerManagerAdminServiceDSHolder",
"org.wso2.carbon.andes.core.SubscriptionManagerException",
... | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.wso2.carbon.andes.admin.internal.Exception; import org.wso2.carbon.andes.admin.internal.Subscription; import org.wso2.carbon.andes.admin.util.AndesBrokerManagerAdminServiceDSHolder; import org.wso2.carbon.andes.core.SubscriptionManagerException; import org.wso2.carbon.andes.core.SubscriptionManagerService; | import java.util.*; import org.wso2.carbon.andes.admin.internal.*; import org.wso2.carbon.andes.admin.util.*; import org.wso2.carbon.andes.core.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 234,573 |
@SuppressWarnings("unchecked")
public static <T> T decode(InputStream in) throws IOException, JSONException {
return (T)newInstance().parse(in);
}
| @SuppressWarnings(STR) static <T> T function(InputStream in) throws IOException, JSONException { return (T)newInstance().parse(in); } | /**
* Decodes a json stream into a object. (character encoding should be Unicode)
*
* @param in a json stream to decode
* @return a decoded object
* @throws IOException if I/O error occurred.
* @throws JSONException if error occurred when parsing.
*/ | Decodes a json stream into a object. (character encoding should be Unicode) | decode | {
"repo_name": "ryokato/ENdoSnipe",
"path": "Javelin/src/main/jsonic/jp/co/acroquest/jsonic/JSON.java",
"license": "mit",
"size": 70774
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,209,033 |
public Complex parse(String source, ParsePosition pos) {
int initialIndex = pos.getIndex();
// parse whitespace
parseAndIgnoreWhitespace(source, pos);
// parse real
Number re = parseNumber(source, getRealFormat(), pos);
if (re == null) {
// invalid real number
// set index back to initial, error index should already be set
pos.setIndex(initialIndex);
return null;
}
// parse sign
int startIndex = pos.getIndex();
char c = parseNextCharacter(source, pos);
int sign = 0;
switch (c) {
case 0 :
// no sign
// return real only complex number
return new Complex(re.doubleValue(), 0.0);
case '-' :
sign = -1;
break;
case '+' :
sign = 1;
break;
default :
// invalid sign
// set index back to initial, error index should be the last
// character examined.
pos.setIndex(initialIndex);
pos.setErrorIndex(startIndex);
return null;
}
// parse whitespace
parseAndIgnoreWhitespace(source, pos);
// parse imaginary
Number im = parseNumber(source, getRealFormat(), pos);
if (im == null) {
// invalid imaginary number
// set index back to initial, error index should already be set
pos.setIndex(initialIndex);
return null;
}
// parse imaginary character
if (!parseFixedstring(source, getImaginaryCharacter(), pos)) {
return null;
}
return new Complex(re.doubleValue(), im.doubleValue() * sign);
} | Complex function(String source, ParsePosition pos) { int initialIndex = pos.getIndex(); parseAndIgnoreWhitespace(source, pos); Number re = parseNumber(source, getRealFormat(), pos); if (re == null) { pos.setIndex(initialIndex); return null; } int startIndex = pos.getIndex(); char c = parseNextCharacter(source, pos); int sign = 0; switch (c) { case 0 : return new Complex(re.doubleValue(), 0.0); case '-' : sign = -1; break; case '+' : sign = 1; break; default : pos.setIndex(initialIndex); pos.setErrorIndex(startIndex); return null; } parseAndIgnoreWhitespace(source, pos); Number im = parseNumber(source, getRealFormat(), pos); if (im == null) { pos.setIndex(initialIndex); return null; } if (!parseFixedstring(source, getImaginaryCharacter(), pos)) { return null; } return new Complex(re.doubleValue(), im.doubleValue() * sign); } | /**
* Parses a string to produce a {@link Complex} object.
*
* @param source the string to parse
* @param pos input/ouput parsing parameter.
* @return the parsed {@link Complex} object.
*/ | Parses a string to produce a <code>Complex</code> object | parse | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_63/src/main/java/org/apache/commons/math/complex/ComplexFormat.java",
"license": "gpl-2.0",
"size": 13342
} | [
"java.text.ParsePosition"
] | import java.text.ParsePosition; | import java.text.*; | [
"java.text"
] | java.text; | 754,249 |
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case mclevmcadPackage.MMCA_DEPLOYMENT: {
MMCADeployment mmcaDeployment = (MMCADeployment)theEObject;
T result = caseMMCADeployment(mmcaDeployment);
if (result == null) result = caseMMCLEVMCADPackageElement(mmcaDeployment);
if (result == null) result = caseMCommonPackageElement(mmcaDeployment);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MSERVICE_LIBRARY_INSTANCE: {
MServiceLibraryInstance mServiceLibraryInstance = (MServiceLibraryInstance)theEObject;
T result = caseMServiceLibraryInstance(mServiceLibraryInstance);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MDRIVER_SLIB_INSTANCE: {
MDriverSLibInstance mDriverSLibInstance = (MDriverSLibInstance)theEObject;
T result = caseMDriverSLibInstance(mDriverSLibInstance);
if (result == null) result = caseMServiceLibraryInstance(mDriverSLibInstance);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MDEVICE_DRIVER_MAPPING: {
MDeviceDriverMapping mDeviceDriverMapping = (MDeviceDriverMapping)theEObject;
T result = caseMDeviceDriverMapping(mDeviceDriverMapping);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MCOMPONENT_INSTANCE: {
MComponentInstance mComponentInstance = (MComponentInstance)theEObject;
T result = caseMComponentInstance(mComponentInstance);
if (result == null) result = caseMCommonReferenceableObj(mComponentInstance);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MDEPLOYMENT_ALTERNATIVE: {
MDeploymentAlternative mDeploymentAlternative = (MDeploymentAlternative)theEObject;
T result = caseMDeploymentAlternative(mDeploymentAlternative);
if (result == null) result = caseMCommonReferenceableObj(mDeploymentAlternative);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MCONNECTION: {
MConnection mConnection = (MConnection)theEObject;
T result = caseMConnection(mConnection);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MCOMMON_CONNECTION: {
MCommonConnection mCommonConnection = (MCommonConnection)theEObject;
T result = caseMCommonConnection(mCommonConnection);
if (result == null) result = caseMConnection(mCommonConnection);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MCONNECTION_SWITCH: {
MConnectionSwitch mConnectionSwitch = (MConnectionSwitch)theEObject;
T result = caseMConnectionSwitch(mConnectionSwitch);
if (result == null) result = caseMConnection(mConnectionSwitch);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MCONNECTION_SWITCH_CASE: {
MConnectionSwitchCase mConnectionSwitchCase = (MConnectionSwitchCase)theEObject;
T result = caseMConnectionSwitchCase(mConnectionSwitchCase);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MDEPLOYMENT_PLATFORM: {
MDeploymentPlatform mDeploymentPlatform = (MDeploymentPlatform)theEObject;
T result = caseMDeploymentPlatform(mDeploymentPlatform);
if (result == null) result = caseMCommonReferenceableObj(mDeploymentPlatform);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MDEPLOYED_DEVICE: {
MDeployedDevice mDeployedDevice = (MDeployedDevice)theEObject;
T result = caseMDeployedDevice(mDeployedDevice);
if (result == null) result = caseMCommonReferenceableObj(mDeployedDevice);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MMCLEVMCAD_PACKAGE_FILE: {
MMCLEVMCADPackageFile mmclevmcadPackageFile = (MMCLEVMCADPackageFile)theEObject;
T result = caseMMCLEVMCADPackageFile(mmclevmcadPackageFile);
if (result == null) result = caseMCommonPackageFile(mmclevmcadPackageFile);
if (result == null) result = defaultCase(theEObject);
return result;
}
case mclevmcadPackage.MMCLEVMCAD_PACKAGE_ELEMENT: {
MMCLEVMCADPackageElement mmclevmcadPackageElement = (MMCLEVMCADPackageElement)theEObject;
T result = caseMMCLEVMCADPackageElement(mmclevmcadPackageElement);
if (result == null) result = caseMCommonPackageElement(mmclevmcadPackageElement);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
} | T function(int classifierID, EObject theEObject) { switch (classifierID) { case mclevmcadPackage.MMCA_DEPLOYMENT: { MMCADeployment mmcaDeployment = (MMCADeployment)theEObject; T result = caseMMCADeployment(mmcaDeployment); if (result == null) result = caseMMCLEVMCADPackageElement(mmcaDeployment); if (result == null) result = caseMCommonPackageElement(mmcaDeployment); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MSERVICE_LIBRARY_INSTANCE: { MServiceLibraryInstance mServiceLibraryInstance = (MServiceLibraryInstance)theEObject; T result = caseMServiceLibraryInstance(mServiceLibraryInstance); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MDRIVER_SLIB_INSTANCE: { MDriverSLibInstance mDriverSLibInstance = (MDriverSLibInstance)theEObject; T result = caseMDriverSLibInstance(mDriverSLibInstance); if (result == null) result = caseMServiceLibraryInstance(mDriverSLibInstance); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MDEVICE_DRIVER_MAPPING: { MDeviceDriverMapping mDeviceDriverMapping = (MDeviceDriverMapping)theEObject; T result = caseMDeviceDriverMapping(mDeviceDriverMapping); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MCOMPONENT_INSTANCE: { MComponentInstance mComponentInstance = (MComponentInstance)theEObject; T result = caseMComponentInstance(mComponentInstance); if (result == null) result = caseMCommonReferenceableObj(mComponentInstance); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MDEPLOYMENT_ALTERNATIVE: { MDeploymentAlternative mDeploymentAlternative = (MDeploymentAlternative)theEObject; T result = caseMDeploymentAlternative(mDeploymentAlternative); if (result == null) result = caseMCommonReferenceableObj(mDeploymentAlternative); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MCONNECTION: { MConnection mConnection = (MConnection)theEObject; T result = caseMConnection(mConnection); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MCOMMON_CONNECTION: { MCommonConnection mCommonConnection = (MCommonConnection)theEObject; T result = caseMCommonConnection(mCommonConnection); if (result == null) result = caseMConnection(mCommonConnection); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MCONNECTION_SWITCH: { MConnectionSwitch mConnectionSwitch = (MConnectionSwitch)theEObject; T result = caseMConnectionSwitch(mConnectionSwitch); if (result == null) result = caseMConnection(mConnectionSwitch); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MCONNECTION_SWITCH_CASE: { MConnectionSwitchCase mConnectionSwitchCase = (MConnectionSwitchCase)theEObject; T result = caseMConnectionSwitchCase(mConnectionSwitchCase); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MDEPLOYMENT_PLATFORM: { MDeploymentPlatform mDeploymentPlatform = (MDeploymentPlatform)theEObject; T result = caseMDeploymentPlatform(mDeploymentPlatform); if (result == null) result = caseMCommonReferenceableObj(mDeploymentPlatform); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MDEPLOYED_DEVICE: { MDeployedDevice mDeployedDevice = (MDeployedDevice)theEObject; T result = caseMDeployedDevice(mDeployedDevice); if (result == null) result = caseMCommonReferenceableObj(mDeployedDevice); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MMCLEVMCAD_PACKAGE_FILE: { MMCLEVMCADPackageFile mmclevmcadPackageFile = (MMCLEVMCADPackageFile)theEObject; T result = caseMMCLEVMCADPackageFile(mmclevmcadPackageFile); if (result == null) result = caseMCommonPackageFile(mmclevmcadPackageFile); if (result == null) result = defaultCase(theEObject); return result; } case mclevmcadPackage.MMCLEVMCAD_PACKAGE_ELEMENT: { MMCLEVMCADPackageElement mmclevmcadPackageElement = (MMCLEVMCADPackageElement)theEObject; T result = caseMMCLEVMCADPackageElement(mmclevmcadPackageElement); if (result == null) result = caseMCommonPackageElement(mmclevmcadPackageElement); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } | /**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/ | Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result | doSwitch | {
"repo_name": "parraman/micobs",
"path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevmcad/util/mclevmcadSwitch.java",
"license": "epl-1.0",
"size": 15477
} | [
"es.uah.aut.srg.micobs.mclev.mclevmcad.MCommonConnection",
"es.uah.aut.srg.micobs.mclev.mclevmcad.MComponentInstance",
"es.uah.aut.srg.micobs.mclev.mclevmcad.MConnection",
"es.uah.aut.srg.micobs.mclev.mclevmcad.MConnectionSwitch",
"es.uah.aut.srg.micobs.mclev.mclevmcad.MConnectionSwitchCase",
"es.uah.aut.... | import es.uah.aut.srg.micobs.mclev.mclevmcad.MCommonConnection; import es.uah.aut.srg.micobs.mclev.mclevmcad.MComponentInstance; import es.uah.aut.srg.micobs.mclev.mclevmcad.MConnection; import es.uah.aut.srg.micobs.mclev.mclevmcad.MConnectionSwitch; import es.uah.aut.srg.micobs.mclev.mclevmcad.MConnectionSwitchCase; import es.uah.aut.srg.micobs.mclev.mclevmcad.MDeployedDevice; import es.uah.aut.srg.micobs.mclev.mclevmcad.MDeploymentAlternative; import es.uah.aut.srg.micobs.mclev.mclevmcad.MDeploymentPlatform; import es.uah.aut.srg.micobs.mclev.mclevmcad.MDeviceDriverMapping; import es.uah.aut.srg.micobs.mclev.mclevmcad.MDriverSLibInstance; import es.uah.aut.srg.micobs.mclev.mclevmcad.MMCADeployment; import es.uah.aut.srg.micobs.mclev.mclevmcad.MMCLEVMCADPackageElement; import es.uah.aut.srg.micobs.mclev.mclevmcad.MMCLEVMCADPackageFile; import es.uah.aut.srg.micobs.mclev.mclevmcad.MServiceLibraryInstance; import org.eclipse.emf.ecore.EObject; | import es.uah.aut.srg.micobs.mclev.mclevmcad.*; import org.eclipse.emf.ecore.*; | [
"es.uah.aut",
"org.eclipse.emf"
] | es.uah.aut; org.eclipse.emf; | 2,461,723 |
public final void pushSubContextList(SubContextList iter)
{
m_axesIteratorStack.push(iter);
} | final void function(SubContextList iter) { m_axesIteratorStack.push(iter); } | /**
* Push a TreeWalker on the stack.
*
* @param iter A sub-context AxesWalker.
* @xsl.usage internal
*/ | Push a TreeWalker on the stack | pushSubContextList | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xpath/internal/XPathContext.java",
"license": "apache-2.0",
"size": 41010
} | [
"com.sun.org.apache.xpath.internal.axes.SubContextList"
] | import com.sun.org.apache.xpath.internal.axes.SubContextList; | import com.sun.org.apache.xpath.internal.axes.*; | [
"com.sun.org"
] | com.sun.org; | 2,062,730 |
public void filterAndSort(SettingUtil.TypeFilterMethod typeFilterMethod,
SettingUtil.ResultFilterMethod resultFilterMethod,
SettingUtil.SortOrder sortOrder,
List<PortalDetail> origin,
List<PortalDetail> edit){
filterPortalDetails(typeFilterMethod, resultFilterMethod, origin, edit);
sortPortalDetails(sortOrder, edit);
} | void function(SettingUtil.TypeFilterMethod typeFilterMethod, SettingUtil.ResultFilterMethod resultFilterMethod, SettingUtil.SortOrder sortOrder, List<PortalDetail> origin, List<PortalDetail> edit){ filterPortalDetails(typeFilterMethod, resultFilterMethod, origin, edit); sortPortalDetails(sortOrder, edit); } | /**
* To sort and filter origin and store result to edit.
* @param typeFilterMethod the type filter mehod to use.
* @param resultFilterMethod the result filter method to use.
* @param sortOrder the sort order to use.
* @param origin the origin list.
* @param edit the result list.
*/ | To sort and filter origin and store result to edit | filterAndSort | {
"repo_name": "GhostFlying/PortalWaitingList",
"path": "app/src/main/java/com/ghostflying/portalwaitinglist/util/MailProcessUtil.java",
"license": "gpl-3.0",
"size": 17323
} | [
"com.ghostflying.portalwaitinglist.model.PortalDetail",
"java.util.List"
] | import com.ghostflying.portalwaitinglist.model.PortalDetail; import java.util.List; | import com.ghostflying.portalwaitinglist.model.*; import java.util.*; | [
"com.ghostflying.portalwaitinglist",
"java.util"
] | com.ghostflying.portalwaitinglist; java.util; | 2,715,173 |
public void initializeDefaults() {
int pos = 0;
// getCheckBoxAsk().setSelected(((Boolean) Configuration.getDefaultValue("overviews_ask_before_loading")).booleanValue());
pos = ((Integer) Configuration.getDefaultValue("overviews_number")).intValue() - 2;
if ((pos < 0) || (pos >= getComboNumber().getItemCount()))
pos = 2;
getComboNumber().setSelectedIndex(pos);
pos = ((Integer) Configuration.getDefaultValue("overviews_rate")).intValue() - 2;
if ((pos < 0) || (pos >= getComboRate().getItemCount()))
pos = 0;
getComboRate().setSelectedIndex(pos);
pos = ((Integer) Configuration.getDefaultValue("overviews_resampling_algorithm")).intValue();
int type = 1;
switch (pos) {
case Jaddo.NEAREST:
type = 0;
break;
case Jaddo.AVERAGE_MAGPHASE:
type = 2;
break;
}
getComboAlgorithm().setSelectedIndex(type);
}
| void function() { int pos = 0; pos = ((Integer) Configuration.getDefaultValue(STR)).intValue() - 2; if ((pos < 0) (pos >= getComboNumber().getItemCount())) pos = 2; getComboNumber().setSelectedIndex(pos); pos = ((Integer) Configuration.getDefaultValue(STR)).intValue() - 2; if ((pos < 0) (pos >= getComboRate().getItemCount())) pos = 0; getComboRate().setSelectedIndex(pos); pos = ((Integer) Configuration.getDefaultValue(STR)).intValue(); int type = 1; switch (pos) { case Jaddo.NEAREST: type = 0; break; case Jaddo.AVERAGE_MAGPHASE: type = 2; break; } getComboAlgorithm().setSelectedIndex(type); } | /**
* Carga los valores por defecto del componente
*/ | Carga los valores por defecto del componente | initializeDefaults | {
"repo_name": "iCarto/siga",
"path": "extRasterTools-SE/src/org/gvsig/raster/gui/preferences/panels/PreferenceOverviews.java",
"license": "gpl-3.0",
"size": 9309
} | [
"org.gvsig.addo.Jaddo",
"org.gvsig.raster.Configuration"
] | import org.gvsig.addo.Jaddo; import org.gvsig.raster.Configuration; | import org.gvsig.addo.*; import org.gvsig.raster.*; | [
"org.gvsig.addo",
"org.gvsig.raster"
] | org.gvsig.addo; org.gvsig.raster; | 2,871,711 |
public static Random getRandom() {
return random;
} | static Random function() { return random; } | /**
* Needed for call to Collections.shuffle
*
* @return
*/ | Needed for call to Collections.shuffle | getRandom | {
"repo_name": "nevik/constraint-relationships-csemiring",
"path": "src/de/uniaugsburg/isse/constraints/random/RandomManager.java",
"license": "mit",
"size": 2558
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 1,376,355 |
ScriptCallback createFigure(SecurityContext ctx, List<Long> objectIDs,
Class type, FigureParam param, long userID)
throws ProcessException, DSOutOfServiceException, DSAccessException
{
long id = getScriptID(ctx, param.getScriptName(),
"Cannot start "+param.getScriptName());
if (id <= 0) return null;
int scriptIndex = param.getIndex();
List<RType> ids = new ArrayList<RType>(objectIDs.size());
Iterator<Long> i = objectIDs.iterator();
while (i.hasNext())
ids.add(omero.rtypes.rlong(i.next()));
Map<String, RType> map = new HashMap<String, RType>();
RString dataType;
dataType = omero.rtypes.rstring("Image");
if (DatasetData.class.equals(type)) {
dataType = omero.rtypes.rstring("Dataset");
}
map.put("Data_Type", dataType);
switch (scriptIndex) {
case FigureParam.THUMBNAILS:
DataObject d = (DataObject) param.getAnchor();
long parentID = -1;
if (d instanceof DatasetData ||
d instanceof ProjectData) parentID = d.getId();
//map.put("Data_Type", dataType);
map.put("IDs", omero.rtypes.rlist(ids));
List<Long> tags = param.getTags();
if (tags != null && tags.size() > 0) {
ids = new ArrayList<RType>(tags.size());
i = tags.iterator();
while (i.hasNext())
ids.add(omero.rtypes.rlong(i.next()));
map.put("Tag_IDs", omero.rtypes.rlist(ids));
}
if (parentID > 0)
map.put("Parent_ID", omero.rtypes.rlong(parentID));
map.put("Show_Untagged_Images",
omero.rtypes.rbool(param.isIncludeUntagged()));
map.put("Thumbnail_Size", omero.rtypes.rint(param.getWidth()));
map.put("Max_Columns", omero.rtypes.rint(
param.getMaxPerColumn()));
map.put("Format",
omero.rtypes.rstring(param.getFormatAsString()));
map.put("Figure_Name",
omero.rtypes.rstring(param.getName()));
return runScript(ctx, id, map);
case FigureParam.MOVIE:
map.put("Max_Columns",
omero.rtypes.rint(param.getMaxPerColumn()));
}
//merge channels
Iterator j;
Map<String, RType> merge = new LinkedHashMap<String, RType>();
Entry entry;
Map<Integer, Integer> mergeChannels = param.getMergeChannels();
if (mergeChannels != null) {
j = mergeChannels.entrySet().iterator();
while (j.hasNext()) {
entry = (Entry) j.next();
merge.put(""+(Integer) entry.getKey(),
omero.rtypes.rlong((Integer) entry.getValue()));
}
}
//split
Map<String, RType> split = new LinkedHashMap<String, RType>();
Map<Integer, String> splitChannels = param.getSplitChannels();
if (splitChannels != null) {
j = splitChannels.entrySet().iterator();
while (j.hasNext()) {
entry = (Entry) j.next();
split.put(""+(Integer) entry.getKey(),
omero.rtypes.rstring((String) entry.getValue()));
}
}
List<Integer> splitActive = param.getSplitActive();
if (splitActive != null && splitActive.size() > 0) {
List<RType> sa = new ArrayList<RType>(splitActive.size());
Iterator<Integer> k = splitActive.iterator();
while (k.hasNext()) {
sa.add(omero.rtypes.rint(k.next()));
}
map.put("Split_Indexes", omero.rtypes.rlist(sa));
}
map.put("Merged_Names", omero.rtypes.rbool(
param.getMergedLabel()));
map.put("IDs", omero.rtypes.rlist(ids));
if (param.getStartZ() >= 0)
map.put("Z_Start", omero.rtypes.rint(param.getStartZ()));
if (param.getEndZ() >= 0)
map.put("Z_End", omero.rtypes.rint(param.getEndZ()));
if (split.size() > 0)
map.put("Channel_Names", omero.rtypes.rmap(split));
if (merge.size() > 0)
map.put("Merged_Colours", omero.rtypes.rmap(merge));
if (scriptIndex == FigureParam.MOVIE) {
List<Integer> times = param.getTimepoints();
List<RType> ts = new ArrayList<RType>(objectIDs.size());
Iterator<Integer> k = times.iterator();
while (k.hasNext())
ts.add(omero.rtypes.rint(k.next()));
map.put("T_Indexes", omero.rtypes.rlist(ts));
map.put("Time_Units",
omero.rtypes.rstring(param.getTimeAsString()));
} else
map.put("Split_Panels_Grey",
omero.rtypes.rbool(param.isSplitGrey()));
if (param.getScaleBar() > 0)
map.put("Scalebar", omero.rtypes.rint(param.getScaleBar()));
map.put("Overlay_Colour", omero.rtypes.rstring(param.getColor()));
map.put("Width", omero.rtypes.rint(param.getWidth()));
map.put("Height", omero.rtypes.rint(param.getHeight()));
map.put("Stepping", omero.rtypes.rint(param.getStepping()));
map.put("Format", omero.rtypes.rstring(param.getFormatAsString()));
map.put("Algorithm",
omero.rtypes.rstring(param.getProjectionTypeAsString()));
map.put("Figure_Name",
omero.rtypes.rstring(param.getName()));
map.put("Image_Labels",
omero.rtypes.rstring(param.getLabelAsString()));
if (scriptIndex == FigureParam.SPLIT_VIEW_ROI) {
map.put("ROI_Zoom", omero.rtypes.rfloat((float)
param.getMagnificationFactor()));
}
return runScript(ctx, id, map);
} | ScriptCallback createFigure(SecurityContext ctx, List<Long> objectIDs, Class type, FigureParam param, long userID) throws ProcessException, DSOutOfServiceException, DSAccessException { long id = getScriptID(ctx, param.getScriptName(), STR+param.getScriptName()); if (id <= 0) return null; int scriptIndex = param.getIndex(); List<RType> ids = new ArrayList<RType>(objectIDs.size()); Iterator<Long> i = objectIDs.iterator(); while (i.hasNext()) ids.add(omero.rtypes.rlong(i.next())); Map<String, RType> map = new HashMap<String, RType>(); RString dataType; dataType = omero.rtypes.rstring("Image"); if (DatasetData.class.equals(type)) { dataType = omero.rtypes.rstring(STR); } map.put(STR, dataType); switch (scriptIndex) { case FigureParam.THUMBNAILS: DataObject d = (DataObject) param.getAnchor(); long parentID = -1; if (d instanceof DatasetData d instanceof ProjectData) parentID = d.getId(); map.put("IDs", omero.rtypes.rlist(ids)); List<Long> tags = param.getTags(); if (tags != null && tags.size() > 0) { ids = new ArrayList<RType>(tags.size()); i = tags.iterator(); while (i.hasNext()) ids.add(omero.rtypes.rlong(i.next())); map.put(STR, omero.rtypes.rlist(ids)); } if (parentID > 0) map.put(STR, omero.rtypes.rlong(parentID)); map.put(STR, omero.rtypes.rbool(param.isIncludeUntagged())); map.put(STR, omero.rtypes.rint(param.getWidth())); map.put(STR, omero.rtypes.rint( param.getMaxPerColumn())); map.put(STR, omero.rtypes.rstring(param.getFormatAsString())); map.put(STR, omero.rtypes.rstring(param.getName())); return runScript(ctx, id, map); case FigureParam.MOVIE: map.put(STR, omero.rtypes.rint(param.getMaxPerColumn())); } Iterator j; Map<String, RType> merge = new LinkedHashMap<String, RType>(); Entry entry; Map<Integer, Integer> mergeChannels = param.getMergeChannels(); if (mergeChannels != null) { j = mergeChannels.entrySet().iterator(); while (j.hasNext()) { entry = (Entry) j.next(); merge.put(STRSTRSplit_IndexesSTRMerged_NamesSTRIDsSTRZ_StartSTRZ_EndSTRChannel_NamesSTRMerged_ColoursSTRT_IndexesSTRTime_UnitsSTRSplit_Panels_GreySTRScalebarSTROverlay_ColourSTRWidthSTRHeightSTRStepping", omero.rtypes.rint(param.getStepping())); map.put(STR, omero.rtypes.rstring(param.getFormatAsString())); map.put("Algorithm", omero.rtypes.rstring(param.getProjectionTypeAsString())); map.put(STR, omero.rtypes.rstring(param.getName())); map.put("Image_LabelsSTRROI_Zoom", omero.rtypes.rfloat((float) param.getMagnificationFactor())); } return runScript(ctx, id, map); } | /**
* Creates a split view figure.
* Returns the id of the annotation hosting the figure.
*
* @param ctx The security context.
* @param objectIDs The id of the objects composing the figure.
* @param type The type of objects.
* @param param The parameters to use.
* @param userID The id of the user.
* @return See above.
* @throws DSOutOfServiceException If the connection is broken, or logged
* in.
* @throws DSAccessException If an error occurred while trying to
* retrieve data from OMEDS service.
* @throws ProcessException If an error occurred while running the script.
*/ | Creates a split view figure. Returns the id of the annotation hosting the figure | createFigure | {
"repo_name": "dpwrussell/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java",
"license": "gpl-2.0",
"size": 262581
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.Iterator",
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Map",
"org.openmicroscopy.shoola.env.data.model.FigureParam"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.openmicroscopy.shoola.env.data.model.FigureParam; | import java.util.*; import org.openmicroscopy.shoola.env.data.model.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 2,225,783 |
public List<String> getAllFAQAdmin() throws Exception; | List<String> function() throws Exception; | /**
* Gets all users who are administrators of FAQ.
*
* @throws Exception the exception
* @LevelAPI Platform
*/ | Gets all users who are administrators of FAQ | getAllFAQAdmin | {
"repo_name": "exoplatform/answers",
"path": "service/src/main/java/org/exoplatform/faq/service/FAQService.java",
"license": "lgpl-3.0",
"size": 36675
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,007,670 |
public static File getUserHome() {
return new File(System.getProperty(USER_HOME_KEY));
} | static File function() { return new File(System.getProperty(USER_HOME_KEY)); } | /**
* <p>
* Gets the user home directory as a <code>File</code>.
* </p>
*
* @return a directory
* @throws SecurityException if a security manager exists and its
* <code>checkPropertyAccess</code> method doesn't allow access to the specified system property.
* @see System#getProperty(String)
* @since 2.1
*/ | Gets the user home directory as a <code>File</code>. | getUserHome | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/commons-lang/org/apache/commons/lang/SystemUtils.java",
"license": "gpl-2.0",
"size": 61386
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,099,002 |
SerializerAdapter getSerializerAdapter() {
return this.serializerAdapter;
}
private final Duration defaultPollInterval; | SerializerAdapter getSerializerAdapter() { return this.serializerAdapter; } private final Duration defaultPollInterval; | /**
* Gets The serializer to serialize an object into a string.
*
* @return the serializerAdapter value.
*/ | Gets The serializer to serialize an object into a string | getSerializerAdapter | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datadog/azure-resourcemanager-datadog/src/main/java/com/azure/resourcemanager/datadog/implementation/MicrosoftDatadogClientImpl.java",
"license": "mit",
"size": 12266
} | [
"com.azure.core.util.serializer.SerializerAdapter",
"java.time.Duration"
] | import com.azure.core.util.serializer.SerializerAdapter; import java.time.Duration; | import com.azure.core.util.serializer.*; import java.time.*; | [
"com.azure.core",
"java.time"
] | com.azure.core; java.time; | 2,209,805 |
String write( T value, JsonSerializationContext ctx ) throws JsonSerializationException; | String write( T value, JsonSerializationContext ctx ) throws JsonSerializationException; | /**
* Writes an object to JSON.
*
* @param value Object to write
* @param ctx Context for the full writing process
* @throws com.github.nmorel.gwtjackson.client.exception.JsonSerializationException if an exception occurs while writing the output
* @return a {@link java.lang.String} object.
*/ | Writes an object to JSON | write | {
"repo_name": "nmorel/gwt-jackson",
"path": "gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ObjectWriter.java",
"license": "apache-2.0",
"size": 2262
} | [
"com.github.nmorel.gwtjackson.client.exception.JsonSerializationException"
] | import com.github.nmorel.gwtjackson.client.exception.JsonSerializationException; | import com.github.nmorel.gwtjackson.client.exception.*; | [
"com.github.nmorel"
] | com.github.nmorel; | 1,577,018 |
public PerformanceEvaluator<? super LearnedType, ? super Collection<? extends FoldDataType>, ? extends StatisticType> getPerformanceEvaluator()
{
return this.performanceEvaluator;
} | PerformanceEvaluator<? super LearnedType, ? super Collection<? extends FoldDataType>, ? extends StatisticType> function() { return this.performanceEvaluator; } | /**
* Gets the performance evaluator to apply to each fold.
*
* @return The performance evaluator to apply to each fold.
*/ | Gets the performance evaluator to apply to each fold | getPerformanceEvaluator | {
"repo_name": "codeaudit/Foundry",
"path": "Components/LearningCore/Source/gov/sandia/cognition/learning/experiment/LearnerComparisonExperiment.java",
"license": "bsd-3-clause",
"size": 17026
} | [
"gov.sandia.cognition.learning.performance.PerformanceEvaluator",
"java.util.Collection"
] | import gov.sandia.cognition.learning.performance.PerformanceEvaluator; import java.util.Collection; | import gov.sandia.cognition.learning.performance.*; import java.util.*; | [
"gov.sandia.cognition",
"java.util"
] | gov.sandia.cognition; java.util; | 271,852 |
@Override
public void onPasswordChanged(Context context, Intent intent) {
EmailBroadcastProcessorService.processDevicePolicyMessage(context,
DEVICE_ADMIN_MESSAGE_PASSWORD_CHANGED);
} | void function(Context context, Intent intent) { EmailBroadcastProcessorService.processDevicePolicyMessage(context, DEVICE_ADMIN_MESSAGE_PASSWORD_CHANGED); } | /**
* Called after the user has changed their password.
*/ | Called after the user has changed their password | onPasswordChanged | {
"repo_name": "craigacgomez/android_email_policy_patch",
"path": "packages/apps/Email/src/com/android/email/SecurityPolicy.java",
"license": "apache-2.0",
"size": 39754
} | [
"android.content.Context",
"android.content.Intent",
"com.android.email.service.EmailBroadcastProcessorService"
] | import android.content.Context; import android.content.Intent; import com.android.email.service.EmailBroadcastProcessorService; | import android.content.*; import com.android.email.service.*; | [
"android.content",
"com.android.email"
] | android.content; com.android.email; | 1,516,760 |
@Test
public void testLastTimestampDate() {
fail("Not yet implemented");
}
| void function() { fail(STR); } | /**
* Test method for {@link com.ycsoft.commons.helper.DateHelper#lastTimestampDate(java.util.Date)}.
*/ | Test method for <code>com.ycsoft.commons.helper.DateHelper#lastTimestampDate(java.util.Date)</code> | testLastTimestampDate | {
"repo_name": "leopardoooo/cambodia",
"path": "boss-core/src/test/java/test/ycsoft/commens/helper/TestDateHelper.java",
"license": "apache-2.0",
"size": 6435
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,376,507 |
public boolean validateAuthor_validateContextControlCode(Author author, DiagnosticChain diagnostics,
Map<Object, Object> context) {
return author.validateContextControlCode(diagnostics, context);
}
| boolean function(Author author, DiagnosticChain diagnostics, Map<Object, Object> context) { return author.validateContextControlCode(diagnostics, context); } | /**
* Validates the validateContextControlCode constraint of '<em>Author</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Validates the validateContextControlCode constraint of 'Author'. | validateAuthor_validateContextControlCode | {
"repo_name": "drbgfc/mdht",
"path": "cda/plugins/org.openhealthtools.mdht.uml.cda/src/org/openhealthtools/mdht/uml/cda/util/CDAValidator.java",
"license": "epl-1.0",
"size": 206993
} | [
"java.util.Map",
"org.eclipse.emf.common.util.DiagnosticChain",
"org.openhealthtools.mdht.uml.cda.Author"
] | import java.util.Map; import org.eclipse.emf.common.util.DiagnosticChain; import org.openhealthtools.mdht.uml.cda.Author; | import java.util.*; import org.eclipse.emf.common.util.*; import org.openhealthtools.mdht.uml.cda.*; | [
"java.util",
"org.eclipse.emf",
"org.openhealthtools.mdht"
] | java.util; org.eclipse.emf; org.openhealthtools.mdht; | 1,728,435 |
private void processFilter(FilteringObjective filt, boolean install,
ApplicationId applicationId) {
// This driver only processes filtering criteria defined with switch
// ports as the key
PortCriterion port;
if (!filt.key().equals(Criteria.dummy()) &&
filt.key().type() == Criterion.Type.IN_PORT) {
port = (PortCriterion) filt.key();
} else {
log.warn("No key defined in filtering objective from app: {}. Not"
+ "processing filtering objective", applicationId);
fail(filt, ObjectiveError.UNKNOWN);
return;
}
// convert filtering conditions for switch-intfs into flowrules
FlowRuleOperations.Builder ops = FlowRuleOperations.builder();
for (Criterion c : filt.conditions()) {
if (c.type() == Criterion.Type.ETH_DST) {
EthCriterion eth = (EthCriterion) c;
FlowRule.Builder rule = processEthFiler(filt, eth, port);
rule.forDevice(deviceId)
.fromApp(applicationId);
ops = install ? ops.add(rule.build()) : ops.remove(rule.build());
} else if (c.type() == Criterion.Type.VLAN_VID) {
VlanIdCriterion vlan = (VlanIdCriterion) c;
FlowRule.Builder rule = processVlanFiler(filt, vlan, port);
rule.forDevice(deviceId)
.fromApp(applicationId);
ops = install ? ops.add(rule.build()) : ops.remove(rule.build());
} else if (c.type() == Criterion.Type.IPV4_DST) {
IPCriterion ip = (IPCriterion) c;
FlowRule.Builder rule = processIpFilter(filt, ip, port);
rule.forDevice(deviceId)
.fromApp(applicationId);
ops = install ? ops.add(rule.build()) : ops.remove(rule.build());
} else {
log.warn("Driver does not currently process filtering condition"
+ " of type: {}", c.type());
fail(filt, ObjectiveError.UNSUPPORTED);
}
} | void function(FilteringObjective filt, boolean install, ApplicationId applicationId) { PortCriterion port; if (!filt.key().equals(Criteria.dummy()) && filt.key().type() == Criterion.Type.IN_PORT) { port = (PortCriterion) filt.key(); } else { log.warn(STR + STR, applicationId); fail(filt, ObjectiveError.UNKNOWN); return; } FlowRuleOperations.Builder ops = FlowRuleOperations.builder(); for (Criterion c : filt.conditions()) { if (c.type() == Criterion.Type.ETH_DST) { EthCriterion eth = (EthCriterion) c; FlowRule.Builder rule = processEthFiler(filt, eth, port); rule.forDevice(deviceId) .fromApp(applicationId); ops = install ? ops.add(rule.build()) : ops.remove(rule.build()); } else if (c.type() == Criterion.Type.VLAN_VID) { VlanIdCriterion vlan = (VlanIdCriterion) c; FlowRule.Builder rule = processVlanFiler(filt, vlan, port); rule.forDevice(deviceId) .fromApp(applicationId); ops = install ? ops.add(rule.build()) : ops.remove(rule.build()); } else if (c.type() == Criterion.Type.IPV4_DST) { IPCriterion ip = (IPCriterion) c; FlowRule.Builder rule = processIpFilter(filt, ip, port); rule.forDevice(deviceId) .fromApp(applicationId); ops = install ? ops.add(rule.build()) : ops.remove(rule.build()); } else { log.warn(STR + STR, c.type()); fail(filt, ObjectiveError.UNSUPPORTED); } } | /**
* Filter processing and installation.
* Processes and installs filtering rules.
*
* @param filt
* @param install
* @param applicationId
*/ | Filter processing and installation. Processes and installs filtering rules | processFilter | {
"repo_name": "sdnwiselab/onos",
"path": "drivers/hp/src/main/java/org/onosproject/drivers/hp/AbstractHPPipeline.java",
"license": "apache-2.0",
"size": 17330
} | [
"org.onosproject.core.ApplicationId",
"org.onosproject.net.flow.FlowRule",
"org.onosproject.net.flow.FlowRuleOperations",
"org.onosproject.net.flow.criteria.Criteria",
"org.onosproject.net.flow.criteria.Criterion",
"org.onosproject.net.flow.criteria.EthCriterion",
"org.onosproject.net.flow.criteria.IPCr... | import org.onosproject.core.ApplicationId; import org.onosproject.net.flow.FlowRule; import org.onosproject.net.flow.FlowRuleOperations; import org.onosproject.net.flow.criteria.Criteria; import org.onosproject.net.flow.criteria.Criterion; import org.onosproject.net.flow.criteria.EthCriterion; import org.onosproject.net.flow.criteria.IPCriterion; import org.onosproject.net.flow.criteria.PortCriterion; import org.onosproject.net.flow.criteria.VlanIdCriterion; import org.onosproject.net.flowobjective.FilteringObjective; import org.onosproject.net.flowobjective.ObjectiveError; | import org.onosproject.core.*; import org.onosproject.net.flow.*; import org.onosproject.net.flow.criteria.*; import org.onosproject.net.flowobjective.*; | [
"org.onosproject.core",
"org.onosproject.net"
] | org.onosproject.core; org.onosproject.net; | 63,477 |
private static void join(ArrayList<AbstractConfigValue> builder, AbstractConfigValue origRight) {
AbstractConfigValue left = builder.get(builder.size() - 1);
AbstractConfigValue right = origRight;
// check for an object which can be converted to a list
// (this will be an object with numeric keys, like foo.0, foo.1)
if (left instanceof ConfigObject && right instanceof SimpleConfigList) {
left = DefaultTransformer.transform(left, ConfigValueType.LIST);
} else if (left instanceof SimpleConfigList && right instanceof ConfigObject) {
right = DefaultTransformer.transform(right, ConfigValueType.LIST);
}
// Since this depends on the type of two instances, I couldn't think
// of much alternative to an instanceof chain. Visitors are sometimes
// used for multiple dispatch but seems like overkill.
AbstractConfigValue joined = null;
if (left instanceof ConfigObject && right instanceof ConfigObject) {
joined = right.withFallback(left);
} else if (left instanceof SimpleConfigList && right instanceof SimpleConfigList) {
joined = ((SimpleConfigList)left).concatenate((SimpleConfigList)right);
} else if ((left instanceof SimpleConfigList || left instanceof ConfigObject) &&
isIgnoredWhitespace(right)) {
joined = left;
// it should be impossible that left is whitespace and right is a list or object
} else if (left instanceof ConfigConcatenation || right instanceof ConfigConcatenation) {
throw new ConfigException.BugOrBroken("unflattened ConfigConcatenation");
} else if (left instanceof Unmergeable || right instanceof Unmergeable) {
// leave joined=null, cannot join
} else {
// handle primitive type or primitive type mixed with object or list
String s1 = left.transformToString();
String s2 = right.transformToString();
if (s1 == null || s2 == null) {
throw new ConfigException.WrongType(left.origin(),
"Cannot concatenate object or list with a non-object-or-list, " + left
+ " and " + right + " are not compatible");
} else {
ConfigOrigin joinedOrigin = SimpleConfigOrigin.mergeOrigins(left.origin(),
right.origin());
joined = new ConfigString.Quoted(joinedOrigin, s1 + s2);
}
}
if (joined == null) {
builder.add(right);
} else {
builder.remove(builder.size() - 1);
builder.add(joined);
}
} | static void function(ArrayList<AbstractConfigValue> builder, AbstractConfigValue origRight) { AbstractConfigValue left = builder.get(builder.size() - 1); AbstractConfigValue right = origRight; if (left instanceof ConfigObject && right instanceof SimpleConfigList) { left = DefaultTransformer.transform(left, ConfigValueType.LIST); } else if (left instanceof SimpleConfigList && right instanceof ConfigObject) { right = DefaultTransformer.transform(right, ConfigValueType.LIST); } AbstractConfigValue joined = null; if (left instanceof ConfigObject && right instanceof ConfigObject) { joined = right.withFallback(left); } else if (left instanceof SimpleConfigList && right instanceof SimpleConfigList) { joined = ((SimpleConfigList)left).concatenate((SimpleConfigList)right); } else if ((left instanceof SimpleConfigList left instanceof ConfigObject) && isIgnoredWhitespace(right)) { joined = left; } else if (left instanceof ConfigConcatenation right instanceof ConfigConcatenation) { throw new ConfigException.BugOrBroken(STR); } else if (left instanceof Unmergeable right instanceof Unmergeable) { } else { String s1 = left.transformToString(); String s2 = right.transformToString(); if (s1 == null s2 == null) { throw new ConfigException.WrongType(left.origin(), STR + left + STR + right + STR); } else { ConfigOrigin joinedOrigin = SimpleConfigOrigin.mergeOrigins(left.origin(), right.origin()); joined = new ConfigString.Quoted(joinedOrigin, s1 + s2); } } if (joined == null) { builder.add(right); } else { builder.remove(builder.size() - 1); builder.add(joined); } } | /**
* Add left and right, or their merger, to builder.
*/ | Add left and right, or their merger, to builder | join | {
"repo_name": "InterestingLab/waterdrop",
"path": "waterdrop-config/src/main/java/io/github/interestinglab/waterdrop/config/impl/ConfigConcatenation.java",
"license": "apache-2.0",
"size": 11952
} | [
"io.github.interestinglab.waterdrop.config.ConfigException",
"io.github.interestinglab.waterdrop.config.ConfigObject",
"io.github.interestinglab.waterdrop.config.ConfigOrigin",
"io.github.interestinglab.waterdrop.config.ConfigValueType",
"java.util.ArrayList"
] | import io.github.interestinglab.waterdrop.config.ConfigException; import io.github.interestinglab.waterdrop.config.ConfigObject; import io.github.interestinglab.waterdrop.config.ConfigOrigin; import io.github.interestinglab.waterdrop.config.ConfigValueType; import java.util.ArrayList; | import io.github.interestinglab.waterdrop.config.*; import java.util.*; | [
"io.github.interestinglab",
"java.util"
] | io.github.interestinglab; java.util; | 1,604,735 |
public DoubleWritable evaluate(LongWritable i) {
if (i == null) {
return null;
} else {
doubleWritable.set(i.get());
return doubleWritable;
}
} | DoubleWritable function(LongWritable i) { if (i == null) { return null; } else { doubleWritable.set(i.get()); return doubleWritable; } } | /**
* Convert from long to a double. This is called for CAST(... AS DOUBLE)
*
* @param i
* The long value to convert
* @return DoubleWritable
*/ | Convert from long to a double. This is called for CAST(... AS DOUBLE) | evaluate | {
"repo_name": "jcamachor/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/udf/UDFToDouble.java",
"license": "apache-2.0",
"size": 6837
} | [
"org.apache.hadoop.hive.serde2.io.DoubleWritable",
"org.apache.hadoop.io.LongWritable"
] | import org.apache.hadoop.hive.serde2.io.DoubleWritable; import org.apache.hadoop.io.LongWritable; | import org.apache.hadoop.hive.serde2.io.*; import org.apache.hadoop.io.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,874,513 |
public int computeLength()
{
// Compute the addresses length.
addressesLength = 0;
if ( ( addresses != null ) && !addresses.isEmpty() )
{
for ( HostAddress hostAddress : addresses )
{
int length = hostAddress.computeLength();
addressesLength += length;
}
}
return 1 + TLV.getNbBytes( addressesLength ) + addressesLength;
} | int function() { addressesLength = 0; if ( ( addresses != null ) && !addresses.isEmpty() ) { for ( HostAddress hostAddress : addresses ) { int length = hostAddress.computeLength(); addressesLength += length; } } return 1 + TLV.getNbBytes( addressesLength ) + addressesLength; } | /**
* Compute the hostAddresses length
* <pre>
* HostAddresses :
*
* 0x30 L1 hostAddresses sequence of HostAddresses
* |
* +--> 0x30 L2[1] Hostaddress[1]
* |
* +--> 0x30 L2[2] Hostaddress[2]
* |
* ...
* |
* +--> 0x30 L2[n] Hostaddress[n]
*
* where L1 = sum( L2[1], l2[2], ..., L2[n] )
* </pre>
*/ | Compute the hostAddresses length <code> HostAddresses : 0x30 L1 hostAddresses sequence of HostAddresses | +--> 0x30 L2[1] Hostaddress[1] | +--> 0x30 L2[2] Hostaddress[2] | ... | +--> 0x30 L2[n] Hostaddress[n] where L1 = sum( L2[1], l2[2], ..., L2[n] ) </code> | computeLength | {
"repo_name": "apache/directory-server",
"path": "kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/HostAddresses.java",
"license": "apache-2.0",
"size": 7857
} | [
"org.apache.directory.api.asn1.ber.tlv.TLV"
] | import org.apache.directory.api.asn1.ber.tlv.TLV; | import org.apache.directory.api.asn1.ber.tlv.*; | [
"org.apache.directory"
] | org.apache.directory; | 276,574 |
public ServerForUpdate withReplicationRole(ReplicationRole replicationRole) {
if (this.innerProperties() == null) {
this.innerProperties = new ServerPropertiesForUpdate();
}
this.innerProperties().withReplicationRole(replicationRole);
return this;
} | ServerForUpdate function(ReplicationRole replicationRole) { if (this.innerProperties() == null) { this.innerProperties = new ServerPropertiesForUpdate(); } this.innerProperties().withReplicationRole(replicationRole); return this; } | /**
* Set the replicationRole property: The replication role of the server.
*
* @param replicationRole the replicationRole value to set.
* @return the ServerForUpdate object itself.
*/ | Set the replicationRole property: The replication role of the server | withReplicationRole | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/ServerForUpdate.java",
"license": "mit",
"size": 9016
} | [
"com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerPropertiesForUpdate"
] | import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.ServerPropertiesForUpdate; | import com.azure.resourcemanager.mysqlflexibleserver.fluent.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,628,742 |
private List<Resource> resourcesOf(JsonNode resourceNodes) {
List<Resource> resources = new LinkedList<Resource>();
if (resourceNodes.isArray()) {
for (JsonNode resource : resourceNodes) {
resources.add(new Resource(resource.asText()));
}
} else {
resources.add(new Resource(resourceNodes.asText()));
}
return resources;
} | List<Resource> function(JsonNode resourceNodes) { List<Resource> resources = new LinkedList<Resource>(); if (resourceNodes.isArray()) { for (JsonNode resource : resourceNodes) { resources.add(new Resource(resource.asText())); } } else { resources.add(new Resource(resourceNodes.asText())); } return resources; } | /**
* Generates a list of resources from the Resource Json Node.
*
* @param resourceNodes
* the resource Json node to be parsed.
* @return the list of resources.
*/ | Generates a list of resources from the Resource Json Node | resourcesOf | {
"repo_name": "dagnir/aws-sdk-java",
"path": "aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/internal/JsonPolicyReader.java",
"license": "apache-2.0",
"size": 12607
} | [
"com.amazonaws.auth.policy.Resource",
"com.fasterxml.jackson.databind.JsonNode",
"java.util.LinkedList",
"java.util.List"
] | import com.amazonaws.auth.policy.Resource; import com.fasterxml.jackson.databind.JsonNode; import java.util.LinkedList; import java.util.List; | import com.amazonaws.auth.policy.*; import com.fasterxml.jackson.databind.*; import java.util.*; | [
"com.amazonaws.auth",
"com.fasterxml.jackson",
"java.util"
] | com.amazonaws.auth; com.fasterxml.jackson; java.util; | 2,612,892 |
protected List<ListItem> prepPage(SessionState state)
{
ToolSession toolSession = SessionManager.getCurrentToolSession();
List<ListItem> rv = new Vector<ListItem>();
// access the page size
int pageSize = ((Integer) toolSession.getAttribute(STATE_PAGESIZE)).intValue();
// cleanup prior prep
state.removeAttribute(STATE_NUM_MESSAGES);
// are we going next or prev, first or last page?
boolean goNextPage = toolSession.getAttribute(STATE_GO_NEXT_PAGE) != null;
boolean goPrevPage = toolSession.getAttribute(STATE_GO_PREV_PAGE) != null;
boolean goFirstPage = toolSession.getAttribute(STATE_GO_FIRST_PAGE) != null;
boolean goLastPage = toolSession.getAttribute(STATE_GO_LAST_PAGE) != null;
state.removeAttribute(STATE_GO_NEXT_PAGE);
state.removeAttribute(STATE_GO_PREV_PAGE);
state.removeAttribute(STATE_GO_FIRST_PAGE);
state.removeAttribute(STATE_GO_LAST_PAGE);
// are we going next or prev message?
boolean goNext = toolSession.getAttribute(STATE_GO_NEXT) != null;
boolean goPrev = toolSession.getAttribute(STATE_GO_PREV) != null;
state.removeAttribute(STATE_GO_NEXT);
state.removeAttribute(STATE_GO_PREV);
// read all channel messages
List<ListItem> allMessages = readAllResources(state);
if (allMessages == null)
{
return rv;
}
String messageIdAtTheTopOfThePage = null;
Object topMsgId = toolSession.getAttribute(STATE_TOP_PAGE_MESSAGE_ID);
if(topMsgId == null)
{
// do nothing
}
else if(topMsgId instanceof Integer)
{
messageIdAtTheTopOfThePage = ((Integer) topMsgId).toString();
}
else if(topMsgId instanceof String)
{
messageIdAtTheTopOfThePage = (String) topMsgId;
}
// if we have no prev page and do have a top message, then we will stay "pinned" to the top
boolean pinToTop = ( (messageIdAtTheTopOfThePage != null)
&& (toolSession.getAttribute(STATE_PREV_PAGE_EXISTS) == null)
&& !goNextPage && !goPrevPage && !goNext && !goPrev && !goFirstPage && !goLastPage);
// if we have no next page and do have a top message, then we will stay "pinned" to the bottom
boolean pinToBottom = ( (messageIdAtTheTopOfThePage != null)
&& (toolSession.getAttribute(STATE_NEXT_PAGE_EXISTS) == null)
&& !goNextPage && !goPrevPage && !goNext && !goPrev && !goFirstPage && !goLastPage);
// how many messages, total
int numMessages = allMessages.size();
if (numMessages == 0)
{
return rv;
}
// save the number of messges
toolSession.setAttribute(STATE_NUM_MESSAGES, Integer.valueOf(numMessages));
// find the position of the message that is the top first on the page
int posStart = 0;
if (messageIdAtTheTopOfThePage != null)
{
// find the next page
posStart = findResourceInList(allMessages, messageIdAtTheTopOfThePage);
// if missing, start at the top
if (posStart == -1)
{
posStart = 0;
}
}
// if going to the next page, adjust
if (goNextPage)
{
posStart += pageSize;
}
// if going to the prev page, adjust
else if (goPrevPage)
{
posStart -= pageSize;
if (posStart < 0) posStart = 0;
}
// if going to the first page, adjust
else if (goFirstPage)
{
posStart = 0;
}
// if going to the last page, adjust
else if (goLastPage)
{
posStart = numMessages - pageSize;
if (posStart < 0) posStart = 0;
}
// pinning
if (pinToTop)
{
posStart = 0;
}
else if (pinToBottom)
{
posStart = numMessages - pageSize;
if (posStart < 0) posStart = 0;
}
// get the last page fully displayed
if (posStart + pageSize > numMessages)
{
posStart = numMessages - pageSize;
if (posStart < 0) posStart = 0;
}
// compute the end to a page size, adjusted for the number of messages available
int posEnd = posStart + (pageSize-1);
if (posEnd >= numMessages) posEnd = numMessages-1;
// select the messages on this page
for (int i = posStart; i <= posEnd; i++)
{
rv.add(allMessages.get(i));
}
// save which message is at the top of the page
ListItem itemAtTheTopOfThePage = (ListItem) allMessages.get(posStart);
toolSession.setAttribute(STATE_TOP_PAGE_MESSAGE_ID, itemAtTheTopOfThePage.getId());
toolSession.setAttribute(STATE_TOP_MESSAGE_INDEX, Integer.valueOf(posStart));
// which message starts the next page (if any)
int next = posStart + pageSize;
if (next < numMessages)
{
toolSession.setAttribute(STATE_NEXT_PAGE_EXISTS, "");
}
else
{
state.removeAttribute(STATE_NEXT_PAGE_EXISTS);
}
// which message ends the prior page (if any)
int prev = posStart - 1;
if (prev >= 0)
{
toolSession.setAttribute(STATE_PREV_PAGE_EXISTS, "");
}
else
{
state.removeAttribute(STATE_PREV_PAGE_EXISTS);
}
if (toolSession.getAttribute(STATE_VIEW_ID) != null)
{
int viewPos = findResourceInList(allMessages, (String) toolSession.getAttribute(STATE_VIEW_ID));
// are we moving to the next message
if (goNext)
{
// advance
viewPos++;
if (viewPos >= numMessages) viewPos = numMessages-1;
}
// are we moving to the prev message
if (goPrev)
{
// retreat
viewPos--;
if (viewPos < 0) viewPos = 0;
}
// update the view message
toolSession.setAttribute(STATE_VIEW_ID, ((ListItem) allMessages.get(viewPos)).getId());
// if the view message is no longer on the current page, adjust the page
// Note: next time through this will get processed
if (viewPos < posStart)
{
toolSession.setAttribute(STATE_GO_PREV_PAGE, "");
}
else if (viewPos > posEnd)
{
toolSession.setAttribute(STATE_GO_NEXT_PAGE, "");
}
if (viewPos > 0)
{
toolSession.setAttribute(STATE_PREV_EXISTS,"");
}
else
{
state.removeAttribute(STATE_PREV_EXISTS);
}
if (viewPos < numMessages-1)
{
toolSession.setAttribute(STATE_NEXT_EXISTS,"");
}
else
{
state.removeAttribute(STATE_NEXT_EXISTS);
}
}
return rv;
} // prepPage
| List<ListItem> function(SessionState state) { ToolSession toolSession = SessionManager.getCurrentToolSession(); List<ListItem> rv = new Vector<ListItem>(); int pageSize = ((Integer) toolSession.getAttribute(STATE_PAGESIZE)).intValue(); state.removeAttribute(STATE_NUM_MESSAGES); boolean goNextPage = toolSession.getAttribute(STATE_GO_NEXT_PAGE) != null; boolean goPrevPage = toolSession.getAttribute(STATE_GO_PREV_PAGE) != null; boolean goFirstPage = toolSession.getAttribute(STATE_GO_FIRST_PAGE) != null; boolean goLastPage = toolSession.getAttribute(STATE_GO_LAST_PAGE) != null; state.removeAttribute(STATE_GO_NEXT_PAGE); state.removeAttribute(STATE_GO_PREV_PAGE); state.removeAttribute(STATE_GO_FIRST_PAGE); state.removeAttribute(STATE_GO_LAST_PAGE); boolean goNext = toolSession.getAttribute(STATE_GO_NEXT) != null; boolean goPrev = toolSession.getAttribute(STATE_GO_PREV) != null; state.removeAttribute(STATE_GO_NEXT); state.removeAttribute(STATE_GO_PREV); List<ListItem> allMessages = readAllResources(state); if (allMessages == null) { return rv; } String messageIdAtTheTopOfThePage = null; Object topMsgId = toolSession.getAttribute(STATE_TOP_PAGE_MESSAGE_ID); if(topMsgId == null) { } else if(topMsgId instanceof Integer) { messageIdAtTheTopOfThePage = ((Integer) topMsgId).toString(); } else if(topMsgId instanceof String) { messageIdAtTheTopOfThePage = (String) topMsgId; } boolean pinToTop = ( (messageIdAtTheTopOfThePage != null) && (toolSession.getAttribute(STATE_PREV_PAGE_EXISTS) == null) && !goNextPage && !goPrevPage && !goNext && !goPrev && !goFirstPage && !goLastPage); boolean pinToBottom = ( (messageIdAtTheTopOfThePage != null) && (toolSession.getAttribute(STATE_NEXT_PAGE_EXISTS) == null) && !goNextPage && !goPrevPage && !goNext && !goPrev && !goFirstPage && !goLastPage); int numMessages = allMessages.size(); if (numMessages == 0) { return rv; } toolSession.setAttribute(STATE_NUM_MESSAGES, Integer.valueOf(numMessages)); int posStart = 0; if (messageIdAtTheTopOfThePage != null) { posStart = findResourceInList(allMessages, messageIdAtTheTopOfThePage); if (posStart == -1) { posStart = 0; } } if (goNextPage) { posStart += pageSize; } else if (goPrevPage) { posStart -= pageSize; if (posStart < 0) posStart = 0; } else if (goFirstPage) { posStart = 0; } else if (goLastPage) { posStart = numMessages - pageSize; if (posStart < 0) posStart = 0; } if (pinToTop) { posStart = 0; } else if (pinToBottom) { posStart = numMessages - pageSize; if (posStart < 0) posStart = 0; } if (posStart + pageSize > numMessages) { posStart = numMessages - pageSize; if (posStart < 0) posStart = 0; } int posEnd = posStart + (pageSize-1); if (posEnd >= numMessages) posEnd = numMessages-1; for (int i = posStart; i <= posEnd; i++) { rv.add(allMessages.get(i)); } ListItem itemAtTheTopOfThePage = (ListItem) allMessages.get(posStart); toolSession.setAttribute(STATE_TOP_PAGE_MESSAGE_ID, itemAtTheTopOfThePage.getId()); toolSession.setAttribute(STATE_TOP_MESSAGE_INDEX, Integer.valueOf(posStart)); int next = posStart + pageSize; if (next < numMessages) { toolSession.setAttribute(STATE_NEXT_PAGE_EXISTS, STRSTRSTRSTRSTR"); } else { state.removeAttribute(STATE_NEXT_EXISTS); } } return rv; } | /**
* Prepare the current page of site collections to display.
* @return List of ListItem objects to display on this page.
*/ | Prepare the current page of site collections to display | prepPage | {
"repo_name": "harfalm/Sakai-10.1",
"path": "content/content-tool/tool/src/java/org/sakaiproject/content/tool/FilePickerAction.java",
"license": "apache-2.0",
"size": 111030
} | [
"java.util.List",
"java.util.Vector",
"org.sakaiproject.event.api.SessionState",
"org.sakaiproject.tool.api.ToolSession",
"org.sakaiproject.tool.cover.SessionManager"
] | import java.util.List; import java.util.Vector; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.tool.api.ToolSession; import org.sakaiproject.tool.cover.SessionManager; | import java.util.*; import org.sakaiproject.event.api.*; import org.sakaiproject.tool.api.*; import org.sakaiproject.tool.cover.*; | [
"java.util",
"org.sakaiproject.event",
"org.sakaiproject.tool"
] | java.util; org.sakaiproject.event; org.sakaiproject.tool; | 239,196 |
private boolean checkUserRole(Session session, User user, Role role)
throws SecurityException
{
boolean result = false;
List<UserAdminRole> uaRoles = session.getAdminRoles();
if(CollectionUtils.isNotEmpty( uaRoles ))
{
// validate user and retrieve user' ou:
User ue = userP.read(user, false);
for(UserAdminRole uaRole : uaRoles)
{
if(uaRole.getName().equalsIgnoreCase(SUPER_ADMIN))
{
result = true;
break;
}
Set<String> osUs = uaRole.getOsUSet();
if(CollectionUtils.isNotEmpty( osUs ))
{
// create Set with case insensitive comparator:
Set<String> osUsFinal = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
for(String osU : osUs)
{
// Add osU children to the set:
osUsFinal.add(osU);
Set<String> children = UsoUtil.getInstance().getDescendants( osU, this.contextId );
osUsFinal.addAll(children);
}
// does the admin role have authority over the user object?
if(osUsFinal.contains(ue.getOu()))
{
// Get the Role range for admin role:
Set<String> range;
if(uaRole.getBeginRange() != null && uaRole.getEndRange() != null && !uaRole.getBeginRange().equalsIgnoreCase(uaRole.getEndRange()))
{
range = RoleUtil.getInstance().getAscendants( uaRole.getBeginRange(), uaRole.getEndRange(),
uaRole.isEndInclusive(), this.contextId );
if(uaRole.isBeginInclusive())
{
range.add(uaRole.getBeginRange());
}
if(CollectionUtils.isNotEmpty( range ))
{
// Does admin role have authority over a role contained with the allowable role range?
if(range.contains(role.getName()))
{
result = true;
break;
}
}
}
// Does admin role have authority over the role?
else if(uaRole.getBeginRange() != null && uaRole.getBeginRange().equalsIgnoreCase(role.getName()))
{
result = true;
break;
}
}
}
}
}
return result;
} | boolean function(Session session, User user, Role role) throws SecurityException { boolean result = false; List<UserAdminRole> uaRoles = session.getAdminRoles(); if(CollectionUtils.isNotEmpty( uaRoles )) { User ue = userP.read(user, false); for(UserAdminRole uaRole : uaRoles) { if(uaRole.getName().equalsIgnoreCase(SUPER_ADMIN)) { result = true; break; } Set<String> osUs = uaRole.getOsUSet(); if(CollectionUtils.isNotEmpty( osUs )) { Set<String> osUsFinal = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for(String osU : osUs) { osUsFinal.add(osU); Set<String> children = UsoUtil.getInstance().getDescendants( osU, this.contextId ); osUsFinal.addAll(children); } if(osUsFinal.contains(ue.getOu())) { Set<String> range; if(uaRole.getBeginRange() != null && uaRole.getEndRange() != null && !uaRole.getBeginRange().equalsIgnoreCase(uaRole.getEndRange())) { range = RoleUtil.getInstance().getAscendants( uaRole.getBeginRange(), uaRole.getEndRange(), uaRole.isEndInclusive(), this.contextId ); if(uaRole.isBeginInclusive()) { range.add(uaRole.getBeginRange()); } if(CollectionUtils.isNotEmpty( range )) { if(range.contains(role.getName())) { result = true; break; } } } else if(uaRole.getBeginRange() != null && uaRole.getBeginRange().equalsIgnoreCase(role.getName())) { result = true; break; } } } } } return result; } | /**
* This helper function processes ARBAC URA "can assign".
* @param session
* @param user
* @param role
* @return boolean
* @throws SecurityException
*/ | This helper function processes ARBAC URA "can assign" | checkUserRole | {
"repo_name": "PennState/directory-fortress-core-1",
"path": "src/main/java/org/apache/directory/fortress/core/impl/DelAccessMgrImpl.java",
"license": "apache-2.0",
"size": 17303
} | [
"java.util.List",
"java.util.Set",
"java.util.TreeSet",
"org.apache.commons.collections.CollectionUtils",
"org.apache.directory.fortress.core.SecurityException",
"org.apache.directory.fortress.core.model.Role",
"org.apache.directory.fortress.core.model.Session",
"org.apache.directory.fortress.core.mod... | import java.util.List; import java.util.Set; import java.util.TreeSet; import org.apache.commons.collections.CollectionUtils; import org.apache.directory.fortress.core.SecurityException; import org.apache.directory.fortress.core.model.Role; import org.apache.directory.fortress.core.model.Session; import org.apache.directory.fortress.core.model.User; import org.apache.directory.fortress.core.model.UserAdminRole; | import java.util.*; import org.apache.commons.collections.*; import org.apache.directory.fortress.core.*; import org.apache.directory.fortress.core.model.*; | [
"java.util",
"org.apache.commons",
"org.apache.directory"
] | java.util; org.apache.commons; org.apache.directory; | 228,911 |
private boolean allowLogging(final DateTime now) {
final Boolean enabled = get(PropertyIdentifier.enable);
if (!enabled.booleanValue())
return false;
final DateTime start = get(PropertyIdentifier.startTime);
final DateTime stop = get(PropertyIdentifier.stopTime);
if (!start.equals(DateTime.UNSPECIFIED)) {
LOG.info("Checking start time");
if (now.compareTo(start) < 0)
return false;
}
if (!stop.equals(DateTime.UNSPECIFIED)) {
LOG.info("Checking stop time");
if (now.compareTo(stop) >= 0)
return false;
}
return true;
}
| boolean function(final DateTime now) { final Boolean enabled = get(PropertyIdentifier.enable); if (!enabled.booleanValue()) return false; final DateTime start = get(PropertyIdentifier.startTime); final DateTime stop = get(PropertyIdentifier.stopTime); if (!start.equals(DateTime.UNSPECIFIED)) { LOG.info(STR); if (now.compareTo(start) < 0) return false; } if (!stop.equals(DateTime.UNSPECIFIED)) { LOG.info(STR); if (now.compareTo(stop) >= 0) return false; } return true; } | /**
* Determines whether logging should be performed based upon Enable, StartTime, and StopTime.
*/ | Determines whether logging should be performed based upon Enable, StartTime, and StopTime | allowLogging | {
"repo_name": "infiniteautomation/BACnet4J",
"path": "src/main/java/com/serotonin/bacnet4j/obj/EventLogObject.java",
"license": "gpl-3.0",
"size": 18771
} | [
"com.serotonin.bacnet4j.type.constructed.DateTime",
"com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier",
"com.serotonin.bacnet4j.type.primitive.Boolean"
] | import com.serotonin.bacnet4j.type.constructed.DateTime; import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier; import com.serotonin.bacnet4j.type.primitive.Boolean; | import com.serotonin.bacnet4j.type.constructed.*; import com.serotonin.bacnet4j.type.enumerated.*; import com.serotonin.bacnet4j.type.primitive.*; | [
"com.serotonin.bacnet4j"
] | com.serotonin.bacnet4j; | 2,443,820 |
protected List<SearchPlugin> getSearchPlugins() {
return List.of();
} | List<SearchPlugin> function() { return List.of(); } | /**
* Test cases should override this if they have plugins that need to be loaded, e.g. the plugins their aggregators are in.
*/ | Test cases should override this if they have plugins that need to be loaded, e.g. the plugins their aggregators are in | getSearchPlugins | {
"repo_name": "uschindler/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java",
"license": "apache-2.0",
"size": 49503
} | [
"java.util.List",
"org.elasticsearch.plugins.SearchPlugin"
] | import java.util.List; import org.elasticsearch.plugins.SearchPlugin; | import java.util.*; import org.elasticsearch.plugins.*; | [
"java.util",
"org.elasticsearch.plugins"
] | java.util; org.elasticsearch.plugins; | 1,054,010 |
public static Drawable changeDrawableColor(Drawable mDrawable, int color) {
Drawable wrappedDrawable = DrawableCompat.wrap(mDrawable);
DrawableCompat.setTint(wrappedDrawable, color);
return wrappedDrawable;
} | static Drawable function(Drawable mDrawable, int color) { Drawable wrappedDrawable = DrawableCompat.wrap(mDrawable); DrawableCompat.setTint(wrappedDrawable, color); return wrappedDrawable; } | /**
* Change drawable color
*/ | Change drawable color | changeDrawableColor | {
"repo_name": "CommonUtils/android",
"path": "common-task/src/main/java/com/common/utils/Common.java",
"license": "mit",
"size": 71901
} | [
"android.graphics.drawable.Drawable",
"android.support.v4.graphics.drawable.DrawableCompat"
] | import android.graphics.drawable.Drawable; import android.support.v4.graphics.drawable.DrawableCompat; | import android.graphics.drawable.*; import android.support.v4.graphics.drawable.*; | [
"android.graphics",
"android.support"
] | android.graphics; android.support; | 447,274 |
public void hasValue(int expected) {
if (actual == null) {
failWithActual("expected an optional with value", expected);
} else if (!actual.isPresent()) {
failWithoutActual(fact("expected to have value", expected), simpleFact("but was absent"));
} else {
checkNoNeedToDisplayBothValues("getAsInt()").that(actual.getAsInt()).isEqualTo(expected);
}
} | void function(int expected) { if (actual == null) { failWithActual(STR, expected); } else if (!actual.isPresent()) { failWithoutActual(fact(STR, expected), simpleFact(STR)); } else { checkNoNeedToDisplayBothValues(STR).that(actual.getAsInt()).isEqualTo(expected); } } | /**
* Fails if the {@link OptionalInt} does not have the given value or the subject is null. More
* sophisticated comparisons can be done using {@link #hasValueThat()}.
*/ | Fails if the <code>OptionalInt</code> does not have the given value or the subject is null. More sophisticated comparisons can be done using <code>#hasValueThat()</code> | hasValue | {
"repo_name": "cgruber/truth",
"path": "extensions/java8/src/main/java/com/google/common/truth/OptionalIntSubject.java",
"license": "apache-2.0",
"size": 2684
} | [
"com.google.common.truth.Fact"
] | import com.google.common.truth.Fact; | import com.google.common.truth.*; | [
"com.google.common"
] | com.google.common; | 1,752,623 |
public static Range findRangeBounds(CategoryDataset dataset,
List visibleSeriesKeys, boolean includeInterval) {
if (dataset == null) {
throw new IllegalArgumentException("Null 'dataset' argument.");
}
Range result = null;
if (dataset instanceof CategoryRangeInfo) {
CategoryRangeInfo info = (CategoryRangeInfo) dataset;
result = info.getRangeBounds(visibleSeriesKeys, includeInterval);
}
else {
result = iterateToFindRangeBounds(dataset, visibleSeriesKeys,
includeInterval);
}
return result;
}
| static Range function(CategoryDataset dataset, List visibleSeriesKeys, boolean includeInterval) { if (dataset == null) { throw new IllegalArgumentException(STR); } Range result = null; if (dataset instanceof CategoryRangeInfo) { CategoryRangeInfo info = (CategoryRangeInfo) dataset; result = info.getRangeBounds(visibleSeriesKeys, includeInterval); } else { result = iterateToFindRangeBounds(dataset, visibleSeriesKeys, includeInterval); } return result; } | /**
* Finds the bounds of the y-values in the specified dataset, including
* only those series that are listed in visibleSeriesKeys.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param visibleSeriesKeys the keys for the visible series
* (<code>null</code> not permitted).
* @param includeInterval include the y-interval (if the dataset has a
* y-interval).
*
* @return The data bounds.
*
* @since 1.0.13
*/ | Finds the bounds of the y-values in the specified dataset, including only those series that are listed in visibleSeriesKeys | findRangeBounds | {
"repo_name": "SpoonLabs/astor",
"path": "examples/chart_1/source/org/jfree/data/general/DatasetUtilities.java",
"license": "gpl-2.0",
"size": 87965
} | [
"java.util.List",
"org.jfree.data.Range",
"org.jfree.data.category.CategoryDataset",
"org.jfree.data.category.CategoryRangeInfo"
] | import java.util.List; import org.jfree.data.Range; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.CategoryRangeInfo; | import java.util.*; import org.jfree.data.*; import org.jfree.data.category.*; | [
"java.util",
"org.jfree.data"
] | java.util; org.jfree.data; | 29,370 |
public YfyShareLink getShareLink(String uniqueName, final String password) throws YfyException {
String[] params = { uniqueName };
Map<String, String> mapParams = new HashMap<String, String>() {{
put(YfySdkConstant.PASSWORD, password);
}};
return getShareLink(params, mapParams);
} | YfyShareLink function(String uniqueName, final String password) throws YfyException { String[] params = { uniqueName }; Map<String, String> mapParams = new HashMap<String, String>() {{ put(YfySdkConstant.PASSWORD, password); }}; return getShareLink(params, mapParams); } | /**
* Retrieve share link info by unique name
*
* @param uniqueName Unique name of share link
* @param password password of the share link
* @return Detailed information of share link
* @throws YfyException
*/ | Retrieve share link info by unique name | getShareLink | {
"repo_name": "yifangyun/fangcloud-java-sdk",
"path": "src/main/java/com/fangcloud/sdk/api/share_link/YfyShareLinkRequest.java",
"license": "mit",
"size": 6388
} | [
"com.fangcloud.sdk.YfySdkConstant",
"com.fangcloud.sdk.exception.YfyException",
"java.util.HashMap",
"java.util.Map"
] | import com.fangcloud.sdk.YfySdkConstant; import com.fangcloud.sdk.exception.YfyException; import java.util.HashMap; import java.util.Map; | import com.fangcloud.sdk.*; import com.fangcloud.sdk.exception.*; import java.util.*; | [
"com.fangcloud.sdk",
"java.util"
] | com.fangcloud.sdk; java.util; | 1,531,581 |
List<RichGroup> convertGroupsToRichGroupsWithAttributes(PerunSession sess, List<Group> groups, List<String> attrNames) throws InternalErrorException;
| List<RichGroup> convertGroupsToRichGroupsWithAttributes(PerunSession sess, List<Group> groups, List<String> attrNames) throws InternalErrorException; | /**
* This method takes list of groups and creates list of RichGroups containing selected attributes
*
* @param sess
* @param groups list of groups
* @param attrNames list of selected attributes
* @return RichGroup
* @throws InternalErrorException
*/ | This method takes list of groups and creates list of RichGroups containing selected attributes | convertGroupsToRichGroupsWithAttributes | {
"repo_name": "ondrejvelisek/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/GroupsManagerBl.java",
"license": "bsd-2-clause",
"size": 43190
} | [
"cz.metacentrum.perun.core.api.Group",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.RichGroup",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"java.util.List"
] | import cz.metacentrum.perun.core.api.Group; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.RichGroup; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 335,708 |
public static int getInt(ContentResolver cr, String name, int def) {
String v = getString(cr, name);
try {
return v != null ? Integer.parseInt(v) : def;
} catch (NumberFormatException e) {
return def;
}
} | static int function(ContentResolver cr, String name, int def) { String v = getString(cr, name); try { return v != null ? Integer.parseInt(v) : def; } catch (NumberFormatException e) { return def; } } | /**
* Convenience function for retrieving a single secure settings value
* as an integer. Note that internally setting values are always
* stored as strings; this function converts the string to an integer
* for you. The default value will be returned if the setting is
* not defined or not an integer.
*
* @param cr The ContentResolver to access.
* @param name The name of the setting to retrieve.
* @param def Value to return if the setting is not defined.
*
* @return The setting's current value, or 'def' if it is not defined
* or not a valid integer.
*/ | Convenience function for retrieving a single secure settings value as an integer. Note that internally setting values are always stored as strings; this function converts the string to an integer for you. The default value will be returned if the setting is not defined or not an integer | getInt | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/provider/Settings.java",
"license": "gpl-3.0",
"size": 338062
} | [
"android.content.ContentResolver"
] | import android.content.ContentResolver; | import android.content.*; | [
"android.content"
] | android.content; | 544,320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.