method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public NodeView getView(Set<GraphClass> graphClasses) { for (NodeView v : nodes) { if (v.getGraphClasses() == graphClasses) { return v; } } return null; }
NodeView function(Set<GraphClass> graphClasses) { for (NodeView v : nodes) { if (v.getGraphClasses() == graphClasses) { return v; } } return null; }
/** * Return the view for the given set of graph classes. */
Return the view for the given set of graph classes
getView
{ "repo_name": "forty3degrees/graphclasses", "path": "K/p/src/teo/isgci/core/GraphView.java", "license": "gpl-3.0", "size": 4192 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,301,570
public List<String> getNamesOfContacts() { List<String> nameList = new ArrayList<String>(); for (WebElement we : driver.findElements(By.xpath(".//*[@id='userForm:j_idt97:j_idt110_data']/tr"))) { if(!we.getText().equals("No records found.")) nameList.add(we.getText()); } return nameList; }
List<String> function() { List<String> nameList = new ArrayList<String>(); for (WebElement we : driver.findElements(By.xpath(STRNo records found.")) nameList.add(we.getText()); } return nameList; }
/** * Get names of contacts * * @return List with names of contacts */
Get names of contacts
getNamesOfContacts
{ "repo_name": "chr-krenn/fhj-ws2015-sd13-pse", "path": "pse/src/test/selenium/at/fhj/swd13/pse/test/gui/pageobjects/UserPage.java", "license": "mit", "size": 10727 }
[ "java.util.ArrayList", "java.util.List", "org.openqa.selenium.By", "org.openqa.selenium.WebElement" ]
import java.util.ArrayList; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement;
import java.util.*; import org.openqa.selenium.*;
[ "java.util", "org.openqa.selenium" ]
java.util; org.openqa.selenium;
2,061,313
List<Phrase> getSubPhrases();
List<Phrase> getSubPhrases();
/** * Gets all possible subphrases of this phrase, up to and including the phrase itself. For * example, the phrase "I like cheese ." would return the following: * <ul> * <li>I * <li>like * <li>cheese * <li>. * <li>I like * <li>like cheese * <li>cheese . * <li>I like cheese * <li>like cheese . * <li>I like cheese . * </ul> * * @return List of all possible subphrases. */
Gets all possible subphrases of this phrase, up to and including the phrase itself. For example, the phrase "I like cheese ." would return the following: I like cheese . I like like cheese cheese . I like cheese like cheese . I like cheese .
getSubPhrases
{ "repo_name": "lukeorland/joshua", "path": "src/joshua/corpus/Phrase.java", "license": "lgpl-2.1", "size": 2445 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,429,845
EReference getServiceProviderType_ProviderSite();
EReference getServiceProviderType_ProviderSite();
/** * Returns the meta object for the containment reference '{@link net.opengis.ows20.ServiceProviderType#getProviderSite <em>Provider Site</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Provider Site</em>'. * @see net.opengis.ows20.ServiceProviderType#getProviderSite() * @see #getServiceProviderType() * @generated */
Returns the meta object for the containment reference '<code>net.opengis.ows20.ServiceProviderType#getProviderSite Provider Site</code>'.
getServiceProviderType_ProviderSite
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.ows/src/net/opengis/ows20/Ows20Package.java", "license": "lgpl-2.1", "size": 356067 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,706,446
public ArrayList<Bid> getAllActiveBidsForChicken(Chicken chicken) { ArrayList<Bid> bids = chicken.getBids(); ArrayList<Bid> active_bids = new ArrayList<>(); for (Bid bid : bids) { if (bid.getBidStatus() == Bid.BidStatus.UNDECIDED) { active_bids.add(bid); } } return active_bids; }
ArrayList<Bid> function(Chicken chicken) { ArrayList<Bid> bids = chicken.getBids(); ArrayList<Bid> active_bids = new ArrayList<>(); for (Bid bid : bids) { if (bid.getBidStatus() == Bid.BidStatus.UNDECIDED) { active_bids.add(bid); } } return active_bids; }
/** * Retrieves all bids on a particular chicken. * * @param chicken the chicken to get bids for * @return list of bids */
Retrieves all bids on a particular chicken
getAllActiveBidsForChicken
{ "repo_name": "CMPUT301W16T05/c301_w16", "path": "app/src/main/java/com/example/c301_w16_g5/c301_w16_g5/ChickenController.java", "license": "apache-2.0", "size": 20276 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,502,573
@SuppressWarnings("unchecked") protected Object newMap(Object old, int size) { if (old instanceof Map) { ((Map) old).clear(); return old; } else return new HashMap<Object, Object>(size); }
@SuppressWarnings(STR) Object function(Object old, int size) { if (old instanceof Map) { ((Map) old).clear(); return old; } else return new HashMap<Object, Object>(size); }
/** Called to create new array instances. Subclasses may override to use a * different map implementation. By default, this returns a {@link * HashMap}.*/
Called to create new array instances. Subclasses may override to use a different map implementation. By default, this returns a {@link
newMap
{ "repo_name": "eonezhang/avro", "path": "lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java", "license": "apache-2.0", "size": 20964 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,333,383
public void setClearButtonEnabled(boolean enabled) { if (enabled) { m_clearButton.enable(); } else { m_clearButton.disable(Messages.get().key(Messages.GUI_DISABLE_CLEAR_LIST_0)); } }
void function(boolean enabled) { if (enabled) { m_clearButton.enable(); } else { m_clearButton.disable(Messages.get().key(Messages.GUI_DISABLE_CLEAR_LIST_0)); } }
/** * Sets the clear list button enabled.<p> * * @param enabled <code>true</code> to enable the button */
Sets the clear list button enabled
setClearButtonEnabled
{ "repo_name": "sbonoc/opencms-core", "path": "src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsListTab.java", "license": "lgpl-2.1", "size": 4500 }
[ "org.opencms.ade.sitemap.client.Messages" ]
import org.opencms.ade.sitemap.client.Messages;
import org.opencms.ade.sitemap.client.*;
[ "org.opencms.ade" ]
org.opencms.ade;
1,440,825
NodeDTO getNode(String nodeId);
NodeDTO getNode(String nodeId);
/** * Returns the contents of the node. * * @param nodeId a node identifier * @return the contents of the node */
Returns the contents of the node
getNode
{ "repo_name": "WilliamNouet/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 53848 }
[ "org.apache.nifi.web.api.dto.NodeDTO" ]
import org.apache.nifi.web.api.dto.NodeDTO;
import org.apache.nifi.web.api.dto.*;
[ "org.apache.nifi" ]
org.apache.nifi;
125,643
private float[] buildGrid() { gridValues = new float[(xNumCells + 1) * (yNumCells + 1)]; for (int i = 0; i <= yNumCells; i++) { for (int j = 0; j <= xNumCells; j++) { DirectPosition dp = new DirectPosition2D( env.getLowerCorner().getOrdinate(0) + (j * dx), env.getUpperCorner().getOrdinate(1) - (i * dy)); // org.opengis.geometry.DirectPosition dpOld = new DirectPosition2D( // env.getLowerCorner().getOrdinate(0) + (j * dx), // env.getUpperCorner().getOrdinate(1) - (i * dy)); // ReferencingUtil ref = ReferencingUtil.getInstance(); // org.opengis.geometry.DirectPosition dp = ref.create(dpOld.getCoordinates(), dpOld.getCoordinateReferenceSystem()); int index = (i * (1 + xNumCells)) + j; float value = getValue(dp); gridValues[index] = value; } } return gridValues; }
float[] function() { gridValues = new float[(xNumCells + 1) * (yNumCells + 1)]; for (int i = 0; i <= yNumCells; i++) { for (int j = 0; j <= xNumCells; j++) { DirectPosition dp = new DirectPosition2D( env.getLowerCorner().getOrdinate(0) + (j * dx), env.getUpperCorner().getOrdinate(1) - (i * dy)); int index = (i * (1 + xNumCells)) + j; float value = getValue(dp); gridValues[index] = value; } } return gridValues; }
/** * Returns array of float of interpolated grid values. * The values are in row order. The dimension * id number of columns * number of rows. * @return Values of grid coordinates */
Returns array of float of interpolated grid values. The values are in row order. The dimension id number of columns * number of rows
buildGrid
{ "repo_name": "iCarto/siga", "path": "libTopology/src/org/geotools/referencefork/referencing/operation/builder/algorithm/AbstractInterpolation.java", "license": "gpl-3.0", "size": 7972 }
[ "org.geotools.referencefork.geometry.DirectPosition2D", "org.opengis.spatialschema.geometry.DirectPosition" ]
import org.geotools.referencefork.geometry.DirectPosition2D; import org.opengis.spatialschema.geometry.DirectPosition;
import org.geotools.referencefork.geometry.*; import org.opengis.spatialschema.geometry.*;
[ "org.geotools.referencefork", "org.opengis.spatialschema" ]
org.geotools.referencefork; org.opengis.spatialschema;
502,366
protected boolean packOptionalTlv(ChannelBuffer cb) { int hTlvType; int hTlvLength; ListIterator<PcepValueType> listIterator = llOptionalTlv.listIterator(); while (listIterator.hasNext()) { PcepValueType tlv = listIterator.next(); if (tlv == null) { log.debug("Warning: tlv is null from OptionalTlv list"); continue; } hTlvType = tlv.getType(); hTlvLength = tlv.getLength(); if (0 == hTlvLength) { log.debug("Warning: invalid length in tlv of OptionalTlv list"); continue; } cb.writeShort(hTlvType); cb.writeShort(hTlvLength); switch (hTlvType) { //TODO: optional TLV for LSPA to be added default: log.debug("Warning: PcepLspaObject: unknown tlv"); } // As per RFC the length of object should // be multiples of 4 int pad = hTlvLength % 4; if (0 < pad) { pad = 4 - pad; if (pad <= cb.readableBytes()) { cb.skipBytes(pad); } } } return true; } public static class Builder implements PcepLspaObject.Builder { private boolean bIsHeaderSet = false; private PcepObjectHeader lspaObjHeader; private boolean bLFlag; private int iExcludeAny; private boolean bIsExcludeAnySet = false; private int iIncludeAny; private boolean bIsIncludeAnySet = false; private int iIncludeAll; private boolean bIsIncludeAllSet = false; private byte cSetupPriority; private boolean bIsSetupPrioritySet = false; private byte cHoldPriority; private boolean bIsHoldPrioritySet = false; private LinkedList<PcepValueType> llOptionalTlv; private boolean bIsPFlagSet = false; private boolean bPFlag; private boolean bIsIFlagSet = false; private boolean bIFlag;
boolean function(ChannelBuffer cb) { int hTlvType; int hTlvLength; ListIterator<PcepValueType> listIterator = llOptionalTlv.listIterator(); while (listIterator.hasNext()) { PcepValueType tlv = listIterator.next(); if (tlv == null) { log.debug(STR); continue; } hTlvType = tlv.getType(); hTlvLength = tlv.getLength(); if (0 == hTlvLength) { log.debug(STR); continue; } cb.writeShort(hTlvType); cb.writeShort(hTlvLength); switch (hTlvType) { default: log.debug(STR); } int pad = hTlvLength % 4; if (0 < pad) { pad = 4 - pad; if (pad <= cb.readableBytes()) { cb.skipBytes(pad); } } } return true; } public static class Builder implements PcepLspaObject.Builder { private boolean bIsHeaderSet = false; private PcepObjectHeader lspaObjHeader; private boolean bLFlag; private int iExcludeAny; private boolean bIsExcludeAnySet = false; private int iIncludeAny; private boolean bIsIncludeAnySet = false; private int iIncludeAll; private boolean bIsIncludeAllSet = false; private byte cSetupPriority; private boolean bIsSetupPrioritySet = false; private byte cHoldPriority; private boolean bIsHoldPrioritySet = false; private LinkedList<PcepValueType> llOptionalTlv; private boolean bIsPFlagSet = false; private boolean bPFlag; private boolean bIsIFlagSet = false; private boolean bIFlag;
/** * Writes optional tlvs to channel buffer. * * @param cb channel buffer * @return true */
Writes optional tlvs to channel buffer
packOptionalTlv
{ "repo_name": "donNewtonAlpha/onos", "path": "protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/ver1/PcepLspaObjectVer1.java", "license": "apache-2.0", "size": 16321 }
[ "java.util.LinkedList", "java.util.ListIterator", "org.jboss.netty.buffer.ChannelBuffer", "org.onosproject.pcepio.protocol.PcepLspaObject", "org.onosproject.pcepio.types.PcepObjectHeader", "org.onosproject.pcepio.types.PcepValueType" ]
import java.util.LinkedList; import java.util.ListIterator; import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.pcepio.protocol.PcepLspaObject; import org.onosproject.pcepio.types.PcepObjectHeader; import org.onosproject.pcepio.types.PcepValueType;
import java.util.*; import org.jboss.netty.buffer.*; import org.onosproject.pcepio.protocol.*; import org.onosproject.pcepio.types.*;
[ "java.util", "org.jboss.netty", "org.onosproject.pcepio" ]
java.util; org.jboss.netty; org.onosproject.pcepio;
2,427,256
public synchronized XSNamedMap getComponentsByNamespace(short objectType, String namespace) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } // try to find the grammar int i = 0; if (namespace != null) { for (; i < fGrammarCount; ++i) { if (namespace.equals(fNamespaces[i])) { break; } } } else { for (; i < fGrammarCount; ++i) { if (fNamespaces[i] == null) { break; } } } if (i == fGrammarCount) { return XSNamedMapImpl.EMPTY_MAP; } // get the hashtable for this type of components if (fNSComponents[i][objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGrammarList[i].fGlobalNotationDecls; break; } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fNSComponents[i][objectType] = new XSNamedMap4Types(namespace, table, objectType); } else { fNSComponents[i][objectType] = new XSNamedMapImpl(namespace, table); } } return fNSComponents[i][objectType]; }
synchronized XSNamedMap function(short objectType, String namespace) { if (objectType <= 0 objectType > MAX_COMP_IDX !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } int i = 0; if (namespace != null) { for (; i < fGrammarCount; ++i) { if (namespace.equals(fNamespaces[i])) { break; } } } else { for (; i < fGrammarCount; ++i) { if (fNamespaces[i] == null) { break; } } } if (i == fGrammarCount) { return XSNamedMapImpl.EMPTY_MAP; } if (fNSComponents[i][objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGrammarList[i].fGlobalNotationDecls; break; } if (objectType == XSTypeDefinition.COMPLEX_TYPE objectType == XSTypeDefinition.SIMPLE_TYPE) { fNSComponents[i][objectType] = new XSNamedMap4Types(namespace, table, objectType); } else { fNSComponents[i][objectType] = new XSNamedMapImpl(namespace, table); } } return fNSComponents[i][objectType]; }
/** * Convenience method. Returns a list of top-level component declarations * that are defined within the specified namespace, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. * @param namespace The namespace to which the declaration belongs or * <code>null</code> (for components with no target namespace). * @return A list of top-level definitions of the specified type in * <code>objectType</code> and defined in the specified * <code>namespace</code> or an empty <code>XSNamedMap</code>. */
Convenience method. Returns a list of top-level component declarations that are defined within the specified namespace, i.e. element declarations, attribute declarations, etc
getComponentsByNamespace
{ "repo_name": "PrincetonUniversity/NVJVM", "path": "build/linux-amd64/jaxp/drop/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XSModelImpl.java", "license": "gpl-2.0", "size": 31919 }
[ "com.sun.org.apache.xerces.internal.impl.xs.util.XSNamedMap4Types", "com.sun.org.apache.xerces.internal.impl.xs.util.XSNamedMapImpl", "com.sun.org.apache.xerces.internal.util.SymbolHash", "com.sun.org.apache.xerces.internal.xs.XSConstants", "com.sun.org.apache.xerces.internal.xs.XSNamedMap", "com.sun.org.apache.xerces.internal.xs.XSTypeDefinition" ]
import com.sun.org.apache.xerces.internal.impl.xs.util.XSNamedMap4Types; import com.sun.org.apache.xerces.internal.impl.xs.util.XSNamedMapImpl; import com.sun.org.apache.xerces.internal.util.SymbolHash; import com.sun.org.apache.xerces.internal.xs.XSConstants; import com.sun.org.apache.xerces.internal.xs.XSNamedMap; import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
import com.sun.org.apache.xerces.internal.impl.xs.util.*; import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.xs.*;
[ "com.sun.org" ]
com.sun.org;
2,301,331
void warn(Marker marker, Message msg, Throwable t);
void warn(Marker marker, Message msg, Throwable t);
/** * Logs a message with the specific Marker at the {@link Level#WARN WARN} level. * * @param marker the marker data specific to this log statement * @param msg the message string to be logged * @param t A Throwable or null. */
Logs a message with the specific Marker at the <code>Level#WARN WARN</code> level
warn
{ "repo_name": "ClarenceAu/log4j2", "path": "log4j-api/src/main/java/org/apache/logging/log4j/Logger.java", "license": "apache-2.0", "size": 39369 }
[ "org.apache.logging.log4j.message.Message" ]
import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.message.*;
[ "org.apache.logging" ]
org.apache.logging;
523,812
public SnmpTargetMIB getSnmpTargetMIB() { return targetMIB; }
SnmpTargetMIB function() { return targetMIB; }
/** * Returns the SNMP-TARGET-MIB implementation used by this config manager. * * @return the SnmpTargetMIB instance of this agent. */
Returns the SNMP-TARGET-MIB implementation used by this config manager
getSnmpTargetMIB
{ "repo_name": "biddyweb/gateway", "path": "management/src/main/java/org/kaazing/gateway/management/snmp/SnmpManagementServiceHandler.java", "license": "apache-2.0", "size": 128109 }
[ "org.snmp4j.agent.mo.snmp.SnmpTargetMIB" ]
import org.snmp4j.agent.mo.snmp.SnmpTargetMIB;
import org.snmp4j.agent.mo.snmp.*;
[ "org.snmp4j.agent" ]
org.snmp4j.agent;
2,725,592
@Source("com/google/appinventor/images/pedometer.png") ImageResource pedometerComponent();
@Source(STR) ImageResource pedometerComponent();
/** * Designer palette item: Pedometer Component */
Designer palette item: Pedometer Component
pedometerComponent
{ "repo_name": "mintingle/appinventor-sources", "path": "appinventor/appengine/src/com/google/appinventor/client/Images.java", "license": "apache-2.0", "size": 13759 }
[ "com.google.gwt.resources.client.ImageResource" ]
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.*;
[ "com.google.gwt" ]
com.google.gwt;
353,797
public byte[] getUID(final UniqueIdType type, final String name) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Missing UID name"); } switch (type) { case METRIC: return this.metrics.getId(name); case TAGK: return this.tag_names.getId(name); case TAGV: return this.tag_values.getId(name); default: throw new IllegalArgumentException("Unrecognized UID type"); } }
byte[] function(final UniqueIdType type, final String name) { if (name == null name.isEmpty()) { throw new IllegalArgumentException(STR); } switch (type) { case METRIC: return this.metrics.getId(name); case TAGK: return this.tag_names.getId(name); case TAGV: return this.tag_values.getId(name); default: throw new IllegalArgumentException(STR); } }
/** * Attempts to find the UID matching a given name * @param type The type of UID * @param name The name to search for * @throws IllegalArgumentException if the type is not valid * @throws NoSuchUniqueName if the name was not found * @since 2.0 */
Attempts to find the UID matching a given name
getUID
{ "repo_name": "pepperdata/opentsdb", "path": "opentsdb-core/src/main/java/net/opentsdb/core/TSDB.java", "license": "lgpl-2.1", "size": 55721 }
[ "net.opentsdb.uid.UniqueId" ]
import net.opentsdb.uid.UniqueId;
import net.opentsdb.uid.*;
[ "net.opentsdb.uid" ]
net.opentsdb.uid;
1,417,240
@Override public void addTemporaryQueue(final TemporaryQueue temp) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("addTemporaryQueue(" + temp + ")"); } synchronized (tempQueues) { tempQueues.add(temp); } }
void function(final TemporaryQueue temp) { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace(STR + temp + ")"); } synchronized (tempQueues) { tempQueues.add(temp); } }
/** * Add temporary queue * * @param temp The temporary queue */
Add temporary queue
addTemporaryQueue
{ "repo_name": "kjniemi/activemq-artemis", "path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java", "license": "apache-2.0", "size": 32007 }
[ "javax.jms.TemporaryQueue" ]
import javax.jms.TemporaryQueue;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
541,182
public static void setBaseTime(final byte[] row, int base_time) { Bytes.setInt(row, base_time, Const.SALT_WIDTH() + TSDB.metrics_width()); }
static void function(final byte[] row, int base_time) { Bytes.setInt(row, base_time, Const.SALT_WIDTH() + TSDB.metrics_width()); }
/** * Sets the time in a raw data table row key * @param row The row to modify * @param base_time The base time to store * @since 2.3 */
Sets the time in a raw data table row key
setBaseTime
{ "repo_name": "MadDogTechnology/opentsdb", "path": "src/core/Internal.java", "license": "lgpl-2.1", "size": 41806 }
[ "org.hbase.async.Bytes" ]
import org.hbase.async.Bytes;
import org.hbase.async.*;
[ "org.hbase.async" ]
org.hbase.async;
2,607,510
private ValidatorActionHelper validateDouble( String name, Configuration constraints, Configuration conf, Map params, boolean is_string, Object param) { boolean nullable = getNullable(conf, constraints); Double value = null; Double dflt = getDoubleValue(getDefault(conf, constraints), true); if (getLogger().isDebugEnabled()) getLogger().debug( "Validating double parameter " + name + " (encoded in a string: " + is_string + ")"); try { value = getDoubleValue(param, is_string); } catch (Exception e) { // Unable to parse double return new ValidatorActionHelper(value, ValidatorActionResult.ERROR); } if (value == null) { if (getLogger().isDebugEnabled()) getLogger().debug("double parameter " + name + " is null"); if (!nullable) { return new ValidatorActionHelper(value, ValidatorActionResult.ISNULL); } else { return new ValidatorActionHelper(dflt); } } if (constraints != null) { Double eq = getAttributeAsDouble(constraints, "equals-to", null); String eqp = constraints.getAttribute("equals-to-param", ""); Double min = getAttributeAsDouble(conf, "min", null); min = getAttributeAsDouble(constraints, "min", min); Double max = getAttributeAsDouble(conf, "max", null); max = getAttributeAsDouble(constraints, "max", max); // Validate whether param is equal to constant if (eq != null) { if (getLogger().isDebugEnabled()) getLogger().debug("Double parameter " + name + " should be equal to " + eq); if (!value.equals(eq)) { if (getLogger().isDebugEnabled()) getLogger().debug("and it is not"); return new ValidatorActionHelper(value, ValidatorActionResult.NOMATCH); } } // Validate whether param is equal to another param // FIXME: take default value of param being compared with into // account? if (!"".equals(eqp)) { if (getLogger().isDebugEnabled()) getLogger().debug( "Double parameter " + name + " should be equal to " + params.get(eqp)); // Request parameter is stored as string. // Need to convert it beforehand. try { Double _eqp = new Double(Double.parseDouble((String) params.get(eqp))); if (!value.equals(_eqp)) { if (getLogger().isDebugEnabled()) getLogger().debug("and it is not"); return new ValidatorActionHelper(value, ValidatorActionResult.NOMATCH); } } catch (NumberFormatException nfe) { if (getLogger().isDebugEnabled()) getLogger().debug( "Double parameter " + name + ": " + eqp + " is no double", nfe); return new ValidatorActionHelper(value, ValidatorActionResult.NOMATCH); } } // Validate wheter param is at least min if (min != null) { if (getLogger().isDebugEnabled()) getLogger().debug("Double parameter " + name + " should be at least " + min); if (0 > value.compareTo(min)) { if (getLogger().isDebugEnabled()) getLogger().debug("and it is not"); return new ValidatorActionHelper(value, ValidatorActionResult.TOOSMALL); } } // Validate wheter param is at most max if (max != null) { if (getLogger().isDebugEnabled()) getLogger().debug("Double parameter " + name + " should be at most " + max); if (0 < value.compareTo(max)) { if (getLogger().isDebugEnabled()) getLogger().debug("and it is not"); return new ValidatorActionHelper(value, ValidatorActionResult.TOOLARGE); } } } return new ValidatorActionHelper(value); }
ValidatorActionHelper function( String name, Configuration constraints, Configuration conf, Map params, boolean is_string, Object param) { boolean nullable = getNullable(conf, constraints); Double value = null; Double dflt = getDoubleValue(getDefault(conf, constraints), true); if (getLogger().isDebugEnabled()) getLogger().debug( STR + name + STR + is_string + ")"); try { value = getDoubleValue(param, is_string); } catch (Exception e) { return new ValidatorActionHelper(value, ValidatorActionResult.ERROR); } if (value == null) { if (getLogger().isDebugEnabled()) getLogger().debug(STR + name + STR); if (!nullable) { return new ValidatorActionHelper(value, ValidatorActionResult.ISNULL); } else { return new ValidatorActionHelper(dflt); } } if (constraints != null) { Double eq = getAttributeAsDouble(constraints, STR, null); String eqp = constraints.getAttribute(STR, STRminSTRminSTRmaxSTRmaxSTRDouble parameter STR should be equal to STRand it is notSTRSTRDouble parameter STR should be equal to STRand it is notSTRDouble parameter STR: STR is no doubleSTRDouble parameter STR should be at least STRand it is notSTRDouble parameter STR should be at most STRand it is not"); return new ValidatorActionHelper(value, ValidatorActionResult.TOOLARGE); } } } return new ValidatorActionHelper(value); }
/** * Validates nullability and default value for given parameter. If given * constraints are not null they are validated as well. */
Validates nullability and default value for given parameter. If given constraints are not null they are validated as well
validateDouble
{ "repo_name": "apache/cocoon", "path": "core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/acting/AbstractValidatorAction.java", "license": "apache-2.0", "size": 42896 }
[ "java.util.Map", "org.apache.avalon.framework.configuration.Configuration" ]
import java.util.Map; import org.apache.avalon.framework.configuration.Configuration;
import java.util.*; import org.apache.avalon.framework.configuration.*;
[ "java.util", "org.apache.avalon" ]
java.util; org.apache.avalon;
1,361,916
List<byte[]> get(final HStoreKey key, final int numVersions) { this.mc_lock.readLock().lock(); try { List<byte []> results; // The synchronizations here are because internalGet iterates synchronized (this.mc) { results = internalGet(this.mc, key, numVersions); } synchronized (snapshot) { results.addAll(results.size(), internalGet(snapshot, key, numVersions - results.size())); } return results; } finally { this.mc_lock.readLock().unlock(); } }
List<byte[]> get(final HStoreKey key, final int numVersions) { this.mc_lock.readLock().lock(); try { List<byte []> results; synchronized (this.mc) { results = internalGet(this.mc, key, numVersions); } synchronized (snapshot) { results.addAll(results.size(), internalGet(snapshot, key, numVersions - results.size())); } return results; } finally { this.mc_lock.readLock().unlock(); } }
/** * Look back through all the backlog TreeMaps to find the target. * @param key * @param numVersions * @return An array of byte arrays ordered by timestamp. */
Look back through all the backlog TreeMaps to find the target
get
{ "repo_name": "ALEXGUOQ/hbase", "path": "src/java/org/apache/hadoop/hbase/HStore.java", "license": "apache-2.0", "size": 109422 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,746,554
@SuppressWarnings("unchecked") @Test public void testEvaluateComplicated() throws Exception { CalendarFilterEvaluater evaluater = new CalendarFilterEvaluater(); Calendar calendar = getCalendar("cal1.ics"); CalendarFilter filter = new CalendarFilter(); ComponentFilter compFilter = new ComponentFilter("VCALENDAR"); ComponentFilter eventFilter = new ComponentFilter("VEVENT"); filter.setFilter(compFilter); compFilter.getComponentFilters().add(eventFilter); DateTime start = new DateTime("20050816T115000Z"); DateTime end = new DateTime("20050916T115000Z"); Period period = new Period(start, end); TimeRangeFilter timeRangeFilter = new TimeRangeFilter(period); eventFilter.setTimeRangeFilter(timeRangeFilter); PropertyFilter propFilter = new PropertyFilter("SUMMARY"); TextMatchFilter textFilter = new TextMatchFilter("Visible"); propFilter.setTextMatchFilter(textFilter); eventFilter.getPropFilters().add(propFilter); PropertyFilter propFilter2 = new PropertyFilter("DTSTART"); ParamFilter paramFilter2 = new ParamFilter("VALUE"); TextMatchFilter textFilter2 = new TextMatchFilter("DATE-TIME"); paramFilter2.setTextMatchFilter(textFilter2); propFilter2.getParamFilters().add(paramFilter2); Period period2 = new Period(start, end); TimeRangeFilter timeRangeFilter2 = new TimeRangeFilter(period2); propFilter2.setTimeRangeFilter(timeRangeFilter2); eventFilter.getPropFilters().add(propFilter2); Assert.assertTrue(evaluater.evaluate(calendar, filter)); // change one thing paramFilter2.setName("XXX"); Assert.assertFalse(evaluater.evaluate(calendar, filter)); }
@SuppressWarnings(STR) void function() throws Exception { CalendarFilterEvaluater evaluater = new CalendarFilterEvaluater(); Calendar calendar = getCalendar(STR); CalendarFilter filter = new CalendarFilter(); ComponentFilter compFilter = new ComponentFilter(STR); ComponentFilter eventFilter = new ComponentFilter(STR); filter.setFilter(compFilter); compFilter.getComponentFilters().add(eventFilter); DateTime start = new DateTime(STR); DateTime end = new DateTime(STR); Period period = new Period(start, end); TimeRangeFilter timeRangeFilter = new TimeRangeFilter(period); eventFilter.setTimeRangeFilter(timeRangeFilter); PropertyFilter propFilter = new PropertyFilter(STR); TextMatchFilter textFilter = new TextMatchFilter(STR); propFilter.setTextMatchFilter(textFilter); eventFilter.getPropFilters().add(propFilter); PropertyFilter propFilter2 = new PropertyFilter(STR); ParamFilter paramFilter2 = new ParamFilter("VALUE"); TextMatchFilter textFilter2 = new TextMatchFilter(STR); paramFilter2.setTextMatchFilter(textFilter2); propFilter2.getParamFilters().add(paramFilter2); Period period2 = new Period(start, end); TimeRangeFilter timeRangeFilter2 = new TimeRangeFilter(period2); propFilter2.setTimeRangeFilter(timeRangeFilter2); eventFilter.getPropFilters().add(propFilter2); Assert.assertTrue(evaluater.evaluate(calendar, filter)); paramFilter2.setName("XXX"); Assert.assertFalse(evaluater.evaluate(calendar, filter)); }
/** * Tests evaluate complicated. * @throws Exception - if something is wrong this exception is thrown. */
Tests evaluate complicated
testEvaluateComplicated
{ "repo_name": "Eisler/cosmo", "path": "cosmo-core/src/test/unit/java/org/unitedinternet/cosmo/calendar/query/CalendarFilterEvaluaterTest.java", "license": "apache-2.0", "size": 23775 }
[ "net.fortuna.ical4j.model.Calendar", "net.fortuna.ical4j.model.DateTime", "net.fortuna.ical4j.model.Period", "org.junit.Assert" ]
import net.fortuna.ical4j.model.Calendar; import net.fortuna.ical4j.model.DateTime; import net.fortuna.ical4j.model.Period; import org.junit.Assert;
import net.fortuna.ical4j.model.*; import org.junit.*;
[ "net.fortuna.ical4j", "org.junit" ]
net.fortuna.ical4j; org.junit;
1,370,752
@Test public void testGetStartOfBlockIndex() throws Exception { int expected = -1; assertEquals("Unexpected initial value", expected, instance.getStartOfBlockIndex()); expected = 0; instance.startOfBlockIndex = expected; assertEquals(expected, instance.getStartOfBlockIndex()); expected = 5; instance.startOfBlockIndex = expected; assertEquals(expected, instance.getStartOfBlockIndex()); }
void function() throws Exception { int expected = -1; assertEquals(STR, expected, instance.getStartOfBlockIndex()); expected = 0; instance.startOfBlockIndex = expected; assertEquals(expected, instance.getStartOfBlockIndex()); expected = 5; instance.startOfBlockIndex = expected; assertEquals(expected, instance.getStartOfBlockIndex()); }
/** * Description of test. * * @throws Exception in the event of a test error. */
Description of test
testGetStartOfBlockIndex
{ "repo_name": "jonmcewen/camel", "path": "components/camel-mllp/src/test/java/org/apache/camel/component/mllp/internal/MllpSocketBufferTest.java", "license": "apache-2.0", "size": 24372 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
809,083
public User findByEmail(String email) { return userRepository.findByEmail(email); }
User function(String email) { return userRepository.findByEmail(email); }
/** * Returns a user for the given email or null if a user could not be found. * @param email The email associated to the user to find. * @return a user for the given email or null if a user could not be found. */
Returns a user for the given email or null if a user could not be found
findByEmail
{ "repo_name": "sasamoah304/devopsjavaspring", "path": "src/main/java/com/devopsjavaspring/backend/service/UserService.java", "license": "mit", "size": 3797 }
[ "com.devopsjavaspring.backend.persistence.domain.backend.User" ]
import com.devopsjavaspring.backend.persistence.domain.backend.User;
import com.devopsjavaspring.backend.persistence.domain.backend.*;
[ "com.devopsjavaspring.backend" ]
com.devopsjavaspring.backend;
267,986
@Test public void test() { final List<String> listOfNames = Arrays.asList("Orange", "Mango", "Guava", "Banana", "Papaya", "Strawberry"); final List<String> listOfNewFruit = select(listOfNames, having(on(String.class), containsString("o"))); final String names = join(listOfNewFruit, "~"); LOG.trace("Merged selected fruit: " + names); }
void function() { final List<String> listOfNames = Arrays.asList(STR, "Mango", "Guava", STR, STR, STR); final List<String> listOfNewFruit = select(listOfNames, having(on(String.class), containsString("o"))); final String names = join(listOfNewFruit, "~"); LOG.trace(STR + names); }
/** * inspired by <a href= * "http://kristantohans.wordpress.com/2011/08/06/lambdaj-as-an-alternative-to-query-out-from-collections-stop-iterations/" * >this blog</a> */
inspired by this blog
test
{ "repo_name": "krevelen/coala", "path": "coala-core/src/test/java/io/coala/experimental/closure/ClosureTest.java", "license": "apache-2.0", "size": 5392 }
[ "ch.lambdaj.Lambda", "java.util.Arrays", "java.util.List", "org.hamcrest.Matchers" ]
import ch.lambdaj.Lambda; import java.util.Arrays; import java.util.List; import org.hamcrest.Matchers;
import ch.lambdaj.*; import java.util.*; import org.hamcrest.*;
[ "ch.lambdaj", "java.util", "org.hamcrest" ]
ch.lambdaj; java.util; org.hamcrest;
2,405,400
public SpringApplicationBuilder contextFactory(ApplicationContextFactory factory) { this.application.setApplicationContextFactory(factory); return this; }
SpringApplicationBuilder function(ApplicationContextFactory factory) { this.application.setApplicationContextFactory(factory); return this; }
/** * Explicitly set the factory used to create the application context. * @param factory the factory to use * @return the current builder * @since 2.4.0 */
Explicitly set the factory used to create the application context
contextFactory
{ "repo_name": "royclarkson/spring-boot", "path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java", "license": "apache-2.0", "size": 18753 }
[ "org.springframework.boot.ApplicationContextFactory" ]
import org.springframework.boot.ApplicationContextFactory;
import org.springframework.boot.*;
[ "org.springframework.boot" ]
org.springframework.boot;
490,332
public boolean canLock(Contentlet contentlet, User user, boolean respectFrontendRoles) throws DotLockException;
boolean function(Contentlet contentlet, User user, boolean respectFrontendRoles) throws DotLockException;
/** * Tests whether a user can potentially lock a piece of content (needed to test before publish, etc). This method will return false if content is already locked * by another user. * @param contentlet * @param user * @param respectFrontendRoles * @return * @throws DotLockException */
Tests whether a user can potentially lock a piece of content (needed to test before publish, etc). This method will return false if content is already locked by another user
canLock
{ "repo_name": "zhiqinghuang/core", "path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPI.java", "license": "gpl-3.0", "size": 64036 }
[ "com.dotmarketing.portlets.contentlet.model.Contentlet", "com.liferay.portal.model.User" ]
import com.dotmarketing.portlets.contentlet.model.Contentlet; import com.liferay.portal.model.User;
import com.dotmarketing.portlets.contentlet.model.*; import com.liferay.portal.model.*;
[ "com.dotmarketing.portlets", "com.liferay.portal" ]
com.dotmarketing.portlets; com.liferay.portal;
1,733,326
protected Criteria getAllAgingInvoiceDocumentsCriteria(String prefix, Date invoiceDueDateFrom, Date invoiceDueDateTo) { Criteria criteria = new Criteria(); if (ObjectUtils.isNotNull(invoiceDueDateFrom)) { criteria.addGreaterOrEqualThan(ArPropertyConstants.CustomerInvoiceDocumentFields.INVOICE_DUE_DATE, invoiceDueDateFrom); } if (ObjectUtils.isNotNull(invoiceDueDateTo)) { criteria.addLessThan(ArPropertyConstants.CustomerInvoiceDocumentFields.INVOICE_DUE_DATE, invoiceDueDateTo); } criteria.addEqualTo(prefix + ArPropertyConstants.CustomerInvoiceDocumentFields.OPEN_INVOICE_INDICATOR, true); criteria.addEqualTo(prefix + "documentHeader.financialDocumentStatusCode", KFSConstants.DocumentStatusCodes.APPROVED); return criteria; }
Criteria function(String prefix, Date invoiceDueDateFrom, Date invoiceDueDateTo) { Criteria criteria = new Criteria(); if (ObjectUtils.isNotNull(invoiceDueDateFrom)) { criteria.addGreaterOrEqualThan(ArPropertyConstants.CustomerInvoiceDocumentFields.INVOICE_DUE_DATE, invoiceDueDateFrom); } if (ObjectUtils.isNotNull(invoiceDueDateTo)) { criteria.addLessThan(ArPropertyConstants.CustomerInvoiceDocumentFields.INVOICE_DUE_DATE, invoiceDueDateTo); } criteria.addEqualTo(prefix + ArPropertyConstants.CustomerInvoiceDocumentFields.OPEN_INVOICE_INDICATOR, true); criteria.addEqualTo(prefix + STR, KFSConstants.DocumentStatusCodes.APPROVED); return criteria; }
/** * get selection criteria for aging invoice document */
get selection criteria for aging invoice document
getAllAgingInvoiceDocumentsCriteria
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/document/dataaccess/impl/CustomerInvoiceDocumentDaoOjb.java", "license": "agpl-3.0", "size": 26570 }
[ "java.sql.Date", "org.apache.ojb.broker.query.Criteria", "org.kuali.kfs.krad.util.ObjectUtils", "org.kuali.kfs.module.ar.ArPropertyConstants", "org.kuali.kfs.sys.KFSConstants" ]
import java.sql.Date; import org.apache.ojb.broker.query.Criteria; import org.kuali.kfs.krad.util.ObjectUtils; import org.kuali.kfs.module.ar.ArPropertyConstants; import org.kuali.kfs.sys.KFSConstants;
import java.sql.*; import org.apache.ojb.broker.query.*; import org.kuali.kfs.krad.util.*; import org.kuali.kfs.module.ar.*; import org.kuali.kfs.sys.*;
[ "java.sql", "org.apache.ojb", "org.kuali.kfs" ]
java.sql; org.apache.ojb; org.kuali.kfs;
1,684,368
protected final boolean perform(BuildStep bs, BuildListener listener) throws InterruptedException, IOException { BuildStepMonitor mon; try { mon = bs.getRequiredMonitorService(); } catch (AbstractMethodError e) { mon = BuildStepMonitor.BUILD; } return mon.perform(bs, AbstractBuild.this, launcher, listener); }
final boolean function(BuildStep bs, BuildListener listener) throws InterruptedException, IOException { BuildStepMonitor mon; try { mon = bs.getRequiredMonitorService(); } catch (AbstractMethodError e) { mon = BuildStepMonitor.BUILD; } return mon.perform(bs, AbstractBuild.this, launcher, listener); }
/** * Calls a build step. */
Calls a build step
perform
{ "repo_name": "sincere520/testGitRepo", "path": "hudson-core/src/main/java/hudson/model/AbstractBuild.java", "license": "mit", "size": 43238 }
[ "hudson.tasks.BuildStep", "hudson.tasks.BuildStepMonitor", "java.io.IOException" ]
import hudson.tasks.BuildStep; import hudson.tasks.BuildStepMonitor; import java.io.IOException;
import hudson.tasks.*; import java.io.*;
[ "hudson.tasks", "java.io" ]
hudson.tasks; java.io;
2,804,673
private void loginToTwitter() { // Check if already logged in Log.d("Logout","logintoTwitter"); if (!isTwitterLoggedInAlready()) { Log.d("Logout","Primer if es false"); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY); builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET); Configuration configuration = builder.build(); TwitterFactory factory = new TwitterFactory(configuration); twitter = factory.getInstance(); try { requestToken = twitter .getOAuthRequestToken(TWITTER_CALLBACK_URL); this.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse(requestToken.getAuthenticationURL()))); } catch (TwitterException e) { e.printStackTrace(); } } else { // user already logged into twitter Toast.makeText(getApplicationContext(), "Already Logged into twitter", Toast.LENGTH_LONG).show(); Log.d("Logout", "en logintoTwitter si estoy conectado de antes"); // Hide login button btnLoginTwitter.setVisibility(View.GONE); // Show Update Twitter lblUpdate.setVisibility(View.VISIBLE); txtUpdate.setVisibility(View.VISIBLE); btnUpdateStatus.setVisibility(View.VISIBLE); btnLogoutTwitter.setVisibility(View.VISIBLE); } } class updateTwitterStatus extends AsyncTask<String, String, String> {
void function() { Log.d(STR,STR); if (!isTwitterLoggedInAlready()) { Log.d(STR,STR); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY); builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET); Configuration configuration = builder.build(); TwitterFactory factory = new TwitterFactory(configuration); twitter = factory.getInstance(); try { requestToken = twitter .getOAuthRequestToken(TWITTER_CALLBACK_URL); this.startActivity(new Intent(Intent.ACTION_VIEW, Uri .parse(requestToken.getAuthenticationURL()))); } catch (TwitterException e) { e.printStackTrace(); } } else { Toast.makeText(getApplicationContext(), STR, Toast.LENGTH_LONG).show(); Log.d(STR, STR); btnLoginTwitter.setVisibility(View.GONE); lblUpdate.setVisibility(View.VISIBLE); txtUpdate.setVisibility(View.VISIBLE); btnUpdateStatus.setVisibility(View.VISIBLE); btnLogoutTwitter.setVisibility(View.VISIBLE); } } class updateTwitterStatus extends AsyncTask<String, String, String> {
/** * Function to login twitter * */
Function to login twitter
loginToTwitter
{ "repo_name": "kriminal666/AndroidTwitterConnect", "path": "src/com/iesebre/dam2/pa201415/criminal/androidTwitterConnect/MainActivity.java", "license": "mit", "size": 12142 }
[ "android.content.Intent", "android.net.Uri", "android.os.AsyncTask", "android.util.Log", "android.view.View", "android.widget.Toast" ]
import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import android.view.View; import android.widget.Toast;
import android.content.*; import android.net.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*;
[ "android.content", "android.net", "android.os", "android.util", "android.view", "android.widget" ]
android.content; android.net; android.os; android.util; android.view; android.widget;
265,782
@Override public void menuAboutToShow(IMenuManager menuManager) { super.menuAboutToShow(menuManager); MenuManager submenuManager = null; submenuManager = new MenuManager(RuntimeEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); populateManager(submenuManager, createChildActions, null); menuManager.insertBefore("edit", submenuManager); submenuManager = new MenuManager(RuntimeEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); populateManager(submenuManager, createSiblingActions, null); menuManager.insertBefore("edit", submenuManager); }
void function(IMenuManager menuManager) { super.menuAboutToShow(menuManager); MenuManager submenuManager = null; submenuManager = new MenuManager(RuntimeEditorPlugin.INSTANCE.getString(STR)); populateManager(submenuManager, createChildActions, null); menuManager.insertBefore("edit", submenuManager); submenuManager = new MenuManager(RuntimeEditorPlugin.INSTANCE.getString(STR)); populateManager(submenuManager, createSiblingActions, null); menuManager.insertBefore("edit", submenuManager); }
/** * This populates the pop-up menu before it appears. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This populates the pop-up menu before it appears.
menuAboutToShow
{ "repo_name": "awortmann/xmontiarc", "path": "ur1.diverse.xmontiarc.runtime.model.editor/src/runtime/presentation/RuntimeActionBarContributor.java", "license": "epl-1.0", "size": 13941 }
[ "org.eclipse.jface.action.IMenuManager", "org.eclipse.jface.action.MenuManager" ]
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
770,477
public void shutdownAndAwaitTermination() { executorService.shutdown(); try { // Wait a while for existing tasks to terminate if (!executorService.awaitTermination(EmailConstants.DEFAULT_TIMEOUT_VALUE, TimeUnit.SECONDS)) { executorService.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!executorService.awaitTermination(EmailConstants.DEFAULT_TIMEOUT_VALUE, TimeUnit.SECONDS)) { logger.error("Email sender executor pool did not terminate"); } } } catch (InterruptedException ie) { logger.error("An error occurred when shutting down and awaiting the termination of the existing tasks", ie); // (Re-)Cancel if current thread also interrupted executorService.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
void function() { executorService.shutdown(); try { if (!executorService.awaitTermination(EmailConstants.DEFAULT_TIMEOUT_VALUE, TimeUnit.SECONDS)) { executorService.shutdownNow(); if (!executorService.awaitTermination(EmailConstants.DEFAULT_TIMEOUT_VALUE, TimeUnit.SECONDS)) { logger.error(STR); } } } catch (InterruptedException ie) { logger.error(STR, ie); executorService.shutdownNow(); Thread.currentThread().interrupt(); } }
/** * Shutdown the thread pool */
Shutdown the thread pool
shutdownAndAwaitTermination
{ "repo_name": "kasunbg/carbon-deployment-monitor", "path": "deployment-monitor-core/src/main/java/org/wso2/deployment/monitor/utils/notification/email/EmailNotifications.java", "license": "apache-2.0", "size": 10020 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,155,973
public void checkin(String comment) { checkIsUpdateable(); try { this.node.setProperty( LAST_MODIFIED_PROPERTY_NAME, Calendar.getInstance() ); this.node.setProperty( CHECKIN_COMMENT, comment ); this.node.setProperty( LAST_CONTRIBUTOR_PROPERTY_NAME, this.node.getSession().getUserID() ); long nextVersion = getVersionNumber() + 1; this.node.setProperty( VERSION_NUMBER_PROPERTY_NAME, nextVersion ); this.node.getSession().save(); this.node.checkin(); } catch ( RepositoryException e ) { throw new RulesRepositoryException( "Unable to checkin.", e ); } }
void function(String comment) { checkIsUpdateable(); try { this.node.setProperty( LAST_MODIFIED_PROPERTY_NAME, Calendar.getInstance() ); this.node.setProperty( CHECKIN_COMMENT, comment ); this.node.setProperty( LAST_CONTRIBUTOR_PROPERTY_NAME, this.node.getSession().getUserID() ); long nextVersion = getVersionNumber() + 1; this.node.setProperty( VERSION_NUMBER_PROPERTY_NAME, nextVersion ); this.node.getSession().save(); this.node.checkin(); } catch ( RepositoryException e ) { throw new RulesRepositoryException( STR, e ); } }
/** * This will save the content (if it hasn't been already) and * then check it in to create a new version. * It will also set the last modified property. */
This will save the content (if it hasn't been already) and then check it in to create a new version. It will also set the last modified property
checkin
{ "repo_name": "bobmcwhirter/drools", "path": "drools-repository/src/main/java/org/drools/repository/VersionableItem.java", "license": "apache-2.0", "size": 28012 }
[ "java.util.Calendar", "javax.jcr.RepositoryException" ]
import java.util.Calendar; import javax.jcr.RepositoryException;
import java.util.*; import javax.jcr.*;
[ "java.util", "javax.jcr" ]
java.util; javax.jcr;
2,589,534
public InVarList getInVarFields() { InVarList inCols = new InVarList(); for (int r = 0; r < m_model.getRowCount(); r++) { if (!m_model.validateValues(r)) { // there are errors in this row continue; } Object value = m_model.getValueAt(r, Column.COLUMN); if (value instanceof FlowVariable) { FlowVariable colSpec = (FlowVariable)value; InVar inVar = new InVar(); inVar.setKnimeType(colSpec.getType()); inVar.setKnimeName(colSpec.getName()); inVar.setJavaName( (String)m_model.getValueAt(r, Column.JAVA_FIELD)); inVar.setJavaType((Class)m_model.getValueAt(r, Column.JAVA_TYPE)); inCols.add(inVar); } } return inCols; } private static class InputListCellRenderer extends FlowVariableListCellRenderer { /** * {@inheritDoc}
InVarList function() { InVarList inCols = new InVarList(); for (int r = 0; r < m_model.getRowCount(); r++) { if (!m_model.validateValues(r)) { continue; } Object value = m_model.getValueAt(r, Column.COLUMN); if (value instanceof FlowVariable) { FlowVariable colSpec = (FlowVariable)value; InVar inVar = new InVar(); inVar.setKnimeType(colSpec.getType()); inVar.setKnimeName(colSpec.getName()); inVar.setJavaName( (String)m_model.getValueAt(r, Column.JAVA_FIELD)); inVar.setJavaType((Class)m_model.getValueAt(r, Column.JAVA_TYPE)); inCols.add(inVar); } } return inCols; } private static class InputListCellRenderer extends FlowVariableListCellRenderer { /** * {@inheritDoc}
/** * Get the field definitions representing input flow variables. * * @return fields representing input flow variables */
Get the field definitions representing input flow variables
getInVarFields
{ "repo_name": "pavloff-de/spark4knime", "path": "src/de/pavloff/spark4knime/jsnippet/ui/InFieldsTable.java", "license": "gpl-3.0", "size": 20017 }
[ "de.pavloff.spark4knime.jsnippet.JavaField", "de.pavloff.spark4knime.jsnippet.JavaFieldList", "de.pavloff.spark4knime.jsnippet.ui.FieldsTableModel", "org.knime.core.node.util.FlowVariableListCellRenderer", "org.knime.core.node.workflow.FlowVariable" ]
import de.pavloff.spark4knime.jsnippet.JavaField; import de.pavloff.spark4knime.jsnippet.JavaFieldList; import de.pavloff.spark4knime.jsnippet.ui.FieldsTableModel; import org.knime.core.node.util.FlowVariableListCellRenderer; import org.knime.core.node.workflow.FlowVariable;
import de.pavloff.spark4knime.jsnippet.*; import de.pavloff.spark4knime.jsnippet.ui.*; import org.knime.core.node.util.*; import org.knime.core.node.workflow.*;
[ "de.pavloff.spark4knime", "org.knime.core" ]
de.pavloff.spark4knime; org.knime.core;
2,007,991
public static java.util.List extractStagingClassificationList(ims.domain.ILightweightDomainFactory domainFactory, ims.clinicaladmin.vo.StagingClassificationListVoCollection voCollection) { return extractStagingClassificationList(domainFactory, voCollection, null, new HashMap()); }
static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.clinicaladmin.vo.StagingClassificationListVoCollection voCollection) { return extractStagingClassificationList(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.oncology.configuration.domain.objects.StagingClassification list from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.oncology.configuration.domain.objects.StagingClassification list from the value object collection
extractStagingClassificationList
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/clinicaladmin/vo/domain/StagingClassificationListVoAssembler.java", "license": "agpl-3.0", "size": 17194 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,367,001
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<AppServiceEnvironmentResourceInner>> listByResourceGroupNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<AppServiceEnvironmentResourceInner>> function( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws DefaultErrorResponseErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return collection of App Service Environments. */
Get the next page of items
listByResourceGroupNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/AppServiceEnvironmentsClientImpl.java", "license": "mit", "size": 563770 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.appservice.fluent.models.AppServiceEnvironmentResourceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.appservice.fluent.models.AppServiceEnvironmentResourceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.appservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,643,077
public static List<AppNews> getNewsForApp(int appId) throws WebApiException { return getNewsForApp(appId, 5, null); }
static List<AppNews> function(int appId) throws WebApiException { return getNewsForApp(appId, 5, null); }
/** * Loads the news for the given game with the given restrictions * * @param appId The unique Steam Application ID of the game (e.g. * <code>440</code> for Team Fortress 2). See * http://developer.valvesoftware.com/wiki/Steam_Application_IDs for * all application IDs * @return A list of news for the specified game with the given options * @throws WebApiException if a request to Steam's Web API fails */
Loads the news for the given game with the given restrictions
getNewsForApp
{ "repo_name": "koraktor/steam-condenser-java", "path": "src/main/java/com/github/koraktor/steamcondenser/community/AppNews.java", "license": "bsd-3-clause", "size": 8166 }
[ "com.github.koraktor.steamcondenser.exceptions.WebApiException", "java.util.List" ]
import com.github.koraktor.steamcondenser.exceptions.WebApiException; import java.util.List;
import com.github.koraktor.steamcondenser.exceptions.*; import java.util.*;
[ "com.github.koraktor", "java.util" ]
com.github.koraktor; java.util;
904,090
EList<MountingPoint> getMountingPoints();
EList<MountingPoint> getMountingPoints();
/** * Returns the value of the '<em><b>Mounting Points</b></em>' reference list. * The list contents are of type {@link CIM.IEC61970.Informative.InfAssets.MountingPoint}. * It is bidirectional and its opposite is '{@link CIM.IEC61970.Informative.InfAssets.MountingPoint#getConnections <em>Connections</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Mounting Points</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Mounting Points</em>' reference list. * @see CIM.IEC61970.Informative.InfAssets.InfAssetsPackage#getMountingConnection_MountingPoints() * @see CIM.IEC61970.Informative.InfAssets.MountingPoint#getConnections * @model opposite="Connections" * @generated */
Returns the value of the 'Mounting Points' reference list. The list contents are of type <code>CIM.IEC61970.Informative.InfAssets.MountingPoint</code>. It is bidirectional and its opposite is '<code>CIM.IEC61970.Informative.InfAssets.MountingPoint#getConnections Connections</code>'. If the meaning of the 'Mounting Points' reference list isn't clear, there really should be more of a description here...
getMountingPoints
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Informative/InfAssets/MountingConnection.java", "license": "mit", "size": 4603 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
395,336
public Map<K,WindowFuture<K,R,P>> createSortedSnapshot() { Map<K,WindowFuture<K,R,P>> sortedRequests = new TreeMap<K,WindowFuture<K,R,P>>(); sortedRequests.putAll(this.futures); return sortedRequests; }
Map<K,WindowFuture<K,R,P>> function() { Map<K,WindowFuture<K,R,P>> sortedRequests = new TreeMap<K,WindowFuture<K,R,P>>(); sortedRequests.putAll(this.futures); return sortedRequests; }
/** * Creates an ordered snapshot of the requests in this window. The entries * will be sorted by the natural ascending order of the key. A new map * is allocated when calling this method, so be careful about calling it * once. * @return A new map instance representing all requests sorted by * the natural ascending order of its key. */
Creates an ordered snapshot of the requests in this window. The entries will be sorted by the natural ascending order of the key. A new map is allocated when calling this method, so be careful about calling it once
createSortedSnapshot
{ "repo_name": "twitter/cloudhopper-commons", "path": "ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java", "license": "apache-2.0", "size": 31012 }
[ "java.util.Map", "java.util.TreeMap" ]
import java.util.Map; import java.util.TreeMap;
import java.util.*;
[ "java.util" ]
java.util;
142,156
public List<Node> visit() { List<Node> nodes = new ArrayList<>(); visit(nodes, root); return nodes; }
List<Node> function() { List<Node> nodes = new ArrayList<>(); visit(nodes, root); return nodes; }
/** * Visit the tree in preorder, i.e. first visit the root and the children, * and returns the list of all the nodes * @return The list of nodes. */
Visit the tree in preorder, i.e. first visit the root and the children, and returns the list of all the nodes
visit
{ "repo_name": "mutandon/IQR", "path": "src/main/java/it/unitn/disi/db/queryrelaxation/tree/OptimalRelaxationTree.java", "license": "gpl-2.0", "size": 28838 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
281,664
private int nextNonWhitespace(boolean throwOnEof) throws IOException { char[] buffer = this.buffer; int p = pos; int l = limit; while (true) { if (p == l) { pos = p; if (!fillBuffer(1)) { break; } p = pos; l = limit; } int c = buffer[p++]; if (c == '\n') { lineNumber++; lineStart = p; continue; } else if (c == ' ' || c == '\r' || c == '\t') { continue; } if (c == '/') { pos = p; if (p == l) { pos--; // push back '/' so it's still in the buffer when this method returns boolean charsLoaded = fillBuffer(2); pos++; // consume the '/' again if (!charsLoaded) { return c; } } checkLenient(); char peek = buffer[pos]; switch (peek) { case '*': // skip a pos++; if (!skipTo("*/")) { throw syntaxError("Unterminated comment"); } p = pos + 2; l = limit; continue; case '/': // skip a // end-of-line comment pos++; skipToEndOfLine(); p = pos; l = limit; continue; default: return c; } } else if (c == '#') { pos = p; checkLenient(); skipToEndOfLine(); p = pos; l = limit; } else { pos = p; return c; } } if (throwOnEof) { throw new EOFException("End of input" + " at line " + getLineNumber() + " column " + getColumnNumber()); } else { return -1; } }
int function(boolean throwOnEof) throws IOException { char[] buffer = this.buffer; int p = pos; int l = limit; while (true) { if (p == l) { pos = p; if (!fillBuffer(1)) { break; } p = pos; l = limit; } int c = buffer[p++]; if (c == '\n') { lineNumber++; lineStart = p; continue; } else if (c == ' ' c == '\r' c == '\t') { continue; } if (c == '/') { pos = p; if (p == l) { pos--; boolean charsLoaded = fillBuffer(2); pos++; if (!charsLoaded) { return c; } } checkLenient(); char peek = buffer[pos]; switch (peek) { case '*': pos++; if (!skipTo("*/")) { throw syntaxError(STR); } p = pos + 2; l = limit; continue; case '/': pos++; skipToEndOfLine(); p = pos; l = limit; continue; default: return c; } } else if (c == '#') { pos = p; checkLenient(); skipToEndOfLine(); p = pos; l = limit; } else { pos = p; return c; } } if (throwOnEof) { throw new EOFException(STR + STR + getLineNumber() + STR + getColumnNumber()); } else { return -1; } }
/** * Returns the next character in the stream that is neither whitespace nor a * part of a comment. When this returns, the returned character is always at * {@code buffer[pos-1]}; this means the caller can always push back the * returned character by decrementing {@code pos}. */
Returns the next character in the stream that is neither whitespace nor a part of a comment. When this returns, the returned character is always at buffer[pos-1]; this means the caller can always push back the returned character by decrementing pos
nextNonWhitespace
{ "repo_name": "vparfonov/gson", "path": "src/main/java/com/google/gson/stream/JsonReader.java", "license": "apache-2.0", "size": 48772 }
[ "java.io.EOFException", "java.io.IOException" ]
import java.io.EOFException; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,049,429
public void changeField(Field oldField, Field newField) throws xBaseJException, IOException { int i, j; Field tField; for (i = 0; i < fldcount; i++) { tField = getField(i); if (oldField.getName().equalsIgnoreCase(tField.getName())) break; } if (i > fldcount) throw new xBaseJException("Field: " + oldField.getName() + " does not exist."); for (j = 0; j < fldcount; j++) { tField = getField(j); if (newField.getName().equalsIgnoreCase(tField.getName()) && (j != i)) throw new xBaseJException("Field: " + newField.getName() + " already exists."); } }
void function(Field oldField, Field newField) throws xBaseJException, IOException { int i, j; Field tField; for (i = 0; i < fldcount; i++) { tField = getField(i); if (oldField.getName().equalsIgnoreCase(tField.getName())) break; } if (i > fldcount) throw new xBaseJException(STR + oldField.getName() + STR); for (j = 0; j < fldcount; j++) { tField = getField(j); if (newField.getName().equalsIgnoreCase(tField.getName()) && (j != i)) throw new xBaseJException(STR + newField.getName() + STR); } }
/** * changes a Field in a database NOT FULLY IMPLEMENTED * * @param oldField a Field object * @param newField a Field object * @see Field * @throws xBaseJException org.xBaseJ error caused by called methods * @throws IOException Java error caused by called methods */
changes a Field in a database NOT FULLY IMPLEMENTED
changeField
{ "repo_name": "ianturton/xbasej", "path": "src/main/java/org/xbasej/DBF.java", "license": "lgpl-3.0", "size": 76131 }
[ "java.io.IOException", "org.xbasej.fields.Field" ]
import java.io.IOException; import org.xbasej.fields.Field;
import java.io.*; import org.xbasej.fields.*;
[ "java.io", "org.xbasej.fields" ]
java.io; org.xbasej.fields;
2,176,046
DateFormat formatter = new SimpleDateFormat(format, Locale.getDefault()); if (timezone == null) { formatter.setTimeZone(TimeZone.getDefault()); } else { formatter.setTimeZone(TimeZone.getTimeZone(timezone)); } return formatter.format(date); }
DateFormat formatter = new SimpleDateFormat(format, Locale.getDefault()); if (timezone == null) { formatter.setTimeZone(TimeZone.getDefault()); } else { formatter.setTimeZone(TimeZone.getTimeZone(timezone)); } return formatter.format(date); }
/** * getDateAsString * Convert a date into a string * * @param date the date * @param format the format in which to return the string * @return the new formatted date string */
getDateAsString Convert a date into a string
getDateAsString
{ "repo_name": "throwrocks/android-udacity-reviews", "path": "app/src/main/java/rocks/athrow/android_udacity_reviews/util/Utilities.java", "license": "mit", "size": 6158 }
[ "java.text.DateFormat", "java.text.SimpleDateFormat", "java.util.Locale", "java.util.TimeZone" ]
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Locale; import java.util.TimeZone;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
2,032,274
Set<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds( MembershipListener l);
Set<InternalDistributedMember> addMembershipListenerAndGetDistributionManagerIds( MembershipListener l);
/** * Add a membership listener and return other DistributionManagerIds as an atomic operation */
Add a membership listener and return other DistributionManagerIds as an atomic operation
addMembershipListenerAndGetDistributionManagerIds
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java", "license": "apache-2.0", "size": 14971 }
[ "java.util.Set", "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import java.util.Set; import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import java.util.*; import org.apache.geode.distributed.internal.membership.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
341,123
private File validateWorkingDirectory(String workingDir) { if (isEmpty(workingDir)) { throw new IllegalArgumentException( "Locator WorkingDirectory must not be null"); } return new File(workingDir); } // ------------------------------------------------------------------------- // Static utility methods // -------------------------------------------------------------------------
File function(String workingDir) { if (isEmpty(workingDir)) { throw new IllegalArgumentException( STR); } return new File(workingDir); }
/** * Validates working directory is not null or empty. */
Validates working directory is not null or empty
validateWorkingDirectory
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AgentConfigImpl.java", "license": "apache-2.0", "size": 65559 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,402,703
static void attemptClose(Statement o) { try { if (o != null) {o.close();} else { }} catch (Exception e) { e.printStackTrace();} }
static void attemptClose(Statement o) { try { if (o != null) {o.close();} else { }} catch (Exception e) { e.printStackTrace();} }
/** * Tries to close object. * @param o Statement */
Tries to close object
attemptClose
{ "repo_name": "bushed/NettyServer", "path": "src/nettyserver/StatDAO.java", "license": "apache-2.0", "size": 10615 }
[ "java.sql.Statement" ]
import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,856,898
@Override public void visitSymbol(ESymbol userSymbolNode, SemanticScope semanticScope) { boolean read = semanticScope.getCondition(userSymbolNode, Read.class); boolean write = semanticScope.getCondition(userSymbolNode, Write.class); String symbol = userSymbolNode.getSymbol(); Class<?> staticType = semanticScope.getScriptScope().getPainlessLookup().canonicalTypeNameToType(symbol); if (staticType != null) { if (write) { throw userSymbolNode.createError( new IllegalArgumentException( "invalid assignment: " + "cannot write a value to a static type [" + PainlessLookupUtility.typeToCanonicalTypeName(staticType) + "]" ) ); } if (read == false) { throw userSymbolNode.createError( new IllegalArgumentException( "not a statement: " + "static type [" + PainlessLookupUtility.typeToCanonicalTypeName(staticType) + "] not used" ) ); } semanticScope.putDecoration(userSymbolNode, new StaticType(staticType)); } else if (semanticScope.isVariableDefined(symbol)) { if (read == false && write == false) { throw userSymbolNode.createError(new IllegalArgumentException("not a statement: variable [" + symbol + "] not used")); } Location location = userSymbolNode.getLocation(); Variable variable = semanticScope.getVariable(location, symbol); if (write && variable.isFinal()) { throw userSymbolNode.createError(new IllegalArgumentException("Variable [" + variable.getName() + "] is read-only.")); } Class<?> valueType = variable.getType(); semanticScope.putDecoration(userSymbolNode, new ValueType(valueType)); } else { semanticScope.putDecoration(userSymbolNode, new PartialCanonicalTypeName(symbol)); } }
void function(ESymbol userSymbolNode, SemanticScope semanticScope) { boolean read = semanticScope.getCondition(userSymbolNode, Read.class); boolean write = semanticScope.getCondition(userSymbolNode, Write.class); String symbol = userSymbolNode.getSymbol(); Class<?> staticType = semanticScope.getScriptScope().getPainlessLookup().canonicalTypeNameToType(symbol); if (staticType != null) { if (write) { throw userSymbolNode.createError( new IllegalArgumentException( STR + STR + PainlessLookupUtility.typeToCanonicalTypeName(staticType) + "]" ) ); } if (read == false) { throw userSymbolNode.createError( new IllegalArgumentException( STR + STR + PainlessLookupUtility.typeToCanonicalTypeName(staticType) + STR ) ); } semanticScope.putDecoration(userSymbolNode, new StaticType(staticType)); } else if (semanticScope.isVariableDefined(symbol)) { if (read == false && write == false) { throw userSymbolNode.createError(new IllegalArgumentException(STR + symbol + STR)); } Location location = userSymbolNode.getLocation(); Variable variable = semanticScope.getVariable(location, symbol); if (write && variable.isFinal()) { throw userSymbolNode.createError(new IllegalArgumentException(STR + variable.getName() + STR)); } Class<?> valueType = variable.getType(); semanticScope.putDecoration(userSymbolNode, new ValueType(valueType)); } else { semanticScope.putDecoration(userSymbolNode, new PartialCanonicalTypeName(symbol)); } }
/** * Visits a symbol expression which covers static types, partial canonical types, * and variables. * Checks: type checking, type resolution, variable resolution */
Visits a symbol expression which covers static types, partial canonical types, and variables. Checks: type checking, type resolution, variable resolution
visitSymbol
{ "repo_name": "GlenRSmith/elasticsearch", "path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultSemanticAnalysisPhase.java", "license": "apache-2.0", "size": 160963 }
[ "org.elasticsearch.painless.Location", "org.elasticsearch.painless.lookup.PainlessLookupUtility", "org.elasticsearch.painless.node.ESymbol", "org.elasticsearch.painless.symbol.Decorations", "org.elasticsearch.painless.symbol.SemanticScope" ]
import org.elasticsearch.painless.Location; import org.elasticsearch.painless.lookup.PainlessLookupUtility; import org.elasticsearch.painless.node.ESymbol; import org.elasticsearch.painless.symbol.Decorations; import org.elasticsearch.painless.symbol.SemanticScope;
import org.elasticsearch.painless.*; import org.elasticsearch.painless.lookup.*; import org.elasticsearch.painless.node.*; import org.elasticsearch.painless.symbol.*;
[ "org.elasticsearch.painless" ]
org.elasticsearch.painless;
2,137,913
public boolean hasStepStarted( String sname, int copy ) { // log.logDetailed("DIS: Checking wether of not ["+sname+"]."+cnr+" has started!"); // log.logDetailed("DIS: hasStepStarted() looking in "+threads.size()+" threads"); for ( int i = 0; i < steps.size(); i++ ) { StepMetaDataCombi sid = steps.get( i ); boolean started = ( sid.stepname != null && sid.stepname.equalsIgnoreCase( sname ) ) && sid.copy == copy; if ( started ) { return true; } } return false; }
boolean function( String sname, int copy ) { for ( int i = 0; i < steps.size(); i++ ) { StepMetaDataCombi sid = steps.get( i ); boolean started = ( sid.stepname != null && sid.stepname.equalsIgnoreCase( sname ) ) && sid.copy == copy; if ( started ) { return true; } } return false; }
/** * Checks whether the specified step (or step copy) has started. * * @param sname * the step name * @param copy * the copy number * @return true the specified step (or step copy) has started, false otherwise */
Checks whether the specified step (or step copy) has started
hasStepStarted
{ "repo_name": "alina-ipatina/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/Trans.java", "license": "apache-2.0", "size": 197880 }
[ "org.pentaho.di.trans.step.StepMetaDataCombi" ]
import org.pentaho.di.trans.step.StepMetaDataCombi;
import org.pentaho.di.trans.step.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,578,069
public void setNumReplies(org.ontoware.rdf2go.model.node.Node value) { Base.set(this.model, this.getResource(), NUMREPLIES, value); }
void function(org.ontoware.rdf2go.model.node.Node value) { Base.set(this.model, this.getResource(), NUMREPLIES, value); }
/** * Sets a value of property NumReplies from an RDF2Go node. First, all * existing values are removed, then this value is added. Cardinality * constraints are not checked, but this method exists only for properties * with no minCardinality or minCardinality == 1. * * @param value * the value to be added * * [Generated from RDFReactor template rule #set1dynamic] */
Sets a value of property NumReplies from an RDF2Go node. First, all existing values are removed, then this value is added. Cardinality constraints are not checked, but this method exists only for properties with no minCardinality or minCardinality == 1
setNumReplies
{ "repo_name": "m0ep/master-thesis", "path": "source/apis/rdf2go/rdf2go-sioc/src/main/java/org/rdfs/sioc/Thing.java", "license": "mit", "size": 317844 }
[ "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdfreactor" ]
org.ontoware.rdfreactor;
1,083,888
public java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI> getSubterm_multisets_EmptyHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.EmptyImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI( (fr.lip6.move.pnml.hlpn.multisets.Empty)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.EmptyImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.EmptyHLAPI( (fr.lip6.move.pnml.hlpn.multisets.Empty)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of EmptyHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of EmptyHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_multisets_EmptyHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/GreaterThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108757 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,882,628
public static void setDefaultXmppStringprep(XmppStringprep defaultXmppStringprep) { JxmppContext.defaultXmppStringprep = Objects.requireNonNull(defaultXmppStringprep, "defaultXmppStringprep"); updateDefaultContext(); }
static void function(XmppStringprep defaultXmppStringprep) { JxmppContext.defaultXmppStringprep = Objects.requireNonNull(defaultXmppStringprep, STR); updateDefaultContext(); }
/** * Set the default XmppStringprep interface. * * @param defaultXmppStringprep the default XmppStringprep interface. */
Set the default XmppStringprep interface
setDefaultXmppStringprep
{ "repo_name": "Flowdalic/jxmpp", "path": "jxmpp-core/src/main/java/org/jxmpp/JxmppContext.java", "license": "apache-2.0", "size": 3037 }
[ "org.jxmpp.stringprep.XmppStringprep", "org.jxmpp.util.Objects" ]
import org.jxmpp.stringprep.XmppStringprep; import org.jxmpp.util.Objects;
import org.jxmpp.stringprep.*; import org.jxmpp.util.*;
[ "org.jxmpp.stringprep", "org.jxmpp.util" ]
org.jxmpp.stringprep; org.jxmpp.util;
2,587,765
EReference getDocumentRoot_PartnerEntity();
EReference getDocumentRoot_PartnerEntity();
/** * Returns the meta object for the containment reference '{@link org.eclipse.bpmn2.DocumentRoot#getPartnerEntity <em>Partner Entity</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Partner Entity</em>'. * @see org.eclipse.bpmn2.DocumentRoot#getPartnerEntity() * @see #getDocumentRoot() * @generated */
Returns the meta object for the containment reference '<code>org.eclipse.bpmn2.DocumentRoot#getPartnerEntity Partner Entity</code>'.
getDocumentRoot_PartnerEntity
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,031
@ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceGroupName, String namespaceName, String relayName) { deleteAsync(resourceGroupName, namespaceName, relayName).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) void function(String resourceGroupName, String namespaceName, String relayName) { deleteAsync(resourceGroupName, namespaceName, relayName).block(); }
/** * Deletes a WCF relay. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param namespaceName The namespace name. * @param relayName The relay name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Deletes a WCF relay
delete
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/relay/azure-resourcemanager-relay/src/main/java/com/azure/resourcemanager/relay/implementation/WcfRelaysClientImpl.java", "license": "mit", "size": 109024 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
1,875,660
public void RemoveAPIEnvironments(APIIdentifier apiIdentifier) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; int apiId; String deleteEnvironments = SQLConstants.REMOVE_API_ENVIRONMENTS_SQL; try { connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(deleteEnvironments); apiId = getAPIID(apiIdentifier, connection); if (apiId == -1) { String msg = "Could not load API record for: " + apiIdentifier.getApiName(); log.error(msg); throw new APIManagementException(msg); } prepStmt.setInt(1, apiId); prepStmt.execute(); connection.commit(); } catch (SQLException e) { handleException("Error while deleting environments for API : " + apiIdentifier.getApiName(), e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }
void function(APIIdentifier apiIdentifier) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; int apiId; String deleteEnvironments = SQLConstants.REMOVE_API_ENVIRONMENTS_SQL; try { connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(deleteEnvironments); apiId = getAPIID(apiIdentifier, connection); if (apiId == -1) { String msg = STR + apiIdentifier.getApiName(); log.error(msg); throw new APIManagementException(msg); } prepStmt.setInt(1, apiId); prepStmt.execute(); connection.commit(); } catch (SQLException e) { handleException(STR + apiIdentifier.getApiName(), e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }
/** * Remove persisted Environments of the API * * @param apiIdentifier API Identifier * @throws APIManagementException */
Remove persisted Environments of the API
RemoveAPIEnvironments
{ "repo_name": "knPerera/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 493075 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.APIIdentifier", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
1,052,101
@Override public Queue<Packet> processSocketData(XMPPIOService<Object> serv) { Queue<Packet> packets = serv.getReceivedPackets(); Packet p = null; while ((p = packets.poll()) != null) { // log.finer("Processing packet: " + p.getElemName() // + ", type: " + p.getType()); if (p.getXMLNS() == XMLNS_SERVER_VAL) { p.getElement().setXMLNS(XMLNS_CLIENT_VAL); } if (log.isLoggable(Level.FINEST)) { log.finest(serv + ", Processing socket data: " + p); } if (p.getXMLNS() == XMLNS_DB_VAL) { processDialback(p, serv); } else { if (p.getElemName() == "error") { processStreamError(p, serv); return null; } else { if (checkPacket(p, serv)) { if (log.isLoggable(Level.FINEST)) { log.finest(serv + ", Adding packet out: " + p); } addOutPacket(p); } else { return null; } } } // end of else } // end of while () return null; }
Queue<Packet> function(XMPPIOService<Object> serv) { Queue<Packet> packets = serv.getReceivedPackets(); Packet p = null; while ((p = packets.poll()) != null) { if (p.getXMLNS() == XMLNS_SERVER_VAL) { p.getElement().setXMLNS(XMLNS_CLIENT_VAL); } if (log.isLoggable(Level.FINEST)) { log.finest(serv + STR + p); } if (p.getXMLNS() == XMLNS_DB_VAL) { processDialback(p, serv); } else { if (p.getElemName() == "error") { processStreamError(p, serv); return null; } else { if (checkPacket(p, serv)) { if (log.isLoggable(Level.FINEST)) { log.finest(serv + STR + p); } addOutPacket(p); } else { return null; } } } } return null; }
/** * Method description * * * @param serv * * */
Method description
processSocketData
{ "repo_name": "wangningbo/tigase-server", "path": "src/main/java/tigase/server/xmppserver/ServerConnectionManager.java", "license": "agpl-3.0", "size": 43238 }
[ "java.util.Queue", "java.util.logging.Level" ]
import java.util.Queue; import java.util.logging.Level;
import java.util.*; import java.util.logging.*;
[ "java.util" ]
java.util;
2,519,966
public ICategory createCategory(String name);
ICategory function(String name);
/** * Creates or returns an existing {@link ICategory} with the provided name from the store. * * @param name * @return */
Creates or returns an existing <code>ICategory</code> with the provided name from the store
createCategory
{ "repo_name": "elexis/elexis-3-core", "path": "bundles/ch.elexis.core/src/ch/elexis/core/services/IDocumentStore.java", "license": "epl-1.0", "size": 3490 }
[ "ch.elexis.core.model.ICategory" ]
import ch.elexis.core.model.ICategory;
import ch.elexis.core.model.*;
[ "ch.elexis.core" ]
ch.elexis.core;
143,188
public static boolean isRawSuperType(Type type, Type superTypeCandidate) { return isRawSuperType(type, superTypeCandidate, new RecursionGuard<Type>()); }
static boolean function(Type type, Type superTypeCandidate) { return isRawSuperType(type, superTypeCandidate, new RecursionGuard<Type>()); }
/** * Check if superTypeCandidate is raw super type of Type. Structural typing is ignored here. */
Check if superTypeCandidate is raw super type of Type. Structural typing is ignored here
isRawSuperType
{ "repo_name": "lbeurerkellner/n4js", "path": "plugins/org.eclipse.n4js.ts/src/org/eclipse/n4js/ts/utils/TypeUtils.java", "license": "epl-1.0", "size": 59084 }
[ "org.eclipse.n4js.ts.types.Type", "org.eclipse.n4js.utils.RecursionGuard" ]
import org.eclipse.n4js.ts.types.Type; import org.eclipse.n4js.utils.RecursionGuard;
import org.eclipse.n4js.ts.types.*; import org.eclipse.n4js.utils.*;
[ "org.eclipse.n4js" ]
org.eclipse.n4js;
2,643,260
@SuppressWarnings("unchecked") public Type enrich(String resourceUri, AggregationStrategy aggregationStrategy, boolean aggregateOnException) { EnrichDefinition enrich = new EnrichDefinition(aggregationStrategy, resourceUri); enrich.setAggregateOnException(aggregateOnException); addOutput(enrich); return (Type) this; }
@SuppressWarnings(STR) Type function(String resourceUri, AggregationStrategy aggregationStrategy, boolean aggregateOnException) { EnrichDefinition enrich = new EnrichDefinition(aggregationStrategy, resourceUri); enrich.setAggregateOnException(aggregateOnException); addOutput(enrich); return (Type) this; }
/** * The <a href="http://camel.apache.org/content-enricher.html">Content Enricher EIP</a> * enriches an exchange with additional data obtained from a <code>resourceUri</code>. * * @param resourceUri URI of resource endpoint for obtaining additional data. * @param aggregationStrategy aggregation strategy to aggregate input data and additional data. * @return the builder * @see org.apache.camel.processor.Enricher */
The Content Enricher EIP enriches an exchange with additional data obtained from a <code>resourceUri</code>
enrich
{ "repo_name": "oscerd/camel", "path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java", "license": "apache-2.0", "size": 144870 }
[ "org.apache.camel.processor.aggregate.AggregationStrategy" ]
import org.apache.camel.processor.aggregate.AggregationStrategy;
import org.apache.camel.processor.aggregate.*;
[ "org.apache.camel" ]
org.apache.camel;
945,686
private String getReadonlyDisplayValue(final Object value, final HtmlCheckBox checkBox) { final StringBuilder sb = new StringBuilder(); if (StringUtils.isNotEmpty(checkBox.getDescription())) { sb.append(checkBox.getDescription()).append(": "); } sb.append((Boolean) value ? "ja" : "nein"); return sb.toString(); }
String function(final Object value, final HtmlCheckBox checkBox) { final StringBuilder sb = new StringBuilder(); if (StringUtils.isNotEmpty(checkBox.getDescription())) { sb.append(checkBox.getDescription()).append(STR); } sb.append((Boolean) value ? "ja" : "nein"); return sb.toString(); }
/** * Should return value string for the readonly view mode. Can be overridden * for custom components. */
Should return value string for the readonly view mode. Can be overridden for custom components
getReadonlyDisplayValue
{ "repo_name": "ButterFaces/ButterFaces", "path": "components/src/main/java/org/butterfaces/component/partrenderer/CheckBoxReadonlyPartRenderer.java", "license": "mit", "size": 2313 }
[ "org.butterfaces.component.html.HtmlCheckBox", "org.butterfaces.util.StringUtils" ]
import org.butterfaces.component.html.HtmlCheckBox; import org.butterfaces.util.StringUtils;
import org.butterfaces.component.html.*; import org.butterfaces.util.*;
[ "org.butterfaces.component", "org.butterfaces.util" ]
org.butterfaces.component; org.butterfaces.util;
1,112,760
private void createUpdateSqlReset() { m_createSqlColumn = new ArrayList<String>(); m_createSqlValue = new ArrayList<String>(); } // createUpdateSqlReset
void function() { m_createSqlColumn = new ArrayList<String>(); m_createSqlValue = new ArrayList<String>(); }
/** * Reset Update Data */
Reset Update Data
createUpdateSqlReset
{ "repo_name": "mgrigioni/oseb", "path": "base/src/org/compiere/model/GridTable.java", "license": "gpl-2.0", "size": 97286 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
441,330
public T gzip() { GzipDataFormat gzdf = new GzipDataFormat(); return dataFormat(gzdf); }
T function() { GzipDataFormat gzdf = new GzipDataFormat(); return dataFormat(gzdf); }
/** * Uses the GZIP deflater data format */
Uses the GZIP deflater data format
gzip
{ "repo_name": "aaronwalker/camel", "path": "camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java", "license": "apache-2.0", "size": 18605 }
[ "org.apache.camel.model.dataformat.GzipDataFormat" ]
import org.apache.camel.model.dataformat.GzipDataFormat;
import org.apache.camel.model.dataformat.*;
[ "org.apache.camel" ]
org.apache.camel;
530,953
public AbstractLink setBody(final IModel<?> bodyModel) { this.bodyModel = wrap(bodyModel); return this; }
AbstractLink function(final IModel<?> bodyModel) { this.bodyModel = wrap(bodyModel); return this; }
/** * Sets the link's body model * * @param bodyModel * @return <code>this</code> for method chaining */
Sets the link's body model
setBody
{ "repo_name": "aldaris/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/markup/html/link/AbstractLink.java", "license": "apache-2.0", "size": 3403 }
[ "org.apache.wicket.model.IModel" ]
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.*;
[ "org.apache.wicket" ]
org.apache.wicket;
894,781
public static List<TasksEntry> filterFindByG_A(long groupId, long assigneeUserId) { return getPersistence().filterFindByG_A(groupId, assigneeUserId); }
static List<TasksEntry> function(long groupId, long assigneeUserId) { return getPersistence().filterFindByG_A(groupId, assigneeUserId); }
/** * Returns all the tasks entries that the user has permission to view where groupId = &#63; and assigneeUserId = &#63;. * * @param groupId the group ID * @param assigneeUserId the assignee user ID * @return the matching tasks entries that the user has permission to view */
Returns all the tasks entries that the user has permission to view where groupId = &#63; and assigneeUserId = &#63;
filterFindByG_A
{ "repo_name": "gamerson/blade", "path": "test-resources/projects/tasks-plugins-sdk/portlets/tasks-portlet/docroot/WEB-INF/service/com/liferay/tasks/service/persistence/TasksEntryUtil.java", "license": "apache-2.0", "size": 94635 }
[ "com.liferay.tasks.model.TasksEntry", "java.util.List" ]
import com.liferay.tasks.model.TasksEntry; import java.util.List;
import com.liferay.tasks.model.*; import java.util.*;
[ "com.liferay.tasks", "java.util" ]
com.liferay.tasks; java.util;
75,571
public static boolean move(File from, File to) throws IOException { FileUtils.moveFile(from, to); return true; // try{ // synchronized(getLock(to)){ // return from.renameTo(to); // } // } finally{ // freeLock(to); // } }
static boolean function(File from, File to) throws IOException { FileUtils.moveFile(from, to); return true; }
/** * Moves a file from one location to another. Assuming no exception is * thrown, always returns true. * * @param from * @param to */
Moves a file from one location to another. Assuming no exception is thrown, always returns true
move
{ "repo_name": "dbuxo/CommandHelper", "path": "src/main/java/com/laytonsmith/PureUtilities/Common/FileUtil.java", "license": "mit", "size": 12513 }
[ "java.io.File", "java.io.IOException", "org.apache.commons.io.FileUtils" ]
import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils;
import java.io.*; import org.apache.commons.io.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
1,930,287
public void addVisitor(ArrayList<Visitor> visitors) { this.visitors.addAll(visitors); }
void function(ArrayList<Visitor> visitors) { this.visitors.addAll(visitors); }
/** * Adds visitors. * @param visitors visitors */
Adds visitors
addVisitor
{ "repo_name": "misterflud/aoleynikov", "path": "chapter_002/additionalTask/src/main/java/ru/job4j/Bank.java", "license": "apache-2.0", "size": 3150 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
108,202
public static Statement getStatement(String dbname) { try { if (driver == null) driver = new org.gjt.mm.mysql.Driver(); Connection conn = driver.connect(String.format( "jdbc:mysql://%s/%s?user=%s&password=%s", dbhost, dbname, dbuser, dbpwd), null); Statement stmt = conn.createStatement(); return stmt; } catch (Exception e) { return null; } }
static Statement function(String dbname) { try { if (driver == null) driver = new org.gjt.mm.mysql.Driver(); Connection conn = driver.connect(String.format( "jdbc:mysql: dbuser, dbpwd), null); Statement stmt = conn.createStatement(); return stmt; } catch (Exception e) { return null; } }
/** * Get db statement, change dbname if necessary, not stored in connection * pool * * @param dbname * @return null if exception occurred */
Get db statement, change dbname if necessary, not stored in connection pool
getStatement
{ "repo_name": "javajoker/infoecos", "path": "src/com/infoecos/util/db/DBUtil.java", "license": "gpl-2.0", "size": 5701 }
[ "java.sql.Connection", "java.sql.Driver", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.Driver; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,860,483
public static List<String> toString(Throwable ex) { return toString(ex, null); }
static List<String> function(Throwable ex) { return toString(ex, null); }
/** * Converts a {@link Throwable} object into a flattened list of texts including its stack trace * and the stack traces of the nested causes. * @param ex a {@link Throwable} object * @return a flattened list of texts including the {@link Throwable} object's stack trace * and the stack traces of the nested causes. */
Converts a <code>Throwable</code> object into a flattened list of texts including its stack trace and the stack traces of the nested causes
toString
{ "repo_name": "LantaoJin/spark", "path": "sql/hive-thriftserver/v2.3.5/src/main/java/org/apache/hive/service/cli/HiveSQLException.java", "license": "apache-2.0", "size": 7742 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,809,525
public static LazyObject createLazyPrimitiveClass( PrimitiveObjectInspector oi) { PrimitiveCategory p = oi.getPrimitiveCategory(); switch (p) { case BOOLEAN: return new CassandraLazyBoolean((LazyBooleanObjectInspector) oi); case BYTE: return new LazyByte((LazyByteObjectInspector) oi); case SHORT: return new LazyShort((LazyShortObjectInspector) oi); case INT: return new CassandraLazyInteger((LazyIntObjectInspector) oi); case LONG: return new CassandraLazyLong((LazyLongObjectInspector) oi); case FLOAT: return new CassandraLazyFloat((LazyFloatObjectInspector) oi); case DOUBLE: return new CassandraLazyDouble((LazyDoubleObjectInspector) oi); case STRING: return new CassandraLazyString((LazyStringObjectInspector) oi); case BINARY: return new CassandraLazyBinary((LazyBinaryObjectInspector) oi); case TIMESTAMP: return new CassandraLazyTimestamp((LazyTimestampObjectInspector) oi); default: throw new RuntimeException("Internal error: no LazyObject for " + p); } }
static LazyObject function( PrimitiveObjectInspector oi) { PrimitiveCategory p = oi.getPrimitiveCategory(); switch (p) { case BOOLEAN: return new CassandraLazyBoolean((LazyBooleanObjectInspector) oi); case BYTE: return new LazyByte((LazyByteObjectInspector) oi); case SHORT: return new LazyShort((LazyShortObjectInspector) oi); case INT: return new CassandraLazyInteger((LazyIntObjectInspector) oi); case LONG: return new CassandraLazyLong((LazyLongObjectInspector) oi); case FLOAT: return new CassandraLazyFloat((LazyFloatObjectInspector) oi); case DOUBLE: return new CassandraLazyDouble((LazyDoubleObjectInspector) oi); case STRING: return new CassandraLazyString((LazyStringObjectInspector) oi); case BINARY: return new CassandraLazyBinary((LazyBinaryObjectInspector) oi); case TIMESTAMP: return new CassandraLazyTimestamp((LazyTimestampObjectInspector) oi); default: throw new RuntimeException(STR + p); } }
/** * Create a lazy primitive class given the type name. For Long and INT we * use CassandraLazyLong and CassandraLazyInt instead of the LazyObject from * Hive. */
Create a lazy primitive class given the type name. For Long and INT we use CassandraLazyLong and CassandraLazyInt instead of the LazyObject from Hive
createLazyPrimitiveClass
{ "repo_name": "javierTQ/hive-cassandra", "path": "src/main/java/org/apache/hadoop/hive/cassandra/serde/CassandraLazyFactory.java", "license": "apache-2.0", "size": 7362 }
[ "org.apache.hadoop.hive.serde2.lazy.CassandraLazyBinary", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyBoolean", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyDouble", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyFloat", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyInteger", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyLong", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyString", "org.apache.hadoop.hive.serde2.lazy.CassandraLazyTimestamp", "org.apache.hadoop.hive.serde2.lazy.LazyByte", "org.apache.hadoop.hive.serde2.lazy.LazyObject", "org.apache.hadoop.hive.serde2.lazy.LazyShort", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyBinaryObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyBooleanObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyByteObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyDoubleObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyFloatObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyIntObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyLongObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyShortObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector", "org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector" ]
import org.apache.hadoop.hive.serde2.lazy.CassandraLazyBinary; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyBoolean; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyDouble; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyFloat; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyInteger; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyLong; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyString; import org.apache.hadoop.hive.serde2.lazy.CassandraLazyTimestamp; import org.apache.hadoop.hive.serde2.lazy.LazyByte; import org.apache.hadoop.hive.serde2.lazy.LazyObject; import org.apache.hadoop.hive.serde2.lazy.LazyShort; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyBinaryObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyBooleanObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyByteObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyDoubleObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyFloatObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyIntObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyLongObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyShortObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyStringObjectInspector; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyTimestampObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.*; import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.*; import org.apache.hadoop.hive.serde2.objectinspector.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,192,021
default boolean hasPermission(User user, PermissionType permission) { return getAllowedPermissions(user).contains(permission); }
default boolean hasPermission(User user, PermissionType permission) { return getAllowedPermissions(user).contains(permission); }
/** * Checks if a user has a given permission. * Remember, that some permissions affect others! * E.g. a user who has {@link PermissionType#SEND_MESSAGES} but not {@link PermissionType#READ_MESSAGES} cannot * send messages, even though he has the {@link PermissionType#SEND_MESSAGES} permission. * This method also do not take into account overwritten permissions in some channels! * * @param user The user. * @param permission The permission to check. * @return Whether the user has the permission or not. */
Checks if a user has a given permission. Remember, that some permissions affect others! E.g. a user who has <code>PermissionType#SEND_MESSAGES</code> but not <code>PermissionType#READ_MESSAGES</code> cannot send messages, even though he has the <code>PermissionType#SEND_MESSAGES</code> permission. This method also do not take into account overwritten permissions in some channels
hasPermission
{ "repo_name": "BtoBastian/Javacord", "path": "javacord-api/src/main/java/org/javacord/api/entity/server/Server.java", "license": "lgpl-3.0", "size": 103692 }
[ "org.javacord.api.entity.permission.PermissionType", "org.javacord.api.entity.user.User" ]
import org.javacord.api.entity.permission.PermissionType; import org.javacord.api.entity.user.User;
import org.javacord.api.entity.permission.*; import org.javacord.api.entity.user.*;
[ "org.javacord.api" ]
org.javacord.api;
1,044,722
private static void writeCSV() throws IOException { String head = String.format("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s%n", "Parallelism", "dataset", "vertexKeys", "edgeKeys", "USE_VERTEX_LABELS", "USE_EDGE_LABELS", "Vertex Aggregators", "Vertex-Aggregator-Keys", "EPGMEdge-Aggregators", "EPGMEdge-Aggregator-Keys", "Runtime(s)"); String tail = String.format("%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s%n", getExecutionEnvironment().getParallelism(), INPUT_PATH, VERTEX_GROUPING_KEYS, EDGE_GROUPING_KEYS, USE_VERTEX_LABELS, USE_EDGE_LABELS, VERTEX_AGGREGATORS, VERTEX_AGGREGATOR_KEYS, EDGE_AGGREGATORS, EDGE_AGGREGATOR_KEYS, getExecutionEnvironment().getLastJobExecutionResult() .getNetRuntime(TimeUnit.SECONDS)); File f = new File(CSV_PATH); if (f.exists() && !f.isDirectory()) { FileUtils.writeStringToFile(f, tail, true); } else { PrintWriter writer = new PrintWriter(CSV_PATH, "UTF-8"); writer.print(head); writer.print(tail); writer.close(); } } /** * {@inheritDoc}
static void function() throws IOException { String head = String.format(STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR); String tail = String.format(STR, getExecutionEnvironment().getParallelism(), INPUT_PATH, VERTEX_GROUPING_KEYS, EDGE_GROUPING_KEYS, USE_VERTEX_LABELS, USE_EDGE_LABELS, VERTEX_AGGREGATORS, VERTEX_AGGREGATOR_KEYS, EDGE_AGGREGATORS, EDGE_AGGREGATOR_KEYS, getExecutionEnvironment().getLastJobExecutionResult() .getNetRuntime(TimeUnit.SECONDS)); File f = new File(CSV_PATH); if (f.exists() && !f.isDirectory()) { FileUtils.writeStringToFile(f, tail, true); } else { PrintWriter writer = new PrintWriter(CSV_PATH, "UTF-8"); writer.print(head); writer.print(tail); writer.close(); } } /** * {@inheritDoc}
/** * Method to create and add lines to a csv-file * @throws IOException */
Method to create and add lines to a csv-file
writeCSV
{ "repo_name": "niklasteichmann/gradoop", "path": "gradoop-examples/src/main/java/org/gradoop/benchmark/grouping/GroupingBenchmark.java", "license": "apache-2.0", "size": 16381 }
[ "java.io.File", "java.io.IOException", "java.io.PrintWriter", "java.util.concurrent.TimeUnit", "org.apache.commons.io.FileUtils" ]
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils;
import java.io.*; import java.util.concurrent.*; import org.apache.commons.io.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
2,332,308
public AttributeOverride<Embedded<T>> getOrCreateAttributeOverride() { List<Node> nodeList = childNode.get("attribute-override"); if (nodeList != null && nodeList.size() > 0) { return new AttributeOverrideImpl<Embedded<T>>(this, "attribute-override", childNode, nodeList.get(0)); } return createAttributeOverride(); }
AttributeOverride<Embedded<T>> function() { List<Node> nodeList = childNode.get(STR); if (nodeList != null && nodeList.size() > 0) { return new AttributeOverrideImpl<Embedded<T>>(this, STR, childNode, nodeList.get(0)); } return createAttributeOverride(); }
/** * If not already created, a new <code>attribute-override</code> element will be created and returned. * Otherwise, the first existing <code>attribute-override</code> element will be returned. * @return the instance defined for the element <code>attribute-override</code> */
If not already created, a new <code>attribute-override</code> element will be created and returned. Otherwise, the first existing <code>attribute-override</code> element will be returned
getOrCreateAttributeOverride
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/EmbeddedImpl.java", "license": "epl-1.0", "size": 9074 }
[ "java.util.List", "org.jboss.shrinkwrap.descriptor.api.orm20.AttributeOverride", "org.jboss.shrinkwrap.descriptor.api.orm20.Embedded", "org.jboss.shrinkwrap.descriptor.spi.node.Node" ]
import java.util.List; import org.jboss.shrinkwrap.descriptor.api.orm20.AttributeOverride; import org.jboss.shrinkwrap.descriptor.api.orm20.Embedded; import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import java.util.*; import org.jboss.shrinkwrap.descriptor.api.orm20.*; import org.jboss.shrinkwrap.descriptor.spi.node.*;
[ "java.util", "org.jboss.shrinkwrap" ]
java.util; org.jboss.shrinkwrap;
2,902,473
public ArrayList<Object> getInput() { return this.input; }
ArrayList<Object> function() { return this.input; }
/** * Returns the input for this recipe, any mod accessing this value should never * manipulate the values in this array as it will effect the recipe itself. * @return The recipes input vales. */
Returns the input for this recipe, any mod accessing this value should never manipulate the values in this array as it will effect the recipe itself
getInput
{ "repo_name": "brubo1/MinecraftForge", "path": "src/main/java/net/minecraftforge/oredict/ShapelessOreRecipe.java", "license": "lgpl-2.1", "size": 4750 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,764,158
public Type getType(JavaType type) { if (type instanceof SimpleType) { return getType((SimpleType) type); } else if (type instanceof CollectionType) { return getType((CollectionLikeType) type); } else if (type instanceof ArrayType) { return getType((ArrayType) type); } else if (type instanceof MapLikeType) { return getType((MapLikeType) type); } throw new RuntimeException("Unimplemented Jackson type: " + type); }
Type function(JavaType type) { if (type instanceof SimpleType) { return getType((SimpleType) type); } else if (type instanceof CollectionType) { return getType((CollectionLikeType) type); } else if (type instanceof ArrayType) { return getType((ArrayType) type); } else if (type instanceof MapLikeType) { return getType((MapLikeType) type); } throw new RuntimeException(STR + type); }
/** * Do redirection from general Jackson type to the concrete one * * @param type * jackson type * @return JRAPIDoc type */
Do redirection from general Jackson type to the concrete one
getType
{ "repo_name": "projectodd/jrapidoc", "path": "jrapidoc-model/src/main/java/org/projectodd/jrapidoc/model/type/provider/converter/JacksonToJrapidocProcessor.java", "license": "apache-2.0", "size": 10179 }
[ "com.fasterxml.jackson.databind.JavaType", "com.fasterxml.jackson.databind.type.ArrayType", "com.fasterxml.jackson.databind.type.CollectionLikeType", "com.fasterxml.jackson.databind.type.CollectionType", "com.fasterxml.jackson.databind.type.MapLikeType", "com.fasterxml.jackson.databind.type.SimpleType", "org.projectodd.jrapidoc.model.object.type.Type" ]
import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.type.ArrayType; import com.fasterxml.jackson.databind.type.CollectionLikeType; import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.MapLikeType; import com.fasterxml.jackson.databind.type.SimpleType; import org.projectodd.jrapidoc.model.object.type.Type;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.type.*; import org.projectodd.jrapidoc.model.object.type.*;
[ "com.fasterxml.jackson", "org.projectodd.jrapidoc" ]
com.fasterxml.jackson; org.projectodd.jrapidoc;
2,800,571
public PDAction getK() { COSDictionary k = (COSDictionary) actions.getDictionaryObject(COSName.K); PDAction retval = null; if (k != null) { retval = PDActionFactory.createAction(k); } return retval; }
PDAction function() { COSDictionary k = (COSDictionary) actions.getDictionaryObject(COSName.K); PDAction retval = null; if (k != null) { retval = PDActionFactory.createAction(k); } return retval; }
/** * This will get a JavaScript action to be performed when the user * types a keystroke into a text field or combo box or modifies the * selection in a scrollable list box. This allows the keystroke to * be checked for validity and rejected or modified. * * @return The K entry of form field's additional actions dictionary. */
This will get a JavaScript action to be performed when the user types a keystroke into a text field or combo box or modifies the selection in a scrollable list box. This allows the keystroke to be checked for validity and rejected or modified
getK
{ "repo_name": "gavanx/pdflearn", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDFormFieldAdditionalActions.java", "license": "apache-2.0", "size": 5479 }
[ "org.apache.pdfbox.cos.COSDictionary", "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
1,770,188
final BooleanValue generateSBP(LeafInterpreter interpreter, Options options) { final int predLength = options.symmetryBreaking(); if (symmetries.isEmpty() || predLength==0) return BooleanConstant.TRUE; options.reporter().generatingSBP(); final List<RelationParts> relParts = relParts(); final BooleanFactory factory = interpreter.factory(); final BooleanAccumulator sbp = BooleanAccumulator.treeGate(Operator.AND); final List<BooleanValue> original = new ArrayList<BooleanValue>(predLength); final List<BooleanValue> permuted = new ArrayList<BooleanValue>(predLength); for(IntSet sym : symmetries) { IntIterator indeces = sym.iterator(); for(int prevIndex = indeces.next(); indeces.hasNext(); ) { int curIndex = indeces.next(); for(Iterator<RelationParts> rIter = relParts.iterator(); rIter.hasNext() && original.size() < predLength;) { RelationParts rparts = rIter.next(); Relation r = rparts.relation; if (!rparts.representatives.contains(sym.min())) continue; // r does not range over sym BooleanMatrix m = interpreter.interpret(r); for(IndexedEntry<BooleanValue> entry : m) { int permIndex = permutation(r.arity(), entry.index(), prevIndex, curIndex); BooleanValue permValue = m.get(permIndex); if (permIndex==entry.index() || atSameIndex(original, permValue, permuted, entry.value())) continue; original.add(entry.value()); permuted.add(permValue); } } sbp.add(leq(factory, original, permuted)); original.clear(); permuted.clear(); prevIndex = curIndex; } } symmetries.clear(); // no symmetries left to break (this is conservative) return factory.accumulate(sbp); }
final BooleanValue generateSBP(LeafInterpreter interpreter, Options options) { final int predLength = options.symmetryBreaking(); if (symmetries.isEmpty() predLength==0) return BooleanConstant.TRUE; options.reporter().generatingSBP(); final List<RelationParts> relParts = relParts(); final BooleanFactory factory = interpreter.factory(); final BooleanAccumulator sbp = BooleanAccumulator.treeGate(Operator.AND); final List<BooleanValue> original = new ArrayList<BooleanValue>(predLength); final List<BooleanValue> permuted = new ArrayList<BooleanValue>(predLength); for(IntSet sym : symmetries) { IntIterator indeces = sym.iterator(); for(int prevIndex = indeces.next(); indeces.hasNext(); ) { int curIndex = indeces.next(); for(Iterator<RelationParts> rIter = relParts.iterator(); rIter.hasNext() && original.size() < predLength;) { RelationParts rparts = rIter.next(); Relation r = rparts.relation; if (!rparts.representatives.contains(sym.min())) continue; BooleanMatrix m = interpreter.interpret(r); for(IndexedEntry<BooleanValue> entry : m) { int permIndex = permutation(r.arity(), entry.index(), prevIndex, curIndex); BooleanValue permValue = m.get(permIndex); if (permIndex==entry.index() atSameIndex(original, permValue, permuted, entry.value())) continue; original.add(entry.value()); permuted.add(permValue); } } sbp.add(leq(factory, original, permuted)); original.clear(); permuted.clear(); prevIndex = curIndex; } } symmetries.clear(); return factory.accumulate(sbp); }
/** * Generates a lex leader symmetry breaking predicate for this.symmetries * (if any), using the specified leaf interpreter and options.symmetryBreaking. * It also invokes options.reporter().generatingSBP() if a non-constant predicate * is generated. * @requires interpreter.relations in this.bounds.relations * @ensures options.reporter().generatingSBP() if a non-constant predicate is generated. * @return a symmetry breaking predicate for this.symmetries */
Generates a lex leader symmetry breaking predicate for this.symmetries (if any), using the specified leaf interpreter and options.symmetryBreaking. It also invokes options.reporter().generatingSBP() if a non-constant predicate is generated
generateSBP
{ "repo_name": "drayside/kodkod", "path": "src/kodkod/engine/fol2sat/SymmetryBreaker.java", "license": "mit", "size": 22506 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
263,568
public static AndesAckData generateAndesAckMessage(UUID channelID, long messageID) throws AndesException { org.wso2.andes.kernel.subscription.AndesSubscription localSubscription = AndesContext.getInstance(). getAndesSubscriptionManager().getSubscriptionByProtocolChannel(channelID); if (null == localSubscription) { log.error("Cannot handle acknowledgement for message ID = " + messageID + " as subscription is closed " + "channelID= " + "" + channelID); return null; } DeliverableAndesMetadata metadata = localSubscription. getSubscriberConnection().getUnAckedMessage(messageID); return new AndesAckData(channelID, metadata); }
static AndesAckData function(UUID channelID, long messageID) throws AndesException { org.wso2.andes.kernel.subscription.AndesSubscription localSubscription = AndesContext.getInstance(). getAndesSubscriptionManager().getSubscriptionByProtocolChannel(channelID); if (null == localSubscription) { log.error(STR + messageID + STR + STR + "" + channelID); return null; } DeliverableAndesMetadata metadata = localSubscription. getSubscriberConnection().getUnAckedMessage(messageID); return new AndesAckData(channelID, metadata); }
/** * create andes ack data message * * @param channelID id of the connection message was received * @param messageID id of the message * @return Andes Ack Data */
create andes ack data message
generateAndesAckMessage
{ "repo_name": "pumudu88/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/AndesUtils.java", "license": "apache-2.0", "size": 10435 }
[ "org.wso2.andes.kernel.subscription.AndesSubscription" ]
import org.wso2.andes.kernel.subscription.AndesSubscription;
import org.wso2.andes.kernel.subscription.*;
[ "org.wso2.andes" ]
org.wso2.andes;
1,298,641
@Override protected void setUp() throws Exception { // Currently there are no tests that depend on data created outside // of the test ficture itself. This means we can relax the retrictions // on the user name, and thus schema; we don't need to keep it the same // over all test fixtures. schema = TestConfiguration.getCurrent().getUserName(); // Only a prerequisite for one test, but enforce it here (fail-fast). assertTrue("schema name must be at least three characters long", schema.length() > 2); }
void function() throws Exception { schema = TestConfiguration.getCurrent().getUserName(); assertTrue(STR, schema.length() > 2); }
/** * Set the schema name to be used by the test. * @throws java.lang.Exception */
Set the schema name to be used by the test
setUp
{ "repo_name": "trejkaz/derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java", "license": "apache-2.0", "size": 214556 }
[ "org.apache.derbyTesting.junit.TestConfiguration" ]
import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.*;
[ "org.apache" ]
org.apache;
1,243,471
private void copyConfigurationFiles() throws IOException { for (Entry<String, String> entry : filePathMap.entrySet()) { String sourceFileName = entry.getKey(); String fileDestinationPath = entry.getValue(); File file; if (SolrConstants.SOLR_HOME.equals(fileDestinationPath)) { file = new File(solrHome, sourceFileName); } else if (SolrConstants.SOLR_CORE.equals(fileDestinationPath)) { file = new File(confDir.getParentFile(), sourceFileName); } else if (SolrConstants.SOLR_CONF_LANG.equals(fileDestinationPath)) { file = new File(langDir, sourceFileName); } else { file = new File(confDir, sourceFileName); } if (!file.exists()) { write2File(sourceFileName, file); } } }
void function() throws IOException { for (Entry<String, String> entry : filePathMap.entrySet()) { String sourceFileName = entry.getKey(); String fileDestinationPath = entry.getValue(); File file; if (SolrConstants.SOLR_HOME.equals(fileDestinationPath)) { file = new File(solrHome, sourceFileName); } else if (SolrConstants.SOLR_CORE.equals(fileDestinationPath)) { file = new File(confDir.getParentFile(), sourceFileName); } else if (SolrConstants.SOLR_CONF_LANG.equals(fileDestinationPath)) { file = new File(langDir, sourceFileName); } else { file = new File(confDir, sourceFileName); } if (!file.exists()) { write2File(sourceFileName, file); } } }
/** * Copy solr configuration files in resource folder to solr home folder. * @throws IOException */
Copy solr configuration files in resource folder to solr home folder
copyConfigurationFiles
{ "repo_name": "daneshk/carbon-registry", "path": "components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java", "license": "apache-2.0", "size": 69901 }
[ "java.io.File", "java.io.IOException", "java.util.Map", "org.wso2.carbon.registry.indexing.SolrConstants" ]
import java.io.File; import java.io.IOException; import java.util.Map; import org.wso2.carbon.registry.indexing.SolrConstants;
import java.io.*; import java.util.*; import org.wso2.carbon.registry.indexing.*;
[ "java.io", "java.util", "org.wso2.carbon" ]
java.io; java.util; org.wso2.carbon;
1,806,793
private void makeTwoWayMap() { assert twoWayPairs == null; twoWayPairs = new LinkedHashMap<Integer, Integer>(); for (BindingInfo bindingInfo : this.getBindingInfo()) { if (bindingInfo.getTwoWayCounterpart() >= 0) // if this one part of a two way expression { if ((twoWayPairs.get(bindingInfo.getIndex())==null) && (twoWayPairs.get(bindingInfo.getTwoWayCounterpart()))==null) { twoWayPairs.put(bindingInfo.getIndex(), bindingInfo.getTwoWayCounterpart()); } } } }
void function() { assert twoWayPairs == null; twoWayPairs = new LinkedHashMap<Integer, Integer>(); for (BindingInfo bindingInfo : this.getBindingInfo()) { if (bindingInfo.getTwoWayCounterpart() >= 0) { if ((twoWayPairs.get(bindingInfo.getIndex())==null) && (twoWayPairs.get(bindingInfo.getTwoWayCounterpart()))==null) { twoWayPairs.put(bindingInfo.getIndex(), bindingInfo.getTwoWayCounterpart()); } } } }
/** * Find all the two way binding relationships, and put them into this.twoWayPairs */
Find all the two way binding relationships, and put them into this.twoWayPairs
makeTwoWayMap
{ "repo_name": "adufilie/flex-falcon", "path": "compiler/src/org/apache/flex/compiler/internal/codegen/databinding/BindingDatabase.java", "license": "apache-2.0", "size": 14463 }
[ "java.util.LinkedHashMap" ]
import java.util.LinkedHashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,152,048
@Test public void testEnvBrightnessTyp() { String message = " PKT:SID=10;PC=123;MT=8;MGID=11;MID=1;MD=4a0000000006;d6a695c8"; SHCMessage shcMessage = new SHCMessage(message, packet); List<Type> values = shcMessage.getData().getOpenHABTypes(); assertEquals(37, ((DecimalType) values.get(0)).intValue()); }
void function() { String message = STR; SHCMessage shcMessage = new SHCMessage(message, packet); List<Type> values = shcMessage.getData().getOpenHABTypes(); assertEquals(37, ((DecimalType) values.get(0)).intValue()); }
/** * test data is: environment brightness: 37 % (typ) */
test data is: environment brightness: 37 % (typ)
testEnvBrightnessTyp
{ "repo_name": "vgoldman/openhab", "path": "bundles/binding/org.openhab.binding.smarthomatic/src/test/java/org/openhab/binding/smarthomatic/TestSHCMessage.java", "license": "epl-1.0", "size": 24829 }
[ "java.util.List", "org.junit.Assert", "org.openhab.binding.smarthomatic.internal.SHCMessage", "org.openhab.core.library.types.DecimalType", "org.openhab.core.types.Type" ]
import java.util.List; import org.junit.Assert; import org.openhab.binding.smarthomatic.internal.SHCMessage; import org.openhab.core.library.types.DecimalType; import org.openhab.core.types.Type;
import java.util.*; import org.junit.*; import org.openhab.binding.smarthomatic.internal.*; import org.openhab.core.library.types.*; import org.openhab.core.types.*;
[ "java.util", "org.junit", "org.openhab.binding", "org.openhab.core" ]
java.util; org.junit; org.openhab.binding; org.openhab.core;
2,526,935
public void unregisterResource(BundleResource resource){ Log.d(TAG, "unregister Resource"); if(resource == null){ throw new IllegalArgumentException( "resource is null."); } nativeUnregisterBundleResource(resource, resource.getURI()); }
void function(BundleResource resource){ Log.d(TAG, STR); if(resource == null){ throw new IllegalArgumentException( STR); } nativeUnregisterBundleResource(resource, resource.getURI()); }
/** * Unregisters a bundle resource * * @param resource * Resource to be unregistered */
Unregisters a bundle resource
unregisterResource
{ "repo_name": "kadasaikumar/iotivity-1.2.1", "path": "service/resource-container/android/resource-container/src/main/java/org/iotivity/service/resourcecontainer/RcsResourceContainer.java", "license": "gpl-3.0", "size": 17408 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,041,585
public void testMessageGetsRemoved() throws AMQException { ContentHeaderBody chb = createPersistentContentHeader(); MessagePublishInfo info = new MessagePublishInfo() {
void function() throws AMQException { ContentHeaderBody chb = createPersistentContentHeader(); MessagePublishInfo info = new MessagePublishInfo() {
/** * Check that when the reference count is decremented the message removes itself from the store */
Check that when the reference count is decremented the message removes itself from the store
testMessageGetsRemoved
{ "repo_name": "ThilankaBowala/andes", "path": "modules/andes-core/broker/src/test/java/org/wso2/andes/server/store/ReferenceCountingTest.java", "license": "apache-2.0", "size": 5188 }
[ "org.wso2.andes.AMQException", "org.wso2.andes.framing.ContentHeaderBody", "org.wso2.andes.framing.abstraction.MessagePublishInfo" ]
import org.wso2.andes.AMQException; import org.wso2.andes.framing.ContentHeaderBody; import org.wso2.andes.framing.abstraction.MessagePublishInfo;
import org.wso2.andes.*; import org.wso2.andes.framing.*; import org.wso2.andes.framing.abstraction.*;
[ "org.wso2.andes" ]
org.wso2.andes;
361,485
public MessageDestinationType<ApplicationDescriptor> getOrCreateMessageDestination() { List<Node> nodeList = model.get("message-destination"); if (nodeList != null && nodeList.size() > 0) { return new MessageDestinationTypeImpl<ApplicationDescriptor>(this, "message-destination", model, nodeList.get(0)); } return createMessageDestination(); }
MessageDestinationType<ApplicationDescriptor> function() { List<Node> nodeList = model.get(STR); if (nodeList != null && nodeList.size() > 0) { return new MessageDestinationTypeImpl<ApplicationDescriptor>(this, STR, model, nodeList.get(0)); } return createMessageDestination(); }
/** * If not already created, a new <code>message-destination</code> element will be created and returned. * Otherwise, the first existing <code>message-destination</code> element will be returned. * @return the instance defined for the element <code>message-destination</code> */
If not already created, a new <code>message-destination</code> element will be created and returned. Otherwise, the first existing <code>message-destination</code> element will be returned
getOrCreateMessageDestination
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/application6/ApplicationDescriptorImpl.java", "license": "epl-1.0", "size": 49252 }
[ "java.util.List", "org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor", "org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationType", "org.jboss.shrinkwrap.descriptor.impl.javaee6.MessageDestinationTypeImpl", "org.jboss.shrinkwrap.descriptor.spi.node.Node" ]
import java.util.List; import org.jboss.shrinkwrap.descriptor.api.application6.ApplicationDescriptor; import org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationType; import org.jboss.shrinkwrap.descriptor.impl.javaee6.MessageDestinationTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import java.util.*; import org.jboss.shrinkwrap.descriptor.api.application6.*; import org.jboss.shrinkwrap.descriptor.api.javaee6.*; import org.jboss.shrinkwrap.descriptor.impl.javaee6.*; import org.jboss.shrinkwrap.descriptor.spi.node.*;
[ "java.util", "org.jboss.shrinkwrap" ]
java.util; org.jboss.shrinkwrap;
2,159,826
private List<SignupAttendee> getValidAttendees(List<SignupAttendee> attendees) { List<SignupAttendee> cleanedList = new ArrayList<SignupAttendee>(); for(SignupAttendee attendee: attendees){ if(sakaiFacade.checkForUser(attendee.getAttendeeUserId())) { cleanedList.add(attendee); } } return cleanedList; }
List<SignupAttendee> function(List<SignupAttendee> attendees) { List<SignupAttendee> cleanedList = new ArrayList<SignupAttendee>(); for(SignupAttendee attendee: attendees){ if(sakaiFacade.checkForUser(attendee.getAttendeeUserId())) { cleanedList.add(attendee); } } return cleanedList; }
/** * Clean the list of attendees by checking that each user is valid. This is a duplicate of the SignupUIBaseBean method. * @param attendees List of attendees to be cleaned * @return the cleaned list */
Clean the list of attendees by checking that each user is valid. This is a duplicate of the SignupUIBaseBean method
getValidAttendees
{ "repo_name": "sakai-mirror/signup", "path": "tool/src/java/org/sakaiproject/signup/tool/downloadEvents/CSVExport.java", "license": "apache-2.0", "size": 6055 }
[ "java.util.ArrayList", "java.util.List", "org.sakaiproject.signup.model.SignupAttendee" ]
import java.util.ArrayList; import java.util.List; import org.sakaiproject.signup.model.SignupAttendee;
import java.util.*; import org.sakaiproject.signup.model.*;
[ "java.util", "org.sakaiproject.signup" ]
java.util; org.sakaiproject.signup;
2,427,304
public void sendNotification(Notification notification);
void function(Notification notification);
/** * send the notification to registered clients * * @param notification */
send the notification to registered clients
sendNotification
{ "repo_name": "prasi-in/geode", "path": "geode-core/src/main/java/org/apache/geode/management/internal/NotificationBroadCasterProxy.java", "license": "apache-2.0", "size": 1387 }
[ "javax.management.Notification" ]
import javax.management.Notification;
import javax.management.*;
[ "javax.management" ]
javax.management;
650,951
private Map<String, Map<String, Object>> getCurrentTotalStats() throws InterruptedException, ExecutionException, TimeoutException { Map<String, Map<String, Object>> allStats = new HashMap<>(); final List<ListenableFuture<StatsFromTaskResult>> futures = new ArrayList<>(); final List<Pair<Integer, String>> groupAndTaskIds = new ArrayList<>(); for (int groupId : activelyReadingTaskGroups.keySet()) { TaskGroup group = activelyReadingTaskGroups.get(groupId); for (String taskId : group.taskIds()) { futures.add( Futures.transform( taskClient.getMovingAveragesAsync(taskId), (Function<Map<String, Object>, StatsFromTaskResult>) (currentStats) -> new StatsFromTaskResult( groupId, taskId, currentStats ) ) ); groupAndTaskIds.add(new Pair<>(groupId, taskId)); } } for (int groupId : pendingCompletionTaskGroups.keySet()) { List<TaskGroup> pendingGroups = pendingCompletionTaskGroups.get(groupId); for (TaskGroup pendingGroup : pendingGroups) { for (String taskId : pendingGroup.taskIds()) { futures.add( Futures.transform( taskClient.getMovingAveragesAsync(taskId), (Function<Map<String, Object>, StatsFromTaskResult>) (currentStats) -> new StatsFromTaskResult( groupId, taskId, currentStats ) ) ); groupAndTaskIds.add(new Pair<>(groupId, taskId)); } } } List<StatsFromTaskResult> results = Futures.successfulAsList(futures) .get(futureTimeoutInSeconds, TimeUnit.SECONDS); for (int i = 0; i < results.size(); i++) { StatsFromTaskResult result = results.get(i); if (result != null) { Map<String, Object> groupMap = allStats.computeIfAbsent(result.getGroupId(), k -> new HashMap<>()); groupMap.put(result.getTaskId(), result.getStats()); } else { Pair<Integer, String> groupAndTaskId = groupAndTaskIds.get(i); log.error("Failed to get stats for group[%d]-task[%s]", groupAndTaskId.lhs, groupAndTaskId.rhs); } } return allStats; }
Map<String, Map<String, Object>> function() throws InterruptedException, ExecutionException, TimeoutException { Map<String, Map<String, Object>> allStats = new HashMap<>(); final List<ListenableFuture<StatsFromTaskResult>> futures = new ArrayList<>(); final List<Pair<Integer, String>> groupAndTaskIds = new ArrayList<>(); for (int groupId : activelyReadingTaskGroups.keySet()) { TaskGroup group = activelyReadingTaskGroups.get(groupId); for (String taskId : group.taskIds()) { futures.add( Futures.transform( taskClient.getMovingAveragesAsync(taskId), (Function<Map<String, Object>, StatsFromTaskResult>) (currentStats) -> new StatsFromTaskResult( groupId, taskId, currentStats ) ) ); groupAndTaskIds.add(new Pair<>(groupId, taskId)); } } for (int groupId : pendingCompletionTaskGroups.keySet()) { List<TaskGroup> pendingGroups = pendingCompletionTaskGroups.get(groupId); for (TaskGroup pendingGroup : pendingGroups) { for (String taskId : pendingGroup.taskIds()) { futures.add( Futures.transform( taskClient.getMovingAveragesAsync(taskId), (Function<Map<String, Object>, StatsFromTaskResult>) (currentStats) -> new StatsFromTaskResult( groupId, taskId, currentStats ) ) ); groupAndTaskIds.add(new Pair<>(groupId, taskId)); } } } List<StatsFromTaskResult> results = Futures.successfulAsList(futures) .get(futureTimeoutInSeconds, TimeUnit.SECONDS); for (int i = 0; i < results.size(); i++) { StatsFromTaskResult result = results.get(i); if (result != null) { Map<String, Object> groupMap = allStats.computeIfAbsent(result.getGroupId(), k -> new HashMap<>()); groupMap.put(result.getTaskId(), result.getStats()); } else { Pair<Integer, String> groupAndTaskId = groupAndTaskIds.get(i); log.error(STR, groupAndTaskId.lhs, groupAndTaskId.rhs); } } return allStats; }
/** * Collect row ingestion stats from all tasks managed by this supervisor. * * @return A map of groupId->taskId->task row stats * * @throws InterruptedException * @throws ExecutionException * @throws TimeoutException */
Collect row ingestion stats from all tasks managed by this supervisor
getCurrentTotalStats
{ "repo_name": "knoguchi/druid", "path": "indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java", "license": "apache-2.0", "size": 122885 }
[ "com.google.common.base.Function", "com.google.common.util.concurrent.Futures", "com.google.common.util.concurrent.ListenableFuture", "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "java.util.concurrent.ExecutionException", "java.util.concurrent.TimeUnit", "java.util.concurrent.TimeoutException", "org.apache.druid.java.util.common.Pair" ]
import com.google.common.base.Function; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.druid.java.util.common.Pair;
import com.google.common.base.*; import com.google.common.util.concurrent.*; import java.util.*; import java.util.concurrent.*; import org.apache.druid.java.util.common.*;
[ "com.google.common", "java.util", "org.apache.druid" ]
com.google.common; java.util; org.apache.druid;
1,516,775
@Nonnull public Builder setTimeCharacteristic(@Nonnull TimeCharacteristic timeCharacteristic) { this.timeCharacteristic = timeCharacteristic; return this; }
Builder function(@Nonnull TimeCharacteristic timeCharacteristic) { this.timeCharacteristic = timeCharacteristic; return this; }
/** * Sets the time characteristic. * * @param timeCharacteristic The time characteristic configures time scale to use for ttl. */
Sets the time characteristic
setTimeCharacteristic
{ "repo_name": "yew1eb/flink", "path": "flink-core/src/main/java/org/apache/flink/api/common/state/StateTtlConfig.java", "license": "apache-2.0", "size": 7562 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,146,263
public boolean run() throws YarnException, IOException, InterruptedException { LOG.info("Starting ApplicationMaster"); Credentials credentials = UserGroupInformation.getCurrentUser() .getCredentials(); DataOutputBuffer dob = new DataOutputBuffer(); credentials.writeTokenStorageToStream(dob); // Now remove the AM->RM token so that containers cannot access it. credentials.getAllTokens().removeIf((token) -> token.getKind().equals(AMRMTokenIdentifier.KIND_NAME)); allTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); AMRMClientAsync.AbstractCallbackHandler allocListener = new RMCallbackHandler(); amRMClient = AMRMClientAsync.createAMRMClientAsync(1000, allocListener); amRMClient.init(conf); amRMClient.start(); containerListener = createNMCallbackHandler(); nmClientAsync = new NMClientAsyncImpl(containerListener); nmClientAsync.init(conf); nmClientAsync.start(); // Register self with ResourceManager // This will start heartbeating to the RM String appMasterHostname = NetUtils.getHostname(); amRMClient.registerApplicationMaster(appMasterHostname, -1, ""); // Supplier to use to indicate to wait-loops to stop waiting Supplier<Boolean> exitCritera = this::isComplete; Optional<Properties> namenodeProperties = Optional.empty(); if (launchNameNode) { ContainerRequest nnContainerRequest = setupContainerAskForRM( amOptions.getNameNodeMemoryMB(), amOptions.getNameNodeVirtualCores(), 0, amOptions.getNameNodeNodeLabelExpression()); LOG.info("Requested NameNode ask: " + nnContainerRequest.toString()); amRMClient.addContainerRequest(nnContainerRequest); // Wait for the NN container to make its information available on the // shared // remote file storage Path namenodeInfoPath = new Path(remoteStoragePath, DynoConstants.NN_INFO_FILE_NAME); LOG.info("Waiting on availability of NameNode information at " + namenodeInfoPath); namenodeProperties = DynoInfraUtils.waitForAndGetNameNodeProperties( exitCritera, conf, namenodeInfoPath, LOG); if (!namenodeProperties.isPresent()) { cleanup(); return false; } namenodeServiceRpcAddress = DynoInfraUtils .getNameNodeServiceRpcAddr(namenodeProperties.get()).toString(); LOG.info("NameNode information: " + namenodeProperties.get()); LOG.info("NameNode can be reached at: " + DynoInfraUtils .getNameNodeHdfsUri(namenodeProperties.get()).toString()); DynoInfraUtils.waitForNameNodeStartup(namenodeProperties.get(), exitCritera, LOG); } else { LOG.info("Using remote NameNode with RPC address: " + namenodeServiceRpcAddress); } blockListFiles = Collections .synchronizedList(getDataNodeBlockListingFiles()); numTotalDataNodes = blockListFiles.size(); if (numTotalDataNodes == 0) { LOG.error( "No block listing files were found! Cannot run with 0 DataNodes."); markCompleted(); return false; } numTotalDataNodeContainers = (int) Math.ceil(((double) numTotalDataNodes) / Math.max(1, amOptions.getDataNodesPerCluster())); LOG.info("Requesting {} DataNode containers with {} MB memory, {} vcores", numTotalDataNodeContainers, amOptions.getDataNodeMemoryMB(), amOptions.getDataNodeVirtualCores()); for (int i = 0; i < numTotalDataNodeContainers; ++i) { ContainerRequest datanodeAsk = setupContainerAskForRM( amOptions.getDataNodeMemoryMB(), amOptions.getDataNodeVirtualCores(), 1, amOptions.getDataNodeNodeLabelExpression()); amRMClient.addContainerRequest(datanodeAsk); LOG.debug("Requested datanode ask: " + datanodeAsk.toString()); } LOG.info("Finished requesting datanode containers"); if (launchNameNode) { DynoInfraUtils.waitForNameNodeReadiness(namenodeProperties.get(), numTotalDataNodes, true, exitCritera, conf, LOG); } waitForCompletion(); return cleanup(); }
boolean function() throws YarnException, IOException, InterruptedException { LOG.info(STR); Credentials credentials = UserGroupInformation.getCurrentUser() .getCredentials(); DataOutputBuffer dob = new DataOutputBuffer(); credentials.writeTokenStorageToStream(dob); credentials.getAllTokens().removeIf((token) -> token.getKind().equals(AMRMTokenIdentifier.KIND_NAME)); allTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); AMRMClientAsync.AbstractCallbackHandler allocListener = new RMCallbackHandler(); amRMClient = AMRMClientAsync.createAMRMClientAsync(1000, allocListener); amRMClient.init(conf); amRMClient.start(); containerListener = createNMCallbackHandler(); nmClientAsync = new NMClientAsyncImpl(containerListener); nmClientAsync.init(conf); nmClientAsync.start(); String appMasterHostname = NetUtils.getHostname(); amRMClient.registerApplicationMaster(appMasterHostname, -1, STRRequested NameNode ask: STRWaiting on availability of NameNode information at STRNameNode information: STRNameNode can be reached at: STRUsing remote NameNode with RPC address: STRNo block listing files were found! Cannot run with 0 DataNodes.STRRequesting {} DataNode containers with {} MB memory, {} vcoresSTRRequested datanode ask: STRFinished requesting datanode containers"); if (launchNameNode) { DynoInfraUtils.waitForNameNodeReadiness(namenodeProperties.get(), numTotalDataNodes, true, exitCritera, conf, LOG); } waitForCompletion(); return cleanup(); }
/** * Main run function for the application master. * * @return True if the application completed successfully; false if if exited * unexpectedly, failed, was killed, etc. * @throws YarnException for issues while contacting YARN daemons * @throws IOException for other issues * @throws InterruptedException when the thread is interrupted */
Main run function for the application master
run
{ "repo_name": "apurtell/hadoop", "path": "hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/ApplicationMaster.java", "license": "apache-2.0", "size": 33599 }
[ "java.io.IOException", "java.nio.ByteBuffer", "org.apache.hadoop.io.DataOutputBuffer", "org.apache.hadoop.net.NetUtils", "org.apache.hadoop.security.Credentials", "org.apache.hadoop.security.UserGroupInformation", "org.apache.hadoop.yarn.client.api.async.AMRMClientAsync", "org.apache.hadoop.yarn.client.api.async.impl.NMClientAsyncImpl", "org.apache.hadoop.yarn.exceptions.YarnException", "org.apache.hadoop.yarn.security.AMRMTokenIdentifier" ]
import java.io.IOException; import java.nio.ByteBuffer; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync; import org.apache.hadoop.yarn.client.api.async.impl.NMClientAsyncImpl; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
import java.io.*; import java.nio.*; import org.apache.hadoop.io.*; import org.apache.hadoop.net.*; import org.apache.hadoop.security.*; import org.apache.hadoop.yarn.client.api.async.*; import org.apache.hadoop.yarn.client.api.async.impl.*; import org.apache.hadoop.yarn.exceptions.*; import org.apache.hadoop.yarn.security.*;
[ "java.io", "java.nio", "org.apache.hadoop" ]
java.io; java.nio; org.apache.hadoop;
690,780
public void testShiftLeft3() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; int number = 27; byte rBytes[] = {12, 1, -61, 39, -11, -94, -55, 106, -40, 31, -119, 24, -48, 0, 0, 0}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger result = aNumber.shiftLeft(number); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign", 1, result.signum()); }
void function() { byte aBytes[] = {1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26}; int aSign = 1; int number = 27; byte rBytes[] = {12, 1, -61, 39, -11, -94, -55, 106, -40, 31, -119, 24, -48, 0, 0, 0}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger result = aNumber.shiftLeft(number); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 1, result.signum()); }
/** * shiftLeft(int n) a positive number, n > 0 */
shiftLeft(int n) a positive number, n > 0
testShiftLeft3
{ "repo_name": "JSDemos/android-sdk-20", "path": "src/org/apache/harmony/tests/java/math/BigIntegerOperateBitsTest.java", "license": "apache-2.0", "size": 50548 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,930,564
@Override public DatabaseMap getDatabaseMap() { return this.dbMap; }
DatabaseMap function() { return this.dbMap; }
/** * Gets the databasemap this map builder built. * * @return the databasemap */
Gets the databasemap this map builder built
getDatabaseMap
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/map/TDashboardFieldMapBuilder.java", "license": "gpl-3.0", "size": 8924 }
[ "org.apache.torque.map.DatabaseMap" ]
import org.apache.torque.map.DatabaseMap;
import org.apache.torque.map.*;
[ "org.apache.torque" ]
org.apache.torque;
2,867,113
Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } }
Assert.notNull(converterAdapters); for (ConverterAdapter c : converterAdapters) { modelMapper.createTypeMap(c.getSourceClass(), c.getTargetClass()) .setConverter(context -> c.getConverter().convert(context.getSource())); } }
/** * Creates custom converters for {@code ModelMapper} using the {@code ConverterAdapters} given in * the {@code converterAdapters} parameter. * @param converterAdapters the list of ConverterAdapters */
Creates custom converters for ModelMapper using the ConverterAdapters given in the converterAdapters parameter
setupCustomConverters
{ "repo_name": "epam-debrecen-rft-2015/atsy", "path": "service/src/main/java/com/epam/rft/atsy/service/impl/ModelMapperConverterServiceImpl.java", "license": "apache-2.0", "size": 1825 }
[ "com.epam.rft.atsy.service.converter.ConverterAdapter", "org.springframework.util.Assert" ]
import com.epam.rft.atsy.service.converter.ConverterAdapter; import org.springframework.util.Assert;
import com.epam.rft.atsy.service.converter.*; import org.springframework.util.*;
[ "com.epam.rft", "org.springframework.util" ]
com.epam.rft; org.springframework.util;
766,737
@Override protected String getLuceneFieldName() { return LuceneUtil.ATTACHMENT; }
String function() { return LuceneUtil.ATTACHMENT; }
/** * Gets the associated field name for logging purposes * @return */
Gets the associated field name for logging purposes
getLuceneFieldName
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/lucene/index/associatedFields/AttachmentIndexer.java", "license": "gpl-3.0", "size": 11346 }
[ "com.aurel.track.lucene.LuceneUtil" ]
import com.aurel.track.lucene.LuceneUtil;
import com.aurel.track.lucene.*;
[ "com.aurel.track" ]
com.aurel.track;
693,786
public void setUserLastModified(CmsUUID userLastModified) { m_userLastModified = userLastModified; }
void function(CmsUUID userLastModified) { m_userLastModified = userLastModified; }
/** * Sets the user Last Modified.<p> * * @param userLastModified the user Last Modified to set */
Sets the user Last Modified
setUserLastModified
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/importexport/CmsImportVersion7.java", "license": "lgpl-2.1", "size": 114451 }
[ "org.opencms.util.CmsUUID" ]
import org.opencms.util.CmsUUID;
import org.opencms.util.*;
[ "org.opencms.util" ]
org.opencms.util;
593,287
public InputStream processError() { if (process==null) { System.out.println("process not started."); throw new IllegalStateException(); } else { return process.getErrorStream(); } }
InputStream function() { if (process==null) { System.out.println(STR); throw new IllegalStateException(); } else { return process.getErrorStream(); } }
/** * Gets the error stream of the subprocess running this.com. * The stream obtains data piped from the standard error stream * of the process run by this thread. * @return error stream of the subprocess running this.com */
Gets the error stream of the subprocess running this.com. The stream obtains data piped from the standard error stream of the process run by this thread
processError
{ "repo_name": "emina/kodkod", "path": "test/kodkod/test/util/ProcessRunner.java", "license": "mit", "size": 3633 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,224,334
public static String parseName(byte[] buffer, final int offset, final int length, final ZipEncoding encoding) throws IOException { int len = length; for (; len > 0; len--) { if (buffer[offset + len - 1] != 0) { break; } } if (len > 0) { byte[] b = new byte[len]; System.arraycopy(buffer, offset, b, 0, len); return encoding.decode(b); } return ""; }
static String function(byte[] buffer, final int offset, final int length, final ZipEncoding encoding) throws IOException { int len = length; for (; len > 0; len--) { if (buffer[offset + len - 1] != 0) { break; } } if (len > 0) { byte[] b = new byte[len]; System.arraycopy(buffer, offset, b, 0, len); return encoding.decode(b); } return ""; }
/** * Parse an entry name from a buffer. * Parsing stops when a NUL is found * or the buffer length is reached. * * @param buffer The buffer from which to parse. * @param offset The offset into the buffer from which to parse. * @param length The maximum number of bytes to parse. * @param encoding name of the encoding to use for file names * @since 1.4 * @return The entry name. */
Parse an entry name from a buffer. Parsing stops when a NUL is found or the buffer length is reached
parseName
{ "repo_name": "wspeirs/sop4j-base", "path": "src/main/java/com/sop4j/base/apache/compress/archivers/tar/TarUtils.java", "license": "apache-2.0", "size": 24573 }
[ "com.sop4j.base.apache.compress.archivers.zip.ZipEncoding", "java.io.IOException" ]
import com.sop4j.base.apache.compress.archivers.zip.ZipEncoding; import java.io.IOException;
import com.sop4j.base.apache.compress.archivers.zip.*; import java.io.*;
[ "com.sop4j.base", "java.io" ]
com.sop4j.base; java.io;
1,621,153
public void kbrOverlayMessageForwarded(OverlayContact<?> sender, OverlayContact<?> receiver, Message olMsg, int hops);
void function(OverlayContact<?> sender, OverlayContact<?> receiver, Message olMsg, int hops);
/** * Informs the installed KBROverlayAnalyzers about the forward of a routed * message * * @param sender * @param receiver * @param olMsg * the forwarded overlay Message * @param hops * the hop count at message send */
Informs the installed KBROverlayAnalyzers about the forward of a routed message
kbrOverlayMessageForwarded
{ "repo_name": "flyroom/PeerfactSimKOM_Clone", "path": "src/org/peerfact/api/common/Monitor.java", "license": "gpl-2.0", "size": 16925 }
[ "org.peerfact.api.overlay.OverlayContact" ]
import org.peerfact.api.overlay.OverlayContact;
import org.peerfact.api.overlay.*;
[ "org.peerfact.api" ]
org.peerfact.api;
1,322,424
public FactorTriangle getSourceFactors();
FactorTriangle function();
/** * Returns the development factors used as input for * the calculation of the link-ratios. */
Returns the development factors used as input for the calculation of the link-ratios
getSourceFactors
{ "repo_name": "Depter/JRLib", "path": "NetbeansProject/jrlib/src/main/java/org/jreserve/jrlib/linkratio/scale/LinkRatioScale.java", "license": "lgpl-3.0", "size": 2800 }
[ "org.jreserve.jrlib.triangle.factor.FactorTriangle" ]
import org.jreserve.jrlib.triangle.factor.FactorTriangle;
import org.jreserve.jrlib.triangle.factor.*;
[ "org.jreserve.jrlib" ]
org.jreserve.jrlib;
277,788
public static Object mapIndexNormalize(final Map<?, ?> value, Object index) { return index; }
static Object function(final Map<?, ?> value, Object index) { return index; }
/** * "Normalizes" the index into a {@code Map} by making no change to the index. */
"Normalizes" the index into a Map by making no change to the index
mapIndexNormalize
{ "repo_name": "qwerty4030/elasticsearch", "path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/Def.java", "license": "apache-2.0", "size": 42376 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,331,670
public void addComments(String[] aIn) { if (null == comments) { comments = new LinkedList<String>(); } for (String lThis : aIn) { comments.add(lThis); } }
void function(String[] aIn) { if (null == comments) { comments = new LinkedList<String>(); } for (String lThis : aIn) { comments.add(lThis); } }
/** * adds a list of comments to this item * @param aIn comments added */
adds a list of comments to this item
addComments
{ "repo_name": "mhrobinson/opflex", "path": "genie/src/main/java/org/opendaylight/opflex/genie/engine/model/Item.java", "license": "epl-1.0", "size": 6233 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
1,944,413
return VertexProgram.<TraversalVertexProgram>createVertexProgram(graph, configuration).getTraversal(); }
return VertexProgram.<TraversalVertexProgram>createVertexProgram(graph, configuration).getTraversal(); }
/** * A helper method to yield a {@link Traversal} from the {@link Graph} and provided {@link Configuration}. * * @param graph the graph that the traversal will run against * @param configuration The configuration containing the TRAVERSAL_SUPPLIER key. * @return the traversal supplied by the configuration */
A helper method to yield a <code>Traversal</code> from the <code>Graph</code> and provided <code>Configuration</code>
getTraversal
{ "repo_name": "dalaro/incubator-tinkerpop", "path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java", "license": "apache-2.0", "size": 14418 }
[ "org.apache.tinkerpop.gremlin.process.computer.VertexProgram" ]
import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
import org.apache.tinkerpop.gremlin.process.computer.*;
[ "org.apache.tinkerpop" ]
org.apache.tinkerpop;
1,305,708
public Collection<FunctionType> getDirectImplementors( ObjectType interfaceInstance) { return interfaceToImplementors.get(interfaceInstance.getReferenceName()); }
Collection<FunctionType> function( ObjectType interfaceInstance) { return interfaceToImplementors.get(interfaceInstance.getReferenceName()); }
/** * Returns a collection of types that directly implement {@code * interfaceInstance}. Subtypes of implementing types are not guaranteed to * be returned. {@code interfaceInstance} must be an ObjectType for the * instance of the interface. */
Returns a collection of types that directly implement interfaceInstance. Subtypes of implementing types are not guaranteed to be returned. interfaceInstance must be an ObjectType for the instance of the interface
getDirectImplementors
{ "repo_name": "abdullah38rcc/closure-compiler", "path": "src/com/google/javascript/rhino/jstype/JSTypeRegistry.java", "license": "apache-2.0", "size": 63642 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
546,004
public static IField getFieldInvocation( final ICodeLevelModel aPadlModel, final Expression anExpression, final IFirstClassEntity anEntity) { IField field = null; final IVariableBinding variableBinding = (IVariableBinding) MethodInvocationUtils .getExpressionTypeBinding(anExpression); final String fieldName = variableBinding.getName(); // search a field in an entity; I assume that 2 fields can't have the // same name so I don't check the type try { final Iterator<?> iter = anEntity.getIteratorOnConstituents(Class .forName("padl.kernel.impl.Field")); IField tmpField; while (iter.hasNext()) { tmpField = (IField) iter.next(); if (fieldName.equals(tmpField.getDisplayName())) { field = tmpField; break; } } } catch (final ClassNotFoundException e) { e.printStackTrace(ProxyConsole.getInstance().errorOutput()); } // Should I add this field to the ghost --- and if it is an array or // list // type // should I add it ; I think it will create like ghosts for those // classes - what should I do? // if yes, the code for that is below if (field == null) { final String fieldID = fieldName; final ITypeBinding fieldTypeBinding = variableBinding.getType(); final String fieldType = PadlParserUtil.getTypeName(fieldTypeBinding, true); final int cardinality = PadlParserUtil.getDim(fieldTypeBinding); field = aPadlModel.getFactory().createField( fieldID.toCharArray(), fieldName.toCharArray(), fieldType.toCharArray(), cardinality); anEntity.addConstituent(field); } return field; }
static IField function( final ICodeLevelModel aPadlModel, final Expression anExpression, final IFirstClassEntity anEntity) { IField field = null; final IVariableBinding variableBinding = (IVariableBinding) MethodInvocationUtils .getExpressionTypeBinding(anExpression); final String fieldName = variableBinding.getName(); try { final Iterator<?> iter = anEntity.getIteratorOnConstituents(Class .forName(STR)); IField tmpField; while (iter.hasNext()) { tmpField = (IField) iter.next(); if (fieldName.equals(tmpField.getDisplayName())) { field = tmpField; break; } } } catch (final ClassNotFoundException e) { e.printStackTrace(ProxyConsole.getInstance().errorOutput()); } if (field == null) { final String fieldID = fieldName; final ITypeBinding fieldTypeBinding = variableBinding.getType(); final String fieldType = PadlParserUtil.getTypeName(fieldTypeBinding, true); final int cardinality = PadlParserUtil.getDim(fieldTypeBinding); field = aPadlModel.getFactory().createField( fieldID.toCharArray(), fieldName.toCharArray(), fieldType.toCharArray(), cardinality); anEntity.addConstituent(field); } return field; }
/** * Return the field by which the invocation is performed * * @param aPadlModel * @param anExpression * @param anEntity * @return */
Return the field by which the invocation is performed
getFieldInvocation
{ "repo_name": "ptidej/SmellDetectionCaller", "path": "PADL Creator JavaFile (Eclipse)/src/padl/creator/javafile/eclipse/util/MethodInvocationUtils.java", "license": "gpl-2.0", "size": 13218 }
[ "java.util.Iterator", "org.eclipse.jdt.core.dom.Expression", "org.eclipse.jdt.core.dom.ITypeBinding", "org.eclipse.jdt.core.dom.IVariableBinding" ]
import java.util.Iterator; import org.eclipse.jdt.core.dom.Expression; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.IVariableBinding;
import java.util.*; import org.eclipse.jdt.core.dom.*;
[ "java.util", "org.eclipse.jdt" ]
java.util; org.eclipse.jdt;
2,331,862