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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
default void checkCanRevokeTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal revokee, boolean grantOption)
{
denyRevokeTablePrivilege(privilege.toString(), tableName.toString());
} | default void checkCanRevokeTablePrivilege(ConnectorSecurityContext context, Privilege privilege, SchemaTableName tableName, TrinoPrincipal revokee, boolean grantOption) { denyRevokeTablePrivilege(privilege.toString(), tableName.toString()); } | /**
* Check if identity is allowed to revoke the specified privilege on the specified table from any user.
*
* @throws io.trino.spi.security.AccessDeniedException if not allowed
*/ | Check if identity is allowed to revoke the specified privilege on the specified table from any user | checkCanRevokeTablePrivilege | {
"repo_name": "ebyhr/presto",
"path": "core/trino-spi/src/main/java/io/trino/spi/connector/ConnectorAccessControl.java",
"license": "apache-2.0",
"size": 24835
} | [
"io.trino.spi.security.AccessDeniedException",
"io.trino.spi.security.Privilege",
"io.trino.spi.security.TrinoPrincipal"
] | import io.trino.spi.security.AccessDeniedException; import io.trino.spi.security.Privilege; import io.trino.spi.security.TrinoPrincipal; | import io.trino.spi.security.*; | [
"io.trino.spi"
] | io.trino.spi; | 2,653,443 |
@SuppressWarnings("unchecked")
private static final <T> T[] mergeAccess(T[] array1, T[] array2, boolean override)
{
if (array1 == null)
{
System.out.println("null !!!");
}
List<T> list = new ArrayList<T>();
for (T po : array1)
{
list.add(po);
}
for (T o2 : array2)
{
boolean found = false;
for (int i = 0; i < array1.length; i++)
{
final T o1 = array1[i];
if (o1 instanceof OrgAccess)
{
final OrgAccess oa1 = (OrgAccess)o1;
final OrgAccess oa2 = (OrgAccess)o2;
found = oa1.equals(oa2);
if (found && override)
{
// stronger permissions first
if (!oa2.readOnly)
oa1.readOnly = false;
}
}
else if (o1 instanceof MTableAccess)
{
final MTableAccess ta1 = (MTableAccess)o1;
final MTableAccess ta2 = (MTableAccess)o2;
found = ta1.getAD_Table_ID() == ta2.getAD_Table_ID();
if (found && override)
{
// stronger permissions first
if (ta2.isCanReport())
ta1.setIsCanExport(true);
if (ta2.isCanReport())
ta1.setIsCanReport(true);
if (!ta2.isReadOnly())
ta1.setIsCanExport(false);
if (!ta2.isExclude())
ta1.setIsExclude(false);
}
}
else if (o1 instanceof MColumnAccess)
{
final MColumnAccess ca1 = (MColumnAccess)o1;
final MColumnAccess ca2 = (MColumnAccess)o2;
found = ca1.getAD_Column_ID() == ca2.getAD_Column_ID();
if (found && override)
{
// stronger permissions first
if (!ca2.isReadOnly())
ca1.setIsReadOnly(false);
if (!ca2.isExclude())
ca1.setIsExclude(false);
}
}
else if (o1 instanceof MRecordAccess)
{
final MRecordAccess ra1 = (MRecordAccess)o1;
final MRecordAccess ra2 = (MRecordAccess)o2;
found = ra1.getAD_Table_ID() == ra2.getAD_Table_ID()
&& ra1.getRecord_ID() == ra2.getRecord_ID();
if (found && override)
{
// stronger permissions first
if(!ra2.isReadOnly())
ra1.setIsReadOnly(false);
if (!ra2.isDependentEntities())
ra1.setIsDependentEntities(false);
if (!ra2.isExclude())
ra1.setIsExclude(false);
}
}
else
{
throw new AdempiereException("Not supported objects - "+o1+", "+o2);
}
//
if (found)
{
break;
}
} // end for array1
if (!found)
{
//System.out.println("add "+o2);
list.add(o2);
}
}
T[] arr = (T[]) Array.newInstance(array1.getClass().getComponentType(), list.size());
return list.toArray(arr);
}
| @SuppressWarnings(STR) static final <T> T[] function(T[] array1, T[] array2, boolean override) { if (array1 == null) { System.out.println(STR); } List<T> list = new ArrayList<T>(); for (T po : array1) { list.add(po); } for (T o2 : array2) { boolean found = false; for (int i = 0; i < array1.length; i++) { final T o1 = array1[i]; if (o1 instanceof OrgAccess) { final OrgAccess oa1 = (OrgAccess)o1; final OrgAccess oa2 = (OrgAccess)o2; found = oa1.equals(oa2); if (found && override) { if (!oa2.readOnly) oa1.readOnly = false; } } else if (o1 instanceof MTableAccess) { final MTableAccess ta1 = (MTableAccess)o1; final MTableAccess ta2 = (MTableAccess)o2; found = ta1.getAD_Table_ID() == ta2.getAD_Table_ID(); if (found && override) { if (ta2.isCanReport()) ta1.setIsCanExport(true); if (ta2.isCanReport()) ta1.setIsCanReport(true); if (!ta2.isReadOnly()) ta1.setIsCanExport(false); if (!ta2.isExclude()) ta1.setIsExclude(false); } } else if (o1 instanceof MColumnAccess) { final MColumnAccess ca1 = (MColumnAccess)o1; final MColumnAccess ca2 = (MColumnAccess)o2; found = ca1.getAD_Column_ID() == ca2.getAD_Column_ID(); if (found && override) { if (!ca2.isReadOnly()) ca1.setIsReadOnly(false); if (!ca2.isExclude()) ca1.setIsExclude(false); } } else if (o1 instanceof MRecordAccess) { final MRecordAccess ra1 = (MRecordAccess)o1; final MRecordAccess ra2 = (MRecordAccess)o2; found = ra1.getAD_Table_ID() == ra2.getAD_Table_ID() && ra1.getRecord_ID() == ra2.getRecord_ID(); if (found && override) { if(!ra2.isReadOnly()) ra1.setIsReadOnly(false); if (!ra2.isDependentEntities()) ra1.setIsDependentEntities(false); if (!ra2.isExclude()) ra1.setIsExclude(false); } } else { throw new AdempiereException(STR+o1+STR+o2); } if (found) { break; } } if (!found) { list.add(o2); } } T[] arr = (T[]) Array.newInstance(array1.getClass().getComponentType(), list.size()); return list.toArray(arr); } | /**
* Merge permissions access
* @param <T>
* @param array1
* @param array2
* @return array of merged values
* @see metas-2009_0021_AP1_G94
*/ | Merge permissions access | mergeAccess | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/MRole.java",
"license": "gpl-2.0",
"size": 91774
} | [
"java.lang.reflect.Array",
"java.util.ArrayList",
"java.util.List",
"org.adempiere.exceptions.AdempiereException"
] | import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; import org.adempiere.exceptions.AdempiereException; | import java.lang.reflect.*; import java.util.*; import org.adempiere.exceptions.*; | [
"java.lang",
"java.util",
"org.adempiere.exceptions"
] | java.lang; java.util; org.adempiere.exceptions; | 209,618 |
Collection<MPDSong> findArtist(String artist); | Collection<MPDSong> findArtist(String artist); | /**
* Returns a {@link java.util.Collection} of {@link org.bff.javampd.song.MPDSong}s for an artist.
* Please note this only returns an exact match of artist. To find a partial
* match use {@link #searchArtist(String)}.
*
* @param artist the artist to find
* @return a {@link java.util.Collection} of {@link org.bff.javampd.song.MPDSong}s
*/ | Returns a <code>java.util.Collection</code> of <code>org.bff.javampd.song.MPDSong</code>s for an artist. Please note this only returns an exact match of artist. To find a partial match use <code>#searchArtist(String)</code> | findArtist | {
"repo_name": "billf5293/javampd",
"path": "src/main/java/org/bff/javampd/song/SongDatabase.java",
"license": "gpl-2.0",
"size": 9895
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,797,655 |
public Document getDocument()
{
return textComponent.getDocument();
} | Document function() { return textComponent.getDocument(); } | /**
* Returns the document associated with this view.
*
* @return the document associated with this view
*/ | Returns the document associated with this view | getDocument | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java",
"license": "gpl-2.0",
"size": 47133
} | [
"javax.swing.text.Document"
] | import javax.swing.text.Document; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 1,580,207 |
void setServer(Server server);
| void setServer(Server server); | /**
* Sets a reference to the server.
*
* @param server
* server
*/ | Sets a reference to the server | setServer | {
"repo_name": "rajdeeprath/red5-server",
"path": "src/main/java/org/red5/server/api/plugin/IRed5Plugin.java",
"license": "apache-2.0",
"size": 1872
} | [
"org.red5.server.Server"
] | import org.red5.server.Server; | import org.red5.server.*; | [
"org.red5.server"
] | org.red5.server; | 1,201,016 |
protected void scanExternalID(String[] identifiers,
boolean optionalSystemId)
throws IOException, XNIException {
String systemId = null;
String publicId = null;
if (fEntityScanner.skipString("PUBLIC")) {
if (!fEntityScanner.skipSpaces()) {
reportFatalError("SpaceRequiredAfterPUBLIC", null);
}
scanPubidLiteral(fString);
publicId = fString.toString();
if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
}
}
if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
if (publicId == null && !fEntityScanner.skipSpaces()) {
reportFatalError("SpaceRequiredAfterSYSTEM", null);
}
int quote = fEntityScanner.peekChar();
if (quote != '\'' && quote != '"') {
if (publicId != null && optionalSystemId) {
// looks like we don't have any system id
// simply return the public id
identifiers[0] = null;
identifiers[1] = publicId;
return;
}
reportFatalError("QuoteRequiredInSystemID", null);
}
fEntityScanner.scanChar(null);
XMLString ident = fString;
if (fEntityScanner.scanLiteral(quote, ident, false) != quote) {
fStringBuffer.clear();
do {
fStringBuffer.append(ident);
int c = fEntityScanner.peekChar();
if (XMLChar.isMarkup(c) || c == ']') {
fStringBuffer.append((char)fEntityScanner.scanChar(null));
} else if (c != -1 && isInvalidLiteral(c)) {
reportFatalError("InvalidCharInSystemID",
new Object[] {Integer.toString(c, 16)});
}
} while (fEntityScanner.scanLiteral(quote, ident, false) != quote);
fStringBuffer.append(ident);
ident = fStringBuffer;
}
systemId = ident.toString();
if (!fEntityScanner.skipChar(quote, null)) {
reportFatalError("SystemIDUnterminated", null);
}
}
// store result in array
identifiers[0] = systemId;
identifiers[1] = publicId;
} | void function(String[] identifiers, boolean optionalSystemId) throws IOException, XNIException { String systemId = null; String publicId = null; if (fEntityScanner.skipString(STR)) { if (!fEntityScanner.skipSpaces()) { reportFatalError(STR, null); } scanPubidLiteral(fString); publicId = fString.toString(); if (!fEntityScanner.skipSpaces() && !optionalSystemId) { reportFatalError(STR, null); } } if (publicId != null fEntityScanner.skipString(STR)) { if (publicId == null && !fEntityScanner.skipSpaces()) { reportFatalError(STR, null); } int quote = fEntityScanner.peekChar(); if (quote != '\'' && quote != 'STRQuoteRequiredInSystemIDSTRInvalidCharInSystemIDSTRSystemIDUnterminated", null); } } identifiers[0] = systemId; identifiers[1] = publicId; } | /**
* Scans External ID and return the public and system IDs.
*
* @param identifiers An array of size 2 to return the system id,
* and public id (in that order).
* @param optionalSystemId Specifies whether the system id is optional.
*
* <strong>Note:</strong> This method uses fString and fStringBuffer,
* anything in them at the time of calling is lost.
*/ | Scans External ID and return the public and system IDs | scanExternalID | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java",
"license": "gpl-2.0",
"size": 62187
} | [
"com.sun.org.apache.xerces.internal.xni.XNIException",
"java.io.IOException"
] | import com.sun.org.apache.xerces.internal.xni.XNIException; import java.io.IOException; | import com.sun.org.apache.xerces.internal.xni.*; import java.io.*; | [
"com.sun.org",
"java.io"
] | com.sun.org; java.io; | 1,499,719 |
// Set up the atom cache etc
AtomCache cache = new AtomCache();
cache.setUseMmCif(true);
FileParsingParameters params = cache.getFileParsingParams();
params.setCreateAtomBonds(true);
params.setAlignSeqRes(true);
params.setParseBioAssembly(true);
DownloadChemCompProvider cc = new DownloadChemCompProvider();
ChemCompGroupFactory.setChemCompProvider(cc);
cc.checkDoFirstInstall();
cache.setFileParsingParams(params);
StructureIO.setAtomCache(cache);
return cache;
} | AtomCache cache = new AtomCache(); cache.setUseMmCif(true); FileParsingParameters params = cache.getFileParsingParams(); params.setCreateAtomBonds(true); params.setAlignSeqRes(true); params.setParseBioAssembly(true); DownloadChemCompProvider cc = new DownloadChemCompProvider(); ChemCompGroupFactory.setChemCompProvider(cc); cc.checkDoFirstInstall(); cache.setFileParsingParams(params); StructureIO.setAtomCache(cache); return cache; } | /**
* Set up the configuration parameters for BioJava.
*/ | Set up the configuration parameters for BioJava | setUpBioJava | {
"repo_name": "andreasprlic/biojava",
"path": "biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java",
"license": "lgpl-2.1",
"size": 17445
} | [
"org.biojava.nbio.structure.StructureIO",
"org.biojava.nbio.structure.align.util.AtomCache",
"org.biojava.nbio.structure.io.FileParsingParameters",
"org.biojava.nbio.structure.io.mmcif.ChemCompGroupFactory",
"org.biojava.nbio.structure.io.mmcif.DownloadChemCompProvider"
] | import org.biojava.nbio.structure.StructureIO; import org.biojava.nbio.structure.align.util.AtomCache; import org.biojava.nbio.structure.io.FileParsingParameters; import org.biojava.nbio.structure.io.mmcif.ChemCompGroupFactory; import org.biojava.nbio.structure.io.mmcif.DownloadChemCompProvider; | import org.biojava.nbio.structure.*; import org.biojava.nbio.structure.align.util.*; import org.biojava.nbio.structure.io.*; import org.biojava.nbio.structure.io.mmcif.*; | [
"org.biojava.nbio"
] | org.biojava.nbio; | 1,651,310 |
public String getId(boolean forceRegenerate) throws IOException;
public String generateId() throws IOException;
public boolean validId() throws IOException;
public AceComponentType getComponentType();
/**
* Return the raw {@code byte[]} JSON for this component.
* @return JSON as a {@code byte[]} | String getId(boolean forceRegenerate) throws IOException; public String generateId() throws IOException; public boolean validId() throws IOException; public AceComponentType function(); /** * Return the raw {@code byte[]} JSON for this component. * @return JSON as a {@code byte[]} | /**
* Return the {@link AceComponentType} for this component.
* @return the AceComponentType for this component.
*/ | Return the <code>AceComponentType</code> for this component | getComponentType | {
"repo_name": "agmip/ace-core",
"path": "src/main/java/org/agmip/ace/IAceBaseComponent.java",
"license": "bsd-3-clause",
"size": 2112
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,687,138 |
protected void setFailureAttribute(final ServletRequest request, final AuthenticationException ae) {
final String className = ae.getClass().getName();
request.setAttribute(this.getFailureKeyAttribute(), className);
} | void function(final ServletRequest request, final AuthenticationException ae) { final String className = ae.getClass().getName(); request.setAttribute(this.getFailureKeyAttribute(), className); } | /**
* Sets the failure attribute.
*
* @param request
* the request
* @param ae
* the ae
*/ | Sets the failure attribute | setFailureAttribute | {
"repo_name": "hazendaz/waffle",
"path": "Source/JNA/waffle-shiro/src/main/java/waffle/shiro/negotiate/NegotiateAuthenticationFilter.java",
"license": "mit",
"size": 15406
} | [
"javax.servlet.ServletRequest",
"org.apache.shiro.authc.AuthenticationException"
] | import javax.servlet.ServletRequest; import org.apache.shiro.authc.AuthenticationException; | import javax.servlet.*; import org.apache.shiro.authc.*; | [
"javax.servlet",
"org.apache.shiro"
] | javax.servlet; org.apache.shiro; | 2,243,755 |
public synchronized SIPServerTransaction getServerTransaction(BranchMethodKey key, Request req) {
SIPServerTransaction serverTransaction = (SIPServerTransaction)m_serverTransactionsByBranchMethodKey.get(key);
if (serverTransaction == null) {
return null;
}
// getting here means we seem to have a matching transaction,
// but there are several more rules that need to be verified
if (!serverTransaction.isRequestPartOfTransaction(req)) {
if (s_logger.isTraceDebugEnabled()) {
s_logger.traceDebug("Warning: server transaction [" + serverTransaction.toString()
+ "] does not match request");
}
return null;
}
return serverTransaction;
} | synchronized SIPServerTransaction function(BranchMethodKey key, Request req) { SIPServerTransaction serverTransaction = (SIPServerTransaction)m_serverTransactionsByBranchMethodKey.get(key); if (serverTransaction == null) { return null; } if (!serverTransaction.isRequestPartOfTransaction(req)) { if (s_logger.isTraceDebugEnabled()) { s_logger.traceDebug(STR + serverTransaction.toString() + STR); } return null; } return serverTransaction; } | /**
* called when a request arrives from the network, to match a server
* transaction to this request per rfc 3261 section 17.2.3
* @param key method+branch identifying the transaction
* @param req the incoming request
*/ | called when a request arrives from the network, to match a server transaction to this request per rfc 3261 section 17.2.3 | getServerTransaction | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/ws/sip/stack/transaction/transactions/SIPTransactionsModel.java",
"license": "epl-1.0",
"size": 12624
} | [
"com.ibm.ws.sip.stack.transaction.transactions.st.SIPServerTransaction"
] | import com.ibm.ws.sip.stack.transaction.transactions.st.SIPServerTransaction; | import com.ibm.ws.sip.stack.transaction.transactions.st.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,488,233 |
public WB_Segment[] getSegments() {
final WB_Segment[] result = new WB_Segment[getNumberOfEdges()];
final Iterator<HE_Halfedge> eItr = eItr();
HE_Halfedge e;
int i = 0;
while (eItr.hasNext()) {
e = eItr.next();
result[i] = new WB_Segment(e.getVertex(), e.getEndVertex());
i++;
}
return result;
} | WB_Segment[] function() { final WB_Segment[] result = new WB_Segment[getNumberOfEdges()]; final Iterator<HE_Halfedge> eItr = eItr(); HE_Halfedge e; int i = 0; while (eItr.hasNext()) { e = eItr.next(); result[i] = new WB_Segment(e.getVertex(), e.getEndVertex()); i++; } return result; } | /**
* Gets the segments.
*
* @return the segments
*/ | Gets the segments | getSegments | {
"repo_name": "DweebsUnited/CodeMonkey",
"path": "java/CodeMonkey/HEMesh/wblut/hemesh/HE_Mesh.java",
"license": "bsd-3-clause",
"size": 143263
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,375,435 |
@Test
public void whenRookMoveThatHeHasLastCoordinates() throws ImpossibleMoveException, OccupiedWayException, FigureNotFoundException {
board.addFigure(rook);
board.move(rook.getPosition(), getObjectCell(6, 0));
board.move(rook.getPosition(), getObjectCell(6, 2));
board.move(rook.getPosition(), getObjectCell(2, 2));
board.move(rook.getPosition(), getObjectCell(2, 5));
assertThat(rook.getPosition(), is(getObjectCell(2, 5)));
}
| void function() throws ImpossibleMoveException, OccupiedWayException, FigureNotFoundException { board.addFigure(rook); board.move(rook.getPosition(), getObjectCell(6, 0)); board.move(rook.getPosition(), getObjectCell(6, 2)); board.move(rook.getPosition(), getObjectCell(2, 2)); board.move(rook.getPosition(), getObjectCell(2, 5)); assertThat(rook.getPosition(), is(getObjectCell(2, 5))); } | /**
* Testing the movement of the figure of the Rook.
* @throws ImpossibleMoveException exception in case of impossibility of motion figure.
* @throws OccupiedWayException exception if there's other figures.
* @throws FigureNotFoundException exception if the figure is not found.
*/ | Testing the movement of the figure of the Rook | whenRookMoveThatHeHasLastCoordinates | {
"repo_name": "sergeyBulygin/Java_a_to_z",
"path": "Chapter_002/Test_task/Game/src/test/java/ru/sbulygin/chees/BoardTest.java",
"license": "apache-2.0",
"size": 16452
} | [
"org.hamcrest.core.Is",
"org.junit.Assert",
"ru.sbulygin.chees.Cell",
"ru.sbulygin.exeptions.FigureNotFoundException",
"ru.sbulygin.exeptions.ImpossibleMoveException",
"ru.sbulygin.exeptions.OccupiedWayException"
] | import org.hamcrest.core.Is; import org.junit.Assert; import ru.sbulygin.chees.Cell; import ru.sbulygin.exeptions.FigureNotFoundException; import ru.sbulygin.exeptions.ImpossibleMoveException; import ru.sbulygin.exeptions.OccupiedWayException; | import org.hamcrest.core.*; import org.junit.*; import ru.sbulygin.chees.*; import ru.sbulygin.exeptions.*; | [
"org.hamcrest.core",
"org.junit",
"ru.sbulygin.chees",
"ru.sbulygin.exeptions"
] | org.hamcrest.core; org.junit; ru.sbulygin.chees; ru.sbulygin.exeptions; | 268,959 |
public static <A> void foo(Map<A, Map<A, A>> map) {} | public static <A> void foo(Map<A, Map<A, A>> map) {} | /**
* Simple method.
*/ | Simple method | method | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java",
"license": "mit",
"size": 3595
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 964,181 |
public void addHtmlModificationListener(HtmlModificationListener listener){
htmlModificationListeners.add(listener);
}
| void function(HtmlModificationListener listener){ htmlModificationListeners.add(listener); } | /**
* Adds a listener to the list of objects that will be notified about changes that
* cleaner does during cleanup process.
*
* @param listener -- listener object to be notified of the changes.
*/ | Adds a listener to the list of objects that will be notified about changes that cleaner does during cleanup process | addHtmlModificationListener | {
"repo_name": "unktomi/form-follows-function",
"path": "f3_awesomium_jogl/src/share/classes/org/htmlcleaner/CleanerProperties.java",
"license": "gpl-2.0",
"size": 18502
} | [
"org.htmlcleaner.audit.HtmlModificationListener"
] | import org.htmlcleaner.audit.HtmlModificationListener; | import org.htmlcleaner.audit.*; | [
"org.htmlcleaner.audit"
] | org.htmlcleaner.audit; | 1,336,523 |
public void reset()
{
if (!Simulation.getFactoryCDLIncludeFile().equals(Simulation.getCDLIncludeFile()))
Simulation.setCDLIncludeFile(Simulation.getFactoryCDLIncludeFile());
if (!Simulation.getFactoryCDLLibName().equals(Simulation.getCDLLibName()))
Simulation.setCDLLibName(Simulation.getFactoryCDLLibName());
if (!Simulation.getFactoryCDLLibPath().equals(Simulation.getCDLLibPath()))
Simulation.setCDLLibPath(Simulation.getFactoryCDLLibPath());
if (Simulation.isFactoryCDLConvertBrackets() != Simulation.isCDLConvertBrackets())
Simulation.setCDLConvertBrackets(Simulation.isFactoryCDLConvertBrackets());
} | void function() { if (!Simulation.getFactoryCDLIncludeFile().equals(Simulation.getCDLIncludeFile())) Simulation.setCDLIncludeFile(Simulation.getFactoryCDLIncludeFile()); if (!Simulation.getFactoryCDLLibName().equals(Simulation.getCDLLibName())) Simulation.setCDLLibName(Simulation.getFactoryCDLLibName()); if (!Simulation.getFactoryCDLLibPath().equals(Simulation.getCDLLibPath())) Simulation.setCDLLibPath(Simulation.getFactoryCDLLibPath()); if (Simulation.isFactoryCDLConvertBrackets() != Simulation.isCDLConvertBrackets()) Simulation.setCDLConvertBrackets(Simulation.isFactoryCDLConvertBrackets()); } | /**
* Method called when the factory reset is requested.
*/ | Method called when the factory reset is requested | reset | {
"repo_name": "imr/Electric8",
"path": "com/sun/electric/tool/user/dialogs/options/CDLTab.java",
"license": "gpl-3.0",
"size": 8201
} | [
"com.sun.electric.tool.simulation.Simulation"
] | import com.sun.electric.tool.simulation.Simulation; | import com.sun.electric.tool.simulation.*; | [
"com.sun.electric"
] | com.sun.electric; | 2,521,263 |
@Override
public void setElementType(String name, DataComponent component)
{
elementType.setName(name);
elementType.setValue(component);
((AbstractDataComponentImpl)component).setParent(this);
} | void function(String name, DataComponent component) { elementType.setName(name); elementType.setValue(component); ((AbstractDataComponentImpl)component).setParent(this); } | /**
* Sets the elementType property
*/ | Sets the elementType property | setElementType | {
"repo_name": "sensiasoft/lib-swe-common",
"path": "swe-common-core/src/main/java/org/vast/data/AbstractArrayImpl.java",
"license": "mpl-2.0",
"size": 8924
} | [
"net.opengis.swe.v20.DataComponent"
] | import net.opengis.swe.v20.DataComponent; | import net.opengis.swe.v20.*; | [
"net.opengis.swe"
] | net.opengis.swe; | 1,060,800 |
public List<String> getRecordsNames(SchemeRecord rec) {
Objects.requireNonNull(rec, "rec");
if (!rec.isTemplate()) {
throw new IllegalArgumentException("Record cannot be used as template in generator");
}
if (!rec.getParentGenerator().equals(getName())) {
throw new IllegalArgumentException("Record template from wrong generator");
}
String baseName = rec.getName();
List<String> names = new ArrayList<>();
for (String s : iterator) {
if (s.isEmpty()) {
names.add(baseName);
} else {
switch (type) {
case PREFIX:
names.add(s + (delimiter == null ? "" : delimiter) + baseName);
break;
case SUFFIX:
names.add(baseName + (delimiter == null ? "" : delimiter) + s);
break;
}
}
}
return names;
} | List<String> function(SchemeRecord rec) { Objects.requireNonNull(rec, "rec"); if (!rec.isTemplate()) { throw new IllegalArgumentException(STR); } if (!rec.getParentGenerator().equals(getName())) { throw new IllegalArgumentException(STR); } String baseName = rec.getName(); List<String> names = new ArrayList<>(); for (String s : iterator) { if (s.isEmpty()) { names.add(baseName); } else { switch (type) { case PREFIX: names.add(s + (delimiter == null ? STR" : delimiter) + s); break; } } } return names; } | /**
* Generates all names for given record. Record must be template and be owned by this generator.
*/ | Generates all names for given record. Record must be template and be owned by this generator | getRecordsNames | {
"repo_name": "Devexperts/QD",
"path": "dxfeed-scheme/src/main/java/com/dxfeed/scheme/model/SchemeRecordGenerator.java",
"license": "mpl-2.0",
"size": 8654
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Objects"
] | import java.util.ArrayList; import java.util.List; import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 2,071,679 |
public boolean isDownsamplingSupported(MediaFile mediaFile) {
if (mediaFile != null) {
boolean isMp3 = "mp3".equalsIgnoreCase(mediaFile.getFormat());
if (!isMp3) {
return false;
}
}
String commandLine = settingsService.getDownsamplingCommand();
return isTranscodingStepInstalled(commandLine);
} | boolean function(MediaFile mediaFile) { if (mediaFile != null) { boolean isMp3 = "mp3".equalsIgnoreCase(mediaFile.getFormat()); if (!isMp3) { return false; } } String commandLine = settingsService.getDownsamplingCommand(); return isTranscodingStepInstalled(commandLine); } | /**
* Returns whether downsampling is supported (i.e., whether ffmpeg is installed or not.)
*
* @param mediaFile If not null, returns whether downsampling is supported for this file.
* @return Whether downsampling is supported.
*/ | Returns whether downsampling is supported (i.e., whether ffmpeg is installed or not.) | isDownsamplingSupported | {
"repo_name": "subrobotnik/subrobotnik",
"path": "subsonic-main/src/main/java/net/sourceforge/subsonic/service/TranscodingService.java",
"license": "gpl-3.0",
"size": 21526
} | [
"net.sourceforge.subsonic.domain.MediaFile"
] | import net.sourceforge.subsonic.domain.MediaFile; | import net.sourceforge.subsonic.domain.*; | [
"net.sourceforge.subsonic"
] | net.sourceforge.subsonic; | 2,483,762 |
public static void sendParticle(Particle particle, Location loc, int count) {
sendParticle(particle, loc, 0, 0, 0, 0, count);
} | static void function(Particle particle, Location loc, int count) { sendParticle(particle, loc, 0, 0, 0, 0, count); } | /**
* Sends the particle effect to the given location
*
* @param particle The particle to send
* @param loc The location to send it to
* @param count The number of particles to send
*/ | Sends the particle effect to the given location | sendParticle | {
"repo_name": "minnymin3/Zephyr",
"path": "Zephyr-Bukkit/src/main/java/com/minnymin/zephyr/bukkit/util/ParticleEffects.java",
"license": "lgpl-3.0",
"size": 2514
} | [
"org.bukkit.Location"
] | import org.bukkit.Location; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 539,676 |
private void saveConf()
{
// save window location and size
Point ptTmp = this.getLocationOnScreen();
EzimConf.UI_MSGIN_LOCATION_X = (int) ptTmp.getX();
EzimConf.UI_MSGIN_LOCATION_Y = (int) ptTmp.getY();
Dimension dmTmp = this.getSize();
EzimConf.UI_MSGIN_SIZE_W = (int) dmTmp.getWidth();
EzimConf.UI_MSGIN_SIZE_H = (int) dmTmp.getHeight();
} | void function() { Point ptTmp = this.getLocationOnScreen(); EzimConf.UI_MSGIN_LOCATION_X = (int) ptTmp.getX(); EzimConf.UI_MSGIN_LOCATION_Y = (int) ptTmp.getY(); Dimension dmTmp = this.getSize(); EzimConf.UI_MSGIN_SIZE_W = (int) dmTmp.getWidth(); EzimConf.UI_MSGIN_SIZE_H = (int) dmTmp.getHeight(); } | /**
* save window position and size to configuration settings
*/ | save window position and size to configuration settings | saveConf | {
"repo_name": "LdTrigger/soen343-ezim",
"path": "org/ezim/ui/EzimMsgIn.java",
"license": "gpl-3.0",
"size": 11089
} | [
"java.awt.Dimension",
"java.awt.Point",
"org.ezim.core.EzimConf"
] | import java.awt.Dimension; import java.awt.Point; import org.ezim.core.EzimConf; | import java.awt.*; import org.ezim.core.*; | [
"java.awt",
"org.ezim.core"
] | java.awt; org.ezim.core; | 2,673,006 |
//-------------//
// afterReload //
//-------------//
public void afterReload (Measure measure)
{
try {
this.measure = measure;
// Augmentation dot(s)?
countDots();
// Staff for rest chord
if (this instanceof RestChordInter) {
setStaff(getNotes().get(0).getStaff());
}
} catch (Exception ex) {
logger.warn("Error in " + getClass() + " afterReload() " + ex, ex);
}
}
| void function (Measure measure) { try { this.measure = measure; countDots(); if (this instanceof RestChordInter) { setStaff(getNotes().get(0).getStaff()); } } catch (Exception ex) { logger.warn(STR + getClass() + STR + ex, ex); } } | /**
* To be called right after unmarshalling.
*
* @param measure containing measure
*/ | To be called right after unmarshalling | afterReload | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/sig/inter/AbstractChordInter.java",
"license": "agpl-3.0",
"size": 41317
} | [
"org.audiveris.omr.sheet.rhythm.Measure"
] | import org.audiveris.omr.sheet.rhythm.Measure; | import org.audiveris.omr.sheet.rhythm.*; | [
"org.audiveris.omr"
] | org.audiveris.omr; | 1,509,315 |
public List<String> getMessages() {
List<String> rtnList = new ArrayList<>(buffer.length);
synchronized (buffer) {
int pos = start;
Formatter formatter = getFormatter();
for (int i = 0; i < count; i++) {
rtnList.add(formatter.format(buffer[pos++]));
if (pos == buffer.length)
pos = 0;
}
}
return rtnList;
} | List<String> function() { List<String> rtnList = new ArrayList<>(buffer.length); synchronized (buffer) { int pos = start; Formatter formatter = getFormatter(); for (int i = 0; i < count; i++) { rtnList.add(formatter.format(buffer[pos++])); if (pos == buffer.length) pos = 0; } } return rtnList; } | /**
* Return the log messages from the ring buffer
*
* @return List of log messages
*/ | Return the log messages from the ring buffer | getMessages | {
"repo_name": "cping/RipplePower",
"path": "eclipse/RipplePower/src/org/ripple/power/txns/btc/MemoryLogHandler.java",
"license": "apache-2.0",
"size": 2754
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.logging.Formatter"
] | import java.util.ArrayList; import java.util.List; import java.util.logging.Formatter; | import java.util.*; import java.util.logging.*; | [
"java.util"
] | java.util; | 2,338,855 |
public void addSubnet(Uuid snetId, String name, Uuid tenantId,
IpAddress gatewayIp, String ipVersion, IpPrefix subnetCidr,
String ipV6AddressMode, String ipV6RaMode) {
// Save the gateway ipv6 address in its fully expanded format. We always store the v6Addresses
// in expanded form and are used during Neighbor Discovery Support.
if (gatewayIp != null) {
Ipv6Address addr = new Ipv6Address(InetAddresses
.forString(gatewayIp.getIpv6Address().getValue()).getHostAddress());
gatewayIp = new IpAddress(addr);
}
VirtualSubnet snet = VirtualSubnet.builder().subnetUUID(snetId).tenantID(tenantId).name(name)
.gatewayIp(gatewayIp).subnetCidr(subnetCidr).ipVersion(ipVersion).ipv6AddressMode(ipV6AddressMode)
.ipv6RAMode(ipV6RaMode).build();
vsubnets.put(snetId, snet);
Set<VirtualPort> intfList = unprocessedSubnetIntfs.remove(snetId);
if (intfList == null) {
LOG.debug("No unprocessed interfaces for the subnet {}", snetId);
return;
}
synchronized (intfList) {
for (VirtualPort intf : intfList) {
if (intf != null) {
intf.setSubnet(snetId, snet);
snet.addInterface(intf);
VirtualRouter rtr = intf.getRouter();
if (rtr != null) {
rtr.addSubnet(snet);
}
updateInterfaceDpidOfPortInfo(intf.getIntfUUID());
}
}
}
} | void function(Uuid snetId, String name, Uuid tenantId, IpAddress gatewayIp, String ipVersion, IpPrefix subnetCidr, String ipV6AddressMode, String ipV6RaMode) { if (gatewayIp != null) { Ipv6Address addr = new Ipv6Address(InetAddresses .forString(gatewayIp.getIpv6Address().getValue()).getHostAddress()); gatewayIp = new IpAddress(addr); } VirtualSubnet snet = VirtualSubnet.builder().subnetUUID(snetId).tenantID(tenantId).name(name) .gatewayIp(gatewayIp).subnetCidr(subnetCidr).ipVersion(ipVersion).ipv6AddressMode(ipV6AddressMode) .ipv6RAMode(ipV6RaMode).build(); vsubnets.put(snetId, snet); Set<VirtualPort> intfList = unprocessedSubnetIntfs.remove(snetId); if (intfList == null) { LOG.debug(STR, snetId); return; } synchronized (intfList) { for (VirtualPort intf : intfList) { if (intf != null) { intf.setSubnet(snetId, snet); snet.addInterface(intf); VirtualRouter rtr = intf.getRouter(); if (rtr != null) { rtr.addSubnet(snet); } updateInterfaceDpidOfPortInfo(intf.getIntfUUID()); } } } } | /**
* Add Subnet.
*
* @param snetId subnet id
* @param name subnet name
* @param tenantId tenant id
* @param gatewayIp gateway ip address
* @param ipVersion IP Version "IPv4 or IPv6"
* @param subnetCidr subnet CIDR
* @param ipV6AddressMode Address Mode of IPv6 Subnet
* @param ipV6RaMode RA Mode of IPv6 Subnet.
*/ | Add Subnet | addSubnet | {
"repo_name": "opendaylight/netvirt",
"path": "ipv6service/impl/src/main/java/org/opendaylight/netvirt/ipv6service/IfMgr.java",
"license": "epl-1.0",
"size": 66023
} | [
"com.google.common.net.InetAddresses",
"java.util.Set",
"org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress",
"org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix",
"org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iet... | import com.google.common.net.InetAddresses; import java.util.Set; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; | import com.google.common.net.*; import java.util.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.*; | [
"com.google.common",
"java.util",
"org.opendaylight.yang"
] | com.google.common; java.util; org.opendaylight.yang; | 1,046,594 |
private void registerCheck(String token, AbstractCheck check) throws CheckstyleException {
if (check.isCommentNodesRequired()) {
tokenToCommentChecks.put(token, check);
}
else if (TokenUtils.isCommentType(token)) {
final String message = String.format(Locale.ROOT, "Check '%s' waits for comment type "
+ "token ('%s') and should override 'isCommentNodesRequired()' "
+ "method to return 'true'", check.getClass().getName(), token);
throw new CheckstyleException(message);
}
else {
tokenToOrdinaryChecks.put(token, check);
}
} | void function(String token, AbstractCheck check) throws CheckstyleException { if (check.isCommentNodesRequired()) { tokenToCommentChecks.put(token, check); } else if (TokenUtils.isCommentType(token)) { final String message = String.format(Locale.ROOT, STR + STR + STR, check.getClass().getName(), token); throw new CheckstyleException(message); } else { tokenToOrdinaryChecks.put(token, check); } } | /**
* Register a check for a specified token name.
* @param token the name of the token
* @param check the check to register
* @throws CheckstyleException if Check is misconfigured
*/ | Register a check for a specified token name | registerCheck | {
"repo_name": "liscju/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java",
"license": "lgpl-2.1",
"size": 28732
} | [
"com.puppycrawl.tools.checkstyle.api.AbstractCheck",
"com.puppycrawl.tools.checkstyle.api.CheckstyleException",
"com.puppycrawl.tools.checkstyle.utils.TokenUtils",
"java.util.Locale"
] | import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.utils.TokenUtils; import java.util.Locale; | import com.puppycrawl.tools.checkstyle.api.*; import com.puppycrawl.tools.checkstyle.utils.*; import java.util.*; | [
"com.puppycrawl.tools",
"java.util"
] | com.puppycrawl.tools; java.util; | 245,821 |
public ServiceCall<SkuInner> beginPutAsyncNonResourceAsync(final ServiceCallback<SkuInner> serviceCallback) {
return ServiceCall.create(beginPutAsyncNonResourceWithServiceResponseAsync(), serviceCallback);
} | ServiceCall<SkuInner> function(final ServiceCallback<SkuInner> serviceCallback) { return ServiceCall.create(beginPutAsyncNonResourceWithServiceResponseAsync(), serviceCallback); } | /**
* Long running put request with non resource.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | Long running put request with non resource | beginPutAsyncNonResourceAsync | {
"repo_name": "yugangw-msft/autorest",
"path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROsInner.java",
"license": "mit",
"size": 366932
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,681,198 |
public void removeArgument(Argument arg) {
PropertyIterator iter = getArguments().iterator();
while (iter.hasNext()) {
Argument item = (Argument) iter.next().getObjectValue();
if (arg.equals(item)) {
iter.remove();
}
}
}
| void function(Argument arg) { PropertyIterator iter = getArguments().iterator(); while (iter.hasNext()) { Argument item = (Argument) iter.next().getObjectValue(); if (arg.equals(item)) { iter.remove(); } } } | /**
* Remove the specified argument from the list.
*
* @param arg
* the argument to remove
*/ | Remove the specified argument from the list | removeArgument | {
"repo_name": "yuyupapa/OpenSource",
"path": "apache-jmeter-3.0/src/core/org/apache/jmeter/config/Arguments.java",
"license": "apache-2.0",
"size": 9592
} | [
"org.apache.jmeter.testelement.property.PropertyIterator"
] | import org.apache.jmeter.testelement.property.PropertyIterator; | import org.apache.jmeter.testelement.property.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 731,940 |
public String getState(int id) throws SQLException {
return seeker.getState(id);
} | String function(int id) throws SQLException { return seeker.getState(id); } | /**
* Obtiene el tipo de estado dado su id
*
* @param id id del estado
*
* @return devuelve el tipo de estado
*
* @throws SQLException si ocurre alguna SQLException durante la ejecución
* de la operación
*/ | Obtiene el tipo de estado dado su id | getState | {
"repo_name": "jcrcano/DrakkarKeel",
"path": "Modules/DrakkarStern/src/drakkar/stern/tracker/persistent/FacadeDBProw.java",
"license": "gpl-2.0",
"size": 48742
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 491,719 |
public SortedMap<SpatialOperator, SortedSet<QName>> getSpatialOperators() {
return Collections.unmodifiableSortedMap(spatialOperators);
} | SortedMap<SpatialOperator, SortedSet<QName>> function() { return Collections.unmodifiableSortedMap(spatialOperators); } | /**
* Get spatial operators
*
* @return spatial operators
*/ | Get spatial operators | getSpatialOperators | {
"repo_name": "ahuarte47/SOS",
"path": "core/api/src/main/java/org/n52/sos/ogc/filter/FilterCapabilities.java",
"license": "gpl-2.0",
"size": 7162
} | [
"java.util.Collections",
"java.util.SortedMap",
"java.util.SortedSet",
"javax.xml.namespace.QName",
"org.n52.sos.ogc.filter.FilterConstants"
] | import java.util.Collections; import java.util.SortedMap; import java.util.SortedSet; import javax.xml.namespace.QName; import org.n52.sos.ogc.filter.FilterConstants; | import java.util.*; import javax.xml.namespace.*; import org.n52.sos.ogc.filter.*; | [
"java.util",
"javax.xml",
"org.n52.sos"
] | java.util; javax.xml; org.n52.sos; | 2,131,803 |
public File getConfigFile() {
// I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
// is to abuse the plugin object we already have
// plugin.getDataFolder() => base/plugins/PluginA/
// pluginsFolder => base/plugins/
// The base is not necessarily relative to the startup directory.
File pluginsFolder = plugin.getDataFolder().getParentFile();
// return => base/plugins/PluginMetrics/config.yml
return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
} | File function() { File pluginsFolder = plugin.getDataFolder().getParentFile(); return new File(new File(pluginsFolder, STR), STR); } | /**
* Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
*
* @return the File object for the config file
*/ | Gets the File object of the config file that should be used to store data such as the GUID and opt-out status | getConfigFile | {
"repo_name": "GravityCraftMC/Core",
"path": "src/main/java/com/gravitymc/core/utils/Metrics.java",
"license": "gpl-3.0",
"size": 25683
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,242,855 |
@Override
public String toString() {
StringBuffer sb = new StringBuffer("DynamicManagedBean[");
sb.append("name=");
sb.append(name);
sb.append(", className=");
sb.append(className);
sb.append(", description=");
sb.append(description);
if (group != null) {
sb.append(", group=");
sb.append(group);
}
sb.append(", type=");
sb.append(type);
sb.append(", attributes=");
sb.append(Arrays.asList(attributes));
sb.append("]");
return (sb.toString());
} | String function() { StringBuffer sb = new StringBuffer(STR); sb.append("name="); sb.append(name); sb.append(STR); sb.append(className); sb.append(STR); sb.append(description); if (group != null) { sb.append(STR); sb.append(group); } sb.append(STR); sb.append(type); sb.append(STR); sb.append(Arrays.asList(attributes)); sb.append("]"); return (sb.toString()); } | /**
* Return a string representation of this managed bean.
*/ | Return a string representation of this managed bean | toString | {
"repo_name": "robertgeiger/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/admin/jmx/internal/DynamicManagedBean.java",
"license": "apache-2.0",
"size": 4799
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 577,408 |
public boolean hasNextObjectiveId(DestinationSet ns) {
NextNeighbors nextHops = dsNextObjStore.
get(new DestinationSetNextObjectiveStoreKey(deviceId, ns));
if (nextHops == null) {
return false;
}
return true;
} | boolean function(DestinationSet ns) { NextNeighbors nextHops = dsNextObjStore. get(new DestinationSetNextObjectiveStoreKey(deviceId, ns)); if (nextHops == null) { return false; } return true; } | /**
* Checks if the next objective ID (group) for the neighbor set exists or not.
*
* @param ns neighbor set to check
* @return true if it exists, false otherwise
*/ | Checks if the next objective ID (group) for the neighbor set exists or not | hasNextObjectiveId | {
"repo_name": "kuujo/onos",
"path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/grouphandler/DefaultGroupHandler.java",
"license": "apache-2.0",
"size": 73488
} | [
"org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey"
] | import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; | import org.onosproject.segmentrouting.storekey.*; | [
"org.onosproject.segmentrouting"
] | org.onosproject.segmentrouting; | 193,870 |
public Map<String, String> getAliases() {
return aliases;
} | Map<String, String> function() { return aliases; } | /**
* Gets aliases map.
*
* @return Aliases.
*/ | Gets aliases map | getAliases | {
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java",
"license": "apache-2.0",
"size": 6317
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,893,675 |
EReference getXMLTypeDocumentRoot_XSISchemaLocation(); | EReference getXMLTypeDocumentRoot_XSISchemaLocation(); | /**
* Returns the meta object for the map '{@link org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot#getXSISchemaLocation <em>XSI Schema Location</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the map '<em>XSI Schema Location</em>'.
* @see org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot#getXSISchemaLocation()
* @see #getXMLTypeDocumentRoot()
* @generated
*/ | Returns the meta object for the map '<code>org.eclipse.emf.ecore.xml.type.XMLTypeDocumentRoot#getXSISchemaLocation XSI Schema Location</code>'. | getXMLTypeDocumentRoot_XSISchemaLocation | {
"repo_name": "markus1978/clickwatch",
"path": "external/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/XMLTypePackage.java",
"license": "apache-2.0",
"size": 81795
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,176,546 |
private static String exec(File workingDir, List<String> cmds, boolean getReader, ProcessAction pAction){
ProcessBuilder bld = new ProcessBuilder(cmds);
BufferedReader br = null;
Process p = null;
String result = null;
try {
bld.redirectErrorStream(true);
bld.directory(workingDir);
p = bld.start();
if (getReader) {
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
br = new BufferedReader(isr);
}
result = pAction.actionPerform(p, br);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} finally {
if(br != null){
try{ br.close(); }catch(IOException e){}
}
if(p != null){
p.destroy();
}
}
return result;
}
}
| static String function(File workingDir, List<String> cmds, boolean getReader, ProcessAction pAction){ ProcessBuilder bld = new ProcessBuilder(cmds); BufferedReader br = null; Process p = null; String result = null; try { bld.redirectErrorStream(true); bld.directory(workingDir); p = bld.start(); if (getReader) { InputStream is = p.getInputStream(); InputStreamReader isr = new InputStreamReader(is); br = new BufferedReader(isr); } result = pAction.actionPerform(p, br); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } finally { if(br != null){ try{ br.close(); }catch(IOException e){} } if(p != null){ p.destroy(); } } return result; } } | /**
* <pre>
* execute process
* </pre>
* @param cmds
* commands
* @param getReader
* process 의 InputStreamReader 를 생성할지 여부. true 이면 ProcessAction.actionPerform 의 br 을 사용할수 있음. false 이면 br 이 null 이다.
* @param pAction
* process 를 생성한후 처리할 action 을 수행한다.
* @return
*/ | <code> execute process </code> | exec | {
"repo_name": "nices96/athena-meerkat",
"path": "controller/src/main/java/com/athena/meerkat/controller/web/provisioning/CommandUtil.java",
"license": "gpl-2.0",
"size": 2372
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.util.List"
] | import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 326,613 |
public void setBigDecimal(int parameterIndex, BigDecimal x)
throws SQLException {
if (x == null) {
setNull(parameterIndex, java.sql.Types.DECIMAL);
} else {
setInternal(parameterIndex, StringUtils
.fixDecimalExponent(StringUtils.consistentToString(x)));
this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.DECIMAL;
}
} | void function(int parameterIndex, BigDecimal x) throws SQLException { if (x == null) { setNull(parameterIndex, java.sql.Types.DECIMAL); } else { setInternal(parameterIndex, StringUtils .fixDecimalExponent(StringUtils.consistentToString(x))); this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.DECIMAL; } } | /**
* Set a parameter to a java.math.BigDecimal value. The driver converts this
* to a SQL NUMERIC value when it sends it to the database.
*
* @param parameterIndex
* the first parameter is 1...
* @param x
* the parameter value
*
* @exception SQLException
* if a database access error occurs
*/ | Set a parameter to a java.math.BigDecimal value. The driver converts this to a SQL NUMERIC value when it sends it to the database | setBigDecimal | {
"repo_name": "vaisaghvt/gameAnalyzer",
"path": "mysql-connector-java-5.1.22/src/com/mysql/jdbc/PreparedStatement.java",
"license": "mit",
"size": 168277
} | [
"java.math.BigDecimal",
"java.sql.SQLException",
"java.sql.Types"
] | import java.math.BigDecimal; import java.sql.SQLException; import java.sql.Types; | import java.math.*; import java.sql.*; | [
"java.math",
"java.sql"
] | java.math; java.sql; | 570,696 |
public void setMultipartFilter(Filter filter) {
this.multipartFilter = filter;
} | void function(Filter filter) { this.multipartFilter = filter; } | /**
* Allows using a custom multipart filter. Note: setting multipartFilter forces the value of enableMultipartFilter
* to true.
*/ | Allows using a custom multipart filter. Note: setting multipartFilter forces the value of enableMultipartFilter to true | setMultipartFilter | {
"repo_name": "nikhilvibhav/camel",
"path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpEndpoint.java",
"license": "apache-2.0",
"size": 11342
} | [
"javax.servlet.Filter"
] | import javax.servlet.Filter; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 2,707 |
public final double getAndSet(double newValue) {
long next = doubleToRawLongBits(newValue);
return longBitsToDouble(updater.getAndSet(this, next));
}
| final double function(double newValue) { long next = doubleToRawLongBits(newValue); return longBitsToDouble(updater.getAndSet(this, next)); } | /**
* Atomically sets to the given value and returns the old value.
*
* @param newValue the new value
* @return the previous value
*/ | Atomically sets to the given value and returns the old value | getAndSet | {
"repo_name": "mariusj/org.openntf.domino",
"path": "domino/externals/guava/src/main/java/com/google/common/util/concurrent/AtomicDouble.java",
"license": "apache-2.0",
"size": 7892
} | [
"java.lang.Double"
] | import java.lang.Double; | import java.lang.*; | [
"java.lang"
] | java.lang; | 994,717 |
public static synchronized Document getDocument(String file, ClassLoader classLoader, boolean force,
boolean canBeReloaded) throws XMLConfigException
{
String mainFile = file;
if (isFiringEvents) {
fireConfigurationEvents();
}
if (file == null) {
System.err.println("Invalid argument: no file specified");
throw new IllegalArgumentException("No file specified");
}
if (splitConfig == null) {
try {
readSplitConfig();
}
catch (Exception exc) {
LOG.error("Error reading: XMLConfigSplit.properties ", exc);
splitConfig = new HashMap<String, SplitConfig>();
mainToSplitFile = new HashMap<String, List<String>>();
}
}
Document document = documents.get(file);
if ((document != null) && !force) {
return document;
}
if (isSplitFile(file)) {
document = splitDocuments.get(file);
if ((document != null) && !force) {
return document;
}
SplitConfig sCfg = splitConfig.get(file);
mainFile = sCfg.getFileSrc();
}
URL currentUrl = getURL(mainFile, classLoader, force, canBeReloaded);
LOG.debug("Retrieved Document URL: " + currentUrl);
try {
document = readDocument(currentUrl, mainFile);
documents.put(mainFile, document);
urls.put(mainFile, currentUrl);
if (canBeReloaded) {
reloadableDocuments.put(mainFile, document);
ConfigurationEvent event = new ConfigurationEvent(ConfigurationEvent.EVT_FILE_LOADED, mainFile,
urls.get(mainFile));
prepareConfigurationEvent(event, true);
}
if (isSplitFile(file)) {
document = initSplitFile(file, mainFile, document);
}
return document;
}
catch (Throwable thr) {
thr.printStackTrace();
throw new XMLConfigException("XML XMLConfig error (File:" + file + ", Node:-, XPath:-)", thr);
}
} | static synchronized Document function(String file, ClassLoader classLoader, boolean force, boolean canBeReloaded) throws XMLConfigException { String mainFile = file; if (isFiringEvents) { fireConfigurationEvents(); } if (file == null) { System.err.println(STR); throw new IllegalArgumentException(STR); } if (splitConfig == null) { try { readSplitConfig(); } catch (Exception exc) { LOG.error(STR, exc); splitConfig = new HashMap<String, SplitConfig>(); mainToSplitFile = new HashMap<String, List<String>>(); } } Document document = documents.get(file); if ((document != null) && !force) { return document; } if (isSplitFile(file)) { document = splitDocuments.get(file); if ((document != null) && !force) { return document; } SplitConfig sCfg = splitConfig.get(file); mainFile = sCfg.getFileSrc(); } URL currentUrl = getURL(mainFile, classLoader, force, canBeReloaded); LOG.debug(STR + currentUrl); try { document = readDocument(currentUrl, mainFile); documents.put(mainFile, document); urls.put(mainFile, currentUrl); if (canBeReloaded) { reloadableDocuments.put(mainFile, document); ConfigurationEvent event = new ConfigurationEvent(ConfigurationEvent.EVT_FILE_LOADED, mainFile, urls.get(mainFile)); prepareConfigurationEvent(event, true); } if (isSplitFile(file)) { document = initSplitFile(file, mainFile, document); } return document; } catch (Throwable thr) { thr.printStackTrace(); throw new XMLConfigException(STR + file + STR, thr); } } | /**
* Reads a configuration file and caches it.
* <p>
* The file is searched into the Java class path as another Java resource.
* See Java class loader documentation to understand this mechanism.
*
* @param file
* the file to read
* @param classLoader
* the class loader to use to retrieve the file to read
* @param force
* force the reload of file if already present in cache
* @param canBeReloaded
* flag that indicates if this file can be changed and can be
* reloaded
* @return the read configuration as {@link org.w3c.dom.Document Document}.
*
* @throws XMLConfigException
* if some error occurs.
*/ | Reads a configuration file and caches it. The file is searched into the Java class path as another Java resource. See Java class loader documentation to understand this mechanism | getDocument | {
"repo_name": "green-vulcano/gv-engine",
"path": "gvengine/gvbase/src/main/java/it/greenvulcano/configuration/XMLConfig.java",
"license": "lgpl-3.0",
"size": 77533
} | [
"java.util.HashMap",
"java.util.List",
"org.w3c.dom.Document"
] | import java.util.HashMap; import java.util.List; import org.w3c.dom.Document; | import java.util.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 2,805,818 |
TabSwitcher createGridTabSwitcher(@NonNull Activity activity,
@NonNull ActivityLifecycleDispatcher activityLifecycleDispatcher,
@NonNull TabModelSelector tabModelSelector,
@NonNull TabContentManager tabContentManager,
@NonNull BrowserControlsStateProvider browserControlsStateProvider,
@NonNull TabCreatorManager tabCreatorManager,
@NonNull MenuOrKeyboardActionController menuOrKeyboardActionController,
@NonNull ViewGroup containerView,
@NonNull Supplier<ShareDelegate> shareDelegateSupplier,
@NonNull MultiWindowModeStateDispatcher multiWindowModeStateDispatcher,
@NonNull ScrimCoordinator scrimCoordinator, @NonNull ViewGroup rootView); | TabSwitcher createGridTabSwitcher(@NonNull Activity activity, @NonNull ActivityLifecycleDispatcher activityLifecycleDispatcher, @NonNull TabModelSelector tabModelSelector, @NonNull TabContentManager tabContentManager, @NonNull BrowserControlsStateProvider browserControlsStateProvider, @NonNull TabCreatorManager tabCreatorManager, @NonNull MenuOrKeyboardActionController menuOrKeyboardActionController, @NonNull ViewGroup containerView, @NonNull Supplier<ShareDelegate> shareDelegateSupplier, @NonNull MultiWindowModeStateDispatcher multiWindowModeStateDispatcher, @NonNull ScrimCoordinator scrimCoordinator, @NonNull ViewGroup rootView); | /**
* Create the {@link TabSwitcher} to display Tabs in grid.
* @param activity The current android {@link Activity}.
* @param activityLifecycleDispatcher Allows observation of the activity lifecycle.
* @param tabModelSelector Gives access to the current set of {@TabModel}.
* @param tabContentManager Gives access to the tab content.
* @param browserControlsStateProvider Gives access to the state of the browser controls.
* @param tabCreatorManger Manages creation of tabs.
* @param menuOrKeyboardActionController allows access to menu or keyboard actions.
* @param containerView The {@link ViewGroup} to add the switcher to.
* @param shareDelegateSupplier Supplies the current {@link ShareDelegate}.
* @param multiWindowModeStateDispatcher Gives access to the multi window mode state.
* @param scrimCoordinator The {@link ScrimCoordinator} to control the scrim view.
* @param rootView The root view of the app.
* @return The {@link TabSwitcher}.
*/ | Create the <code>TabSwitcher</code> to display Tabs in grid | createGridTabSwitcher | {
"repo_name": "scheib/chromium",
"path": "chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabManagementDelegate.java",
"license": "bsd-3-clause",
"size": 17237
} | [
"android.app.Activity",
"android.view.ViewGroup",
"androidx.annotation.NonNull",
"org.chromium.base.supplier.Supplier",
"org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider",
"org.chromium.chrome.browser.compositor.layouts.content.TabContentManager",
"org.chromium.chrome.browser.li... | import android.app.Activity; import android.view.ViewGroup; import androidx.annotation.NonNull; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.browser_controls.BrowserControlsStateProvider; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher; import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.tabmodel.TabCreatorManager; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.components.browser_ui.widget.MenuOrKeyboardActionController; import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator; | import android.app.*; import android.view.*; import androidx.annotation.*; import org.chromium.base.supplier.*; import org.chromium.chrome.browser.browser_controls.*; import org.chromium.chrome.browser.compositor.layouts.content.*; import org.chromium.chrome.browser.lifecycle.*; import org.chromium.chrome.browser.multiwindow.*; import org.chromium.chrome.browser.share.*; import org.chromium.chrome.browser.tabmodel.*; import org.chromium.components.browser_ui.widget.*; import org.chromium.components.browser_ui.widget.scrim.*; | [
"android.app",
"android.view",
"androidx.annotation",
"org.chromium.base",
"org.chromium.chrome",
"org.chromium.components"
] | android.app; android.view; androidx.annotation; org.chromium.base; org.chromium.chrome; org.chromium.components; | 2,109,483 |
public DocumentMutation set(@NonNullable FieldPath path, float f); | DocumentMutation function(@NonNullable FieldPath path, float f); | /**
* Sets the field at the given FieldPath to the specified {@code float} value.
*
* @param path path of the field that needs to be updated
* @param f the new value to set at the FieldPath
* @return {@code this} for chained invocation
*/ | Sets the field at the given FieldPath to the specified float value | set | {
"repo_name": "ojai/ojai",
"path": "java/core/src/main/java/org/ojai/store/DocumentMutation.java",
"license": "apache-2.0",
"size": 47815
} | [
"org.ojai.FieldPath",
"org.ojai.annotation.API"
] | import org.ojai.FieldPath; import org.ojai.annotation.API; | import org.ojai.*; import org.ojai.annotation.*; | [
"org.ojai",
"org.ojai.annotation"
] | org.ojai; org.ojai.annotation; | 2,771,473 |
void close() throws IOException
{
stream.close();
} | void close() throws IOException { stream.close(); } | /**
* Closes the file item.
*
* @throws IOException
* An I/O error occurred.
*/ | Closes the file item | close | {
"repo_name": "martin-g/wicket-osgi",
"path": "wicket-util/src/main/java/org/apache/wicket/util/upload/FileUploadBase.java",
"license": "apache-2.0",
"size": 33050
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,524,435 |
@Test(expected = ExecutionException.class)
public void alterTableNotSupportedTest() throws Exception {
TableName tableName = new TableName(CATALOG, TABLE);
AlterOptions alterOptions = new AlterOptions(AlterOperation.DROP_COLUMN, null, null);
decisionMetadataEngine.alterTable(tableName, alterOptions, connection);
} | @Test(expected = ExecutionException.class) void function() throws Exception { TableName tableName = new TableName(CATALOG, TABLE); AlterOptions alterOptions = new AlterOptions(AlterOperation.DROP_COLUMN, null, null); decisionMetadataEngine.alterTable(tableName, alterOptions, connection); } | /**
* Method: alterTableNotSupportedTest(TableMetadata streamMetadata, Connection<IStratioStreamingAPI> connection)
*/ | Method: alterTableNotSupportedTest(TableMetadata streamMetadata, Connection connection) | alterTableNotSupportedTest | {
"repo_name": "Stratio/stratio-connector-decision",
"path": "connector-decision/src/test/java/com/stratio/connector/decision/core/engine/DecisionMetadataEngineTest.java",
"license": "apache-2.0",
"size": 6913
} | [
"com.stratio.crossdata.common.data.AlterOperation",
"com.stratio.crossdata.common.data.AlterOptions",
"com.stratio.crossdata.common.data.TableName",
"com.stratio.crossdata.common.exceptions.ExecutionException",
"org.junit.Test"
] | import com.stratio.crossdata.common.data.AlterOperation; import com.stratio.crossdata.common.data.AlterOptions; import com.stratio.crossdata.common.data.TableName; import com.stratio.crossdata.common.exceptions.ExecutionException; import org.junit.Test; | import com.stratio.crossdata.common.data.*; import com.stratio.crossdata.common.exceptions.*; import org.junit.*; | [
"com.stratio.crossdata",
"org.junit"
] | com.stratio.crossdata; org.junit; | 2,097,562 |
@Test
public void testQueryConsistency() {
GraknGraph graph = SNBGraph.getGraph();
QueryBuilder qb = graph.graql();
Reasoner reasoner = new Reasoner(graph);
String queryString = "match $x isa person; $y isa place; ($x, $y) isa resides;" +
"$z isa person;$z has name 'Miguel Gonzalez'; ($x, $z) isa knows; select $x, $y;";
MatchQuery query = qb.parse(queryString);
QueryAnswers answers = new QueryAnswers(reasoner.resolve(query));
String queryString2 = "match $x isa person; $y isa person;$y has name 'Miguel Gonzalez';" +
"$z isa place; ($x, $y) isa knows; ($x, $z) isa resides; select $x, $z;";
MatchQuery query2 = qb.parse(queryString2);
Map<String, String> unifiers = new HashMap<>();
unifiers.put("z", "y");
QueryAnswers answers2 = (new QueryAnswers(reasoner.resolve(query2))).unify(unifiers);
assertEquals(answers, answers2);
} | void function() { GraknGraph graph = SNBGraph.getGraph(); QueryBuilder qb = graph.graql(); Reasoner reasoner = new Reasoner(graph); String queryString = STR + STR; MatchQuery query = qb.parse(queryString); QueryAnswers answers = new QueryAnswers(reasoner.resolve(query)); String queryString2 = STR + STR; MatchQuery query2 = qb.parse(queryString2); Map<String, String> unifiers = new HashMap<>(); unifiers.put("z", "y"); QueryAnswers answers2 = (new QueryAnswers(reasoner.resolve(query2))).unify(unifiers); assertEquals(answers, answers2); } | /**
* Tests transitivity and Bug #7416
*/ | Tests transitivity and Bug #7416 | testQueryConsistency | {
"repo_name": "fppt/mindmapsdb",
"path": "grakn-test/src/test/java/ai/grakn/test/graql/reasoner/inference/SNBInferenceTest.java",
"license": "gpl-3.0",
"size": 21843
} | [
"ai.grakn.GraknGraph",
"ai.grakn.graql.MatchQuery",
"ai.grakn.graql.QueryBuilder",
"ai.grakn.graql.Reasoner",
"ai.grakn.graql.internal.reasoner.query.QueryAnswers",
"ai.grakn.test.graql.reasoner.graphs.SNBGraph",
"java.util.HashMap",
"java.util.Map",
"org.junit.Assert"
] | import ai.grakn.GraknGraph; import ai.grakn.graql.MatchQuery; import ai.grakn.graql.QueryBuilder; import ai.grakn.graql.Reasoner; import ai.grakn.graql.internal.reasoner.query.QueryAnswers; import ai.grakn.test.graql.reasoner.graphs.SNBGraph; import java.util.HashMap; import java.util.Map; import org.junit.Assert; | import ai.grakn.*; import ai.grakn.graql.*; import ai.grakn.graql.internal.reasoner.query.*; import ai.grakn.test.graql.reasoner.graphs.*; import java.util.*; import org.junit.*; | [
"ai.grakn",
"ai.grakn.graql",
"ai.grakn.test",
"java.util",
"org.junit"
] | ai.grakn; ai.grakn.graql; ai.grakn.test; java.util; org.junit; | 44,250 |
@Override public void enterSubExpr(@NotNull IntlyParser.SubExprContext ctx) { } | @Override public void enterSubExpr(@NotNull IntlyParser.SubExprContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | exitAssignment | {
"repo_name": "johnbradley/Intly",
"path": "src/intly/parser/IntlyBaseListener.java",
"license": "bsd-2-clause",
"size": 8238
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,730,305 |
public static boolean containsOccurrences(Multiset<?> superMultiset, Multiset<?> subMultiset) {
checkNotNull(superMultiset);
checkNotNull(subMultiset);
for (Entry<?> entry : subMultiset.entrySet()) {
int superCount = superMultiset.count(entry.getElement());
if (superCount < entry.getCount()) {
return false;
}
}
return true;
} | static boolean function(Multiset<?> superMultiset, Multiset<?> subMultiset) { checkNotNull(superMultiset); checkNotNull(subMultiset); for (Entry<?> entry : subMultiset.entrySet()) { int superCount = superMultiset.count(entry.getElement()); if (superCount < entry.getCount()) { return false; } } return true; } | /**
* Returns {@code true} if {@code subMultiset.count(o) <= superMultiset.count(o)} for all {@code
* o}.
*
* @since 10.0
*/ | Returns true if subMultiset.count(o) <= superMultiset.count(o) for all o | containsOccurrences | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/guava25/collect/Multisets.java",
"license": "mit",
"size": 40326
} | [
"com.azure.cosmos.implementation.guava25.base.Preconditions",
"com.azure.cosmos.implementation.guava25.collect.Multiset"
] | import com.azure.cosmos.implementation.guava25.base.Preconditions; import com.azure.cosmos.implementation.guava25.collect.Multiset; | import com.azure.cosmos.implementation.guava25.base.*; import com.azure.cosmos.implementation.guava25.collect.*; | [
"com.azure.cosmos"
] | com.azure.cosmos; | 1,239,148 |
protected boolean onSuccess(T storedValue, Transaction jedisMulti) {
return true;
} | boolean function(T storedValue, Transaction jedisMulti) { return true; } | /**
* Define what to do if the request is successful according to the condition.
* If you do not override it, it just returns true and the request goes to the next one.
*/ | Define what to do if the request is successful according to the condition. If you do not override it, it just returns true and the request goes to the next one | onSuccess | {
"repo_name": "longcoding/undefined-gateway",
"path": "src/main/java/com/longcoding/moon/interceptors/RedisBaseValidationInterceptor.java",
"license": "mit",
"size": 3870
} | [
"redis.clients.jedis.Transaction"
] | import redis.clients.jedis.Transaction; | import redis.clients.jedis.*; | [
"redis.clients.jedis"
] | redis.clients.jedis; | 561,210 |
public Map<String, Object> getUserAttributes() {
if (this.userAttributes == null) {
this.userAttributes = new HashMap<String, Object>();
}
return this.userAttributes;
} | Map<String, Object> function() { if (this.userAttributes == null) { this.userAttributes = new HashMap<String, Object>(); } return this.userAttributes; } | /**
* Return user attributes associated with this invocation.
* This method provides an invocation-bound alternative to a ThreadLocal.
* <p>This map is initialized lazily and is not used in the AOP framework itself.
* @return any user attributes associated with this invocation
* (never {@code null})
*/ | Return user attributes associated with this invocation. This method provides an invocation-bound alternative to a ThreadLocal. This map is initialized lazily and is not used in the AOP framework itself | getUserAttributes | {
"repo_name": "leogoing/spring_jeesite",
"path": "spring-aop-4.0/org/springframework/aop/framework/ReflectiveMethodInvocation.java",
"license": "apache-2.0",
"size": 9872
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,377,520 |
public static List<NetworkRouteRs> listToObjects(List<Map<String, String[]>> maps, String nameIface) {
List<NetworkRouteRs> routes = new ArrayList<NetworkRouteRs>();
if (maps != null && maps.size()>0) {
for (Map<String, String[]> map : maps) {
NetworkRouteRs j = mapToObject(nameIface, map);
routes.add(j);
}
}
return routes;
}
| static List<NetworkRouteRs> function(List<Map<String, String[]>> maps, String nameIface) { List<NetworkRouteRs> routes = new ArrayList<NetworkRouteRs>(); if (maps != null && maps.size()>0) { for (Map<String, String[]> map : maps) { NetworkRouteRs j = mapToObject(nameIface, map); routes.add(j); } } return routes; } | /**
* Convierte una lista de mapas de networkInterfacee a objetos networkInterfacers
* @param mapNetworkInterfaces
* @return
*/ | Convierte una lista de mapas de networkInterfacee a objetos networkInterfacers | listToObjects | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "src/com/whitebearsolutions/imagine/wbsairback/rs/model/system/NetworkRouteRs.java",
"license": "apache-2.0",
"size": 4450
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 112,732 |
@Test
public void testSetWorkload_1()
throws Exception {
JobConfiguration fixture = new JobConfiguration();
fixture.setDataFileIds(new HashSet());
fixture.setVariables(new HashMap());
fixture.setJobRegions(new HashSet());
fixture.setNotifications(new HashSet());
fixture.setParent(new Workload());
Workload workload = new Workload();
fixture.setWorkload(workload);
} | void function() throws Exception { JobConfiguration fixture = new JobConfiguration(); fixture.setDataFileIds(new HashSet()); fixture.setVariables(new HashMap()); fixture.setJobRegions(new HashSet()); fixture.setNotifications(new HashSet()); fixture.setParent(new Workload()); Workload workload = new Workload(); fixture.setWorkload(workload); } | /**
* Run the void setWorkload(Workload) method test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/15/14 1:34 PM
*/ | Run the void setWorkload(Workload) method test | testSetWorkload_1 | {
"repo_name": "kevinmcgoldrick/Tank",
"path": "data_model/src/test/java/com/intuit/tank/project/JobConfigurationTest.java",
"license": "epl-1.0",
"size": 12513
} | [
"com.intuit.tank.project.JobConfiguration",
"com.intuit.tank.project.Workload",
"java.util.HashMap",
"java.util.HashSet"
] | import com.intuit.tank.project.JobConfiguration; import com.intuit.tank.project.Workload; import java.util.HashMap; import java.util.HashSet; | import com.intuit.tank.project.*; import java.util.*; | [
"com.intuit.tank",
"java.util"
] | com.intuit.tank; java.util; | 1,653,044 |
private void writeColorParams(Canvas canvas) {
if (mHSVenabled) {
canvas.drawText("H: " + Integer.toString((int)(mHSV[0] / 360.0f * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE, mText);
canvas.drawText("S: " + Integer.toString((int)(mHSV[1] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 2, mText);
canvas.drawText("V: " + Integer.toString((int)(mHSV[2] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 3, mText);
}
if (mRGBenabled) {
canvas.drawText("R: " + mRGB[0], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE, mText);
canvas.drawText("G: " + mRGB[1], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE * 2, mText);
canvas.drawText("B: " + mRGB[2], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE * 3, mText);
}
if (mYUVenabled) {
canvas.drawText("Y: " + Integer.toString((int)(mYUV[0] * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE, mText);
canvas.drawText("U: " + Integer.toString((int)((mYUV[1] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 2, mText);
canvas.drawText("V: " + Integer.toString((int)((mYUV[2] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 3, mText);
}
if (mHexenabled)
canvas.drawText("#" + mHexStr, TEXT_HEX_POS[0], TEXT_HEX_POS[1] + TEXT_SIZE, mText);
} | void function(Canvas canvas) { if (mHSVenabled) { canvas.drawText(STR + Integer.toString((int)(mHSV[0] / 360.0f * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE, mText); canvas.drawText(STR + Integer.toString((int)(mHSV[1] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 2, mText); canvas.drawText(STR + Integer.toString((int)(mHSV[2] * 255)), TEXT_HSV_POS[0], TEXT_HSV_POS[1] + TEXT_SIZE * 3, mText); } if (mRGBenabled) { canvas.drawText(STR + mRGB[0], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE, mText); canvas.drawText(STR + mRGB[1], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE * 2, mText); canvas.drawText(STR + mRGB[2], TEXT_RGB_POS[0], TEXT_RGB_POS[1] + TEXT_SIZE * 3, mText); } if (mYUVenabled) { canvas.drawText(STR + Integer.toString((int)(mYUV[0] * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE, mText); canvas.drawText(STR + Integer.toString((int)((mYUV[1] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 2, mText); canvas.drawText(STR + Integer.toString((int)((mYUV[2] + .5f) * 255)), TEXT_YUV_POS[0], TEXT_YUV_POS[1] + TEXT_SIZE * 3, mText); } if (mHexenabled) canvas.drawText("#" + mHexStr, TEXT_HEX_POS[0], TEXT_HEX_POS[1] + TEXT_SIZE, mText); } | /**
* Write the color parametes (HSV, RGB, YUV, Hex, etc.).
* @param canvas
*/ | Write the color parametes (HSV, RGB, YUV, Hex, etc.) | writeColorParams | {
"repo_name": "drelleum/vnc_android_library",
"path": "eclipse_projects/PubkeyGenerator/src/com/iiordanov/pubkeygenerator/UberColorPickerDialog.java",
"license": "gpl-3.0",
"size": 32288
} | [
"android.graphics.Canvas"
] | import android.graphics.Canvas; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,303,106 |
UpgradeStatus getStatus(Optional<DataSource> dataSource);
| UpgradeStatus getStatus(Optional<DataSource> dataSource); | /**
* Gets the current upgrade status. The non-existence of the transient table
* corresponds to {@link UpgradeStatus#NONE}.
*
* @param dataSource the dataSource to use to execute the select statement which retrieve the status.
* @return the current status.
*/ | Gets the current upgrade status. The non-existence of the transient table corresponds to <code>UpgradeStatus#NONE</code> | getStatus | {
"repo_name": "badgerwithagun/morf",
"path": "morf-core/src/main/java/org/alfasoftware/morf/upgrade/UpgradeStatusTableService.java",
"license": "apache-2.0",
"size": 4115
} | [
"java.util.Optional",
"javax.sql.DataSource"
] | import java.util.Optional; import javax.sql.DataSource; | import java.util.*; import javax.sql.*; | [
"java.util",
"javax.sql"
] | java.util; javax.sql; | 42,963 |
ServiceCall getReportAsync(final ServiceCallback<Map<String, Integer>> serviceCallback) throws IllegalArgumentException; | ServiceCall getReportAsync(final ServiceCallback<Map<String, Integer>> serviceCallback) throws IllegalArgumentException; | /**
* Get test coverage report.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link ServiceCall} object
*/ | Get test coverage report | getReportAsync | {
"repo_name": "John-Hart/autorest",
"path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/azurereport/AutoRestReportServiceForAzure.java",
"license": "mit",
"size": 3607
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback",
"java.util.Map"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 404,981 |
public static byte[] base64Decode(String string) {
if (string == null) return null;
return DatatypeConverter.parseBase64Binary(string);
} | static byte[] function(String string) { if (string == null) return null; return DatatypeConverter.parseBase64Binary(string); } | /**
* Decodes a base64-encoded string to binary data.
*
* @param string A base64-encoded string.
* @return The base64-encoded string decoded to binary data.
*/ | Decodes a base64-encoded string to binary data | base64Decode | {
"repo_name": "Permafrost/Tundra.java",
"path": "src/main/java/permafrost/tundra/lang/BytesHelper.java",
"license": "mit",
"size": 8911
} | [
"javax.xml.bind.DatatypeConverter"
] | import javax.xml.bind.DatatypeConverter; | import javax.xml.bind.*; | [
"javax.xml"
] | javax.xml; | 2,515,989 |
public List<TEntity> getList(PersistenceManagerFactory factory, String field, Object value)
throws IllegalArgumentException, IllegalStateException
{
checkNonNull(factory, "factory");
checkNonNull(field, "field");
checkNonNull(value, "value");
PersistenceManager manager = createManager(factory);
try
{
return getList(manager, field, value);
}
finally
{
manager.close();
}
} | List<TEntity> function(PersistenceManagerFactory factory, String field, Object value) throws IllegalArgumentException, IllegalStateException { checkNonNull(factory, STR); checkNonNull(field, "field"); checkNonNull(value, "value"); PersistenceManager manager = createManager(factory); try { return getList(manager, field, value); } finally { manager.close(); } } | /**
* Get entities using a condition that filters them.
*
* @param factory
* A persistence manager factory.
*
* @param field
* A database column name.
*
* @param value
* A value of the data field which filters entities.
*
* @return
* Entity list.
*
* @throws IllegalArgumentException
* {@code factory} is {@code null}, {@code field} is {@code null},
* or {@code value} is {@code null}.
*
* @throws IllegalStateException
* {@code factory.}{@link PersistenceManagerFactory#getPersistenceManager()
* getPersistenceManager()} failed.
*
* @since 1.7
*/ | Get entities using a condition that filters them | getList | {
"repo_name": "TakahikoKawasaki/nv-jdo",
"path": "src/main/java/com/neovisionaries/jdo/Dao.java",
"license": "apache-2.0",
"size": 86235
} | [
"java.util.List",
"javax.jdo.PersistenceManager",
"javax.jdo.PersistenceManagerFactory"
] | import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; | import java.util.*; import javax.jdo.*; | [
"java.util",
"javax.jdo"
] | java.util; javax.jdo; | 182,190 |
public static Drupal7SiteContext getDrupalSiteContext(Bundle savedInstanceState)
{
if (drupalSiteContext == null) {
drupalSiteContext = new Drupal7SiteContextImpl(drupalSiteUrl, "dandy");
if (savedInstanceState != null && savedInstanceState.containsKey(DRUPAL_SITE_CONTEXT_INSTANCE_STATE)) {
DrupalSiteContextInstanceState instanceState = (DrupalSiteContextInstanceState)savedInstanceState.getSerializable(DRUPAL_SITE_CONTEXT_INSTANCE_STATE);
if (instanceState != null) {
drupalSiteContext.initializeSavedState(instanceState);
}
}
}
// set the android request manager on the context
//
AndroidDrupalServicesRequestManagerImpl requestManager = new AndroidDrupalServicesRequestManagerImpl();
drupalSiteContext.setRequestManager(requestManager);
return drupalSiteContext;
} | static Drupal7SiteContext function(Bundle savedInstanceState) { if (drupalSiteContext == null) { drupalSiteContext = new Drupal7SiteContextImpl(drupalSiteUrl, "dandy"); if (savedInstanceState != null && savedInstanceState.containsKey(DRUPAL_SITE_CONTEXT_INSTANCE_STATE)) { DrupalSiteContextInstanceState instanceState = (DrupalSiteContextInstanceState)savedInstanceState.getSerializable(DRUPAL_SITE_CONTEXT_INSTANCE_STATE); if (instanceState != null) { drupalSiteContext.initializeSavedState(instanceState); } } } drupalSiteContext.setRequestManager(requestManager); return drupalSiteContext; } | /**
* provides a helper method to return a singleton of a DrupalSiteContext for use by activities
*
* @param savedInstanceState
* @return wired instance of DrupalSiteContext
*/ | provides a helper method to return a singleton of a DrupalSiteContext for use by activities | getDrupalSiteContext | {
"repo_name": "workhabitinc/dandy",
"path": "dandy-publisher/src/main/java/com/workhabit/drupal/publisher/DandyApplication.java",
"license": "gpl-2.0",
"size": 2315
} | [
"android.os.Bundle",
"org.workhabit.drupal.api.site.Drupal7SiteContext",
"org.workhabit.drupal.api.site.impl.DrupalSiteContextInstanceState",
"org.workhabit.drupal.api.site.impl.v3.Drupal7SiteContextImpl"
] | import android.os.Bundle; import org.workhabit.drupal.api.site.Drupal7SiteContext; import org.workhabit.drupal.api.site.impl.DrupalSiteContextInstanceState; import org.workhabit.drupal.api.site.impl.v3.Drupal7SiteContextImpl; | import android.os.*; import org.workhabit.drupal.api.site.*; import org.workhabit.drupal.api.site.impl.*; import org.workhabit.drupal.api.site.impl.v3.*; | [
"android.os",
"org.workhabit.drupal"
] | android.os; org.workhabit.drupal; | 500,252 |
@Override
public void setRemoveTime(Date value) {
set(8, value);
} | void function(Date value) { set(8, value); } | /**
* Setter for <code>cattle.service_expose_map.remove_time</code>.
*/ | Setter for <code>cattle.service_expose_map.remove_time</code> | setRemoveTime | {
"repo_name": "vincent99/cattle",
"path": "code/iaas/model/src/main/java/io/cattle/platform/core/model/tables/records/ServiceExposeMapRecord.java",
"license": "apache-2.0",
"size": 21690
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,473,779 |
public void cleanUpCSVReports() {
//use ChorusLapTimer directory
String path = Utils.getReportPath();
File file = new File(path);
//get date today
//TODO: check if it really works with Calendar, or use Date?
Calendar calToday = Calendar.getInstance();
long todayMillis = calToday.getTimeInMillis();
//iterate from files inside the ChorusLapTimer directory
if (file.list() != null) {
for (int i = 0; i < file.list().length; i++) {
File currFile = file.listFiles()[i];
//check difference of file.lastModified compared to date today
long diff = todayMillis - currFile.lastModified();
//convert difference to number of days
long numDays = TimeUnit.MILLISECONDS.toDays(diff);
//if number of days are 14(2 weeks), delete the file
if (numDays > 14) {
try {
currFile.delete();
} catch (Exception e) {
continue;
}
}
}
}
} | void function() { String path = Utils.getReportPath(); File file = new File(path); Calendar calToday = Calendar.getInstance(); long todayMillis = calToday.getTimeInMillis(); if (file.list() != null) { for (int i = 0; i < file.list().length; i++) { File currFile = file.listFiles()[i]; long diff = todayMillis - currFile.lastModified(); long numDays = TimeUnit.MILLISECONDS.toDays(diff); if (numDays > 14) { try { currFile.delete(); } catch (Exception e) { continue; } } } } } | /**
* This function will cleanUp CSV Reports if it has been 2 weeks since file is last updated.
*/ | This function will cleanUp CSV Reports if it has been 2 weeks since file is last updated | cleanUpCSVReports | {
"repo_name": "voroshkov/Chorus-RF-Laptimer",
"path": "Android/ChorusRFLaptimer/app/src/main/java/app/andrey_voroshkov/chorus_laptimer/MainActivity.java",
"license": "mit",
"size": 17059
} | [
"java.io.File",
"java.util.Calendar",
"java.util.concurrent.TimeUnit"
] | import java.io.File; import java.util.Calendar; import java.util.concurrent.TimeUnit; | import java.io.*; import java.util.*; import java.util.concurrent.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 359,382 |
public static boolean checkPrefixKeys(List<ExprNodeDesc> childKeys, List<ExprNodeDesc> parentKeys,
Operator<? extends OperatorDesc> childOp, Operator<? extends OperatorDesc> parentOp)
throws SemanticException {
return checkPrefixKeys(childKeys, parentKeys, childOp, parentOp, false);
} | static boolean function(List<ExprNodeDesc> childKeys, List<ExprNodeDesc> parentKeys, Operator<? extends OperatorDesc> childOp, Operator<? extends OperatorDesc> parentOp) throws SemanticException { return checkPrefixKeys(childKeys, parentKeys, childOp, parentOp, false); } | /**
* Checks whether the keys of a parent operator are a prefix of the keys of a
* child operator.
* @param childKeys keys of the child operator
* @param parentKeys keys of the parent operator
* @param childOp child operator
* @param parentOp parent operator
* @return true if the keys are a prefix, false otherwise
* @throws SemanticException
*/ | Checks whether the keys of a parent operator are a prefix of the keys of a child operator | checkPrefixKeys | {
"repo_name": "nishantmonu51/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java",
"license": "apache-2.0",
"size": 39250
} | [
"java.util.List",
"org.apache.hadoop.hive.ql.exec.Operator",
"org.apache.hadoop.hive.ql.parse.SemanticException"
] | import java.util.List; import org.apache.hadoop.hive.ql.exec.Operator; import org.apache.hadoop.hive.ql.parse.SemanticException; | import java.util.*; import org.apache.hadoop.hive.ql.exec.*; import org.apache.hadoop.hive.ql.parse.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 776,838 |
public Iterator<Quad> getObjects(final DatasetGraph dataset,
final Node subject, final Resource predicate) {
return dataset.find(ANY, subject, predicate.asNode(), ANY);
} | Iterator<Quad> function(final DatasetGraph dataset, final Node subject, final Resource predicate) { return dataset.find(ANY, subject, predicate.asNode(), ANY); } | /**
* Return an iterator of Quads that match the given subject and predicate
*
* @param dataset
* @param subject
* @param predicate
* @return
*/ | Return an iterator of Quads that match the given subject and predicate | getObjects | {
"repo_name": "barmintor/fcrepo4",
"path": "fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java",
"license": "apache-2.0",
"size": 9113
} | [
"com.hp.hpl.jena.graph.Node",
"com.hp.hpl.jena.rdf.model.Resource",
"com.hp.hpl.jena.sparql.core.DatasetGraph",
"com.hp.hpl.jena.sparql.core.Quad",
"java.util.Iterator"
] | import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.sparql.core.DatasetGraph; import com.hp.hpl.jena.sparql.core.Quad; import java.util.Iterator; | import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.rdf.model.*; import com.hp.hpl.jena.sparql.core.*; import java.util.*; | [
"com.hp.hpl",
"java.util"
] | com.hp.hpl; java.util; | 2,451,596 |
Pair<List<MarketDataValue>, Paging> getMarketDataValues(ObjectId marketDataId, PagingRequest pagingRequest); | Pair<List<MarketDataValue>, Paging> getMarketDataValues(ObjectId marketDataId, PagingRequest pagingRequest); | /**
* Gets market data values of given market data.
*
* @param marketDataId
* the object id of the market data
* @param pagingRequest
* the paging request, limiting number of market data values returned
* @return requested market data values, not null
* @throws IllegalArgumentException
* if the request is invalid
*/ | Gets market data values of given market data | getMarketDataValues | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/main/java/com/opengamma/batch/BatchMaster.java",
"license": "apache-2.0",
"size": 3364
} | [
"com.opengamma.batch.domain.MarketDataValue",
"com.opengamma.id.ObjectId",
"com.opengamma.util.paging.Paging",
"com.opengamma.util.paging.PagingRequest",
"com.opengamma.util.tuple.Pair",
"java.util.List"
] | import com.opengamma.batch.domain.MarketDataValue; import com.opengamma.id.ObjectId; import com.opengamma.util.paging.Paging; import com.opengamma.util.paging.PagingRequest; import com.opengamma.util.tuple.Pair; import java.util.List; | import com.opengamma.batch.domain.*; import com.opengamma.id.*; import com.opengamma.util.paging.*; import com.opengamma.util.tuple.*; import java.util.*; | [
"com.opengamma.batch",
"com.opengamma.id",
"com.opengamma.util",
"java.util"
] | com.opengamma.batch; com.opengamma.id; com.opengamma.util; java.util; | 1,276,022 |
public Authorization getDestinationAuthorization() {
return this.dstAuth;
} | Authorization function() { return this.dstAuth; } | /**
* Returns authorization type for
* the destination side for the url copy.
* If no authorization type is set, the default
* authorization will be performed for a given protocol.
*
* @return destination authorization type
*/ | Returns authorization type for the destination side for the url copy. If no authorization type is set, the default authorization will be performed for a given protocol | getDestinationAuthorization | {
"repo_name": "NCIP/cagrid2-wsrf",
"path": "wsrf-jglobus/src/main/java/org/globus/io/urlcopy/UrlCopy.java",
"license": "bsd-3-clause",
"size": 23113
} | [
"org.globus.gsi.gssapi.auth.Authorization"
] | import org.globus.gsi.gssapi.auth.Authorization; | import org.globus.gsi.gssapi.auth.*; | [
"org.globus.gsi"
] | org.globus.gsi; | 1,199,292 |
public static String getLocationResourcePath(URL baseURL) {
return getResourcePath(baseURL, "locations", Optional.empty());
} | static String function(URL baseURL) { return getResourcePath(baseURL, STR, Optional.empty()); } | /**
* Returns the location resource path.
*
* @param baseURL
* the base URL of the REST API server e.g. http://localhost:8080/omakase
* @return the location resource path.
*/ | Returns the location resource path | getLocationResourcePath | {
"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,862 |
private void extractEmbeddedJar(String jarPath)
throws Exception
{
// Remove leading slash if present.
jarPath = (jarPath.length() > 0) && (jarPath.charAt(0) == '/')
? jarPath.substring(1) : jarPath;
// Any embedded JAR files will be extracted to the embedded directory.
// Since embedded JAR file names may clash when extracting from multiple
// embedded JAR files, the embedded directory is per embedded JAR file.
// For backwards compatibility purposes, don't use the file cache name
// for the root bundle JAR file.
File embedDir;
if (m_legacy)
{
embedDir = new File(m_rootDir, LEGACY_EMBEDDED_DIRECTORY);
}
else
{
embedDir = new File(m_rootDir, m_file.getName() + EMBEDDED_DIRECTORY);
}
File jarFile = new File(embedDir, jarPath);
if (!BundleCache.getSecureAction().fileExists(jarFile))
{
InputStream is = null;
try
{
// Make sure class path entry is a JAR file.
ZipEntry ze = m_jarFile.getEntry(jarPath);
if (ze == null)
{
return;
}
// If the zip entry is a directory, then ignore it since
// we don't need to extact it; otherwise, it points to an
// embedded JAR file, so extract it.
else if (!ze.isDirectory())
{
// Make sure that the embedded JAR's parent directory exists;
// it may be in a sub-directory.
File jarDir = jarFile.getParentFile();
if (!BundleCache.getSecureAction().fileExists(jarDir))
{
if (!BundleCache.getSecureAction().mkdirs(jarDir))
{
throw new IOException("Unable to create embedded JAR directory.");
}
}
// Extract embedded JAR into its directory.
is = new BufferedInputStream(m_jarFile.getInputStream(ze), BundleCache.BUFSIZE);
if (is == null)
{
throw new IOException("No input stream: " + jarPath);
}
// Copy the file.
BundleCache.copyStreamToFile(is, jarFile);
}
}
finally
{
if (is != null) is.close();
}
}
}
private static class EntriesEnumeration implements Enumeration
{
private Enumeration m_enumeration = null;
public EntriesEnumeration(Enumeration enumeration)
{
m_enumeration = enumeration;
} | void function(String jarPath) throws Exception { jarPath = (jarPath.length() > 0) && (jarPath.charAt(0) == '/') ? jarPath.substring(1) : jarPath; File embedDir; if (m_legacy) { embedDir = new File(m_rootDir, LEGACY_EMBEDDED_DIRECTORY); } else { embedDir = new File(m_rootDir, m_file.getName() + EMBEDDED_DIRECTORY); } File jarFile = new File(embedDir, jarPath); if (!BundleCache.getSecureAction().fileExists(jarFile)) { InputStream is = null; try { ZipEntry ze = m_jarFile.getEntry(jarPath); if (ze == null) { return; } else if (!ze.isDirectory()) { File jarDir = jarFile.getParentFile(); if (!BundleCache.getSecureAction().fileExists(jarDir)) { if (!BundleCache.getSecureAction().mkdirs(jarDir)) { throw new IOException(STR); } } is = new BufferedInputStream(m_jarFile.getInputStream(ze), BundleCache.BUFSIZE); if (is == null) { throw new IOException(STR + jarPath); } BundleCache.copyStreamToFile(is, jarFile); } } finally { if (is != null) is.close(); } } } private static class EntriesEnumeration implements Enumeration { private Enumeration m_enumeration = null; public EntriesEnumeration(Enumeration enumeration) { m_enumeration = enumeration; } | /**
* This method extracts an embedded JAR file from the bundle's
* JAR file.
* @param id the identifier of the bundle that owns the embedded JAR file.
* @param jarPath the path to the embedded JAR file inside the bundle JAR file.
**/ | This method extracts an embedded JAR file from the bundle's JAR file | extractEmbeddedJar | {
"repo_name": "mstine/polyglot-osgi",
"path": "lib/osgi/felix/org.apache.felix.framework-1.8.1/src/main/java/org/apache/felix/framework/cache/JarContent.java",
"license": "gpl-3.0",
"size": 17400
} | [
"java.io.BufferedInputStream",
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"java.util.Enumeration",
"java.util.zip.ZipEntry"
] | import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.zip.ZipEntry; | import java.io.*; import java.util.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,353,230 |
protected Button constructClearButton() {
clearButton = new Button(message("ocs.clear"));
clearButton.setIcon(VaadinIcon.ERASER.create());
clearButton.addClickListener(this);
clearButton.setVisible(!getFormOptions().isHideClearButton());
return clearButton;
} | Button function() { clearButton = new Button(message(STR)); clearButton.setIcon(VaadinIcon.ERASER.create()); clearButton.addClickListener(this); clearButton.setVisible(!getFormOptions().isHideClearButton()); return clearButton; } | /**
* Constructs the "clear" button
*
* @return
*/ | Constructs the "clear" button | constructClearButton | {
"repo_name": "opencirclesolutions/dynamo",
"path": "dynamo-frontend/src/main/java/com/ocs/dynamo/ui/composite/form/AbstractModelBasedSearchForm.java",
"license": "apache-2.0",
"size": 17587
} | [
"com.vaadin.flow.component.button.Button",
"com.vaadin.flow.component.icon.VaadinIcon"
] | import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.icon.VaadinIcon; | import com.vaadin.flow.component.button.*; import com.vaadin.flow.component.icon.*; | [
"com.vaadin.flow"
] | com.vaadin.flow; | 2,563,885 |
private static final void addNewScope(ScopeDeclaration declaration, Class originalClass) {
int id = declaration.id();
if (ID_2_NAME.containsKey(id)) {
throw new UnexpectedException(
"ScopeDeclaration id=" + id + " at " + originalClass.getName() + " has conflict with another named " + ID_2_NAME
.get(id));
}
if (id < 0) {
throw new UnexpectedException(
"ScopeDeclaration id=" + id + " at " + originalClass.getName() + " is negative. ");
}
String name = declaration.name();
if (NAME_2_ID.containsKey(name)) {
throw new UnexpectedException(
"ScopeDeclaration fieldName=" + name + " at " + originalClass.getName() + " has conflict with another id= " + NAME_2_ID
.get(name));
}
ID_2_NAME.put(id, name);
NAME_2_ID.put(name, id);
List<ScopeDefaultColumn> scopeDefaultColumns = new ArrayList<>();
ScopeDefaultColumn.VirtualColumnDefinition virtualColumn = (ScopeDefaultColumn.VirtualColumnDefinition) originalClass
.getAnnotation(ScopeDefaultColumn.VirtualColumnDefinition.class);
if (virtualColumn != null) {
scopeDefaultColumns.add(
new ScopeDefaultColumn(virtualColumn.fieldName(), virtualColumn.columnName(), virtualColumn
.type(), virtualColumn.isID(), virtualColumn.length()));
}
Field[] scopeClassField = originalClass.getDeclaredFields();
if (scopeClassField != null) {
for (Field field : scopeClassField) {
ScopeDefaultColumn.DefinedByField definedByField = field.getAnnotation(
ScopeDefaultColumn.DefinedByField.class);
if (definedByField != null) {
if (!definedByField.requireDynamicActive() || ACTIVE_EXTRA_MODEL_COLUMNS) {
scopeDefaultColumns.add(
new ScopeDefaultColumn(
field.getName(), definedByField.columnName(), field.getType(), false,
definedByField.length()
));
}
}
}
}
SCOPE_COLUMNS.put(name, scopeDefaultColumns);
String catalogName = declaration.catalog();
switch (catalogName) {
case SERVICE_CATALOG_NAME:
SERVICE_CATALOG.put(id, Boolean.TRUE);
break;
case SERVICE_INSTANCE_CATALOG_NAME:
SERVICE_INSTANCE_CATALOG.put(id, Boolean.TRUE);
break;
case ENDPOINT_CATALOG_NAME:
ENDPOINT_CATALOG.put(id, Boolean.TRUE);
break;
case SERVICE_RELATION_CATALOG_NAME:
SERVICE_RELATION_CATALOG.put(id, Boolean.TRUE);
break;
case SERVICE_INSTANCE_RELATION_CATALOG_NAME:
SERVICE_INSTANCE_RELATION_CATALOG.put(id, Boolean.TRUE);
break;
case ENDPOINT_RELATION_CATALOG_NAME:
ENDPOINT_RELATION_CATALOG.put(id, Boolean.TRUE);
break;
case PROCESS_CATALOG_NAME:
PROCESS_CATALOG.put(id, Boolean.TRUE);
break;
}
} | static final void function(ScopeDeclaration declaration, Class originalClass) { int id = declaration.id(); if (ID_2_NAME.containsKey(id)) { throw new UnexpectedException( STR + id + STR + originalClass.getName() + STR + ID_2_NAME .get(id)); } if (id < 0) { throw new UnexpectedException( STR + id + STR + originalClass.getName() + STR); } String name = declaration.name(); if (NAME_2_ID.containsKey(name)) { throw new UnexpectedException( STR + name + STR + originalClass.getName() + STR + NAME_2_ID .get(name)); } ID_2_NAME.put(id, name); NAME_2_ID.put(name, id); List<ScopeDefaultColumn> scopeDefaultColumns = new ArrayList<>(); ScopeDefaultColumn.VirtualColumnDefinition virtualColumn = (ScopeDefaultColumn.VirtualColumnDefinition) originalClass .getAnnotation(ScopeDefaultColumn.VirtualColumnDefinition.class); if (virtualColumn != null) { scopeDefaultColumns.add( new ScopeDefaultColumn(virtualColumn.fieldName(), virtualColumn.columnName(), virtualColumn .type(), virtualColumn.isID(), virtualColumn.length())); } Field[] scopeClassField = originalClass.getDeclaredFields(); if (scopeClassField != null) { for (Field field : scopeClassField) { ScopeDefaultColumn.DefinedByField definedByField = field.getAnnotation( ScopeDefaultColumn.DefinedByField.class); if (definedByField != null) { if (!definedByField.requireDynamicActive() ACTIVE_EXTRA_MODEL_COLUMNS) { scopeDefaultColumns.add( new ScopeDefaultColumn( field.getName(), definedByField.columnName(), field.getType(), false, definedByField.length() )); } } } } SCOPE_COLUMNS.put(name, scopeDefaultColumns); String catalogName = declaration.catalog(); switch (catalogName) { case SERVICE_CATALOG_NAME: SERVICE_CATALOG.put(id, Boolean.TRUE); break; case SERVICE_INSTANCE_CATALOG_NAME: SERVICE_INSTANCE_CATALOG.put(id, Boolean.TRUE); break; case ENDPOINT_CATALOG_NAME: ENDPOINT_CATALOG.put(id, Boolean.TRUE); break; case SERVICE_RELATION_CATALOG_NAME: SERVICE_RELATION_CATALOG.put(id, Boolean.TRUE); break; case SERVICE_INSTANCE_RELATION_CATALOG_NAME: SERVICE_INSTANCE_RELATION_CATALOG.put(id, Boolean.TRUE); break; case ENDPOINT_RELATION_CATALOG_NAME: ENDPOINT_RELATION_CATALOG.put(id, Boolean.TRUE); break; case PROCESS_CATALOG_NAME: PROCESS_CATALOG.put(id, Boolean.TRUE); break; } } | /**
* Add a new scope based on the scan result
*
* @param declaration includes the definition.
* @param originalClass represents the class having the {@link ScopeDeclaration} annotation
*/ | Add a new scope based on the scan result | addNewScope | {
"repo_name": "apache/skywalking",
"path": "oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java",
"license": "apache-2.0",
"size": 14840
} | [
"java.lang.reflect.Field",
"java.util.ArrayList",
"java.util.List",
"org.apache.skywalking.oap.server.core.UnexpectedException"
] | import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import org.apache.skywalking.oap.server.core.UnexpectedException; | import java.lang.reflect.*; import java.util.*; import org.apache.skywalking.oap.server.core.*; | [
"java.lang",
"java.util",
"org.apache.skywalking"
] | java.lang; java.util; org.apache.skywalking; | 648,262 |
@Override
public double getReplenishmentValue(int functionIndex, ExampleSet exampleSet, Attribute attribute)
throws UndefinedParameterError {
int chosen = getParameterAsInt(PARAMETER_REPLENISHMENT_WHAT);
switch (functionIndex) {
case NONE:
return Double.POSITIVE_INFINITY;
case ZERO:
return 0.0;
case MAX_BYTE:
return (chosen == 0) ? Byte.MAX_VALUE : Byte.MIN_VALUE;
case MAX_INT:
return (chosen == 0) ? Integer.MAX_VALUE : Integer.MIN_VALUE;
case MAX_DOUBLE:
return (chosen == 0) ? Double.MAX_VALUE : -Double.MAX_VALUE;
case MISSING:
return Double.NaN;
case VALUE:
return getParameterAsDouble(PARAMETER_REPLENISHMENT_VALUE);
default:
throw new RuntimeException("Illegal value functionIndex: " + functionIndex);
}
}
| double function(int functionIndex, ExampleSet exampleSet, Attribute attribute) throws UndefinedParameterError { int chosen = getParameterAsInt(PARAMETER_REPLENISHMENT_WHAT); switch (functionIndex) { case NONE: return Double.POSITIVE_INFINITY; case ZERO: return 0.0; case MAX_BYTE: return (chosen == 0) ? Byte.MAX_VALUE : Byte.MIN_VALUE; case MAX_INT: return (chosen == 0) ? Integer.MAX_VALUE : Integer.MIN_VALUE; case MAX_DOUBLE: return (chosen == 0) ? Double.MAX_VALUE : -Double.MAX_VALUE; case MISSING: return Double.NaN; case VALUE: return getParameterAsDouble(PARAMETER_REPLENISHMENT_VALUE); default: throw new RuntimeException(STR + functionIndex); } } | /**
* Replaces the values
*
* @throws UndefinedParameterError
*/ | Replaces the values | getReplenishmentValue | {
"repo_name": "aborg0/rapidminer-studio",
"path": "src/main/java/com/rapidminer/operator/preprocessing/filter/InfiniteValueReplenishment.java",
"license": "agpl-3.0",
"size": 6402
} | [
"com.rapidminer.example.Attribute",
"com.rapidminer.example.ExampleSet",
"com.rapidminer.parameter.UndefinedParameterError"
] | import com.rapidminer.example.Attribute; import com.rapidminer.example.ExampleSet; import com.rapidminer.parameter.UndefinedParameterError; | import com.rapidminer.example.*; import com.rapidminer.parameter.*; | [
"com.rapidminer.example",
"com.rapidminer.parameter"
] | com.rapidminer.example; com.rapidminer.parameter; | 1,917,577 |
public TrafficSelector meta() {
return meta;
} | TrafficSelector function() { return meta; } | /**
* Gets metadata information in this PortNextObjectiveStoreKey.
*
* @return meta information
*/ | Gets metadata information in this PortNextObjectiveStoreKey | meta | {
"repo_name": "kuujo/onos",
"path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/storekey/PortNextObjectiveStoreKey.java",
"license": "apache-2.0",
"size": 3490
} | [
"org.onosproject.net.flow.TrafficSelector"
] | import org.onosproject.net.flow.TrafficSelector; | import org.onosproject.net.flow.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 1,845,222 |
private static CreditCurveIdentifier getCreditCurveIdentifier(final CreditDefaultSwapSecurity security, final String name) {
final CreditCurveIdentifier curveIdentifier = CreditCurveIdentifier.of(name + security.getReferenceEntity().getValue(), security.getNotional().getCurrency(),
security.getDebtSeniority().toString(), security.getRestructuringClause().toString());
return curveIdentifier;
} | static CreditCurveIdentifier function(final CreditDefaultSwapSecurity security, final String name) { final CreditCurveIdentifier curveIdentifier = CreditCurveIdentifier.of(name + security.getReferenceEntity().getValue(), security.getNotional().getCurrency(), security.getDebtSeniority().toString(), security.getRestructuringClause().toString()); return curveIdentifier; } | /**
* Get the CreditCurveIdentifier with name appended
*
* @param security
*/ | Get the CreditCurveIdentifier with name appended | getCreditCurveIdentifier | {
"repo_name": "DevStreet/FinanceAnalytics",
"path": "projects/OG-Financial/src/main/java/com/opengamma/financial/analytics/model/credit/isdanew/ISDACompliantCDSFunction.java",
"license": "apache-2.0",
"size": 27556
} | [
"com.opengamma.financial.security.cds.CreditDefaultSwapSecurity",
"com.opengamma.util.credit.CreditCurveIdentifier"
] | import com.opengamma.financial.security.cds.CreditDefaultSwapSecurity; import com.opengamma.util.credit.CreditCurveIdentifier; | import com.opengamma.financial.security.cds.*; import com.opengamma.util.credit.*; | [
"com.opengamma.financial",
"com.opengamma.util"
] | com.opengamma.financial; com.opengamma.util; | 174,978 |
public OVarType getFaultType(){
return _faultVarType;
} | OVarType function(){ return _faultVarType; } | /**
* The message type of the fault message data. Null if no fault data.
* @return fault type
*/ | The message type of the fault message data. Null if no fault data | getFaultType | {
"repo_name": "matthieu/apache-ode",
"path": "runtimes/src/main/java/org/apache/ode/bpel/rtrep/v1/channels/FaultData.java",
"license": "apache-2.0",
"size": 3660
} | [
"org.apache.ode.bpel.rtrep.v1.OVarType"
] | import org.apache.ode.bpel.rtrep.v1.OVarType; | import org.apache.ode.bpel.rtrep.v1.*; | [
"org.apache.ode"
] | org.apache.ode; | 1,118,428 |
public final void testAllExamples() {
log.info("Start testing Java examples...");
// describe all AMIs
List<Image> allImages = DescribeImagesExample.describeAllImages();
if (null == allImages || allImages.size() == 0) {
Assert.fail("No AMI defined in aws-mock!");
}
// pick the first AMI and run 10 instances based on it
String imageId = allImages.get(0).getImageId();
final int runCount = 10;
List<Instance> exampleInstances = RunInstancesExample.runInstances(imageId, runCount);
// check if all of the 10 new instances are there
Assert.assertTrue("Actual started instance count (" + exampleInstances.size() + ") does not equal to runCount("
+ runCount + ").",
exampleInstances.size() == runCount);
// get max boot time for each instance (in seconds), from properties
int maxBootSeconds = Integer.parseInt(PropertiesUtils.getProperty("instance.max.boot.time.seconds"));
// sleep for at least such a time of max boot seconds
try {
Thread.sleep((maxBootSeconds + 1) * ONE_SECOND_IN_MILLSECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
// then check if the 10 new instances are all turned into 'running'
List<String> exampleInstanceIDs = new ArrayList<String>();
for (Instance inst : exampleInstances) {
exampleInstanceIDs.add(inst.getInstanceId());
}
// now we describe our 10 instances again, and assert all of them should be running now
exampleInstances = DescribeInstancesExample.describeInstances(exampleInstanceIDs);
for (Instance inst : exampleInstances) {
Assert.assertTrue("Instance state did not turn to 'running' after " + maxBootSeconds + " seconds.",
InstanceState.RUNNING.getName().equals(inst.getState().getName()));
}
// pick one of the example instances, for testing stop, start and terminate
String exampleInstanceID = exampleInstanceIDs.get(0);
// stop the instance
List<InstanceStateChange> instanceStateChanges = StopInstancesExample.stopInstances(Arrays
.asList(exampleInstanceID));
Assert.assertTrue(
"Wrong state change count found on stopping! expected 1, found " + instanceStateChanges.size(),
1 == instanceStateChanges.size());
Assert.assertTrue(
"Wrong previous state before change! expected 'running', found "
+ instanceStateChanges.get(0).getPreviousState().getName(), instanceStateChanges.get(0)
.getPreviousState().getName().equals(InstanceState.RUNNING.getName()));
Assert.assertTrue(
"Wrong current state before change! expected 'stopping', found "
+ instanceStateChanges.get(0).getCurrentState().getName(), instanceStateChanges.get(0)
.getCurrentState().getName().equals(InstanceState.STOPPING.getName()));
// get max shutdown time for each instance (in seconds), from properties
int maxShutdownSeconds = Integer.parseInt(PropertiesUtils.getProperty("instance.max.shutdown.time.seconds"));
// sleep for at least such a time of max shutdown seconds
try {
Thread.sleep((maxShutdownSeconds + 1) * ONE_SECOND_IN_MILLSECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
// describe that instance again
exampleInstances = DescribeInstancesExample.describeInstances(Arrays.asList(exampleInstanceID));
// check if it is stopped now
Assert.assertTrue("Instance state should be stopped now, but found "
+ exampleInstances.get(0).getState().getName(),
InstanceState.STOPPED.getName().equals(exampleInstances.get(0).getState().getName()));
// terminate all the 10 example instances
instanceStateChanges = TerminateInstancesExample.terminateInstances(exampleInstanceIDs);
Assert.assertTrue(
"Wrong state change count found on stopping! expected 10, found " + instanceStateChanges.size(),
runCount == instanceStateChanges.size());
// check if all 10 instances' states are changed to 'terminated'
for (InstanceStateChange stateChange : instanceStateChanges) {
Assert.assertTrue("Wrong current state after terminataion, expected terminated, found "
+ stateChange.getCurrentState().getName() + " - instanceID: " + stateChange.getInstanceId(),
InstanceState.TERMINATED.getName().equals(stateChange.getCurrentState().getName()));
}
// describe those 10 instance again
exampleInstances = DescribeInstancesExample.describeInstances(exampleInstanceIDs);
// check again if all of them are terminated
for (Instance inst : exampleInstances) {
Assert.assertTrue("Wrong state described after terminataion, expected terminated, found "
+ inst.getState().getName() + " - instanceID: " + inst.getInstanceId(),
InstanceState.TERMINATED.getName().equals(inst.getState().getName()));
}
log.info("Tests for Java examples passed.");
} | final void function() { log.info(STR); List<Image> allImages = DescribeImagesExample.describeAllImages(); if (null == allImages allImages.size() == 0) { Assert.fail(STR); } String imageId = allImages.get(0).getImageId(); final int runCount = 10; List<Instance> exampleInstances = RunInstancesExample.runInstances(imageId, runCount); Assert.assertTrue(STR + exampleInstances.size() + STR + runCount + ").", exampleInstances.size() == runCount); int maxBootSeconds = Integer.parseInt(PropertiesUtils.getProperty(STR)); try { Thread.sleep((maxBootSeconds + 1) * ONE_SECOND_IN_MILLSECONDS); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } List<String> exampleInstanceIDs = new ArrayList<String>(); for (Instance inst : exampleInstances) { exampleInstanceIDs.add(inst.getInstanceId()); } exampleInstances = DescribeInstancesExample.describeInstances(exampleInstanceIDs); for (Instance inst : exampleInstances) { Assert.assertTrue(STR + maxBootSeconds + STR, InstanceState.RUNNING.getName().equals(inst.getState().getName())); } String exampleInstanceID = exampleInstanceIDs.get(0); List<InstanceStateChange> instanceStateChanges = StopInstancesExample.stopInstances(Arrays .asList(exampleInstanceID)); Assert.assertTrue( STR + instanceStateChanges.size(), 1 == instanceStateChanges.size()); Assert.assertTrue( STR + instanceStateChanges.get(0).getPreviousState().getName(), instanceStateChanges.get(0) .getPreviousState().getName().equals(InstanceState.RUNNING.getName())); Assert.assertTrue( STR + instanceStateChanges.get(0).getCurrentState().getName(), instanceStateChanges.get(0) .getCurrentState().getName().equals(InstanceState.STOPPING.getName())); int maxShutdownSeconds = Integer.parseInt(PropertiesUtils.getProperty(STR)); try { Thread.sleep((maxShutdownSeconds + 1) * ONE_SECOND_IN_MILLSECONDS); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } exampleInstances = DescribeInstancesExample.describeInstances(Arrays.asList(exampleInstanceID)); Assert.assertTrue(STR + exampleInstances.get(0).getState().getName(), InstanceState.STOPPED.getName().equals(exampleInstances.get(0).getState().getName())); instanceStateChanges = TerminateInstancesExample.terminateInstances(exampleInstanceIDs); Assert.assertTrue( STR + instanceStateChanges.size(), runCount == instanceStateChanges.size()); for (InstanceStateChange stateChange : instanceStateChanges) { Assert.assertTrue(STR + stateChange.getCurrentState().getName() + STR + stateChange.getInstanceId(), InstanceState.TERMINATED.getName().equals(stateChange.getCurrentState().getName())); } exampleInstances = DescribeInstancesExample.describeInstances(exampleInstanceIDs); for (Instance inst : exampleInstances) { Assert.assertTrue(STR + inst.getState().getName() + STR + inst.getInstanceId(), InstanceState.TERMINATED.getName().equals(inst.getState().getName())); } log.info(STR); } | /**
* Tests that describeImages and run,describe,stop,start and terminate instances.
*/ | Tests that describeImages and run,describe,stop,start and terminate instances | testAllExamples | {
"repo_name": "dadoonet/aws-mock",
"path": "example/java/test/TestExamples.java",
"license": "mit",
"size": 6472
} | [
"com.amazonaws.services.ec2.model.Image",
"com.amazonaws.services.ec2.model.Instance",
"com.amazonaws.services.ec2.model.InstanceStateChange",
"com.tlswe.awsmock.common.util.PropertiesUtils",
"com.tlswe.awsmock.ec2.model.AbstractMockEc2Instance",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.L... | import com.amazonaws.services.ec2.model.Image; import com.amazonaws.services.ec2.model.Instance; import com.amazonaws.services.ec2.model.InstanceStateChange; import com.tlswe.awsmock.common.util.PropertiesUtils; import com.tlswe.awsmock.ec2.model.AbstractMockEc2Instance; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.Assert; | import com.amazonaws.services.ec2.model.*; import com.tlswe.awsmock.common.util.*; import com.tlswe.awsmock.ec2.model.*; import java.util.*; import junit.framework.*; | [
"com.amazonaws.services",
"com.tlswe.awsmock",
"java.util",
"junit.framework"
] | com.amazonaws.services; com.tlswe.awsmock; java.util; junit.framework; | 643,094 |
in.ensure(MVCC_VERSION_SIZE);
long coordVer = in.readLong();
long cntr = in.readLong();
int opCntr = in.readInt();
return new MvccVersionImpl(coordVer, cntr, opCntr);
} | in.ensure(MVCC_VERSION_SIZE); long coordVer = in.readLong(); long cntr = in.readLong(); int opCntr = in.readInt(); return new MvccVersionImpl(coordVer, cntr, opCntr); } | /**
* Reads {@link MvccVersion} from given input.
*
* @param in Data input to read from.
* @return Mvcc version.
*/ | Reads <code>MvccVersion</code> from given input | readMvccVersion | {
"repo_name": "ptupitsyn/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/serializer/TxRecordSerializer.java",
"license": "apache-2.0",
"size": 8880
} | [
"org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl"
] | import org.apache.ignite.internal.processors.cache.mvcc.MvccVersionImpl; | import org.apache.ignite.internal.processors.cache.mvcc.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,493,953 |
private void add(Field f) {
m_fields.put(f.name(), f);
m_doc.add(f);
} | void function(Field f) { m_fields.put(f.name(), f); m_doc.add(f); } | /**
* Adds a field to this document.<p>
*
* @param f the field to add
*/ | Adds a field to this document | add | {
"repo_name": "ggiudetti/opencms-core",
"path": "src/org/opencms/search/CmsLuceneDocument.java",
"license": "lgpl-2.1",
"size": 14629
} | [
"org.apache.lucene.document.Field"
] | import org.apache.lucene.document.Field; | import org.apache.lucene.document.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 918,165 |
public Value die(String msg)
{
try {
getOut().print(msg);
} catch (IOException e) {
log.log(Level.WARNING, e.toString(), e);
}
throw new QuercusDieException(msg);
} | Value function(String msg) { try { getOut().print(msg); } catch (IOException e) { log.log(Level.WARNING, e.toString(), e); } throw new QuercusDieException(msg); } | /**
* Handles exit/die
*/ | Handles exit/die | die | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/quercus/env/Env.java",
"license": "gpl-2.0",
"size": 161703
} | [
"com.caucho.quercus.QuercusDieException",
"java.io.IOException",
"java.util.logging.Level"
] | import com.caucho.quercus.QuercusDieException; import java.io.IOException; import java.util.logging.Level; | import com.caucho.quercus.*; import java.io.*; import java.util.logging.*; | [
"com.caucho.quercus",
"java.io",
"java.util"
] | com.caucho.quercus; java.io; java.util; | 246,761 |
public static String format(long sysTime) {
return LONG_DATE_FMT.format(Instant.ofEpochMilli(sysTime));
} | static String function(long sysTime) { return LONG_DATE_FMT.format(Instant.ofEpochMilli(sysTime)); } | /**
* Formats system time in milliseconds for printing in logs.
*
* @param sysTime System time.
* @return Formatted time string.
*/ | Formats system time in milliseconds for printing in logs | format | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 388551
} | [
"java.time.Instant"
] | import java.time.Instant; | import java.time.*; | [
"java.time"
] | java.time; | 1,549,619 |
@Deprecated
public static ClassLoader privilegedGetClassLoaderForClass(final Class clazz) {
try{
return AccessController.doPrivileged(new PrivilegedGetClassLoaderForClass(clazz));
}catch (PrivilegedActionException ex){
throw (RuntimeException) ex.getCause();
}
} | static ClassLoader function(final Class clazz) { try{ return AccessController.doPrivileged(new PrivilegedGetClassLoaderForClass(clazz)); }catch (PrivilegedActionException ex){ throw (RuntimeException) ex.getCause(); } } | /**
* Gets the class loader for a given class. Wraps the call in a privileged block if necessary
* @deprecated Will be removed in next version.
*/ | Gets the class loader for a given class. Wraps the call in a privileged block if necessary | privilegedGetClassLoaderForClass | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/security/PrivilegedAccessHelper.java",
"license": "epl-1.0",
"size": 26787
} | [
"java.security.AccessController",
"java.security.PrivilegedActionException"
] | import java.security.AccessController; import java.security.PrivilegedActionException; | import java.security.*; | [
"java.security"
] | java.security; | 1,001,452 |
long readInt64() throws IOException; | long readInt64() throws IOException; | /**
* Read an int64.
*
* @return the value
*/ | Read an int64 | readInt64 | {
"repo_name": "jdubrule/bond",
"path": "java/core/src/main/java/org/bondlib/TaggedProtocolReader.java",
"license": "mit",
"size": 4345
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,870,953 |
public Date getUserBirthDate() {
if (getIdentity()!=null) {
return getIdentity().getBirthDate();
}
return new Date();
} | Date function() { if (getIdentity()!=null) { return getIdentity().getBirthDate(); } return new Date(); } | /**
* <<Transient>> Safe user birth date.
*/ | > Safe user birth date | getUserBirthDate | {
"repo_name": "iservport/helianto",
"path": "helianto-core/src/main/java/org/helianto/user/domain/User.java",
"license": "apache-2.0",
"size": 12348
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,266,199 |
@Variability(id = AnnotationConstants.MONITOR_VALUES)
@Override
public void notifyValueChange(String recId,
String newValue) {
notifyValueChange(recId, ValueType.STRING, newValue);
}
| @Variability(id = AnnotationConstants.MONITOR_VALUES) void function(String recId, String newValue) { notifyValueChange(recId, ValueType.STRING, newValue); } | /**
* Notifies the recorder about a changing value. [Java call, native call]
*
* @param recId the recorder id (optional, may be <b>null</b>)
* @param newValue the value after the value change
*
* @since 1.00
*/ | Notifies the recorder about a changing value. [Java call, native call] | notifyValueChange | {
"repo_name": "SSEHUB/spassMeter",
"path": "Instrumentation.ex/src/de/uni_hildesheim/sse/monitoring/runtime/recording/Recorder.java",
"license": "apache-2.0",
"size": 53045
} | [
"de.uni_hildesheim.sse.codeEraser.annotations.Variability",
"de.uni_hildesheim.sse.monitoring.runtime.AnnotationConstants",
"de.uni_hildesheim.sse.monitoring.runtime.plugins.ValueType"
] | import de.uni_hildesheim.sse.codeEraser.annotations.Variability; import de.uni_hildesheim.sse.monitoring.runtime.AnnotationConstants; import de.uni_hildesheim.sse.monitoring.runtime.plugins.ValueType; | import de.uni_hildesheim.sse.*; import de.uni_hildesheim.sse.monitoring.runtime.*; import de.uni_hildesheim.sse.monitoring.runtime.plugins.*; | [
"de.uni_hildesheim.sse"
] | de.uni_hildesheim.sse; | 2,028,757 |
// TODO: this should specify paths as Strings rather than as Files
public static void deleteContents(File dir) throws IOException {
File[] files = dir.listFiles();
if (files == null) {
throw new IllegalArgumentException("not a directory: " + dir);
}
for (File file : files) {
if (file.isDirectory()) {
deleteContents(file);
}
if (!file.delete()) {
throw new IOException("failed to delete file: " + file);
}
}
} | static void function(File dir) throws IOException { File[] files = dir.listFiles(); if (files == null) { throw new IllegalArgumentException(STR + dir); } for (File file : files) { if (file.isDirectory()) { deleteContents(file); } if (!file.delete()) { throw new IOException(STR + file); } } } | /**
* Recursively delete everything in {@code dir}.
*/ | Recursively delete everything in dir | deleteContents | {
"repo_name": "RyanTech/Forkids",
"path": "com.xlg.library/src/com/xlg/library/imageutility/DiskLruCache.java",
"license": "apache-2.0",
"size": 33908
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 516,893 |
@Override public void exitCompDimMathMeasureAtom(@NotNull QueryGrammarParser.CompDimMathMeasureAtomContext ctx) { } | @Override public void exitCompDimMathMeasureAtom(@NotNull QueryGrammarParser.CompDimMathMeasureAtomContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterCompDimMathMeasureAtom | {
"repo_name": "pmeisen/dis-timeintervaldataanalyzer",
"path": "src/net/meisen/dissertation/impl/parser/query/generated/QueryGrammarBaseListener.java",
"license": "bsd-3-clause",
"size": 33327
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,760,900 |
// [START translate_list_codes_beta]
static SupportedLanguages listSupportedLanguages(String projectId, String location) {
try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {
LocationName locationName =
LocationName.newBuilder().setProject(projectId).setLocation(location).build();
GetSupportedLanguagesRequest getSupportedLanguagesRequest =
GetSupportedLanguagesRequest.newBuilder().setParent(locationName.toString()).build();
// Call the API
ApiFuture<SupportedLanguages> future =
translationServiceClient
.getSupportedLanguagesCallable()
.futureCall(getSupportedLanguagesRequest);
SupportedLanguages response = future.get();
List<SupportedLanguage> languages = response.getLanguagesList();
for (SupportedLanguage language : languages) {
System.out.printf("Code: %s\n", language.getLanguageCode());
}
return response;
} catch (Exception e) {
throw new RuntimeException("Couldn't create client.", e);
}
}
// [END translate_list_codes_beta] | static SupportedLanguages listSupportedLanguages(String projectId, String location) { try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) { LocationName locationName = LocationName.newBuilder().setProject(projectId).setLocation(location).build(); GetSupportedLanguagesRequest getSupportedLanguagesRequest = GetSupportedLanguagesRequest.newBuilder().setParent(locationName.toString()).build(); ApiFuture<SupportedLanguages> future = translationServiceClient .getSupportedLanguagesCallable() .futureCall(getSupportedLanguagesRequest); SupportedLanguages response = future.get(); List<SupportedLanguage> languages = response.getLanguagesList(); for (SupportedLanguage language : languages) { System.out.printf(STR, language.getLanguageCode()); } return response; } catch (Exception e) { throw new RuntimeException(STR, e); } } | /**
* Lists all the supported language codes.
*
* @param projectId - Id of the project.
* @param location - location name.
*/ | Lists all the supported language codes | listSupportedLanguages | {
"repo_name": "googleapis/google-cloud-java",
"path": "google-cloud-examples/src/main/java/com/google/cloud/examples/translate/snippets/TranslateSnippetsBeta.java",
"license": "apache-2.0",
"size": 17424
} | [
"com.google.api.core.ApiFuture",
"com.google.cloud.translate.v3beta1.GetSupportedLanguagesRequest",
"com.google.cloud.translate.v3beta1.LocationName",
"com.google.cloud.translate.v3beta1.SupportedLanguage",
"com.google.cloud.translate.v3beta1.SupportedLanguages",
"com.google.cloud.translate.v3beta1.Transl... | import com.google.api.core.ApiFuture; import com.google.cloud.translate.v3beta1.GetSupportedLanguagesRequest; import com.google.cloud.translate.v3beta1.LocationName; import com.google.cloud.translate.v3beta1.SupportedLanguage; import com.google.cloud.translate.v3beta1.SupportedLanguages; import com.google.cloud.translate.v3beta1.TranslationServiceClient; import java.util.List; | import com.google.api.core.*; import com.google.cloud.translate.v3beta1.*; import java.util.*; | [
"com.google.api",
"com.google.cloud",
"java.util"
] | com.google.api; com.google.cloud; java.util; | 2,539,979 |
public boolean add(boolean repeatDaily, String alarmTitle, String alarmSubTitle, String alarmTicker,
String alarmId, Calendar cal) {
final long triggerTime = cal.getTimeInMillis();
final String recurring = repeatDaily ? "daily" : "onetime";
Log.d(PLUGIN_NAME, "Adding " + recurring + " notification: '" + alarmTitle + alarmSubTitle + "' with id: "
+ alarmId + " at timestamp: " + triggerTime);
boolean result = alarm.addAlarm(repeatDaily, alarmTitle, alarmSubTitle, alarmTicker, alarmId, cal);
if (result) {
return true;
} else {
return false;
}
} | boolean function(boolean repeatDaily, String alarmTitle, String alarmSubTitle, String alarmTicker, String alarmId, Calendar cal) { final long triggerTime = cal.getTimeInMillis(); final String recurring = repeatDaily ? "daily" : STR; Log.d(PLUGIN_NAME, STR + recurring + STR + alarmTitle + alarmSubTitle + STR + alarmId + STR + triggerTime); boolean result = alarm.addAlarm(repeatDaily, alarmTitle, alarmSubTitle, alarmTicker, alarmId, cal); if (result) { return true; } else { return false; } } | /**
* Set an alarm
*
* @param repeatDaily
* If true, the alarm interval will be set to one day.
* @param alarmTitle
* The title of the alarm as shown in the Android notification
* panel
* @param alarmSubTitle
* The subtitle of the alarm
* @param alarmId
* The unique ID of the notification
* @param cal
* A calendar object that represents the time at which the alarm
* should first be started
* @return A pluginresult.
*/ | Set an alarm | add | {
"repo_name": "jojo080889/LocalNotification",
"path": "LocalNotification.java",
"license": "mit",
"size": 6135
} | [
"android.util.Log",
"java.util.Calendar"
] | import android.util.Log; import java.util.Calendar; | import android.util.*; import java.util.*; | [
"android.util",
"java.util"
] | android.util; java.util; | 1,206,312 |
private void constructWriteHandles(){
parserWithWriteHandles.when( WEIGH_INS, new JsonWriteHandleImpl( new JsonArrayWithObjectWriteHandler(
writeModel::startWritingWeighIn, null, writeModel::startWritingWeighIns, null
) ) );
parserWithWriteHandles.when( DATE, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getDate ) ) );
parserWithWriteHandles.when( MORNING_WEIGHT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningWeight ) ) );
parserWithWriteHandles.when( MORNING_BODY_FAT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningBodyFat ) ) );
parserWithWriteHandles.when( MORNING_LEAN_MASS, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningLeanMass ) ) );
parserWithWriteHandles.when( EVENING_WEIGHT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningWeight ) ) );
parserWithWriteHandles.when( EVENING_BODY_FAT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningBodyFat ) ) );
parserWithWriteHandles.when( EVENING_LEAN_MASS, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningLeanMass ) ) );
}//End Method | void function(){ parserWithWriteHandles.when( WEIGH_INS, new JsonWriteHandleImpl( new JsonArrayWithObjectWriteHandler( writeModel::startWritingWeighIn, null, writeModel::startWritingWeighIns, null ) ) ); parserWithWriteHandles.when( DATE, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getDate ) ) ); parserWithWriteHandles.when( MORNING_WEIGHT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningWeight ) ) ); parserWithWriteHandles.when( MORNING_BODY_FAT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningBodyFat ) ) ); parserWithWriteHandles.when( MORNING_LEAN_MASS, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getMorningLeanMass ) ) ); parserWithWriteHandles.when( EVENING_WEIGHT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningWeight ) ) ); parserWithWriteHandles.when( EVENING_BODY_FAT, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningBodyFat ) ) ); parserWithWriteHandles.when( EVENING_LEAN_MASS, new JsonWriteHandleImpl( new JsonValueWriteHandler( writeModel::getEveningLeanMass ) ) ); } | /**
* Method to construct the {@link JsonParser} for writing.
*/ | Method to construct the <code>JsonParser</code> for writing | constructWriteHandles | {
"repo_name": "DanGrew/Nuts",
"path": "nuts/src/uk/dangrew/nuts/persistence/weighins/WeightRecordingPersistence.java",
"license": "apache-2.0",
"size": 6185
} | [
"uk.dangrew.jupa.json.write.handle.key.JsonArrayWithObjectWriteHandler",
"uk.dangrew.jupa.json.write.handle.key.JsonValueWriteHandler",
"uk.dangrew.jupa.json.write.handle.type.JsonWriteHandleImpl"
] | import uk.dangrew.jupa.json.write.handle.key.JsonArrayWithObjectWriteHandler; import uk.dangrew.jupa.json.write.handle.key.JsonValueWriteHandler; import uk.dangrew.jupa.json.write.handle.type.JsonWriteHandleImpl; | import uk.dangrew.jupa.json.write.handle.key.*; import uk.dangrew.jupa.json.write.handle.type.*; | [
"uk.dangrew.jupa"
] | uk.dangrew.jupa; | 246,166 |
public Map<String, Set<String>> comparePackages(User loggedInUser,
String kickstartLabel1, String kickstartLabel2) {
// Validate parameters
if (kickstartLabel1 == null) {
throw new IllegalArgumentException("kickstartLabel1 cannot be null");
}
if (kickstartLabel2 == null) {
throw new IllegalArgumentException("kickstartLabel2 cannot be null");
}
// Load the profiles and their package lists
KickstartData profile1 =
KickstartFactory.lookupKickstartDataByLabelAndOrgId(kickstartLabel1,
loggedInUser.getOrg().getId());
KickstartData profile2 =
KickstartFactory.lookupKickstartDataByLabelAndOrgId(kickstartLabel2,
loggedInUser.getOrg().getId());
// Set operations to determine deltas
Set<String> onlyInProfile1 = getPackageNamesForKS(profile1);
onlyInProfile1.removeAll(getPackageNamesForKS(profile2));
Set<String> onlyInProfile2 = getPackageNamesForKS(profile2);
onlyInProfile2.removeAll(getPackageNamesForKS(profile1));
// Package for return
Map<String, Set<String>> results = new HashMap<String, Set<String>>(2);
results.put(kickstartLabel1, onlyInProfile1);
results.put(kickstartLabel2, onlyInProfile2);
return results;
} | Map<String, Set<String>> function(User loggedInUser, String kickstartLabel1, String kickstartLabel2) { if (kickstartLabel1 == null) { throw new IllegalArgumentException(STR); } if (kickstartLabel2 == null) { throw new IllegalArgumentException(STR); } KickstartData profile1 = KickstartFactory.lookupKickstartDataByLabelAndOrgId(kickstartLabel1, loggedInUser.getOrg().getId()); KickstartData profile2 = KickstartFactory.lookupKickstartDataByLabelAndOrgId(kickstartLabel2, loggedInUser.getOrg().getId()); Set<String> onlyInProfile1 = getPackageNamesForKS(profile1); onlyInProfile1.removeAll(getPackageNamesForKS(profile2)); Set<String> onlyInProfile2 = getPackageNamesForKS(profile2); onlyInProfile2.removeAll(getPackageNamesForKS(profile1)); Map<String, Set<String>> results = new HashMap<String, Set<String>>(2); results.put(kickstartLabel1, onlyInProfile1); results.put(kickstartLabel2, onlyInProfile2); return results; } | /**
* Returns a list for each kickstart profile of package names that are present
* in that profile but not the other.
*
* @param loggedInUser The current user
* cannot be <code>null</code>
* @param kickstartLabel1 identifies a profile to be compared;
* cannot be <code>null</code>
* @param kickstartLabel2 identifies a profile to be compared;
* cannot be <code>null</code>
*
* @return map of kickstart label to a list of package names in that profile but not in
* the other; if no keys match the criteria the list will be empty
*
* @xmlrpc.doc Returns a list for each kickstart profile; each list will contain
* package names not present on the other profile.
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.param #param("string", "kickstartLabel1")
* @xmlrpc.param #param("string", "kickstartLabel2")
* @xmlrpc.returntype
* #struct("Comparison Info")
* #prop_desc("array", "kickstartLabel1", "Actual label of the first kickstart
* profile is the key into the struct")
* #array_single("string", "package name")
* #prop_desc("array", "kickstartLabel2", "Actual label of the second kickstart
* profile is the key into the struct")
* #array_single("string", "package name")
* #struct_end()
*/ | Returns a list for each kickstart profile of package names that are present in that profile but not the other | comparePackages | {
"repo_name": "lhellebr/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java",
"license": "gpl-2.0",
"size": 65872
} | [
"com.redhat.rhn.domain.kickstart.KickstartData",
"com.redhat.rhn.domain.kickstart.KickstartFactory",
"com.redhat.rhn.domain.user.User",
"java.util.HashMap",
"java.util.Map",
"java.util.Set"
] | import com.redhat.rhn.domain.kickstart.KickstartData; import com.redhat.rhn.domain.kickstart.KickstartFactory; import com.redhat.rhn.domain.user.User; import java.util.HashMap; import java.util.Map; import java.util.Set; | import com.redhat.rhn.domain.kickstart.*; import com.redhat.rhn.domain.user.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 2,484,144 |
static Class<?> comparableClassFor(Object x) {
if (x instanceof Comparable) {
Class<?> c; Type[] ts, as; Type t; ParameterizedType p;
if ((c = x.getClass()) == String.class) // bypass checks
return c;
if ((ts = c.getGenericInterfaces()) != null) {
for (int i = 0; i < ts.length; ++i) {
if (((t = ts[i]) instanceof ParameterizedType) &&
((p = (ParameterizedType)t).getRawType() ==
Comparable.class) &&
(as = p.getActualTypeArguments()) != null &&
as.length == 1 && as[0] == c) // type arg is c
return c;
}
}
}
return null;
} | static Class<?> comparableClassFor(Object x) { if (x instanceof Comparable) { Class<?> c; Type[] ts, as; Type t; ParameterizedType p; if ((c = x.getClass()) == String.class) return c; if ((ts = c.getGenericInterfaces()) != null) { for (int i = 0; i < ts.length; ++i) { if (((t = ts[i]) instanceof ParameterizedType) && ((p = (ParameterizedType)t).getRawType() == Comparable.class) && (as = p.getActualTypeArguments()) != null && as.length == 1 && as[0] == c) return c; } } } return null; } | /**
* Returns x's Class if it is of the form "class C implements
* Comparable<C>", else null.
*/ | Returns x's Class if it is of the form "class C implements Comparable", else null | comparableClassFor | {
"repo_name": "corochoone/elasticsearch",
"path": "src/main/java/jsr166e/ConcurrentHashMapV8.java",
"license": "apache-2.0",
"size": 263930
} | [
"java.lang.reflect.ParameterizedType",
"java.lang.reflect.Type"
] | import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,340,878 |
EReference getConstraintList_ConstraintSemantic(); | EReference getConstraintList_ConstraintSemantic(); | /**
* Returns the meta object for the containment reference '{@link no.hib.dpf.text.tdpf.ConstraintList#getConstraintSemantic <em>Constraint Semantic</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Constraint Semantic</em>'.
* @see no.hib.dpf.text.tdpf.ConstraintList#getConstraintSemantic()
* @see #getConstraintList()
* @generated
*/ | Returns the meta object for the containment reference '<code>no.hib.dpf.text.tdpf.ConstraintList#getConstraintSemantic Constraint Semantic</code>'. | getConstraintList_ConstraintSemantic | {
"repo_name": "fmantz/DPF_Text",
"path": "no.hib.dpf.text/src-gen/no/hib/dpf/text/tdpf/TdpfPackage.java",
"license": "epl-1.0",
"size": 84409
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 397,814 |
public boolean contains(Point p) {
if ( p == null ) {
throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
}
return contains(p.x, p.y);
} | boolean function(Point p) { if ( p == null ) { throw new IllegalArgumentException(JaiI18N.getString(STR)); } return contains(p.x, p.y); } | /**
* Returns <code>true</code> if the ROI contains a given Point.
*
* @param p A Point identifying the pixel to be queried.
* @throws IllegalArgumentException if p is null.
* @return <code>true</code> if the pixel lies within the ROI.
*/ | Returns <code>true</code> if the ROI contains a given Point | contains | {
"repo_name": "MarinnaCole/LightZone",
"path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/ROI.java",
"license": "bsd-3-clause",
"size": 37125
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,506,078 |
public BigDecimal getTrxAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TrxAmt);
if (bd == null)
return Env.ZERO;
return bd;
} | BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TrxAmt); if (bd == null) return Env.ZERO; return bd; } | /** Get Transaction Amount.
@return Amount of a transaction
*/ | Get Transaction Amount | getTrxAmt | {
"repo_name": "sumairsh/adempiere",
"path": "base/src/org/compiere/model/X_I_BankStatement.java",
"license": "gpl-2.0",
"size": 26189
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 361,086 |
private long scanHex (ScanfFormat fmt, int width)
throws IOException, IllegalArgumentException
{
if (width == -1)
{ width = 1000000000;
}
long val;
int k, i;
checkTypeAndScanPrefix (fmt, "x");
skipWhiteSpace();
if (curChar == -1)
{ throw new EOFException("EOF");
}
if (hexChars.indexOf(curChar) == -1)
{ throw new ScanfMatchException(
"Malformed hex integer");
}
val = 0;
i = 0;
while ((k=hexChars.indexOf(curChar)) != -1 && i<width)
{ if (k > 15)
{ k -= 6;
}
val = val*16+k;
consumeAndReplaceChar();
i++;
}
scanSuffix (fmt);
return val;
} | long function (ScanfFormat fmt, int width) throws IOException, IllegalArgumentException { if (width == -1) { width = 1000000000; } long val; int k, i; checkTypeAndScanPrefix (fmt, "x"); skipWhiteSpace(); if (curChar == -1) { throw new EOFException("EOF"); } if (hexChars.indexOf(curChar) == -1) { throw new ScanfMatchException( STR); } val = 0; i = 0; while ((k=hexChars.indexOf(curChar)) != -1 && i<width) { if (k > 15) { k -= 6; } val = val*16+k; consumeAndReplaceChar(); i++; } scanSuffix (fmt); return val; } | /**
* Implementing function for scanHex.
*
* @see ScanfReader#scanHex(String)
*/ | Implementing function for scanHex | scanHex | {
"repo_name": "ariesteam/thinklab",
"path": "plugins/org.integratedmodelling.thinklab.core/src/org/integratedmodelling/utils/cformat/ScanfReader.java",
"license": "gpl-3.0",
"size": 48835
} | [
"java.io.EOFException",
"java.io.IOException"
] | import java.io.EOFException; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,553,757 |
public void initialize(Context context, boolean is24HourMode, boolean hasInnerCircle,
boolean disappearsOut, int selectionDegrees, boolean isInnerCircle) {
if (mIsInitialized) {
Log.e(TAG, "This RadialSelectorView may only be initialized once.");
return;
}
Resources res = context.getResources();
int accent = res.getColor(R.color.accentColor);
mPaint.setColor(accent);
mPaint.setAntiAlias(true);
mSelectionAlpha = SELECTED_ALPHA;
// Calculate values for the circle radius size.
mIs24HourMode = is24HourMode;
if (is24HourMode) {
mCircleRadiusMultiplier = Float.parseFloat(
res.getString(R.string.circle_radius_multiplier_24HourMode));
} else {
mCircleRadiusMultiplier = Float.parseFloat(
res.getString(R.string.circle_radius_multiplier));
mAmPmCircleRadiusMultiplier =
Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
}
// Calculate values for the radius size(s) of the numbers circle(s).
mHasInnerCircle = hasInnerCircle;
if (hasInnerCircle) {
mInnerNumbersRadiusMultiplier =
Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_inner));
mOuterNumbersRadiusMultiplier =
Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_outer));
} else {
mNumbersRadiusMultiplier =
Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_normal));
}
mSelectionRadiusMultiplier =
Float.parseFloat(res.getString(R.string.selection_radius_multiplier));
// Calculate values for the transition mid-way states.
mAnimationRadiusMultiplier = 1;
mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut? -1 : 1));
mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut? 1 : -1));
mInvalidateUpdateListener = new InvalidateUpdateListener();
setSelection(selectionDegrees, isInnerCircle, false);
mIsInitialized = true;
} | void function(Context context, boolean is24HourMode, boolean hasInnerCircle, boolean disappearsOut, int selectionDegrees, boolean isInnerCircle) { if (mIsInitialized) { Log.e(TAG, STR); return; } Resources res = context.getResources(); int accent = res.getColor(R.color.accentColor); mPaint.setColor(accent); mPaint.setAntiAlias(true); mSelectionAlpha = SELECTED_ALPHA; mIs24HourMode = is24HourMode; if (is24HourMode) { mCircleRadiusMultiplier = Float.parseFloat( res.getString(R.string.circle_radius_multiplier_24HourMode)); } else { mCircleRadiusMultiplier = Float.parseFloat( res.getString(R.string.circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier)); } mHasInnerCircle = hasInnerCircle; if (hasInnerCircle) { mInnerNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_inner)); mOuterNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_outer)); } else { mNumbersRadiusMultiplier = Float.parseFloat(res.getString(R.string.numbers_radius_multiplier_normal)); } mSelectionRadiusMultiplier = Float.parseFloat(res.getString(R.string.selection_radius_multiplier)); mAnimationRadiusMultiplier = 1; mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut? -1 : 1)); mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut? 1 : -1)); mInvalidateUpdateListener = new InvalidateUpdateListener(); setSelection(selectionDegrees, isInnerCircle, false); mIsInitialized = true; } | /**
* Initialize this selector with the state of the picker.
* @param context Current context.
* @param is24HourMode Whether the selector is in 24-hour mode, which will tell us
* whether the circle's center is moved up slightly to make room for the AM/PM circles.
* @param hasInnerCircle Whether we have both an inner and an outer circle of numbers
* that may be selected. Should be true for 24-hour mode in the hours circle.
* @param disappearsOut Whether the numbers' animation will have them disappearing out
* or disappearing in.
* @param selectionDegrees The initial degrees to be selected.
* @param isInnerCircle Whether the initial selection is in the inner or outer circle.
* Will be ignored when hasInnerCircle is false.
*/ | Initialize this selector with the state of the picker | initialize | {
"repo_name": "paveldudka/NursingTimer",
"path": "app/src/main/java/trickyandroid/com/nursingtimer/widgets/timepicker/RadialSelectorView.java",
"license": "apache-2.0",
"size": 16468
} | [
"android.content.Context",
"android.content.res.Resources",
"android.util.Log"
] | import android.content.Context; import android.content.res.Resources; import android.util.Log; | import android.content.*; import android.content.res.*; import android.util.*; | [
"android.content",
"android.util"
] | android.content; android.util; | 2,035,696 |
Dashboard getWardenDashboard(PrincipalUser user);
//~ Enums ****************************************************************************************************************************************
public static enum PolicyCounter {
METRICS_PER_HOUR("warden.metrics_per_hour", 1100, POSTING, "sum", TriggerType.GREATER_THAN),
DATAPOINTS_PER_HOUR("warden.datapoints_per_hour", 11000, POSTING, "sum", TriggerType.GREATER_THAN),
MINIMUM_RESOLUTION_MS("warden.min_resolution_in_millis", 60000, POSTING, "min", TriggerType.LESS_THAN);
private final String _metricName;
private final double _defaultValue;
private final SubSystem _subSystem;
private final String _aggregator;
private final TriggerType _triggerType;
PolicyCounter(String metricName, double defaultValue, SubSystem subSystem, String aggregator, TriggerType triggerType) {
_metricName = metricName;
_defaultValue = defaultValue;
_subSystem = subSystem;
_aggregator = aggregator;
_triggerType = triggerType;
} | Dashboard getWardenDashboard(PrincipalUser user); public static enum PolicyCounter { METRICS_PER_HOUR(STR, 1100, POSTING, "sum", TriggerType.GREATER_THAN), DATAPOINTS_PER_HOUR(STR, 11000, POSTING, "sum", TriggerType.GREATER_THAN), MINIMUM_RESOLUTION_MS(STR, 60000, POSTING, "min", TriggerType.LESS_THAN); private final String _metricName; private final double _defaultValue; private final SubSystem _subSystem; private final String _aggregator; private final TriggerType _triggerType; PolicyCounter(String metricName, double defaultValue, SubSystem subSystem, String aggregator, TriggerType triggerType) { _metricName = metricName; _defaultValue = defaultValue; _subSystem = subSystem; _aggregator = aggregator; _triggerType = triggerType; } | /**
* Returns the Warden dashboard for a given user.
*
* @param user The user for which to retrieve the warden dashboard for.
*
* @return The warden dashboard for the user. Will never be null.
*/ | Returns the Warden dashboard for a given user | getWardenDashboard | {
"repo_name": "SalesforceEng/Argus",
"path": "ArgusCore/src/main/java/com/salesforce/dva/argus/service/WardenService.java",
"license": "bsd-3-clause",
"size": 10879
} | [
"com.salesforce.dva.argus.entity.Dashboard",
"com.salesforce.dva.argus.entity.PrincipalUser",
"com.salesforce.dva.argus.entity.Trigger"
] | import com.salesforce.dva.argus.entity.Dashboard; import com.salesforce.dva.argus.entity.PrincipalUser; import com.salesforce.dva.argus.entity.Trigger; | import com.salesforce.dva.argus.entity.*; | [
"com.salesforce.dva"
] | com.salesforce.dva; | 783,487 |
@Test
public void testConcurrentFileCreation() throws IOException {
Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build();
try {
FileSystem fs = cluster.getFileSystem();
Path[] p = {new Path("/foo"), new Path("/bar")};
//write 2 files at the same time
FSDataOutputStream[] out = {fs.create(p[0]), fs.create(p[1])};
int i = 0;
for(; i < 100; i++) {
out[0].write(i);
out[1].write(i);
}
out[0].close();
for(; i < 200; i++) {out[1].write(i);}
out[1].close();
//verify
FSDataInputStream[] in = {fs.open(p[0]), fs.open(p[1])};
for(i = 0; i < 100; i++) {assertEquals(i, in[0].read());}
for(i = 0; i < 200; i++) {assertEquals(i, in[1].read());}
} finally {
if (cluster != null) {cluster.shutdown();}
}
} | void function() throws IOException { Configuration conf = new HdfsConfiguration(); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build(); try { FileSystem fs = cluster.getFileSystem(); Path[] p = {new Path("/foo"), new Path("/bar")}; FSDataOutputStream[] out = {fs.create(p[0]), fs.create(p[1])}; int i = 0; for(; i < 100; i++) { out[0].write(i); out[1].write(i); } out[0].close(); for(; i < 200; i++) {out[1].write(i);} out[1].close(); FSDataInputStream[] in = {fs.open(p[0]), fs.open(p[1])}; for(i = 0; i < 100; i++) {assertEquals(i, in[0].read());} for(i = 0; i < 200; i++) {assertEquals(i, in[1].read());} } finally { if (cluster != null) {cluster.shutdown();} } } | /**
* Test creating two files at the same time.
*/ | Test creating two files at the same time | testConcurrentFileCreation | {
"repo_name": "likaiwalkman/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileCreation.java",
"license": "apache-2.0",
"size": 49089
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FSDataInputStream",
"org.apache.hadoop.fs.FSDataOutputStream",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 401,878 |
SysSystemMappingDto getDefaultMapping(UUID systemId); | SysSystemMappingDto getDefaultMapping(UUID systemId); | /**
* Returns default mapping - provisioning, identity
*
* @see #createSystem(String, boolean)
* @param systemId
* @return
*/ | Returns default mapping - provisioning, identity | getDefaultMapping | {
"repo_name": "bcvsolutions/CzechIdMng",
"path": "Realization/backend/rpt/rpt-impl/src/test/java/eu/bcvsolutions/idm/rpt/acc/TestHelper.java",
"license": "mit",
"size": 5008
} | [
"eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto"
] | import eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto; | import eu.bcvsolutions.idm.acc.dto.*; | [
"eu.bcvsolutions.idm"
] | eu.bcvsolutions.idm; | 2,397,196 |
@Before
public void setUp() throws Exception {
this.admin = TEST_UTIL.getHBaseAdmin();
long tid = System.currentTimeMillis();
tableName = TableName.valueOf("testtb-" + tid);
snapshotName = Bytes.toBytes("snaptb0-" + tid);
emptySnapshotName = Bytes.toBytes("emptySnaptb0-" + tid);
// create Table
SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
// Take an empty snapshot
admin.snapshot(emptySnapshotName, tableName);
// Add some rows
HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
// take a snapshot
admin.snapshot(snapshotName, tableName);
} | void function() throws Exception { this.admin = TEST_UTIL.getHBaseAdmin(); long tid = System.currentTimeMillis(); tableName = TableName.valueOf(STR + tid); snapshotName = Bytes.toBytes(STR + tid); emptySnapshotName = Bytes.toBytes(STR + tid); SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY); admin.snapshot(emptySnapshotName, tableName); HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName); SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY); admin.snapshot(snapshotName, tableName); } | /**
* Create a table and take a snapshot of the table used by the export test.
*/ | Create a table and take a snapshot of the table used by the export test | setUp | {
"repo_name": "throughsky/lywebank",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java",
"license": "apache-2.0",
"size": 17197
} | [
"org.apache.hadoop.hbase.TableName",
"org.apache.hadoop.hbase.client.HTable",
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.util.Bytes; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 550,720 |
private void loadFromResultSet(
final ResultSet rs,
final int i,
final Object object,
final String instanceEntityName,
final EntityKey key,
final String rowIdAlias,
final LockMode lockMode,
final Loadable rootPersister,
final SessionImplementor session)
throws SQLException, HibernateException {
final Serializable id = key.getIdentifier();
// Get the persister for the _subclass_
final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName );
if ( log.isTraceEnabled() ) {
log.trace(
"Initializing object from ResultSet: " +
MessageHelper.infoString( persister, id, getFactory() )
);
}
boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i);
// add temp entry so that the next step is circular-reference
// safe - only needed because some types don't take proper
// advantage of two-phase-load (esp. components)
TwoPhaseLoad.addUninitializedEntity(
key,
object,
persister,
lockMode,
!eagerPropertyFetch,
session
);
//This is not very nice (and quite slow):
final String[][] cols = persister == rootPersister ?
getEntityAliases()[i].getSuffixedPropertyAliases() :
getEntityAliases()[i].getSuffixedPropertyAliases(persister);
final Object[] values = persister.hydrate(
rs,
id,
object,
rootPersister,
cols,
eagerPropertyFetch,
session
);
final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null;
final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes();
if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) {
String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName();
if (ukName!=null) {
final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName);
final Type type = persister.getPropertyTypes()[index];
// polymorphism not really handled completely correctly,
// perhaps...well, actually its ok, assuming that the
// entity name used in the lookup is the same as the
// the one used here, which it will be
EntityUniqueKey euk = new EntityUniqueKey(
rootPersister.getEntityName(), //polymorphism comment above
ukName,
type.semiResolve( values[index], session, object ),
type,
session.getEntityMode(), session.getFactory()
);
session.getPersistenceContext().addEntity( euk, object );
}
}
TwoPhaseLoad.postHydrate(
persister,
id,
values,
rowId,
object,
lockMode,
!eagerPropertyFetch,
session
);
} | void function( final ResultSet rs, final int i, final Object object, final String instanceEntityName, final EntityKey key, final String rowIdAlias, final LockMode lockMode, final Loadable rootPersister, final SessionImplementor session) throws SQLException, HibernateException { final Serializable id = key.getIdentifier(); final Loadable persister = (Loadable) getFactory().getEntityPersister( instanceEntityName ); if ( log.isTraceEnabled() ) { log.trace( STR + MessageHelper.infoString( persister, id, getFactory() ) ); } boolean eagerPropertyFetch = isEagerPropertyFetchEnabled(i); TwoPhaseLoad.addUninitializedEntity( key, object, persister, lockMode, !eagerPropertyFetch, session ); final String[][] cols = persister == rootPersister ? getEntityAliases()[i].getSuffixedPropertyAliases() : getEntityAliases()[i].getSuffixedPropertyAliases(persister); final Object[] values = persister.hydrate( rs, id, object, rootPersister, cols, eagerPropertyFetch, session ); final Object rowId = persister.hasRowId() ? rs.getObject(rowIdAlias) : null; final AssociationType[] ownerAssociationTypes = getOwnerAssociationTypes(); if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) { String ukName = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName(); if (ukName!=null) { final int index = ( (UniqueKeyLoadable) persister ).getPropertyIndex(ukName); final Type type = persister.getPropertyTypes()[index]; EntityUniqueKey euk = new EntityUniqueKey( rootPersister.getEntityName(), ukName, type.semiResolve( values[index], session, object ), type, session.getEntityMode(), session.getFactory() ); session.getPersistenceContext().addEntity( euk, object ); } } TwoPhaseLoad.postHydrate( persister, id, values, rowId, object, lockMode, !eagerPropertyFetch, session ); } | /**
* Hydrate the state an object from the SQL <tt>ResultSet</tt>, into
* an array or "hydrated" values (do not resolve associations yet),
* and pass the hydrates state to the session.
*/ | Hydrate the state an object from the SQL ResultSet, into an array or "hydrated" values (do not resolve associations yet), and pass the hydrates state to the session | loadFromResultSet | {
"repo_name": "renmeng8875/projects",
"path": "Hibernate-source/源代码及重要说明/Hibernate相关资料/hibernate-3.2.0.ga/hibernate-3.2/src/org/hibernate/loader/Loader.java",
"license": "apache-2.0",
"size": 68301
} | [
"java.io.Serializable",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.hibernate.HibernateException",
"org.hibernate.LockMode",
"org.hibernate.engine.EntityKey",
"org.hibernate.engine.EntityUniqueKey",
"org.hibernate.engine.SessionImplementor",
"org.hibernate.engine.TwoPhaseLoad",
"org.hibern... | import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.engine.EntityKey; import org.hibernate.engine.EntityUniqueKey; import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.TwoPhaseLoad; import org.hibernate.persister.entity.Loadable; import org.hibernate.persister.entity.UniqueKeyLoadable; import org.hibernate.pretty.MessageHelper; import org.hibernate.type.AssociationType; import org.hibernate.type.Type; | import java.io.*; import java.sql.*; import org.hibernate.*; import org.hibernate.engine.*; import org.hibernate.persister.entity.*; import org.hibernate.pretty.*; import org.hibernate.type.*; | [
"java.io",
"java.sql",
"org.hibernate",
"org.hibernate.engine",
"org.hibernate.persister",
"org.hibernate.pretty",
"org.hibernate.type"
] | java.io; java.sql; org.hibernate; org.hibernate.engine; org.hibernate.persister; org.hibernate.pretty; org.hibernate.type; | 903,531 |
@Deprecated
public static ReferenceType setReference(ReferenceType reference,
LightXmlObjectType lightXmlObject) {
try {
IdentificationManager.getInstance().addReferenceInformation(reference,
lightXmlObject);
} catch (DDIFtpException e) {
// do nothing
e.printStackTrace();
}
return reference;
} | static ReferenceType function(ReferenceType reference, LightXmlObjectType lightXmlObject) { try { IdentificationManager.getInstance().addReferenceInformation(reference, lightXmlObject); } catch (DDIFtpException e) { e.printStackTrace(); } return reference; } | /**
* Does not set version and agency in reference
*
* Use
* org.ddialliance.ddieditor.logic.identification.addReferenceInformation
* instead
*
* @deprecated
* @see org.ddialliance.ddieditor.logic.identification.addReferenceInformation
*/ | Does not set version and agency in reference Use org.ddialliance.ddieditor.logic.identification.addReferenceInformation instead | setReference | {
"repo_name": "DdiEditor/ddieditor-model",
"path": "src/org/ddialliance/ddieditor/ui/model/ModelAccessor.java",
"license": "lgpl-3.0",
"size": 3034
} | [
"org.ddialliance.ddi3.xml.xmlbeans.reusable.ReferenceType",
"org.ddialliance.ddieditor.logic.identification.IdentificationManager",
"org.ddialliance.ddieditor.model.lightxmlobject.LightXmlObjectType",
"org.ddialliance.ddiftp.util.DDIFtpException"
] | import org.ddialliance.ddi3.xml.xmlbeans.reusable.ReferenceType; import org.ddialliance.ddieditor.logic.identification.IdentificationManager; import org.ddialliance.ddieditor.model.lightxmlobject.LightXmlObjectType; import org.ddialliance.ddiftp.util.DDIFtpException; | import org.ddialliance.ddi3.xml.xmlbeans.reusable.*; import org.ddialliance.ddieditor.logic.identification.*; import org.ddialliance.ddieditor.model.lightxmlobject.*; import org.ddialliance.ddiftp.util.*; | [
"org.ddialliance.ddi3",
"org.ddialliance.ddieditor",
"org.ddialliance.ddiftp"
] | org.ddialliance.ddi3; org.ddialliance.ddieditor; org.ddialliance.ddiftp; | 1,771,874 |
public static ApplicationContext getApplicationContext() {
return ctx;
}
| static ApplicationContext function() { return ctx; } | /**
* Get access to the Spring ApplicationContext from everywhere in your Application.
*
* @return
*/ | Get access to the Spring ApplicationContext from everywhere in your Application | getApplicationContext | {
"repo_name": "OpenSourceConsulting/athena-chameleon",
"path": "src/main/java/com/athena/peacock/engine/common/AppContext.java",
"license": "apache-2.0",
"size": 1721
} | [
"org.springframework.context.ApplicationContext"
] | import org.springframework.context.ApplicationContext; | import org.springframework.context.*; | [
"org.springframework.context"
] | org.springframework.context; | 2,419,825 |
private void centerParents() {
for (int i = nodeRows.size() - 1; i >= 0; i--) {
for (ClassdiagramNode node : nodeRows.get(i)) {
List<ClassdiagramNode> children = node.getDownNodes();
if (children.size() > 0) {
node.setLocation(new Point(xCenter(children)
- node.getSize().width / 2, node.getLocation().y));
}
}
// TODO: Make another pass to deal with overlaps?
}
}
| void function() { for (int i = nodeRows.size() - 1; i >= 0; i--) { for (ClassdiagramNode node : nodeRows.get(i)) { List<ClassdiagramNode> children = node.getDownNodes(); if (children.size() > 0) { node.setLocation(new Point(xCenter(children) - node.getSize().width / 2, node.getLocation().y)); } } } } | /**
* Center parents over their children, working from bottom to top.
*/ | Center parents over their children, working from bottom to top | centerParents | {
"repo_name": "ckaestne/LEADT",
"path": "workspace/argouml_critics/argouml-app/src/org/argouml/uml/diagram/static_structure/layout/ClassdiagramLayouter.java",
"license": "gpl-3.0",
"size": 23748
} | [
"java.awt.Point",
"java.util.List"
] | import java.awt.Point; import java.util.List; | import java.awt.*; import java.util.*; | [
"java.awt",
"java.util"
] | java.awt; java.util; | 2,301,471 |
public void setReferenceNumbers(List<ItemAttribute> referenceNumbers) {
this.referenceNumbers = referenceNumbers;
}
| void function(List<ItemAttribute> referenceNumbers) { this.referenceNumbers = referenceNumbers; } | /**
* Set the funds provider reference number
*
* @param referenceNumbers The reference number
*/ | Set the funds provider reference number | setReferenceNumbers | {
"repo_name": "anu-doi/metadata-stores",
"path": "store/src/main/java/au/edu/anu/metadatastores/store/grants/GrantItem.java",
"license": "gpl-3.0",
"size": 7813
} | [
"au.edu.anu.metadatastores.datamodel.store.ItemAttribute",
"java.util.List"
] | import au.edu.anu.metadatastores.datamodel.store.ItemAttribute; import java.util.List; | import au.edu.anu.metadatastores.datamodel.store.*; import java.util.*; | [
"au.edu.anu",
"java.util"
] | au.edu.anu; java.util; | 783,997 |
@Reference(service = AuthData.class,
cardinality = ReferenceCardinality.OPTIONAL,
policy = ReferencePolicy.STATIC,
target = "(id=unbound)",
policyOption = ReferencePolicyOption.GREEDY)
protected void setAuthData(ServiceReference<AuthData> ref) {
authDataRef = ref;
} | @Reference(service = AuthData.class, cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.STATIC, target = STR, policyOption = ReferencePolicyOption.GREEDY) void function(ServiceReference<AuthData> ref) { authDataRef = ref; } | /**
* Declarative Services method for setting the service reference for the default auth data
*
* @param ref reference to the service
*/ | Declarative Services method for setting the service reference for the default auth data | setAuthData | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.persistence/src/com/ibm/wsspi/persistence/internal/DatabaseStoreImpl.java",
"license": "epl-1.0",
"size": 42588
} | [
"com.ibm.websphere.security.auth.data.AuthData",
"org.osgi.framework.ServiceReference",
"org.osgi.service.component.annotations.Reference",
"org.osgi.service.component.annotations.ReferenceCardinality",
"org.osgi.service.component.annotations.ReferencePolicy",
"org.osgi.service.component.annotations.Refer... | import com.ibm.websphere.security.auth.data.AuthData; import org.osgi.framework.ServiceReference; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.osgi.service.component.annotations.ReferencePolicyOption; | import com.ibm.websphere.security.auth.data.*; import org.osgi.framework.*; import org.osgi.service.component.annotations.*; | [
"com.ibm.websphere",
"org.osgi.framework",
"org.osgi.service"
] | com.ibm.websphere; org.osgi.framework; org.osgi.service; | 2,643,340 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.