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 InputStream generateJpgDiagram(ProcessDefinitionEntity processDefinition) { return generateDiagram(processDefinition, "jpg", Collections.<String> emptyList()); }
static InputStream function(ProcessDefinitionEntity processDefinition) { return generateDiagram(processDefinition, "jpg", Collections.<String> emptyList()); }
/** * Generates a JPG diagram image of the given process definition, using the * diagram interchange information of the process. */
Generates a JPG diagram image of the given process definition, using the diagram interchange information of the process
generateJpgDiagram
{ "repo_name": "nagyistoce/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/diagram/ProcessDiagramGenerator.java", "license": "apache-2.0", "size": 19704 }
[ "java.io.InputStream", "java.util.Collections", "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity" ]
import java.io.InputStream; import java.util.Collections; import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
import java.io.*; import java.util.*; import org.camunda.bpm.engine.impl.persistence.entity.*;
[ "java.io", "java.util", "org.camunda.bpm" ]
java.io; java.util; org.camunda.bpm;
2,158,377
public void set(Element el) { // the children (time ranges) NodeList children = el.getChildNodes(); final int length = children.getLength(); for(int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element)child; // look for a time range if (element.getTagName().equals("range")) { try { m_ranges.add(TimeService.newTimeRange(element.getAttribute("range"))); } catch (Exception e) { M_log.warn("set: while reading time range: " + e); } } } } // set
void function(Element el) { NodeList children = el.getChildNodes(); final int length = children.getLength(); for(int i = 0; i < length; i++) { Node child = children.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element)child; if (element.getTagName().equals("range")) { try { m_ranges.add(TimeService.newTimeRange(element.getAttribute("range"))); } catch (Exception e) { M_log.warn(STR + e); } } } }
/** * Take values from this xml element * @param el The xml element. */
Take values from this xml element
set
{ "repo_name": "ouit0408/sakai", "path": "calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/ExclusionRecurrenceRule.java", "license": "apache-2.0", "size": 6507 }
[ "org.sakaiproject.time.cover.TimeService", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import org.sakaiproject.time.cover.TimeService; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import org.sakaiproject.time.cover.*; import org.w3c.dom.*;
[ "org.sakaiproject.time", "org.w3c.dom" ]
org.sakaiproject.time; org.w3c.dom;
2,911,510
public void addChatMessage(ICommandSender sender, String phraseId, String prefix, String suffix) { EntityPlayer player = null; for (final WorldServer world : MinecraftServer.getServer().worldServers) { if (world.getPlayerEntityByName(sender.getCommandSenderName()) != null) { player = world.getPlayerEntityByName(sender.getCommandSenderName()); break; } } MCA.packetPipeline.sendPacketToPlayer(new Packet(EnumPacketType.SayLocalized, player, null, phraseId, false, prefix, suffix), (EntityPlayerMP)player); }
void function(ICommandSender sender, String phraseId, String prefix, String suffix) { EntityPlayer player = null; for (final WorldServer world : MinecraftServer.getServer().worldServers) { if (world.getPlayerEntityByName(sender.getCommandSenderName()) != null) { player = world.getPlayerEntityByName(sender.getCommandSenderName()); break; } } MCA.packetPipeline.sendPacketToPlayer(new Packet(EnumPacketType.SayLocalized, player, null, phraseId, false, prefix, suffix), (EntityPlayerMP)player); }
/** * Sends a packet to the player so that the output from the command will be translated into their selected language. * * @param sender The player who is using the command. * @param phraseId The ID of the phrase to send. * @param prefix The prefix to add to the translated phrase. * @param suffix The suffix to add to the translated phrase. */
Sends a packet to the player so that the output from the command will be translated into their selected language
addChatMessage
{ "repo_name": "MrPonyCaptain/minecraft-comes-alive", "path": "Minecraft/1.7.10/src/main/java/mca/command/AbstractCommand.java", "license": "gpl-3.0", "size": 3429 }
[ "com.radixshock.radixcore.network.Packet", "net.minecraft.command.ICommandSender", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.entity.player.EntityPlayerMP", "net.minecraft.server.MinecraftServer", "net.minecraft.world.WorldServer" ]
import com.radixshock.radixcore.network.Packet; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.world.WorldServer;
import com.radixshock.radixcore.network.*; import net.minecraft.command.*; import net.minecraft.entity.player.*; import net.minecraft.server.*; import net.minecraft.world.*;
[ "com.radixshock.radixcore", "net.minecraft.command", "net.minecraft.entity", "net.minecraft.server", "net.minecraft.world" ]
com.radixshock.radixcore; net.minecraft.command; net.minecraft.entity; net.minecraft.server; net.minecraft.world;
2,710,412
private RegionQueue createHARegionQueue(String name, Cache cache) throws IOException, ClassNotFoundException, CacheException, InterruptedException { RegionQueue regionqueue =HARegionQueue.getHARegionQueueInstance(name, cache,HARegionQueue.NON_BLOCKING_HA_QUEUE, false); return regionqueue; }
RegionQueue function(String name, Cache cache) throws IOException, ClassNotFoundException, CacheException, InterruptedException { RegionQueue regionqueue =HARegionQueue.getHARegionQueueInstance(name, cache,HARegionQueue.NON_BLOCKING_HA_QUEUE, false); return regionqueue; }
/** * Creates HA region-queue object * * @return HA region-queue object * @throws IOException * @throws ClassNotFoundException * @throws CacheException * @throws InterruptedException */
Creates HA region-queue object
createHARegionQueue
{ "repo_name": "gemxd/gemfirexd-oss", "path": "tests/core/src/main/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueStartStopJUnitTest.java", "license": "apache-2.0", "size": 3551 }
[ "com.gemstone.gemfire.cache.Cache", "com.gemstone.gemfire.cache.CacheException", "com.gemstone.gemfire.internal.cache.RegionQueue", "java.io.IOException" ]
import com.gemstone.gemfire.cache.Cache; import com.gemstone.gemfire.cache.CacheException; import com.gemstone.gemfire.internal.cache.RegionQueue; import java.io.IOException;
import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.internal.cache.*; import java.io.*;
[ "com.gemstone.gemfire", "java.io" ]
com.gemstone.gemfire; java.io;
2,804,757
public void requestIsimAuthentication(String nonce, Message response);
void function(String nonce, Message response);
/** * Request the ISIM application on the UICC to perform the AKA * challenge/response algorithm for IMS authentication. The nonce string * and challenge response are Base64 encoded Strings. * * @param nonce the nonce string to pass with the ISIM authentication request * @param response a callback message with the String response in the obj field */
Request the ISIM application on the UICC to perform the AKA challenge/response algorithm for IMS authentication. The nonce string and challenge response are Base64 encoded Strings
requestIsimAuthentication
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/opt/telephony/src/java/com/android/internal/telephony/CommandsInterface.java", "license": "gpl-2.0", "size": 86787 }
[ "android.os.Message" ]
import android.os.Message;
import android.os.*;
[ "android.os" ]
android.os;
2,014,772
Long l = new Long(polynomial); FPGenerator fpgen = (FPGenerator) generators.get(l); if (fpgen == null) { fpgen = new FPGenerator(polynomial, degree); generators.put(l, fpgen); } return fpgen; } private static final Hashtable generators = new Hashtable(10); private static final long zero = 0; private static final long one = 0x8000000000000000L;
Long l = new Long(polynomial); FPGenerator fpgen = (FPGenerator) generators.get(l); if (fpgen == null) { fpgen = new FPGenerator(polynomial, degree); generators.put(l, fpgen); } return fpgen; } private static final Hashtable generators = new Hashtable(10); private static final long zero = 0; private static final long one = 0x8000000000000000L;
/** * Return a fingerprint generator. The fingerprints generated will have degree * <code>degree</code> and will be generated by <code>polynomial</code>. If a * generator based on <code>polynomial</code> has already been created, it * will be returned. Requires that <code>polynomial</code> is an irreducible * polynomial of degree <code>degree</code> (the array * <code>polynomials</code> contains some irreducible polynomials). */
Return a fingerprint generator. The fingerprints generated will have degree <code>degree</code> and will be generated by <code>polynomial</code>. If a generator based on <code>polynomial</code> has already been created, it will be returned. Requires that <code>polynomial</code> is an irreducible polynomial of degree <code>degree</code> (the array <code>polynomials</code> contains some irreducible polynomials)
make
{ "repo_name": "harshs08/oodt-solr", "path": "src/tika-parser/src/main/java/com/parse/deduplication/FPGenerator.java", "license": "apache-2.0", "size": 15592 }
[ "java.util.Hashtable" ]
import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
2,847,744
public java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> getInput_strings_HLPNStringHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.HLPNStringImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI( (fr.lip6.move.pnml.hlpn.strings.HLPNString)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.strings.impl.HLPNStringImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.strings.hlapi.HLPNStringHLAPI( (fr.lip6.move.pnml.hlpn.strings.HLPNString)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of HLPNStringHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of HLPNStringHLAPI kind. WARNING : this method can creates a lot of new object in memory
getInput_strings_HLPNStringHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 108533 }
[ "fr.lip6.move.pnml.hlpn.terms.Sort", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Sort; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,394,612
public void deleteEntry(URL entryUrl) throws FeedServerClientException { try { service.delete(entryUrl); } catch (IOException e) { throw new FeedServerClientException("Error while deleting " + entryUrl, e); } catch (ServiceException e) { throw new FeedServerClientException(e); } }
void function(URL entryUrl) throws FeedServerClientException { try { service.delete(entryUrl); } catch (IOException e) { throw new FeedServerClientException(STR + entryUrl, e); } catch (ServiceException e) { throw new FeedServerClientException(e); } }
/** * Deletes entry specified by supplied URL. This URL must include the full * path. * * @param entryUrl the full URL to the entry in this feed. * @throws FeedServerClientException if any communication issues occur with * the feed or the feed ID is invalid or malformed.. */
Deletes entry specified by supplied URL. This URL must include the full path
deleteEntry
{ "repo_name": "jyang/google-feedserver", "path": "src/java/com/google/feedserver/client/TypelessFeedServerClient.java", "license": "apache-2.0", "size": 15704 }
[ "com.google.feedserver.util.FeedServerClientException", "com.google.gdata.util.ServiceException", "java.io.IOException" ]
import com.google.feedserver.util.FeedServerClientException; import com.google.gdata.util.ServiceException; import java.io.IOException;
import com.google.feedserver.util.*; import com.google.gdata.util.*; import java.io.*;
[ "com.google.feedserver", "com.google.gdata", "java.io" ]
com.google.feedserver; com.google.gdata; java.io;
640,011
Subject check(Credential[] credentials, String schemeName) throws SSOAuthenticationException;
Subject check(Credential[] credentials, String schemeName) throws SSOAuthenticationException;
/** * The is valid method is used to see if credentials are a valid proof of the user identity. * The process populates the received subject with all Principals and Credentials. * * @param credentials that should proof user identity. * the state of the authenticated Subject. * @return the authenticated subject. */
The is valid method is used to see if credentials are a valid proof of the user identity. The process populates the received subject with all Principals and Credentials
check
{ "repo_name": "webbfontaine/josso1", "path": "core/josso-core/src/main/java/org/josso/auth/Authenticator.java", "license": "lgpl-2.1", "size": 2616 }
[ "javax.security.auth.Subject", "org.josso.auth.exceptions.SSOAuthenticationException" ]
import javax.security.auth.Subject; import org.josso.auth.exceptions.SSOAuthenticationException;
import javax.security.auth.*; import org.josso.auth.exceptions.*;
[ "javax.security", "org.josso.auth" ]
javax.security; org.josso.auth;
442,500
public boolean getActPodcastsExist() { boolean actPodcastsExist = false; // if student on site that has Podcasts but no Resources, want "There are no..." if (!getResourceToolExists() && ! podcastPermissionsService.canUpdateSite()) { return false; } if (!getPodcastFolderExists()) { // if for some reason there is not a podcast folder // for example, was renamed in Resources actPodcastsExist = false; } else { // ask the service if there is anything in the podcast folder try { actPodcastsExist = podcastService.checkForActualPodcasts(); } catch (PermissionException e) { LOG.warn("PermissionException while determining if there are files in the podcast folder " + " for site " + podcastService.getSiteId() + ". " + e.getMessage(), e); setErrorMessage(PERMISSION_ALERT); } } return actPodcastsExist; }
boolean function() { boolean actPodcastsExist = false; if (!getResourceToolExists() && ! podcastPermissionsService.canUpdateSite()) { return false; } if (!getPodcastFolderExists()) { actPodcastsExist = false; } else { try { actPodcastsExist = podcastService.checkForActualPodcasts(); } catch (PermissionException e) { LOG.warn(STR + STR + podcastService.getSiteId() + STR + e.getMessage(), e); setErrorMessage(PERMISSION_ALERT); } } return actPodcastsExist; }
/** * Resources/podcasts exists, but are there any actual podcasts * * @return boolean * TRUE if there are podcasts, FALSE otherwise */
Resources/podcasts exists, but are there any actual podcasts
getActPodcastsExist
{ "repo_name": "ouit0408/sakai", "path": "podcasts/podcasts-app/src/java/org/sakaiproject/tool/podcasts/podHomeBean.java", "license": "apache-2.0", "size": 60014 }
[ "org.sakaiproject.exception.PermissionException" ]
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.exception.*;
[ "org.sakaiproject.exception" ]
org.sakaiproject.exception;
2,265,469
public void doAcceptBuildResult(StaplerResponse rsp) throws IOException, ServletException { rsp.setStatus(HttpServletResponse.SC_OK); }
void function(StaplerResponse rsp) throws IOException, ServletException { rsp.setStatus(HttpServletResponse.SC_OK); }
/** * Used to check if this is an external job and ready to accept a build * result. */
Used to check if this is an external job and ready to accept a build result
doAcceptBuildResult
{ "repo_name": "sap-production/hudson-3.x", "path": "hudson-core/src/main/java/hudson/model/ExternalJob.java", "license": "apache-2.0", "size": 3757 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletResponse", "org.kohsuke.stapler.StaplerResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import org.kohsuke.stapler.StaplerResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.kohsuke.stapler.*;
[ "java.io", "javax.servlet", "org.kohsuke.stapler" ]
java.io; javax.servlet; org.kohsuke.stapler;
194,360
EList<IfcExternalReferenceRelationship> getHasExternalReference();
EList<IfcExternalReferenceRelationship> getHasExternalReference();
/** * Returns the value of the '<em><b>Has External Reference</b></em>' reference list. * The list contents are of type {@link cn.dlb.bim.models.ifc4.IfcExternalReferenceRelationship}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Has External Reference</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Has External Reference</em>' reference list. * @see #isSetHasExternalReference() * @see #unsetHasExternalReference() * @see cn.dlb.bim.models.ifc4.Ifc4Package#getIfcTimeSeries_HasExternalReference() * @model unsettable="true" * @generated */
Returns the value of the 'Has External Reference' reference list. The list contents are of type <code>cn.dlb.bim.models.ifc4.IfcExternalReferenceRelationship</code>. If the meaning of the 'Has External Reference' reference list isn't clear, there really should be more of a description here...
getHasExternalReference
{ "repo_name": "shenan4321/BIMplatform", "path": "generated/cn/dlb/bim/models/ifc4/IfcTimeSeries.java", "license": "agpl-3.0", "size": 13525 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,519,011
public void testOneToOneBi() { NucleusContext nucleusCtx = new PersistenceNucleusContextImpl("JPA", null); ClassLoaderResolver clr = nucleusCtx.getClassLoaderResolver(null); MetaDataManager metaDataMgr = new JPAMetaDataManager(nucleusCtx); PersistenceUnitMetaData pumd = getMetaDataForPersistenceUnit(nucleusCtx, "JPATest"); metaDataMgr.loadPersistenceUnit(pumd, null); // non-owner side ClassMetaData cmd1 = (ClassMetaData)metaDataMgr.getMetaDataForClass(Boiler.class.getName(), clr); assertEquals("Boiler has incorrect table name", "JPA_AX_BOILER", cmd1.getTable()); AbstractMemberMetaData fmd1 = cmd1.getMetaDataForMember("timer"); assertNotNull("Boiler.timer is null!", fmd1); assertEquals("Boiler.timer mapped-by is incorrect", "boiler", fmd1.getMappedBy()); assertEquals("Boiler.timer relationType is incorrect", RelationType.ONE_TO_ONE_BI, fmd1.getRelationType(clr)); // owner side ClassMetaData cmd2 = (ClassMetaData)metaDataMgr.getMetaDataForClass(Timer.class.getName(), clr); assertEquals("Timer has incorrect table name", "JPA_AX_TIMER", cmd2.getTable()); AbstractMemberMetaData fmd2 = cmd2.getMetaDataForMember("boiler"); assertNotNull("Timer.boiler is null!", fmd2); assertEquals("Timer.boiler mapped-by is incorrect", null, fmd2.getMappedBy()); assertEquals("Timer.boiler relationType is incorrect", RelationType.ONE_TO_ONE_BI, fmd2.getRelationType(clr)); assertNotNull("Timer.boiler has no column info", fmd2.getColumnMetaData()); assertEquals("Timer.boiler has incorrect number of columns", 1, fmd2.getColumnMetaData().length); assertEquals("Timer.boiler column name is wrong", "BOILER_ID", fmd2.getColumnMetaData()[0].getName()); }
void function() { NucleusContext nucleusCtx = new PersistenceNucleusContextImpl("JPA", null); ClassLoaderResolver clr = nucleusCtx.getClassLoaderResolver(null); MetaDataManager metaDataMgr = new JPAMetaDataManager(nucleusCtx); PersistenceUnitMetaData pumd = getMetaDataForPersistenceUnit(nucleusCtx, STR); metaDataMgr.loadPersistenceUnit(pumd, null); ClassMetaData cmd1 = (ClassMetaData)metaDataMgr.getMetaDataForClass(Boiler.class.getName(), clr); assertEquals(STR, STR, cmd1.getTable()); AbstractMemberMetaData fmd1 = cmd1.getMetaDataForMember("timer"); assertNotNull(STR, fmd1); assertEquals(STR, STR, fmd1.getMappedBy()); assertEquals(STR, RelationType.ONE_TO_ONE_BI, fmd1.getRelationType(clr)); ClassMetaData cmd2 = (ClassMetaData)metaDataMgr.getMetaDataForClass(Timer.class.getName(), clr); assertEquals(STR, STR, cmd2.getTable()); AbstractMemberMetaData fmd2 = cmd2.getMetaDataForMember(STR); assertNotNull(STR, fmd2); assertEquals(STR, null, fmd2.getMappedBy()); assertEquals(STR, RelationType.ONE_TO_ONE_BI, fmd2.getRelationType(clr)); assertNotNull(STR, fmd2.getColumnMetaData()); assertEquals(STR, 1, fmd2.getColumnMetaData().length); assertEquals(STR, STR, fmd2.getColumnMetaData()[0].getName()); }
/** * Test of 1-1 bi relation */
Test of 1-1 bi relation
testOneToOneBi
{ "repo_name": "datanucleus/tests", "path": "jpa/general/src/test/org/datanucleus/tests/metadata/AnnotationPlusXMLTest.java", "license": "apache-2.0", "size": 24912 }
[ "org.datanucleus.ClassLoaderResolver", "org.datanucleus.NucleusContext", "org.datanucleus.PersistenceNucleusContextImpl", "org.datanucleus.api.jpa.metadata.JPAMetaDataManager", "org.datanucleus.metadata.AbstractMemberMetaData", "org.datanucleus.metadata.ClassMetaData", "org.datanucleus.metadata.MetaDataManager", "org.datanucleus.metadata.PersistenceUnitMetaData", "org.datanucleus.metadata.RelationType", "org.datanucleus.samples.ann_xml.one_one.bidir.Boiler", "org.datanucleus.samples.ann_xml.one_one.bidir.Timer" ]
import org.datanucleus.ClassLoaderResolver; import org.datanucleus.NucleusContext; import org.datanucleus.PersistenceNucleusContextImpl; import org.datanucleus.api.jpa.metadata.JPAMetaDataManager; import org.datanucleus.metadata.AbstractMemberMetaData; import org.datanucleus.metadata.ClassMetaData; import org.datanucleus.metadata.MetaDataManager; import org.datanucleus.metadata.PersistenceUnitMetaData; import org.datanucleus.metadata.RelationType; import org.datanucleus.samples.ann_xml.one_one.bidir.Boiler; import org.datanucleus.samples.ann_xml.one_one.bidir.Timer;
import org.datanucleus.*; import org.datanucleus.api.jpa.metadata.*; import org.datanucleus.metadata.*; import org.datanucleus.samples.ann_xml.one_one.bidir.*;
[ "org.datanucleus", "org.datanucleus.api", "org.datanucleus.metadata", "org.datanucleus.samples" ]
org.datanucleus; org.datanucleus.api; org.datanucleus.metadata; org.datanucleus.samples;
2,446,728
@Test public void testGetImagesBySplitFilesetsMixedProjectAsRoot() throws Exception { // first create a project Image i1 = (Image) iUpdate .saveAndReturnObject(mmFactory.simpleImage()); Image i2 = (Image) iUpdate .saveAndReturnObject(mmFactory.simpleImage()); Fileset fileset = newFileset(); fileset.addImage(i1); fileset.addImage(i2); fileset = (Fileset) iUpdate.saveAndReturnObject(fileset); assertEquals(fileset.copyImages().size(), 2); Dataset d1 = (Dataset) iUpdate.saveAndReturnObject(mmFactory .simpleDatasetData().asIObject()); Dataset d2 = (Dataset) iUpdate.saveAndReturnObject(mmFactory .simpleDatasetData().asIObject()); // link the 2 DatasetImageLink link = new DatasetImageLinkI(); link.setParent(d1); link.setChild((Image) i1.proxy()); iUpdate.saveAndReturnObject(link); link = new DatasetImageLinkI(); link.setParent(d2); link.setChild((Image) i2.proxy()); iUpdate.saveAndReturnObject(link); Project p1 = (Project) iUpdate.saveAndReturnObject(mmFactory .simpleProjectData().asIObject()); ProjectDatasetLink lp = new ProjectDatasetLinkI(); lp.setParent(p1); lp.setChild((Dataset) d1.proxy()); iUpdate.saveAndReturnObject(lp); Project p2 = (Project) iUpdate.saveAndReturnObject(mmFactory .simpleProjectData().asIObject()); lp = new ProjectDatasetLinkI(); lp.setParent(p2); lp.setChild((Dataset) d2.proxy()); iUpdate.saveAndReturnObject(lp); Parameters param = new ParametersI(); List<Long> ids = new ArrayList<Long>(); ids.add(p1.getId().getValue()); ids.add(p2.getId().getValue()); Map<String, List<Long>> map = new HashMap<String, List<Long>>(1); map.put(Project.class.getName(), ids); Map<Long, Map<Boolean, List<Long>>> results = iContainer .getImagesBySplitFilesets(map, param); assertEquals(results.size(), 0); }
void function() throws Exception { Image i1 = (Image) iUpdate .saveAndReturnObject(mmFactory.simpleImage()); Image i2 = (Image) iUpdate .saveAndReturnObject(mmFactory.simpleImage()); Fileset fileset = newFileset(); fileset.addImage(i1); fileset.addImage(i2); fileset = (Fileset) iUpdate.saveAndReturnObject(fileset); assertEquals(fileset.copyImages().size(), 2); Dataset d1 = (Dataset) iUpdate.saveAndReturnObject(mmFactory .simpleDatasetData().asIObject()); Dataset d2 = (Dataset) iUpdate.saveAndReturnObject(mmFactory .simpleDatasetData().asIObject()); DatasetImageLink link = new DatasetImageLinkI(); link.setParent(d1); link.setChild((Image) i1.proxy()); iUpdate.saveAndReturnObject(link); link = new DatasetImageLinkI(); link.setParent(d2); link.setChild((Image) i2.proxy()); iUpdate.saveAndReturnObject(link); Project p1 = (Project) iUpdate.saveAndReturnObject(mmFactory .simpleProjectData().asIObject()); ProjectDatasetLink lp = new ProjectDatasetLinkI(); lp.setParent(p1); lp.setChild((Dataset) d1.proxy()); iUpdate.saveAndReturnObject(lp); Project p2 = (Project) iUpdate.saveAndReturnObject(mmFactory .simpleProjectData().asIObject()); lp = new ProjectDatasetLinkI(); lp.setParent(p2); lp.setChild((Dataset) d2.proxy()); iUpdate.saveAndReturnObject(lp); Parameters param = new ParametersI(); List<Long> ids = new ArrayList<Long>(); ids.add(p1.getId().getValue()); ids.add(p2.getId().getValue()); Map<String, List<Long>> map = new HashMap<String, List<Long>>(1); map.put(Project.class.getName(), ids); Map<Long, Map<Boolean, List<Long>>> results = iContainer .getImagesBySplitFilesets(map, param); assertEquals(results.size(), 0); }
/** * Test the <code>getImagesBySplitFilesets</code> Project as root. The * fileset is split between 2 datasets contained into 2 projects. Both * projects are specified. * * @throws Exception * Thrown if an error occurred. */
Test the <code>getImagesBySplitFilesets</code> Project as root. The fileset is split between 2 datasets contained into 2 projects. Both projects are specified
testGetImagesBySplitFilesetsMixedProjectAsRoot
{ "repo_name": "stelfrich/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/PojosServiceTest.java", "license": "gpl-2.0", "size": 79848 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "org.testng.AssertJUnit" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.testng.AssertJUnit;
import java.util.*; import org.testng.*;
[ "java.util", "org.testng" ]
java.util; org.testng;
1,796,361
protected String generateUpdateRowString() { Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ); //if ( !elementIsFormula ) { update.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters ); //} if ( hasIdentifier ) { update.addPrimaryKeyColumns( new String[]{ identifierColumnName } ); } else if ( hasIndex && !indexContainsFormula ) { update.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) ); } else { update.addPrimaryKeyColumns( keyColumnNames ); update.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters ); } if ( getFactory().getSettings().isCommentsEnabled() ) { update.setComment( "update collection row " + getRole() ); } return update.toStatementString(); }
String function() { Update update = new Update( getDialect() ) .setTableName( qualifiedTableName ); update.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters ); if ( hasIdentifier ) { update.addPrimaryKeyColumns( new String[]{ identifierColumnName } ); } else if ( hasIndex && !indexContainsFormula ) { update.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) ); } else { update.addPrimaryKeyColumns( keyColumnNames ); update.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters ); } if ( getFactory().getSettings().isCommentsEnabled() ) { update.setComment( STR + getRole() ); } return update.toStatementString(); }
/** * Generate the SQL UPDATE that updates a row */
Generate the SQL UPDATE that updates a row
generateUpdateRowString
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java", "license": "epl-1.0", "size": 10842 }
[ "org.hibernate.sql.Update", "org.hibernate.util.ArrayHelper" ]
import org.hibernate.sql.Update; import org.hibernate.util.ArrayHelper;
import org.hibernate.sql.*; import org.hibernate.util.*;
[ "org.hibernate.sql", "org.hibernate.util" ]
org.hibernate.sql; org.hibernate.util;
1,838,083
public static Integer getPort(String address) { Matcher matcher = HOST_PORT_PATTERN.matcher(address); return matcher.matches() ? Integer.parseInt(matcher.group(2)) : null; }
static Integer function(String address) { Matcher matcher = HOST_PORT_PATTERN.matcher(address); return matcher.matches() ? Integer.parseInt(matcher.group(2)) : null; }
/** * Extracts the port number from a "host:port" address string. * * @param address address string to parse * @return port number or null if the given address is incorrect */
Extracts the port number from a "host:port" address string
getPort
{ "repo_name": "norwood/common", "path": "utils/src/main/java/io/confluent/common/utils/Utils.java", "license": "apache-2.0", "size": 10951 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,473,507
public PrivateKey getPrivateKey(String alias) { PrivateKey pk = this.privateKeyByAlias.get(alias); if(pk != null) { return pk; } throw new IllegalArgumentException("No PrivateKey found for alias:'"+alias+"'"); }
PrivateKey function(String alias) { PrivateKey pk = this.privateKeyByAlias.get(alias); if(pk != null) { return pk; } throw new IllegalArgumentException(STR+alias+"'"); }
/** * Return the private Key for a specific alias * * @param alias * the name of the alias for the private key * @return the private key for the given <code>alias</code> * @throws IllegalArgumentException * when no private key could be found */
Return the private Key for a specific alias
getPrivateKey
{ "repo_name": "hizhangqi/jmeter-1", "path": "src/core/org/apache/jmeter/util/keystore/JmeterKeyStore.java", "license": "apache-2.0", "size": 12304 }
[ "java.security.PrivateKey" ]
import java.security.PrivateKey;
import java.security.*;
[ "java.security" ]
java.security;
191,898
public static String[] splitAll(String string, String splitterRegex) { return splitAll(string, Pattern.compile(splitterRegex)); }
static String[] function(String string, String splitterRegex) { return splitAll(string, Pattern.compile(splitterRegex)); }
/** * Splits a string to two parts by splitter * @param string The string to split * @param splitterRegex The regular expression of the splitter * @return An array of strings */
Splits a string to two parts by splitter
splitAll
{ "repo_name": "Web-of-Building-Data/Ifc2Rdf", "path": "software/drumbeat-ifc2rdf-1.5.0/drumbeat-common/src/fi/hut/cs/drumbeat/common/string/RegexUtils.java", "license": "mit", "size": 3556 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
354,159
public boolean hasChannel(String channelName, Side source) { return channels.get(source).containsKey(channelName); }
boolean function(String channelName, Side source) { return channels.get(source).containsKey(channelName); }
/** * Is there a channel with this name on this side? * @param channelName The name * @param source the side * @return if there's a channel */
Is there a channel with this name on this side
hasChannel
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraftforge/fml/common/network/NetworkRegistry.java", "license": "lgpl-2.1", "size": 13920 }
[ "net.minecraftforge.fml.relauncher.Side" ]
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.*;
[ "net.minecraftforge.fml" ]
net.minecraftforge.fml;
960,243
private void addTaggedValuesToRepresent(Element e, Info i) throws EAException { if (ArcGISWorkspace.representTaggedValues) { for (String tvToRepresent : ArcGISWorkspace.taggedValuesToRepresent) { String normalizedTag = options.normalizeTag(tvToRepresent); String[] values = i.taggedValuesForTag(normalizedTag); if (values.length > 0) { EAElementUtil.setTaggedValue(e, new EATaggedValue(tvToRepresent, Arrays.asList(values))); } } } }
void function(Element e, Info i) throws EAException { if (ArcGISWorkspace.representTaggedValues) { for (String tvToRepresent : ArcGISWorkspace.taggedValuesToRepresent) { String normalizedTag = options.normalizeTag(tvToRepresent); String[] values = i.taggedValuesForTag(normalizedTag); if (values.length > 0) { EAElementUtil.setTaggedValue(e, new EATaggedValue(tvToRepresent, Arrays.asList(values))); } } } }
/** * If any specific tagged values shall be represented, and the info object has * such tagged values, they will be added. * * @param e * @param i * @throws EAException */
If any specific tagged values shall be represented, and the info object has such tagged values, they will be added
addTaggedValuesToRepresent
{ "repo_name": "ShapeChange/ShapeChange", "path": "src/main/java/de/interactive_instruments/ShapeChange/Target/ArcGISWorkspace/ArcGISWorkspace.java", "license": "gpl-3.0", "size": 170900 }
[ "de.interactive_instruments.ShapeChange", "java.util.Arrays", "org.sparx.Element" ]
import de.interactive_instruments.ShapeChange; import java.util.Arrays; import org.sparx.Element;
import de.interactive_instruments.*; import java.util.*; import org.sparx.*;
[ "de.interactive_instruments", "java.util", "org.sparx" ]
de.interactive_instruments; java.util; org.sparx;
933,513
public static String getConfigureName(Class<?> c) { try { return (String) c.getMethod("getConfigureTypeName").invoke(null); } catch (NoSuchMethodException e) { // Ignore. This is normal, since some classes won't have this method. } catch (IllegalAccessException e) { ErrorDialog.bug(e); } catch (IllegalArgumentException e) { ErrorDialog.bug(e); } catch (InvocationTargetException e) { ErrorDialog.bug(e); } catch (NullPointerException e) { ErrorDialog.bug(e); } catch (ExceptionInInitializerError e) { ErrorDialog.bug(e); } return c.getName().substring(c.getName().lastIndexOf(".") + 1); }
static String function(Class<?> c) { try { return (String) c.getMethod(STR).invoke(null); } catch (NoSuchMethodException e) { } catch (IllegalAccessException e) { ErrorDialog.bug(e); } catch (IllegalArgumentException e) { ErrorDialog.bug(e); } catch (InvocationTargetException e) { ErrorDialog.bug(e); } catch (NullPointerException e) { ErrorDialog.bug(e); } catch (ExceptionInInitializerError e) { ErrorDialog.bug(e); } return c.getName().substring(c.getName().lastIndexOf(".") + 1); }
/** * Returns the name of the class for display purposes. Reflection is * used to call <code>getConfigureTypeName()</code>, which should be * a static method if it exists in the given class. (This is necessary * because static methods are not permitted in interfaces.) * * @param the class whose configure name will be returned * @return the configure name of the class */
Returns the name of the class for display purposes. Reflection is used to call <code>getConfigureTypeName()</code>, which should be a static method if it exists in the given class. (This is necessary because static methods are not permitted in interfaces.)
getConfigureName
{ "repo_name": "caiusb/vassal", "path": "src/VASSAL/configure/ConfigureTree.java", "license": "lgpl-2.1", "size": 34363 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,242,845
private static TranslationResult processSimpleMemoryAccessLiteralOrRegisterLoad( ITranslationEnvironment environment, IOperandTreeNode segmentOverride, OperandSize size, boolean loadOperand, TranslationResult intermediateResult) { final OperandSize archSize = environment.getArchitectureSize(); // Get the result of the previous translation. final String childResult = intermediateResult.getRegister(); final String loadTarget = environment.getNextVariableString(); // If we have a segment override, we need to add the segment override // into an additional temporary register before we issue the LDM // instruction. if (segmentOverride != null) { // TODO(thomasdullien): Consider refactoring the near-repetitions of // code here and elsewhere (e.g. the adding in of segment registers) // into separate functions. final String pseudoRegister = getSegmentOverridePseudoRegister(segmentOverride); final String nextVariableString = environment.getNextVariableString(); intermediateResult.addInstruction(ReilHelpers.createAdd(0, archSize, childResult, archSize, pseudoRegister, archSize, nextVariableString)); // TODO(thomasdullien): Is this inner use of loadOperand / LDM generation // even needed now? Or does the calling code take care of it now? if (loadOperand) { intermediateResult.addInstruction(ReilHelpers.createLdm(0, archSize, nextVariableString, size, loadTarget)); // Now we need to update the internal results & types. intermediateResult.updateResult(loadTarget, size, nextVariableString, TranslationResultType.MEMORY_ACCESS); } else { intermediateResult.updateResult(nextVariableString, size, nextVariableString, TranslationResultType.MEMORY_ACCESS); } } else { // Generate the LDM instruction that loads a value from the specified address. if (loadOperand) { intermediateResult.addInstruction( ReilHelpers.createLdm(0, archSize, childResult, size, loadTarget)); intermediateResult.updateResult(loadTarget, size, childResult, TranslationResultType.MEMORY_ACCESS); } else { intermediateResult.updateResult(intermediateResult.getRegister(), size, childResult, TranslationResultType.MEMORY_ACCESS); } } return intermediateResult; }
static TranslationResult function( ITranslationEnvironment environment, IOperandTreeNode segmentOverride, OperandSize size, boolean loadOperand, TranslationResult intermediateResult) { final OperandSize archSize = environment.getArchitectureSize(); final String childResult = intermediateResult.getRegister(); final String loadTarget = environment.getNextVariableString(); if (segmentOverride != null) { final String pseudoRegister = getSegmentOverridePseudoRegister(segmentOverride); final String nextVariableString = environment.getNextVariableString(); intermediateResult.addInstruction(ReilHelpers.createAdd(0, archSize, childResult, archSize, pseudoRegister, archSize, nextVariableString)); if (loadOperand) { intermediateResult.addInstruction(ReilHelpers.createLdm(0, archSize, nextVariableString, size, loadTarget)); intermediateResult.updateResult(loadTarget, size, nextVariableString, TranslationResultType.MEMORY_ACCESS); } else { intermediateResult.updateResult(nextVariableString, size, nextVariableString, TranslationResultType.MEMORY_ACCESS); } } else { if (loadOperand) { intermediateResult.addInstruction( ReilHelpers.createLdm(0, archSize, childResult, size, loadTarget)); intermediateResult.updateResult(loadTarget, size, childResult, TranslationResultType.MEMORY_ACCESS); } else { intermediateResult.updateResult(intermediateResult.getRegister(), size, childResult, TranslationResultType.MEMORY_ACCESS); } } return intermediateResult; }
/** * Generate translation for a simple memory access or register load. * * @param environment The translation environment, keeps track of temp register usage etc. * @param segmentOverride Any segment overrides that were passed down from above during the * translation. * @param size The size of the operand. * @param loadOperand Should a LDM be generated when "[" is seen? * @param intermediateResult The result of the translation so far. * @return The TranslationResult with the instructions for this operand. */
Generate translation for a simple memory access or register load
processSimpleMemoryAccessLiteralOrRegisterLoad
{ "repo_name": "crowell/binnavi", "path": "src/main/java/com/google/security/zynamics/reil/translators/x86/Helpers.java", "license": "apache-2.0", "size": 83697 }
[ "com.google.security.zynamics.reil.OperandSize", "com.google.security.zynamics.reil.ReilHelpers", "com.google.security.zynamics.reil.translators.ITranslationEnvironment", "com.google.security.zynamics.reil.translators.TranslationResult", "com.google.security.zynamics.reil.translators.TranslationResultType", "com.google.security.zynamics.zylib.disassembly.IOperandTreeNode" ]
import com.google.security.zynamics.reil.OperandSize; import com.google.security.zynamics.reil.ReilHelpers; import com.google.security.zynamics.reil.translators.ITranslationEnvironment; import com.google.security.zynamics.reil.translators.TranslationResult; import com.google.security.zynamics.reil.translators.TranslationResultType; import com.google.security.zynamics.zylib.disassembly.IOperandTreeNode;
import com.google.security.zynamics.reil.*; import com.google.security.zynamics.reil.translators.*; import com.google.security.zynamics.zylib.disassembly.*;
[ "com.google.security" ]
com.google.security;
220,045
public void undoRename4DstParent(final BlockStoragePolicySuite bsps, final INode deletedChild, int latestSnapshotId) { DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature(); assert sf != null : "Directory does not have snapshot feature"; boolean removeDeletedChild = sf.getDiffs().removeDeletedChild(deletedChild); int sid = removeDeletedChild ? Snapshot.CURRENT_STATE_ID : latestSnapshotId; final boolean added = addChild(deletedChild, true, sid); // update quota usage if adding is successfully and the old child has not // been stored in deleted list before if (added && !removeDeletedChild) { final QuotaCounts counts = deletedChild.computeQuotaUsage(bsps); addSpaceConsumed(counts); } }
void function(final BlockStoragePolicySuite bsps, final INode deletedChild, int latestSnapshotId) { DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature(); assert sf != null : STR; boolean removeDeletedChild = sf.getDiffs().removeDeletedChild(deletedChild); int sid = removeDeletedChild ? Snapshot.CURRENT_STATE_ID : latestSnapshotId; final boolean added = addChild(deletedChild, true, sid); if (added && !removeDeletedChild) { final QuotaCounts counts = deletedChild.computeQuotaUsage(bsps); addSpaceConsumed(counts); } }
/** * Undo the rename operation for the dst tree, i.e., if the rename operation * (with OVERWRITE option) removes a file/dir from the dst tree, add it back * and delete possible record in the deleted list. */
Undo the rename operation for the dst tree, i.e., if the rename operation (with OVERWRITE option) removes a file/dir from the dst tree, add it back and delete possible record in the deleted list
undoRename4DstParent
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java", "license": "apache-2.0", "size": 36327 }
[ "org.apache.hadoop.hdfs.server.blockmanagement.BlockStoragePolicySuite", "org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature", "org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot" ]
import org.apache.hadoop.hdfs.server.blockmanagement.BlockStoragePolicySuite; import org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature; import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot;
import org.apache.hadoop.hdfs.server.blockmanagement.*; import org.apache.hadoop.hdfs.server.namenode.snapshot.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,256,233
@Test void testInDigest2() { RexNode e = in(vInt(0), literal(1), plus(literal(2), vInt(1))); assertThat(e.toString(), is("OR(=(?0.int0, 1), =(?0.int0, +(2, ?0.int1)))")); }
@Test void testInDigest2() { RexNode e = in(vInt(0), literal(1), plus(literal(2), vInt(1))); assertThat(e.toString(), is(STR)); }
/** Tests that {@link #in} does not generate SEARCH if any of the arguments * are not literals. */
Tests that <code>#in</code> does not generate SEARCH if any of the arguments
testInDigest2
{ "repo_name": "datametica/calcite", "path": "core/src/test/java/org/apache/calcite/rex/RexProgramTest.java", "license": "apache-2.0", "size": 123658 }
[ "org.hamcrest.CoreMatchers", "org.hamcrest.MatcherAssert", "org.junit.jupiter.api.Test" ]
import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test;
import org.hamcrest.*; import org.junit.jupiter.api.*;
[ "org.hamcrest", "org.junit.jupiter" ]
org.hamcrest; org.junit.jupiter;
1,755,271
public String filterFragment(String alias, Map enabledFilters, Set<String> treatAsDeclarations) throws MappingException;
String function(String alias, Map enabledFilters, Set<String> treatAsDeclarations) throws MappingException;
/** * Get the where clause filter, given a query alias and considering enabled session filters */
Get the where clause filter, given a query alias and considering enabled session filters
filterFragment
{ "repo_name": "kevin-chen-hw/LDAE", "path": "com.huawei.soa.ldae/src/main/java/org/hibernate/persister/entity/Joinable.java", "license": "lgpl-2.1", "size": 3651 }
[ "java.util.Map", "java.util.Set", "org.hibernate.MappingException" ]
import java.util.Map; import java.util.Set; import org.hibernate.MappingException;
import java.util.*; import org.hibernate.*;
[ "java.util", "org.hibernate" ]
java.util; org.hibernate;
1,500,331
private void appendEntity(OutputStream outputStream, ByteArrayInputStream byteArrayInputStream) { try { byte[] buffer = new byte[BUFFER_SIZE]; while (true) { int bytesRead = byteArrayInputStream.read(buffer); if (bytesRead <= 0) { break; } outputStream.write(buffer, 0, bytesRead); } } catch (IOException e) { throw new RuntimeException(e); } }
void function(OutputStream outputStream, ByteArrayInputStream byteArrayInputStream) { try { byte[] buffer = new byte[BUFFER_SIZE]; while (true) { int bytesRead = byteArrayInputStream.read(buffer); if (bytesRead <= 0) { break; } outputStream.write(buffer, 0, bytesRead); } } catch (IOException e) { throw new RuntimeException(e); } }
/** * Append entity. * * @param outputStream * the output stream * @param byteArrayInputStream * the byte array input stream */
Append entity
appendEntity
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/mediaservices/microsoft-azure-media/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperations.java", "license": "mit", "size": 20550 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.io.OutputStream" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,426,931
public void setKeyFieldNames(List<String> keyFieldNames) { this.keyFieldNames = keyFieldNames; }
void function(List<String> keyFieldNames) { this.keyFieldNames = keyFieldNames; }
/** * Set the keyFieldNames * @param keyFieldNames the list of keyField names */
Set the keyFieldNames
setKeyFieldNames
{ "repo_name": "joshkh/intermine", "path": "intermine/api/main/src/org/intermine/api/profile/InterMineBag.java", "license": "lgpl-2.1", "size": 32953 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,588,114
final UniqueIdSupplier test = new UniqueIdSupplier("Scheme"); assertEquals(UniqueId.parse("Scheme~1"), test.get()); assertEquals(UniqueId.parse("Scheme~2"), test.get()); assertEquals(UniqueId.parse("Scheme~3"), test.get()); }
final UniqueIdSupplier test = new UniqueIdSupplier(STR); assertEquals(UniqueId.parse(STR), test.get()); assertEquals(UniqueId.parse(STR), test.get()); assertEquals(UniqueId.parse(STR), test.get()); }
/** * Tests unique id generation. */
Tests unique id generation
testBasics
{ "repo_name": "McLeodMoores/starling", "path": "projects/util/src/test/java/com/opengamma/id/UniqueIdSupplierTest.java", "license": "apache-2.0", "size": 1780 }
[ "org.testng.AssertJUnit" ]
import org.testng.AssertJUnit;
import org.testng.*;
[ "org.testng" ]
org.testng;
49,078
public static <T extends Model> void setValue(final T model, final IModelType<T> type, final Object value) throws Throwable { final MethodHandle gmh = buildAccessor(model, type, ACCESSOR_PREFIXES); final String setMethodName = buildMethodName("set", type.getKey()); final MethodHandle smh = MethodHandles .lookup() .findVirtual( model.getClass(), setMethodName, MethodType.methodType(void.class, gmh.type() .returnType())).bindTo(model); final Object objVal = coerce(value, gmh.type().returnType()); smh.invoke(objVal); }
static <T extends Model> void function(final T model, final IModelType<T> type, final Object value) throws Throwable { final MethodHandle gmh = buildAccessor(model, type, ACCESSOR_PREFIXES); final String setMethodName = buildMethodName("set", type.getKey()); final MethodHandle smh = MethodHandles .lookup() .findVirtual( model.getClass(), setMethodName, MethodType.methodType(void.class, gmh.type() .returnType())).bindTo(model); final Object objVal = coerce(value, gmh.type().returnType()); smh.invoke(objVal); }
/** * Sets a {@linkplain Model} value for a {@linkplain IModelType}. * * @param model * the {@linkplain Model} to get the value from * @param type * the {@linkplain Model} type * @param value * the value to set * @return the extracted {@linkplain Model} value * @throws Throwable * any errors during extraction */
Sets a Model value for a IModelType
setValue
{ "repo_name": "ugate/ugate", "path": "src/main/java/org/ugate/service/entity/IModelType.java", "license": "apache-2.0", "size": 10220 }
[ "java.lang.invoke.MethodHandle", "java.lang.invoke.MethodHandles", "java.lang.invoke.MethodType" ]
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType;
import java.lang.invoke.*;
[ "java.lang" ]
java.lang;
392,666
public List<MeasureDto> selectPastMeasures(DbSession dbSession, PastMeasureQuery query) { return mapper(dbSession).selectPastMeasuresOnSeveralAnalyses(query); }
List<MeasureDto> function(DbSession dbSession, PastMeasureQuery query) { return mapper(dbSession).selectPastMeasuresOnSeveralAnalyses(query); }
/** * Select measures of: * - one component * - for a list of metrics * - with analysis from a date (inclusive) - optional * - with analysis to a date (exclusive) - optional * * If no constraints on dates, all the history is returned */
Select measures of: - one component - for a list of metrics - with analysis from a date (inclusive) - optional - with analysis to a date (exclusive) - optional If no constraints on dates, all the history is returned
selectPastMeasures
{ "repo_name": "SonarSource/sonarqube", "path": "server/sonar-db-dao/src/main/java/org/sonar/db/measure/MeasureDao.java", "license": "lgpl-3.0", "size": 2741 }
[ "java.util.List", "org.sonar.db.DbSession" ]
import java.util.List; import org.sonar.db.DbSession;
import java.util.*; import org.sonar.db.*;
[ "java.util", "org.sonar.db" ]
java.util; org.sonar.db;
161,867
void startPass(String passName) { Preconditions.checkState(currentTracer == null); currentPassName = passName; currentTracer = newTracer(passName); }
void startPass(String passName) { Preconditions.checkState(currentTracer == null); currentPassName = passName; currentTracer = newTracer(passName); }
/** * Marks the beginning of a pass. */
Marks the beginning of a pass
startPass
{ "repo_name": "h4ck3rm1k3/javascript-closure-compiler-git", "path": "src/com/google/javascript/jscomp/Compiler.java", "license": "apache-2.0", "size": 76703 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,477,628
public boolean isRewriteSupported(String url) { if (rewriteHttpsOnly) return url.startsWith(WaybackConstants.HTTPS_URL_PREFIX); return true; }
boolean function(String url) { if (rewriteHttpsOnly) return url.startsWith(WaybackConstants.HTTPS_URL_PREFIX); return true; }
/** * return {@code true} if {@code url} needs rewrite in this * replay. * <p>As {@link #contextualizeUrl(String, String)} runs this test, * there's no real point doing this check outside of ReplayParseContext. * this method may be changed to {@code protected} in the future.</p> * @param url URL to test. it must be free of escaping (i.e. no {@code "https:\/\/"}.) * @return {@code true} if {@code url} needs rewrite. * @see #setRewriteHttpsOnly(boolean) */
return true if url needs rewrite in this replay. As <code>#contextualizeUrl(String, String)</code> runs this test, there's no real point doing this check outside of ReplayParseContext. this method may be changed to protected in the future
isRewriteSupported
{ "repo_name": "bitzl/openwayback", "path": "wayback-core/src/main/java/org/archive/wayback/replay/html/ReplayParseContext.java", "license": "apache-2.0", "size": 9908 }
[ "org.archive.wayback.WaybackConstants" ]
import org.archive.wayback.WaybackConstants;
import org.archive.wayback.*;
[ "org.archive.wayback" ]
org.archive.wayback;
1,079,046
public Object lookup(final Name name) throws NamingException { if (isEmpty(name)) { final Name emptyName = new CompositeName(""); return new NamingContext(emptyName, this, new Hashtable<String, Object>()); } return root.accept(new LookupVisitor(name)); }
Object function(final Name name) throws NamingException { if (isEmpty(name)) { final Name emptyName = new CompositeName(""); return new NamingContext(emptyName, this, new Hashtable<String, Object>()); } return root.accept(new LookupVisitor(name)); }
/** * Lookup the object value of a binding node in the tree. * * @param name The entry name * @return The object value of the binding * @throws NamingException */
Lookup the object value of a binding node in the tree
lookup
{ "repo_name": "xasx/wildfly", "path": "naming/src/main/java/org/jboss/as/naming/InMemoryNamingStore.java", "license": "lgpl-2.1", "size": 22452 }
[ "java.util.Hashtable", "javax.naming.CompositeName", "javax.naming.Name", "javax.naming.NamingException" ]
import java.util.Hashtable; import javax.naming.CompositeName; import javax.naming.Name; import javax.naming.NamingException;
import java.util.*; import javax.naming.*;
[ "java.util", "javax.naming" ]
java.util; javax.naming;
2,484,342
public T pop() { T returnedValue = null; if (isEmpty()) { throw new NoSuchElementException(); } if (objectStack == null) { returnedValue = firstObject; firstObject = null; } else { returnedValue = objectStack.pollLast(); objectsSet.remove(returnedValue); } return returnedValue; }
T function() { T returnedValue = null; if (isEmpty()) { throw new NoSuchElementException(); } if (objectStack == null) { returnedValue = firstObject; firstObject = null; } else { returnedValue = objectStack.pollLast(); objectsSet.remove(returnedValue); } return returnedValue; }
/** * Removes last added object from the stack. * * @return last added object * @throws NoSuchElementException - if the stack is empty */
Removes last added object from the stack
pop
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "external/jsilver/src/com/google/clearsilver/jsilver/data/UniqueStack.java", "license": "gpl-3.0", "size": 4318 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
1,873,058
public float translateX(float x) { if (mOverlay.mFacing == CameraSource.CAMERA_FACING_FRONT) { return mOverlay.getWidth() - scaleX(x); } else { return scaleX(x); } }
float function(float x) { if (mOverlay.mFacing == CameraSource.CAMERA_FACING_FRONT) { return mOverlay.getWidth() - scaleX(x); } else { return scaleX(x); } }
/** * Adjusts the x coordinate from the preview's coordinate system to the view coordinate * system. */
Adjusts the x coordinate from the preview's coordinate system to the view coordinate system
translateX
{ "repo_name": "hacktx/electron", "path": "app/src/main/java/com/hacktx/electron/vision/GraphicOverlay.java", "license": "epl-1.0", "size": 6372 }
[ "com.google.android.gms.vision.CameraSource" ]
import com.google.android.gms.vision.CameraSource;
import com.google.android.gms.vision.*;
[ "com.google.android" ]
com.google.android;
2,726,548
@SuppressWarnings("unchecked") public <P extends Stanza> P nextResult(long timeout) throws InterruptedException { throwIfCancelled(); P res = null; long remainingWait = timeout; waitStart = System.currentTimeMillis(); do { res = (P) resultQueue.poll(remainingWait, TimeUnit.MILLISECONDS); if (res != null) { return res; } remainingWait = timeout - (System.currentTimeMillis() - waitStart); } while (remainingWait > 0); return null; }
@SuppressWarnings(STR) <P extends Stanza> P function(long timeout) throws InterruptedException { throwIfCancelled(); P res = null; long remainingWait = timeout; waitStart = System.currentTimeMillis(); do { res = (P) resultQueue.poll(remainingWait, TimeUnit.MILLISECONDS); if (res != null) { return res; } remainingWait = timeout - (System.currentTimeMillis() - waitStart); } while (remainingWait > 0); return null; }
/** * Returns the next available packet. The method call will block (not return) * until a stanza(/packet) is available or the <tt>timeout</tt> has elapsed. If the * timeout elapses without a result, <tt>null</tt> will be returned. * * @param timeout the timeout in milliseconds. * @return the next available packet. * @throws InterruptedException */
Returns the next available packet. The method call will block (not return) until a stanza(/packet) is available or the timeout has elapsed. If the timeout elapses without a result, null will be returned
nextResult
{ "repo_name": "qingsong-xu/Smack", "path": "smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java", "license": "apache-2.0", "size": 11858 }
[ "java.util.concurrent.TimeUnit", "org.jivesoftware.smack.packet.Stanza" ]
import java.util.concurrent.TimeUnit; import org.jivesoftware.smack.packet.Stanza;
import java.util.concurrent.*; import org.jivesoftware.smack.packet.*;
[ "java.util", "org.jivesoftware.smack" ]
java.util; org.jivesoftware.smack;
945,726
public void onPanelOpened(DrawerPanel panel); } private boolean mIsShrinking; private int mPosition; private int mDuration; private boolean mLinearFlying; private int mHandleId; private int mContentId; private int mTapAreaId; private View mHandle; private View mContent; private View mTapArea; private Drawable mOpenedHandle; private Drawable mClosedHandle; private float mTrackX; private float mTrackY; private float mVelocity; private OnPanelListener panelListener; public static final int TOP = 0; public static final int BOTTOM = 1; public static final int LEFT = 2; public static final int RIGHT = 3; private enum State { ABOUT_TO_ANIMATE, ANIMATING, READY, TRACKING, FLYING, CLICK }; private State mState; private Interpolator mInterpolator; private GestureDetector mGestureDetector; private int mContentHeight; private int mContentWidth; private int mOrientation; private float mWeight; private PanelOnGestureListener mGestureListener; private boolean mBringToFront; private int mContentVisibility = GONE; @SuppressWarnings("deprecation") public DrawerPanel(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Panel); mDuration = a.getInteger(R.styleable.Panel_animationDuration, 750); // duration defaults to 750 ms mPosition = a.getInteger(R.styleable.Panel_position, BOTTOM); // position defaults to BOTTOM mLinearFlying = a.getBoolean(R.styleable.Panel_linearFlying, false); // linearFlying defaults to false mWeight = a.getFraction(R.styleable.Panel_weight, 0, 1, 0.0f); // weight defaults to 0.0 if (mWeight < 0 || mWeight > 1) { mWeight = 0.0f; Log.w(TAG, a.getPositionDescription() + ": weight must be > 0 and <= 1"); } mOpenedHandle = a.getDrawable(R.styleable.Panel_openedHandle); mClosedHandle = a.getDrawable(R.styleable.Panel_closedHandle); RuntimeException e = null; mHandleId = a.getResourceId(R.styleable.Panel_handle, 0); if (mHandleId == 0) { e = new IllegalArgumentException(a.getPositionDescription() + ": The handle attribute is required and must refer to a valid child."); } mContentId = a.getResourceId(R.styleable.Panel_content, 0); if (mContentId == 0) { e = new IllegalArgumentException(a.getPositionDescription() + ": The content attribute is required and must refer to a valid child."); } mTapAreaId = a.getResourceId(R.styleable.Panel_tapArea, 0); a.recycle(); float density = getResources().getDisplayMetrics().density; mMaximumMajorVelocity = (int) (MAXIMUM_MAJOR_VELOCITY * (density + 0.5f)); mMaximumAcceleration = (int) (MAXIMUM_ACCELERATION * (density + 0.5f)); if (e != null) { throw e; } mOrientation = (mPosition == TOP || mPosition == BOTTOM) ? VERTICAL : HORIZONTAL; setOrientation(mOrientation); mState = State.READY; mGestureListener = new PanelOnGestureListener(); mGestureDetector = new GestureDetector(mGestureListener); mGestureDetector.setIsLongpressEnabled(false); // i DON'T really know why i need this... setBaselineAligned(false); }
void function(DrawerPanel panel); } private boolean mIsShrinking; private int mPosition; private int mDuration; private boolean mLinearFlying; private int mHandleId; private int mContentId; private int mTapAreaId; private View mHandle; private View mContent; private View mTapArea; private Drawable mOpenedHandle; private Drawable mClosedHandle; private float mTrackX; private float mTrackY; private float mVelocity; private OnPanelListener panelListener; public static final int TOP = 0; public static final int BOTTOM = 1; public static final int LEFT = 2; public static final int RIGHT = 3; private enum State { ABOUT_TO_ANIMATE, ANIMATING, READY, TRACKING, FLYING, CLICK }; private State mState; private Interpolator mInterpolator; private GestureDetector mGestureDetector; private int mContentHeight; private int mContentWidth; private int mOrientation; private float mWeight; private PanelOnGestureListener mGestureListener; private boolean mBringToFront; private int mContentVisibility = GONE; @SuppressWarnings(STR) public DrawerPanel(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Panel); mDuration = a.getInteger(R.styleable.Panel_animationDuration, 750); mPosition = a.getInteger(R.styleable.Panel_position, BOTTOM); mLinearFlying = a.getBoolean(R.styleable.Panel_linearFlying, false); mWeight = a.getFraction(R.styleable.Panel_weight, 0, 1, 0.0f); if (mWeight < 0 mWeight > 1) { mWeight = 0.0f; Log.w(TAG, a.getPositionDescription() + STR); } mOpenedHandle = a.getDrawable(R.styleable.Panel_openedHandle); mClosedHandle = a.getDrawable(R.styleable.Panel_closedHandle); RuntimeException e = null; mHandleId = a.getResourceId(R.styleable.Panel_handle, 0); if (mHandleId == 0) { e = new IllegalArgumentException(a.getPositionDescription() + STR); } mContentId = a.getResourceId(R.styleable.Panel_content, 0); if (mContentId == 0) { e = new IllegalArgumentException(a.getPositionDescription() + STR); } mTapAreaId = a.getResourceId(R.styleable.Panel_tapArea, 0); a.recycle(); float density = getResources().getDisplayMetrics().density; mMaximumMajorVelocity = (int) (MAXIMUM_MAJOR_VELOCITY * (density + 0.5f)); mMaximumAcceleration = (int) (MAXIMUM_ACCELERATION * (density + 0.5f)); if (e != null) { throw e; } mOrientation = (mPosition == TOP mPosition == BOTTOM) ? VERTICAL : HORIZONTAL; setOrientation(mOrientation); mState = State.READY; mGestureListener = new PanelOnGestureListener(); mGestureDetector = new GestureDetector(mGestureListener); mGestureDetector.setIsLongpressEnabled(false); setBaselineAligned(false); }
/** * Invoked when the panel becomes fully opened. */
Invoked when the panel becomes fully opened
onPanelOpened
{ "repo_name": "zoozooll/MyExercise", "path": "meep/MeepHome/src/com/oregonscientific/meep/home/view/DrawerPanel.java", "license": "apache-2.0", "size": 22093 }
[ "android.content.Context", "android.content.res.TypedArray", "android.graphics.drawable.Drawable", "android.util.AttributeSet", "android.util.Log", "android.view.GestureDetector", "android.view.View", "android.view.animation.Interpolator" ]
import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.View; import android.view.animation.Interpolator;
import android.content.*; import android.content.res.*; import android.graphics.drawable.*; import android.util.*; import android.view.*; import android.view.animation.*;
[ "android.content", "android.graphics", "android.util", "android.view" ]
android.content; android.graphics; android.util; android.view;
654,584
public PathFragment getLdExecutable() { return ldExecutable; }
PathFragment function() { return ldExecutable; }
/** * Returns the execution path to the linker binary to use for this build. * Relative paths are relative to the execution root. */
Returns the execution path to the linker binary to use for this build. Relative paths are relative to the execution root
getLdExecutable
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java", "license": "apache-2.0", "size": 77508 }
[ "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
498,607
public static int[] toArray(Collection<? extends Number> collection) { if (collection instanceof IntArrayAsList) { return ((IntArrayAsList) collection).toIntArray(); } Object[] boxedArray = collection.toArray(); int len = boxedArray.length; int[] array = new int[len]; for (int i = 0; i < len; i++) { // checkNotNull for GWT (do not optimize) array[i] = ((Number) checkNotNull(boxedArray[i])).intValue(); } return array; }
static int[] function(Collection<? extends Number> collection) { if (collection instanceof IntArrayAsList) { return ((IntArrayAsList) collection).toIntArray(); } Object[] boxedArray = collection.toArray(); int len = boxedArray.length; int[] array = new int[len]; for (int i = 0; i < len; i++) { array[i] = ((Number) checkNotNull(boxedArray[i])).intValue(); } return array; }
/** * Returns an array containing each value of {@code collection}, converted to * a {@code int} value in the manner of {@link Number#intValue}. * * <p>Elements are copied from the argument collection as if by {@code * collection.toArray()}. Calling this method is as thread-safe as calling * that method. * * @param collection a collection of {@code Number} instances * @return an array containing the same values as {@code collection}, in the * same order, converted to primitives * @throws NullPointerException if {@code collection} or any of its elements * is null * @since 1.0 (parameter was {@code Collection<Integer>} before 12.0) */
Returns an array containing each value of collection, converted to a int value in the manner of <code>Number#intValue</code>. Elements are copied from the argument collection as if by collection.toArray(). Calling this method is as thread-safe as calling that method
toArray
{ "repo_name": "kingland/guava", "path": "guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/Ints.java", "license": "apache-2.0", "size": 21232 }
[ "com.google.common.base.Preconditions", "java.util.Collection" ]
import com.google.common.base.Preconditions; import java.util.Collection;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,057,954
public boolean isEqualNode(Node arg) { if (!super.isEqualNode(arg)) { return false; } boolean hasAttrs = hasAttributes(); if (hasAttrs != ((Element) arg).hasAttributes()) { return false; } if (hasAttrs) { NamedNodeMap map1 = getAttributes(); NamedNodeMap map2 = ((Element) arg).getAttributes(); int len = map1.getLength(); if (len != map2.getLength()) { return false; } for (int i = 0; i < len; i++) { Node n1 = map1.item(i); if (n1.getLocalName() == null) { // DOM Level 1 Node Node n2 = map2.getNamedItem(n1.getNodeName()); if (n2 == null || !((NodeImpl) n1).isEqualNode(n2)) { return false; } } else { Node n2 = map2.getNamedItemNS(n1.getNamespaceURI(), n1.getLocalName()); if (n2 == null || !((NodeImpl) n1).isEqualNode(n2)) { return false; } } } } return true; }
boolean function(Node arg) { if (!super.isEqualNode(arg)) { return false; } boolean hasAttrs = hasAttributes(); if (hasAttrs != ((Element) arg).hasAttributes()) { return false; } if (hasAttrs) { NamedNodeMap map1 = getAttributes(); NamedNodeMap map2 = ((Element) arg).getAttributes(); int len = map1.getLength(); if (len != map2.getLength()) { return false; } for (int i = 0; i < len; i++) { Node n1 = map1.item(i); if (n1.getLocalName() == null) { Node n2 = map2.getNamedItem(n1.getNodeName()); if (n2 == null !((NodeImpl) n1).isEqualNode(n2)) { return false; } } else { Node n2 = map2.getNamedItemNS(n1.getNamespaceURI(), n1.getLocalName()); if (n2 == null !((NodeImpl) n1).isEqualNode(n2)) { return false; } } } } return true; }
/** * DOM Level 3 WD- Experimental. * Override inherited behavior from NodeImpl and ParentNode to check on * attributes */
DOM Level 3 WD- Experimental. Override inherited behavior from NodeImpl and ParentNode to check on attributes
isEqualNode
{ "repo_name": "itgeeker/jdk", "path": "src/com/sun/org/apache/xerces/internal/dom/ElementImpl.java", "license": "apache-2.0", "size": 42962 }
[ "org.w3c.dom.Element", "org.w3c.dom.NamedNodeMap", "org.w3c.dom.Node" ]
import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,476,205
public short getNormStartAsShort() { return Numbers.castToShort(getNormStartAsLong()); }
short function() { return Numbers.castToShort(getNormStartAsLong()); }
/** * Gets the normalized start value (as {@code short}). * * @return the normalized start value (as {@code short}) */
Gets the normalized start value (as short)
getNormStartAsShort
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "src/net/meisen/dissertation/model/time/mapper/BaseMapper.java", "license": "bsd-3-clause", "size": 24492 }
[ "net.meisen.general.genmisc.types.Numbers" ]
import net.meisen.general.genmisc.types.Numbers;
import net.meisen.general.genmisc.types.*;
[ "net.meisen.general" ]
net.meisen.general;
825,420
private Map<String, List<DatabaseRemoteFile>> retrieveAllRemoteDatabaseFiles() throws StorageException { SortedMap<String, List<DatabaseRemoteFile>> allDatabaseRemoteFilesMap = new TreeMap<String, List<DatabaseRemoteFile>>(); Map<String, DatabaseRemoteFile> allDatabaseRemoteFiles = transferManager.list(DatabaseRemoteFile.class); for (Map.Entry<String, DatabaseRemoteFile> entry : allDatabaseRemoteFiles.entrySet()) { String clientName = entry.getValue().getClientName(); if (allDatabaseRemoteFilesMap.get(clientName) == null) { allDatabaseRemoteFilesMap.put(clientName, new ArrayList<DatabaseRemoteFile>()); } allDatabaseRemoteFilesMap.get(clientName).add(entry.getValue()); } return allDatabaseRemoteFilesMap; }
Map<String, List<DatabaseRemoteFile>> function() throws StorageException { SortedMap<String, List<DatabaseRemoteFile>> allDatabaseRemoteFilesMap = new TreeMap<String, List<DatabaseRemoteFile>>(); Map<String, DatabaseRemoteFile> allDatabaseRemoteFiles = transferManager.list(DatabaseRemoteFile.class); for (Map.Entry<String, DatabaseRemoteFile> entry : allDatabaseRemoteFiles.entrySet()) { String clientName = entry.getValue().getClientName(); if (allDatabaseRemoteFilesMap.get(clientName) == null) { allDatabaseRemoteFilesMap.put(clientName, new ArrayList<DatabaseRemoteFile>()); } allDatabaseRemoteFilesMap.get(clientName).add(entry.getValue()); } return allDatabaseRemoteFilesMap; }
/** * This method obtains a Map with Lists of {@link DatabaseRemoteFile}s as values, by listing them in the remote repo and * collecting the files per client. * * @return a Map with clientNames as keys and lists of corresponding DatabaseRemoteFiles as values. */
This method obtains a Map with Lists of <code>DatabaseRemoteFile</code>s as values, by listing them in the remote repo and collecting the files per client
retrieveAllRemoteDatabaseFiles
{ "repo_name": "syncany/syncany-plugin-dropbox", "path": "core/syncany-lib/src/main/java/org/syncany/operations/cleanup/CleanupOperation.java", "license": "gpl-3.0", "size": 24865 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "java.util.SortedMap", "java.util.TreeMap", "org.syncany.plugins.transfer.StorageException", "org.syncany.plugins.transfer.files.DatabaseRemoteFile" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import org.syncany.plugins.transfer.StorageException; import org.syncany.plugins.transfer.files.DatabaseRemoteFile;
import java.util.*; import org.syncany.plugins.transfer.*; import org.syncany.plugins.transfer.files.*;
[ "java.util", "org.syncany.plugins" ]
java.util; org.syncany.plugins;
1,887,679
Cell source = new Cell(3, 3); Cell dest = new Cell(2, 5); Figure one = new Knight(source); Cell[] route = one.way(source, dest); assertThat(route.length, is(2)); assertThat(route[0].getX(), is(source.getX())); assertThat(route[0].getY(), is(source.getY())); assertThat(route[1].getX(), is(dest.getX())); assertThat(route[1].getY(), is(dest.getY())); }
Cell source = new Cell(3, 3); Cell dest = new Cell(2, 5); Figure one = new Knight(source); Cell[] route = one.way(source, dest); assertThat(route.length, is(2)); assertThat(route[0].getX(), is(source.getX())); assertThat(route[0].getY(), is(source.getY())); assertThat(route[1].getX(), is(dest.getX())); assertThat(route[1].getY(), is(dest.getY())); }
/** * Test when route is right 1. */
Test when route is right 1
whenWayRightOneThenReturnRoute
{ "repo_name": "tgenman/dbondarev", "path": "chapter_002/src/test/java/ru.job4j/chess/KnightTest.java", "license": "apache-2.0", "size": 4467 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
1,822,918
public static void setIllegalMemoryAccessListener(IllegalMemoryAccessListener illegalMemoryAccessListener) { MySafeDelegator.setIllegalMemoryAccessListener(illegalMemoryAccessListener); }
static void function(IllegalMemoryAccessListener illegalMemoryAccessListener) { MySafeDelegator.setIllegalMemoryAccessListener(illegalMemoryAccessListener); }
/** * Sets the given {@link IllegalMemoryAccessListener} instance. * * @param illegalMemoryAccessListener the {@link IllegalMemoryAccessListener} instance to be set */
Sets the given <code>IllegalMemoryAccessListener</code> instance
setIllegalMemoryAccessListener
{ "repo_name": "serkan-ozal/mysafe", "path": "src/main/java/tr/com/serkanozal/mysafe/MySafe.java", "license": "apache-2.0", "size": 8689 }
[ "tr.com.serkanozal.mysafe.impl.MySafeDelegator" ]
import tr.com.serkanozal.mysafe.impl.MySafeDelegator;
import tr.com.serkanozal.mysafe.impl.*;
[ "tr.com.serkanozal" ]
tr.com.serkanozal;
2,788,652
@Override public void afterPropertiesSet() throws Exception { if (StringUtils.isNotEmpty(username)) { Assert.notNull(userPasswordSetter, "userPasswordSetter required if username is not empty"); } }
void function() throws Exception { if (StringUtils.isNotEmpty(username)) { Assert.notNull(userPasswordSetter, STR); } }
/** * JAVADOC Method Level Comments * * @throws Exception JAVADOC. */
JAVADOC Method Level Comments
afterPropertiesSet
{ "repo_name": "cucina/opencucina", "path": "nosql/security/src/main/java/org/cucina/security/service/SystemUserServiceImpl.java", "license": "apache-2.0", "size": 3002 }
[ "org.apache.commons.lang3.StringUtils", "org.springframework.util.Assert" ]
import org.apache.commons.lang3.StringUtils; import org.springframework.util.Assert;
import org.apache.commons.lang3.*; import org.springframework.util.*;
[ "org.apache.commons", "org.springframework.util" ]
org.apache.commons; org.springframework.util;
1,732,412
private void initLatchSDK(Properties properties) throws OXException { latchApplicationId = getRequiredProperty(properties, "latch.applicationId"); latchApplicationSecret = getRequiredProperty(properties, "latch.applicationSecret"); latchOperationId = properties.getProperty("latch.operationId"); latchSDK = new LatchSDKImpl(latchApplicationId, latchApplicationSecret); if (properties.getProperty("latch.stopOnError") != null) { if (properties.getProperty("latch.stopOnError").equals("true")) { stopOnError = true; } } }
void function(Properties properties) throws OXException { latchApplicationId = getRequiredProperty(properties, STR); latchApplicationSecret = getRequiredProperty(properties, STR); latchOperationId = properties.getProperty(STR); latchSDK = new LatchSDKImpl(latchApplicationId, latchApplicationSecret); if (properties.getProperty(STR) != null) { if (properties.getProperty(STR).equals("true")) { stopOnError = true; } } }
/** * Initializes the Latch SDK and the stopOnError parameter. * * @throws OXException * If something goes wrong. */
Initializes the Latch SDK and the stopOnError parameter
initLatchSDK
{ "repo_name": "ElevenPaths/latch-plugin-open-xchange", "path": "src/main/java/com/elevenpaths/latch/plugins/openexchange/config/LatchConfig.java", "license": "lgpl-2.1", "size": 9839 }
[ "com.elevenpaths.latch.sdk.impl.LatchSDKImpl", "com.openexchange.exception.OXException", "java.util.Properties" ]
import com.elevenpaths.latch.sdk.impl.LatchSDKImpl; import com.openexchange.exception.OXException; import java.util.Properties;
import com.elevenpaths.latch.sdk.impl.*; import com.openexchange.exception.*; import java.util.*;
[ "com.elevenpaths.latch", "com.openexchange.exception", "java.util" ]
com.elevenpaths.latch; com.openexchange.exception; java.util;
530,335
@Override public String toString() { return ToStringBuilder.reflectionToString(this); }
String function() { return ToStringBuilder.reflectionToString(this); }
/** * Default toString implementation * * @return This object as String. */
Default toString implementation
toString
{ "repo_name": "cucina/opencucina", "path": "loader/src/main/java/org/cucina/loader/FileLoaderContainer.java", "license": "apache-2.0", "size": 2871 }
[ "org.apache.commons.lang3.builder.ToStringBuilder" ]
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.*;
[ "org.apache.commons" ]
org.apache.commons;
1,772,435
@Test @MediumTest @Feature({"Browser", "Main"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) public void testTabCountLabel() { final int tabCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); tabCountLabelCheck("Initial state", tabCount); ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); // Make sure the TAB_CREATED notification went through InstrumentationRegistry.getInstrumentation().waitForIdleSync(); tabCountLabelCheck("After new tab", tabCount + 1); ChromeTabUtils.closeCurrentTab( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); // Make sure the TAB_CLOSED notification went through InstrumentationRegistry.getInstrumentation().waitForIdleSync(); tabCountLabelCheck("After close tab", tabCount); }
@Feature({STR, "Main"}) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) void function() { final int tabCount = mActivityTestRule.getActivity().getCurrentTabModel().getCount(); tabCountLabelCheck(STR, tabCount); ChromeTabUtils.newTabFromMenu( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); tabCountLabelCheck(STR, tabCount + 1); ChromeTabUtils.closeCurrentTab( InstrumentationRegistry.getInstrumentation(), mActivityTestRule.getActivity()); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); tabCountLabelCheck(STR, tabCount); }
/** * Verify displayed Tab Count matches the actual number of tabs. */
Verify displayed Tab Count matches the actual number of tabs
testTabCountLabel
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/android/javatests/src/org/chromium/chrome/browser/TabCountLabelTest.java", "license": "bsd-3-clause", "size": 3137 }
[ "android.support.test.InstrumentationRegistry", "org.chromium.base.test.util.Feature", "org.chromium.base.test.util.Restriction", "org.chromium.chrome.test.util.ChromeTabUtils", "org.chromium.ui.test.util.UiRestriction" ]
import android.support.test.InstrumentationRegistry; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.ui.test.util.UiRestriction;
import android.support.test.*; import org.chromium.base.test.util.*; import org.chromium.chrome.test.util.*; import org.chromium.ui.test.util.*;
[ "android.support", "org.chromium.base", "org.chromium.chrome", "org.chromium.ui" ]
android.support; org.chromium.base; org.chromium.chrome; org.chromium.ui;
2,023,137
public Element createLocale(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) { // add an element with a "locale" attribute to the given root node Element element = root.addElement(getInnerName()); element.addAttribute(XSD_ATTRIBUTE_VALUE_LANGUAGE, locale.toString()); // now generate the default XML for the element return createDefaultXml(cms, document, element, locale); }
Element function(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) { Element element = root.addElement(getInnerName()); element.addAttribute(XSD_ATTRIBUTE_VALUE_LANGUAGE, locale.toString()); return createDefaultXml(cms, document, element, locale); }
/** * Generates a valid locale (language) element for the XML schema of this content definition.<p> * * @param cms the current users OpenCms context * @param document the OpenCms XML document the XML is created for * @param root the root node of the document where to append the locale to * @param locale the locale to create the default element in the document with * * @return a valid XML element for the locale according to the XML schema of this content definition */
Generates a valid locale (language) element for the XML schema of this content definition
createLocale
{ "repo_name": "mediaworx/opencms-core", "path": "src/org/opencms/xml/CmsXmlContentDefinition.java", "license": "lgpl-2.1", "size": 62589 }
[ "java.util.Locale", "org.dom4j.Element", "org.opencms.file.CmsObject" ]
import java.util.Locale; import org.dom4j.Element; import org.opencms.file.CmsObject;
import java.util.*; import org.dom4j.*; import org.opencms.file.*;
[ "java.util", "org.dom4j", "org.opencms.file" ]
java.util; org.dom4j; org.opencms.file;
2,915,633
protected void handleSplitAction(SolrQueryRequest adminReq, SolrQueryResponse rsp) throws IOException { SolrParams params = adminReq.getParams(); List<DocRouter.Range> ranges = null; String[] pathsArr = params.getParams("path"); String rangesStr = params.get(CoreAdminParams.RANGES); // ranges=a-b,c-d,e-f if (rangesStr != null) { String[] rangesArr = rangesStr.split(","); if (rangesArr.length == 0) { throw new SolrException(ErrorCode.BAD_REQUEST, "There must be at least one range specified to split an index"); } else { ranges = new ArrayList<DocRouter.Range>(rangesArr.length); for (String r : rangesArr) { try { ranges.add(DocRouter.DEFAULT.fromString(r)); } catch (Exception e) { throw new SolrException(ErrorCode.BAD_REQUEST, "Exception parsing hexadecimal hash range: " + r, e); } } } } String splitKey = params.get("split.key"); String[] newCoreNames = params.getParams("targetCore"); String cname = params.get(CoreAdminParams.CORE, ""); if ((pathsArr == null || pathsArr.length == 0) && (newCoreNames == null || newCoreNames.length == 0)) { throw new SolrException(ErrorCode.BAD_REQUEST, "Either path or targetCore param must be specified"); } log.info("Invoked split action for core: " + cname); SolrCore core = coreContainer.getCore(cname); SolrQueryRequest req = new LocalSolrQueryRequest(core, params); List<SolrCore> newCores = null; try { // TODO: allow use of rangesStr in the future List<String> paths = null; int partitions = pathsArr != null ? pathsArr.length : newCoreNames.length; DocRouter router = null; String routeFieldName = null; if (coreContainer.isZooKeeperAware()) { ClusterState clusterState = coreContainer.getZkController().getClusterState(); String collectionName = req.getCore().getCoreDescriptor().getCloudDescriptor().getCollectionName(); DocCollection collection = clusterState.getCollection(collectionName); String sliceName = req.getCore().getCoreDescriptor().getCloudDescriptor().getShardId(); Slice slice = clusterState.getSlice(collectionName, sliceName); router = collection.getRouter() != null ? collection.getRouter() : DocRouter.DEFAULT; if (ranges == null) { DocRouter.Range currentRange = slice.getRange(); ranges = currentRange != null ? router.partitionRange(partitions, currentRange) : null; } Object routerObj = collection.get(DOC_ROUTER); // for back-compat with Solr 4.4 if (routerObj != null && routerObj instanceof Map) { Map routerProps = (Map) routerObj; routeFieldName = (String) routerProps.get("field"); } } if (pathsArr == null) { newCores = new ArrayList<SolrCore>(partitions); for (String newCoreName : newCoreNames) { SolrCore newcore = coreContainer.getCore(newCoreName); if (newcore != null) { newCores.add(newcore); } else { throw new SolrException(ErrorCode.BAD_REQUEST, "Core with core name " + newCoreName + " expected but doesn't exist."); } } } else { paths = Arrays.asList(pathsArr); } SplitIndexCommand cmd = new SplitIndexCommand(req, paths, newCores, ranges, router, routeFieldName, splitKey); core.getUpdateHandler().split(cmd); // After the split has completed, someone (here?) should start the process of replaying the buffered updates. } catch (Exception e) { log.error("ERROR executing split:", e); throw new RuntimeException(e); } finally { if (req != null) req.close(); if (core != null) core.close(); if (newCores != null) { for (SolrCore newCore : newCores) { newCore.close(); } } } }
void function(SolrQueryRequest adminReq, SolrQueryResponse rsp) throws IOException { SolrParams params = adminReq.getParams(); List<DocRouter.Range> ranges = null; String[] pathsArr = params.getParams("path"); String rangesStr = params.get(CoreAdminParams.RANGES); if (rangesStr != null) { String[] rangesArr = rangesStr.split(","); if (rangesArr.length == 0) { throw new SolrException(ErrorCode.BAD_REQUEST, STR); } else { ranges = new ArrayList<DocRouter.Range>(rangesArr.length); for (String r : rangesArr) { try { ranges.add(DocRouter.DEFAULT.fromString(r)); } catch (Exception e) { throw new SolrException(ErrorCode.BAD_REQUEST, STR + r, e); } } } } String splitKey = params.get(STR); String[] newCoreNames = params.getParams(STR); String cname = params.get(CoreAdminParams.CORE, STREither path or targetCore param must be specifiedSTRInvoked split action for core: STRfieldSTRCore with core name STR expected but doesn't exist.STRERROR executing split:", e); throw new RuntimeException(e); } finally { if (req != null) req.close(); if (core != null) core.close(); if (newCores != null) { for (SolrCore newCore : newCores) { newCore.close(); } } } }
/** * Handle the core admin SPLIT action. */
Handle the core admin SPLIT action
handleSplitAction
{ "repo_name": "pengzong1111/solr4", "path": "solr/core/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java", "license": "apache-2.0", "size": 43091 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.solr.common.SolrException", "org.apache.solr.common.cloud.DocRouter", "org.apache.solr.common.params.CoreAdminParams", "org.apache.solr.common.params.SolrParams", "org.apache.solr.core.SolrCore", "org.apache.solr.request.SolrQueryRequest", "org.apache.solr.response.SolrQueryResponse" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.solr.common.SolrException; import org.apache.solr.common.cloud.DocRouter; import org.apache.solr.common.params.CoreAdminParams; import org.apache.solr.common.params.SolrParams; import org.apache.solr.core.SolrCore; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.response.SolrQueryResponse;
import java.io.*; import java.util.*; import org.apache.solr.common.*; import org.apache.solr.common.cloud.*; import org.apache.solr.common.params.*; import org.apache.solr.core.*; import org.apache.solr.request.*; import org.apache.solr.response.*;
[ "java.io", "java.util", "org.apache.solr" ]
java.io; java.util; org.apache.solr;
1,938,655
IndicesStatsRequestBuilder prepareStats(String... indices);
IndicesStatsRequestBuilder prepareStats(String... indices);
/** * Indices stats. */
Indices stats
prepareStats
{ "repo_name": "ern/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java", "license": "apache-2.0", "size": 26477 }
[ "org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder" ]
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
import org.elasticsearch.action.admin.indices.stats.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
587,159
public Count getHeartbeatCount() { return this.m_heartbeatCount; }
Count function() { return this.m_heartbeatCount; }
/** * Get count of heartbeats * * @return count of heartbeats */
Get count of heartbeats
getHeartbeatCount
{ "repo_name": "Fiware/i2nd.KIARA", "path": "src/main/java/org/fiware/kiara/ps/rtps/writer/StatefulWriter.java", "license": "lgpl-3.0", "size": 18951 }
[ "org.fiware.kiara.ps.rtps.messages.elements.Count" ]
import org.fiware.kiara.ps.rtps.messages.elements.Count;
import org.fiware.kiara.ps.rtps.messages.elements.*;
[ "org.fiware.kiara" ]
org.fiware.kiara;
2,481,662
public void setChildren( List<ExprNode> list ) { children = list; }
void function( List<ExprNode> list ) { children = list; }
/** * Sets the list of children under this node. * * @param list the list of children to set. */
Sets the list of children under this node
setChildren
{ "repo_name": "darranl/directory-shared", "path": "ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/BranchNode.java", "license": "apache-2.0", "size": 7347 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,323,411
public static PopulateChunkEvent.Pre createPopulateChunkEventPre(Game game, Cause cause, List<Populator> pendingPopulators, Chunk targetChunk) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("cause", cause); values.put("pendingPopulators", pendingPopulators); values.put("targetChunk", targetChunk); return SpongeEventFactoryUtils.createEventImpl(PopulateChunkEvent.Pre.class, values); }
static PopulateChunkEvent.Pre function(Game game, Cause cause, List<Populator> pendingPopulators, Chunk targetChunk) { Map<String, Object> values = Maps.newHashMap(); values.put("game", game); values.put("cause", cause); values.put(STR, pendingPopulators); values.put(STR, targetChunk); return SpongeEventFactoryUtils.createEventImpl(PopulateChunkEvent.Pre.class, values); }
/** * AUTOMATICALLY GENERATED, DO NOT EDIT. * Creates a new instance of * {@link org.spongepowered.api.event.world.chunk.PopulateChunkEvent.Pre}. * * @param game The game * @param cause The cause * @param pendingPopulators The pending populators * @param targetChunk The target chunk * @return A new pre populate chunk event */
AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.world.chunk.PopulateChunkEvent.Pre</code>
createPopulateChunkEventPre
{ "repo_name": "jamierocks/SpongeAPI", "path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java", "license": "mit", "size": 196993 }
[ "com.google.common.collect.Maps", "java.util.List", "java.util.Map", "org.spongepowered.api.Game", "org.spongepowered.api.event.cause.Cause", "org.spongepowered.api.event.world.chunk.PopulateChunkEvent", "org.spongepowered.api.world.Chunk", "org.spongepowered.api.world.gen.Populator" ]
import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import org.spongepowered.api.Game; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.world.chunk.PopulateChunkEvent; import org.spongepowered.api.world.Chunk; import org.spongepowered.api.world.gen.Populator;
import com.google.common.collect.*; import java.util.*; import org.spongepowered.api.*; import org.spongepowered.api.event.cause.*; import org.spongepowered.api.event.world.chunk.*; import org.spongepowered.api.world.*; import org.spongepowered.api.world.gen.*;
[ "com.google.common", "java.util", "org.spongepowered.api" ]
com.google.common; java.util; org.spongepowered.api;
2,173,336
boolean GetProcessTimes(HANDLE handle, LongByReference lpCreationTime, LongByReference lpExitTime, LongByReference lpKernelTime, LongByReference lpUserTime);
boolean GetProcessTimes(HANDLE handle, LongByReference lpCreationTime, LongByReference lpExitTime, LongByReference lpKernelTime, LongByReference lpUserTime);
/** * Gets the process times. * * @param handle * the h process * @param lpCreationTime * the lp creation time * @param lpExitTime * the lp exit time * @param lpKernelTime * the lp kernel time * @param lpUserTime * the lp user time * * @return true, if successful */
Gets the process times
GetProcessTimes
{ "repo_name": "ColFusion/PentahoKettle", "path": "CarteService/default/src/main/java/org/rzo/yajsw/os/ms/win/w32/WindowsXPProcess.java", "license": "mit", "size": 113666 }
[ "com.sun.jna.ptr.LongByReference" ]
import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.*;
[ "com.sun.jna" ]
com.sun.jna;
2,356,233
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); HttpSession session = request.getSession(); String type = request.getParameter("type"); if(type.equals("accountDetails")){ String username = request.getParameter("username"); String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String password = request.getParameter("password"); String email = request.getParameter("email"); SiteUser user1 = SiteUser.getUser(username); user1.setFirstName(firstName); user1.setLastName(lastName); user1.setPassword(password); user1.setEmail(email); user1.editAccount(); session.setAttribute("siteUser", user1); request.getRequestDispatcher("userPage.jsp").forward(request, response); } else if(type.equals("personalDetails")){ String username = request.getParameter("username"); String bio = request.getParameter("bio"); String img = request.getParameter("img"); String location = request.getParameter("location"); String gender = request.getParameter("gender"); SiteUser user1 = SiteUser.getUser(username); user1.setBio(bio); user1.setImg(img); user1.setLocation(location); user1.setGender(gender); user1.editBio(); session.setAttribute("siteUser", user1); request.getRequestDispatcher("userPage.jsp").forward(request, response); } else{ request.getRequestDispatcher("userPage.jsp").forward(request, response); } }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(STR); HttpSession session = request.getSession(); String type = request.getParameter("type"); if(type.equals(STR)){ String username = request.getParameter(STR); String firstName = request.getParameter(STR); String lastName = request.getParameter(STR); String password = request.getParameter(STR); String email = request.getParameter("email"); SiteUser user1 = SiteUser.getUser(username); user1.setFirstName(firstName); user1.setLastName(lastName); user1.setPassword(password); user1.setEmail(email); user1.editAccount(); session.setAttribute(STR, user1); request.getRequestDispatcher(STR).forward(request, response); } else if(type.equals(STR)){ String username = request.getParameter(STR); String bio = request.getParameter("bio"); String img = request.getParameter("img"); String location = request.getParameter(STR); String gender = request.getParameter(STR); SiteUser user1 = SiteUser.getUser(username); user1.setBio(bio); user1.setImg(img); user1.setLocation(location); user1.setGender(gender); user1.editBio(); session.setAttribute(STR, user1); request.getRequestDispatcher(STR).forward(request, response); } else{ request.getRequestDispatcher(STR).forward(request, response); } }
/** * Processes requests for both HTTP * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods
processRequest
{ "repo_name": "JackLClements/AluminiSite", "path": "AluminiWebsite/src/java/alumini/EditController.java", "license": "apache-2.0", "size": 4277 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "javax.servlet.http.HttpSession" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
888,803
public void addMapPrinciple(MapPrinciple mapPrinciple);
void function(MapPrinciple mapPrinciple);
/** * Adds the map principle. * * @param mapPrinciple the map principle */
Adds the map principle
addMapPrinciple
{ "repo_name": "IHTSDO/OTF-Mapping-Service", "path": "model/src/main/java/org/ihtsdo/otf/mapping/helpers/MapPrincipleList.java", "license": "apache-2.0", "size": 848 }
[ "org.ihtsdo.otf.mapping.model.MapPrinciple" ]
import org.ihtsdo.otf.mapping.model.MapPrinciple;
import org.ihtsdo.otf.mapping.model.*;
[ "org.ihtsdo.otf" ]
org.ihtsdo.otf;
1,641,858
public Table createRandomTable(TableName tableName, final Collection<String> families, final int maxVersions, final int numColsPerRow, final int numFlushes, final int numRegions, final int numRowsPerFlush) throws IOException, InterruptedException { LOG.info("\n\nCreating random table " + tableName + " with " + numRegions + " regions, " + numFlushes + " storefiles per region, " + numRowsPerFlush + " rows per flush, maxVersions=" + maxVersions + "\n"); final Random rand = new Random(tableName.hashCode() * 17L + 12938197137L); final int numCF = families.size(); final byte[][] cfBytes = new byte[numCF][]; { int cfIndex = 0; for (String cf : families) { cfBytes[cfIndex++] = Bytes.toBytes(cf); } } final int actualStartKey = 0; final int actualEndKey = Integer.MAX_VALUE; final int keysPerRegion = (actualEndKey - actualStartKey) / numRegions; final int splitStartKey = actualStartKey + keysPerRegion; final int splitEndKey = actualEndKey - keysPerRegion; final String keyFormat = "%08x"; final Table table = createTable(tableName, cfBytes, maxVersions, Bytes.toBytes(String.format(keyFormat, splitStartKey)), Bytes.toBytes(String.format(keyFormat, splitEndKey)), numRegions); if (hbaseCluster != null) { getMiniHBaseCluster().flushcache(TableName.META_TABLE_NAME); } BufferedMutator mutator = getConnection().getBufferedMutator(tableName); for (int iFlush = 0; iFlush < numFlushes; ++iFlush) { for (int iRow = 0; iRow < numRowsPerFlush; ++iRow) { final byte[] row = Bytes.toBytes( String.format(keyFormat, actualStartKey + rand.nextInt(actualEndKey - actualStartKey))); Put put = new Put(row); Delete del = new Delete(row); for (int iCol = 0; iCol < numColsPerRow; ++iCol) { final byte[] cf = cfBytes[rand.nextInt(numCF)]; final long ts = rand.nextInt(); final byte[] qual = Bytes.toBytes("col" + iCol); if (rand.nextBoolean()) { final byte[] value = Bytes.toBytes("value_for_row_" + iRow + "_cf_" + Bytes.toStringBinary(cf) + "_col_" + iCol + "_ts_" + ts + "_random_" + rand.nextLong()); put.addColumn(cf, qual, ts, value); } else if (rand.nextDouble() < 0.8) { del.addColumn(cf, qual, ts); } else { del.addColumns(cf, qual, ts); } } if (!put.isEmpty()) { mutator.mutate(put); } if (!del.isEmpty()) { mutator.mutate(del); } } LOG.info("Initiating flush #" + iFlush + " for table " + tableName); mutator.flush(); if (hbaseCluster != null) { getMiniHBaseCluster().flushcache(table.getName()); } } mutator.close(); return table; }
Table function(TableName tableName, final Collection<String> families, final int maxVersions, final int numColsPerRow, final int numFlushes, final int numRegions, final int numRowsPerFlush) throws IOException, InterruptedException { LOG.info(STR + tableName + STR + numRegions + STR + numFlushes + STR + numRowsPerFlush + STR + maxVersions + "\n"); final Random rand = new Random(tableName.hashCode() * 17L + 12938197137L); final int numCF = families.size(); final byte[][] cfBytes = new byte[numCF][]; { int cfIndex = 0; for (String cf : families) { cfBytes[cfIndex++] = Bytes.toBytes(cf); } } final int actualStartKey = 0; final int actualEndKey = Integer.MAX_VALUE; final int keysPerRegion = (actualEndKey - actualStartKey) / numRegions; final int splitStartKey = actualStartKey + keysPerRegion; final int splitEndKey = actualEndKey - keysPerRegion; final String keyFormat = "%08x"; final Table table = createTable(tableName, cfBytes, maxVersions, Bytes.toBytes(String.format(keyFormat, splitStartKey)), Bytes.toBytes(String.format(keyFormat, splitEndKey)), numRegions); if (hbaseCluster != null) { getMiniHBaseCluster().flushcache(TableName.META_TABLE_NAME); } BufferedMutator mutator = getConnection().getBufferedMutator(tableName); for (int iFlush = 0; iFlush < numFlushes; ++iFlush) { for (int iRow = 0; iRow < numRowsPerFlush; ++iRow) { final byte[] row = Bytes.toBytes( String.format(keyFormat, actualStartKey + rand.nextInt(actualEndKey - actualStartKey))); Put put = new Put(row); Delete del = new Delete(row); for (int iCol = 0; iCol < numColsPerRow; ++iCol) { final byte[] cf = cfBytes[rand.nextInt(numCF)]; final long ts = rand.nextInt(); final byte[] qual = Bytes.toBytes("col" + iCol); if (rand.nextBoolean()) { final byte[] value = Bytes.toBytes(STR + iRow + "_cf_" + Bytes.toStringBinary(cf) + "_col_" + iCol + "_ts_" + ts + STR + rand.nextLong()); put.addColumn(cf, qual, ts, value); } else if (rand.nextDouble() < 0.8) { del.addColumn(cf, qual, ts); } else { del.addColumns(cf, qual, ts); } } if (!put.isEmpty()) { mutator.mutate(put); } if (!del.isEmpty()) { mutator.mutate(del); } } LOG.info(STR + iFlush + STR + tableName); mutator.flush(); if (hbaseCluster != null) { getMiniHBaseCluster().flushcache(table.getName()); } } mutator.close(); return table; }
/** * Creates a random table with the given parameters */
Creates a random table with the given parameters
createRandomTable
{ "repo_name": "mahak/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java", "license": "apache-2.0", "size": 151013 }
[ "java.io.IOException", "java.util.Collection", "java.util.Random", "org.apache.hadoop.hbase.client.BufferedMutator", "org.apache.hadoop.hbase.client.Delete", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.client.Table", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.IOException; import java.util.Collection; import java.util.Random; import org.apache.hadoop.hbase.client.BufferedMutator; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
404,285
public T targetFilterQuery(final String targetFilterQuery) { this.targetFilterQuery = StringUtils.trimWhitespace(targetFilterQuery); return (T) this; }
T function(final String targetFilterQuery) { this.targetFilterQuery = StringUtils.trimWhitespace(targetFilterQuery); return (T) this; }
/** * Filter of the rollout * * @param targetFilterQuery * query * @return this builder */
Filter of the rollout
targetFilterQuery
{ "repo_name": "eclipse/hawkbit", "path": "hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/builder/AbstractRolloutUpdateCreate.java", "license": "epl-1.0", "size": 3279 }
[ "org.springframework.util.StringUtils" ]
import org.springframework.util.StringUtils;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
2,279,025
void add(@Nonnull TopLevelItem item) throws IOException, IllegalArgumentException;
void add(@Nonnull TopLevelItem item) throws IOException, IllegalArgumentException;
/** * Add item to this view. * * @throws IOException Adding failed. * @throws IllegalArgumentException View rejected to add an item. */
Add item to this view
add
{ "repo_name": "ErikVerheul/jenkins", "path": "core/src/main/java/hudson/model/DirectlyModifiableView.java", "license": "mit", "size": 2835 }
[ "java.io.IOException", "javax.annotation.Nonnull" ]
import java.io.IOException; import javax.annotation.Nonnull;
import java.io.*; import javax.annotation.*;
[ "java.io", "javax.annotation" ]
java.io; javax.annotation;
1,411,552
public Iterator<GraphNode> nodeIterator() { return this.mGraphImplementor.nodeIterator(); }
Iterator<GraphNode> function() { return this.mGraphImplementor.nodeIterator(); }
/** * Returns an iterator for the nodes in the Graph. These iterators are fail safe. * * @return Iterator */
Returns an iterator for the nodes in the Graph. These iterators are fail safe
nodeIterator
{ "repo_name": "pegasus-isi/pegasus", "path": "src/edu/isi/pegasus/planner/classes/ADag.java", "license": "apache-2.0", "size": 34906 }
[ "edu.isi.pegasus.planner.partitioner.graph.GraphNode", "java.util.Iterator" ]
import edu.isi.pegasus.planner.partitioner.graph.GraphNode; import java.util.Iterator;
import edu.isi.pegasus.planner.partitioner.graph.*; import java.util.*;
[ "edu.isi.pegasus", "java.util" ]
edu.isi.pegasus; java.util;
1,042,794
List<EventsServed> findBySubject(String subject);
List<EventsServed> findBySubject(String subject);
/** * Find by subject. * * @param subject * the subject * @return the list */
Find by subject
findBySubject
{ "repo_name": "gudipatiharitha/medicmobile", "path": "modules/medicmobile/trunk/src/main/java/org/medicmobile/repository/EventsServedRepository.java", "license": "bsd-3-clause", "size": 774 }
[ "java.util.List", "org.medicmobile.model.EventsServed" ]
import java.util.List; import org.medicmobile.model.EventsServed;
import java.util.*; import org.medicmobile.model.*;
[ "java.util", "org.medicmobile.model" ]
java.util; org.medicmobile.model;
702,601
public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final RequestContext context) { final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); return getService(argumentExtractors, request); }
static WebApplicationService function(final List<ArgumentExtractor> argumentExtractors, final RequestContext context) { final HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); return getService(argumentExtractors, request); }
/** * Gets the service. * * @param argumentExtractors the argument extractors * @param context the context * @return the service */
Gets the service
getService
{ "repo_name": "Unicon/cas", "path": "core/cas-server-core-web/src/main/java/org/apereo/cas/web/support/WebUtils.java", "license": "apache-2.0", "size": 33997 }
[ "java.util.List", "javax.servlet.http.HttpServletRequest", "org.apereo.cas.authentication.principal.WebApplicationService", "org.springframework.webflow.execution.RequestContext" ]
import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apereo.cas.authentication.principal.WebApplicationService; import org.springframework.webflow.execution.RequestContext;
import java.util.*; import javax.servlet.http.*; import org.apereo.cas.authentication.principal.*; import org.springframework.webflow.execution.*;
[ "java.util", "javax.servlet", "org.apereo.cas", "org.springframework.webflow" ]
java.util; javax.servlet; org.apereo.cas; org.springframework.webflow;
1,085,296
public String getBigO() { Object tmp = library.getObject(entries, O_KEY); if (tmp instanceof StringObject) { return ((StringObject) tmp).getLiteralString(); } else { return null; } }
String function() { Object tmp = library.getObject(entries, O_KEY); if (tmp instanceof StringObject) { return ((StringObject) tmp).getLiteralString(); } else { return null; } }
/** * Gets the 32-byte string used for verifying the owner password. * * @return 32-byte string representing the key O. */
Gets the 32-byte string used for verifying the owner password
getBigO
{ "repo_name": "gburca/VirtMus", "path": "ICEpdf/icepdf/core/src/org/icepdf/core/pobjects/security/EncryptionDictionary.java", "license": "gpl-2.0", "size": 23583 }
[ "org.icepdf.core.pobjects.StringObject" ]
import org.icepdf.core.pobjects.StringObject;
import org.icepdf.core.pobjects.*;
[ "org.icepdf.core" ]
org.icepdf.core;
2,400,934
public void setUserDirectoryService(UserDirectoryService userDirectoryService) { this.userDirectoryService = userDirectoryService; }
void function(UserDirectoryService userDirectoryService) { this.userDirectoryService = userDirectoryService; }
/** * called by the spring framework to initialize the userDirectoryService data member specified in the components.xml file via IoC. * <br/><br/> * @param userDirectoryService the implementation of the UserDirectoryService interface provided by the spring framework. */
called by the spring framework to initialize the userDirectoryService data member specified in the components.xml file via IoC.
setUserDirectoryService
{ "repo_name": "pushyamig/sakai", "path": "jobscheduler/scheduler-component-shared/src/java/org/sakaiproject/component/app/scheduler/jobs/coursepublish/CourseSitePublishJob.java", "license": "apache-2.0", "size": 9587 }
[ "org.sakaiproject.user.api.UserDirectoryService" ]
import org.sakaiproject.user.api.UserDirectoryService;
import org.sakaiproject.user.api.*;
[ "org.sakaiproject.user" ]
org.sakaiproject.user;
438,760
protected void processCertX509IssuerSerial(X509Data x509Data, java.security.cert.X509Certificate cert) { if (options.emitX509IssuerSerial) { String issuerNameValue = getIssuerName(cert); if (! DatatypeHelper.isEmpty(issuerNameValue)) { x509Data.getX509IssuerSerials().add( KeyInfoHelper.buildX509IssuerSerial(issuerNameValue, cert.getSerialNumber()) ); } } }
void function(X509Data x509Data, java.security.cert.X509Certificate cert) { if (options.emitX509IssuerSerial) { String issuerNameValue = getIssuerName(cert); if (! DatatypeHelper.isEmpty(issuerNameValue)) { x509Data.getX509IssuerSerials().add( KeyInfoHelper.buildX509IssuerSerial(issuerNameValue, cert.getSerialNumber()) ); } } }
/** * Process the options related to generation of the X509IssuerSerial child element of X509Data * based on certificate data. * * @param x509Data the X509Data element being processed. * @param cert the certificate being processed */
Process the options related to generation of the X509IssuerSerial child element of X509Data based on certificate data
processCertX509IssuerSerial
{ "repo_name": "Safewhere/kombit-service-java", "path": "XmlTooling/src/org/opensaml/xml/security/x509/X509KeyInfoGeneratorFactory.java", "license": "mit", "size": 31297 }
[ "org.opensaml.xml.security.keyinfo.KeyInfoHelper", "org.opensaml.xml.signature.X509Certificate", "org.opensaml.xml.signature.X509Data", "org.opensaml.xml.util.DatatypeHelper" ]
import org.opensaml.xml.security.keyinfo.KeyInfoHelper; import org.opensaml.xml.signature.X509Certificate; import org.opensaml.xml.signature.X509Data; import org.opensaml.xml.util.DatatypeHelper;
import org.opensaml.xml.security.keyinfo.*; import org.opensaml.xml.signature.*; import org.opensaml.xml.util.*;
[ "org.opensaml.xml" ]
org.opensaml.xml;
2,121,208
public Insets getBorderInsets(Component c, Insets insets) { FontMetrics fm; int descent = 0; int ascent = 16; int height = 16; Border border = getBorder(); if (border != null) { if (border instanceof AbstractBorder) { ((AbstractBorder)border).getBorderInsets(c, insets); } else { // Can't reuse border insets because the Border interface // can't be enhanced. Insets i = border.getBorderInsets(c); insets.top = i.top; insets.right = i.right; insets.bottom = i.bottom; insets.left = i.left; } } else { insets.left = insets.top = insets.right = insets.bottom = 0; } insets.left += EDGE_SPACING + TEXT_SPACING; insets.right += EDGE_SPACING + TEXT_SPACING; insets.top += EDGE_SPACING + TEXT_SPACING; insets.bottom += EDGE_SPACING + TEXT_SPACING; if(c == null || getTitle() == null || getTitle().equals("")) { return insets; } Font font = getFont(c); fm = c.getFontMetrics(font); if(fm != null) { descent = fm.getDescent(); ascent = fm.getAscent(); height = fm.getHeight(); } switch (getTitlePosition()) { case ABOVE_TOP: insets.top += ascent + descent + (Math.max(EDGE_SPACING, TEXT_SPACING*2) - EDGE_SPACING); break; case TOP: case DEFAULT_POSITION: insets.top += ascent + descent; break; case BELOW_TOP: insets.top += ascent + descent + TEXT_SPACING; break; case ABOVE_BOTTOM: insets.bottom += ascent + descent + TEXT_SPACING; break; case BOTTOM: insets.bottom += ascent + descent; break; case BELOW_BOTTOM: insets.bottom += height; break; } return insets; } public boolean isBorderOpaque() { return false; }
Insets function(Component c, Insets insets) { FontMetrics fm; int descent = 0; int ascent = 16; int height = 16; Border border = getBorder(); if (border != null) { if (border instanceof AbstractBorder) { ((AbstractBorder)border).getBorderInsets(c, insets); } else { Insets i = border.getBorderInsets(c); insets.top = i.top; insets.right = i.right; insets.bottom = i.bottom; insets.left = i.left; } } else { insets.left = insets.top = insets.right = insets.bottom = 0; } insets.left += EDGE_SPACING + TEXT_SPACING; insets.right += EDGE_SPACING + TEXT_SPACING; insets.top += EDGE_SPACING + TEXT_SPACING; insets.bottom += EDGE_SPACING + TEXT_SPACING; if(c == null getTitle() == null getTitle().equals("")) { return insets; } Font font = getFont(c); fm = c.getFontMetrics(font); if(fm != null) { descent = fm.getDescent(); ascent = fm.getAscent(); height = fm.getHeight(); } switch (getTitlePosition()) { case ABOVE_TOP: insets.top += ascent + descent + (Math.max(EDGE_SPACING, TEXT_SPACING*2) - EDGE_SPACING); break; case TOP: case DEFAULT_POSITION: insets.top += ascent + descent; break; case BELOW_TOP: insets.top += ascent + descent + TEXT_SPACING; break; case ABOVE_BOTTOM: insets.bottom += ascent + descent + TEXT_SPACING; break; case BOTTOM: insets.bottom += ascent + descent; break; case BELOW_BOTTOM: insets.bottom += height; break; } return insets; } public boolean isBorderOpaque() { return false; }
/** * Reinitialize the insets parameter with this Border's current Insets. * @param c the component for which this border insets value applies * @param insets the object to be reinitialized */
Reinitialize the insets parameter with this Border's current Insets
getBorderInsets
{ "repo_name": "andreagenso/java2scala", "path": "test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/javax/swing/border/TitledBorder.java", "license": "apache-2.0", "size": 27942 }
[ "java.awt.Component", "java.awt.Font", "java.awt.FontMetrics", "java.awt.Insets" ]
import java.awt.Component; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Insets;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,964,749
default AgeableData getAgeData() { return get(AgeableData.class).get(); }
default AgeableData getAgeData() { return get(AgeableData.class).get(); }
/** * Gets the {@link AgeableData} that represents age determining whether an * {@link Entity} is a child or an adult. * * @return The ageable data */
Gets the <code>AgeableData</code> that represents age determining whether an <code>Entity</code> is a child or an adult
getAgeData
{ "repo_name": "Kiskae/SpongeAPI", "path": "src/main/java/org/spongepowered/api/entity/living/Ageable.java", "license": "mit", "size": 1966 }
[ "org.spongepowered.api.data.manipulator.mutable.entity.AgeableData" ]
import org.spongepowered.api.data.manipulator.mutable.entity.AgeableData;
import org.spongepowered.api.data.manipulator.mutable.entity.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
734,513
protected static String canonicalizeTableHttpRequest(final java.net.URL address, final String accountName, final String method, final String contentType, final long contentLength, final String date, final HttpURLConnection conn) throws StorageException { // The first element should be the Method of the request. // I.e. GET, POST, PUT, or HEAD. final StringBuilder canonicalizedString = new StringBuilder(ExpectedTableCanonicalizedStringLength); canonicalizedString.append(conn.getRequestMethod()); // The second element should be the MD5 value. // This is optional and may be empty. final String httpContentMD5Value = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_MD5); appendCanonicalizedElement(canonicalizedString, httpContentMD5Value); // The third element should be the content type. appendCanonicalizedElement(canonicalizedString, contentType); // The fourth element should be the request date. // See if there's an storage date header. // If there's one, then don't use the date header. final String dateString = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.DATE); // If x-ms-date header exists, Date should be that value. appendCanonicalizedElement(canonicalizedString, dateString.equals(Constants.EMPTY_STRING) ? date : dateString); appendCanonicalizedElement(canonicalizedString, getCanonicalizedResourceLite(address, accountName)); return canonicalizedString.toString(); }
static String function(final java.net.URL address, final String accountName, final String method, final String contentType, final long contentLength, final String date, final HttpURLConnection conn) throws StorageException { final StringBuilder canonicalizedString = new StringBuilder(ExpectedTableCanonicalizedStringLength); canonicalizedString.append(conn.getRequestMethod()); final String httpContentMD5Value = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.CONTENT_MD5); appendCanonicalizedElement(canonicalizedString, httpContentMD5Value); appendCanonicalizedElement(canonicalizedString, contentType); final String dateString = Utility.getStandardHeaderValue(conn, Constants.HeaderConstants.DATE); appendCanonicalizedElement(canonicalizedString, dateString.equals(Constants.EMPTY_STRING) ? date : dateString); appendCanonicalizedElement(canonicalizedString, getCanonicalizedResourceLite(address, accountName)); return canonicalizedString.toString(); }
/** * Constructs a canonicalized string that will be used to construct the signature string * for signing a Table service request under the Shared Key authentication scheme. * * @param address * the request URI * @param accountName * the account name associated with the request * @param method * the verb to be used for the HTTP request. * @param contentType * the content type of the HTTP request. * @param contentLength * the length of the content written to the outputstream in bytes, -1 if unknown * @param date * the date/time specification for the HTTP request * @param conn * the HttpURLConnection for the operation. * @return A canonicalized string. * @throws StorageException */
Constructs a canonicalized string that will be used to construct the signature string for signing a Table service request under the Shared Key authentication scheme
canonicalizeTableHttpRequest
{ "repo_name": "james-hu/azure-storage-java", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/core/Canonicalizer.java", "license": "apache-2.0", "size": 19203 }
[ "com.microsoft.azure.storage.Constants", "com.microsoft.azure.storage.StorageException", "java.net.HttpURLConnection" ]
import com.microsoft.azure.storage.Constants; import com.microsoft.azure.storage.StorageException; import java.net.HttpURLConnection;
import com.microsoft.azure.storage.*; import java.net.*;
[ "com.microsoft.azure", "java.net" ]
com.microsoft.azure; java.net;
2,654,549
public synchronized void stop() { logger.info("PLEXSVC Stoping " + _containers.size() + " containers..."); for (ServiceContainer g : new HashSet<ServiceContainer>( _containers.values())) { if (g.getHandlers().size() > 0) { g.stop(); } } }
synchronized void function() { logger.info(STR + _containers.size() + STR); for (ServiceContainer g : new HashSet<ServiceContainer>( _containers.values())) { if (g.getHandlers().size() > 0) { g.stop(); } } }
/** * This method stops all containers */
This method stops all containers
stop
{ "repo_name": "bhatti/PlexServices", "path": "plexsvc-framework/src/main/java/com/plexobject/service/impl/ServiceRegistryContainers.java", "license": "mit", "size": 5759 }
[ "com.plexobject.service.ServiceContainer", "java.util.HashSet" ]
import com.plexobject.service.ServiceContainer; import java.util.HashSet;
import com.plexobject.service.*; import java.util.*;
[ "com.plexobject.service", "java.util" ]
com.plexobject.service; java.util;
1,923,964
public void setRuntimeLogger(RuntimeLogger logger);
void function(RuntimeLogger logger);
/** * Sets the logger. This will be called before any calls to the * uberspector */
Sets the logger. This will be called before any calls to the uberspector
setRuntimeLogger
{ "repo_name": "adufilie/flex-sdk", "path": "modules/thirdparty/velocity/src/java/org/apache/flex/forks/velocity/util/introspection/UberspectLoggable.java", "license": "apache-2.0", "size": 1234 }
[ "org.apache.flex.forks.velocity.runtime.RuntimeLogger" ]
import org.apache.flex.forks.velocity.runtime.RuntimeLogger;
import org.apache.flex.forks.velocity.runtime.*;
[ "org.apache.flex" ]
org.apache.flex;
371,713
public BasicLinkConfig latency(Duration latency) { Long nanos = latency == null ? null : latency.toNanos(); return (BasicLinkConfig) setOrClear(LATENCY, nanos); }
BasicLinkConfig function(Duration latency) { Long nanos = latency == null ? null : latency.toNanos(); return (BasicLinkConfig) setOrClear(LATENCY, nanos); }
/** * Sets the link latency. * * @param latency new latency; null to clear * @return self */
Sets the link latency
latency
{ "repo_name": "kuujo/onos", "path": "core/api/src/main/java/org/onosproject/net/config/basics/BasicLinkConfig.java", "license": "apache-2.0", "size": 6142 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
1,161,387
@SuppressWarnings("unchecked") public static <K, V> Map<K, V> toMap(Object object) { if (object != null && !(object instanceof Map)) return null; return (Map<K, V>) object; }
@SuppressWarnings(STR) static <K, V> Map<K, V> function(Object object) { if (object != null && !(object instanceof Map)) return null; return (Map<K, V>) object; }
/** Returns the Object argument as a parameterized Map if the Object argument * is an instance of Map. Otherwise returns null. */
Returns the Object argument as a parameterized Map if the Object argument is an instance of Map. Otherwise returns null
toMap
{ "repo_name": "zamentur/ofbiz_ynh", "path": "sources/framework/base/src/org/ofbiz/base/util/UtilGenerics.java", "license": "apache-2.0", "size": 7115 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
233,683
public ObjectId getProcessId() { return processId; }
ObjectId function() { return processId; }
/** * Get the process identifier * * @return the process identifier */
Get the process identifier
getProcessId
{ "repo_name": "rozza/mongo-java-driver", "path": "driver-core/src/main/com/mongodb/connection/TopologyVersion.java", "license": "apache-2.0", "size": 3144 }
[ "org.bson.types.ObjectId" ]
import org.bson.types.ObjectId;
import org.bson.types.*;
[ "org.bson.types" ]
org.bson.types;
2,288,338
@Test public void testNameNode() throws Exception { int numDatanodes = 2; cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build(); cluster.waitActive(); DFSTestUtil.createFile(cluster.getFileSystem(), new Path("/test1"), fileSize, fileSize, blockSize, (short) 2, seed); JMXGet jmx = new JMXGet(); String serviceName = "NameNode"; jmx.setService(serviceName); jmx.init(); // default lists namenode mbeans only assertTrue("error printAllValues", checkPrintAllValues(jmx)); //get some data from different source DFSTestUtil.waitForMetric(jmx, "NumLiveDataNodes", numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue("NumLiveDataNodes"))); assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")), getMetrics("FSNamesystem")); DFSTestUtil.waitForMetric(jmx, "NumOpenConnections", numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue("NumOpenConnections"))); cluster.shutdown(); MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); ObjectName query = new ObjectName("Hadoop:service=" + serviceName + ",*"); Set<ObjectName> names = mbsc.queryNames(query, null); assertTrue("No beans should be registered for " + serviceName, names.isEmpty()); }
void function() throws Exception { int numDatanodes = 2; cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build(); cluster.waitActive(); DFSTestUtil.createFile(cluster.getFileSystem(), new Path(STR), fileSize, fileSize, blockSize, (short) 2, seed); JMXGet jmx = new JMXGet(); String serviceName = STR; jmx.setService(serviceName); jmx.init(); assertTrue(STR, checkPrintAllValues(jmx)); DFSTestUtil.waitForMetric(jmx, STR, numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue(STR))); assertGauge(STR, Long.parseLong(jmx.getValue(STR)), getMetrics(STR)); DFSTestUtil.waitForMetric(jmx, STR, numDatanodes); assertEquals(numDatanodes, Integer.parseInt( jmx.getValue(STR))); cluster.shutdown(); MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer(); ObjectName query = new ObjectName(STR + serviceName + ",*"); Set<ObjectName> names = mbsc.queryNames(query, null); assertTrue(STR + serviceName, names.isEmpty()); }
/** * test JMX connection to NameNode.. * @throws Exception */
test JMX connection to NameNode.
testNameNode
{ "repo_name": "laxman-ch/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tools/TestJMXGet.java", "license": "apache-2.0", "size": 5667 }
[ "java.lang.management.ManagementFactory", "java.util.Set", "javax.management.MBeanServerConnection", "javax.management.ObjectName", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.DFSTestUtil", "org.apache.hadoop.hdfs.MiniDFSCluster", "org.apache.hadoop.hdfs.tools.JMXGet", "org.apache.hadoop.test.MetricsAsserts", "org.junit.Assert" ]
import java.lang.management.ManagementFactory; import java.util.Set; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.tools.JMXGet; import org.apache.hadoop.test.MetricsAsserts; import org.junit.Assert;
import java.lang.management.*; import java.util.*; import javax.management.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.tools.*; import org.apache.hadoop.test.*; import org.junit.*;
[ "java.lang", "java.util", "javax.management", "org.apache.hadoop", "org.junit" ]
java.lang; java.util; javax.management; org.apache.hadoop; org.junit;
651,180
PublishResult setupExchange(String exchangeName, String queueName, ExchangeType type, String routingKey) throws CancellationException, ExecutionException, InterruptedException;
PublishResult setupExchange(String exchangeName, String queueName, ExchangeType type, String routingKey) throws CancellationException, ExecutionException, InterruptedException;
/** * Setup exchange. * * Exchange is declared then binded to queue in RabbitMQ. * Note that this is blocking method. * * @param exchangeName the exchange name. If null, unique name is used. * You can get it from {@link PublishResult#getExchangeName()}. * @param queueName the queue name. this is mandatory. * @param type the exchange type. * @param routingKey the routing key. Key usage is decided by exchange type. * @return instance of {@link PublishResult}. * @throws CancellationException if the computation was cancelled. * @throws ExecutionException if the computation threw an exception. * @throws InterruptedException if the current thread was interrupted while waiting. */
Setup exchange. Exchange is declared then binded to queue in RabbitMQ. Note that this is blocking method
setupExchange
{ "repo_name": "jenkinsci/rabbitmq-consumer-plugin", "path": "src/main/java/org/jenkinsci/plugins/rabbitmqconsumer/publishers/PublishChannel.java", "license": "mit", "size": 3536 }
[ "java.util.concurrent.CancellationException", "java.util.concurrent.ExecutionException" ]
import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,014,256
public void setBadgeDrawable(Drawable drawable) { mBadgeDrawable = drawable; if (null != mSearchBar) { mSearchBar.setBadgeDrawable(drawable); } }
void function(Drawable drawable) { mBadgeDrawable = drawable; if (null != mSearchBar) { mSearchBar.setBadgeDrawable(drawable); } }
/** * Sets the badge drawable that will be shown inside the search bar next to * the title. */
Sets the badge drawable that will be shown inside the search bar next to the title
setBadgeDrawable
{ "repo_name": "kingargyle/adt-leanback-support", "path": "leanback-v17/src/main/java/android/support/v17/leanback/app/SearchSupportFragment.java", "license": "apache-2.0", "size": 24062 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
2,617,821
private Endpoint findByAPI(List<Endpoint> list, String api) { for (Endpoint endpoint : list) { if (endpoint.api.equals(api)) { return endpoint; } } return null; }
Endpoint function(List<Endpoint> list, String api) { for (Endpoint endpoint : list) { if (endpoint.api.equals(api)) { return endpoint; } } return null; }
/** * Find an endpoint by its API * @param list list * @param api api name * @return the endpoint or null if there was no match */
Find an endpoint by its API
findByAPI
{ "repo_name": "legend-hua/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/main/java/org/apache/hadoop/registry/client/types/ServiceRecord.java", "license": "apache-2.0", "size": 6919 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,149,640
@MediumTest @Feature({"Android-AppBase"}) public void testNetworkCallbacks() throws Exception { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; }
@Feature({STR}) void function() throws Exception { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; }
/** * Tests that callbacks are issued to Observers when NetworkChangeNotifierAutoDetect receives * the right signals (via its NetworkCallback). */
Tests that callbacks are issued to Observers when NetworkChangeNotifierAutoDetect receives the right signals (via its NetworkCallback)
testNetworkCallbacks
{ "repo_name": "Workday/OpenFrame", "path": "net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java", "license": "bsd-3-clause", "size": 26665 }
[ "android.os.Build", "org.chromium.base.test.util.Feature" ]
import android.os.Build; import org.chromium.base.test.util.Feature;
import android.os.*; import org.chromium.base.test.util.*;
[ "android.os", "org.chromium.base" ]
android.os; org.chromium.base;
65,977
public int writeVarLong (long value, boolean optimizePositive) throws KryoException { if (!optimizePositive) value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) { if (position == capacity) require(1); buffer[position++] = (byte)value; return 1; } if (value >>> 14 == 0) { require(2); int p = position; position = p + 2; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7); return 2; } if (value >>> 21 == 0) { require(3); int p = position; position = p + 3; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14); return 3; } if (value >>> 28 == 0) { require(4); int p = position; position = p + 4; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21); return 4; } if (value >>> 35 == 0) { require(5); int p = position; position = p + 5; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21 | 0x80); buffer[p + 4] = (byte)(value >>> 28); return 5; } if (value >>> 42 == 0) { require(6); int p = position; position = p + 6; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21 | 0x80); buffer[p + 4] = (byte)(value >>> 28 | 0x80); buffer[p + 5] = (byte)(value >>> 35); return 6; } if (value >>> 49 == 0) { require(7); int p = position; position = p + 7; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21 | 0x80); buffer[p + 4] = (byte)(value >>> 28 | 0x80); buffer[p + 5] = (byte)(value >>> 35 | 0x80); buffer[p + 6] = (byte)(value >>> 42); return 7; } if (value >>> 56 == 0) { require(8); int p = position; position = p + 8; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21 | 0x80); buffer[p + 4] = (byte)(value >>> 28 | 0x80); buffer[p + 5] = (byte)(value >>> 35 | 0x80); buffer[p + 6] = (byte)(value >>> 42 | 0x80); buffer[p + 7] = (byte)(value >>> 49); return 8; } require(9); int p = position; position = p + 9; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) | 0x80); buffer[p + 1] = (byte)(value >>> 7 | 0x80); buffer[p + 2] = (byte)(value >>> 14 | 0x80); buffer[p + 3] = (byte)(value >>> 21 | 0x80); buffer[p + 4] = (byte)(value >>> 28 | 0x80); buffer[p + 5] = (byte)(value >>> 35 | 0x80); buffer[p + 6] = (byte)(value >>> 42 | 0x80); buffer[p + 7] = (byte)(value >>> 49 | 0x80); buffer[p + 8] = (byte)(value >>> 56); return 9; }
int function (long value, boolean optimizePositive) throws KryoException { if (!optimizePositive) value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) { if (position == capacity) require(1); buffer[position++] = (byte)value; return 1; } if (value >>> 14 == 0) { require(2); int p = position; position = p + 2; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7); return 2; } if (value >>> 21 == 0) { require(3); int p = position; position = p + 3; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14); return 3; } if (value >>> 28 == 0) { require(4); int p = position; position = p + 4; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21); return 4; } if (value >>> 35 == 0) { require(5); int p = position; position = p + 5; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21 0x80); buffer[p + 4] = (byte)(value >>> 28); return 5; } if (value >>> 42 == 0) { require(6); int p = position; position = p + 6; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21 0x80); buffer[p + 4] = (byte)(value >>> 28 0x80); buffer[p + 5] = (byte)(value >>> 35); return 6; } if (value >>> 49 == 0) { require(7); int p = position; position = p + 7; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21 0x80); buffer[p + 4] = (byte)(value >>> 28 0x80); buffer[p + 5] = (byte)(value >>> 35 0x80); buffer[p + 6] = (byte)(value >>> 42); return 7; } if (value >>> 56 == 0) { require(8); int p = position; position = p + 8; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21 0x80); buffer[p + 4] = (byte)(value >>> 28 0x80); buffer[p + 5] = (byte)(value >>> 35 0x80); buffer[p + 6] = (byte)(value >>> 42 0x80); buffer[p + 7] = (byte)(value >>> 49); return 8; } require(9); int p = position; position = p + 9; byte[] buffer = this.buffer; buffer[p] = (byte)((value & 0x7F) 0x80); buffer[p + 1] = (byte)(value >>> 7 0x80); buffer[p + 2] = (byte)(value >>> 14 0x80); buffer[p + 3] = (byte)(value >>> 21 0x80); buffer[p + 4] = (byte)(value >>> 28 0x80); buffer[p + 5] = (byte)(value >>> 35 0x80); buffer[p + 6] = (byte)(value >>> 42 0x80); buffer[p + 7] = (byte)(value >>> 49 0x80); buffer[p + 8] = (byte)(value >>> 56); return 9; }
/** Writes a 1-9 byte long. * @param optimizePositive If true, small positive numbers will be more efficient (1 byte) and small negative numbers will be * inefficient (9 bytes). * @return The number of bytes written. * @see #varLongLength(long, boolean) */
Writes a 1-9 byte long
writeVarLong
{ "repo_name": "EsotericSoftware/kryo", "path": "src/com/esotericsoftware/kryo/io/Output.java", "license": "bsd-3-clause", "size": 34695 }
[ "com.esotericsoftware.kryo.KryoException" ]
import com.esotericsoftware.kryo.KryoException;
import com.esotericsoftware.kryo.*;
[ "com.esotericsoftware.kryo" ]
com.esotericsoftware.kryo;
952,054
@Override @Nullable public Map<String, List<String>> getHeaders() { return customHeaders; }
Map<String, List<String>> function() { return customHeaders; }
/** * Returns custom headers that have been added, or null if none have been set. */
Returns custom headers that have been added, or null if none have been set
getHeaders
{ "repo_name": "Flipkart/elasticsearch", "path": "src/main/java/org/elasticsearch/rest/RestResponse.java", "license": "apache-2.0", "size": 2810 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,663,582
public void recordTileIndexClick(int cardIndex, int tileIndex) { // TODO(petewil): Should I get the number of sites in this category from the model instead // of using MAX_TILE_COUNT? RecordHistogram.recordLinearCountHistogram("ExploreSites.SiteTilesClickIndex2", cardIndex * ExploreSitesPage.MAX_TILE_COUNT_ALL_VARIATIONS + tileIndex, 1, 100, 100); }
void function(int cardIndex, int tileIndex) { RecordHistogram.recordLinearCountHistogram(STR, cardIndex * ExploreSitesPage.MAX_TILE_COUNT_ALL_VARIATIONS + tileIndex, 1, 100, 100); }
/** * Records UMA data for how far down the EoS page the picked tile was. * @param cardIndex The number card (zero based) of the tile that was picked. * @param tileIndex The number of the tile within the card. */
Records UMA data for how far down the EoS page the picked tile was
recordTileIndexClick
{ "repo_name": "endlessm/chromium-browser", "path": "chrome/android/java/src/org/chromium/chrome/browser/explore_sites/ExploreSitesCategoryCardView.java", "license": "bsd-3-clause", "size": 14571 }
[ "org.chromium.base.metrics.RecordHistogram" ]
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.*;
[ "org.chromium.base" ]
org.chromium.base;
2,618,169
public void testFRLocale() throws ValidatorException { // Create bean to run test on. TypeBean info = new TypeBean(); info.setByte("12"); info.setShort("-129"); info.setInteger("1443"); info.setLong("88000"); info.setFloat("12,1555"); info.setDouble("129,1551511111"); info.setDate("21/12/2010"); Map<String, ?> map = localeTest(info, Locale.FRENCH); assertTrue("float value not correct", ((Float)map.get("float")).intValue() == 12); assertTrue("double value not correct", ((Double)map.get("double")).intValue() == 129); }
void function() throws ValidatorException { TypeBean info = new TypeBean(); info.setByte("12"); info.setShort("-129"); info.setInteger("1443"); info.setLong("88000"); info.setFloat(STR); info.setDouble(STR); info.setDate(STR); Map<String, ?> map = localeTest(info, Locale.FRENCH); assertTrue(STR, ((Float)map.get("float")).intValue() == 12); assertTrue(STR, ((Double)map.get(STR)).intValue() == 129); }
/** * Tests the fr locale. */
Tests the fr locale
testFRLocale
{ "repo_name": "apache/commons-validator", "path": "src/test/java/org/apache/commons/validator/GenericTypeValidatorTest.java", "license": "apache-2.0", "size": 7389 }
[ "java.util.Locale", "java.util.Map" ]
import java.util.Locale; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,630,365
public void execute() throws BuildException { log.debug("execute()"); command = command.trim(); if (srcFile == null && command.length() == 0 && filesets.isEmpty()) { throw new BuildException("Source file does not exist!", getLocation()); } if (srcFile != null && !srcFile.exists()) { throw new BuildException("Source file does not exist!", getLocation()); } // TODO: any of this used? // deal with the filesets for (int i = 0; i < filesets.size(); i++) { FileSet fs = filesets.elementAt(i); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File srcDir = fs.getDir(getProject()); String[] srcFiles = ds.getIncludedFiles(); } try { PrintStream out = System.out; try { if (output != null) { log.verbose("Opening PrintStream to output file " + output); out = new PrintStream( new BufferedOutputStream( new FileOutputStream(output.getAbsolutePath(), append))); } // if there are no groovy statements between the enclosing Groovy tags // then read groovy statements in from a text file using the src attribute if (command == null || command.trim().length() == 0) { createClasspath().add(new Path(getProject(), srcFile.getParentFile().getCanonicalPath())); command = getText(new BufferedReader(new FileReader(srcFile))); } if (command != null) { execGroovy(command, out); } else { throw new BuildException("Source file does not exist!", getLocation()); } } finally { if (out != null && out != System.out) { out.close(); } } } catch (IOException e) { throw new BuildException(e, getLocation()); } log.verbose("statements executed successfully"); }
void function() throws BuildException { log.debug(STR); command = command.trim(); if (srcFile == null && command.length() == 0 && filesets.isEmpty()) { throw new BuildException(STR, getLocation()); } if (srcFile != null && !srcFile.exists()) { throw new BuildException(STR, getLocation()); } for (int i = 0; i < filesets.size(); i++) { FileSet fs = filesets.elementAt(i); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); File srcDir = fs.getDir(getProject()); String[] srcFiles = ds.getIncludedFiles(); } try { PrintStream out = System.out; try { if (output != null) { log.verbose(STR + output); out = new PrintStream( new BufferedOutputStream( new FileOutputStream(output.getAbsolutePath(), append))); } if (command == null command.trim().length() == 0) { createClasspath().add(new Path(getProject(), srcFile.getParentFile().getCanonicalPath())); command = getText(new BufferedReader(new FileReader(srcFile))); } if (command != null) { execGroovy(command, out); } else { throw new BuildException(STR, getLocation()); } } finally { if (out != null && out != System.out) { out.close(); } } } catch (IOException e) { throw new BuildException(e, getLocation()); } log.verbose(STR); }
/** * Load the file and then execute it */
Load the file and then execute it
execute
{ "repo_name": "komalsukhani/debian-groovy2", "path": "subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovy.java", "license": "apache-2.0", "size": 22870 }
[ "java.io.BufferedOutputStream", "java.io.BufferedReader", "java.io.File", "java.io.FileOutputStream", "java.io.FileReader", "java.io.IOException", "java.io.PrintStream", "org.apache.tools.ant.BuildException", "org.apache.tools.ant.DirectoryScanner", "org.apache.tools.ant.types.FileSet", "org.apache.tools.ant.types.Path" ]
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.PrintStream; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path;
import java.io.*; import org.apache.tools.ant.*; import org.apache.tools.ant.types.*;
[ "java.io", "org.apache.tools" ]
java.io; org.apache.tools;
2,562,713
public OutputStream getOutputStream() throws IOException;
OutputStream function() throws IOException;
/** * Get the current output stream * * @return Returns the current output stream or null if StreamJuggler has * been closed * @throws IOException if an IO-problem occurs */
Get the current output stream
getOutputStream
{ "repo_name": "daisy/pipeline-issues", "path": "libs/dotify/dotify.common/src/org/daisy/dotify/common/io/StreamJuggler.java", "license": "apache-2.0", "size": 1254 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,172,790
public void setBaseNegativeItemLabelPosition(ItemLabelPosition position) { setBaseNegativeItemLabelPosition(position, true); }
void function(ItemLabelPosition position) { setBaseNegativeItemLabelPosition(position, true); }
/** * Sets the base item label position for negative values and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). * * @see #getBaseNegativeItemLabelPosition() */
Sets the base item label position for negative values and sends a <code>RendererChangeEvent</code> to all registered listeners
setBaseNegativeItemLabelPosition
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java", "license": "mit", "size": 126056 }
[ "org.jfree.chart.labels.ItemLabelPosition" ]
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,564,992
public List<Instance> getMachines(String workspaceId) throws EnvironmentNotRunningException { EnvironmentHolder environment; try (StripedLocks.ReadLock lock = stripedLocks.acquireReadLock(workspaceId)) { environment = environments.get(workspaceId); if (environment == null) { throw new EnvironmentNotRunningException("Environment with ID '" + workspaceId + "' is not found"); } return new ArrayList<>(environment.machines); } }
List<Instance> function(String workspaceId) throws EnvironmentNotRunningException { EnvironmentHolder environment; try (StripedLocks.ReadLock lock = stripedLocks.acquireReadLock(workspaceId)) { environment = environments.get(workspaceId); if (environment == null) { throw new EnvironmentNotRunningException(STR + workspaceId + STR); } return new ArrayList<>(environment.machines); } }
/** * Returns all machines from environment of specific workspace. * * @param workspaceId * ID of workspace that owns environment machines * @return list of machines * @throws EnvironmentNotRunningException * if environment is not running */
Returns all machines from environment of specific workspace
getMachines
{ "repo_name": "ollie314/che", "path": "wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/environment/server/CheEnvironmentEngine.java", "license": "epl-1.0", "size": 61046 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.che.api.environment.server.exception.EnvironmentNotRunningException", "org.eclipse.che.api.machine.server.spi.Instance", "org.eclipse.che.api.workspace.server.StripedLocks" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.che.api.environment.server.exception.EnvironmentNotRunningException; import org.eclipse.che.api.machine.server.spi.Instance; import org.eclipse.che.api.workspace.server.StripedLocks;
import java.util.*; import org.eclipse.che.api.environment.server.exception.*; import org.eclipse.che.api.machine.server.spi.*; import org.eclipse.che.api.workspace.server.*;
[ "java.util", "org.eclipse.che" ]
java.util; org.eclipse.che;
1,190,919
EAttribute getUInt8MultiArray_Data();
EAttribute getUInt8MultiArray_Data();
/** * Returns the meta object for the attribute list '{@link org.eclipse.papyrus.RobotMLLibraries.RobotML_ModelLibrary.RobotML_DataTypes.std_datatypes.UInt8MultiArray#getData <em>Data</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute list '<em>Data</em>'. * @see org.eclipse.papyrus.RobotMLLibraries.RobotML_ModelLibrary.RobotML_DataTypes.std_datatypes.UInt8MultiArray#getData() * @see #getUInt8MultiArray() * @generated */
Returns the meta object for the attribute list '<code>org.eclipse.papyrus.RobotMLLibraries.RobotML_ModelLibrary.RobotML_DataTypes.std_datatypes.UInt8MultiArray#getData Data</code>'.
getUInt8MultiArray_Data
{ "repo_name": "RobotML/RobotML-SDK-Juno", "path": "plugins/robotml/org.eclipse.papyrus.robotml/src/org/eclipse/papyrus/RobotMLLibraries/RobotML_ModelLibrary/RobotML_DataTypes/std_datatypes/Std_datatypesPackage.java", "license": "epl-1.0", "size": 78001 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
217,869
public int getRank(Conditional<I> c, Explanation exp) { int vRank = this.getVerificationRank(c, new Explanation(exp)); if (vRank == this.INFINITY) { if (exp != null) { exp.setText("k" + c + " = " + vRank); } return this.INFINITY; } int aRank = this.getRank(c.getAntecedence(), new Explanation(exp)); if (exp != null) { new Explanation(exp, "k" + c + " = " + vRank + " - " + aRank + " = " + (vRank - aRank)); exp.setText("k" + c + " = " + (vRank - aRank)); } return vRank - aRank; }
int function(Conditional<I> c, Explanation exp) { int vRank = this.getVerificationRank(c, new Explanation(exp)); if (vRank == this.INFINITY) { if (exp != null) { exp.setText("k" + c + STR + vRank); } return this.INFINITY; } int aRank = this.getRank(c.getAntecedence(), new Explanation(exp)); if (exp != null) { new Explanation(exp, "k" + c + STR + vRank + STR + aRank + STR + (vRank - aRank)); exp.setText("k" + c + STR + (vRank - aRank)); } return vRank - aRank; }
/** * Returns the rank for a conditional, which is the difference between the * rank of its verification and the rank of its antecedence. If the * verification is ranked with {@link RankingFunction#INFINITY}, it is also * the result. * * @param c * Conditional * @param exp * Explanation * @return Rank */
Returns the rank for a conditional, which is the difference between the rank of its verification and the rank of its antecedence. If the verification is ranked with <code>RankingFunction#INFINITY</code>, it is also the result
getRank
{ "repo_name": "tbsflk/RelationalSystemZ", "path": "src/semantics/ranking/ExplainedRankingFunction.java", "license": "gpl-3.0", "size": 5739 }
[ "edu.cs.ai.log4KR.logical.syntax.probabilistic.Conditional" ]
import edu.cs.ai.log4KR.logical.syntax.probabilistic.Conditional;
import edu.cs.ai.*;
[ "edu.cs.ai" ]
edu.cs.ai;
923,656
public void encode(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); if (extensionValue == null) { extensionId = PKIXExtensions.CertificateIssuer_Id; critical = true; encodeThis(); } super.encode(tmp); out.write(tmp.toByteArray()); }
void function(OutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); if (extensionValue == null) { extensionId = PKIXExtensions.CertificateIssuer_Id; critical = true; encodeThis(); } super.encode(tmp); out.write(tmp.toByteArray()); }
/** * Write the extension to the OutputStream. * * @param out the OutputStream to write the extension to * @exception IOException on encoding errors */
Write the extension to the OutputStream
encode
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/src/share/classes/sun/security/x509/CertificateIssuerExtension.java", "license": "mit", "size": 6953 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,923,881
public DataNode setMeasurementScalar(String measurement);
DataNode function(String measurement);
/** * name for measured signal * <p> * <p><b>Enumeration:</b><ul> * <li><b>temperature</b> </li> * <li><b>pH</b> </li> * <li><b>magnetic_field</b> </li> * <li><b>electric_field</b> </li> * <li><b>conductivity</b> </li> * <li><b>resistance</b> </li> * <li><b>voltage</b> </li> * <li><b>pressure</b> </li> * <li><b>flow</b> </li> * <li><b>stress</b> </li> * <li><b>strain</b> </li> * <li><b>shear</b> </li> * <li><b>surface_pressure</b> </li></ul></p> * </p> * * @param measurement the measurement */
name for measured signal Enumeration: temperature pH magnetic_field electric_field conductivity resistance voltage pressure flow stress strain shear surface_pressure
setMeasurementScalar
{ "repo_name": "xen-0/dawnsci", "path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NXsensor.java", "license": "epl-1.0", "size": 17164 }
[ "org.eclipse.dawnsci.analysis.api.tree.DataNode" ]
import org.eclipse.dawnsci.analysis.api.tree.DataNode;
import org.eclipse.dawnsci.analysis.api.tree.*;
[ "org.eclipse.dawnsci" ]
org.eclipse.dawnsci;
804,460
public void setName(String name) { dict.setString(COSName.NAME, name); }
void function(String name) { dict.setString(COSName.NAME, name); }
/** * Sets the name of the optional content group. * @param name the name */
Sets the name of the optional content group
setName
{ "repo_name": "TomRoush/PdfBox-Android", "path": "library/src/main/java/com/tom_roush/pdfbox/pdmodel/graphics/optionalcontent/PDOptionalContentGroup.java", "license": "apache-2.0", "size": 4685 }
[ "com.tom_roush.pdfbox.cos.COSName" ]
import com.tom_roush.pdfbox.cos.COSName;
import com.tom_roush.pdfbox.cos.*;
[ "com.tom_roush.pdfbox" ]
com.tom_roush.pdfbox;
615,704
public ServerSetting getServerSetting(SharedPreferences prefs, int orderOffset, int order);
ServerSetting function(SharedPreferences prefs, int orderOffset, int order);
/** * Should return a {@link ServerSetting} object that can connect to the seedbox as identified by the given seedbox * provider-unique order. * @param prefs The shared preferences to load the settings from * @param orderOffset An offset integer to add to the normal order number to assign a app-unique server id to this * seedbox * @param order The seedbox provider-specific order id referring to the specific seedbox to load settings for * @return A server settings object corresponding to the user's seedbox settings for the specified order id */
Should return a <code>ServerSetting</code> object that can connect to the seedbox as identified by the given seedbox provider-unique order
getServerSetting
{ "repo_name": "krajeswaran/transdroid", "path": "app/src/main/java/org/transdroid/core/seedbox/SeedboxSettings.java", "license": "gpl-3.0", "size": 3581 }
[ "android.content.SharedPreferences", "org.transdroid.core.app.settings.ServerSetting" ]
import android.content.SharedPreferences; import org.transdroid.core.app.settings.ServerSetting;
import android.content.*; import org.transdroid.core.app.settings.*;
[ "android.content", "org.transdroid.core" ]
android.content; org.transdroid.core;
1,964,741
@Override public synchronized void write(final byte[] b, final int off, final int len) throws IOException { super.write(b, off, len); this.branch.write(b, off, len); }
synchronized void function(final byte[] b, final int off, final int len) throws IOException { super.write(b, off, len); this.branch.write(b, off, len); }
/** * Write the specified bytes to both streams. * @param b the bytes to write * @param off The start offset * @param len The number of bytes to write * @throws IOException if an I/O error occurs */
Write the specified bytes to both streams
write
{ "repo_name": "de-mklinger/exec", "path": "src/main/java/de/mklinger/commons/exec/io/TeeOutputStream.java", "license": "apache-2.0", "size": 3047 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
666,409
EClass getNomenclature();
EClass getNomenclature();
/** * Returns the meta object for class '{@link orgomg.cwm.analysis.businessnomenclature.Nomenclature <em>Nomenclature</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Nomenclature</em>'. * @see orgomg.cwm.analysis.businessnomenclature.Nomenclature * @generated */
Returns the meta object for class '<code>orgomg.cwm.analysis.businessnomenclature.Nomenclature Nomenclature</code>'.
getNomenclature
{ "repo_name": "dresden-ocl/dresdenocl", "path": "plugins/org.dresdenocl.tools.CWM/src/orgomg/cwm/analysis/businessnomenclature/BusinessnomenclaturePackage.java", "license": "lgpl-3.0", "size": 73760 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,664,485
public String encrypt(String data) { try { KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(ALIAS, null); PublicKey publicKey = privateKeyEntry.getCertificate().getPublicKey(); Cipher inputCipher = Cipher.getInstance(RSA_MODE, getProvider()); inputCipher.init(Cipher.ENCRYPT_MODE, publicKey); ByteArrayOutputStream out = new ByteArrayOutputStream(); CipherOutputStream cipherOut = new CipherOutputStream(out, inputCipher); cipherOut.write(Base64.encode(data.getBytes("UTF-8"), Base64.DEFAULT)); cipherOut.close(); return Base64.encodeToString(out.toByteArray(), Base64.DEFAULT); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnrecoverableEntryException e) { e.printStackTrace(); } catch (KeyStoreException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
String function(String data) { try { KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(ALIAS, null); PublicKey publicKey = privateKeyEntry.getCertificate().getPublicKey(); Cipher inputCipher = Cipher.getInstance(RSA_MODE, getProvider()); inputCipher.init(Cipher.ENCRYPT_MODE, publicKey); ByteArrayOutputStream out = new ByteArrayOutputStream(); CipherOutputStream cipherOut = new CipherOutputStream(out, inputCipher); cipherOut.write(Base64.encode(data.getBytes("UTF-8"), Base64.DEFAULT)); cipherOut.close(); return Base64.encodeToString(out.toByteArray(), Base64.DEFAULT); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (UnrecoverableEntryException e) { e.printStackTrace(); } catch (KeyStoreException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } catch (NoSuchProviderException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
/** * Encrypts given data */
Encrypts given data
encrypt
{ "repo_name": "chandilsachin/SecuredPreference", "path": "app/src/main/java/com/sachinchandil/securedpreference/KeyChainManager.java", "license": "apache-2.0", "size": 7062 }
[ "android.util.Base64", "java.io.ByteArrayOutputStream", "java.io.IOException", "java.security.InvalidKeyException", "java.security.KeyStore", "java.security.KeyStoreException", "java.security.NoSuchAlgorithmException", "java.security.NoSuchProviderException", "java.security.PublicKey", "java.security.UnrecoverableEntryException", "javax.crypto.Cipher", "javax.crypto.CipherOutputStream", "javax.crypto.NoSuchPaddingException" ]
import android.util.Base64; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.InvalidKeyException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PublicKey; import java.security.UnrecoverableEntryException; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.NoSuchPaddingException;
import android.util.*; import java.io.*; import java.security.*; import javax.crypto.*;
[ "android.util", "java.io", "java.security", "javax.crypto" ]
android.util; java.io; java.security; javax.crypto;
1,053,949
public static String makePathRelativeTo(InJarResourceImpl inJarResource, InJarResourceImpl relativeToDir) { String canonicalFile = inJarResource.getEntry().getName(); String canonicalRelTo = relativeToDir.getEntry().getName(); String[] filePathComponents = FileUtils.getPathComponents(canonicalFile); String[] relToPathComponents = FileUtils.getPathComponents(canonicalRelTo); int i = 0; while (i < filePathComponents.length && i < relToPathComponents.length && filePathComponents[i].equals(relToPathComponents[i])) { i++; } StringBuffer buf = new StringBuffer(); for (int j = i; j < relToPathComponents.length; j++) { buf.append("../"); } for (int j = i; j < filePathComponents.length - 1; j++) { buf.append(filePathComponents[j]).append('/'); } buf.append(filePathComponents[filePathComponents.length - 1]); return buf.toString(); }
static String function(InJarResourceImpl inJarResource, InJarResourceImpl relativeToDir) { String canonicalFile = inJarResource.getEntry().getName(); String canonicalRelTo = relativeToDir.getEntry().getName(); String[] filePathComponents = FileUtils.getPathComponents(canonicalFile); String[] relToPathComponents = FileUtils.getPathComponents(canonicalRelTo); int i = 0; while (i < filePathComponents.length && i < relToPathComponents.length && filePathComponents[i].equals(relToPathComponents[i])) { i++; } StringBuffer buf = new StringBuffer(); for (int j = i; j < relToPathComponents.length; j++) { buf.append("../"); } for (int j = i; j < filePathComponents.length - 1; j++) { buf.append(filePathComponents[j]).append('/'); } buf.append(filePathComponents[filePathComponents.length - 1]); return buf.toString(); }
/** * Finds a relative path to a given InJarResourceImpl, relative to a specified directory represented as a InJarResourceImpl * * @param inJarResource * file that the relative path should resolve to * @param relativeToDir * directory that the path should be relative to * @return a relative path. This always uses / as the separator character. */
Finds a relative path to a given InJarResourceImpl, relative to a specified directory represented as a InJarResourceImpl
makePathRelativeTo
{ "repo_name": "openflexo-team/connie", "path": "connie-utils/src/main/java/org/openflexo/toolbox/JarUtils.java", "license": "gpl-3.0", "size": 3781 }
[ "org.openflexo.rm.InJarResourceImpl" ]
import org.openflexo.rm.InJarResourceImpl;
import org.openflexo.rm.*;
[ "org.openflexo.rm" ]
org.openflexo.rm;
430,565
public static NotEmpty extract(Any a) { try { return ((NotEmptyHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad; } }
static NotEmpty function(Any a) { try { return ((NotEmptyHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION(); bad.initCause(ex); bad.minor = Minor.Any; throw bad; } }
/** * Extract the exception from the given {@link Any}. */
Extract the exception from the given <code>Any</code>
extract
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java", "license": "bsd-3-clause", "size": 3676 }
[ "org.omg.CORBA" ]
import org.omg.CORBA;
import org.omg.*;
[ "org.omg" ]
org.omg;
275
ServiceFuture<SimpleProduct> putSimpleProductWithGroupingAsync(FlattenParameterGroup flattenParameterGroup, final ServiceCallback<SimpleProduct> serviceCallback);
ServiceFuture<SimpleProduct> putSimpleProductWithGroupingAsync(FlattenParameterGroup flattenParameterGroup, final ServiceCallback<SimpleProduct> serviceCallback);
/** * Put Simple Product with client flattening true on the model. * * @param flattenParameterGroup Additional parameters for the operation * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Put Simple Product with client flattening true on the model
putSimpleProductWithGroupingAsync
{ "repo_name": "devigned/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/modelflattening/AutoRestResourceFlatteningTestService.java", "license": "mit", "size": 26691 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,554,141
Preconditions.checkArgument(offset >= MINIMUM_OFFSET, "Range offset must be at least " + MINIMUM_OFFSET); Preconditions.checkArgument(length <= vertexCount - offset, "Range length must not be greater than the vertex count minus the range offset."); offsetRanges.add(new OffsetRange(offset, length)); return this; }
Preconditions.checkArgument(offset >= MINIMUM_OFFSET, STR + MINIMUM_OFFSET); Preconditions.checkArgument(length <= vertexCount - offset, STR); offsetRanges.add(new OffsetRange(offset, length)); return this; }
/** * Required configuration for each range of offsets in the graph. * * @param offset first offset appointing the vertices' position * @param length number of contiguous offsets in range * @return this */
Required configuration for each range of offsets in the graph
addRange
{ "repo_name": "WangTaoTheTonic/flink", "path": "flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java", "license": "apache-2.0", "size": 7208 }
[ "org.apache.flink.util.Preconditions" ]
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.*;
[ "org.apache.flink" ]
org.apache.flink;
1,833,858