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 int getDoorOrientation(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return this.getFullMetadata(par1IBlockAccess, par2, par3, par4) & 3;
} | int function(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return this.getFullMetadata(par1IBlockAccess, par2, par3, par4) & 3; } | /**
* Returns 0, 1, 2 or 3 depending on where the hinge is.
*/ | Returns 0, 1, 2 or 3 depending on where the hinge is | getDoorOrientation | {
"repo_name": "HATB0T/RuneCraftery",
"path": "forge/mcp/src/minecraft/net/minecraft/block/BlockDoor.java",
"license": "lgpl-3.0",
"size": 15633
} | [
"net.minecraft.world.IBlockAccess"
] | import net.minecraft.world.IBlockAccess; | import net.minecraft.world.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 1,530,597 |
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
} | void function() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } | /**
* This method was generated by MyBatis Generator. This method corresponds to the database table BR_USERS_HOSTNAME
* @mbg.generated Sun Sep 01 18:35:01 EDT 2019
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table BR_USERS_HOSTNAME | clear | {
"repo_name": "ZFGCCP/ZFGC3",
"path": "src/main/java/com/zfgc/dbobj/BrUsersHostnameDbObjExample.java",
"license": "mit",
"size": 10652
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 61,587 |
// @todo darrel: make this method static?
protected void basicOperateOnRegion(EntryEventImpl ev, DistributedRegion rgn) {
if (logger.isDebugEnabled()) {
logger.debug("Processing {}", this);
}
try {
long time = this.lastModified;
if (ev.getVersionTag() != null) {
checkVersionTag(rgn, ev.getVersionTag());
time = ev.getVersionTag().getVersionTimeStamp();
}
this.appliedOperation = doPutOrCreate(rgn, ev, time);
}
catch (ConcurrentCacheModificationException e) {
dispatchElidedEvent(rgn, ev);
this.appliedOperation = false;
}
} | void function(EntryEventImpl ev, DistributedRegion rgn) { if (logger.isDebugEnabled()) { logger.debug(STR, this); } try { long time = this.lastModified; if (ev.getVersionTag() != null) { checkVersionTag(rgn, ev.getVersionTag()); time = ev.getVersionTag().getVersionTimeStamp(); } this.appliedOperation = doPutOrCreate(rgn, ev, time); } catch (ConcurrentCacheModificationException e) { dispatchElidedEvent(rgn, ev); this.appliedOperation = false; } } | /**
* Do the actual update after operationOnRegion has confirmed work needs to be done
* Note this is the default implementation used by UpdateOperation.
* DistributedPutAllOperation overrides and then calls back using super
* to this implementation.
* NOTE: be careful to not use methods like getEvent(); defer to
* the ev passed as a parameter instead.
*/ | Do the actual update after operationOnRegion has confirmed work needs to be done Note this is the default implementation used by UpdateOperation. DistributedPutAllOperation overrides and then calls back using super to this implementation. the ev passed as a parameter instead | basicOperateOnRegion | {
"repo_name": "sshcherbakov/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/AbstractUpdateOperation.java",
"license": "apache-2.0",
"size": 13739
} | [
"com.gemstone.gemfire.internal.cache.versions.ConcurrentCacheModificationException"
] | import com.gemstone.gemfire.internal.cache.versions.ConcurrentCacheModificationException; | import com.gemstone.gemfire.internal.cache.versions.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,007,878 |
defaultParameters = new SessionParameters();
otherParameters = new SessionParameters();
otherParameters.setLocale(Locale.ENGLISH);
otherParameters.addCustomDictionay("MAD");
}
| defaultParameters = new SessionParameters(); otherParameters = new SessionParameters(); otherParameters.setLocale(Locale.ENGLISH); otherParameters.addCustomDictionay("MAD"); } | /**
* Set up test attributes.
*/ | Set up test attributes | setUp | {
"repo_name": "AlexRNL/SubtitleCorrector",
"path": "src/test/java/com/alexrnl/subtitlecorrector/service/SessionParametersTest.java",
"license": "bsd-3-clause",
"size": 3577
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,221,775 |
private List<CmsResource> readChangedResourcesInsideProject(
CmsDbContext dbc,
CmsUUID projectId,
CmsReadChangedProjectResourceMode mode)
throws CmsException {
String cacheKey = projectId + "_" + mode.toString();
List<CmsResource> result = m_monitor.getCachedProjectResources(cacheKey);
if (result != null) {
return result;
}
List<String> projectResources = readProjectResources(dbc, readProject(dbc, projectId));
result = new ArrayList<CmsResource>();
String currentProjectResource = null;
List<CmsResource> resources = new ArrayList<CmsResource>();
CmsResource currentResource = null;
CmsLock currentLock = null;
for (int i = 0; i < projectResources.size(); i++) {
// read all resources that are inside the project by visiting each project resource
currentProjectResource = projectResources.get(i);
try {
currentResource = readResource(dbc, currentProjectResource, CmsResourceFilter.ALL);
if (currentResource.isFolder()) {
resources.addAll(readResources(dbc, currentResource, CmsResourceFilter.ALL, true));
} else {
resources.add(currentResource);
}
} catch (CmsException e) {
// the project resource probably doesn't exist (anymore)...
if (!(e instanceof CmsVfsResourceNotFoundException)) {
throw e;
}
}
}
for (int j = 0; j < resources.size(); j++) {
currentResource = resources.get(j);
currentLock = getLock(dbc, currentResource).getEditionLock();
if (!currentResource.getState().isUnchanged()) {
if ((currentLock.isNullLock() && (currentResource.getProjectLastModified().equals(projectId)))
|| (currentLock.isOwnedBy(dbc.currentUser()) && (currentLock.getProjectId().equals(projectId)))) {
// add only resources that are
// - inside the project,
// - changed in the project,
// - either unlocked, or locked for the current user in the project
if ((mode == RCPRM_FILES_AND_FOLDERS_MODE)
|| (currentResource.isFolder() && (mode == RCPRM_FOLDERS_ONLY_MODE))
|| (currentResource.isFile() && (mode == RCPRM_FILES_ONLY_MODE))) {
result.add(currentResource);
}
}
}
}
resources.clear();
resources = null;
m_monitor.cacheProjectResources(cacheKey, result);
return result;
} | List<CmsResource> function( CmsDbContext dbc, CmsUUID projectId, CmsReadChangedProjectResourceMode mode) throws CmsException { String cacheKey = projectId + "_" + mode.toString(); List<CmsResource> result = m_monitor.getCachedProjectResources(cacheKey); if (result != null) { return result; } List<String> projectResources = readProjectResources(dbc, readProject(dbc, projectId)); result = new ArrayList<CmsResource>(); String currentProjectResource = null; List<CmsResource> resources = new ArrayList<CmsResource>(); CmsResource currentResource = null; CmsLock currentLock = null; for (int i = 0; i < projectResources.size(); i++) { currentProjectResource = projectResources.get(i); try { currentResource = readResource(dbc, currentProjectResource, CmsResourceFilter.ALL); if (currentResource.isFolder()) { resources.addAll(readResources(dbc, currentResource, CmsResourceFilter.ALL, true)); } else { resources.add(currentResource); } } catch (CmsException e) { if (!(e instanceof CmsVfsResourceNotFoundException)) { throw e; } } } for (int j = 0; j < resources.size(); j++) { currentResource = resources.get(j); currentLock = getLock(dbc, currentResource).getEditionLock(); if (!currentResource.getState().isUnchanged()) { if ((currentLock.isNullLock() && (currentResource.getProjectLastModified().equals(projectId))) (currentLock.isOwnedBy(dbc.currentUser()) && (currentLock.getProjectId().equals(projectId)))) { if ((mode == RCPRM_FILES_AND_FOLDERS_MODE) (currentResource.isFolder() && (mode == RCPRM_FOLDERS_ONLY_MODE)) (currentResource.isFile() && (mode == RCPRM_FILES_ONLY_MODE))) { result.add(currentResource); } } } } resources.clear(); resources = null; m_monitor.cacheProjectResources(cacheKey, result); return result; } | /**
* Reads all resources that are inside and changed in a specified project.<p>
*
* @param dbc the current database context
* @param projectId the ID of the project
* @param mode one of the {@link CmsReadChangedProjectResourceMode} constants
*
* @return a List with all resources inside the specified project
*
* @throws CmsException if something goes wrong
*/ | Reads all resources that are inside and changed in a specified project | readChangedResourcesInsideProject | {
"repo_name": "ggiudetti/opencms-core",
"path": "src/org/opencms/db/CmsDriverManager.java",
"license": "lgpl-2.1",
"size": 494693
} | [
"java.util.ArrayList",
"java.util.List",
"org.opencms.file.CmsResource",
"org.opencms.file.CmsResourceFilter",
"org.opencms.file.CmsVfsResourceNotFoundException",
"org.opencms.lock.CmsLock",
"org.opencms.main.CmsException",
"org.opencms.util.CmsUUID"
] | import java.util.ArrayList; import java.util.List; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.file.CmsVfsResourceNotFoundException; import org.opencms.lock.CmsLock; import org.opencms.main.CmsException; import org.opencms.util.CmsUUID; | import java.util.*; import org.opencms.file.*; import org.opencms.lock.*; import org.opencms.main.*; import org.opencms.util.*; | [
"java.util",
"org.opencms.file",
"org.opencms.lock",
"org.opencms.main",
"org.opencms.util"
] | java.util; org.opencms.file; org.opencms.lock; org.opencms.main; org.opencms.util; | 2,877,552 |
public Map<String, EdgeProperty> getOutputVertexEdgeProperties();
/**
* Get a {@link VertexStatistics} object to find out execution statistics
* about the given {@link Vertex}.
* <br>This only provides point in time values for statistics (completed tasks)
* and must be called again to get updated values.
*
* @param vertexName
* Name of the {@link Vertex} | Map<String, EdgeProperty> function(); /** * Get a {@link VertexStatistics} object to find out execution statistics * about the given {@link Vertex}. * <br>This only provides point in time values for statistics (completed tasks) * and must be called again to get updated values. * * @param vertexName * Name of the {@link Vertex} | /**
* Get the edge properties on the output edges of this vertex. The output edge
* is represented by the destination vertex name
* @return Map of destination vertex name and edge property
*/ | Get the edge properties on the output edges of this vertex. The output edge is represented by the destination vertex name | getOutputVertexEdgeProperties | {
"repo_name": "navis/tez",
"path": "tez-api/src/main/java/org/apache/tez/dag/api/VertexManagerPluginContext.java",
"license": "apache-2.0",
"size": 12073
} | [
"java.util.Map",
"org.apache.tez.runtime.api.VertexStatistics"
] | import java.util.Map; import org.apache.tez.runtime.api.VertexStatistics; | import java.util.*; import org.apache.tez.runtime.api.*; | [
"java.util",
"org.apache.tez"
] | java.util; org.apache.tez; | 1,659,479 |
protected void startCallAnsweredTreatment() {
Logger.println("Call " + callHandler
+ " starting call answered treatment");
callAnsweredTreatment.addTreatmentDoneListener(this);
callHandler.addTreatment(callAnsweredTreatment);
} | void function() { Logger.println(STR + callHandler + STR); callAnsweredTreatment.addTreatmentDoneListener(this); callHandler.addTreatment(callAnsweredTreatment); } | /**
* Start call answered treatment
*/ | Start call answered treatment | startCallAnsweredTreatment | {
"repo_name": "zyilmaz/openwonderland-jvoicebridge",
"path": "voip/src/com/sun/voip/server/CallSetupAgent.java",
"license": "gpl-2.0",
"size": 13254
} | [
"com.sun.voip.Logger"
] | import com.sun.voip.Logger; | import com.sun.voip.*; | [
"com.sun.voip"
] | com.sun.voip; | 2,698,630 |
public XId getUserId() {
return uxid;
}
XId uxid; | XId function() { return uxid; } XId uxid; | /**
* This is NOT auto-set. It relies on {@link #setUser(XId, IProperties)}.
* @return user id, or null
*/ | This is NOT auto-set. It relies on <code>#setUser(XId, IProperties)</code> | getUserId | {
"repo_name": "sodash/open-code",
"path": "winterwell.web/src/com/winterwell/web/app/WebRequest.java",
"license": "mit",
"size": 39762
} | [
"com.winterwell.web.data.XId"
] | import com.winterwell.web.data.XId; | import com.winterwell.web.data.*; | [
"com.winterwell.web"
] | com.winterwell.web; | 1,573,523 |
EList<Participant2> getParticipants();
| EList<Participant2> getParticipants(); | /**
* Returns the value of the '<em><b>Participant</b></em>' containment reference list.
* The list contents are of type {@link org.openhealthtools.mdht.uml.cda.Participant2}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Participant</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Participant</em>' containment reference list.
* @see org.openhealthtools.mdht.uml.cda.CDAPackage#getProcedure_Participant()
* @model containment="true" ordered="false"
* extendedMetaData="namespace='##targetNamespace'"
* @generated
*/ | Returns the value of the 'Participant' containment reference list. The list contents are of type <code>org.openhealthtools.mdht.uml.cda.Participant2</code>. If the meaning of the 'Participant' containment reference list isn't clear, there really should be more of a description here... | getParticipants | {
"repo_name": "drbgfc/mdht",
"path": "cda/plugins/org.openhealthtools.mdht.uml.cda/src/org/openhealthtools/mdht/uml/cda/Procedure.java",
"license": "epl-1.0",
"size": 30383
} | [
"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; | 1,125,282 |
public void setIcon(Icon icon)
{
dialogFrame.setIcon(icon);
} | void function(Icon icon) { dialogFrame.setIcon(icon); } | /**
* Set the window icon. This icon will be displayed on the
* window frame's title bar.
*
* @param icon The new icon.
*/ | Set the window icon. This icon will be displayed on the window frame's title bar | setIcon | {
"repo_name": "iritgo/iritgo-aktario",
"path": "aktario-framework/src/main/java/de/iritgo/aktario/core/gui/IDialog.java",
"license": "apache-2.0",
"size": 8641
} | [
"javax.swing.Icon"
] | import javax.swing.Icon; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,948,119 |
public void closeAndDelete() throws IOException {
close(true);
} | void function() throws IOException { close(true); } | /**
* Closes this output, writing pending data and releasing the memory.
*
* @throws IOException Thrown, if the pending data could not be written.
*/ | Closes this output, writing pending data and releasing the memory | closeAndDelete | {
"repo_name": "apache/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/FileChannelOutputView.java",
"license": "apache-2.0",
"size": 4935
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,524,912 |
EClass getGround(); | EClass getGround(); | /**
* Returns the meta object for class '{@link gluemodel.CIM.IEC61970.Wires.Ground <em>Ground</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Ground</em>'.
* @see gluemodel.CIM.IEC61970.Wires.Ground
* @generated
*/ | Returns the meta object for class '<code>gluemodel.CIM.IEC61970.Wires.Ground Ground</code>'. | getGround | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Wires/WiresPackage.java",
"license": "mit",
"size": 669840
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 533,514 |
protected boolean isMouseOverTab(CreativeTabs tab, int mouseX, int mouseY)
{
if (tab.getTabPage() != tabPage)
{
if (tab != CreativeTabs.SEARCH && tab != CreativeTabs.INVENTORY)
{
return false;
}
}
int i = tab.getTabColumn();
int j = 28 * i;
int k = 0;
if (tab.isAlignedRight())
{
j = this.xSize - 28 * (6 - i) + 2;
}
else if (i > 0)
{
j += i;
}
if (tab.isTabInFirstRow())
{
k = k - 32;
}
else
{
k = k + this.ySize;
}
return mouseX >= j && mouseX <= j + 28 && mouseY >= k && mouseY <= k + 32;
} | boolean function(CreativeTabs tab, int mouseX, int mouseY) { if (tab.getTabPage() != tabPage) { if (tab != CreativeTabs.SEARCH && tab != CreativeTabs.INVENTORY) { return false; } } int i = tab.getTabColumn(); int j = 28 * i; int k = 0; if (tab.isAlignedRight()) { j = this.xSize - 28 * (6 - i) + 2; } else if (i > 0) { j += i; } if (tab.isTabInFirstRow()) { k = k - 32; } else { k = k + this.ySize; } return mouseX >= j && mouseX <= j + 28 && mouseY >= k && mouseY <= k + 32; } | /**
* Checks if the mouse is over the given tab. Returns true if so.
*/ | Checks if the mouse is over the given tab. Returns true if so | isMouseOverTab | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/inventory/GuiContainerCreative.java",
"license": "gpl-3.0",
"size": 47930
} | [
"net.minecraft.creativetab.CreativeTabs"
] | import net.minecraft.creativetab.CreativeTabs; | import net.minecraft.creativetab.*; | [
"net.minecraft.creativetab"
] | net.minecraft.creativetab; | 33,181 |
public static DoubleAttribute getInstance(Node root)
throws NumberFormatException
{
return getInstance(root.getFirstChild().getNodeValue());
} | static DoubleAttribute function(Node root) throws NumberFormatException { return getInstance(root.getFirstChild().getNodeValue()); } | /**
* Returns a new <code>DoubleAttribute</code> that represents
* the xsi:double at a particular DOM node.
*
* @param root the <code>Node</code> that contains the desired value
* @return a new <code>DoubleAttribute</code> representing the
* appropriate value (null if there is a parsing error)
* @throws NumberFormatException if the string form is not a double
*/ | Returns a new <code>DoubleAttribute</code> that represents the xsi:double at a particular DOM node | getInstance | {
"repo_name": "townbull/mtaaas",
"path": "src/sunxacml/com/sun/xacml/attr/DoubleAttribute.java",
"license": "apache-2.0",
"size": 7026
} | [
"org.w3c.dom.Node"
] | import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,178,571 |
public void readRequest() throws IOException
{
String request = readLine();
if (request == null)
{
throw new HttpException(HttpConstants.STATUS_BAD_REQUEST, "Null query");
}
// Parses the request
StringTokenizer parts = new StringTokenizer(request);
try
{
parseMethod(parts.nextToken());
parseRequest(parts.nextToken());
}
catch (NoSuchElementException ex)
{
throw new HttpException(HttpConstants.STATUS_BAD_REQUEST, request);
}
if (parts.hasMoreTokens())
{
parseVersion(parts.nextToken());
}
else
{
version = 0.9f;
}
if (version >= 1.0f)
{
readHeaders();
parseVariables();
}
} | void function() throws IOException { String request = readLine(); if (request == null) { throw new HttpException(HttpConstants.STATUS_BAD_REQUEST, STR); } StringTokenizer parts = new StringTokenizer(request); try { parseMethod(parts.nextToken()); parseRequest(parts.nextToken()); } catch (NoSuchElementException ex) { throw new HttpException(HttpConstants.STATUS_BAD_REQUEST, request); } if (parts.hasMoreTokens()) { parseVersion(parts.nextToken()); } else { version = 0.9f; } if (version >= 1.0f) { readHeaders(); parseVariables(); } } | /**
* Reads the request parsing the headers
*
* @exception IOException Description of Exception
*/ | Reads the request parsing the headers | readRequest | {
"repo_name": "boneman1231/org.apache.felix",
"path": "trunk/mosgi/jmx.httpconnector/src/main/java/org/apache/felix/mosgi/jmx/httpconnector/mx4j/tools/adaptor/http/HttpInputStream.java",
"license": "apache-2.0",
"size": 10647
} | [
"java.io.IOException",
"java.util.NoSuchElementException",
"java.util.StringTokenizer"
] | import java.io.IOException; import java.util.NoSuchElementException; import java.util.StringTokenizer; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,775,282 |
IDatatype getTranslatedType(IDatatype originalType) {
IDatatype copiedType = null;
if (null != originalType) {
if (originalType.isPrimitive()) {
// Real, Strings, Integers, Booleans, Constraints
copiedType = originalType;
} else if (Container.TYPE.isAssignableFrom(originalType)) {
copiedType = getTranslatedContainer((Container) originalType);
} else if (originalType instanceof Compound || originalType instanceof Enum
|| originalType instanceof DerivedDatatype) {
// Type must be defined in project and must not be created on the fly!
copiedType = (IDatatype) copiedElements.get(originalType);
} else if (originalType instanceof Reference) {
copiedType = (IDatatype) copiedElements.get(originalType);
if (null == copiedType) {
Reference orgRef = (Reference) originalType;
IDatatype copiedBasisType = getTranslatedType(orgRef.getType());
if (null != copiedBasisType) {
ModelElement parent = (ModelElement) getCopiedParent(orgRef.getParent());
Reference copiedReference = new Reference(originalType.getName(), copiedBasisType, parent);
setComment(copiedReference, orgRef);
copiedElements.put(copiedReference, orgRef);
copiedType = copiedReference;
}
}
} else if (null != projectTypes.get(originalType)) {
Project copiedProject = projectTypes.get(originalType);
copiedType = copiedProject.getType();
} else if (originalType instanceof FreezeVariableType) {
copiedType = (IDatatype) copiedElements.get(originalType);
if (null == copiedType && frozenElementsOK) {
FreezeVariableType orgFreezeType = (FreezeVariableType) originalType;
FreezeVariableType copiedFreezeType = new FreezeVariableType(currentlyFrozen, parents.peekFirst());
copiedElements.put(orgFreezeType, copiedFreezeType);
copiedType = copiedFreezeType;
}
}
}
assert copiedType == null || copiedType.getClass() == originalType.getClass();
return copiedType;
} | IDatatype getTranslatedType(IDatatype originalType) { IDatatype copiedType = null; if (null != originalType) { if (originalType.isPrimitive()) { copiedType = originalType; } else if (Container.TYPE.isAssignableFrom(originalType)) { copiedType = getTranslatedContainer((Container) originalType); } else if (originalType instanceof Compound originalType instanceof Enum originalType instanceof DerivedDatatype) { copiedType = (IDatatype) copiedElements.get(originalType); } else if (originalType instanceof Reference) { copiedType = (IDatatype) copiedElements.get(originalType); if (null == copiedType) { Reference orgRef = (Reference) originalType; IDatatype copiedBasisType = getTranslatedType(orgRef.getType()); if (null != copiedBasisType) { ModelElement parent = (ModelElement) getCopiedParent(orgRef.getParent()); Reference copiedReference = new Reference(originalType.getName(), copiedBasisType, parent); setComment(copiedReference, orgRef); copiedElements.put(copiedReference, orgRef); copiedType = copiedReference; } } } else if (null != projectTypes.get(originalType)) { Project copiedProject = projectTypes.get(originalType); copiedType = copiedProject.getType(); } else if (originalType instanceof FreezeVariableType) { copiedType = (IDatatype) copiedElements.get(originalType); if (null == copiedType && frozenElementsOK) { FreezeVariableType orgFreezeType = (FreezeVariableType) originalType; FreezeVariableType copiedFreezeType = new FreezeVariableType(currentlyFrozen, parents.peekFirst()); copiedElements.put(orgFreezeType, copiedFreezeType); copiedType = copiedFreezeType; } } } assert copiedType == null copiedType.getClass() == originalType.getClass(); return copiedType; } | /**
* Returns the copied {@link IDatatype} for the given one.
* @param originalType A {@link IDatatype} used in the original project.
* @return The copied {@link IDatatype}, the same {@link IDatatype} if it is a basis type, or <tt>null</tt> if the
* datatype wasn't translated so far.
*/ | Returns the copied <code>IDatatype</code> for the given one | getTranslatedType | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/VarModel/Model/src/net/ssehub/easy/varModel/model/rewrite/ProjectCopyVisitor.java",
"license": "apache-2.0",
"size": 53478
} | [
"net.ssehub.easy.varModel.model.ModelElement",
"net.ssehub.easy.varModel.model.Project",
"net.ssehub.easy.varModel.model.datatypes.Compound",
"net.ssehub.easy.varModel.model.datatypes.Container",
"net.ssehub.easy.varModel.model.datatypes.DerivedDatatype",
"net.ssehub.easy.varModel.model.datatypes.Enum",
"net.ssehub.easy.varModel.model.datatypes.FreezeVariableType",
"net.ssehub.easy.varModel.model.datatypes.IDatatype",
"net.ssehub.easy.varModel.model.datatypes.Reference"
] | import net.ssehub.easy.varModel.model.ModelElement; import net.ssehub.easy.varModel.model.Project; import net.ssehub.easy.varModel.model.datatypes.Compound; import net.ssehub.easy.varModel.model.datatypes.Container; import net.ssehub.easy.varModel.model.datatypes.DerivedDatatype; import net.ssehub.easy.varModel.model.datatypes.Enum; import net.ssehub.easy.varModel.model.datatypes.FreezeVariableType; import net.ssehub.easy.varModel.model.datatypes.IDatatype; import net.ssehub.easy.varModel.model.datatypes.Reference; | import net.ssehub.easy.*; | [
"net.ssehub.easy"
] | net.ssehub.easy; | 1,006,920 |
public Dimension getPreferredMinSize()
{
if (preferredMinSize == null)
return getPreferredSize(tree);
else
return preferredMinSize;
} | Dimension function() { if (preferredMinSize == null) return getPreferredSize(tree); else return preferredMinSize; } | /**
* Gets the preferred minimum size.
*
* @returns the preferred minimum size.
*/ | Gets the preferred minimum size | getPreferredMinSize | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/javax/swing/plaf/basic/BasicTreeUI.java",
"license": "gpl-2.0",
"size": 115323
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 573,340 |
protected void cacheElement(Ehcache cache, Serializable cacheKey, CachedPortletResultHolder<?> data, CacheControl cacheControl) {
// using validation method, ignore expirationTime and defer to cache configuration
if (cacheControl.getETag() != null) {
final Element element = new Element(cacheKey, data);
cache.put(element);
return;
}
// using expiration method, -1 for CacheControl#expirationTime means "forever" (e.g. ignore and defer to cache configuration)
final int expirationTime = cacheControl.getExpirationTime();
if(expirationTime == -1) {
final Element element = new Element(cacheKey, data);
cache.put(element);
return;
}
// using expiration method with a positive expiration, set that value as the element's TTL if it is lower than the configured cache TTL
final CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
final Element element = new Element(cacheKey, data);
final long cacheTTL = cacheConfiguration.getTimeToLiveSeconds();
if (expirationTime < cacheTTL) {
element.setTimeToLive(expirationTime);
}
cache.put(element);
}
| void function(Ehcache cache, Serializable cacheKey, CachedPortletResultHolder<?> data, CacheControl cacheControl) { if (cacheControl.getETag() != null) { final Element element = new Element(cacheKey, data); cache.put(element); return; } final int expirationTime = cacheControl.getExpirationTime(); if(expirationTime == -1) { final Element element = new Element(cacheKey, data); cache.put(element); return; } final CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); final Element element = new Element(cacheKey, data); final long cacheTTL = cacheConfiguration.getTimeToLiveSeconds(); if (expirationTime < cacheTTL) { element.setTimeToLive(expirationTime); } cache.put(element); } | /**
* Construct an appropriate Cache {@link Element} for the cacheKey and data.
* The element's ttl will be set depending on whether expiration or validation method is indicated from the CacheControl and the cache's configuration.
*/ | Construct an appropriate Cache <code>Element</code> for the cacheKey and data. The element's ttl will be set depending on whether expiration or validation method is indicated from the CacheControl and the cache's configuration | cacheElement | {
"repo_name": "Jasig/SSP-Platform",
"path": "uportal-war/src/main/java/org/jasig/portal/portlet/container/cache/PortletCacheControlServiceImpl.java",
"license": "apache-2.0",
"size": 30139
} | [
"java.io.Serializable",
"javax.portlet.CacheControl",
"net.sf.ehcache.Ehcache",
"net.sf.ehcache.Element",
"net.sf.ehcache.config.CacheConfiguration"
] | import java.io.Serializable; import javax.portlet.CacheControl; import net.sf.ehcache.Ehcache; import net.sf.ehcache.Element; import net.sf.ehcache.config.CacheConfiguration; | import java.io.*; import javax.portlet.*; import net.sf.ehcache.*; import net.sf.ehcache.config.*; | [
"java.io",
"javax.portlet",
"net.sf.ehcache"
] | java.io; javax.portlet; net.sf.ehcache; | 478,534 |
public boolean isRadioButton() {
return getCOSObject().getFlag(COSName.FF, FLAG_RADIO);
} | boolean function() { return getCOSObject().getFlag(COSName.FF, FLAG_RADIO); } | /**
* Determines if radio button bit is set.
*
* @return true if type of button field is a push button.
*/ | Determines if radio button bit is set | isRadioButton | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDButton.java",
"license": "apache-2.0",
"size": 10742
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 51,902 |
static boolean constrainedResize(ResizeFeaturesBase prop,
boolean isFirstRun,
double tableWidth,
List<? extends TableColumnBase<?,?>> visibleLeafColumns) {
TableColumnBase<?,?> column = prop.getColumn();
double delta = prop.getDelta();
boolean isShrinking;
double target;
double totalLowerBound = 0;
double totalUpperBound = 0;
if (tableWidth == 0) return false;
// determine the width of all visible columns, and their preferred width
double colWidth = 0;
for (TableColumnBase<?,?> col : visibleLeafColumns) {
colWidth += col.getWidth();
}
if (Math.abs(colWidth - tableWidth) > 1) {
isShrinking = colWidth > tableWidth;
target = tableWidth;
if (isFirstRun) {
// if we are here we have an inconsistency - these two values should be
// equal when this resizing policy is being used.
for (TableColumnBase<?,?> col : visibleLeafColumns) {
totalLowerBound += col.getMinWidth();
totalUpperBound += col.getMaxWidth();
}
// We run into trouble if the numbers are set to infinity later on
totalUpperBound = totalUpperBound == Double.POSITIVE_INFINITY ?
Double.MAX_VALUE :
(totalUpperBound == Double.NEGATIVE_INFINITY ? Double.MIN_VALUE : totalUpperBound);
for (TableColumnBase col : visibleLeafColumns) {
double lowerBound = col.getMinWidth();
double upperBound = col.getMaxWidth();
// Check for zero. This happens when the distribution of the delta
// finishes early due to a series of "fixed" entries at the end.
// In this case, lowerBound == upperBound, for all subsequent terms.
double newSize;
if (Math.abs(totalLowerBound - totalUpperBound) < .0000001) {
newSize = lowerBound;
} else {
double f = (target - totalLowerBound) / (totalUpperBound - totalLowerBound);
newSize = Math.round(lowerBound + f * (upperBound - lowerBound));
}
double remainder = resize(col, newSize - col.getWidth());
target -= newSize + remainder;
totalLowerBound -= lowerBound;
totalUpperBound -= upperBound;
}
isFirstRun = false;
} else {
double actualDelta = tableWidth - colWidth;
List<? extends TableColumnBase<?,?>> cols = visibleLeafColumns;
resizeColumns(cols, actualDelta);
}
}
// At this point we can be happy in the knowledge that we have internal
// consistency, i.e. table width == sum of the width of all visible
// leaf columns.
if (column == null) {
return false;
}
isShrinking = delta < 0;
// need to find the last leaf column of the given column - it is this
// column that we actually resize from. If this column is a leaf, then we
// use it.
TableColumnBase<?,?> leafColumn = column;
while (leafColumn.getColumns().size() > 0) {
leafColumn = leafColumn.getColumns().get(leafColumn.getColumns().size() - 1);
}
int colPos = visibleLeafColumns.indexOf(leafColumn);
int endColPos = visibleLeafColumns.size() - 1;
// we now can split the observableArrayList into two subobservableArrayLists, representing all
// columns that should grow, and all columns that should shrink
// var growingCols = if (isShrinking)
// then table.visibleLeafColumns[colPos+1..endColPos]
// else table.visibleLeafColumns[0..colPos];
// var shrinkingCols = if (isShrinking)
// then table.visibleLeafColumns[0..colPos]
// else table.visibleLeafColumns[colPos+1..endColPos];
double remainingDelta = delta;
while (endColPos > colPos && remainingDelta != 0) {
TableColumnBase<?,?> resizingCol = visibleLeafColumns.get(endColPos);
endColPos--;
// if the column width is fixed, break out and try the next column
if (! resizingCol.isResizable()) continue;
// for convenience we discern between the shrinking and growing columns
TableColumnBase<?,?> shrinkingCol = isShrinking ? leafColumn : resizingCol;
TableColumnBase<?,?> growingCol = !isShrinking ? leafColumn : resizingCol;
// (shrinkingCol.width == shrinkingCol.minWidth) or (growingCol.width == growingCol.maxWidth)
if (growingCol.getWidth() > growingCol.getPrefWidth()) {
// growingCol is willing to be generous in this case - it goes
// off to find a potentially better candidate to grow
List<? extends TableColumnBase> seq = visibleLeafColumns.subList(colPos + 1, endColPos + 1);
for (int i = seq.size() - 1; i >= 0; i--) {
TableColumnBase<?,?> c = seq.get(i);
if (c.getWidth() < c.getPrefWidth()) {
growingCol = c;
break;
}
}
}
//
// if (shrinkingCol.width < shrinkingCol.prefWidth) {
// for (c in reverse table.visibleLeafColumns[colPos+1..endColPos]) {
// if (c.width > c.prefWidth) {
// shrinkingCol = c;
// break;
// }
// }
// }
double sdiff = Math.min(Math.abs(remainingDelta), shrinkingCol.getWidth() - shrinkingCol.getMinWidth());
// System.out.println("\tshrinking " + shrinkingCol.getText() + " and growing " + growingCol.getText());
// System.out.println("\t\tMath.min(Math.abs("+remainingDelta+"), "+shrinkingCol.getWidth()+" - "+shrinkingCol.getMinWidth()+") = " + sdiff);
double delta1 = resize(shrinkingCol, -sdiff);
double delta2 = resize(growingCol, sdiff);
remainingDelta += isShrinking ? sdiff : -sdiff;
}
return remainingDelta == 0;
} | static boolean constrainedResize(ResizeFeaturesBase prop, boolean isFirstRun, double tableWidth, List<? extends TableColumnBase<?,?>> visibleLeafColumns) { TableColumnBase<?,?> column = prop.getColumn(); double delta = prop.getDelta(); boolean isShrinking; double target; double totalLowerBound = 0; double totalUpperBound = 0; if (tableWidth == 0) return false; double colWidth = 0; for (TableColumnBase<?,?> col : visibleLeafColumns) { colWidth += col.getWidth(); } if (Math.abs(colWidth - tableWidth) > 1) { isShrinking = colWidth > tableWidth; target = tableWidth; if (isFirstRun) { for (TableColumnBase<?,?> col : visibleLeafColumns) { totalLowerBound += col.getMinWidth(); totalUpperBound += col.getMaxWidth(); } totalUpperBound = totalUpperBound == Double.POSITIVE_INFINITY ? Double.MAX_VALUE : (totalUpperBound == Double.NEGATIVE_INFINITY ? Double.MIN_VALUE : totalUpperBound); for (TableColumnBase col : visibleLeafColumns) { double lowerBound = col.getMinWidth(); double upperBound = col.getMaxWidth(); double newSize; if (Math.abs(totalLowerBound - totalUpperBound) < .0000001) { newSize = lowerBound; } else { double f = (target - totalLowerBound) / (totalUpperBound - totalLowerBound); newSize = Math.round(lowerBound + f * (upperBound - lowerBound)); } double remainder = resize(col, newSize - col.getWidth()); target -= newSize + remainder; totalLowerBound -= lowerBound; totalUpperBound -= upperBound; } isFirstRun = false; } else { double actualDelta = tableWidth - colWidth; List<? extends TableColumnBase<?,?>> cols = visibleLeafColumns; resizeColumns(cols, actualDelta); } } if (column == null) { return false; } isShrinking = delta < 0; TableColumnBase<?,?> leafColumn = column; while (leafColumn.getColumns().size() > 0) { leafColumn = leafColumn.getColumns().get(leafColumn.getColumns().size() - 1); } int colPos = visibleLeafColumns.indexOf(leafColumn); int endColPos = visibleLeafColumns.size() - 1; double remainingDelta = delta; while (endColPos > colPos && remainingDelta != 0) { TableColumnBase<?,?> resizingCol = visibleLeafColumns.get(endColPos); endColPos--; if (! resizingCol.isResizable()) continue; TableColumnBase<?,?> shrinkingCol = isShrinking ? leafColumn : resizingCol; TableColumnBase<?,?> growingCol = !isShrinking ? leafColumn : resizingCol; if (growingCol.getWidth() > growingCol.getPrefWidth()) { List<? extends TableColumnBase> seq = visibleLeafColumns.subList(colPos + 1, endColPos + 1); for (int i = seq.size() - 1; i >= 0; i--) { TableColumnBase<?,?> c = seq.get(i); if (c.getWidth() < c.getPrefWidth()) { growingCol = c; break; } } } double sdiff = Math.min(Math.abs(remainingDelta), shrinkingCol.getWidth() - shrinkingCol.getMinWidth()); double delta1 = resize(shrinkingCol, -sdiff); double delta2 = resize(growingCol, sdiff); remainingDelta += isShrinking ? sdiff : -sdiff; } return remainingDelta == 0; } | /**
* The constrained resize algorithm used by TableView and TreeTableView.
* @param prop
* @param isFirstRun
* @param tableWidth
* @param visibleLeafColumns
* @return
*/ | The constrained resize algorithm used by TableView and TreeTableView | constrainedResize | {
"repo_name": "166MMX/openjdk.java.net-openjfx-8u40-rt",
"path": "modules/controls/src/main/java/javafx/scene/control/TableUtil.java",
"license": "gpl-2.0",
"size": 20431
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,800,121 |
public boolean hasFreeVarsFor(BindingSet binding);
| boolean function(BindingSet binding); | /**
* returns true iff this statement has free variables in the presence
* of the specified binding set
*
* @param binding
* @return
*/ | returns true iff this statement has free variables in the presence of the specified binding set | hasFreeVarsFor | {
"repo_name": "semagrow/fork-fedX",
"path": "src/com/fluidops/fedx/algebra/StatementTupleExpr.java",
"license": "agpl-3.0",
"size": 2606
} | [
"org.openrdf.query.BindingSet"
] | import org.openrdf.query.BindingSet; | import org.openrdf.query.*; | [
"org.openrdf.query"
] | org.openrdf.query; | 1,851,241 |
protected void parseNodes(Node pageElem, mxVsdxModel model, String pageName)
{
Node pageChild = pageElem.getFirstChild();
while (pageChild != null)
{
if (pageChild instanceof Element)
{
Element pageChildElem = (Element) pageChild;
String childName = pageChildElem.getNodeName();
if (childName.equals("Rel"))
{
resolveRel(pageChildElem, model, pageName);
}
else if (childName.equals("Shapes"))
{
this.shapes = parseShapes(pageChildElem, null, false);
}
else if (childName.equals("Connects"))
{
NodeList connectList = pageChildElem.getElementsByTagName(mxVsdxConstants.CONNECT);
Node connectNode = (connectList != null && connectList.getLength() > 0) ? connectList.item(0) : null;
//mxVdxConnect currentConnect = null;
while (connectNode != null)
{
if (connectNode instanceof Element)
{
Element connectElem = (Element) connectNode;
mxVsdxConnect connect = new mxVsdxConnect(connectElem);
Integer fromSheet = connect.getFromSheet();
mxVsdxConnect previousConnect = (fromSheet != null && fromSheet > -1) ? connects.get(fromSheet) : null;
if (previousConnect != null)
{
previousConnect.addConnect(connectElem);
}
else
{
connects.put(connect.getFromSheet(), connect);
}
}
connectNode = connectNode.getNextSibling();
}
}
else if (childName.equals("PageSheet"))
{
this.pageSheet = pageChildElem;
}
}
pageChild = pageChild.getNextSibling();
}
} | void function(Node pageElem, mxVsdxModel model, String pageName) { Node pageChild = pageElem.getFirstChild(); while (pageChild != null) { if (pageChild instanceof Element) { Element pageChildElem = (Element) pageChild; String childName = pageChildElem.getNodeName(); if (childName.equals("Rel")) { resolveRel(pageChildElem, model, pageName); } else if (childName.equals(STR)) { this.shapes = parseShapes(pageChildElem, null, false); } else if (childName.equals(STR)) { NodeList connectList = pageChildElem.getElementsByTagName(mxVsdxConstants.CONNECT); Node connectNode = (connectList != null && connectList.getLength() > 0) ? connectList.item(0) : null; while (connectNode != null) { if (connectNode instanceof Element) { Element connectElem = (Element) connectNode; mxVsdxConnect connect = new mxVsdxConnect(connectElem); Integer fromSheet = connect.getFromSheet(); mxVsdxConnect previousConnect = (fromSheet != null && fromSheet > -1) ? connects.get(fromSheet) : null; if (previousConnect != null) { previousConnect.addConnect(connectElem); } else { connects.put(connect.getFromSheet(), connect); } } connectNode = connectNode.getNextSibling(); } } else if (childName.equals(STR)) { this.pageSheet = pageChildElem; } } pageChild = pageChild.getNextSibling(); } } | /**
* Parses the child nodes of the given element
* @param pageElem the parent whose children to parse
* @param model the model of the vsdx file
* @param pageName page information is split across pages.xml and pageX.xml where X is any number. We have to know which we're currently parsing to use the correct relationships file.
*/ | Parses the child nodes of the given element | parseNodes | {
"repo_name": "fisherMartyn/draw.io",
"path": "src/com/mxgraph/io/vsdx/mxVsdxPage.java",
"license": "gpl-3.0",
"size": 9339
} | [
"org.w3c.dom.Element",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,063,060 |
public void addProviderAtEnd(Provider p, Oid mech)
throws GSSException {
// this GSSManager implementation does not support an SPI
// with a pluggable provider architecture
throw new GSSException(GSSException.UNAVAILABLE);
}
| void function(Provider p, Oid mech) throws GSSException { throw new GSSException(GSSException.UNAVAILABLE); } | /**
* Currently not implemented.
*/ | Currently not implemented | addProviderAtEnd | {
"repo_name": "dCache/jglobus-1.8",
"path": "src/org/globus/gsi/gssapi/GlobusGSSManagerImpl.java",
"license": "apache-2.0",
"size": 11427
} | [
"java.security.Provider",
"org.ietf.jgss.GSSException",
"org.ietf.jgss.Oid"
] | import java.security.Provider; import org.ietf.jgss.GSSException; import org.ietf.jgss.Oid; | import java.security.*; import org.ietf.jgss.*; | [
"java.security",
"org.ietf.jgss"
] | java.security; org.ietf.jgss; | 2,892,053 |
public static WizardInfo getCustomDistributionWizard() {
return null;
}
| static WizardInfo function() { return null; } | /**
* The default wizard info for this distrib. If none no custom distribution wizard is shown
* @return the default wizard info
*/ | The default wizard info for this distrib. If none no custom distribution wizard is shown | getCustomDistributionWizard | {
"repo_name": "NewCell/Call-Text-v1",
"path": "src/com/newcell/calltext/utils/CustomDistribution.java",
"license": "gpl-3.0",
"size": 5267
} | [
"com.newcell.calltext.wizards.WizardUtils"
] | import com.newcell.calltext.wizards.WizardUtils; | import com.newcell.calltext.wizards.*; | [
"com.newcell.calltext"
] | com.newcell.calltext; | 2,207,785 |
@PreDestroy
public void destroy() {
try {
if (INITIALIZED.get() && this.loggerContext != null) {
final ServletContextEvent event = new ServletContextEvent(this.context);
LOGGER.debug("Destroying logging context and shutting it down");
this.loggerContext.contextDestroyed(event);
}
} catch (final Exception e) {
throw new RuntimeException(e);
}
} | void function() { try { if (INITIALIZED.get() && this.loggerContext != null) { final ServletContextEvent event = new ServletContextEvent(this.context); LOGGER.debug(STR); this.loggerContext.contextDestroyed(event); } } catch (final Exception e) { throw new RuntimeException(e); } } | /**
* Destroys all logging hooks and shuts down
* the logger.
*/ | Destroys all logging hooks and shuts down the logger | destroy | {
"repo_name": "moghaddam/cas",
"path": "cas-server-core-logging/src/main/java/org/jasig/cas/util/CasLoggerContextInitializer.java",
"license": "apache-2.0",
"size": 6269
} | [
"javax.servlet.ServletContextEvent"
] | import javax.servlet.ServletContextEvent; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 537,752 |
public void setAutopsyTagsManager(TagsManager autopsyTagsManager) {
synchronized (autopsyTagsManagerLock) {
this.autopsyTagsManager = autopsyTagsManager;
clearFollowUpTagName();
}
} | void function(TagsManager autopsyTagsManager) { synchronized (autopsyTagsManagerLock) { this.autopsyTagsManager = autopsyTagsManager; clearFollowUpTagName(); } } | /**
* assign a new TagsManager to back this one, ie when the current case
* changes
*
* @param autopsyTagsManager
*/ | assign a new TagsManager to back this one, ie when the current case changes | setAutopsyTagsManager | {
"repo_name": "mhmdfy/autopsy",
"path": "ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java",
"license": "apache-2.0",
"size": 7843
} | [
"org.sleuthkit.autopsy.casemodule.services.TagsManager"
] | import org.sleuthkit.autopsy.casemodule.services.TagsManager; | import org.sleuthkit.autopsy.casemodule.services.*; | [
"org.sleuthkit.autopsy"
] | org.sleuthkit.autopsy; | 1,023,919 |
private void createComboBox(Container root, GridBagConstraints gbc,
String arg, String currentParam) {
JPanel panel = new JPanel();
JLabel label = new JLabel(arg + ": ");
panel.add(label);
JComboBox<String> input = new JComboBox<>();
for (String value : block.getParamValues()) {
input.addItem(value);
}
input.setSelectedItem(currentParam);
inputs[gbc.gridx] = input;
panel.add(input);
root.add(panel, gbc);
} | void function(Container root, GridBagConstraints gbc, String arg, String currentParam) { JPanel panel = new JPanel(); JLabel label = new JLabel(arg + STR); panel.add(label); JComboBox<String> input = new JComboBox<>(); for (String value : block.getParamValues()) { input.addItem(value); } input.setSelectedItem(currentParam); inputs[gbc.gridx] = input; panel.add(input); root.add(panel, gbc); } | /**
* Create a combo box for selection of parameters
*
* @param root
* the pane to add this to
* @param gbc
* constraints for the combo box
* @param arg
* The label for the combo box
*/ | Create a combo box for selection of parameters | createComboBox | {
"repo_name": "BlueDragon23/MIDIBlocks",
"path": "src/main/gui/ParamsDialog.java",
"license": "mit",
"size": 8945
} | [
"java.awt.Container",
"java.awt.GridBagConstraints",
"javax.swing.JComboBox",
"javax.swing.JLabel",
"javax.swing.JPanel"
] | import java.awt.Container; import java.awt.GridBagConstraints; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,540,628 |
public ConEstCon getByCodigo(String codigo) throws Exception {
ConEstCon conEstCon;
String queryString = "from ConEstCon t where t.codConEstCon = :codigo";
Session session = SiatHibernateUtil.currentSession();
Query query = session.createQuery(queryString).setString("codigo", codigo);
conEstCon = (ConEstCon) query.uniqueResult();
return conEstCon;
}
| ConEstCon function(String codigo) throws Exception { ConEstCon conEstCon; String queryString = STR; Session session = SiatHibernateUtil.currentSession(); Query query = session.createQuery(queryString).setString(STR, codigo); conEstCon = (ConEstCon) query.uniqueResult(); return conEstCon; } | /**
* Obtiene un ConEstCon por su codigo
*/ | Obtiene un ConEstCon por su codigo | getByCodigo | {
"repo_name": "avdata99/SIAT",
"path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/gde/buss/dao/ConEstConDAO.java",
"license": "gpl-3.0",
"size": 5029
} | [
"ar.gov.rosario.siat.base.buss.dao.SiatHibernateUtil",
"ar.gov.rosario.siat.gde.buss.bean.ConEstCon",
"org.hibernate.Query",
"org.hibernate.classic.Session"
] | import ar.gov.rosario.siat.base.buss.dao.SiatHibernateUtil; import ar.gov.rosario.siat.gde.buss.bean.ConEstCon; import org.hibernate.Query; import org.hibernate.classic.Session; | import ar.gov.rosario.siat.base.buss.dao.*; import ar.gov.rosario.siat.gde.buss.bean.*; import org.hibernate.*; import org.hibernate.classic.*; | [
"ar.gov.rosario",
"org.hibernate",
"org.hibernate.classic"
] | ar.gov.rosario; org.hibernate; org.hibernate.classic; | 69,539 |
public Object getHealth() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/health";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2_client_credentials_grant", "oauth2_password_grant" };
GenericType<Object> localVarReturnType = new GenericType<Object>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | Object function() throws ApiException { Object localVarPostBody = null; String localVarPath = STR; List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { STR }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { STR, STR }; GenericType<Object> localVarReturnType = new GenericType<Object>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } | /**
* Get health info
* <b>Permissions Needed:</b> ANY
* @return Object
* @throws ApiException if fails to make API call
*/ | Get health info <b>Permissions Needed:</b> ANY | getHealth | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/api/UtilHealthApi.java",
"license": "apache-2.0",
"size": 2151
} | [
"com.knetikcloud.client.ApiException",
"com.knetikcloud.client.Pair",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"javax.ws.rs.core.GenericType"
] | import com.knetikcloud.client.ApiException; import com.knetikcloud.client.Pair; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.ws.rs.core.GenericType; | import com.knetikcloud.client.*; import java.util.*; import javax.ws.rs.core.*; | [
"com.knetikcloud.client",
"java.util",
"javax.ws"
] | com.knetikcloud.client; java.util; javax.ws; | 2,101,938 |
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState state = this.getDefaultState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer));
EnumFacing blockFacing = getFacingFromEntity(worldIn, pos, placer);
if (!worldIn.isRemote)
{
if(TrackerHelper.track(this, pos.getX(), pos.getY(), pos.getZ(), blockFacing.getIndex()))
{
// LogHelper.info("Adding block to list. "+pos.getX()+", "+pos.getY()+", "+pos.getZ()+", "+state.getValue(PropertyDirection.create("facing")));
// LogHelper.info(Test1.magnetTracker.getNumOfMagnets());
}
}
return this.getDefaultState().withProperty(FACING, blockFacing);
} | IBlockState function(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { IBlockState state = this.getDefaultState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)); EnumFacing blockFacing = getFacingFromEntity(worldIn, pos, placer); if (!worldIn.isRemote) { if(TrackerHelper.track(this, pos.getX(), pos.getY(), pos.getZ(), blockFacing.getIndex())) { } } return this.getDefaultState().withProperty(FACING, blockFacing); } | /**
* Called when block is placed in world. Creates the state, and defines the facing direction using the direction the placer is facing.
* Also adds block to the trackers.
*/ | Called when block is placed in world. Creates the state, and defines the facing direction using the direction the placer is facing. Also adds block to the trackers | onBlockPlaced | {
"repo_name": "aegf1/MCTest1",
"path": "src/main/java/com/JosephB/maxwellcraft/block/BlockRotatedPillerMaxwellCraft.java",
"license": "gpl-3.0",
"size": 6094
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.util.EnumFacing",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; | import net.minecraft.block.state.*; import net.minecraft.entity.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"net.minecraft.block",
"net.minecraft.entity",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.block; net.minecraft.entity; net.minecraft.util; net.minecraft.world; | 1,320,275 |
private HttpMessage prepareRequestMessage(UsernamePasswordAuthenticationCredentials credentials)
throws URIException, HttpMalformedHeaderException, DatabaseException {
// Replace the username and password in the uri
String requestURL = loginRequestURL.replace(MSG_USER_PATTERN,
encodeParameter(credentials.getUsername()));
requestURL = requestURL.replace(MSG_PASS_PATTERN,
encodeParameter(credentials.getPassword()));
URI requestURI = new URI(requestURL, false);
// Replace the username and password in the post data of the request, if needed
String requestBody = null;
if (loginRequestBody != null && !loginRequestBody.isEmpty()) {
requestBody = loginRequestBody.replace(MSG_USER_PATTERN,
encodeParameter(credentials.getUsername()));
requestBody = requestBody.replace(MSG_PASS_PATTERN,
encodeParameter(credentials.getPassword()));
}
// Prepare the actual message, either based on the existing one, or create a new one
HttpMessage requestMessage;
if (this.loginSiteNode != null) {
// TODO: What happens if the SiteNode was deleted?
requestMessage = loginSiteNode.getHistoryReference().getHttpMessage().cloneRequest();
requestMessage.getRequestHeader().setURI(requestURI);
if (requestBody != null) {
requestMessage.getRequestBody().setBody(requestBody);
requestMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null);
}
} else {
String method = (requestBody != null) ? HttpRequestHeader.POST : HttpRequestHeader.GET;
requestMessage = new HttpMessage();
requestMessage.setRequestHeader(
new HttpRequestHeader(method, requestURI, HttpHeader.HTTP10,
Model.getSingleton().getOptionsParam().getConnectionParam()));
if (requestBody != null) {
requestMessage.getRequestBody().setBody(requestBody);
}
}
return requestMessage;
} | HttpMessage function(UsernamePasswordAuthenticationCredentials credentials) throws URIException, HttpMalformedHeaderException, DatabaseException { String requestURL = loginRequestURL.replace(MSG_USER_PATTERN, encodeParameter(credentials.getUsername())); requestURL = requestURL.replace(MSG_PASS_PATTERN, encodeParameter(credentials.getPassword())); URI requestURI = new URI(requestURL, false); String requestBody = null; if (loginRequestBody != null && !loginRequestBody.isEmpty()) { requestBody = loginRequestBody.replace(MSG_USER_PATTERN, encodeParameter(credentials.getUsername())); requestBody = requestBody.replace(MSG_PASS_PATTERN, encodeParameter(credentials.getPassword())); } HttpMessage requestMessage; if (this.loginSiteNode != null) { requestMessage = loginSiteNode.getHistoryReference().getHttpMessage().cloneRequest(); requestMessage.getRequestHeader().setURI(requestURI); if (requestBody != null) { requestMessage.getRequestBody().setBody(requestBody); requestMessage.getRequestHeader().setHeader(HttpHeader.CONTENT_LENGTH, null); } } else { String method = (requestBody != null) ? HttpRequestHeader.POST : HttpRequestHeader.GET; requestMessage = new HttpMessage(); requestMessage.setRequestHeader( new HttpRequestHeader(method, requestURI, HttpHeader.HTTP10, Model.getSingleton().getOptionsParam().getConnectionParam())); if (requestBody != null) { requestMessage.getRequestBody().setBody(requestBody); } } return requestMessage; } | /**
* Prepares a request message, by filling the appropriate 'username' and 'password' fields
* in the request URI and the POST data, if any.
*
* @param credentials the credentials
* @return the HTTP message prepared for authentication
* @throws URIException if failed to create the request URI
* @throws HttpMalformedHeaderException if the constructed HTTP request is malformed
* @throws DatabaseException if an error occurred while reading the request from database
*/ | Prepares a request message, by filling the appropriate 'username' and 'password' fields in the request URI and the POST data, if any | prepareRequestMessage | {
"repo_name": "Harinus/zaproxy",
"path": "src/org/zaproxy/zap/authentication/FormBasedAuthenticationMethodType.java",
"license": "apache-2.0",
"size": 37031
} | [
"org.apache.commons.httpclient.URIException",
"org.parosproxy.paros.db.DatabaseException",
"org.parosproxy.paros.model.Model",
"org.parosproxy.paros.network.HttpHeader",
"org.parosproxy.paros.network.HttpMalformedHeaderException",
"org.parosproxy.paros.network.HttpMessage",
"org.parosproxy.paros.network.HttpRequestHeader"
] | import org.apache.commons.httpclient.URIException; import org.parosproxy.paros.db.DatabaseException; import org.parosproxy.paros.model.Model; import org.parosproxy.paros.network.HttpHeader; import org.parosproxy.paros.network.HttpMalformedHeaderException; import org.parosproxy.paros.network.HttpMessage; import org.parosproxy.paros.network.HttpRequestHeader; | import org.apache.commons.httpclient.*; import org.parosproxy.paros.db.*; import org.parosproxy.paros.model.*; import org.parosproxy.paros.network.*; | [
"org.apache.commons",
"org.parosproxy.paros"
] | org.apache.commons; org.parosproxy.paros; | 1,258,273 |
Symbol resolveOperator(int pos, int optag, Env env, List argtypes) {
Name name = treeinfo.operatorName(optag);
return access(findMethod(env, syms.predefClass.type, name, argtypes),
pos, env.enclClass.sym.type, name, false, argtypes);
} | Symbol resolveOperator(int pos, int optag, Env env, List argtypes) { Name name = treeinfo.operatorName(optag); return access(findMethod(env, syms.predefClass.type, name, argtypes), pos, env.enclClass.sym.type, name, false, argtypes); } | /**
* Resolve operator.
*
* @param pos
* The position to use for error reporting.
* @param optag
* The tag of the operation tree.
* @param env
* The environment current at the operation.
* @param argtypes
* The types of the operands.
*/ | Resolve operator | resolveOperator | {
"repo_name": "nileshpatelksy/hello-pod-cast",
"path": "archive/FILE/Compiler/java_GJC1.42_src/src/com/sun/tools/javac/v8/comp/Resolve.java",
"license": "apache-2.0",
"size": 42456
} | [
"com.sun.tools.javac.v8.code.Symbol",
"com.sun.tools.javac.v8.util.List",
"com.sun.tools.javac.v8.util.Name"
] | import com.sun.tools.javac.v8.code.Symbol; import com.sun.tools.javac.v8.util.List; import com.sun.tools.javac.v8.util.Name; | import com.sun.tools.javac.v8.code.*; import com.sun.tools.javac.v8.util.*; | [
"com.sun.tools"
] | com.sun.tools; | 2,693,603 |
public static void checkAdditionCompatible(final AnyMatrix left, final AnyMatrix right)
throws IllegalArgumentException {
if ((left.getRowDimension() != right.getRowDimension()) ||
(left.getColumnDimension() != right.getColumnDimension())) {
throw MathRuntimeException.createIllegalArgumentException(
"{0}x{1} and {2}x{3} matrices are not addition compatible",
left.getRowDimension(), left.getColumnDimension(),
right.getRowDimension(), right.getColumnDimension());
}
}
| static void function(final AnyMatrix left, final AnyMatrix right) throws IllegalArgumentException { if ((left.getRowDimension() != right.getRowDimension()) (left.getColumnDimension() != right.getColumnDimension())) { throw MathRuntimeException.createIllegalArgumentException( STR, left.getRowDimension(), left.getColumnDimension(), right.getRowDimension(), right.getColumnDimension()); } } | /**
* Check if matrices are addition compatible
* @param left left hand side matrix
* @param right right hand side matrix
* @exception IllegalArgumentException if matrices are not addition compatible
*/ | Check if matrices are addition compatible | checkAdditionCompatible | {
"repo_name": "SpoonLabs/astor",
"path": "examples/Math-issue-340/src/main/java/org/apache/commons/math/linear/MatrixUtils.java",
"license": "gpl-2.0",
"size": 39382
} | [
"org.apache.commons.math.MathRuntimeException"
] | import org.apache.commons.math.MathRuntimeException; | import org.apache.commons.math.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,830,738 |
protected int runApplicationMaster(Configuration config) {
ActorSystem actorSystem = null;
WebMonitor webMonitor = null;
HighAvailabilityServices highAvailabilityServices = null;
MetricRegistryImpl metricRegistry = null;
int numberProcessors = Hardware.getNumberCPUCores();
final ScheduledExecutorService futureExecutor = Executors.newScheduledThreadPool(
numberProcessors,
new ExecutorThreadFactory("yarn-jobmanager-future"));
final ExecutorService ioExecutor = Executors.newFixedThreadPool(
numberProcessors,
new ExecutorThreadFactory("yarn-jobmanager-io"));
try {
// ------- (1) load and parse / validate all configurations -------
// loading all config values here has the advantage that the program fails fast, if any
// configuration problem occurs
final String currDir = ENV.get(Environment.PWD.key());
require(currDir != null, "Current working directory variable (%s) not set", Environment.PWD.key());
// Note that we use the "appMasterHostname" given by YARN here, to make sure
// we use the hostnames given by YARN consistently throughout akka.
// for akka "localhost" and "localhost.localdomain" are different actors.
final String appMasterHostname = ENV.get(Environment.NM_HOST.key());
require(appMasterHostname != null,
"ApplicationMaster hostname variable %s not set", Environment.NM_HOST.key());
LOG.info("YARN assigned hostname for application master: {}", appMasterHostname);
final String remoteKeytabPrincipal = ENV.get(YarnConfigKeys.KEYTAB_PRINCIPAL);
File f = new File(currDir, Utils.KEYTAB_FILE_NAME);
if (remoteKeytabPrincipal != null && f.exists()) {
String keytabPath = f.getAbsolutePath();
LOG.debug("keytabPath: {}", keytabPath);
config.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, keytabPath);
config.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL, remoteKeytabPrincipal);
}
// Hadoop/Yarn configuration (loads config data automatically from classpath files)
final YarnConfiguration yarnConfig = new YarnConfiguration();
final int taskManagerContainerMemory;
final int numInitialTaskManagers;
final int slotsPerTaskManager;
try {
taskManagerContainerMemory = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_TM_MEMORY));
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid value for " + YarnConfigKeys.ENV_TM_MEMORY + " : "
+ e.getMessage());
}
try {
numInitialTaskManagers = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_TM_COUNT));
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid value for " + YarnConfigKeys.ENV_TM_COUNT + " : "
+ e.getMessage());
}
try {
slotsPerTaskManager = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_SLOTS));
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid value for " + YarnConfigKeys.ENV_SLOTS + " : "
+ e.getMessage());
}
final ContaineredTaskManagerParameters taskManagerParameters =
ContaineredTaskManagerParameters.create(config, taskManagerContainerMemory, slotsPerTaskManager);
LOG.info("TaskManagers will be created with {} task slots", taskManagerParameters.numSlots());
LOG.info("TaskManagers will be started with container size {} MB, JVM heap size {} MB, " +
"JVM direct memory limit {} MB",
taskManagerParameters.taskManagerTotalMemoryMB(),
taskManagerParameters.taskManagerHeapSizeMB(),
taskManagerParameters.taskManagerDirectMemoryLimitMB());
// ----------------- (2) start the actor system -------------------
// try to start the actor system, JobManager and JobManager actor system
// using the port range definition from the config.
final String amPortRange = config.getString(
YarnConfigOptions.APPLICATION_MASTER_PORT);
actorSystem = BootstrapTools.startActorSystem(config, appMasterHostname, amPortRange, LOG);
final String akkaHostname = AkkaUtils.getAddress(actorSystem).host().get();
final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get();
LOG.info("Actor system bound to hostname {}.", akkaHostname);
// ---- (3) Generate the configuration for the TaskManagers
final Configuration taskManagerConfig = BootstrapTools.generateTaskManagerConfiguration(
config, akkaHostname, akkaPort, slotsPerTaskManager, TASKMANAGER_REGISTRATION_TIMEOUT);
LOG.debug("TaskManager configuration: {}", taskManagerConfig);
final ContainerLaunchContext taskManagerContext = Utils.createTaskExecutorContext(
config, yarnConfig, ENV,
taskManagerParameters, taskManagerConfig,
currDir, getTaskManagerClass(), LOG);
// ---- (4) start the actors and components in this order:
// 1) JobManager & Archive (in non-HA case, the leader service takes this)
// 2) Web Monitor (we need its port to register)
// 3) Resource Master for YARN
// 4) Process reapers for the JobManager and Resource Master
// 0: Start the JobManager services
// update the configuration used to create the high availability services
config.setString(JobManagerOptions.ADDRESS, akkaHostname);
config.setInteger(JobManagerOptions.PORT, akkaPort);
highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices(
config,
ioExecutor,
HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
// 1: the web monitor
LOG.debug("Starting Web Frontend");
Time webMonitorTimeout = Time.milliseconds(config.getLong(WebOptions.TIMEOUT));
webMonitor = BootstrapTools.startWebMonitorIfConfigured(
config,
highAvailabilityServices,
new AkkaJobManagerRetriever(actorSystem, webMonitorTimeout, 10, Time.milliseconds(50L)),
new AkkaQueryServiceRetriever(actorSystem, webMonitorTimeout),
webMonitorTimeout,
new ScheduledExecutorServiceAdapter(futureExecutor),
LOG);
metricRegistry = new MetricRegistryImpl(
MetricRegistryConfiguration.fromConfiguration(config));
metricRegistry.startQueryService(actorSystem, null);
// 2: the JobManager
LOG.debug("Starting JobManager actor");
// we start the JobManager with its standard name
ActorRef jobManager = JobManager.startJobManagerActors(
config,
actorSystem,
futureExecutor,
ioExecutor,
highAvailabilityServices,
metricRegistry,
webMonitor == null ? Option.empty() : Option.apply(webMonitor.getRestAddress()),
new Some<>(JobMaster.JOB_MANAGER_NAME),
Option.<String>empty(),
getJobManagerClass(),
getArchivistClass())._1();
final String webMonitorURL = webMonitor == null ? null : webMonitor.getRestAddress();
// 3: Flink's Yarn ResourceManager
LOG.debug("Starting YARN Flink Resource Manager");
Props resourceMasterProps = YarnFlinkResourceManager.createActorProps(
getResourceManagerClass(),
config,
yarnConfig,
highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID),
appMasterHostname,
webMonitorURL,
taskManagerParameters,
taskManagerContext,
numInitialTaskManagers,
LOG);
ActorRef resourceMaster = actorSystem.actorOf(resourceMasterProps);
// 4: Process reapers
// The process reapers ensure that upon unexpected actor death, the process exits
// and does not stay lingering around unresponsive
LOG.debug("Starting process reapers for JobManager and YARN Application Master");
actorSystem.actorOf(
Props.create(ProcessReaper.class, resourceMaster, LOG, ACTOR_DIED_EXIT_CODE),
"YARN_Resource_Master_Process_Reaper");
actorSystem.actorOf(
Props.create(ProcessReaper.class, jobManager, LOG, ACTOR_DIED_EXIT_CODE),
"JobManager_Process_Reaper");
}
catch (Throwable t) {
// make sure that everything whatever ends up in the log
LOG.error("YARN Application Master initialization failed", t);
if (webMonitor != null) {
try {
webMonitor.stop();
} catch (Throwable ignored) {
LOG.warn("Failed to stop the web frontend", t);
}
} | int function(Configuration config) { ActorSystem actorSystem = null; WebMonitor webMonitor = null; HighAvailabilityServices highAvailabilityServices = null; MetricRegistryImpl metricRegistry = null; int numberProcessors = Hardware.getNumberCPUCores(); final ScheduledExecutorService futureExecutor = Executors.newScheduledThreadPool( numberProcessors, new ExecutorThreadFactory(STR)); final ExecutorService ioExecutor = Executors.newFixedThreadPool( numberProcessors, new ExecutorThreadFactory(STR)); try { final String currDir = ENV.get(Environment.PWD.key()); require(currDir != null, STR, Environment.PWD.key()); final String appMasterHostname = ENV.get(Environment.NM_HOST.key()); require(appMasterHostname != null, STR, Environment.NM_HOST.key()); LOG.info(STR, appMasterHostname); final String remoteKeytabPrincipal = ENV.get(YarnConfigKeys.KEYTAB_PRINCIPAL); File f = new File(currDir, Utils.KEYTAB_FILE_NAME); if (remoteKeytabPrincipal != null && f.exists()) { String keytabPath = f.getAbsolutePath(); LOG.debug(STR, keytabPath); config.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, keytabPath); config.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL, remoteKeytabPrincipal); } final YarnConfiguration yarnConfig = new YarnConfiguration(); final int taskManagerContainerMemory; final int numInitialTaskManagers; final int slotsPerTaskManager; try { taskManagerContainerMemory = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_TM_MEMORY)); } catch (NumberFormatException e) { throw new RuntimeException(STR + YarnConfigKeys.ENV_TM_MEMORY + STR + e.getMessage()); } try { numInitialTaskManagers = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_TM_COUNT)); } catch (NumberFormatException e) { throw new RuntimeException(STR + YarnConfigKeys.ENV_TM_COUNT + STR + e.getMessage()); } try { slotsPerTaskManager = Integer.parseInt(ENV.get(YarnConfigKeys.ENV_SLOTS)); } catch (NumberFormatException e) { throw new RuntimeException(STR + YarnConfigKeys.ENV_SLOTS + STR + e.getMessage()); } final ContaineredTaskManagerParameters taskManagerParameters = ContaineredTaskManagerParameters.create(config, taskManagerContainerMemory, slotsPerTaskManager); LOG.info(STR, taskManagerParameters.numSlots()); LOG.info(STR + STR, taskManagerParameters.taskManagerTotalMemoryMB(), taskManagerParameters.taskManagerHeapSizeMB(), taskManagerParameters.taskManagerDirectMemoryLimitMB()); final String amPortRange = config.getString( YarnConfigOptions.APPLICATION_MASTER_PORT); actorSystem = BootstrapTools.startActorSystem(config, appMasterHostname, amPortRange, LOG); final String akkaHostname = AkkaUtils.getAddress(actorSystem).host().get(); final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get(); LOG.info(STR, akkaHostname); final Configuration taskManagerConfig = BootstrapTools.generateTaskManagerConfiguration( config, akkaHostname, akkaPort, slotsPerTaskManager, TASKMANAGER_REGISTRATION_TIMEOUT); LOG.debug(STR, taskManagerConfig); final ContainerLaunchContext taskManagerContext = Utils.createTaskExecutorContext( config, yarnConfig, ENV, taskManagerParameters, taskManagerConfig, currDir, getTaskManagerClass(), LOG); config.setString(JobManagerOptions.ADDRESS, akkaHostname); config.setInteger(JobManagerOptions.PORT, akkaPort); highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices( config, ioExecutor, HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION); LOG.debug(STR); Time webMonitorTimeout = Time.milliseconds(config.getLong(WebOptions.TIMEOUT)); webMonitor = BootstrapTools.startWebMonitorIfConfigured( config, highAvailabilityServices, new AkkaJobManagerRetriever(actorSystem, webMonitorTimeout, 10, Time.milliseconds(50L)), new AkkaQueryServiceRetriever(actorSystem, webMonitorTimeout), webMonitorTimeout, new ScheduledExecutorServiceAdapter(futureExecutor), LOG); metricRegistry = new MetricRegistryImpl( MetricRegistryConfiguration.fromConfiguration(config)); metricRegistry.startQueryService(actorSystem, null); LOG.debug(STR); ActorRef jobManager = JobManager.startJobManagerActors( config, actorSystem, futureExecutor, ioExecutor, highAvailabilityServices, metricRegistry, webMonitor == null ? Option.empty() : Option.apply(webMonitor.getRestAddress()), new Some<>(JobMaster.JOB_MANAGER_NAME), Option.<String>empty(), getJobManagerClass(), getArchivistClass())._1(); final String webMonitorURL = webMonitor == null ? null : webMonitor.getRestAddress(); LOG.debug(STR); Props resourceMasterProps = YarnFlinkResourceManager.createActorProps( getResourceManagerClass(), config, yarnConfig, highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID), appMasterHostname, webMonitorURL, taskManagerParameters, taskManagerContext, numInitialTaskManagers, LOG); ActorRef resourceMaster = actorSystem.actorOf(resourceMasterProps); LOG.debug(STR); actorSystem.actorOf( Props.create(ProcessReaper.class, resourceMaster, LOG, ACTOR_DIED_EXIT_CODE), STR); actorSystem.actorOf( Props.create(ProcessReaper.class, jobManager, LOG, ACTOR_DIED_EXIT_CODE), STR); } catch (Throwable t) { LOG.error(STR, t); if (webMonitor != null) { try { webMonitor.stop(); } catch (Throwable ignored) { LOG.warn(STR, t); } } | /**
* The main work method, must run as a privileged action.
*
* @return The return code for the Java process.
*/ | The main work method, must run as a privileged action | runApplicationMaster | {
"repo_name": "mylog00/flink",
"path": "flink-yarn/src/main/java/org/apache/flink/yarn/YarnApplicationMasterRunner.java",
"license": "apache-2.0",
"size": 21335
} | [
"java.io.File",
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Executors",
"java.util.concurrent.ScheduledExecutorService",
"org.apache.flink.api.common.time.Time",
"org.apache.flink.configuration.Configuration",
"org.apache.flink.configuration.JobManagerOptions",
"org.apache.flink.configuration.SecurityOptions",
"org.apache.flink.configuration.WebOptions",
"org.apache.flink.runtime.akka.AkkaUtils",
"org.apache.flink.runtime.clusterframework.BootstrapTools",
"org.apache.flink.runtime.clusterframework.ContaineredTaskManagerParameters",
"org.apache.flink.runtime.concurrent.ScheduledExecutorServiceAdapter",
"org.apache.flink.runtime.highavailability.HighAvailabilityServices",
"org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils",
"org.apache.flink.runtime.jobmanager.JobManager",
"org.apache.flink.runtime.jobmaster.JobMaster",
"org.apache.flink.runtime.metrics.MetricRegistryConfiguration",
"org.apache.flink.runtime.metrics.MetricRegistryImpl",
"org.apache.flink.runtime.process.ProcessReaper",
"org.apache.flink.runtime.util.ExecutorThreadFactory",
"org.apache.flink.runtime.util.Hardware",
"org.apache.flink.runtime.webmonitor.WebMonitor",
"org.apache.flink.runtime.webmonitor.retriever.impl.AkkaJobManagerRetriever",
"org.apache.flink.runtime.webmonitor.retriever.impl.AkkaQueryServiceRetriever",
"org.apache.flink.yarn.Utils",
"org.apache.flink.yarn.configuration.YarnConfigOptions",
"org.apache.hadoop.yarn.api.ApplicationConstants",
"org.apache.hadoop.yarn.api.records.ContainerLaunchContext",
"org.apache.hadoop.yarn.conf.YarnConfiguration"
] | import java.io.File; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import org.apache.flink.api.common.time.Time; import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.JobManagerOptions; import org.apache.flink.configuration.SecurityOptions; import org.apache.flink.configuration.WebOptions; import org.apache.flink.runtime.akka.AkkaUtils; import org.apache.flink.runtime.clusterframework.BootstrapTools; import org.apache.flink.runtime.clusterframework.ContaineredTaskManagerParameters; import org.apache.flink.runtime.concurrent.ScheduledExecutorServiceAdapter; import org.apache.flink.runtime.highavailability.HighAvailabilityServices; import org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils; import org.apache.flink.runtime.jobmanager.JobManager; import org.apache.flink.runtime.jobmaster.JobMaster; import org.apache.flink.runtime.metrics.MetricRegistryConfiguration; import org.apache.flink.runtime.metrics.MetricRegistryImpl; import org.apache.flink.runtime.process.ProcessReaper; import org.apache.flink.runtime.util.ExecutorThreadFactory; import org.apache.flink.runtime.util.Hardware; import org.apache.flink.runtime.webmonitor.WebMonitor; import org.apache.flink.runtime.webmonitor.retriever.impl.AkkaJobManagerRetriever; import org.apache.flink.runtime.webmonitor.retriever.impl.AkkaQueryServiceRetriever; import org.apache.flink.yarn.Utils; import org.apache.flink.yarn.configuration.YarnConfigOptions; import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.conf.YarnConfiguration; | import java.io.*; import java.util.concurrent.*; import org.apache.flink.api.common.time.*; import org.apache.flink.configuration.*; import org.apache.flink.runtime.akka.*; import org.apache.flink.runtime.clusterframework.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.highavailability.*; import org.apache.flink.runtime.jobmanager.*; import org.apache.flink.runtime.jobmaster.*; import org.apache.flink.runtime.metrics.*; import org.apache.flink.runtime.process.*; import org.apache.flink.runtime.util.*; import org.apache.flink.runtime.webmonitor.*; import org.apache.flink.runtime.webmonitor.retriever.impl.*; import org.apache.flink.yarn.*; import org.apache.flink.yarn.configuration.*; import org.apache.hadoop.yarn.api.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.conf.*; | [
"java.io",
"java.util",
"org.apache.flink",
"org.apache.hadoop"
] | java.io; java.util; org.apache.flink; org.apache.hadoop; | 2,226,426 |
@Nullable
public static File getExternalCacheDir(Context context) {
return context.getExternalCacheDir();
} | static File function(Context context) { return context.getExternalCacheDir(); } | /**
* Get the external app cache directory.
*
* @param context The context to use
*
* @return The external cache dir
*/ | Get the external app cache directory | getExternalCacheDir | {
"repo_name": "kaaholst/android-squeezer",
"path": "Squeezer/src/main/java/uk/org/ngo/squeezer/util/ImageCache.java",
"license": "apache-2.0",
"size": 23185
} | [
"android.content.Context",
"java.io.File"
] | import android.content.Context; import java.io.File; | import android.content.*; import java.io.*; | [
"android.content",
"java.io"
] | android.content; java.io; | 40,208 |
public static QDataSet rebin( QDataSet lds, QDataSet zds, QDataSet lgrid ) {
return rebin( lds, zds, lgrid, 0 );
}
| static QDataSet function( QDataSet lds, QDataSet zds, QDataSet lgrid ) { return rebin( lds, zds, lgrid, 0 ); } | /**
* rebin the datasets to rank 2 dataset ( time, LShell ), by interpolating along sweeps. This
* dataset has the property "sweeps", which is a dataset that indexes the input datasets.
* @param lds rank 1 dataset of length N
* @param zds rank 1 dataset of length N, indexed along with <tt>lds</tt>
* @param lgrid rank 1 dataset indicating the dim 1 tags for the result dataset.
* @return a rank 2 dataset, with one column per sweep, interpolated to <tt>lgrid</tt>
*/ | rebin the datasets to rank 2 dataset ( time, LShell ), by interpolating along sweeps. This dataset has the property "sweeps", which is a dataset that indexes the input datasets | rebin | {
"repo_name": "autoplot/app",
"path": "QDataSet/src/org/das2/qds/util/LSpec.java",
"license": "gpl-2.0",
"size": 16160
} | [
"org.das2.qds.QDataSet"
] | import org.das2.qds.QDataSet; | import org.das2.qds.*; | [
"org.das2.qds"
] | org.das2.qds; | 1,286,336 |
public File[] getSelectedFiles() {
File[] files = super.getSelectedFiles();
if (files.length == 1) {
files[0] = checkForDuplicateEntry(files[0]);
}
return this.convertToRelativeFiles(files);
}
| File[] function() { File[] files = super.getSelectedFiles(); if (files.length == 1) { files[0] = checkForDuplicateEntry(files[0]); } return this.convertToRelativeFiles(files); } | /**
* override to make the selected files relative if appropriate
*/ | override to make the selected files relative if appropriate | getSelectedFiles | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "utils/eclipselink.utils.workbench/framework/source/org/eclipse/persistence/tools/workbench/framework/uitools/FileChooser.java",
"license": "epl-1.0",
"size": 8975
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,657,210 |
public Vector2 stageToScreenCoordinates (Vector2 stageCoords) {
camera.project(cameraCoords.set(stageCoords.x, stageCoords.y, 0), viewportX, viewportY, viewportWidth, viewportHeight);
stageCoords.x = cameraCoords.x;
stageCoords.y = viewportHeight - cameraCoords.y;
return stageCoords;
}
| Vector2 function (Vector2 stageCoords) { camera.project(cameraCoords.set(stageCoords.x, stageCoords.y, 0), viewportX, viewportY, viewportWidth, viewportHeight); stageCoords.x = cameraCoords.x; stageCoords.y = viewportHeight - cameraCoords.y; return stageCoords; } | /** Transforms the stage coordinates to screen coordinates.
* @param stageCoords Input stage coordinates and output for resulting screen coordinates. */ | Transforms the stage coordinates to screen coordinates | stageToScreenCoordinates | {
"repo_name": "ryoenji/libgdx",
"path": "gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java",
"license": "apache-2.0",
"size": 29625
} | [
"com.badlogic.gdx.math.Vector2"
] | import com.badlogic.gdx.math.Vector2; | import com.badlogic.gdx.math.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 803,672 |
@FXML
private void handleOpen() {
FileChooser fileChooser = new FileChooser();
// Set extension filter
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(
"XML files (*.xml)", "*.xml");
fileChooser.getExtensionFilters().add(extFilter);
// Show save file dialog
File file = fileChooser.showOpenDialog(mainApp.getPrimaryStage());
if (file != null) {
mainApp.loadkindDataFromFile(file);
}
}
| void function() { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter( STR, "*.xml"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showOpenDialog(mainApp.getPrimaryStage()); if (file != null) { mainApp.loadkindDataFromFile(file); } } | /**
* Opens a FileChooser to let the user select an address book to load.
*/ | Opens a FileChooser to let the user select an address book to load | handleOpen | {
"repo_name": "wayne70211/FluidDynamicTools",
"path": "RootLayoutControl.java",
"license": "epl-1.0",
"size": 3369
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,073,487 |
public Correlation correlation() {
return this.correlation;
} | Correlation function() { return this.correlation; } | /**
* Get the run correlation.
*
* @return the correlation value
*/ | Get the run correlation | correlation | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/logic/mgmt-v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggerHistoryInner.java",
"license": "mit",
"size": 5883
} | [
"com.microsoft.azure.management.logic.v2016_06_01.Correlation"
] | import com.microsoft.azure.management.logic.v2016_06_01.Correlation; | import com.microsoft.azure.management.logic.v2016_06_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,329,167 |
@Override
public void close() throws IOException {
try {
in.close();
} catch (IOException e) {
handleIOException(e);
}
} | void function() throws IOException { try { in.close(); } catch (IOException e) { handleIOException(e); } } | /**
* Invokes the delegate's <code>close()</code> method.
* @throws IOException if an I/O error occurs
*/ | Invokes the delegate's <code>close()</code> method | close | {
"repo_name": "sebastiansemmle/acio",
"path": "src/main/java/org/apache/commons/io/input/ProxyReader.java",
"license": "apache-2.0",
"size": 8345
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,763,137 |
private void renderRhs(final RuleModel model) {
for ( int i = 0; i < model.rhs.length; i++ ) {
DirtyableVerticalPane widget = new DirtyableVerticalPane();
widget.setWidth( "100%" );
IAction action = model.rhs[i];
//if lockRHS() set the widget RO, otherwise let them decide.
Boolean readOnly = this.lockRHS() ? true : null;
RuleModellerWidget w = getWidgetFactory().getWidget( this,
action,
readOnly );
w.addOnModifiedCommand( this.onWidgetModifiedCommand );
w.setWidth( "100%" );
widget.add( spacerWidget() );
DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();
horiz.setWidth( "100%" );
//horiz.setBorderWidth(2);
Image remove = new ImageButton( images.deleteItemSmall() );
remove.setTitle( constants.RemoveThisAction() );
final int idx = i;
remove.addClickHandler( new ClickHandler() { | void function(final RuleModel model) { for ( int i = 0; i < model.rhs.length; i++ ) { DirtyableVerticalPane widget = new DirtyableVerticalPane(); widget.setWidth( "100%" ); IAction action = model.rhs[i]; Boolean readOnly = this.lockRHS() ? true : null; RuleModellerWidget w = getWidgetFactory().getWidget( this, action, readOnly ); w.addOnModifiedCommand( this.onWidgetModifiedCommand ); w.setWidth( "100%" ); widget.add( spacerWidget() ); DirtyableHorizontalPane horiz = new DirtyableHorizontalPane(); horiz.setWidth( "100%" ); Image remove = new ImageButton( images.deleteItemSmall() ); remove.setTitle( constants.RemoveThisAction() ); final int idx = i; remove.addClickHandler( new ClickHandler() { | /**
* Do all the widgets for the RHS.
*/ | Do all the widgets for the RHS | renderRhs | {
"repo_name": "Rikkola/guvnor",
"path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/modeldriven/ui/RuleModeller.java",
"license": "apache-2.0",
"size": 55355
} | [
"com.google.gwt.event.dom.client.ClickHandler",
"com.google.gwt.user.client.ui.Image",
"org.drools.guvnor.client.common.DirtyableHorizontalPane",
"org.drools.guvnor.client.common.DirtyableVerticalPane",
"org.drools.guvnor.client.common.ImageButton",
"org.drools.ide.common.client.modeldriven.brl.IAction",
"org.drools.ide.common.client.modeldriven.brl.RuleModel"
] | import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Image; import org.drools.guvnor.client.common.DirtyableHorizontalPane; import org.drools.guvnor.client.common.DirtyableVerticalPane; import org.drools.guvnor.client.common.ImageButton; import org.drools.ide.common.client.modeldriven.brl.IAction; import org.drools.ide.common.client.modeldriven.brl.RuleModel; | import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; import org.drools.guvnor.client.common.*; import org.drools.ide.common.client.modeldriven.brl.*; | [
"com.google.gwt",
"org.drools.guvnor",
"org.drools.ide"
] | com.google.gwt; org.drools.guvnor; org.drools.ide; | 2,088,663 |
@OnTimerMethodAnnotation("cleanExpiredUsersSessions")
public final void cleanExpiredUsersSessions() {
Map<String, Map<String, Object>> map = getInstance().deleteOldGeneration();
if (map != null && !map.isEmpty()) {
Map<String, Guid> userSessionMap = new HashMap<String, Guid>();
for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) {
VdcUser user = (VdcUser) entry.getValue().get("VdcUser");
if (user != null) {
userSessionMap.put(entry.getKey(), user.getUserId());
}
}
if (!userSessionMap.isEmpty()) {
DbFacade.getInstance().getDbUserDAO().removeUserSessions(userSessionMap);
}
}
} | @OnTimerMethodAnnotation(STR) final void function() { Map<String, Map<String, Object>> map = getInstance().deleteOldGeneration(); if (map != null && !map.isEmpty()) { Map<String, Guid> userSessionMap = new HashMap<String, Guid>(); for (Map.Entry<String, Map<String, Object>> entry : map.entrySet()) { VdcUser user = (VdcUser) entry.getValue().get(STR); if (user != null) { userSessionMap.put(entry.getKey(), user.getUserId()); } } if (!userSessionMap.isEmpty()) { DbFacade.getInstance().getDbUserDAO().removeUserSessions(userSessionMap); } } } | /**
* Will run the process of cleaning expired sessions. At case when session
* connected to user, it will be also deleted from DB
*/ | Will run the process of cleaning expired sessions. At case when session connected to user, it will be also deleted from DB | cleanExpiredUsersSessions | {
"repo_name": "raksha-rao/gluster-ovirt",
"path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/session/SessionDataContainer.java",
"license": "apache-2.0",
"size": 6193
} | [
"java.util.HashMap",
"java.util.Map",
"org.ovirt.engine.core.common.users.VdcUser",
"org.ovirt.engine.core.compat.Guid",
"org.ovirt.engine.core.dal.dbbroker.DbFacade",
"org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation"
] | import java.util.HashMap; import java.util.Map; import org.ovirt.engine.core.common.users.VdcUser; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.utils.timer.OnTimerMethodAnnotation; | import java.util.*; import org.ovirt.engine.core.common.users.*; import org.ovirt.engine.core.compat.*; import org.ovirt.engine.core.dal.dbbroker.*; import org.ovirt.engine.core.utils.timer.*; | [
"java.util",
"org.ovirt.engine"
] | java.util; org.ovirt.engine; | 632,335 |
public static String getAssetsResourcePath(URL baseURL) {
return getResourcePath(baseURL, "assets", Optional.empty());
} | static String function(URL baseURL) { return getResourcePath(baseURL, STR, Optional.empty()); } | /**
* Returns the asset resource path.
*
* @param baseURL
* the base URL of the REST API server e.g. http://localhost:8080/omakase
* @return the asset resource path.
*/ | Returns the asset resource path | getAssetsResourcePath | {
"repo_name": "projectomakase/omakase",
"path": "omakase/src/it/java/org/projectomakase/omakase/RestIntegrationTests.java",
"license": "apache-2.0",
"size": 30644
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,978,855 |
public void testGeneral() {
DefaultHeatMapDataset d = new DefaultHeatMapDataset(10, 5, 0.0, 9.0,
0.0, 5.0);
assertEquals(10, d.getXSampleCount());
assertEquals(5, d.getYSampleCount());
assertEquals(0.0, d.getMinimumXValue(), EPSILON);
assertEquals(9.0, d.getMaximumXValue(), EPSILON);
assertEquals(0.0, d.getMinimumYValue(), EPSILON);
assertEquals(5.0, d.getMaximumYValue(), EPSILON);
assertEquals(0.0, d.getZValue(0, 0), EPSILON);
d.addChangeListener(this);
d.setZValue(0, 0, 1.0, false);
assertEquals(1.0, d.getZValue(0, 0), EPSILON);
assertNull(this.lastEvent);
d.setZValue(1, 2, 2.0);
assertEquals(2.0, d.getZValue(1, 2), EPSILON);
assertNotNull(this.lastEvent);
} | void function() { DefaultHeatMapDataset d = new DefaultHeatMapDataset(10, 5, 0.0, 9.0, 0.0, 5.0); assertEquals(10, d.getXSampleCount()); assertEquals(5, d.getYSampleCount()); assertEquals(0.0, d.getMinimumXValue(), EPSILON); assertEquals(9.0, d.getMaximumXValue(), EPSILON); assertEquals(0.0, d.getMinimumYValue(), EPSILON); assertEquals(5.0, d.getMaximumYValue(), EPSILON); assertEquals(0.0, d.getZValue(0, 0), EPSILON); d.addChangeListener(this); d.setZValue(0, 0, 1.0, false); assertEquals(1.0, d.getZValue(0, 0), EPSILON); assertNull(this.lastEvent); d.setZValue(1, 2, 2.0); assertEquals(2.0, d.getZValue(1, 2), EPSILON); assertNotNull(this.lastEvent); } | /**
* Some general tests.
*/ | Some general tests | testGeneral | {
"repo_name": "apetresc/JFreeChart",
"path": "src/test/java/org/jfree/data/general/junit/DefaultHeatMapDatasetTests.java",
"license": "lgpl-2.1",
"size": 8069
} | [
"org.jfree.data.general.DefaultHeatMapDataset"
] | import org.jfree.data.general.DefaultHeatMapDataset; | import org.jfree.data.general.*; | [
"org.jfree.data"
] | org.jfree.data; | 39,742 |
private static Icon createIcon(String path)
{
URL location = IconManager.class.getResource(path);
ImageIcon icon = null;
if (location != null)
icon = new ImageIcon(location);
return icon;
} | static Icon function(String path) { URL location = IconManager.class.getResource(path); ImageIcon icon = null; if (location != null) icon = new ImageIcon(location); return icon; } | /**
* Utility factory method to create an icon from a file.
*
* @param path The path of the icon file relative to this class.
* @return An instance of {@link javax.swing.Icon Icon} or
* <code>null</code> if the path was invalid.
*/ | Utility factory method to create an icon from a file | createIcon | {
"repo_name": "knabar/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/IconManager.java",
"license": "gpl-2.0",
"size": 34286
} | [
"javax.swing.Icon",
"javax.swing.ImageIcon"
] | import javax.swing.Icon; import javax.swing.ImageIcon; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,579,450 |
public void setDeclaration(Advertisment declaration) {
this.declaration = declaration;
} | void function(Advertisment declaration) { this.declaration = declaration; } | /**
* Sets the declaration.
*
* @param declaration the new declaration
*/ | Sets the declaration | setDeclaration | {
"repo_name": "valmas/ideal-house-dbms",
"path": "src/main/java/com/ntua/db/beans/AdvertismentBean.java",
"license": "apache-2.0",
"size": 11714
} | [
"com.ntua.db.jpa.Advertisment"
] | import com.ntua.db.jpa.Advertisment; | import com.ntua.db.jpa.*; | [
"com.ntua.db"
] | com.ntua.db; | 979,141 |
private void onOpenClicked(@NotNull Notification notification) {
notification.setState(READ);
Notification.OpenNotificationHandler openHandler = notification.getOpenHandler();
if (openHandler != null) {
openHandler.onOpenClicked();
} else {
dialogFactory.createMessageDialog(notification.getType().toString(),
DATA_FORMAT.format(notification.getTime()) + " " + notification.getMessage(), null).show();
}
} | void function(@NotNull Notification notification) { notification.setState(READ); Notification.OpenNotificationHandler openHandler = notification.getOpenHandler(); if (openHandler != null) { openHandler.onOpenClicked(); } else { dialogFactory.createMessageDialog(notification.getType().toString(), DATA_FORMAT.format(notification.getTime()) + " " + notification.getMessage(), null).show(); } } | /**
* Performs some actions in response to a user's opening a notification
*
* @param notification
* notification that is opening
*/ | Performs some actions in response to a user's opening a notification | onOpenClicked | {
"repo_name": "codenvy/che-core",
"path": "ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/notification/NotificationManagerImpl.java",
"license": "epl-1.0",
"size": 9288
} | [
"javax.validation.constraints.NotNull",
"org.eclipse.che.ide.api.notification.Notification"
] | import javax.validation.constraints.NotNull; import org.eclipse.che.ide.api.notification.Notification; | import javax.validation.constraints.*; import org.eclipse.che.ide.api.notification.*; | [
"javax.validation",
"org.eclipse.che"
] | javax.validation; org.eclipse.che; | 152,290 |
public static PixelConverter createDialogPixelConverter(Control control) {
Dialog.applyDialogFont(control);
return new PixelConverter(control);
} | static PixelConverter function(Control control) { Dialog.applyDialogFont(control); return new PixelConverter(control); } | /**
* Creates a pixel converter
*
* @param control
*
* @return the created pixel converter
*/ | Creates a pixel converter | createDialogPixelConverter | {
"repo_name": "collaborative-modeling/egit",
"path": "org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/SWTUtils.java",
"license": "epl-1.0",
"size": 15839
} | [
"org.eclipse.jface.dialogs.Dialog",
"org.eclipse.swt.widgets.Control"
] | import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.widgets.Control; | import org.eclipse.jface.dialogs.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.jface; org.eclipse.swt; | 558,913 |
record = false;
// Init keyboard
g910 = (OrionKeyboard)LogitechDevice.getAsLogiDevice(MainViewController.device);
selKeys = new ArrayList<>();
} | record = false; g910 = (OrionKeyboard)LogitechDevice.getAsLogiDevice(MainViewController.device); selKeys = new ArrayList<>(); } | /**
* Initializes the controller class.
*
* @param url
* @param rb
*/ | Initializes the controller class | initialize | {
"repo_name": "Jackjan4/Loginux",
"path": "src/de/janroslan/loginux/views/controller/KeyboardBunchFrameController.java",
"license": "gpl-3.0",
"size": 2760
} | [
"de.janroslan.loginux.devices.LogitechDevice",
"de.janroslan.loginux.devices.OrionKeyboard",
"java.util.ArrayList"
] | import de.janroslan.loginux.devices.LogitechDevice; import de.janroslan.loginux.devices.OrionKeyboard; import java.util.ArrayList; | import de.janroslan.loginux.devices.*; import java.util.*; | [
"de.janroslan.loginux",
"java.util"
] | de.janroslan.loginux; java.util; | 2,256,599 |
public Builder setLinkType(LinkTargetType linkType) {
this.linkType = linkType;
return this;
} | Builder function(LinkTargetType linkType) { this.linkType = linkType; return this; } | /**
* Sets the type of ELF file to be created (.a, .so, .lo, executable). The
* default is {@link LinkTargetType#STATIC_LIBRARY}.
*/ | Sets the type of ELF file to be created (.a, .so, .lo, executable). The default is <code>LinkTargetType#STATIC_LIBRARY</code> | setLinkType | {
"repo_name": "hhclam/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java",
"license": "apache-2.0",
"size": 51985
} | [
"com.google.devtools.build.lib.rules.cpp.Link"
] | import com.google.devtools.build.lib.rules.cpp.Link; | import com.google.devtools.build.lib.rules.cpp.*; | [
"com.google.devtools"
] | com.google.devtools; | 765,243 |
public OvhHlr serviceName_outgoing_id_hlr_GET(String serviceName, Long id) throws IOException {
String qPath = "/sms/{serviceName}/outgoing/{id}/hlr";
StringBuilder sb = path(qPath, serviceName, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhHlr.class);
}
/**
* Get this object properties
*
* REST: GET /sms/{serviceName}/outgoing/{id} | OvhHlr function(String serviceName, Long id) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhHlr.class); } /** * Get this object properties * * REST: GET /sms/{serviceName}/outgoing/{id} | /**
* Get this object properties
*
* REST: GET /sms/{serviceName}/outgoing/{id}/hlr
* @param serviceName [required] The internal name of your SMS offer
* @param id [required] Id of the object
*/ | Get this object properties | serviceName_outgoing_id_hlr_GET | {
"repo_name": "UrielCh/ovh-java-sdk",
"path": "ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java",
"license": "bsd-3-clause",
"size": 76622
} | [
"java.io.IOException",
"net.minidev.ovh.api.sms.OvhHlr"
] | import java.io.IOException; import net.minidev.ovh.api.sms.OvhHlr; | import java.io.*; import net.minidev.ovh.api.sms.*; | [
"java.io",
"net.minidev.ovh"
] | java.io; net.minidev.ovh; | 452,782 |
public static Controller createArtefactCollectWizzardController(final UserRequest ureq, final WindowControl wControl, final OLATResourceable ores,
final String businessPath) {
final PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean("portfolioModule");
final EPArtefactHandler<?> handler = portfolioModule.getArtefactHandler(ores.getResourceableTypeName());
if (portfolioModule.isEnabled() && handler != null && handler.isEnabled()) {
final ArtefactWizzardStepsController artWizzCtrl = new ArtefactWizzardStepsController(ureq, wControl, ores, businessPath);
return artWizzCtrl;
}
return null;
} | static Controller function(final UserRequest ureq, final WindowControl wControl, final OLATResourceable ores, final String businessPath) { final PortfolioModule portfolioModule = (PortfolioModule) CoreSpringFactory.getBean(STR); final EPArtefactHandler<?> handler = portfolioModule.getArtefactHandler(ores.getResourceableTypeName()); if (portfolioModule.isEnabled() && handler != null && handler.isEnabled()) { final ArtefactWizzardStepsController artWizzCtrl = new ArtefactWizzardStepsController(ureq, wControl, ores, businessPath); return artWizzCtrl; } return null; } | /**
* initiate the artefact-collection wizzard, first get link which then is handled by ctrl itself to open the wizzard
*
* @param ureq
* @param wControl
* @param ores the resourcable from which an artefact should be created
* @param subPath
* @param businessPath
* @return
*/ | initiate the artefact-collection wizzard, first get link which then is handled by ctrl itself to open the wizzard | createArtefactCollectWizzardController | {
"repo_name": "RLDevOps/Demo",
"path": "src/main/java/org/olat/portfolio/EPUIFactory.java",
"license": "apache-2.0",
"size": 8082
} | [
"org.olat.core.CoreSpringFactory",
"org.olat.core.gui.UserRequest",
"org.olat.core.gui.control.Controller",
"org.olat.core.gui.control.WindowControl",
"org.olat.core.id.OLATResourceable",
"org.olat.portfolio.ui.artefacts.collect.ArtefactWizzardStepsController"
] | import org.olat.core.CoreSpringFactory; import org.olat.core.gui.UserRequest; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.WindowControl; import org.olat.core.id.OLATResourceable; import org.olat.portfolio.ui.artefacts.collect.ArtefactWizzardStepsController; | import org.olat.core.*; import org.olat.core.gui.*; import org.olat.core.gui.control.*; import org.olat.core.id.*; import org.olat.portfolio.ui.artefacts.collect.*; | [
"org.olat.core",
"org.olat.portfolio"
] | org.olat.core; org.olat.portfolio; | 2,560,655 |
static DockerClientConfigBuilder createDefaultConfigBuilder(Map<String, String> env, Properties systemProperties) {
Properties properties = loadIncludedDockerProperties(systemProperties);
properties = overrideDockerPropertiesWithSettingsFromUserHome(properties, systemProperties);
properties = overrideDockerPropertiesWithEnv(properties, env);
properties = overrideDockerPropertiesWithSystemProperties(properties, systemProperties);
return new DockerClientConfigBuilder().withProperties(properties);
} | static DockerClientConfigBuilder createDefaultConfigBuilder(Map<String, String> env, Properties systemProperties) { Properties properties = loadIncludedDockerProperties(systemProperties); properties = overrideDockerPropertiesWithSettingsFromUserHome(properties, systemProperties); properties = overrideDockerPropertiesWithEnv(properties, env); properties = overrideDockerPropertiesWithSystemProperties(properties, systemProperties); return new DockerClientConfigBuilder().withProperties(properties); } | /**
* Allows you to build the config without system environment interfering for more robust testing
*/ | Allows you to build the config without system environment interfering for more robust testing | createDefaultConfigBuilder | {
"repo_name": "signalfx/docker-java",
"path": "src/main/java/com/github/dockerjava/core/DockerClientConfig.java",
"license": "apache-2.0",
"size": 16500
} | [
"java.util.Map",
"java.util.Properties"
] | import java.util.Map; import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,641,092 |
public Set<Pseudostate> getAllValuesOfsrc(final MultipleInitialTransitionsMatch partialMatch) {
return rawAccumulateAllValuesOfsrc(partialMatch.toArray());
}
| Set<Pseudostate> function(final MultipleInitialTransitionsMatch partialMatch) { return rawAccumulateAllValuesOfsrc(partialMatch.toArray()); } | /**
* Retrieve the set of values that occur in matches for src.
* @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
*
*/ | Retrieve the set of values that occur in matches for src | getAllValuesOfsrc | {
"repo_name": "ELTE-Soft/xUML-RT-Executor",
"path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/MultipleInitialTransitionsMatcher.java",
"license": "epl-1.0",
"size": 16593
} | [
"hu.eltesoft.modelexecution.validation.MultipleInitialTransitionsMatch",
"java.util.Set",
"org.eclipse.uml2.uml.Pseudostate"
] | import hu.eltesoft.modelexecution.validation.MultipleInitialTransitionsMatch; import java.util.Set; import org.eclipse.uml2.uml.Pseudostate; | import hu.eltesoft.modelexecution.validation.*; import java.util.*; import org.eclipse.uml2.uml.*; | [
"hu.eltesoft.modelexecution",
"java.util",
"org.eclipse.uml2"
] | hu.eltesoft.modelexecution; java.util; org.eclipse.uml2; | 114,135 |
public ConnectionContext getConnection(UserGroupInformation ugi,
String nnAddress, Class<?> protocol) throws IOException {
// Check if the manager is shutdown
if (!this.running) {
LOG.error(
"Cannot get a connection to {} because the manager isn't running",
nnAddress);
return null;
}
// Try to get the pool if created
ConnectionPoolId connectionId =
new ConnectionPoolId(ugi, nnAddress, protocol);
ConnectionPool pool = null;
readLock.lock();
try {
pool = this.pools.get(connectionId);
} finally {
readLock.unlock();
}
// Create the pool if not created before
if (pool == null) {
writeLock.lock();
try {
pool = this.pools.get(connectionId);
if (pool == null) {
pool = new ConnectionPool(
this.conf, nnAddress, ugi, this.minSize, this.maxSize, protocol);
this.pools.put(connectionId, pool);
}
} finally {
writeLock.unlock();
}
}
ConnectionContext conn = pool.getConnection();
// Add a new connection to the pool if it wasn't usable
if (conn == null || !conn.isUsable()) {
if (!this.creatorQueue.offer(pool)) {
LOG.error("Cannot add more than {} connections at the same time",
MAX_NEW_CONNECTIONS);
}
}
if (conn != null && conn.isClosed()) {
LOG.error("We got a closed connection from {}", pool);
conn = null;
}
return conn;
} | ConnectionContext function(UserGroupInformation ugi, String nnAddress, Class<?> protocol) throws IOException { if (!this.running) { LOG.error( STR, nnAddress); return null; } ConnectionPoolId connectionId = new ConnectionPoolId(ugi, nnAddress, protocol); ConnectionPool pool = null; readLock.lock(); try { pool = this.pools.get(connectionId); } finally { readLock.unlock(); } if (pool == null) { writeLock.lock(); try { pool = this.pools.get(connectionId); if (pool == null) { pool = new ConnectionPool( this.conf, nnAddress, ugi, this.minSize, this.maxSize, protocol); this.pools.put(connectionId, pool); } } finally { writeLock.unlock(); } } ConnectionContext conn = pool.getConnection(); if (conn == null !conn.isUsable()) { if (!this.creatorQueue.offer(pool)) { LOG.error(STR, MAX_NEW_CONNECTIONS); } } if (conn != null && conn.isClosed()) { LOG.error(STR, pool); conn = null; } return conn; } | /**
* Fetches the next available proxy client in the pool. Each client connection
* is reserved for a single user and cannot be reused until free.
*
* @param ugi User group information.
* @param nnAddress Namenode address for the connection.
* @param protocol Protocol for the connection.
* @return Proxy client to connect to nnId as UGI.
* @throws IOException If the connection cannot be obtained.
*/ | Fetches the next available proxy client in the pool. Each client connection is reserved for a single user and cannot be reused until free | getConnection | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionManager.java",
"license": "apache-2.0",
"size": 13523
} | [
"java.io.IOException",
"org.apache.hadoop.security.UserGroupInformation"
] | import java.io.IOException; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import org.apache.hadoop.security.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,961,897 |
long readUnsignedInt()
throws IOException; | long readUnsignedInt() throws IOException; | /**
* Reads an unsigned 32-bit integer. If necessary, the value gets
* converted from the stream’s {@linkplain #getByteOrder()
* current byte order}.
*
* <p>The {@linkplain #getBitOffset() bit offset} is set to zero
* before any data is read.
*
* @throws EOFException if the input stream ends before all four
* bytes were read.
*
* @throws IOException if some general problem happens with
* accessing data.
*
* @see #readInt()
* @see #readFully(int[], int, int)
*/ | Reads an unsigned 32-bit integer. If necessary, the value gets converted from the stream’s #getByteOrder() current byte order. The #getBitOffset() bit offset is set to zero before any data is read | readUnsignedInt | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/imageio/stream/ImageInputStream.java",
"license": "gpl-2.0",
"size": 18566
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,889,487 |
private void handleCompletedFuture(int index, T value, Throwable throwable) {
if (throwable != null) {
completeExceptionally(throwable);
} else {
results[index] = value;
if (numCompleted.incrementAndGet() == numTotal) {
complete(Arrays.asList(results));
}
}
}
@SuppressWarnings("unchecked")
ResultConjunctFuture(Collection<? extends CompletableFuture<? extends T>> resultFutures) {
this.numTotal = resultFutures.size();
results = (T[]) new Object[numTotal];
if (resultFutures.isEmpty()) {
complete(Collections.emptyList());
} else {
int counter = 0;
for (CompletableFuture<? extends T> future : resultFutures) {
final int index = counter;
counter++;
future.whenComplete(
(value, throwable) -> handleCompletedFuture(index, value, throwable));
}
}
} | void function(int index, T value, Throwable throwable) { if (throwable != null) { completeExceptionally(throwable); } else { results[index] = value; if (numCompleted.incrementAndGet() == numTotal) { complete(Arrays.asList(results)); } } } @SuppressWarnings(STR) ResultConjunctFuture(Collection<? extends CompletableFuture<? extends T>> resultFutures) { this.numTotal = resultFutures.size(); results = (T[]) new Object[numTotal]; if (resultFutures.isEmpty()) { complete(Collections.emptyList()); } else { int counter = 0; for (CompletableFuture<? extends T> future : resultFutures) { final int index = counter; counter++; future.whenComplete( (value, throwable) -> handleCompletedFuture(index, value, throwable)); } } } | /**
* The function that is attached to all futures in the conjunction. Once a future is
* complete, this function tracks the completion or fails the conjunct.
*/ | The function that is attached to all futures in the conjunction. Once a future is complete, this function tracks the completion or fails the conjunct | handleCompletedFuture | {
"repo_name": "kl0u/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java",
"license": "apache-2.0",
"size": 57033
} | [
"java.util.Arrays",
"java.util.Collection",
"java.util.Collections",
"java.util.concurrent.CompletableFuture"
] | import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.concurrent.CompletableFuture; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,400,263 |
@Override
public Map<LocalDate, MultipleCurrencyAmount> visitCashDefinition(final CashDefinition cash) {
ArgumentChecker.notNull(cash, "cash");
if (cash.getNotional() < 0) {
return Collections.emptyMap();
}
final LocalDate endDate = cash.getEndDate().toLocalDate();
return Collections.singletonMap(endDate, MultipleCurrencyAmount.of(cash.getCurrency(), cash.getInterestAmount()));
} | Map<LocalDate, MultipleCurrencyAmount> function(final CashDefinition cash) { ArgumentChecker.notNull(cash, "cash"); if (cash.getNotional() < 0) { return Collections.emptyMap(); } final LocalDate endDate = cash.getEndDate().toLocalDate(); return Collections.singletonMap(endDate, MultipleCurrencyAmount.of(cash.getCurrency(), cash.getInterestAmount())); } | /**
* If the notional is negative (i.e. an amount is to be paid), returns an empty map.
* Otherwise, returns a map containing a single payment date and amount to be received.
* @param cash The cash definition, not null
* @return A map containing the (single) payment date and amount, or an empty map, as appropriate
*/ | If the notional is negative (i.e. an amount is to be paid), returns an empty map. Otherwise, returns a map containing a single payment date and amount to be received | visitCashDefinition | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/instrument/FixedReceiveCashFlowVisitor.java",
"license": "apache-2.0",
"size": 20099
} | [
"com.opengamma.analytics.financial.instrument.cash.CashDefinition",
"com.opengamma.util.ArgumentChecker",
"com.opengamma.util.money.MultipleCurrencyAmount",
"java.util.Collections",
"java.util.Map",
"org.threeten.bp.LocalDate"
] | import com.opengamma.analytics.financial.instrument.cash.CashDefinition; import com.opengamma.util.ArgumentChecker; import com.opengamma.util.money.MultipleCurrencyAmount; import java.util.Collections; import java.util.Map; import org.threeten.bp.LocalDate; | import com.opengamma.analytics.financial.instrument.cash.*; import com.opengamma.util.*; import com.opengamma.util.money.*; import java.util.*; import org.threeten.bp.*; | [
"com.opengamma.analytics",
"com.opengamma.util",
"java.util",
"org.threeten.bp"
] | com.opengamma.analytics; com.opengamma.util; java.util; org.threeten.bp; | 2,691,802 |
public List<Integer> recommendByPrediction(int user) {
List<Integer> result = new ArrayList<Integer>();
// If there are no ratings for the user in the training set,
// there is no point of making a recommendation.
Map<Integer, Set<Rating>> ratings = getDataModel().getRatingsPerUser();
// If we have no ratings...
if (ratings == null || ratings.size() == 0) {
return Collections.emptyList();
}
// Calculate rating predictions for all items we know
Map<Integer, Float> predictions = new HashMap<Integer, Float>();
byte rating = -1;
float pred = Float.NaN;
// Go through all the items
for (Integer item : dataModel.getItems()) {
// check if we have seen the item already
rating = dataModel.getRating(user, item);
if (rating == -1) {
// make a prediction and remember it in case the recommender
// could make one
pred = predictRatingBPR(user, item);
if (!Float.isNaN(pred)) {
predictions.put(item, pred);
}
}
}
predictions = filterElementsByRelevanceThreshold(predictions, user);
predictions = Utilities101.sortByValueDescending(predictions);
for (Integer item : predictions.keySet()) {
result.add(item);
}
return result;
}
| List<Integer> function(int user) { List<Integer> result = new ArrayList<Integer>(); Map<Integer, Set<Rating>> ratings = getDataModel().getRatingsPerUser(); if (ratings == null ratings.size() == 0) { return Collections.emptyList(); } Map<Integer, Float> predictions = new HashMap<Integer, Float>(); byte rating = -1; float pred = Float.NaN; for (Integer item : dataModel.getItems()) { rating = dataModel.getRating(user, item); if (rating == -1) { pred = predictRatingBPR(user, item); if (!Float.isNaN(pred)) { predictions.put(item, pred); } } } predictions = filterElementsByRelevanceThreshold(predictions, user); predictions = Utilities101.sortByValueDescending(predictions); for (Integer item : predictions.keySet()) { result.add(item); } return result; } | /**
* This is similar to AbstractRecommender.recommendItemsByRatingPrediction but uses the internal function
*/ | This is similar to AbstractRecommender.recommendItemsByRatingPrediction but uses the internal function | recommendByPrediction | {
"repo_name": "tknandu/recommender_pilot",
"path": "src/org/recommender101/recommender/extensions/bprmf/BPRMFRecommender.java",
"license": "mit",
"size": 13712
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.recommender101.data.Rating",
"org.recommender101.tools.Utilities101"
] | import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.recommender101.data.Rating; import org.recommender101.tools.Utilities101; | import java.util.*; import org.recommender101.data.*; import org.recommender101.tools.*; | [
"java.util",
"org.recommender101.data",
"org.recommender101.tools"
] | java.util; org.recommender101.data; org.recommender101.tools; | 921,178 |
@Override public void exitRow_items(@NotNull CSSParser.Row_itemsContext ctx) { } | @Override public void exitRow_items(@NotNull CSSParser.Row_itemsContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterRow_items | {
"repo_name": "andra49/CSSGenerator",
"path": "CSSGenerator/src/CSSBaseListener.java",
"license": "mit",
"size": 4957
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 385,974 |
private HttpEngine getResponse() throws IOException {
initHttpEngine();
if (httpEngine.hasResponse()) {
return httpEngine;
}
try {
while (true) {
httpEngine.sendRequest();
httpEngine.readResponse();
Retry retry = processResponseHeaders();
if (retry == Retry.NONE) {
httpEngine.automaticallyReleaseConnectionToPool();
break;
}
String retryMethod = method;
OutputStream requestBody = httpEngine.getRequestBody();
int responseCode = getResponseCode();
if (responseCode == HTTP_MULT_CHOICE || responseCode == HTTP_MOVED_PERM
|| responseCode == HTTP_MOVED_TEMP || responseCode == HTTP_SEE_OTHER) {
retryMethod = HttpEngine.GET;
requestBody = null;
}
if (requestBody != null && !(requestBody instanceof RetryableOutputStream)) {
throw new HttpRetryException("Cannot retry streamed HTTP body",
httpEngine.getResponseCode());
}
if (retry == Retry.DIFFERENT_CONNECTION) {
httpEngine.automaticallyReleaseConnectionToPool();
}
httpEngine.release(true);
httpEngine = newHttpEngine(retryMethod, rawRequestHeaders,
httpEngine.getConnection(), (RetryableOutputStream) requestBody);
}
return httpEngine;
} catch (IOException e) {
httpEngineFailure = e;
throw e;
}
} | HttpEngine function() throws IOException { initHttpEngine(); if (httpEngine.hasResponse()) { return httpEngine; } try { while (true) { httpEngine.sendRequest(); httpEngine.readResponse(); Retry retry = processResponseHeaders(); if (retry == Retry.NONE) { httpEngine.automaticallyReleaseConnectionToPool(); break; } String retryMethod = method; OutputStream requestBody = httpEngine.getRequestBody(); int responseCode = getResponseCode(); if (responseCode == HTTP_MULT_CHOICE responseCode == HTTP_MOVED_PERM responseCode == HTTP_MOVED_TEMP responseCode == HTTP_SEE_OTHER) { retryMethod = HttpEngine.GET; requestBody = null; } if (requestBody != null && !(requestBody instanceof RetryableOutputStream)) { throw new HttpRetryException(STR, httpEngine.getResponseCode()); } if (retry == Retry.DIFFERENT_CONNECTION) { httpEngine.automaticallyReleaseConnectionToPool(); } httpEngine.release(true); httpEngine = newHttpEngine(retryMethod, rawRequestHeaders, httpEngine.getConnection(), (RetryableOutputStream) requestBody); } return httpEngine; } catch (IOException e) { httpEngineFailure = e; throw e; } } | /**
* Aggressively tries to get the final HTTP response, potentially making
* many HTTP requests in the process in order to cope with redirects and
* authentication.
*/ | Aggressively tries to get the final HTTP response, potentially making many HTTP requests in the process in order to cope with redirects and authentication | getResponse | {
"repo_name": "xdajog/samsung_sources_i927",
"path": "libcore/luni/src/main/java/libcore/net/http/HttpURLConnectionImpl.java",
"license": "gpl-2.0",
"size": 17896
} | [
"java.io.IOException",
"java.io.OutputStream",
"java.net.HttpRetryException"
] | import java.io.IOException; import java.io.OutputStream; import java.net.HttpRetryException; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 2,890,815 |
public JComponent getResultingJComponent(FIBView<?, J> view) {
if (view.getComponent().getUseScrollBar()) {
// System.out.println("parent=" +
// view.getTechnologyComponent().getParent());
if (view.getTechnologyComponent().getParent() instanceof JViewport) {
// System.out.println("on retourne la scrollpane deja faite pour "
// + view);
return (JScrollPane) ((JViewport) view.getTechnologyComponent().getParent()).getParent();
}
else {
// System.out.println("on se refait une scrollpane pour " +
// view);
JScrollPane scrolledComponent = new JScrollPane(getJComponent(view.getTechnologyComponent()),
view.getComponent().getVerticalScrollbarPolicy().getPolicy(),
view.getComponent().getHorizontalScrollbarPolicy().getPolicy());
scrolledComponent.setOpaque(false);
scrolledComponent.getViewport().setOpaque(false);
scrolledComponent.setBorder(BorderFactory.createEmptyBorder());
scrolledComponent.revalidate();
return scrolledComponent;
}
}
else {
return getJComponent(view.getTechnologyComponent());
}
} | JComponent function(FIBView<?, J> view) { if (view.getComponent().getUseScrollBar()) { if (view.getTechnologyComponent().getParent() instanceof JViewport) { return (JScrollPane) ((JViewport) view.getTechnologyComponent().getParent()).getParent(); } else { JScrollPane scrolledComponent = new JScrollPane(getJComponent(view.getTechnologyComponent()), view.getComponent().getVerticalScrollbarPolicy().getPolicy(), view.getComponent().getHorizontalScrollbarPolicy().getPolicy()); scrolledComponent.setOpaque(false); scrolledComponent.getViewport().setOpaque(false); scrolledComponent.setBorder(BorderFactory.createEmptyBorder()); scrolledComponent.revalidate(); return scrolledComponent; } } else { return getJComponent(view.getTechnologyComponent()); } } | /**
* Return the effective component to be added to swing hierarchy<br>
* This component may be the same as the one returned by {@link #getJComponent()} (if useScrollBar set to false) or an encapsulation in
* a JScrollPane
*
* @return JComponent
*/ | Return the effective component to be added to swing hierarchy This component may be the same as the one returned by <code>#getJComponent()</code> (if useScrollBar set to false) or an encapsulation in a JScrollPane | getResultingJComponent | {
"repo_name": "openflexo-team/gina",
"path": "gina-swing/src/main/java/org/openflexo/gina/swing/view/SwingRenderingAdapter.java",
"license": "gpl-3.0",
"size": 10086
} | [
"javax.swing.BorderFactory",
"javax.swing.JComponent",
"javax.swing.JScrollPane",
"javax.swing.JViewport",
"org.openflexo.gina.view.FIBView"
] | import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JScrollPane; import javax.swing.JViewport; import org.openflexo.gina.view.FIBView; | import javax.swing.*; import org.openflexo.gina.view.*; | [
"javax.swing",
"org.openflexo.gina"
] | javax.swing; org.openflexo.gina; | 1,301,877 |
private void trackScreenSurface(SurfaceData sd) {
if (!done && sd instanceof D3DWindowSurfaceData) {
synchronized (this) {
if (d3dwSurfaces == null) {
d3dwSurfaces = new ArrayList<D3DWindowSurfaceData>();
}
D3DWindowSurfaceData d3dw = (D3DWindowSurfaceData)sd;
if (!d3dwSurfaces.contains(d3dw)) {
d3dwSurfaces.add(d3dw);
}
}
startUpdateThread();
}
} | void function(SurfaceData sd) { if (!done && sd instanceof D3DWindowSurfaceData) { synchronized (this) { if (d3dwSurfaces == null) { d3dwSurfaces = new ArrayList<D3DWindowSurfaceData>(); } D3DWindowSurfaceData d3dw = (D3DWindowSurfaceData)sd; if (!d3dwSurfaces.contains(d3dw)) { d3dwSurfaces.add(d3dw); } } startUpdateThread(); } } | /**
* Adds a surface to the list of tracked surfaces.
*
* @param d3dw the surface to be added
*/ | Adds a surface to the list of tracked surfaces | trackScreenSurface | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java",
"license": "gpl-2.0",
"size": 22437
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,230,502 |
@Generated(value = "com.sun.tools.xjc.Driver", date = "2015-10-25T05:29:34+06:00", comments = "JAXB RI v2.2.11")
public long getId() {
return id;
} | @Generated(value = STR, date = STR, comments = STR) long function() { return id; } | /**
* Gets the value of the id property.
*
*/ | Gets the value of the id property | getId | {
"repo_name": "kanonirov/lanb-client",
"path": "src/main/java/ru/lanbilling/webservice/wsdl/DelSbssRequestClass.java",
"license": "mit",
"size": 1704
} | [
"javax.annotation.Generated"
] | import javax.annotation.Generated; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 746,491 |
Bukkit.broadcastMessage("IMPORTANT, This server needs a restart!");
Bukkit.getOnlinePlayers().forEach(player -> {
player.sendMessage("Sending you to Lobby_x.");
//Send to lobby
});
core.getComponents().forEach(ServerUtil::unregisterComponent);
Bukkit.getScheduler().runTaskLater(core.getPlugin(), Bukkit::shutdown, 40);
} | Bukkit.broadcastMessage(STR); Bukkit.getOnlinePlayers().forEach(player -> { player.sendMessage(STR); }); core.getComponents().forEach(ServerUtil::unregisterComponent); Bukkit.getScheduler().runTaskLater(core.getPlugin(), Bukkit::shutdown, 40); } | /**
* This is fired when the command is executed.
*
* @param sender Sender of the command
* @param args Command arguments
*/ | This is fired when the command is executed | execute | {
"repo_name": "TeddyDev/MCNetwork",
"path": "Core/src/main/java/me/lukebingham/core/command/StopCommand.java",
"license": "gpl-3.0",
"size": 1471
} | [
"me.lukebingham.core.util.ServerUtil",
"org.bukkit.Bukkit"
] | import me.lukebingham.core.util.ServerUtil; import org.bukkit.Bukkit; | import me.lukebingham.core.util.*; import org.bukkit.*; | [
"me.lukebingham.core",
"org.bukkit"
] | me.lukebingham.core; org.bukkit; | 1,447,143 |
protected void internalClose()
{
try
{
channel.close();
buffer = null;
}
catch (IOException e)
{
throw new FSWriteError(e, getPath());
}
} | void function() { try { channel.close(); buffer = null; } catch (IOException e) { throw new FSWriteError(e, getPath()); } } | /**
* Close the segment file. Do not call from outside this class, use syncAndClose() instead.
*/ | Close the segment file. Do not call from outside this class, use syncAndClose() instead | internalClose | {
"repo_name": "newrelic-forks/cassandra",
"path": "src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java",
"license": "apache-2.0",
"size": 22114
} | [
"java.io.IOException",
"org.apache.cassandra.io.FSWriteError"
] | import java.io.IOException; import org.apache.cassandra.io.FSWriteError; | import java.io.*; import org.apache.cassandra.io.*; | [
"java.io",
"org.apache.cassandra"
] | java.io; org.apache.cassandra; | 828,103 |
@Test
public void testOFAgentRemove() {
expect(mockOFAgentService.agent(eq(NETWORK))).andReturn(OF_AGENT).anyTimes();
replay(mockOFAgentService);
expect(mockOFAgentAdminService.removeAgent(NETWORK)).andReturn(OF_AGENT).anyTimes();
replay(mockOFAgentAdminService);
WebTarget wt = target();
Response response = wt.path("service/ofagent-remove/" + NETWORK.toString())
.request(MediaType.APPLICATION_JSON_TYPE)
.delete();
assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
final JsonObject result = Json.parse(response.readEntity(String.class)).asObject();
assertThat(result.get("networkId").asString(), is(NETWORK.id().toString()));
assertThat(result.get("state").asString(), is(STOPPED.toString()));
verify(mockOFAgentService);
verify(mockOFAgentAdminService);
} | void function() { expect(mockOFAgentService.agent(eq(NETWORK))).andReturn(OF_AGENT).anyTimes(); replay(mockOFAgentService); expect(mockOFAgentAdminService.removeAgent(NETWORK)).andReturn(OF_AGENT).anyTimes(); replay(mockOFAgentAdminService); WebTarget wt = target(); Response response = wt.path(STR + NETWORK.toString()) .request(MediaType.APPLICATION_JSON_TYPE) .delete(); assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK)); final JsonObject result = Json.parse(response.readEntity(String.class)).asObject(); assertThat(result.get(STR).asString(), is(NETWORK.id().toString())); assertThat(result.get("state").asString(), is(STOPPED.toString())); verify(mockOFAgentService); verify(mockOFAgentAdminService); } | /**
* Tests deleting an OFAgent with DELETE.
*/ | Tests deleting an OFAgent with DELETE | testOFAgentRemove | {
"repo_name": "gkatsikas/onos",
"path": "apps/ofagent/src/test/java/org/onosproject/ofagent/rest/OFAgentWebResourceTest.java",
"license": "apache-2.0",
"size": 20970
} | [
"com.eclipsesource.json.Json",
"com.eclipsesource.json.JsonObject",
"java.net.HttpURLConnection",
"javax.ws.rs.client.WebTarget",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.easymock.EasyMock",
"org.hamcrest.Matchers",
"org.junit.Assert",
"org.onosproject.ofagent.api.OFAgent"
] | import com.eclipsesource.json.Json; import com.eclipsesource.json.JsonObject; import java.net.HttpURLConnection; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.easymock.EasyMock; import org.hamcrest.Matchers; import org.junit.Assert; import org.onosproject.ofagent.api.OFAgent; | import com.eclipsesource.json.*; import java.net.*; import javax.ws.rs.client.*; import javax.ws.rs.core.*; import org.easymock.*; import org.hamcrest.*; import org.junit.*; import org.onosproject.ofagent.api.*; | [
"com.eclipsesource.json",
"java.net",
"javax.ws",
"org.easymock",
"org.hamcrest",
"org.junit",
"org.onosproject.ofagent"
] | com.eclipsesource.json; java.net; javax.ws; org.easymock; org.hamcrest; org.junit; org.onosproject.ofagent; | 1,305,600 |
private void validateExpressionRefs() throws QuickFixException {
for (PropertyReference e : expressionRefs) {
String root = e.getRoot();
AuraValueProviderType vpt = AuraValueProviderType.getTypeByPrefix(root);
if (vpt == null) {
// validate that its a foreachs
} else if (vpt == AuraValueProviderType.VIEW) {
if (e.getStem() != null) { // checks for private attributes used in expressions ..
//String stem = e.getStem().toString();
//AttributeDef attr = getAttributeDef(stem);
// FIXME?(GPO) can we check access for attributes here?
}
} else {
AuraContext lc = Aura.getContextService().getCurrentContext();
GlobalValueProvider gvp = lc.getGlobalProviders().get(root);
if (gvp != null && gvp.getValueProviderKey().isGlobal()) {
PropertyReference stem = e.getStem();
if (stem == null) {
throw new InvalidExpressionException("Expression didn't have enough terms: " + e,
e.getLocation());
}
gvp.validate(stem);
}
}
}
} | void function() throws QuickFixException { for (PropertyReference e : expressionRefs) { String root = e.getRoot(); AuraValueProviderType vpt = AuraValueProviderType.getTypeByPrefix(root); if (vpt == null) { } else if (vpt == AuraValueProviderType.VIEW) { if (e.getStem() != null) { } } else { AuraContext lc = Aura.getContextService().getCurrentContext(); GlobalValueProvider gvp = lc.getGlobalProviders().get(root); if (gvp != null && gvp.getValueProviderKey().isGlobal()) { PropertyReference stem = e.getStem(); if (stem == null) { throw new InvalidExpressionException(STR + e, e.getLocation()); } gvp.validate(stem); } } } } | /**
* Does all the validation of the expressions defined in this component
*/ | Does all the validation of the expressions defined in this component | validateExpressionRefs | {
"repo_name": "madmax983/aura",
"path": "aura-impl/src/main/java/org/auraframework/impl/root/component/BaseComponentDefImpl.java",
"license": "apache-2.0",
"size": 74519
} | [
"org.auraframework.Aura",
"org.auraframework.expression.PropertyReference",
"org.auraframework.instance.AuraValueProviderType",
"org.auraframework.instance.GlobalValueProvider",
"org.auraframework.system.AuraContext",
"org.auraframework.throwable.quickfix.InvalidExpressionException",
"org.auraframework.throwable.quickfix.QuickFixException"
] | import org.auraframework.Aura; import org.auraframework.expression.PropertyReference; import org.auraframework.instance.AuraValueProviderType; import org.auraframework.instance.GlobalValueProvider; import org.auraframework.system.AuraContext; import org.auraframework.throwable.quickfix.InvalidExpressionException; import org.auraframework.throwable.quickfix.QuickFixException; | import org.auraframework.*; import org.auraframework.expression.*; import org.auraframework.instance.*; import org.auraframework.system.*; import org.auraframework.throwable.quickfix.*; | [
"org.auraframework",
"org.auraframework.expression",
"org.auraframework.instance",
"org.auraframework.system",
"org.auraframework.throwable"
] | org.auraframework; org.auraframework.expression; org.auraframework.instance; org.auraframework.system; org.auraframework.throwable; | 1,536,244 |
public final void setMinLength(final int minLength) {
Condition.INSTANCE.ensureAtLeast(minLength, 1, "The minimum length must be at least 1");
this.minLength = minLength;
} | final void function(final int minLength) { Condition.INSTANCE.ensureAtLeast(minLength, 1, STR); this.minLength = minLength; } | /**
* Sets the minimum length a text must have.
*
* @param minLength
* The minimum length, which should be set, as an {@link Integer} value. The minimum
* length must be at least 1
*/ | Sets the minimum length a text must have | setMinLength | {
"repo_name": "michael-rapp/AndroidMaterialValidation",
"path": "library/src/main/java/de/mrapp/android/validation/validators/text/MinLengthValidator.java",
"license": "apache-2.0",
"size": 3606
} | [
"de.mrapp.util.Condition"
] | import de.mrapp.util.Condition; | import de.mrapp.util.*; | [
"de.mrapp.util"
] | de.mrapp.util; | 747,682 |
@SideOnly(Side.CLIENT)
public int getTextureByXP()
{
return this.xpValue >= 2477 ? 10 : (this.xpValue >= 1237 ? 9 : (this.xpValue >= 617 ? 8 : (this.xpValue >= 307 ? 7 : (this.xpValue >= 149 ? 6 : (this.xpValue >= 73 ? 5 : (this.xpValue >= 37 ? 4 : (this.xpValue >= 17 ? 3 : (this.xpValue >= 7 ? 2 : (this.xpValue >= 3 ? 1 : 0)))))))));
} | @SideOnly(Side.CLIENT) int function() { return this.xpValue >= 2477 ? 10 : (this.xpValue >= 1237 ? 9 : (this.xpValue >= 617 ? 8 : (this.xpValue >= 307 ? 7 : (this.xpValue >= 149 ? 6 : (this.xpValue >= 73 ? 5 : (this.xpValue >= 37 ? 4 : (this.xpValue >= 17 ? 3 : (this.xpValue >= 7 ? 2 : (this.xpValue >= 3 ? 1 : 0))))))))); } | /**
* Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine
* what texture to use.
*/ | Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine what texture to use | getTextureByXP | {
"repo_name": "tomtomtom09/CampCraft",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/item/EntityXPOrb.java",
"license": "gpl-3.0",
"size": 9159
} | [
"net.minecraftforge.fml.relauncher.Side",
"net.minecraftforge.fml.relauncher.SideOnly"
] | import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; | import net.minecraftforge.fml.relauncher.*; | [
"net.minecraftforge.fml"
] | net.minecraftforge.fml; | 2,346,252 |
public static ThreadPoolExecutor getThreadPoolExecutor(int corePoolSize,
int maxPoolSize, long keepAliveTimeSecs, String threadNamePrefix,
boolean runRejectedExec) {
return getThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTimeSecs,
new SynchronousQueue<>(), threadNamePrefix, runRejectedExec);
} | static ThreadPoolExecutor function(int corePoolSize, int maxPoolSize, long keepAliveTimeSecs, String threadNamePrefix, boolean runRejectedExec) { return getThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTimeSecs, new SynchronousQueue<>(), threadNamePrefix, runRejectedExec); } | /**
* Utility to create a {@link ThreadPoolExecutor}.
*
* @param corePoolSize - min threads in the pool, even if idle
* @param maxPoolSize - max threads in the pool
* @param keepAliveTimeSecs - max seconds beyond which excess idle threads
* will be terminated
* @param threadNamePrefix - name prefix for the pool threads
* @param runRejectedExec - when true, rejected tasks from
* ThreadPoolExecutor are run in the context of calling thread
* @return ThreadPoolExecutor
*/ | Utility to create a <code>ThreadPoolExecutor</code> | getThreadPoolExecutor | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSUtilClient.java",
"license": "apache-2.0",
"size": 39396
} | [
"java.util.concurrent.SynchronousQueue",
"java.util.concurrent.ThreadPoolExecutor"
] | import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,029,242 |
public static ServerLocator createServerLocatorWithoutHA(TransportConfiguration... transportConfigurations) {
return new ServerLocatorImpl(false, transportConfigurations);
} | static ServerLocator function(TransportConfiguration... transportConfigurations) { return new ServerLocatorImpl(false, transportConfigurations); } | /**
* Create a ServerLocator which creates session factories using a static list of transportConfigurations, the ServerLocator is not updated automatically
* as the cluster topology changes, and no HA backup information is propagated to the client
*
* @param transportConfigurations
* @return the ServerLocator
*/ | Create a ServerLocator which creates session factories using a static list of transportConfigurations, the ServerLocator is not updated automatically as the cluster topology changes, and no HA backup information is propagated to the client | createServerLocatorWithoutHA | {
"repo_name": "paulgallagher75/activemq-artemis",
"path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ActiveMQClient.java",
"license": "apache-2.0",
"size": 17476
} | [
"org.apache.activemq.artemis.api.core.TransportConfiguration",
"org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl"
] | import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl; | import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.core.client.impl.*; | [
"org.apache.activemq"
] | org.apache.activemq; | 1,574,466 |
void activateClassAvailableProxyTarget() throws Exception {
Method method = ReflectionHelper.getDeclaredMethod(getClass(), "classAvailable", Class.class);
findClassAvailableProxySetClassAvailableTargetMethod().invoke(null, this, method);
} | void activateClassAvailableProxyTarget() throws Exception { Method method = ReflectionHelper.getDeclaredMethod(getClass(), STR, Class.class); findClassAvailableProxySetClassAvailableTargetMethod().invoke(null, this, method); } | /**
* Activate the {@link #ClassAvailableProxy} by setting ourselves as the
* delegate.
*
* @throws Exception if a reflection error occurred
*/ | Activate the <code>#ClassAvailableProxy</code> by setting ourselves as the delegate | activateClassAvailableProxyTarget | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/MonitoringProxyActivator.java",
"license": "epl-1.0",
"size": 17597
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,397,404 |
public void testJCR_2293() throws RepositoryException, InterruptedException {
final String parentPath = testNode.getPath();
final String folderName = "folder_" + System.currentTimeMillis();
final Session session = getHelper().getReadWriteSession();
final Session session2 = getHelper().getReadOnlySession();
session2.getItem(parentPath); // Don't remove. See JCR-2293.
WaitableEventListener eventListener = new WaitableEventListener() {
private RepositoryException failure;
private boolean done; | void function() throws RepositoryException, InterruptedException { final String parentPath = testNode.getPath(); final String folderName = STR + System.currentTimeMillis(); final Session session = getHelper().getReadWriteSession(); final Session session2 = getHelper().getReadOnlySession(); session2.getItem(parentPath); WaitableEventListener eventListener = new WaitableEventListener() { private RepositoryException failure; private boolean done; | /**
* Check whether an item with the path of an add node event exists.
* Regression test for JCR-2293.
* @throws RepositoryException
* @throws InterruptedException
*/ | Check whether an item with the path of an add node event exists. Regression test for JCR-2293 | testJCR_2293 | {
"repo_name": "Kast0rTr0y/jackrabbit",
"path": "jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/observation/ObservationTest.java",
"license": "apache-2.0",
"size": 4205
} | [
"javax.jcr.RepositoryException",
"javax.jcr.Session"
] | import javax.jcr.RepositoryException; import javax.jcr.Session; | import javax.jcr.*; | [
"javax.jcr"
] | javax.jcr; | 299,112 |
private String readStream( String name, InputStream data ) {
String result = null;
try {
result = IOUtils.toString( data );
} catch ( Exception e ) {
LOG.warn( "An error occurred, while reading the stream for {}: {}", name, e.getMessage() );
}
finally {
IOUtils.closeQuietly( data );
}
return result;
} | String function( String name, InputStream data ) { String result = null; try { result = IOUtils.toString( data ); } catch ( Exception e ) { LOG.warn( STR, name, e.getMessage() ); } finally { IOUtils.closeQuietly( data ); } return result; } | /**
* Reads the given input stream into memory and returns it. The stream is
* closed.
*
* @param name
* the name of the file/object holding the stream.
* @param data
* the input stream to read.
* @return the string that was read out of the stream.
*/ | Reads the given input stream into memory and returns it. The stream is closed | readStream | {
"repo_name": "datascience/c3po",
"path": "c3po-core/src/main/java/com/petpet/c3po/gatherer/FileMetadataStream.java",
"license": "apache-2.0",
"size": 3379
} | [
"java.io.InputStream",
"org.apache.commons.io.IOUtils"
] | import java.io.InputStream; import org.apache.commons.io.IOUtils; | import java.io.*; import org.apache.commons.io.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 2,697,366 |
void isAccountManaged(String email, Callback<Boolean> callback); | void isAccountManaged(String email, Callback<Boolean> callback); | /**
* Verifies if the account is managed. Callback may be called either
* synchronously or asynchronously depending on the availability of the
* result.
* TODO(crbug.com/1002408) Update API to use CoreAccountInfo instead of email
*
* @param email An email of the account.
* @param callback The callback that will receive true if the account is managed, false
* otherwise.
*/ | Verifies if the account is managed. Callback may be called either synchronously or asynchronously depending on the availability of the result. TODO(crbug.com/1002408) Update API to use CoreAccountInfo instead of email | isAccountManaged | {
"repo_name": "scheib/chromium",
"path": "chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/SigninManager.java",
"license": "bsd-3-clause",
"size": 6853
} | [
"org.chromium.base.Callback"
] | import org.chromium.base.Callback; | import org.chromium.base.*; | [
"org.chromium.base"
] | org.chromium.base; | 2,654,664 |
private TextureRegionDrawable createDrawable(Texture texture) {
if (texture == null)
return null;
return new TextureRegionDrawable ( new TextureRegion(texture) );
} | TextureRegionDrawable function(Texture texture) { if (texture == null) return null; return new TextureRegionDrawable ( new TextureRegion(texture) ); } | /**
* Improves testability avoiding erro for null textures.
* @param texture
* @return
*/ | Improves testability avoiding erro for null textures | createDrawable | {
"repo_name": "javierj/nikkylittlequest",
"path": "src/org/iwt2/nikky/util/CombactObjectFactory.java",
"license": "apache-2.0",
"size": 2349
} | [
"com.badlogic.gdx.graphics.Texture",
"com.badlogic.gdx.graphics.g2d.TextureRegion",
"com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable"
] | import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; | import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.graphics.g2d.*; import com.badlogic.gdx.scenes.scene2d.utils.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 1,518,872 |
public IModelComparator getModelComparator()
{
return defaultModelComparator;
} | IModelComparator function() { return defaultModelComparator; } | /**
* Gets the component's current model comparator. Implementations can be used for testing the
* current value of the components model data with the new value that is given.
*
* @return the value defaultModelComparator
*/ | Gets the component's current model comparator. Implementations can be used for testing the current value of the components model data with the new value that is given | getModelComparator | {
"repo_name": "klopfdreh/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/Component.java",
"license": "apache-2.0",
"size": 135583
} | [
"org.apache.wicket.model.IModelComparator"
] | import org.apache.wicket.model.IModelComparator; | import org.apache.wicket.model.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,259,986 |
public static <S extends HasResizedHandlers & HasHandlers> void fire(
S source) {
if (TYPE != null) {
ResizedEvent event = new ResizedEvent();
source.fireEvent(event);
}
} | static <S extends HasResizedHandlers & HasHandlers> void function( S source) { if (TYPE != null) { ResizedEvent event = new ResizedEvent(); source.fireEvent(event); } } | /**
* Fires a open event on all registered handlers in the handler manager.If no
* such handlers exist, this method will do nothing.
*
* @param <S> The event source
* @param source the source of the handlers
*/ | Fires a open event on all registered handlers in the handler manager.If no such handlers exist, this method will do nothing | fire | {
"repo_name": "will-gilbert/SmartGWT-Mobile",
"path": "mobile/src/main/java/com/smartgwt/mobile/client/widgets/events/ResizedEvent.java",
"license": "unlicense",
"size": 2072
} | [
"com.google.gwt.event.shared.HasHandlers"
] | import com.google.gwt.event.shared.HasHandlers; | import com.google.gwt.event.shared.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,514,190 |
private Challenge httpChallenge(final Authorization auth) {
val challenge = locator.find(auth);
acmeChallengeRepository.add(challenge.getToken(), challenge.getAuthorization());
return challenge;
} | Challenge function(final Authorization auth) { val challenge = locator.find(auth); acmeChallengeRepository.add(challenge.getToken(), challenge.getAuthorization()); return challenge; } | /**
* Prepares a HTTP challenge.
* <p>
* The verification of this challenge expects a file with a certain content to be
* reachable at a given path under the domain to be tested.
*
* @param auth {@link Authorization} to find the challenge in
* @return {@link Challenge} to verify
*/ | Prepares a HTTP challenge. The verification of this challenge expects a file with a certain content to be reachable at a given path under the domain to be tested | httpChallenge | {
"repo_name": "rkorn86/cas",
"path": "support/cas-server-support-acme/src/main/java/org/apereo/cas/acme/AcmeCertificateManager.java",
"license": "apache-2.0",
"size": 7563
} | [
"org.shredzone.acme4j.Authorization",
"org.shredzone.acme4j.challenge.Challenge"
] | import org.shredzone.acme4j.Authorization; import org.shredzone.acme4j.challenge.Challenge; | import org.shredzone.acme4j.*; import org.shredzone.acme4j.challenge.*; | [
"org.shredzone.acme4j"
] | org.shredzone.acme4j; | 2,146,772 |
Collection<E> values(); | Collection<E> values(); | /**
* Returns a {@link Collection} view of the values contained in this set.
* The collection is backed by the set, so changes to the set are
* reflected in the collection, and vice-versa.
*
* @return the collection of values.
*/ | Returns a <code>Collection</code> view of the values contained in this set. The collection is backed by the set, so changes to the set are reflected in the collection, and vice-versa | values | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GSet.java",
"license": "apache-2.0",
"size": 3383
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 443,162 |
public void mouseWheelMoved(MouseWheelEvent e) {
double newScale = nc.getScale() * Math.pow(0.8, -e.getWheelRotation());
// New center position so that point under the mouse pointer stays the
// same place as it was before zooming
// You will get the formula by simplifying this expression: newCenter =
// oldCenter + mouseCoordinatesInNewZoom - mouseCoordinatesInOldZoom
// double newX = nc.center.east() - (e.getX() - nc.getWidth()/2.0) *
// (newScale - nc.scale);
// double newY = nc.center.north() + (e.getY() - nc.getHeight()/2.0) *
// (newScale - nc.scale);
// nc.zoomTo(new EastNorth(newX, newY), newScale);
nc.zoomTo(nc.getEastNorth(e.getX(), e.getY()), newScale);
if (nc instanceof ZoomPerformed)
((ZoomPerformed) nc).zoomPerformed();
} | void function(MouseWheelEvent e) { double newScale = nc.getScale() * Math.pow(0.8, -e.getWheelRotation()); nc.zoomTo(nc.getEastNorth(e.getX(), e.getY()), newScale); if (nc instanceof ZoomPerformed) ((ZoomPerformed) nc).zoomPerformed(); } | /**
* Zoom the map by 1/5th of current zoom per wheel-delta.
*
* @param e
* The wheel event.
*/ | Zoom the map by 1/5th of current zoom per wheel-delta | mouseWheelMoved | {
"repo_name": "Emergya/gofleet",
"path": "map_core/src/main/java/org/openstreetmap/josm/gui/MapMover.java",
"license": "gpl-2.0",
"size": 10114
} | [
"es.emergya.ui.plugins.ZoomPerformed",
"java.awt.event.MouseWheelEvent"
] | import es.emergya.ui.plugins.ZoomPerformed; import java.awt.event.MouseWheelEvent; | import es.emergya.ui.plugins.*; import java.awt.event.*; | [
"es.emergya.ui",
"java.awt"
] | es.emergya.ui; java.awt; | 2,390,430 |
public void setPsuedoQDMToMeasure(Button psuedoQDMToMeasure) {
this.psuedoQDMToMeasure = psuedoQDMToMeasure;
}
| void function(Button psuedoQDMToMeasure) { this.psuedoQDMToMeasure = psuedoQDMToMeasure; } | /**
* Sets the psuedo qdm to measure.
*
* @param psuedoQDMToMeasure
* the new psuedo qdm to measure
*/ | Sets the psuedo qdm to measure | setPsuedoQDMToMeasure | {
"repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/mat/client/clause/QDMAvailableValueSetWidget.java",
"license": "apache-2.0",
"size": 33219
} | [
"com.google.gwt.user.client.ui.Button"
] | import com.google.gwt.user.client.ui.Button; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,862,809 |
public Response createDatabase(String user, DatabaseDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
ExecuteException, IOException {
String exec = "create database";
if (desc.ifNotExists)
exec += " if not exists";
exec += " " + desc.database;
if (TempletonUtils.isset(desc.comment))
exec += String.format(" comment '%s'", desc.comment);
if (TempletonUtils.isset(desc.location))
exec += String.format(" location '%s'", desc.location);
if (TempletonUtils.isset(desc.properties))
exec += String.format(" with dbproperties (%s)",
makePropertiesStatement(desc.properties));
exec += ";";
String res = jsonRun(user, exec, desc.group, desc.permissions);
return JsonBuilder.create(res)
.put("database", desc.database)
.build();
} | Response function(String user, DatabaseDesc desc) throws HcatException, NotAuthorizedException, BusyException, ExecuteException, IOException { String exec = STR; if (desc.ifNotExists) exec += STR; exec += " " + desc.database; if (TempletonUtils.isset(desc.comment)) exec += String.format(STR, desc.comment); if (TempletonUtils.isset(desc.location)) exec += String.format(STR, desc.location); if (TempletonUtils.isset(desc.properties)) exec += String.format(STR, makePropertiesStatement(desc.properties)); exec += ";"; String res = jsonRun(user, exec, desc.group, desc.permissions); return JsonBuilder.create(res) .put(STR, desc.database) .build(); } | /**
* Create a database with the given name
*/ | Create a database with the given name | createDatabase | {
"repo_name": "cloudera/hcatalog",
"path": "webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java",
"license": "apache-2.0",
"size": 31761
} | [
"java.io.IOException",
"javax.ws.rs.core.Response",
"org.apache.commons.exec.ExecuteException",
"org.apache.hcatalog.templeton.tool.TempletonUtils"
] | import java.io.IOException; import javax.ws.rs.core.Response; import org.apache.commons.exec.ExecuteException; import org.apache.hcatalog.templeton.tool.TempletonUtils; | import java.io.*; import javax.ws.rs.core.*; import org.apache.commons.exec.*; import org.apache.hcatalog.templeton.tool.*; | [
"java.io",
"javax.ws",
"org.apache.commons",
"org.apache.hcatalog"
] | java.io; javax.ws; org.apache.commons; org.apache.hcatalog; | 2,418,167 |
EList<AreaSpecification> getAreaSpecifications();
| EList<AreaSpecification> getAreaSpecifications(); | /**
* Returns the value of the '<em><b>Area Specifications</b></em>' containment reference list.
* The list contents are of type {@link org.lh.dmlj.schema.AreaSpecification}.
* It is bidirectional and its opposite is '{@link org.lh.dmlj.schema.AreaSpecification#getArea <em>Area</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Area Specifications</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Area Specifications</em>' containment reference list.
* @see org.lh.dmlj.schema.SchemaPackage#getSchemaArea_AreaSpecifications()
* @see org.lh.dmlj.schema.AreaSpecification#getArea
* @model opposite="area" containment="true"
* @generated
*/ | Returns the value of the 'Area Specifications' containment reference list. The list contents are of type <code>org.lh.dmlj.schema.AreaSpecification</code>. It is bidirectional and its opposite is '<code>org.lh.dmlj.schema.AreaSpecification#getArea Area</code>'. If the meaning of the 'Area Specifications' containment reference list isn't clear, there really should be more of a description here... | getAreaSpecifications | {
"repo_name": "kozzeluc/dmlj",
"path": "Eclipse CA IDMS Schema Diagram Editor/bundles/org.lh.dmlj.schema.editor.model/src/org/lh/dmlj/schema/SchemaArea.java",
"license": "gpl-3.0",
"size": 6882
} | [
"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; | 76,640 |
@Override
public void prepareSender() throws LifecycleException {
if (host == null || port == null) {
throw new LifecycleException("Host and port for " + this.getClass().getSimpleName() + " output can't be null");
}
try {
this.dgSocket = new DatagramSocket();
this.address = new InetSocketAddress(host, port);
} catch ( SocketException sockExc ) {
log.error("Failed to create a datagram socket", sockExc);
throw new LifecycleException(sockExc);
}
} | void function() throws LifecycleException { if (host == null port == null) { throw new LifecycleException(STR + this.getClass().getSimpleName() + STR); } try { this.dgSocket = new DatagramSocket(); this.address = new InetSocketAddress(host, port); } catch ( SocketException sockExc ) { log.error(STR, sockExc); throw new LifecycleException(sockExc); } } | /**
* Setup at start of the writer.
*/ | Setup at start of the writer | prepareSender | {
"repo_name": "1and1/jmxtrans",
"path": "src/com/googlecode/jmxtrans/model/output/TCollectorUDPWriter.java",
"license": "mit",
"size": 2550
} | [
"com.googlecode.jmxtrans.util.LifecycleException",
"java.net.DatagramSocket",
"java.net.InetSocketAddress",
"java.net.SocketException"
] | import com.googlecode.jmxtrans.util.LifecycleException; import java.net.DatagramSocket; import java.net.InetSocketAddress; import java.net.SocketException; | import com.googlecode.jmxtrans.util.*; import java.net.*; | [
"com.googlecode.jmxtrans",
"java.net"
] | com.googlecode.jmxtrans; java.net; | 492,835 |
public String getFileManagerDownloadPath(boolean forceDirectoryCreation) {
String pathDownload = "fmDownload_" + this.getProcessID() + File.separator;
String returnPath = this.getFilePathAbsolute(pathDownload);
if (forceDirectoryCreation==true) this.createDirectoryIfRequired(returnPath);
return returnPath;
}
| String function(boolean forceDirectoryCreation) { String pathDownload = STR + this.getProcessID() + File.separator; String returnPath = this.getFilePathAbsolute(pathDownload); if (forceDirectoryCreation==true) this.createDirectoryIfRequired(returnPath); return returnPath; } | /**
* This method returns the folder, where download files, coming from an applications (server.client)
* can be stored locally. If the folder doesn't exists, it will be created.
*
* @param forceDirectoryCreation set true, if the directory should be created
* @return path to the folder, where downloads will be saved ('/AgentGUI/fmDownload[PID]/')
*/ | This method returns the folder, where download files, coming from an applications (server.client) can be stored locally. If the folder doesn't exists, it will be created | getFileManagerDownloadPath | {
"repo_name": "EnFlexIT/AgentWorkbench",
"path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/core/config/GlobalInfo.java",
"license": "lgpl-2.1",
"size": 78561
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 53,466 |
public TreeFileImpl createTreeFile(final URI uri) {
return new TreeFileImpl(nextOid++, uri);
}
| TreeFileImpl function(final URI uri) { return new TreeFileImpl(nextOid++, uri); } | /**
* Create a new tree file with given URI
* @param uri uri
*/ | Create a new tree file with given URI | createTreeFile | {
"repo_name": "willrogers/dawnsci",
"path": "org.eclipse.dawnsci.nexus/src/org/eclipse/dawnsci/nexus/impl/NXobjectFactory.java",
"license": "epl-1.0",
"size": 21644
} | [
"org.eclipse.dawnsci.analysis.tree.impl.TreeFileImpl"
] | import org.eclipse.dawnsci.analysis.tree.impl.TreeFileImpl; | import org.eclipse.dawnsci.analysis.tree.impl.*; | [
"org.eclipse.dawnsci"
] | org.eclipse.dawnsci; | 909,223 |
public static List<Class<?>> getParameterizedType(final Class<?> ownerClass,
Class<?> genericSuperClass) {
Type[] types = null;
if (genericSuperClass.isInterface()) {
types = ownerClass.getGenericInterfaces();
} else {
types = new Type[] { ownerClass.getGenericSuperclass() };
}
final List<Class<?>> classes = new ArrayList<Class<?>>();
for (Type type : types) {
if (!ParameterizedType.class.isAssignableFrom(type.getClass())) {
// the field is it a raw type and does not have generic type
// argument. Return empty list.
return new ArrayList<Class<?>>();
}
final ParameterizedType ptype = (ParameterizedType) type;
final Type[] targs = ptype.getActualTypeArguments();
for (Type aType : targs) {
classes.add(extractClass(ownerClass, aType));
}
}
return classes;
} | static List<Class<?>> function(final Class<?> ownerClass, Class<?> genericSuperClass) { Type[] types = null; if (genericSuperClass.isInterface()) { types = ownerClass.getGenericInterfaces(); } else { types = new Type[] { ownerClass.getGenericSuperclass() }; } final List<Class<?>> classes = new ArrayList<Class<?>>(); for (Type type : types) { if (!ParameterizedType.class.isAssignableFrom(type.getClass())) { return new ArrayList<Class<?>>(); } final ParameterizedType ptype = (ParameterizedType) type; final Type[] targs = ptype.getActualTypeArguments(); for (Type aType : targs) { classes.add(extractClass(ownerClass, aType)); } } return classes; } | /**
* Returns the parameterized type of a class, if exists. Wild cards, type
* variables and raw types will be returned as an empty list.
* <p>
* If a field is of type Set<String> then java.lang.String is returned.
* </p>
* <p>
* If a field is of type Map<String, Integer> then [java.lang.String,
* java.lang.Integer] is returned.
* </p>
*
* @param ownerClass the implementing target class to check against
* @param the generic interface to resolve the type argument from
* @return A list of classes of the parameterized type.
*/ | Returns the parameterized type of a class, if exists. Wild cards, type variables and raw types will be returned as an empty list. If a field is of type Set then java.lang.String is returned. If a field is of type Map then [java.lang.String, java.lang.Integer] is returned. | getParameterizedType | {
"repo_name": "deephacks/tools4j-cli",
"path": "src/main/java/org/deephacks/tools4j/cli/Conversion.java",
"license": "apache-2.0",
"size": 22970
} | [
"java.lang.reflect.ParameterizedType",
"java.lang.reflect.Type",
"java.util.ArrayList",
"java.util.List"
] | import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,648,623 |
@Invisible
@Conversion
public static JavaPath convert(String val) {
JavaPath result;
try {
result = new JavaPath(Path.convert(val));
} catch (VilException e) {
result = null;
}
return result;
} | static JavaPath function(String val) { JavaPath result; try { result = new JavaPath(Path.convert(val)); } catch (VilException e) { result = null; } return result; } | /**
* Conversion operation.
*
* @param val the value to be converted
* @return the converted value
*/ | Conversion operation | convert | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/Instantiation/de.uni_hildesheim.sse.easy.instantiatorCore/src/net/ssehub/easy/instantiation/core/model/artifactModel/JavaPath.java",
"license": "apache-2.0",
"size": 5628
} | [
"net.ssehub.easy.instantiation.core.model.common.VilException"
] | import net.ssehub.easy.instantiation.core.model.common.VilException; | import net.ssehub.easy.instantiation.core.model.common.*; | [
"net.ssehub.easy"
] | net.ssehub.easy; | 176,430 |
private boolean isCompressible() {
// Check if content is not already gzipped
MessageBytes contentEncodingMB =
response.getMimeHeaders().getValue("Content-Encoding");
if ((contentEncodingMB != null)
&& (contentEncodingMB.indexOf("gzip") != -1)) {
return false;
}
// If force mode, always compress (test purposes only)
if (compressionLevel == 2) {
return true;
}
// Check if sufficient length to trigger the compression
long contentLength = response.getContentLengthLong();
if ((contentLength == -1)
|| (contentLength > compressionMinSize)) {
// Check for compatible MIME-TYPE
if (compressableMimeTypes != null) {
return (startsWithStringArray(compressableMimeTypes, response.getContentType()));
}
}
return false;
}
| boolean function() { MessageBytes contentEncodingMB = response.getMimeHeaders().getValue(STR); if ((contentEncodingMB != null) && (contentEncodingMB.indexOf("gzip") != -1)) { return false; } if (compressionLevel == 2) { return true; } long contentLength = response.getContentLengthLong(); if ((contentLength == -1) (contentLength > compressionMinSize)) { if (compressableMimeTypes != null) { return (startsWithStringArray(compressableMimeTypes, response.getContentType())); } } return false; } | /**
* Check if the resource could be compressed, if the client supports it.
*/ | Check if the resource could be compressed, if the client supports it | isCompressible | {
"repo_name": "IAMTJW/Tomcat-8.5.20",
"path": "tomcat-8.5.20/java/org/apache/coyote/http11/Http11Processor.java",
"license": "apache-2.0",
"size": 59665
} | [
"org.apache.tomcat.util.buf.MessageBytes"
] | import org.apache.tomcat.util.buf.MessageBytes; | import org.apache.tomcat.util.buf.*; | [
"org.apache.tomcat"
] | org.apache.tomcat; | 1,830,145 |
EventSyncRequest createEventRequest(Integer requestId); | EventSyncRequest createEventRequest(Integer requestId); | /**
* Creates the Event request.
*
* @param requestId new request id of the SyncRequest.
* @return new Event request.
* @see EventSyncRequest
*/ | Creates the Event request | createEventRequest | {
"repo_name": "sashadidukh/kaa",
"path": "client/client-multi/client-java-core/src/main/java/org/kaaproject/kaa/client/channel/EventTransport.java",
"license": "apache-2.0",
"size": 2005
} | [
"org.kaaproject.kaa.common.endpoint.gen.EventSyncRequest"
] | import org.kaaproject.kaa.common.endpoint.gen.EventSyncRequest; | import org.kaaproject.kaa.common.endpoint.gen.*; | [
"org.kaaproject.kaa"
] | org.kaaproject.kaa; | 521,885 |
boolean canReadCache(TransactionManager xact_mgr); | boolean canReadCache(TransactionManager xact_mgr); | /**
*
* You cannot read from the cache if your txn is behind the state of of the ddl view.
*
* @param xact_mgr
* @return
*/ | You cannot read from the cache if your txn is behind the state of of the ddl view | canReadCache | {
"repo_name": "splicemachine/spliceengine",
"path": "splice_machine/src/main/java/com/splicemachine/derby/ddl/DDLWatcher.java",
"license": "agpl-3.0",
"size": 3575
} | [
"com.splicemachine.db.iapi.store.access.conglomerate.TransactionManager"
] | import com.splicemachine.db.iapi.store.access.conglomerate.TransactionManager; | import com.splicemachine.db.iapi.store.access.conglomerate.*; | [
"com.splicemachine.db"
] | com.splicemachine.db; | 2,703,639 |
public UsageInner withName(UsageName name) {
this.name = name;
return this;
} | UsageInner function(UsageName name) { this.name = name; return this; } | /**
* Set the name of the type of usage.
*
* @param name the name value to set
* @return the UsageInner object itself.
*/ | Set the name of the type of usage | withName | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/UsageInner.java",
"license": "mit",
"size": 3308
} | [
"com.microsoft.azure.management.network.v2019_07_01.UsageName"
] | import com.microsoft.azure.management.network.v2019_07_01.UsageName; | import com.microsoft.azure.management.network.v2019_07_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,126,077 |
public static <T> ProtocolProxy<T> waitForProtocolProxy(Class<T> protocol,
long clientVersion,
InetSocketAddress addr,
Configuration conf) throws IOException {
return waitForProtocolProxy(
protocol, clientVersion, addr, conf, Long.MAX_VALUE);
} | static <T> ProtocolProxy<T> function(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf) throws IOException { return waitForProtocolProxy( protocol, clientVersion, addr, conf, Long.MAX_VALUE); } | /**
* Get a protocol proxy that contains a proxy connection to a remote server
* and a set of methods that are supported by the server
*
* @param protocol protocol class
* @param clientVersion client version
* @param addr remote address
* @param conf configuration to use
* @return the protocol proxy
* @throws IOException if the far end through a RemoteException
*/ | Get a protocol proxy that contains a proxy connection to a remote server and a set of methods that are supported by the server | waitForProtocolProxy | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RPC.java",
"license": "apache-2.0",
"size": 38977
} | [
"java.io.IOException",
"java.net.InetSocketAddress",
"org.apache.hadoop.conf.Configuration"
] | import java.io.IOException; import java.net.InetSocketAddress; import org.apache.hadoop.conf.Configuration; | import java.io.*; import java.net.*; import org.apache.hadoop.conf.*; | [
"java.io",
"java.net",
"org.apache.hadoop"
] | java.io; java.net; org.apache.hadoop; | 1,238,799 |
public static InputStream toInputStream(String input, Charset encoding) {
return new ByteArrayInputStream(input.getBytes(Charsets.toCharset(encoding)));
} | static InputStream function(String input, Charset encoding) { return new ByteArrayInputStream(input.getBytes(Charsets.toCharset(encoding))); } | /**
* Convert the specified string to an input stream, encoded as bytes
* using the specified character encoding.
*
* @param input the string to convert
* @param encoding the encoding to use, null means platform default
* @return an input stream
* @since 2.3
*/ | Convert the specified string to an input stream, encoded as bytes using the specified character encoding | toInputStream | {
"repo_name": "trungnt13/fasta-game",
"path": "TNTEngine/src/org/tntstudio/utils/io/IOUtils.java",
"license": "mit",
"size": 97808
} | [
"java.io.ByteArrayInputStream",
"java.io.InputStream",
"java.nio.charset.Charset"
] | import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.charset.Charset; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,932,937 |
public UserCustomCursor queryForChunk(String[] columns,
BoundingBox boundingBox, Projection projection, String orderBy,
int limit) {
return queryForChunk(false, columns, boundingBox, projection, orderBy,
limit);
} | UserCustomCursor function(String[] columns, BoundingBox boundingBox, Projection projection, String orderBy, int limit) { return queryForChunk(false, columns, boundingBox, projection, orderBy, limit); } | /**
* Query for rows within the bounding box in the provided projection,
* starting at the offset and returning no more than the limit
*
* @param columns columns
* @param boundingBox bounding box
* @param projection projection
* @param orderBy order by
* @param limit chunk limit
* @return cursor
* @since 6.2.0
*/ | Query for rows within the bounding box in the provided projection, starting at the offset and returning no more than the limit | queryForChunk | {
"repo_name": "ngageoint/geopackage-android",
"path": "geopackage-sdk/src/main/java/mil/nga/geopackage/extension/nga/index/FeatureTableIndex.java",
"license": "mit",
"size": 276322
} | [
"mil.nga.geopackage.BoundingBox",
"mil.nga.geopackage.user.custom.UserCustomCursor",
"mil.nga.proj.Projection"
] | import mil.nga.geopackage.BoundingBox; import mil.nga.geopackage.user.custom.UserCustomCursor; import mil.nga.proj.Projection; | import mil.nga.geopackage.*; import mil.nga.geopackage.user.custom.*; import mil.nga.proj.*; | [
"mil.nga.geopackage",
"mil.nga.proj"
] | mil.nga.geopackage; mil.nga.proj; | 347,270 |
private boolean validTypeExpression(Node expr) {
String name = getCallName(expr);
Keywords keyword = nameToKeyword(name);
switch (keyword) {
case TYPE:
return validTemplateTypeExpression(expr);
case UNION:
return validUnionTypeExpression(expr);
case NONE:
return validNoneTypeExpression(expr);
case ALL:
return validAllTypeExpression(expr);
case UNKNOWN:
return validUnknownTypeExpression(expr);
case RAWTYPEOF:
return validRawTypeOfTypeExpression(expr);
case TEMPLATETYPEOF:
return validTemplateTypeOfExpression(expr);
case RECORD:
return validRecordTypeExpression(expr);
case TYPEEXPR:
return validNativeTypeExpr(expr);
default:
throw new IllegalStateException("Invalid type expression");
}
} | boolean function(Node expr) { String name = getCallName(expr); Keywords keyword = nameToKeyword(name); switch (keyword) { case TYPE: return validTemplateTypeExpression(expr); case UNION: return validUnionTypeExpression(expr); case NONE: return validNoneTypeExpression(expr); case ALL: return validAllTypeExpression(expr); case UNKNOWN: return validUnknownTypeExpression(expr); case RAWTYPEOF: return validRawTypeOfTypeExpression(expr); case TEMPLATETYPEOF: return validTemplateTypeOfExpression(expr); case RECORD: return validRecordTypeExpression(expr); case TYPEEXPR: return validNativeTypeExpr(expr); default: throw new IllegalStateException(STR); } } | /**
* A TTL type expression must be a union type, a template type, a record type
* or any of the type predicates (none, rawTypeOf, templateTypeOf).
*/ | A TTL type expression must be a union type, a template type, a record type or any of the type predicates (none, rawTypeOf, templateTypeOf) | validTypeExpression | {
"repo_name": "LorenzoDV/closure-compiler",
"path": "src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java",
"license": "apache-2.0",
"size": 27478
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 581,465 |
public void setPropertyType(PropertyType propertyType) {
this.propertyType = propertyType;
} | void function(PropertyType propertyType) { this.propertyType = propertyType; } | /**
* Missing description at method setPropertyType.
*
* @param propertyType the PropertyType.
*/ | Missing description at method setPropertyType | setPropertyType | {
"repo_name": "NABUCCO/org.nabucco.testautomation",
"path": "org.nabucco.testautomation.facade.message/src/main/gen/org/nabucco/testautomation/facade/message/ProducePropertyMsg.java",
"license": "epl-1.0",
"size": 7702
} | [
"org.nabucco.testautomation.facade.datatype.property.base.PropertyType"
] | import org.nabucco.testautomation.facade.datatype.property.base.PropertyType; | import org.nabucco.testautomation.facade.datatype.property.base.*; | [
"org.nabucco.testautomation"
] | org.nabucco.testautomation; | 9,487 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.