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
void purgeOldStorage(NameNodeFile nnf) { try { archivalManager.purgeOldStorage(nnf); } catch (Exception e) { LOG.warn("Unable to purge old storage " + nnf.getName(), e); } }
void purgeOldStorage(NameNodeFile nnf) { try { archivalManager.purgeOldStorage(nnf); } catch (Exception e) { LOG.warn(STR + nnf.getName(), e); } }
/** * Purge any files in the storage directories that are no longer * necessary. */
Purge any files in the storage directories that are no longer necessary
purgeOldStorage
{ "repo_name": "jaypatil/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java", "license": "gpl-3.0", "size": 54950 }
[ "org.apache.hadoop.hdfs.server.namenode.NNStorage" ]
import org.apache.hadoop.hdfs.server.namenode.NNStorage;
import org.apache.hadoop.hdfs.server.namenode.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,649,193
public PublicKey resolvePublicKey( Element element, String baseURI, StorageResolver storage ) throws KeyResolverException { return resolverSpi.engineLookupAndResolvePublicKey(element, baseURI, storage); }
PublicKey function( Element element, String baseURI, StorageResolver storage ) throws KeyResolverException { return resolverSpi.engineLookupAndResolvePublicKey(element, baseURI, storage); }
/** * Method resolvePublicKey * * @param element * @param baseURI * @param storage * @return resolved public key from the registered from the elements * * @throws KeyResolverException */
Method resolvePublicKey
resolvePublicKey
{ "repo_name": "stain/jdk8u", "path": "src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java", "license": "gpl-2.0", "size": 16380 }
[ "com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver", "java.security.PublicKey", "org.w3c.dom.Element" ]
import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver; import java.security.PublicKey; import org.w3c.dom.Element;
import com.sun.org.apache.xml.internal.security.keys.storage.*; import java.security.*; import org.w3c.dom.*;
[ "com.sun.org", "java.security", "org.w3c.dom" ]
com.sun.org; java.security; org.w3c.dom;
1,608,281
public static void restoreAntiAliasing (Graphics2D gfx, Object rock) { if (rock != null) { gfx.setRenderingHints((RenderingHints)rock); } }
static void function (Graphics2D gfx, Object rock) { if (rock != null) { gfx.setRenderingHints((RenderingHints)rock); } }
/** * Restores anti-aliasing in the supplied graphics context to its original setting. * * @param rock the results of a previous call to {@link #activateAntiAliasing} or null, in * which case this method will NOOP. This alleviates every caller having to conditionally avoid * calling restore if they chose not to activate earlier. */
Restores anti-aliasing in the supplied graphics context to its original setting
restoreAntiAliasing
{ "repo_name": "samskivert/samskivert", "path": "src/main/java/com/samskivert/swing/util/SwingUtil.java", "license": "lgpl-2.1", "size": 25679 }
[ "java.awt.Graphics2D", "java.awt.RenderingHints" ]
import java.awt.Graphics2D; import java.awt.RenderingHints;
import java.awt.*;
[ "java.awt" ]
java.awt;
423,679
@Override public RowId getRowId(int parameterIndex) throws SQLException { throw unsupported("rowId"); }
RowId function(int parameterIndex) throws SQLException { throw unsupported("rowId"); }
/** * [Not supported] Returns the value of the specified column as a row id. * * @param parameterIndex the parameter index (1, 2, ...) */
[Not supported] Returns the value of the specified column as a row id
getRowId
{ "repo_name": "miloszpiglas/h2mod", "path": "src/main/org/h2/jdbc/JdbcCallableStatement.java", "license": "mpl-2.0", "size": 53201 }
[ "java.sql.RowId", "java.sql.SQLException" ]
import java.sql.RowId; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,450,888
void setValidator(Validator validator); Class getPersistentClass();
void setValidator(Validator validator); Class getPersistentClass();
/** * Retrieves the scaffolded persistent class */
Retrieves the scaffolded persistent class
getPersistentClass
{ "repo_name": "lpicanco/grails", "path": "src/commons/org/codehaus/groovy/grails/scaffolding/ScaffoldDomain.java", "license": "apache-2.0", "size": 5558 }
[ "org.springframework.validation.Validator" ]
import org.springframework.validation.Validator;
import org.springframework.validation.*;
[ "org.springframework.validation" ]
org.springframework.validation;
317,711
public void removeHandshakeCompletedListener( HandshakeCompletedListener listener) { hcl = removeFromList(hcl, listener); }
void function( HandshakeCompletedListener listener) { hcl = removeFromList(hcl, listener); }
/** * Description of the Method * * @param listener Description of the Parameter */
Description of the Method
removeHandshakeCompletedListener
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/trunk/src/java/org/dcm4cheri/util/SSLContextAdapterImpl.java", "license": "apache-2.0", "size": 26389 }
[ "javax.net.ssl.HandshakeCompletedListener" ]
import javax.net.ssl.HandshakeCompletedListener;
import javax.net.ssl.*;
[ "javax.net" ]
javax.net;
1,010,880
public CallHandle loadRenderingControl(SecurityContext ctx, long pixelsID, int index, AgentEventListener observer);
CallHandle function(SecurityContext ctx, long pixelsID, int index, AgentEventListener observer);
/** * Loads the rendering proxy associated to the pixels set. * * @param ctx The security context. * @param pixelsID The id of the pixels set. * @param index One of the constants defined by this class. * @param observer Call-back handler. * @return A handle that can be used to cancel the call. */
Loads the rendering proxy associated to the pixels set
loadRenderingControl
{ "repo_name": "joansmith/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/views/ImageDataView.java", "license": "gpl-2.0", "size": 16243 }
[ "org.openmicroscopy.shoola.env.event.AgentEventListener" ]
import org.openmicroscopy.shoola.env.event.AgentEventListener;
import org.openmicroscopy.shoola.env.event.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
1,017,301
public boolean hasLoop( JobEntryCopy entry ) { clearLoopCache(); return hasLoop( entry, null, true ) || hasLoop( entry, null, false ); }
boolean function( JobEntryCopy entry ) { clearLoopCache(); return hasLoop( entry, null, true ) hasLoop( entry, null, false ); }
/** * Checks for loop. * * @param entry the entry * @return true, if successful */
Checks for loop
hasLoop
{ "repo_name": "ViswesvarSekar/pentaho-kettle", "path": "engine/src/org/pentaho/di/job/JobMeta.java", "license": "apache-2.0", "size": 86688 }
[ "org.pentaho.di.job.entry.JobEntryCopy" ]
import org.pentaho.di.job.entry.JobEntryCopy;
import org.pentaho.di.job.entry.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,663,390
@Override protected NotifyingSailConnection getConnectionInternal() throws SailException { final BigdataSailConnection conn; try { if ( knownIsolatable.get() == KnownIsolatableEnum.Unknown ) { final AbstractTripleStore readOnlyTripleStore = (AbstractTripleStore) getIndexManager().getResourceLocator().locate(namespace, ITx.READ_COMMITTED); if(readOnlyTripleStore == null) { throw new DatasetNotFoundException("namespace="+namespace); } final Properties properties = readOnlyTripleStore.getProperties(); final boolean isolatable = Boolean.parseBoolean(properties.getProperty( BigdataSail.Options.ISOLATABLE_INDICES, BigdataSail.Options.DEFAULT_ISOLATABLE_INDICES)); // Set the flag. knownIsolatable.compareAndSet(KnownIsolatableEnum.Unknown, isolatable?KnownIsolatableEnum.Isolated:KnownIsolatableEnum.Unisolated); } switch(knownIsolatable.get()) { case Isolated: conn = getReadWriteConnection(); break; case Unisolated: conn = getUnisolatedConnection(); break; case Unknown: default: throw new UnsupportedOperationException(); } return conn; } catch (Exception ex) { throw new SailException(ex); } } /** * {@inheritDoc} * <p> * If the triple store was provisioned to support full read/write * transactions then this is delegated to {@link #getReadWriteConnection()}. * Otherwise, is delegated to {@link #getUnisolatedConnection()} which * returns the unisolated view of the database. Note that truth maintenance * requires only one connection at a time and is therefore not compatible * with full read/write transactions. * <p> * The correct pattern for obtaining an updatable connection, doing work * with that connection, and committing or rolling back that update is as * follows. * * <pre> * * BigdataSailConnection conn = null; * boolean ok = false; * try { * conn = sail.getConnection(); * doWork(conn); * conn.commit(); * ok = true; * } finally { * if (conn != null) { * if (!ok) { * conn.rollback(); * } * conn.close(); * } * }
NotifyingSailConnection function() throws SailException { final BigdataSailConnection conn; try { if ( knownIsolatable.get() == KnownIsolatableEnum.Unknown ) { final AbstractTripleStore readOnlyTripleStore = (AbstractTripleStore) getIndexManager().getResourceLocator().locate(namespace, ITx.READ_COMMITTED); if(readOnlyTripleStore == null) { throw new DatasetNotFoundException(STR+namespace); } final Properties properties = readOnlyTripleStore.getProperties(); final boolean isolatable = Boolean.parseBoolean(properties.getProperty( BigdataSail.Options.ISOLATABLE_INDICES, BigdataSail.Options.DEFAULT_ISOLATABLE_INDICES)); knownIsolatable.compareAndSet(KnownIsolatableEnum.Unknown, isolatable?KnownIsolatableEnum.Isolated:KnownIsolatableEnum.Unisolated); } switch(knownIsolatable.get()) { case Isolated: conn = getReadWriteConnection(); break; case Unisolated: conn = getUnisolatedConnection(); break; case Unknown: default: throw new UnsupportedOperationException(); } return conn; } catch (Exception ex) { throw new SailException(ex); } } /** * {@inheritDoc} * <p> * If the triple store was provisioned to support full read/write * transactions then this is delegated to {@link #getReadWriteConnection()}. * Otherwise, is delegated to {@link #getUnisolatedConnection()} which * returns the unisolated view of the database. Note that truth maintenance * requires only one connection at a time and is therefore not compatible * with full read/write transactions. * <p> * The correct pattern for obtaining an updatable connection, doing work * with that connection, and committing or rolling back that update is as * follows. * * <pre> * * BigdataSailConnection conn = null; * boolean ok = false; * try { * conn = sail.getConnection(); * doWork(conn); * conn.commit(); * ok = true; * } finally { * if (conn != null) { * if (!ok) { * conn.rollback(); * } * conn.close(); * } * }
/** * Return a read-write {@link SailConnection}. This is used for both * read-write transactions and the UNISOLATED connection. * <p> * Note: There is only one UNISOLATED connection and, when requested, this * method will block until that connection is available. * * @see #getReadOnlyConnection() for a non-blocking, read-only connection. * * @todo many of the stores can support concurrent writers, but there is a * requirement to serialize writers when truth maintenance is enabled. */
Return a read-write <code>SailConnection</code>. This is used for both read-write transactions and the UNISOLATED connection. Note: There is only one UNISOLATED connection and, when requested, this method will block until that connection is available
getConnectionInternal
{ "repo_name": "wikimedia/wikidata-query-blazegraph", "path": "bigdata-core/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java", "license": "gpl-2.0", "size": 195000 }
[ "com.bigdata.journal.ITx", "com.bigdata.rdf.sail.webapp.DatasetNotFoundException", "com.bigdata.rdf.store.AbstractTripleStore", "java.util.Properties", "org.openrdf.sail.NotifyingSailConnection", "org.openrdf.sail.SailException" ]
import com.bigdata.journal.ITx; import com.bigdata.rdf.sail.webapp.DatasetNotFoundException; import com.bigdata.rdf.store.AbstractTripleStore; import java.util.Properties; import org.openrdf.sail.NotifyingSailConnection; import org.openrdf.sail.SailException;
import com.bigdata.journal.*; import com.bigdata.rdf.sail.webapp.*; import com.bigdata.rdf.store.*; import java.util.*; import org.openrdf.sail.*;
[ "com.bigdata.journal", "com.bigdata.rdf", "java.util", "org.openrdf.sail" ]
com.bigdata.journal; com.bigdata.rdf; java.util; org.openrdf.sail;
1,152,996
public static byte[] utf8encode(CharSequence string) { try { ByteBuffer bytes = CHARSET.newEncoder().encode(CharBuffer.wrap(string)); byte[] bytesCopy = new byte[bytes.limit()]; System.arraycopy(bytes.array(), 0, bytesCopy, 0, bytes.limit()); return bytesCopy; } catch (CharacterCodingException e) { throw new IllegalArgumentException("Encoding failed", e); } }
static byte[] function(CharSequence string) { try { ByteBuffer bytes = CHARSET.newEncoder().encode(CharBuffer.wrap(string)); byte[] bytesCopy = new byte[bytes.limit()]; System.arraycopy(bytes.array(), 0, bytesCopy, 0, bytes.limit()); return bytesCopy; } catch (CharacterCodingException e) { throw new IllegalArgumentException(STR, e); } }
/** * Get the bytes of the String in UTF-8 encoded form. */
Get the bytes of the String in UTF-8 encoded form
utf8encode
{ "repo_name": "lclsdu/CS", "path": "jspxcms/src/com/jspxcms/common/security/Cryptos.java", "license": "gpl-2.0", "size": 6595 }
[ "java.nio.ByteBuffer", "java.nio.CharBuffer", "java.nio.charset.CharacterCodingException" ]
import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException;
import java.nio.*; import java.nio.charset.*;
[ "java.nio" ]
java.nio;
605,965
Optional<T> build(DataContainer args);
Optional<T> build(DataContainer args);
/** * Builds a new instance of the data source with arguments from the given {@link DataContainer}. * * @param args The arguments * @return The new data source */
Builds a new instance of the data source with arguments from the given <code>DataContainer</code>
build
{ "repo_name": "Featherblade/VoxelGunsmith", "path": "src/main/java/com/voxelplugineering/voxelsniper/service/persistence/DataSourceBuilder.java", "license": "mit", "size": 1715 }
[ "com.google.common.base.Optional" ]
import com.google.common.base.Optional;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,489,786
public DcmElement putCS(int tag, String[] values) { return put( values != null ? StringElement.createCS(tag, values) : StringElement.createCS(tag)); }
DcmElement function(int tag, String[] values) { return put( values != null ? StringElement.createCS(tag, values) : StringElement.createCS(tag)); }
/** * Description of the Method * * @param tag Description of the Parameter * @param values Description of the Parameter * @return Description of the Return Value */
Description of the Method
putCS
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/tags/DCM4CHE_1_4_14/src/java/org/dcm4cheri/data/DcmObjectImpl.java", "license": "apache-2.0", "size": 84001 }
[ "org.dcm4che.data.DcmElement" ]
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.*;
[ "org.dcm4che.data" ]
org.dcm4che.data;
1,078,873
public void deselect() { Enumeration offs = getOffenders().elements(); while (offs.hasMoreElements()) { Object dm = offs.nextElement(); if (dm instanceof Highlightable) { ((Highlightable) dm).setHighlight(false); } } } public void action() { deselect(); select(); }
void function() { Enumeration offs = getOffenders().elements(); while (offs.hasMoreElements()) { Object dm = offs.nextElement(); if (dm instanceof Highlightable) { ((Highlightable) dm).setHighlight(false); } } } void action() { function(); select(); }
/** * When a ToDoItem is deselected in the UiToDoList window, * unhighlight the "offending" design material's. */
When a ToDoItem is deselected in the UiToDoList window, unhighlight the "offending" design material's
deselect
{ "repo_name": "carvalhomb/tsmells", "path": "sample/argouml/argouml/org/argouml/cognitive/ToDoItem.java", "license": "gpl-2.0", "size": 17539 }
[ "java.util.Enumeration", "org.tigris.gef.ui.Highlightable" ]
import java.util.Enumeration; import org.tigris.gef.ui.Highlightable;
import java.util.*; import org.tigris.gef.ui.*;
[ "java.util", "org.tigris.gef" ]
java.util; org.tigris.gef;
628,611
public void setGuards (Object receiver) { if (handle==null) return; if (!cache) return; MethodHandle fallback = makeFallBack(callSite, sender, name, callType.ordinal(), targetType, safeNavigationOrig, thisCall, spread); // special guards for receiver if (receiver instanceof GroovyObject) { GroovyObject go = (GroovyObject) receiver; MetaClass mc = (MetaClass) go.getMetaClass(); MethodHandle test = SAME_MC.bindTo(mc); // drop dummy receiver test = test.asType(MethodType.methodType(boolean.class,targetType.parameterType(0))); handle = MethodHandles.guardWithTest(test, handle, fallback); if (LOG_ENABLED) LOG.info("added meta class equality check"); } else if (receiver instanceof Class) { MethodHandle test = EQUALS.bindTo(receiver); test = test.asType(MethodType.methodType(boolean.class,targetType.parameterType(0))); handle = MethodHandles.guardWithTest(test, handle, fallback); if (LOG_ENABLED) LOG.info("added class equality check"); } if (!useMetaClass && isCategoryMethod) { // category method needs Thread check // cases: // (1) method is a category method // We need to check if the category in the current thread is still active. // Since we invalidate on leaving the category checking for it being // active directly is good enough. // (2) method is in use scope, but not from category // Since entering/leaving a category will invalidate, there is no need for any special check // (3) method is not in use scope /and not from category // Since entering/leaving a category will invalidate, there is no need for any special check if (method instanceof NewInstanceMetaMethod) { handle = MethodHandles.guardWithTest(HAS_CATEGORY_IN_CURRENT_THREAD_GUARD, handle, fallback); if (LOG_ENABLED) LOG.info("added category-in-current-thread-guard for category method"); } } // handle constant meta class and category changes handle = switchPoint.guardWithTest(handle, fallback); if (LOG_ENABLED) LOG.info("added switch point guard"); // guards for receiver and parameter Class[] pt = handle.type().parameterArray(); for (int i=0; i<args.length; i++) { Object arg = args[i]; MethodHandle test = null; if (arg==null) { test = IS_NULL.asType(MethodType.methodType(boolean.class, pt[i])); if (LOG_ENABLED) LOG.info("added null argument check at pos "+i); } else { Class argClass = arg.getClass(); if (pt[i].isPrimitive()) continue; //if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue; test = SAME_CLASS. bindTo(argClass). asType(MethodType.methodType(boolean.class, pt[i])); if (LOG_ENABLED) LOG.info("added same class check at pos "+i); } Class[] drops = new Class[i]; System.arraycopy(pt, 0, drops, 0, drops.length); test = MethodHandles.dropArguments(test, 0, drops); handle = MethodHandles.guardWithTest(test, handle, fallback); } }
void function (Object receiver) { if (handle==null) return; if (!cache) return; MethodHandle fallback = makeFallBack(callSite, sender, name, callType.ordinal(), targetType, safeNavigationOrig, thisCall, spread); if (receiver instanceof GroovyObject) { GroovyObject go = (GroovyObject) receiver; MetaClass mc = (MetaClass) go.getMetaClass(); MethodHandle test = SAME_MC.bindTo(mc); test = test.asType(MethodType.methodType(boolean.class,targetType.parameterType(0))); handle = MethodHandles.guardWithTest(test, handle, fallback); if (LOG_ENABLED) LOG.info(STR); } else if (receiver instanceof Class) { MethodHandle test = EQUALS.bindTo(receiver); test = test.asType(MethodType.methodType(boolean.class,targetType.parameterType(0))); handle = MethodHandles.guardWithTest(test, handle, fallback); if (LOG_ENABLED) LOG.info(STR); } if (!useMetaClass && isCategoryMethod) { if (method instanceof NewInstanceMetaMethod) { handle = MethodHandles.guardWithTest(HAS_CATEGORY_IN_CURRENT_THREAD_GUARD, handle, fallback); if (LOG_ENABLED) LOG.info(STR); } } handle = switchPoint.guardWithTest(handle, fallback); if (LOG_ENABLED) LOG.info(STR); Class[] pt = handle.type().parameterArray(); for (int i=0; i<args.length; i++) { Object arg = args[i]; MethodHandle test = null; if (arg==null) { test = IS_NULL.asType(MethodType.methodType(boolean.class, pt[i])); if (LOG_ENABLED) LOG.info(STR+i); } else { Class argClass = arg.getClass(); if (pt[i].isPrimitive()) continue; test = SAME_CLASS. bindTo(argClass). asType(MethodType.methodType(boolean.class, pt[i])); if (LOG_ENABLED) LOG.info(STR+i); } Class[] drops = new Class[i]; System.arraycopy(pt, 0, drops, 0, drops.length); test = MethodHandles.dropArguments(test, 0, drops); handle = MethodHandles.guardWithTest(test, handle, fallback); } }
/** * Sets all argument and receiver guards. */
Sets all argument and receiver guards
setGuards
{ "repo_name": "jwagenleitner/incubator-groovy", "path": "src/main/java/org/codehaus/groovy/vmplugin/v7/Selector.java", "license": "apache-2.0", "size": 50364 }
[ "groovy.lang.GroovyObject", "groovy.lang.MetaClass", "java.lang.invoke.MethodHandle", "java.lang.invoke.MethodHandles", "java.lang.invoke.MethodType", "org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod", "org.codehaus.groovy.vmplugin.v7.IndyGuardsFiltersAndSignatures", "org.codehaus.groovy.vmplugin.v7.IndyInterface" ]
import groovy.lang.GroovyObject; import groovy.lang.MetaClass; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod; import org.codehaus.groovy.vmplugin.v7.IndyGuardsFiltersAndSignatures; import org.codehaus.groovy.vmplugin.v7.IndyInterface;
import groovy.lang.*; import java.lang.invoke.*; import org.codehaus.groovy.runtime.metaclass.*; import org.codehaus.groovy.vmplugin.v7.*;
[ "groovy.lang", "java.lang", "org.codehaus.groovy" ]
groovy.lang; java.lang; org.codehaus.groovy;
1,574,927
@ApiModelProperty(example = "null", value = "") public NullableInt64 getProfileId() { return profileId; }
@ApiModelProperty(example = "null", value = "") NullableInt64 function() { return profileId; }
/** * Get profileId * @return profileId **/
Get profileId
getProfileId
{ "repo_name": "ixaris/ope-applicationclients", "path": "java-client/src/main/java/com/ixaris/ope/applications/client/model/ManagedCardFilter.java", "license": "mit", "size": 16001 }
[ "com.ixaris.ope.applications.client.model.NullableInt64", "io.swagger.annotations.ApiModelProperty" ]
import com.ixaris.ope.applications.client.model.NullableInt64; import io.swagger.annotations.ApiModelProperty;
import com.ixaris.ope.applications.client.model.*; import io.swagger.annotations.*;
[ "com.ixaris.ope", "io.swagger.annotations" ]
com.ixaris.ope; io.swagger.annotations;
2,144,945
private static InputStream convertToFeaturesStream(XPath xPath, InputStream kmlInputStream, String root) throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { try { // read stream String kmlData = readCharacters(kmlInputStream, "UTF-8"); // create XML document Document doc = DomUtil.makeDomFromString(Val.removeBOM(kmlData), false); // find placemarks NodeList ndPlacemarks = (NodeList) xPath.evaluate("//Placemark", doc, XPathConstants.NODESET); if (ndPlacemarks.getLength()>0) return new ByteArrayInputStream(kmlData.getBytes("UTF-8")); // find network links NodeList ndNetworkLinks = (NodeList) xPath.evaluate("//NetworkLink/Url/href", doc, XPathConstants.NODESET); if (ndNetworkLinks.getLength()==0) { ndNetworkLinks = (NodeList) xPath.evaluate("//NetworkLink/Link/href", doc, XPathConstants.NODESET); if (ndNetworkLinks.getLength()==0) { return null; } } for (int i=0; i<ndNetworkLinks.getLength(); i++) { Node ndNetworkLink = ndNetworkLinks.item(i); String value = (String) xPath.evaluate(".", ndNetworkLink, XPathConstants.STRING); if (root.length()>0) { try { URI valueUrl = new URI(value); if (!valueUrl.isAbsolute()) { URI rootUrl = new URI(root); value = rootUrl.resolve(valueUrl.normalize()).toString(); } } catch (URISyntaxException ex) { continue; } } if (value.length()>0) { InputStream is = openKmlStream(xPath, value); if (is!=null) { is = convertToFeaturesStream(is, value); if (is!=null) return is; } } } } finally { try { kmlInputStream.close(); } catch (IOException ex){} } return null; }
static InputStream function(XPath xPath, InputStream kmlInputStream, String root) throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { try { String kmlData = readCharacters(kmlInputStream, "UTF-8"); Document doc = DomUtil.makeDomFromString(Val.removeBOM(kmlData), false); NodeList ndPlacemarks = (NodeList) xPath.evaluate(STRUTF-8STR if (ndNetworkLinks.getLength()==0) { ndNetworkLinks = (NodeList) xPath.evaluate(STR.", ndNetworkLink, XPathConstants.STRING); if (root.length()>0) { try { URI valueUrl = new URI(value); if (!valueUrl.isAbsolute()) { URI rootUrl = new URI(root); value = rootUrl.resolve(valueUrl.normalize()).toString(); } } catch (URISyntaxException ex) { continue; } } if (value.length()>0) { InputStream is = openKmlStream(xPath, value); if (is!=null) { is = convertToFeaturesStream(is, value); if (is!=null) return is; } } } } finally { try { kmlInputStream.close(); } catch (IOException ex){} } return null; }
/** * Drills-down KML stream for "Placemark" and follows "NetworkLink". THis method * ALWAYS closes input stream passed as an argument. * @param xPath XPath * @param kmlInputStream KML input stream * @param rootUrl root URL used when KML contains relative URL * @return first found feature stream. * @throws IOException if reading stream fails * @throws XPathExpressionException if invalid XPath expression * @throws SAXException if error parsing document * @throws ParserConfigurationException if error obtaining parser */
Drills-down KML stream for "Placemark" and follows "NetworkLink". THis method ALWAYS closes input stream passed as an argument
convertToFeaturesStream
{ "repo_name": "usgin/usgin-geoportal", "path": "src/com/esri/gpt/framework/util/KmlUtil.java", "license": "apache-2.0", "size": 10545 }
[ "com.esri.gpt.framework.util.Val", "com.esri.gpt.framework.xml.DomUtil", "java.io.IOException", "java.io.InputStream", "java.net.URISyntaxException", "javax.xml.parsers.ParserConfigurationException", "javax.xml.xpath.XPath", "javax.xml.xpath.XPathConstants", "javax.xml.xpath.XPathExpressionException", "org.w3c.dom.Document", "org.w3c.dom.NodeList", "org.xml.sax.SAXException" ]
import com.esri.gpt.framework.util.Val; import com.esri.gpt.framework.xml.DomUtil; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException;
import com.esri.gpt.framework.util.*; import com.esri.gpt.framework.xml.*; import java.io.*; import java.net.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "com.esri.gpt", "java.io", "java.net", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
com.esri.gpt; java.io; java.net; javax.xml; org.w3c.dom; org.xml.sax;
1,502,879
default Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { return Optional.empty(); }
default Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { return Optional.empty(); }
/** * Get the physical layout for a new table. */
Get the physical layout for a new table
getNewTableLayout
{ "repo_name": "stewartpark/presto", "path": "presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorMetadata.java", "license": "apache-2.0", "size": 23793 }
[ "com.facebook.presto.spi.ConnectorNewTableLayout", "com.facebook.presto.spi.ConnectorSession", "com.facebook.presto.spi.ConnectorTableMetadata", "java.util.Optional" ]
import com.facebook.presto.spi.ConnectorNewTableLayout; import com.facebook.presto.spi.ConnectorSession; import com.facebook.presto.spi.ConnectorTableMetadata; import java.util.Optional;
import com.facebook.presto.spi.*; import java.util.*;
[ "com.facebook.presto", "java.util" ]
com.facebook.presto; java.util;
2,653,850
JCExpression makeQualIdent(JCExpression expr, String name) { return naming.makeQualIdent(expr, name); }
JCExpression makeQualIdent(JCExpression expr, String name) { return naming.makeQualIdent(expr, name); }
/** * Makes an <strong>unquoted</strong> qualified (compound) identifier * from the given qualified name components * @param expr A starting expression (may be null) * @param names The components of the name (may be null) * @see #makeQuotedQualIdentFromString(String) */
Makes an unquoted qualified (compound) identifier from the given qualified name components
makeQualIdent
{ "repo_name": "gijsleussink/ceylon", "path": "compiler-java/src/com/redhat/ceylon/compiler/java/codegen/AbstractTransformer.java", "license": "apache-2.0", "size": 262988 }
[ "com.redhat.ceylon.langtools.tools.javac.tree.JCTree" ]
import com.redhat.ceylon.langtools.tools.javac.tree.JCTree;
import com.redhat.ceylon.langtools.tools.javac.tree.*;
[ "com.redhat.ceylon" ]
com.redhat.ceylon;
2,419,599
@Test public void testRegionCrossingRowColBloom() throws Exception { runTest("testRegionCrossingLoadRowColBloom", BloomType.ROWCOL, new byte[][][] { new byte[][]{ Bytes.toBytes("aaaa"), Bytes.toBytes("eee") }, new byte[][]{ Bytes.toBytes("fff"), Bytes.toBytes("zzz") }, }); }
void function() throws Exception { runTest(STR, BloomType.ROWCOL, new byte[][][] { new byte[][]{ Bytes.toBytes("aaaa"), Bytes.toBytes("eee") }, new byte[][]{ Bytes.toBytes("fff"), Bytes.toBytes("zzz") }, }); }
/** * Test loading into a column family that has a ROWCOL bloom filter. */
Test loading into a column family that has a ROWCOL bloom filter
testRegionCrossingRowColBloom
{ "repo_name": "wanhao/IRIndex", "path": "src/test/java/org/apache/hadoop/hbase/mapreduce/TestLoadIncrementalHFiles.java", "license": "apache-2.0", "size": 13740 }
[ "org.apache.hadoop.hbase.regionserver.StoreFile", "org.apache.hadoop.hbase.util.Bytes" ]
import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,309,075
boolean handleTouch(MotionEvent event);
boolean handleTouch(MotionEvent event);
/** * Handles the touch event. * * @param event the touch event * @return true if the event was handled */
Handles the touch event
handleTouch
{ "repo_name": "artiomchi/Dual-Battery-Widget", "path": "lib/AChartEngine/src/org/achartengine/ITouchHandler.java", "license": "apache-2.0", "size": 1564 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
2,228,900
@Override public Component getComponentBefore(Container container, Component component) { Component previous = getButton(ENTER); if(component == getButton(CANCEL)) { previous = getButton(ENTER); } else if(component == getButton(DATE_PICKER)) { previous = getField(DATE); } else if(component == getButton(ENTER)) { previous = getField(NOTES); } else if(component == getButton(NEW)) { previous = getButton(CANCEL); } else if(component == getButton(NEXT)) { previous = getField(CHECK_NUMBER); } else if(component == getButton(SPLIT)) { previous = getForm().getPayToChooser(); } else if(component == getButton(PENDING)) { previous = getButton(SPLIT); } else if(component == getField(AMOUNT)) { previous = getForm().getPayFromChooser(); } else if(component == getField(CHECK_NUMBER)) { previous = getButton(NEW); } else if(component == getField(DATE)) { previous = getField(CHECK_NUMBER); } else if(component == getField(NOTES)) { previous = getButton(PENDING); } else if(component == getForm().getPayFromChooser().getTextField()) { previous = getField(DATE); } else if(component == getForm().getPayToChooser()) { previous = getField(AMOUNT); } if(previous.isEnabled() == false) { previous = component; } return previous; }
Component function(Container container, Component component) { Component previous = getButton(ENTER); if(component == getButton(CANCEL)) { previous = getButton(ENTER); } else if(component == getButton(DATE_PICKER)) { previous = getField(DATE); } else if(component == getButton(ENTER)) { previous = getField(NOTES); } else if(component == getButton(NEW)) { previous = getButton(CANCEL); } else if(component == getButton(NEXT)) { previous = getField(CHECK_NUMBER); } else if(component == getButton(SPLIT)) { previous = getForm().getPayToChooser(); } else if(component == getButton(PENDING)) { previous = getButton(SPLIT); } else if(component == getField(AMOUNT)) { previous = getForm().getPayFromChooser(); } else if(component == getField(CHECK_NUMBER)) { previous = getButton(NEW); } else if(component == getField(DATE)) { previous = getField(CHECK_NUMBER); } else if(component == getField(NOTES)) { previous = getButton(PENDING); } else if(component == getForm().getPayFromChooser().getTextField()) { previous = getField(DATE); } else if(component == getForm().getPayToChooser()) { previous = getField(AMOUNT); } if(previous.isEnabled() == false) { previous = component; } return previous; }
/** * This method returns the previous component to receive focus. * * @param container The container the component belongs to. * @param component The component that currently has the focus. * * @return The previous component to receive focus. */
This method returns the previous component to receive focus
getComponentBefore
{ "repo_name": "aalopez/javamoney-examples", "path": "swing/javamoney-ez/money/src/main/java/org/javamoney/examples/ez/money/gui/view/register/FormTraversalHandler.java", "license": "apache-2.0", "size": 7269 }
[ "java.awt.Component", "java.awt.Container" ]
import java.awt.Component; import java.awt.Container;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,217,801
public void validateFilterField(List<String> filterField) throws AlgebricksException, IOException { IAType fieldType = getSubFieldType(filterField); if (fieldType == null) { throw new AlgebricksException("A field with this name \"" + filterField + "\" could not be found."); } switch (fieldType.getTypeTag()) { case INT8: case INT16: case INT32: case INT64: case FLOAT: case DOUBLE: case STRING: case BINARY: case DATE: case TIME: case DATETIME: case UUID: case YEARMONTHDURATION: case DAYTIMEDURATION: break; case UNION: throw new AlgebricksException("The filter field \"" + filterField + "\" cannot be nullable"); default: throw new AlgebricksException("The field \"" + filterField + "\" which is of type " + fieldType.getTypeTag() + " cannot be used as a filter for a dataset."); } }
void function(List<String> filterField) throws AlgebricksException, IOException { IAType fieldType = getSubFieldType(filterField); if (fieldType == null) { throw new AlgebricksException(STRSTR\STR); } switch (fieldType.getTypeTag()) { case INT8: case INT16: case INT32: case INT64: case FLOAT: case DOUBLE: case STRING: case BINARY: case DATE: case TIME: case DATETIME: case UUID: case YEARMONTHDURATION: case DAYTIMEDURATION: break; case UNION: throw new AlgebricksException(STRSTR\STR); default: throw new AlgebricksException(STRSTR\STR + fieldType.getTypeTag() + STR); } }
/** * Validates the field that will be used as filter for the components of an LSM index. * * @param keyFieldNames * a list of key fields that will be validated * @param indexType * the type of the index that its key fields is being validated * @throws AlgebricksException * (if the validation failed), IOException */
Validates the field that will be used as filter for the components of an LSM index
validateFilterField
{ "repo_name": "sjaco002/incubator-asterixdb", "path": "asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java", "license": "apache-2.0", "size": 24756 }
[ "edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException", "java.io.IOException", "java.util.List" ]
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException; import java.io.IOException; import java.util.List;
import edu.uci.ics.hyracks.algebricks.common.exceptions.*; import java.io.*; import java.util.*;
[ "edu.uci.ics", "java.io", "java.util" ]
edu.uci.ics; java.io; java.util;
965,307
public String getSensorName(){ return "HTS221"; } public HTS221() throws Exception { bus = I2CFactory.getInstance(I2CBus.BUS_1); device = bus.getDevice(HTS221_ADDRESS); doStart(); //super(endpoint, processor, device); buffer.order(ByteOrder.LITTLE_ENDIAN); start(); storeSensor(this); setValidLoad (true); }
String function(){ return STR; } public HTS221() throws Exception { bus = I2CFactory.getInstance(I2CBus.BUS_1); device = bus.getDevice(HTS221_ADDRESS); doStart(); buffer.order(ByteOrder.LITTLE_ENDIAN); start(); storeSensor(this); setValidLoad (true); }
/** * getSensorName() returns the name of the sensor */
getSensorName() returns the name of the sensor
getSensorName
{ "repo_name": "orsjb/HappyBrackets", "path": "HappyBrackets/src/main/java/net/happybrackets/device/sensors/HTS221.java", "license": "apache-2.0", "size": 12388 }
[ "com.pi4j.io.i2c.I2CBus", "com.pi4j.io.i2c.I2CFactory", "java.nio.ByteOrder" ]
import com.pi4j.io.i2c.I2CBus; import com.pi4j.io.i2c.I2CFactory; import java.nio.ByteOrder;
import com.pi4j.io.i2c.*; import java.nio.*;
[ "com.pi4j.io", "java.nio" ]
com.pi4j.io; java.nio;
2,309,103
private void backpropSaved(Set<Integer> featuresSeen) { for (int x : featuresSeen) { int mapX = preMap.get(x); int tok = x / config.numTokens; int offset = (x % config.numTokens) * config.embeddingSize; for (int j = 0; j < config.hiddenSize; ++j) { double delta = gradSaved[mapX][j]; for (int k = 0; k < config.embeddingSize; ++k) { gradW1[j][offset + k] += delta * E[tok][k]; gradE[tok][k] += delta * W1[j][offset + k]; } } } }
void function(Set<Integer> featuresSeen) { for (int x : featuresSeen) { int mapX = preMap.get(x); int tok = x / config.numTokens; int offset = (x % config.numTokens) * config.embeddingSize; for (int j = 0; j < config.hiddenSize; ++j) { double delta = gradSaved[mapX][j]; for (int k = 0; k < config.embeddingSize; ++k) { gradW1[j][offset + k] += delta * E[tok][k]; gradE[tok][k] += delta * W1[j][offset + k]; } } } }
/** * Backpropagate gradient values from gradSaved into the gradients * for the E vectors that generated them. * * @param featuresSeen Feature IDs observed during training for * which gradSaved values need to be backprop'd * into gradE */
Backpropagate gradient values from gradSaved into the gradients for the E vectors that generated them
backpropSaved
{ "repo_name": "rupenp/CoreNLP", "path": "src/edu/stanford/nlp/parser/nndep/Classifier.java", "license": "gpl-2.0", "size": 23512 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,697,851
public static Server subscribeServerToChannel(User user, Server server, Channel channel, boolean flush) { // do not allow non-satellite or non-proxy servers to // be subscribed to satellite or proxy channels respectively. if (channel.isSatellite()) { if (!server.isSatellite()) { return server; } } else if (channel.isProxy()) { if (!server.isProxy()) { return server; } } if (user != null && !ChannelManager.verifyChannelSubscribe(user, channel.getId())) { //Throw an exception with a nice error message so the user //knows what went wrong. LocalizationService ls = LocalizationService.getInstance(); PermissionException pex = new PermissionException("User does not have" + " permission to subscribe this server to this channel."); pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.subscribechannel")); pex.setLocalizedSummary( ls.getMessage("permission.jsp.summary.subscribechannel")); throw pex; } if (!verifyArchCompatibility(server, channel)) { throw new IncompatibleArchException( server.getServerArch(), channel.getChannelArch()); } log.debug("calling subscribe_server_to_channel"); CallableMode m = ModeFactory.getCallableMode("Channel_queries", "subscribe_server_to_channel"); Map<String, Object> in = new HashMap<String, Object>(); in.put("server_id", server.getId()); if (user != null) { in.put("user_id", user.getId()); } else { in.put("user_id", null); } in.put("channel_id", channel.getId()); m.execute(in, new HashMap<String, Integer>()); log.debug("returning with a flush? " + flush); if (flush) { return (Server) HibernateFactory.reload(server); } HibernateFactory.getSession().refresh(server); return server; }
static Server function(User user, Server server, Channel channel, boolean flush) { if (channel.isSatellite()) { if (!server.isSatellite()) { return server; } } else if (channel.isProxy()) { if (!server.isProxy()) { return server; } } if (user != null && !ChannelManager.verifyChannelSubscribe(user, channel.getId())) { LocalizationService ls = LocalizationService.getInstance(); PermissionException pex = new PermissionException(STR + STR); pex.setLocalizedTitle(ls.getMessage(STR)); pex.setLocalizedSummary( ls.getMessage(STR)); throw pex; } if (!verifyArchCompatibility(server, channel)) { throw new IncompatibleArchException( server.getServerArch(), channel.getChannelArch()); } log.debug(STR); CallableMode m = ModeFactory.getCallableMode(STR, STR); Map<String, Object> in = new HashMap<String, Object>(); in.put(STR, server.getId()); if (user != null) { in.put(STR, user.getId()); } else { in.put(STR, null); } in.put(STR, channel.getId()); m.execute(in, new HashMap<String, Integer>()); log.debug(STR + flush); if (flush) { return (Server) HibernateFactory.reload(server); } HibernateFactory.getSession().refresh(server); return server; }
/** * Subscribes the given server to the given channel. * @param user Current user * @param server Server to be subscribed * @param channel Channel to subscribe to. * @param flush flushes the hibernate session. * @return the modified server if there were * any changes modifications made * to the Server during the call. * Make sure the caller uses the * returned server. */
Subscribes the given server to the given channel
subscribeServerToChannel
{ "repo_name": "mcalmer/spacewalk", "path": "java/code/src/com/redhat/rhn/manager/system/SystemManager.java", "license": "gpl-2.0", "size": 134651 }
[ "com.redhat.rhn.common.db.datasource.CallableMode", "com.redhat.rhn.common.db.datasource.ModeFactory", "com.redhat.rhn.common.hibernate.HibernateFactory", "com.redhat.rhn.common.localization.LocalizationService", "com.redhat.rhn.common.security.PermissionException", "com.redhat.rhn.domain.channel.Channel", "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.manager.channel.ChannelManager", "java.util.HashMap", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.CallableMode; import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.hibernate.HibernateFactory; import com.redhat.rhn.common.localization.LocalizationService; import com.redhat.rhn.common.security.PermissionException; import com.redhat.rhn.domain.channel.Channel; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.manager.channel.ChannelManager; import java.util.HashMap; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.common.hibernate.*; import com.redhat.rhn.common.localization.*; import com.redhat.rhn.common.security.*; import com.redhat.rhn.domain.channel.*; import com.redhat.rhn.domain.server.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.manager.channel.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,043,637
public E remove() { E e = poll(); if (e == null) throw new NoSuchElementException(); return e; }
E function() { E e = poll(); if (e == null) throw new NoSuchElementException(); return e; }
/** * Retrieves and removes the head of this queue. This method * differs from the <tt>poll</tt> method in that it throws an * exception if this queue is empty. * * @return the head of this queue. * @throws NoSuchElementException if this queue is empty. */
Retrieves and removes the head of this queue. This method differs from the poll method in that it throws an exception if this queue is empty
remove
{ "repo_name": "wesen/nmedit", "path": "libs/jnmprotocol/src/net/sf/nmedit/jnmprotocol/utils/QueueBuffer.java", "license": "gpl-2.0", "size": 22537 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
1,466,758
InputStream getResourceAsStream(String deploymentId, String resourceName);
InputStream getResourceAsStream(String deploymentId, String resourceName);
/** * Gives access to a deployment resource through a stream of bytes. * * @param deploymentId id of the deployment, cannot be null. * @param resourceName name of the resource, cannot be null. * * @throws ProcessEngineException * When the resource doesn't exist in the given deployment or when no deployment exists * for the given deploymentId. * @throws AuthorizationException * If the user has no {@link Permissions#READ} permission on {@link Resources#DEPLOYMENT}. */
Gives access to a deployment resource through a stream of bytes
getResourceAsStream
{ "repo_name": "holisticon/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/RepositoryService.java", "license": "apache-2.0", "size": 23869 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
339,716
public Color getColor(FOUserAgent foUserAgent) { return null; }
Color function(FOUserAgent foUserAgent) { return null; }
/** * This method expects to be overridden by subclasses * @param foUserAgent FOP user agent * @return ColorType property value */
This method expects to be overridden by subclasses
getColor
{ "repo_name": "Distrotech/fop", "path": "src/java/org/apache/fop/fo/properties/Property.java", "license": "apache-2.0", "size": 5081 }
[ "java.awt.Color", "org.apache.fop.apps.FOUserAgent" ]
import java.awt.Color; import org.apache.fop.apps.FOUserAgent;
import java.awt.*; import org.apache.fop.apps.*;
[ "java.awt", "org.apache.fop" ]
java.awt; org.apache.fop;
553,253
public void tarjan(T entity, int index, Stack<T> stack, Map<T, Integer> indexMap, Map<T, Integer> lowlinkMap, Set<Set<T>> result, Set<T> processed, Set<T> stackEntities, Map<T, Collection<T>> cache, Set<T> childrenOfTop, Set<T> parentsOfBottom) { throwExceptionIfInterrupted(); if (processed.add(entity)) { Collection<T> rawChildren = rawParentChildProvider.getChildren(entity); if (rawChildren.isEmpty() || rawChildren.contains(bottomEntity)) { parentsOfBottom.add(entity); } } pm.reasonerTaskProgressChanged(processed.size(), classificationSize); indexMap.put(entity, index); lowlinkMap.put(entity, index); index = index + 1; stack.push(entity); stackEntities.add(entity); // Get the raw parents - cache if necessary Collection<T> rawParents = null; if (cache != null) { // We are therefore caching raw parents of children. rawParents = cache.get(entity); if (rawParents == null) { // Not in cache! rawParents = rawParentChildProvider.getParents(entity); // Note down if our entity is a if (rawParents.isEmpty() || rawParents.contains(topEntity)) { childrenOfTop.add(entity); } cache.put(entity, rawParents); } } else { rawParents = rawParentChildProvider.getParents(entity); // Note down if our entity is a if (rawParents.isEmpty() || rawParents.contains(topEntity)) { childrenOfTop.add(entity); } } for (T superEntity : rawParents) { if (!indexMap.containsKey(superEntity)) { tarjan(superEntity, index, stack, indexMap, lowlinkMap, result, processed, stackEntities, cache, childrenOfTop, parentsOfBottom); lowlinkMap.put(entity, Math.min(lowlinkMap.get(entity), lowlinkMap.get(superEntity))); } else if (stackEntities.contains(superEntity)) { lowlinkMap.put(entity, Math.min(lowlinkMap.get(entity), indexMap.get(superEntity))); } } if (lowlinkMap.get(entity).equals(indexMap.get(entity))) { Set<T> scc = new HashSet<T>(); while (true) { T clsPrime = stack.pop(); stackEntities.remove(clsPrime); scc.add(clsPrime); if (clsPrime.equals(entity)) { break; } } if (scc.size() > 1) { // We ADD a cycle result.add(scc); } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
void function(T entity, int index, Stack<T> stack, Map<T, Integer> indexMap, Map<T, Integer> lowlinkMap, Set<Set<T>> result, Set<T> processed, Set<T> stackEntities, Map<T, Collection<T>> cache, Set<T> childrenOfTop, Set<T> parentsOfBottom) { throwExceptionIfInterrupted(); if (processed.add(entity)) { Collection<T> rawChildren = rawParentChildProvider.getChildren(entity); if (rawChildren.isEmpty() rawChildren.contains(bottomEntity)) { parentsOfBottom.add(entity); } } pm.reasonerTaskProgressChanged(processed.size(), classificationSize); indexMap.put(entity, index); lowlinkMap.put(entity, index); index = index + 1; stack.push(entity); stackEntities.add(entity); Collection<T> rawParents = null; if (cache != null) { rawParents = cache.get(entity); if (rawParents == null) { rawParents = rawParentChildProvider.getParents(entity); if (rawParents.isEmpty() rawParents.contains(topEntity)) { childrenOfTop.add(entity); } cache.put(entity, rawParents); } } else { rawParents = rawParentChildProvider.getParents(entity); if (rawParents.isEmpty() rawParents.contains(topEntity)) { childrenOfTop.add(entity); } } for (T superEntity : rawParents) { if (!indexMap.containsKey(superEntity)) { tarjan(superEntity, index, stack, indexMap, lowlinkMap, result, processed, stackEntities, cache, childrenOfTop, parentsOfBottom); lowlinkMap.put(entity, Math.min(lowlinkMap.get(entity), lowlinkMap.get(superEntity))); } else if (stackEntities.contains(superEntity)) { lowlinkMap.put(entity, Math.min(lowlinkMap.get(entity), indexMap.get(superEntity))); } } if (lowlinkMap.get(entity).equals(indexMap.get(entity))) { Set<T> scc = new HashSet<T>(); while (true) { T clsPrime = stack.pop(); stackEntities.remove(clsPrime); scc.add(clsPrime); if (clsPrime.equals(entity)) { break; } } if (scc.size() > 1) { result.add(scc); } } }
/** * Applies the tarjan algorithm for a given entity. This computes the cycle that the entity is involved in (if * any). * @param entity The entity * @param index index * @param stack stack * @param indexMap index map * @param lowlinkMap low link map * @param result result * @param processed processed * @param stackEntities stack entities * @param cache A cache of children to parents - may be <code>null</code> if no caching is to take place. * @param childrenOfTop A set of entities that have a raw parent that is the top entity * @param parentsOfBottom A set of entities that have a raw parent that is the bottom entity */
Applies the tarjan algorithm for a given entity. This computes the cycle that the entity is involved in (if any)
tarjan
{ "repo_name": "eschwert/DL-Learner", "path": "components-core/src/main/java/org/dllearner/reasoning/StructuralReasonerExtended.java", "license": "gpl-3.0", "size": 65239 }
[ "java.util.Collection", "java.util.HashSet", "java.util.Map", "java.util.Set", "java.util.Stack" ]
import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Stack;
import java.util.*;
[ "java.util" ]
java.util;
2,018,371
public static List<String> splitDBdotName(String src, String cat, String quotId, boolean isNoBslashEscSet) { if ((src == null) || (src.equals("%"))) { return new ArrayList<String>(); } boolean isQuoted = StringUtils.indexOfIgnoreCase(0, src, quotId) > -1; String retval = src; String tmpCat = cat; //I.e., what if database is named `MyDatabase 1.0.0`... thus trueDotIndex int trueDotIndex = -1; if (!" ".equals(quotId)) { //Presumably, if there is a database name attached and it contains dots, then it should be quoted so we first check for that if (isQuoted) { trueDotIndex = StringUtils.indexOfIgnoreCase(0, retval, quotId + "." + quotId); } else { // NOT quoted, fetch first DOT // ex: cStmt = this.conn.prepareCall("{call bug57022.procbug57022(?, ?)}"); trueDotIndex = StringUtils.indexOfIgnoreCase(0, retval, "."); } } else { trueDotIndex = retval.indexOf("."); } List<String> retTokens = new ArrayList<String>(2); if (trueDotIndex != -1) { //There is a catalog attached if (isQuoted) { tmpCat = StringUtils.toString(StringUtils.stripEnclosure(retval.substring(0, trueDotIndex + 1).getBytes(), quotId, quotId)); if (StringUtils.startsWithIgnoreCaseAndWs(tmpCat, quotId)) { tmpCat = tmpCat.substring(1, tmpCat.length() - 1); } retval = retval.substring(trueDotIndex + 2); retval = StringUtils.toString(StringUtils.stripEnclosure(retval.getBytes(), quotId, quotId)); } else { //NOT quoted, adjust indexOf tmpCat = retval.substring(0, trueDotIndex); retval = retval.substring(trueDotIndex + 1); } } else { //No catalog attached, strip retval and return retval = StringUtils.toString(StringUtils.stripEnclosure(retval.getBytes(), quotId, quotId)); } retTokens.add(tmpCat); retTokens.add(retval); return retTokens; }
static List<String> function(String src, String cat, String quotId, boolean isNoBslashEscSet) { if ((src == null) (src.equals("%"))) { return new ArrayList<String>(); } boolean isQuoted = StringUtils.indexOfIgnoreCase(0, src, quotId) > -1; String retval = src; String tmpCat = cat; int trueDotIndex = -1; if (!" ".equals(quotId)) { if (isQuoted) { trueDotIndex = StringUtils.indexOfIgnoreCase(0, retval, quotId + "." + quotId); } else { trueDotIndex = StringUtils.indexOfIgnoreCase(0, retval, "."); } } else { trueDotIndex = retval.indexOf("."); } List<String> retTokens = new ArrayList<String>(2); if (trueDotIndex != -1) { if (isQuoted) { tmpCat = StringUtils.toString(StringUtils.stripEnclosure(retval.substring(0, trueDotIndex + 1).getBytes(), quotId, quotId)); if (StringUtils.startsWithIgnoreCaseAndWs(tmpCat, quotId)) { tmpCat = tmpCat.substring(1, tmpCat.length() - 1); } retval = retval.substring(trueDotIndex + 2); retval = StringUtils.toString(StringUtils.stripEnclosure(retval.getBytes(), quotId, quotId)); } else { tmpCat = retval.substring(0, trueDotIndex); retval = retval.substring(trueDotIndex + 1); } } else { retval = StringUtils.toString(StringUtils.stripEnclosure(retval.getBytes(), quotId, quotId)); } retTokens.add(tmpCat); retTokens.add(retval); return retTokens; }
/** * Next we check if there is anything to split. If so * we return result in form of "database";"name" * If string is NULL or wildcard (%), returns null and exits. * * @param src * the source string * @param cat * Catalog, if available * @param quotId * quoteId as defined on server * @param isNoBslashEscSet * Is our connection in BackSlashEscape mode * @return the input string with all comment-delimited data removed */
Next we check if there is anything to split. If so we return result in form of "database";"name" If string is NULL or wildcard (%), returns null and exits
splitDBdotName
{ "repo_name": "1fechner/FeatureExtractor", "path": "sources/FeatureExtractor/lib/mysql-connector-java-5.1.38/src/com/mysql/jdbc/StringUtils.java", "license": "lgpl-2.1", "size": 87237 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,522,208
protected IMemoryBlockTablePresentation getTablePresentationAdapter() { return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class); }
IMemoryBlockTablePresentation function() { return (IMemoryBlockTablePresentation)getMemoryBlock().getAdapter(IMemoryBlockTablePresentation.class); }
/** * Returns the table presentation for this rendering's memory block or * <code>null</code> if none. * <p> * By default a table presentation is obtained by asking this rendering's * memory block for its {@link IMemoryBlockTablePresentation} adapter. * </p> * @return the table presentation for this rendering's memory block, * or <code>null</code> */
Returns the table presentation for this rendering's memory block or <code>null</code> if none. By default a table presentation is obtained by asking this rendering's memory block for its <code>IMemoryBlockTablePresentation</code> adapter.
getTablePresentationAdapter
{ "repo_name": "daejunpark/jsaf", "path": "third_party/deckard/samples/src/AbstractAsyncTableRendering.java", "license": "bsd-3-clause", "size": 92248 }
[ "org.eclipse.debug.ui.memory.IMemoryBlockTablePresentation" ]
import org.eclipse.debug.ui.memory.IMemoryBlockTablePresentation;
import org.eclipse.debug.ui.memory.*;
[ "org.eclipse.debug" ]
org.eclipse.debug;
2,789,580
public void show(FragmentManager manager){ show(manager, "waitingDialog"); }
void function(FragmentManager manager){ show(manager, STR); }
/** * Title: show * Description:android.support.v4.app.FragmentManager.getSupportFragmentManager() * @param manager */
Title: show Description:android.support.v4.app.FragmentManager.getSupportFragmentManager()
show
{ "repo_name": "jwzhangjie/AndJie", "path": "AndJie/src/com/jwzhangjie/andbase/ui/dialog/WaitingFragmentDialog.java", "license": "gpl-2.0", "size": 1333 }
[ "android.support.v4.app.FragmentManager" ]
import android.support.v4.app.FragmentManager;
import android.support.v4.app.*;
[ "android.support" ]
android.support;
280,661
public static KeyPair generateKeyPair(X509KeyType keyType) throws GeneralSecurityException { switch (keyType) { case RSA: return generateRSAKeyPair(); case EC: return generateECKeyPair(); default: throw new IllegalArgumentException("Invalid X509KeyType"); } }
static KeyPair function(X509KeyType keyType) throws GeneralSecurityException { switch (keyType) { case RSA: return generateRSAKeyPair(); case EC: return generateECKeyPair(); default: throw new IllegalArgumentException(STR); } }
/** * Generates a new asymmetric key pair of the given type. * @param keyType the type of key pair to generate. * @return the new key pair. * @throws GeneralSecurityException if your java crypto providers are messed up. */
Generates a new asymmetric key pair of the given type
generateKeyPair
{ "repo_name": "maoling/zookeeper", "path": "zookeeper-server/src/test/java/org/apache/zookeeper/common/X509TestHelpers.java", "license": "apache-2.0", "size": 24496 }
[ "java.security.GeneralSecurityException", "java.security.KeyPair" ]
import java.security.GeneralSecurityException; import java.security.KeyPair;
import java.security.*;
[ "java.security" ]
java.security;
229,497
public FirewallPolicyInner updateTags(String resourceGroupName, String firewallPolicyName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).toBlocking().single().body(); }
FirewallPolicyInner function(String resourceGroupName, String firewallPolicyName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).toBlocking().single().body(); }
/** * Updates a Firewall Policy Tags. * * @param resourceGroupName The resource group name of the Firewall Policy. * @param firewallPolicyName The name of the Firewall Policy being updated. * @param tags Resource tags. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FirewallPolicyInner object if successful. */
Updates a Firewall Policy Tags
updateTags
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/FirewallPoliciesInner.java", "license": "mit", "size": 69669 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
278,429
public SubResource peerExpressRouteCircuitPeering() { return this.peerExpressRouteCircuitPeering; }
SubResource function() { return this.peerExpressRouteCircuitPeering; }
/** * Get reference to Express Route Circuit Private Peering Resource of the peered circuit. * * @return the peerExpressRouteCircuitPeering value */
Get reference to Express Route Circuit Private Peering Resource of the peered circuit
peerExpressRouteCircuitPeering
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitConnectionInner.java", "license": "mit", "size": 6784 }
[ "com.microsoft.azure.SubResource" ]
import com.microsoft.azure.SubResource;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,728,310
void modifyExperimentersRoles(SecurityContext ctx, boolean toAdd, List<ExperimenterData> experimenters, String systemGroup) throws DSOutOfServiceException, DSAccessException { try { IAdminPrx svc = gw.getAdminService(ctx); if (toAdd) { Iterator<ExperimenterData> i = experimenters.iterator(); ExperimenterData exp; List<GroupData> list; Iterator<GroupData> j; GroupData group; List<ExperimenterGroup> groups; boolean added = false; ExperimenterGroup gs = svc.lookupGroup(systemGroup); while (i.hasNext()) { exp = i.next(); list = exp.getGroups(); j = list.iterator(); while (j.hasNext()) { group = j.next(); if (dsFactory.getAdmin().isSecuritySystemGroup( group.getId(), systemGroup)) added = true; } if (!added) { groups = new ArrayList<ExperimenterGroup>(); groups.add(gs); svc.addGroups(exp.asExperimenter(), groups); } } } else { Iterator<ExperimenterData> i = experimenters.iterator(); ExperimenterData exp; List<GroupData> list; Iterator<GroupData> j; GroupData group; List<ExperimenterGroup> groups; while (i.hasNext()) { exp = i.next(); list = exp.getGroups(); groups = new ArrayList<ExperimenterGroup>(); j = list.iterator(); while (j.hasNext()) { group = j.next(); if (dsFactory.getAdmin().isSecuritySystemGroup( group.getId(), systemGroup)) { groups.add(group.asGroup()); } } if (groups.size() > 0) svc.removeGroups(exp.asExperimenter(), groups); } } } catch (Throwable t) { handleException(t, "Cannot modify the roles of the experimenters."); } }
void modifyExperimentersRoles(SecurityContext ctx, boolean toAdd, List<ExperimenterData> experimenters, String systemGroup) throws DSOutOfServiceException, DSAccessException { try { IAdminPrx svc = gw.getAdminService(ctx); if (toAdd) { Iterator<ExperimenterData> i = experimenters.iterator(); ExperimenterData exp; List<GroupData> list; Iterator<GroupData> j; GroupData group; List<ExperimenterGroup> groups; boolean added = false; ExperimenterGroup gs = svc.lookupGroup(systemGroup); while (i.hasNext()) { exp = i.next(); list = exp.getGroups(); j = list.iterator(); while (j.hasNext()) { group = j.next(); if (dsFactory.getAdmin().isSecuritySystemGroup( group.getId(), systemGroup)) added = true; } if (!added) { groups = new ArrayList<ExperimenterGroup>(); groups.add(gs); svc.addGroups(exp.asExperimenter(), groups); } } } else { Iterator<ExperimenterData> i = experimenters.iterator(); ExperimenterData exp; List<GroupData> list; Iterator<GroupData> j; GroupData group; List<ExperimenterGroup> groups; while (i.hasNext()) { exp = i.next(); list = exp.getGroups(); groups = new ArrayList<ExperimenterGroup>(); j = list.iterator(); while (j.hasNext()) { group = j.next(); if (dsFactory.getAdmin().isSecuritySystemGroup( group.getId(), systemGroup)) { groups.add(group.asGroup()); } } if (groups.size() > 0) svc.removeGroups(exp.asExperimenter(), groups); } } } catch (Throwable t) { handleException(t, STR); } }
/** * Adds or removes the passed experimenters from the specified system group. * * @param ctx The security context. * @param toAdd Pass <code>true</code> to add the experimenters as owners, * <code>false</code> otherwise. * @param experimenters The experimenters to add or remove. * @param systemGroup The roles to handle. * @throws DSOutOfServiceException If the connection is broken, or logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. */
Adds or removes the passed experimenters from the specified system group
modifyExperimentersRoles
{ "repo_name": "dominikl/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java", "license": "gpl-2.0", "size": 262766 }
[ "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;
165,073
private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception { long byteCount; for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();) { Entry entry = iter.next(); if (entry instanceof DirectoryEntry) { String childIndent = indent; if (childIndent != null) { childIndent += " "; } String childPrefix = prefix + "[" + entry.getName() + "]."; pw.println("start dir: " + prefix + entry.getName()); dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent); pw.println("end dir: " + prefix + entry.getName()); } else if (entry instanceof DocumentEntry) { if (showData) { pw.println("start doc: " + prefix + entry.getName()); if (hex == true) { byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw); } else { byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw); } pw.println("end doc: " + prefix + entry.getName() + " (" + byteCount + " bytes read)"); } else { if (indent != null) { pw.print(indent); } pw.println("doc: " + prefix + entry.getName()); } } else { pw.println("found unknown: " + prefix + entry.getName()); } } }
static void function(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception { long byteCount; for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();) { Entry entry = iter.next(); if (entry instanceof DirectoryEntry) { String childIndent = indent; if (childIndent != null) { childIndent += " "; } String childPrefix = prefix + "[" + entry.getName() + "]."; pw.println(STR + prefix + entry.getName()); dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent); pw.println(STR + prefix + entry.getName()); } else if (entry instanceof DocumentEntry) { if (showData) { pw.println(STR + prefix + entry.getName()); if (hex == true) { byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw); } else { byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw); } pw.println(STR + prefix + entry.getName() + STR + byteCount + STR); } else { if (indent != null) { pw.print(indent); } pw.println(STR + prefix + entry.getName()); } } else { pw.println(STR + prefix + entry.getName()); } } }
/** * This method recursively descends the directory structure, dumping * details of any files it finds to the output file. * * @param pw Output PrintWriter * @param dir DirectoryEntry to dump * @param prefix prefix used to identify path to this object * @param showData flag indicating if data is dumped, or just structure * @param hex set to true if hex output is required * @param indent indent used if displaying structure only * @throws Exception Thrown on file read errors */
This method recursively descends the directory structure, dumping details of any files it finds to the output file
dumpTree
{ "repo_name": "tmyroadctfig/mpxj", "path": "net/sf/mpxj/sample/MppDump.java", "license": "lgpl-2.1", "size": 8018 }
[ "java.io.PrintWriter", "java.util.Iterator", "org.apache.poi.poifs.filesystem.DirectoryEntry", "org.apache.poi.poifs.filesystem.DocumentEntry", "org.apache.poi.poifs.filesystem.DocumentInputStream", "org.apache.poi.poifs.filesystem.Entry" ]
import java.io.PrintWriter; import java.util.Iterator; import org.apache.poi.poifs.filesystem.DirectoryEntry; import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.poifs.filesystem.Entry;
import java.io.*; import java.util.*; import org.apache.poi.poifs.filesystem.*;
[ "java.io", "java.util", "org.apache.poi" ]
java.io; java.util; org.apache.poi;
749,037
private boolean isAPIModified(API api, Mediation mediation) { if (mediation != null) { String sequenceName; if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_IN.equalsIgnoreCase(mediation.getType())) { sequenceName = api.getInSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setInSequence(null); return true; } } else if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_OUT.equalsIgnoreCase(mediation.getType())) { sequenceName = api.getOutSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setOutSequence(null); return true; } } else { sequenceName = api.getFaultSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setFaultSequence(null); return true; } } } return false; }
boolean function(API api, Mediation mediation) { if (mediation != null) { String sequenceName; if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_IN.equalsIgnoreCase(mediation.getType())) { sequenceName = api.getInSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setInSequence(null); return true; } } else if (APIConstants.API_CUSTOM_SEQUENCE_TYPE_OUT.equalsIgnoreCase(mediation.getType())) { sequenceName = api.getOutSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setOutSequence(null); return true; } } else { sequenceName = api.getFaultSequence(); if (isSequenceExistsInAPI(sequenceName, mediation)) { api.setFaultSequence(null); return true; } } } return false; }
/*** * To check if the API is modified or not when the given sequence is in API. * * @param api * @param mediation * @return if the API is modified or not */
To check if the API is modified or not when the given sequence is in API
isAPIModified
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java", "license": "apache-2.0", "size": 253126 }
[ "org.wso2.carbon.apimgt.api.model.Mediation", "org.wso2.carbon.apimgt.impl.APIConstants" ]
import org.wso2.carbon.apimgt.api.model.Mediation; import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,753,145
public static BitSet toBitSet(DocIdSetIterator iterator, int numBits) throws IOException { BitDocIdSet.Builder builder = new BitDocIdSet.Builder(numBits); builder.or(iterator); BitDocIdSet result = builder.build(); if (result != null) { return result.bits(); } else { return new SparseFixedBitSet(numBits); } }
static BitSet function(DocIdSetIterator iterator, int numBits) throws IOException { BitDocIdSet.Builder builder = new BitDocIdSet.Builder(numBits); builder.or(iterator); BitDocIdSet result = builder.build(); if (result != null) { return result.bits(); } else { return new SparseFixedBitSet(numBits); } }
/** * Creates a {@link BitSet} from an iterator. */
Creates a <code>BitSet</code> from an iterator
toBitSet
{ "repo_name": "vrkansagara/elasticsearch", "path": "src/main/java/org/elasticsearch/common/lucene/docset/DocIdSets.java", "license": "apache-2.0", "size": 6540 }
[ "java.io.IOException", "org.apache.lucene.search.DocIdSetIterator", "org.apache.lucene.util.BitDocIdSet", "org.apache.lucene.util.BitSet", "org.apache.lucene.util.SparseFixedBitSet" ]
import java.io.IOException; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.util.BitDocIdSet; import org.apache.lucene.util.BitSet; import org.apache.lucene.util.SparseFixedBitSet;
import java.io.*; import org.apache.lucene.search.*; import org.apache.lucene.util.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
255,706
public ApplicationGatewayInner updateTags(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).toBlocking().last().body(); }
ApplicationGatewayInner function(String resourceGroupName, String applicationGatewayName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName, tags).toBlocking().last().body(); }
/** * Updates the specified application gateway tags. * * @param resourceGroupName The name of the resource group. * @param applicationGatewayName The name of the application gateway. * @param tags Resource tags. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ApplicationGatewayInner object if successful. */
Updates the specified application gateway tags
updateTags
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java", "license": "mit", "size": 183090 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,491,277
public gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdResponseType retrievePtConsentByPtId( gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdRequestType retrievePtConsentByPtIdRequest, WebServiceContext context) { LOG.debug("Begin retrievePtConsentByPtId"); RetrievePtConsentByPtIdResponseType oResponse = new RetrievePtConsentByPtIdResponseType(); AdapterPIPImpl oAdapterPIPImpl = getAdapterPIPImpl(); try { AssertionType assertion = retrievePtConsentByPtIdRequest.getAssertion(); loadAssertion(assertion, context); oResponse = oAdapterPIPImpl.retrievePtConsentByPtId(retrievePtConsentByPtIdRequest); } catch (Exception e) { String sErrorMessage = "Error occurred calling AdapterPIPImpl.retrievePtConsentByPtId. Error: " + e.getMessage(); LOG.error(sErrorMessage, e); throw new RuntimeException(sErrorMessage, e); } LOG.debug("End retrievePtConsentByPtId"); return oResponse; }
gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdResponseType function( gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdRequestType retrievePtConsentByPtIdRequest, WebServiceContext context) { LOG.debug(STR); RetrievePtConsentByPtIdResponseType oResponse = new RetrievePtConsentByPtIdResponseType(); AdapterPIPImpl oAdapterPIPImpl = getAdapterPIPImpl(); try { AssertionType assertion = retrievePtConsentByPtIdRequest.getAssertion(); loadAssertion(assertion, context); oResponse = oAdapterPIPImpl.retrievePtConsentByPtId(retrievePtConsentByPtIdRequest); } catch (Exception e) { String sErrorMessage = STR + e.getMessage(); LOG.error(sErrorMessage, e); throw new RuntimeException(sErrorMessage, e); } LOG.debug(STR); return oResponse; }
/** * Retrieve the patient consent settings for the given patient ID. * * @param retrievePtConsentByPtIdRequest The patient ID for which the consent is being retrieved. * @param context Web service context * @return The patient consent information for that patient. * @throws AdapterPIPException This exception is thrown if the data cannot be retrieved. */
Retrieve the patient consent settings for the given patient ID
retrievePtConsentByPtId
{ "repo_name": "beiyuxinke/CONNECT", "path": "Product/Production/Adapters/General/CONNECTAdapterWeb/src/main/java/gov/hhs/fha/nhinc/policyengine/adapter/pip/AdapterPIPServiceImpl.java", "license": "bsd-3-clause", "size": 6831 }
[ "gov.hhs.fha.nhinc.common.nhinccommon.AssertionType", "gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdResponseType", "javax.xml.ws.WebServiceContext" ]
import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType; import gov.hhs.fha.nhinc.common.nhinccommonadapter.RetrievePtConsentByPtIdResponseType; import javax.xml.ws.WebServiceContext;
import gov.hhs.fha.nhinc.common.nhinccommon.*; import gov.hhs.fha.nhinc.common.nhinccommonadapter.*; import javax.xml.ws.*;
[ "gov.hhs.fha", "javax.xml" ]
gov.hhs.fha; javax.xml;
2,060,658
BigDecimal bid = bitMarketTicker.getBid(); BigDecimal ask = bitMarketTicker.getAsk(); BigDecimal high = bitMarketTicker.getHigh(); BigDecimal low = bitMarketTicker.getLow(); BigDecimal volume = bitMarketTicker.getVolume(); BigDecimal last = bitMarketTicker.getLast(); return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).build(); }
BigDecimal bid = bitMarketTicker.getBid(); BigDecimal ask = bitMarketTicker.getAsk(); BigDecimal high = bitMarketTicker.getHigh(); BigDecimal low = bitMarketTicker.getLow(); BigDecimal volume = bitMarketTicker.getVolume(); BigDecimal last = bitMarketTicker.getLast(); return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).build(); }
/** * Adapts BitMarket ticker to Ticker. * * @param bitMarketTicker * @param currencyPair * @return */
Adapts BitMarket ticker to Ticker
adaptTicker
{ "repo_name": "coingecko/XChange", "path": "xchange-bitmarket/src/main/java/com/xeiam/xchange/bitmarket/BitMarketAdapters.java", "license": "mit", "size": 2738 }
[ "com.xeiam.xchange.dto.marketdata.Ticker", "java.math.BigDecimal" ]
import com.xeiam.xchange.dto.marketdata.Ticker; import java.math.BigDecimal;
import com.xeiam.xchange.dto.marketdata.*; import java.math.*;
[ "com.xeiam.xchange", "java.math" ]
com.xeiam.xchange; java.math;
2,080,394
ReplicaInfo moveBlockAcrossVolumes(final ExtendedBlock block, FsVolumeSpi destination) throws IOException;
ReplicaInfo moveBlockAcrossVolumes(final ExtendedBlock block, FsVolumeSpi destination) throws IOException;
/** * Moves a given block from one volume to another volume. This is used by disk * balancer. * * @param block - ExtendedBlock * @param destination - Destination volume * @return Old replica info */
Moves a given block from one volume to another volume. This is used by disk balancer
moveBlockAcrossVolumes
{ "repo_name": "WIgor/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java", "license": "apache-2.0", "size": 21835 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.ExtendedBlock", "org.apache.hadoop.hdfs.server.datanode.ReplicaInfo" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.datanode.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,554,233
protected class inputListener implements KeyListener, FocusListener { protected void updateValues() { sd.setStationName(name.getText(), key); name.setText(sd.getStationName(key)); }
class inputListener implements KeyListener, FocusListener { protected void function() { sd.setStationName(name.getText(), key); name.setText(sd.getStationName(key)); }
/** * Update station's name */
Update station's name
updateValues
{ "repo_name": "chpatrick/jmt", "path": "src/jmt/gui/jmodel/panels/StationNamePanel.java", "license": "gpl-2.0", "size": 3326 }
[ "java.awt.event.FocusListener", "java.awt.event.KeyListener" ]
import java.awt.event.FocusListener; import java.awt.event.KeyListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,261,823
@WithBridgeMethods(Set.class) public GHPersonSet<GHUser> getCollaborators() throws IOException { return new GHPersonSet<GHUser>(listCollaborators().toList()); }
@WithBridgeMethods(Set.class) GHPersonSet<GHUser> function() throws IOException { return new GHPersonSet<GHUser>(listCollaborators().toList()); }
/** * Gets the collaborators on this repository. This set always appear to include the owner. * * @return the collaborators * @throws IOException * the io exception */
Gets the collaborators on this repository. This set always appear to include the owner
getCollaborators
{ "repo_name": "kohsuke/github-api", "path": "src/main/java/org/kohsuke/github/GHRepository.java", "license": "mit", "size": 103118 }
[ "com.infradna.tool.bridge_method_injector.WithBridgeMethods", "java.io.IOException", "java.util.Set" ]
import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import java.io.IOException; import java.util.Set;
import com.infradna.tool.bridge_method_injector.*; import java.io.*; import java.util.*;
[ "com.infradna.tool", "java.io", "java.util" ]
com.infradna.tool; java.io; java.util;
2,288,971
public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE; }
XObject function(XObject left, XObject right) throws javax.xml.transform.TransformerException { return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE; }
/** * Apply the operation to two operands, and return the result. * * * @param left non-null reference to the evaluated left operand. * @param right non-null reference to the evaluated right operand. * * @return non-null reference to the XObject that represents the result of the operation. * * @throws javax.xml.transform.TransformerException */
Apply the operation to two operands, and return the result
operate
{ "repo_name": "itgeeker/jdk", "path": "src/com/sun/org/apache/xpath/internal/operations/NotEquals.java", "license": "apache-2.0", "size": 1759 }
[ "com.sun.org.apache.xpath.internal.objects.XBoolean", "com.sun.org.apache.xpath.internal.objects.XObject" ]
import com.sun.org.apache.xpath.internal.objects.XBoolean; import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.objects.*;
[ "com.sun.org" ]
com.sun.org;
150,990
void registerMBean(final String datanodeUuid) { // We wrap to bypass standard mbean naming convetion. // This wraping can be removed in java 6 as it is more flexible in // package naming for mbeans and their impl. try { StandardMBean bean = new StandardMBean(this,FSDatasetMBean.class); mbeanName = MBeans.register("DataNode", "FSDatasetState-" + datanodeUuid, bean); } catch (NotCompliantMBeanException e) { LOG.warn("Error registering FSDatasetState MBean", e); } LOG.info("Registered FSDatasetState MBean"); }
void registerMBean(final String datanodeUuid) { try { StandardMBean bean = new StandardMBean(this,FSDatasetMBean.class); mbeanName = MBeans.register(STR, STR + datanodeUuid, bean); } catch (NotCompliantMBeanException e) { LOG.warn(STR, e); } LOG.info(STR); }
/** * Register the FSDataset MBean using the name * "hadoop:service=DataNode,name=FSDatasetState-<datanodeUuid>" */
Register the FSDataset MBean using the name "hadoop:service=DataNode,name=FSDatasetState-"
registerMBean
{ "repo_name": "lukmajercak/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java", "license": "apache-2.0", "size": 125283 }
[ "javax.management.NotCompliantMBeanException", "javax.management.StandardMBean", "org.apache.hadoop.hdfs.server.datanode.metrics.FSDatasetMBean", "org.apache.hadoop.metrics2.util.MBeans" ]
import javax.management.NotCompliantMBeanException; import javax.management.StandardMBean; import org.apache.hadoop.hdfs.server.datanode.metrics.FSDatasetMBean; import org.apache.hadoop.metrics2.util.MBeans;
import javax.management.*; import org.apache.hadoop.hdfs.server.datanode.metrics.*; import org.apache.hadoop.metrics2.util.*;
[ "javax.management", "org.apache.hadoop" ]
javax.management; org.apache.hadoop;
1,454,669
@Category(JackrabbitOnly.class) // TODO: fails on Oak @Test public void testCanRemoveUser() throws IOException, JSONException { testUserId = H.createTestUser(); //1. verify user can not remove themselves String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".privileges-info.json"; //fetch the JSON for the test page to verify the settings. Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd"); String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json); JSONObject jsonObj = new JSONObject(json); //user can not remove themselves assertEquals(false, jsonObj.getBoolean("canRemove")); //2. now try another user testUserId2 = H.createTestUser(); //fetch the JSON for the test page to verify the settings. Credentials testUser2Creds = new UsernamePasswordCredentials(testUserId2, "testPwd"); String json2 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json2); JSONObject jsonObj2 = new JSONObject(json2); //user can not delete other users assertEquals(false, jsonObj2.getBoolean("canRemove")); //3. now add the user to the 'User Admin' group. H.addUserToUserAdminGroup(testUserId2); //fetch the JSON again String json3 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json3); JSONObject jsonObj3 = new JSONObject(json3); //user in 'User Admin' group can remove other users assertEquals(true, jsonObj3.getBoolean("canRemove")); }
@Category(JackrabbitOnly.class) @Test void function() throws IOException, JSONException { testUserId = H.createTestUser(); String getUrl = HttpTest.HTTP_BASE_URL + STR + testUserId + STR; Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, STR); String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json); JSONObject jsonObj = new JSONObject(json); assertEquals(false, jsonObj.getBoolean(STR)); testUserId2 = H.createTestUser(); Credentials testUser2Creds = new UsernamePasswordCredentials(testUserId2, STR); String json2 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json2); JSONObject jsonObj2 = new JSONObject(json2); assertEquals(false, jsonObj2.getBoolean(STR)); H.addUserToUserAdminGroup(testUserId2); String json3 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK); assertNotNull(json3); JSONObject jsonObj3 = new JSONObject(json3); assertEquals(true, jsonObj3.getBoolean(STR)); }
/** * Checks whether the current user has been granted privileges * to remove the specified user. */
Checks whether the current user has been granted privileges to remove the specified user
testCanRemoveUser
{ "repo_name": "dulvac/sling", "path": "launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/UserPrivilegesInfoTest.java", "license": "apache-2.0", "size": 15262 }
[ "java.io.IOException", "javax.servlet.http.HttpServletResponse", "org.apache.commons.httpclient.Credentials", "org.apache.commons.httpclient.UsernamePasswordCredentials", "org.apache.sling.commons.json.JSONException", "org.apache.sling.commons.json.JSONObject", "org.apache.sling.commons.testing.integration.HttpTest", "org.apache.sling.commons.testing.junit.categories.JackrabbitOnly", "org.junit.Assert", "org.junit.Test", "org.junit.experimental.categories.Category" ]
import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.sling.commons.json.JSONException; import org.apache.sling.commons.json.JSONObject; import org.apache.sling.commons.testing.integration.HttpTest; import org.apache.sling.commons.testing.junit.categories.JackrabbitOnly; import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category;
import java.io.*; import javax.servlet.http.*; import org.apache.commons.httpclient.*; import org.apache.sling.commons.json.*; import org.apache.sling.commons.testing.integration.*; import org.apache.sling.commons.testing.junit.categories.*; import org.junit.*; import org.junit.experimental.categories.*;
[ "java.io", "javax.servlet", "org.apache.commons", "org.apache.sling", "org.junit", "org.junit.experimental" ]
java.io; javax.servlet; org.apache.commons; org.apache.sling; org.junit; org.junit.experimental;
1,658,354
public void flushEvents() { final ExecutorService oldMonitorProcessingExecutor = _monitorProcessingExecutor; _monitorProcessingExecutor = Executors.newSingleThreadExecutor(); oldMonitorProcessingExecutor.shutdown(); while (!oldMonitorProcessingExecutor.isTerminated()) { try { oldMonitorProcessingExecutor.awaitTermination(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // ignore } } }
void function() { final ExecutorService oldMonitorProcessingExecutor = _monitorProcessingExecutor; _monitorProcessingExecutor = Executors.newSingleThreadExecutor(); oldMonitorProcessingExecutor.shutdown(); while (!oldMonitorProcessingExecutor.isTerminated()) { try { oldMonitorProcessingExecutor.awaitTermination(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { } } }
/** * Replaces the {@link java.util.concurrent.Executor executor} that is processing * {@link Monitor monitors}, then shuts down the old monitor and waits up to 100ms for it to * finish shutting down. */
Replaces the <code>java.util.concurrent.Executor executor</code> that is processing <code>Monitor monitors</code>, then shuts down the old monitor and waits up to 100ms for it to finish shutting down
flushEvents
{ "repo_name": "erma/erma", "path": "erma-lib/src/java/com/orbitz/monitoring/lib/processor/AsyncMonitorProcessor.java", "license": "apache-2.0", "size": 4434 }
[ "java.util.concurrent.ExecutorService", "java.util.concurrent.Executors", "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
718,070
public void printHit(Writer w, SRHit hit) throws IOException { SRHsp hsp; int nhsp, k; printHitHeader(w, hit); nhsp = hit.countHsp(); w.write(CR_CHAR); for (k = 0; k < nhsp; k++) { hsp = hit.getHsp(k); printHsp(w, hsp); } }
void function(Writer w, SRHit hit) throws IOException { SRHsp hsp; int nhsp, k; printHitHeader(w, hit); nhsp = hit.countHsp(); w.write(CR_CHAR); for (k = 0; k < nhsp; k++) { hsp = hit.getHsp(k); printHsp(w, hsp); } }
/** * Print the content of a SRHit. Print the hit header and all the SRHsps * contained in the hit. */
Print the content of a SRHit. Print the hit header and all the SRHsps contained in the hit
printHit
{ "repo_name": "pgdurand/Bioinformatics-Core-API", "path": "src/bzh/plealog/bioinfo/io/searchresult/txt/TxtExportSROutput.java", "license": "agpl-3.0", "size": 48085 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,035,019
private static void createAndShowGUI() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look // and feel. } // Create and set up the window. JFrame frame = new JFrame("Trend App Controller"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TrendAppController controller = new TrendAppController(); controller.init(); frame.getContentPane().add(controller.getView(), BorderLayout.CENTER); // Display the window. UiUtil.centerAndShow(frame); }
static void function() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (STR.equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } JFrame frame = new JFrame(STR); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TrendAppController controller = new TrendAppController(); controller.init(); frame.getContentPane().add(controller.getView(), BorderLayout.CENTER); UiUtil.centerAndShow(frame); }
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. */
Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread
createAndShowGUI
{ "repo_name": "hiepst/TrendingDemo", "path": "TrendDemo/src/cs/trend/client/TrendAppController.java", "license": "lgpl-3.0", "size": 5794 }
[ "java.awt.BorderLayout", "javax.swing.JFrame", "javax.swing.UIManager" ]
import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.UIManager;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,778,391
@Override public AnnotationDataLink rename(Name name) { return new AnnotationDataLink(name, null); } // ------------------------------------------------------------------------- // Row4 type methods // -------------------------------------------------------------------------
AnnotationDataLink function(Name name) { return new AnnotationDataLink(name, null); }
/** * Rename this table */
Rename this table
rename
{ "repo_name": "gchq/stroom", "path": "stroom-annotation/stroom-annotation-impl-db-jooq/src/main/java/stroom/annotation/impl/db/jooq/tables/AnnotationDataLink.java", "license": "apache-2.0", "size": 5635 }
[ "org.jooq.Name" ]
import org.jooq.Name;
import org.jooq.*;
[ "org.jooq" ]
org.jooq;
166,341
EAttribute getTimeRestriction_Deadline();
EAttribute getTimeRestriction_Deadline();
/** * Returns the meta object for the attribute '{@link br.ufpe.ines.decode.decode.taskDescription.TimeRestriction#getDeadline <em>Deadline</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Deadline</em>'. * @see br.ufpe.ines.decode.decode.taskDescription.TimeRestriction#getDeadline() * @see #getTimeRestriction() * @generated */
Returns the meta object for the attribute '<code>br.ufpe.ines.decode.decode.taskDescription.TimeRestriction#getDeadline Deadline</code>'.
getTimeRestriction_Deadline
{ "repo_name": "netuh/DecodePlatformPlugin", "path": "br.ufpe.ines.decode/bundles/br.ufpe.ines.decode.model/src/br/ufpe/ines/decode/decode/taskDescription/TaskDescriptionPackage.java", "license": "gpl-3.0", "size": 58869 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,423,429
@Override public void updateUI(ManagerAdapter manager, TestSession session) { final CndTestCase testCase = currentTestCase(session); final String caseName = getMatchGroup(GROUP_CASE); final String suiteName = getMatchGroup(GROUP_SUITE); if (isSameTestCase(testCase, caseName, suiteName)) { final String location = suiteName + ":" + caseName; testCase.setLocation(location); updateTime(testCase); updateResult(testCase); } else { throw new IllegalStateException("No test found for: " + suiteName + ":" + caseName); } }
void function(ManagerAdapter manager, TestSession session) { final CndTestCase testCase = currentTestCase(session); final String caseName = getMatchGroup(GROUP_CASE); final String suiteName = getMatchGroup(GROUP_SUITE); if (isSameTestCase(testCase, caseName, suiteName)) { final String location = suiteName + ":" + caseName; testCase.setLocation(location); updateTime(testCase); updateResult(testCase); } else { throw new IllegalStateException(STR + suiteName + ":" + caseName); } }
/** * Updates the UI. * * @param manager Manager Adapter * @param session Test session */
Updates the UI
updateUI
{ "repo_name": "offa/NBCndUnit", "path": "src/main/java/bv/offa/netbeans/cnd/unittest/googletest/GoogleTestTestFinishedHandler.java", "license": "gpl-3.0", "size": 3252 }
[ "org.netbeans.modules.gsf.testrunner.api.TestSession" ]
import org.netbeans.modules.gsf.testrunner.api.TestSession;
import org.netbeans.modules.gsf.testrunner.api.*;
[ "org.netbeans.modules" ]
org.netbeans.modules;
1,381,319
@Input @Optional public List<String> getTags() { return this.tags.getOrNull(); }
List<String> function() { return this.tags.getOrNull(); }
/** * Returns the tags that will be created for the built image. * @return the tags */
Returns the tags that will be created for the built image
getTags
{ "repo_name": "aahlenst/spring-boot", "path": "spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootBuildImage.java", "license": "apache-2.0", "size": 17874 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,593,208
private String encodeURL(String data) { try { // TODO URLEncoder method is not RFC2396 compatible, known // difference // is Space character gets converted to "+" rather than "%20" // Is there anything else which is not correct with URLEncoder? // Couldn't find a RFC2396 encoder data = URLEncoder.encode(data, "UTF-8"); } catch (UnsupportedEncodingException e) { // This shouldn't happen ignore it! } // workaround for the above descripted problem return data.replaceAll("\\+", "%20"); }
String function(String data) { try { data = URLEncoder.encode(data, "UTF-8"); } catch (UnsupportedEncodingException e) { } return data.replaceAll("\\+", "%20"); }
/** * Encode the given URL to UTF-8 * * @param data * url to encode * @return encoded URL */
Encode the given URL to UTF-8
encodeURL
{ "repo_name": "linagora/james-jspf", "path": "src/main/java/org/apache/james/jspf/macro/MacroExpand.java", "license": "apache-2.0", "size": 20956 }
[ "java.io.UnsupportedEncodingException", "java.net.URLEncoder" ]
import java.io.UnsupportedEncodingException; import java.net.URLEncoder;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,263,002
@SuppressWarnings("unchecked") public static <R> ConfigItem.Meta<R> metaConfigItem(Class<R> cls) { return ConfigItem.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ConfigItem.Meta.INSTANCE); }
@SuppressWarnings(STR) static <R> ConfigItem.Meta<R> function(Class<R> cls) { return ConfigItem.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ConfigItem.Meta.INSTANCE); }
/** * The meta-bean for {@code ConfigItem}. * @param <R> the bean's generic type * @param cls the bean's generic type * @return the meta-bean, not null */
The meta-bean for ConfigItem
metaConfigItem
{ "repo_name": "McLeodMoores/starling", "path": "projects/core/src/main/java/com/opengamma/core/config/impl/ConfigItem.java", "license": "apache-2.0", "size": 17563 }
[ "org.joda.beans.JodaBeanUtils" ]
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
440,095
protected X509Certificate[] getX509CertificateObjectChain(X509Certificate[] certs) throws GeneralSecurityException { X509Certificate[] bcCerts = new X509Certificate[certs.length]; for (int i = 0; i < certs.length; i++) { if (!(certs[i] instanceof X509CertificateObject)) { bcCerts[i] = CertificateLoadUtil.loadCertificate(new ByteArrayInputStream(certs[i].getEncoded())); } else { bcCerts[i] = certs[i]; } } return bcCerts; }
X509Certificate[] function(X509Certificate[] certs) throws GeneralSecurityException { X509Certificate[] bcCerts = new X509Certificate[certs.length]; for (int i = 0; i < certs.length; i++) { if (!(certs[i] instanceof X509CertificateObject)) { bcCerts[i] = CertificateLoadUtil.loadCertificate(new ByteArrayInputStream(certs[i].getEncoded())); } else { bcCerts[i] = certs[i]; } } return bcCerts; }
/** * Returns a chain of X509Certificate's that are instances of X509CertificateObject * This is related to http://bugzilla.globus.org/globus/show_bug.cgi?id=4933 * @param certs input certificate chain * @return a new chain where all X509Certificate's are instances of X509CertificateObject * @throws GeneralSecurityException when failing to get load certificate from encoding */
Returns a chain of X509Certificate's that are instances of X509CertificateObject This is related to HREF
getX509CertificateObjectChain
{ "repo_name": "jrevillard/JGlobus", "path": "ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java", "license": "apache-2.0", "size": 34526 }
[ "java.io.ByteArrayInputStream", "java.security.GeneralSecurityException", "java.security.cert.X509Certificate", "org.bouncycastle.jce.provider.X509CertificateObject", "org.globus.gsi.util.CertificateLoadUtil" ]
import java.io.ByteArrayInputStream; import java.security.GeneralSecurityException; import java.security.cert.X509Certificate; import org.bouncycastle.jce.provider.X509CertificateObject; import org.globus.gsi.util.CertificateLoadUtil;
import java.io.*; import java.security.*; import java.security.cert.*; import org.bouncycastle.jce.provider.*; import org.globus.gsi.util.*;
[ "java.io", "java.security", "org.bouncycastle.jce", "org.globus.gsi" ]
java.io; java.security; org.bouncycastle.jce; org.globus.gsi;
838,889
public void filter(com.actionbarsherlock.view.Menu menu) { List<Integer> toShow = new ArrayList<Integer>(); List<Integer> toHide = new ArrayList<Integer>(); filter(toShow, toHide); com.actionbarsherlock.view.MenuItem item = null; for (int i : toShow) { item = menu.findItem(i); if (item != null) { item.setVisible(true); item.setEnabled(true); } } for (int i : toHide) { item = menu.findItem(i); if (item != null) { item.setVisible(false); item.setEnabled(false); } } }
void function(com.actionbarsherlock.view.Menu menu) { List<Integer> toShow = new ArrayList<Integer>(); List<Integer> toHide = new ArrayList<Integer>(); filter(toShow, toHide); com.actionbarsherlock.view.MenuItem item = null; for (int i : toShow) { item = menu.findItem(i); if (item != null) { item.setVisible(true); item.setEnabled(true); } } for (int i : toHide) { item = menu.findItem(i); if (item != null) { item.setVisible(false); item.setEnabled(false); } } }
/** * Filters out the file actions available in the passed {@link Menu} taken into account * the state of the {@link OCFile} held by the filter. * * Second method needed thanks to ActionBarSherlock. * * TODO Get rid of it when ActionBarSherlock is replaced for newer Android Support Library. * * @param menu Options or context menu to filter. */
Filters out the file actions available in the passed <code>Menu</code> taken into account the state of the <code>OCFile</code> held by the filter. Second method needed thanks to ActionBarSherlock. TODO Get rid of it when ActionBarSherlock is replaced for newer Android Support Library
filter
{ "repo_name": "duke8804/android", "path": "src/com/owncloud/android/files/FileMenuFilter.java", "license": "gpl-2.0", "size": 8809 }
[ "android.view.Menu", "android.view.MenuItem", "java.util.ArrayList", "java.util.List" ]
import android.view.Menu; import android.view.MenuItem; import java.util.ArrayList; import java.util.List;
import android.view.*; import java.util.*;
[ "android.view", "java.util" ]
android.view; java.util;
1,201,364
private static boolean isConnectionSlow(int type, int subType) { if (type == ConnectivityManager.TYPE_WIFI) { return false; } else if (type == ConnectivityManager.TYPE_MOBILE) { switch (subType) { // Speeds of about ~ 50 to 100 kbps case TelephonyManager.NETWORK_TYPE_1xRTT: // 2G // Speeds of about ~ 14 to 64 kbps case TelephonyManager.NETWORK_TYPE_CDMA: // 2G // Speeds of about ~ 50 to 100 kbps case TelephonyManager.NETWORK_TYPE_EDGE: // 2G // Speeds of about ~ 100 kbps case TelephonyManager.NETWORK_TYPE_GPRS: // 2G // Speeds of about ~ 25 kbps case TelephonyManager.NETWORK_TYPE_IDEN: // 2G return true; // Otherwise case TelephonyManager.NETWORK_TYPE_UNKNOWN: default: return false; } } else { return false; } }
static boolean function(int type, int subType) { if (type == ConnectivityManager.TYPE_WIFI) { return false; } else if (type == ConnectivityManager.TYPE_MOBILE) { switch (subType) { case TelephonyManager.NETWORK_TYPE_1xRTT: case TelephonyManager.NETWORK_TYPE_CDMA: case TelephonyManager.NETWORK_TYPE_EDGE: case TelephonyManager.NETWORK_TYPE_GPRS: case TelephonyManager.NETWORK_TYPE_IDEN: return true; case TelephonyManager.NETWORK_TYPE_UNKNOWN: default: return false; } } else { return false; } }
/** * <p>Serves <code>isConnectedConnectionSlow</code> public methods with a way to detect the * current sub type connection of MOBILE type.</p> * * @param type of connection either WIFI or MOBILE. * @param subType of a MOBILE connection type. * @return <code>true</code> if MOBILE data speed of about 14kbps to 100kbps * <code>false</code> otherwise. */
Serves <code>isConnectedConnectionSlow</code> public methods with a way to detect the current sub type connection of MOBILE type
isConnectionSlow
{ "repo_name": "alkathirikhalid/connection", "path": "app/src/main/java/com/alkathirikhalid/connection/network/Connection.java", "license": "apache-2.0", "size": 10594 }
[ "android.net.ConnectivityManager", "android.telephony.TelephonyManager" ]
import android.net.ConnectivityManager; import android.telephony.TelephonyManager;
import android.net.*; import android.telephony.*;
[ "android.net", "android.telephony" ]
android.net; android.telephony;
1,035,303
@Override public void exitConstDecl(@NotNull GolangParser.ConstDeclContext ctx) { }
@Override public void exitConstDecl(@NotNull GolangParser.ConstDeclContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterConstDecl
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/GolangBaseListener.java", "license": "gpl-3.0", "size": 35571 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
726,768
public String getPassword() { return this.password; } /** * Set the default encoding to use for {@link MimeMessage MimeMessages}
String function() { return this.password; } /** * Set the default encoding to use for {@link MimeMessage MimeMessages}
/** * Return the password for the account at the mail host. */
Return the password for the account at the mail host
getPassword
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/mail/javamail/JavaMailSenderImpl.java", "license": "unlicense", "size": 14564 }
[ "javax.mail.internet.MimeMessage" ]
import javax.mail.internet.MimeMessage;
import javax.mail.internet.*;
[ "javax.mail" ]
javax.mail;
2,914,353
public void testBug37458() throws Exception { int ids[] = { 13, 1, 8 }; String vals[] = { "c", "a", "b" }; createTable("testBug37458", "(id int not null auto_increment, val varchar(100), " + "primary key (id), unique (val))"); stmt.executeUpdate("insert into testBug37458 values (1, 'a'), (8, 'b'), (13, 'c')"); pstmt = conn.prepareStatement( "insert into testBug37458 (val) values (?) " + "on duplicate key update id = last_insert_id(id)", PreparedStatement.RETURN_GENERATED_KEYS); for (int i = 0; i < ids.length; ++i) { pstmt.setString(1, vals[i]); pstmt.addBatch(); } pstmt.executeBatch(); ResultSet keys = pstmt.getGeneratedKeys(); for (int i = 0; i < ids.length; ++i) { assertTrue(keys.next()); assertEquals(ids[i], keys.getInt(1)); } }
void function() throws Exception { int ids[] = { 13, 1, 8 }; String vals[] = { "c", "a", "b" }; createTable(STR, STR + STR); stmt.executeUpdate(STR); pstmt = conn.prepareStatement( STR + STR, PreparedStatement.RETURN_GENERATED_KEYS); for (int i = 0; i < ids.length; ++i) { pstmt.setString(1, vals[i]); pstmt.addBatch(); } pstmt.executeBatch(); ResultSet keys = pstmt.getGeneratedKeys(); for (int i = 0; i < ids.length; ++i) { assertTrue(keys.next()); assertEquals(ids[i], keys.getInt(1)); } }
/** * Bug #37458 - MySQL 5.1 returns generated keys in ascending order */
Bug #37458 - MySQL 5.1 returns generated keys in ascending order
testBug37458
{ "repo_name": "shubhanshu-gupta/Apache-Solr", "path": "example/solr/collection1/lib/mysql-connector-java-5.1.32/src/testsuite/regression/StatementRegressionTest.java", "license": "apache-2.0", "size": 245487 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet" ]
import java.sql.PreparedStatement; import java.sql.ResultSet;
import java.sql.*;
[ "java.sql" ]
java.sql;
214,338
private List<AppsData> _getUserApps(String token) throws IOException,NullPointerException{ List<AppsData> listApps = new ArrayList<AppsData>(); _log.info("calling restclient"); //call rest client and retrieve json array JsonArray jsonArray = getRestClient().callUserApps(token); for (JsonElement jsonEle : jsonArray) { AppsData apps = new AppsData(); String name = ""; String description = ""; String behaviour = ""; String imageUrl = ""; String adminUrl = ""; if (jsonEle.getAsJsonObject().has("name")) { name = jsonEle.getAsJsonObject().get("name").toString().replaceAll(StringPool.QUOTE, StringPool.BLANK); } if (jsonEle.getAsJsonObject().has("description")) { description = jsonEle.getAsJsonObject().get("description").toString().replaceAll(StringPool.QUOTE, StringPool.BLANK); } if (jsonEle.getAsJsonObject().has("behavior")) { behaviour = jsonEle.getAsJsonObject().get("behavior").toString().replaceAll(StringPool.QUOTE, StringPool.BLANK); } if (jsonEle.getAsJsonObject().has("image_url")) { imageUrl = jsonEle.getAsJsonObject().get("image_url").toString().replaceAll(StringPool.QUOTE, StringPool.BLANK); } //String applicationUrl = jsonEle.getAsJsonObject().get("application_url").toString(); if (jsonEle.getAsJsonObject().has("administration_url")) { adminUrl = jsonEle.getAsJsonObject().get("administration_url").toString(); } // Map Name,Description,Image url and app Url to bean if(!adminUrl.equalsIgnoreCase(StringPool.DOUBLE_QUOTE)){ adminUrl = adminUrl.replaceAll(StringPool.QUOTE, StringPool.BLANK); _log.info("name---" + name); _log.info("description---"+description); _log.info("behaviour---"+behaviour); _log.info("image url---"+imageUrl); _log.info("admin url---"+adminUrl); apps.setName(name); apps.setDescription(description); apps.setBehaviour(behaviour); apps.setImage_url(imageUrl); apps.setApplication_url(adminUrl); apps.setAdmin_url(adminUrl); // add apps data bean to list listApps.add(apps); } } return listApps; } private static Log _log = LogFactoryUtil.getLog(AppsUtil.class); private static AppsUtil instance;
List<AppsData> function(String token) throws IOException,NullPointerException{ List<AppsData> listApps = new ArrayList<AppsData>(); _log.info(STR); JsonArray jsonArray = getRestClient().callUserApps(token); for (JsonElement jsonEle : jsonArray) { AppsData apps = new AppsData(); String name = STRSTRSTRSTRSTRnameSTRnameSTRdescriptionSTRdescriptionSTRbehaviorSTRbehaviorSTRimage_urlSTRimage_urlSTRadministration_urlSTRadministration_urlSTRname---STRdescription---STRbehaviour---STRimage url---STRadmin url---"+adminUrl); apps.setName(name); apps.setDescription(description); apps.setBehaviour(behaviour); apps.setImage_url(imageUrl); apps.setApplication_url(adminUrl); apps.setAdmin_url(adminUrl); listApps.add(apps); } } return listApps; } private static Log _log = LogFactoryUtil.getLog(AppsUtil.class); private static AppsUtil instance;
/** *<b> This method maps list of Apps to UserData Bean.</b> * * @author Manoj Mali * @param token - OAuth Token retrieved from liferay session * @return List of AppsData * @throws IOException */
This method maps list of Apps to UserData Bean
_getUserApps
{ "repo_name": "inbloom/datastore-portal", "path": "portlets/ConfigureApp-portlet/docroot/WEB-INF/src/org/slc/sli/util/AppsUtil.java", "license": "apache-2.0", "size": 4416 }
[ "com.google.gson.JsonArray", "com.google.gson.JsonElement", "com.liferay.portal.kernel.log.Log", "com.liferay.portal.kernel.log.LogFactoryUtil", "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.slc.sli.json.bean.AppsData" ]
import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.slc.sli.json.bean.AppsData;
import com.google.gson.*; import com.liferay.portal.kernel.log.*; import java.io.*; import java.util.*; import org.slc.sli.json.bean.*;
[ "com.google.gson", "com.liferay.portal", "java.io", "java.util", "org.slc.sli" ]
com.google.gson; com.liferay.portal; java.io; java.util; org.slc.sli;
1,727,815
List<Usage> generateTopologiesInfo(Topology[] topologies);
List<Usage> generateTopologiesInfo(Topology[] topologies);
/** * Generate resources (application or template) related to a topology list * * @param topologies * @return */
Generate resources (application or template) related to a topology list
generateTopologiesInfo
{ "repo_name": "broly-git/alien4cloud", "path": "alien4cloud-core/src/main/java/org/alien4cloud/tosca/catalog/index/ICsarService.java", "license": "apache-2.0", "size": 5145 }
[ "java.util.List", "org.alien4cloud.tosca.model.templates.Topology" ]
import java.util.List; import org.alien4cloud.tosca.model.templates.Topology;
import java.util.*; import org.alien4cloud.tosca.model.templates.*;
[ "java.util", "org.alien4cloud.tosca" ]
java.util; org.alien4cloud.tosca;
1,808,507
boolean setEnrolmentStatus(DeviceIdentifier deviceId, String currentOwner, Status status, int tenantId) throws DeviceManagementDAOException;
boolean setEnrolmentStatus(DeviceIdentifier deviceId, String currentOwner, Status status, int tenantId) throws DeviceManagementDAOException;
/** * This method is used to set the current enrollment status of given device and user. * * @param deviceId device id. * @param currentOwner current user name. * @param status device status. * @param tenantId tenant id. * @return returns true if success. * @throws DeviceManagementDAOException */
This method is used to set the current enrollment status of given device and user
setEnrolmentStatus
{ "repo_name": "prithvi66/carbon-device-mgt", "path": "components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java", "license": "apache-2.0", "size": 16585 }
[ "org.wso2.carbon.device.mgt.common.DeviceIdentifier", "org.wso2.carbon.device.mgt.common.EnrolmentInfo" ]
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,783,540
@Auditable(parameters = {"parentNodeRef", "name", "typeQName"}) public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException;
@Auditable(parameters = {STR, "name", STR}) FileInfo function(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException;
/** * Create a file or folder; or any valid node of type derived from file or folder. * <p> * The association QName for the patch defaults to <b>cm:filename</b> i.e. the * <b>Content Model</b> namespace with the filename as the local name. * * @param parentNodeRef the parent node. The parent must be a valid * {@link org.alfresco.model.ContentModel#TYPE_FOLDER folder}. * @param name the name of the node * @param typeQName the type to create * @return Returns the new node's file information * @throws FileExistsException * */
Create a file or folder; or any valid node of type derived from file or folder. The association QName for the patch defaults to cm:filename i.e. the Content Model namespace with the filename as the local name
create
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/service/cmr/model/FileFolderService.java", "license": "lgpl-3.0", "size": 22822 }
[ "org.alfresco.service.Auditable", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.service.namespace.QName" ]
import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName;
import org.alfresco.service.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.namespace.*;
[ "org.alfresco.service" ]
org.alfresco.service;
2,534,287
public ChatThreadClientBuilder chatThreadId(String chatThreadId) { this.chatThreadId = Objects.requireNonNull(chatThreadId, "'chatThreadId' cannot be null."); return this; } /** * Create synchronous chat thread client applying CommunicationTokenCredential, UserAgentPolicy, * RetryPolicy, and CookiePolicy. * Additional HttpPolicies specified by additionalPolicies will be applied after them * * @return ChatThreadClient instance * @throws IllegalStateException If both {@link #retryOptions(RetryOptions)}
ChatThreadClientBuilder function(String chatThreadId) { this.chatThreadId = Objects.requireNonNull(chatThreadId, STR); return this; } /** * Create synchronous chat thread client applying CommunicationTokenCredential, UserAgentPolicy, * RetryPolicy, and CookiePolicy. * Additional HttpPolicies specified by additionalPolicies will be applied after them * * @return ChatThreadClient instance * @throws IllegalStateException If both {@link #retryOptions(RetryOptions)}
/** * Sets the ChatThreadId used to construct a client for this chat thread. * * @param chatThreadId The id of the chat thread. * @return the updated ChatThreadClientBuilder object */
Sets the ChatThreadId used to construct a client for this chat thread
chatThreadId
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/ChatThreadClientBuilder.java", "license": "mit", "size": 17663 }
[ "com.azure.communication.common.CommunicationTokenCredential", "com.azure.core.http.policy.CookiePolicy", "com.azure.core.http.policy.RetryOptions", "com.azure.core.http.policy.RetryPolicy", "com.azure.core.http.policy.UserAgentPolicy", "java.util.Objects" ]
import com.azure.communication.common.CommunicationTokenCredential; import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import java.util.Objects;
import com.azure.communication.common.*; import com.azure.core.http.policy.*; import java.util.*;
[ "com.azure.communication", "com.azure.core", "java.util" ]
com.azure.communication; com.azure.core; java.util;
1,385,539
void configure(Configuration_V1 config, DPUContext ctx) { this.config = config; this.dpuContext = ctx; }
void configure(Configuration_V1 config, DPUContext ctx) { this.config = config; this.dpuContext = ctx; }
/** * Set configuration for test purpose. * * @param config */
Set configuration for test purpose
configure
{ "repo_name": "UnifiedViews/Plugin-DevEnv", "path": "uv-dpu-helpers/src/main/java/eu/unifiedviews/helpers/dpu/extension/faulttolerance/FaultTolerance.java", "license": "lgpl-3.0", "size": 14006 }
[ "eu.unifiedviews.dpu.DPUContext" ]
import eu.unifiedviews.dpu.DPUContext;
import eu.unifiedviews.dpu.*;
[ "eu.unifiedviews.dpu" ]
eu.unifiedviews.dpu;
2,378,667
public SolrQuery setMoreLikeThisMinDocFreq(int mindf) { this.set(MoreLikeThisParams.MIN_DOC_FREQ, mindf); return this; }
SolrQuery function(int mindf) { this.set(MoreLikeThisParams.MIN_DOC_FREQ, mindf); return this; }
/** * Sets the frequency at which words will be ignored which do not occur in at least this many * docs. * * @param mindf the minimum document frequency * @return this */
Sets the frequency at which words will be ignored which do not occur in at least this many docs
setMoreLikeThisMinDocFreq
{ "repo_name": "apache/solr", "path": "solr/solrj/src/java/org/apache/solr/client/solrj/SolrQuery.java", "license": "apache-2.0", "size": 38572 }
[ "org.apache.solr.common.params.MoreLikeThisParams" ]
import org.apache.solr.common.params.MoreLikeThisParams;
import org.apache.solr.common.params.*;
[ "org.apache.solr" ]
org.apache.solr;
1,552,985
private static boolean checkPackageProperty(final String property, final String pkg) { String list = AccessController.doPrivileged(PriviAction .getSecurityProperty(property)); if (list != null) { int plen = pkg.length(); String[] tokens = list.split(", *"); //$NON-NLS-1$ for (String token : tokens) { int tlen = token.length(); if (plen > tlen && pkg.startsWith(token) && (token.charAt(tlen - 1) == '.' || pkg.charAt(tlen) == '.')) { return true; } else if (plen == tlen && token.startsWith(pkg)) { return true; } else if (plen + 1 == tlen && token.startsWith(pkg) && token.charAt(tlen - 1) == '.') { return true; } } } return false; }
static boolean function(final String property, final String pkg) { String list = AccessController.doPrivileged(PriviAction .getSecurityProperty(property)); if (list != null) { int plen = pkg.length(); String[] tokens = list.split(STR); for (String token : tokens) { int tlen = token.length(); if (plen > tlen && pkg.startsWith(token) && (token.charAt(tlen - 1) == '.' pkg.charAt(tlen) == '.')) { return true; } else if (plen == tlen && token.startsWith(pkg)) { return true; } else if (plen + 1 == tlen && token.startsWith(pkg) && token.charAt(tlen - 1) == '.') { return true; } } } return false; }
/** * Returns true if the package name is restricted by the specified security * property. */
Returns true if the package name is restricted by the specified security property
checkPackageProperty
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/src/xmlvm2c/lib/proxies/java/lang/SecurityManager.java", "license": "gpl-2.0", "size": 32450 }
[ "java.security.AccessController", "org.apache.harmony.luni.util.PriviAction" ]
import java.security.AccessController; import org.apache.harmony.luni.util.PriviAction;
import java.security.*; import org.apache.harmony.luni.util.*;
[ "java.security", "org.apache.harmony" ]
java.security; org.apache.harmony;
1,997,544
protected Point doMousePressOnDiskRequestClass() { return doMousePressOrReleaseOnDiskRequestClass(true); }
Point function() { return doMousePressOrReleaseOnDiskRequestClass(true); }
/** * Simluates a mouse press on the "Disk Request" class. */
Simluates a mouse press on the "Disk Request" class
doMousePressOnDiskRequestClass
{ "repo_name": "HebaKhaled/bposs", "path": "src/com.mentor.nucleus.bp.ui.canvas.test/src/com/mentor/nucleus/bp/ui/canvas/test/StatechartTest.java", "license": "apache-2.0", "size": 8612 }
[ "org.eclipse.swt.graphics.Point" ]
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,374,882
Collection<Pattern> getPckStatusMessagePatterns();
Collection<Pattern> getPckStatusMessagePatterns();
/** * Gets the Patterns, the sub handler is capable to process. * * @return the Patterns */
Gets the Patterns, the sub handler is capable to process
getPckStatusMessagePatterns
{ "repo_name": "openhab/openhab2", "path": "bundles/org.openhab.binding.lcn/src/main/java/org/openhab/binding/lcn/internal/subhandler/ILcnModuleSubHandler.java", "license": "epl-1.0", "size": 5731 }
[ "java.util.Collection", "java.util.regex.Pattern" ]
import java.util.Collection; import java.util.regex.Pattern;
import java.util.*; import java.util.regex.*;
[ "java.util" ]
java.util;
1,913,687
@JsonSerialize(include = Inclusion.NON_NULL) public int getDuration() { return duration; }
@JsonSerialize(include = Inclusion.NON_NULL) int function() { return duration; }
/** * Retrieves the duration of the media, e.g. the length of a video. * * @return the duration */
Retrieves the duration of the media, e.g. the length of a video
getDuration
{ "repo_name": "RobertWalsh/apigee-android-sdk", "path": "source/src/main/java/com/apigee/sdk/data/client/entities/Activity.java", "license": "apache-2.0", "size": 29588 }
[ "com.fasterxml.jackson.databind.annotation.JsonSerialize" ]
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,217,395
private void updateGamification(Segment matchedSegment, boolean incrementScore) { Log.d(TAG, "ScoreManager#updateGamification. incrementScore: " + incrementScore); int coverage = matchedSegment == null ? UNKNOWN_VALUE : matchedSegment.getPolyline().coverage; if (matchedSegment != null) { Log.d(TAG, "updateGamification: seqId = " + sequenceId + " matched segment " + matchedSegment.getPolyline().getIdentifier() + " coverage" + " " + coverage + " obd : " + isObdConnected); } if (coverage == UNKNOWN_VALUE) { coverage = MAX_COVERAGE_VALUE; } if (sequenceId == null) { return; } updateScore(coverage, incrementScore); }
void function(Segment matchedSegment, boolean incrementScore) { Log.d(TAG, STR + incrementScore); int coverage = matchedSegment == null ? UNKNOWN_VALUE : matchedSegment.getPolyline().coverage; if (matchedSegment != null) { Log.d(TAG, STR + sequenceId + STR + matchedSegment.getPolyline().getIdentifier() + STR + " " + coverage + STR + isObdConnected); } if (coverage == UNKNOWN_VALUE) { coverage = MAX_COVERAGE_VALUE; } if (sequenceId == null) { return; } updateScore(coverage, incrementScore); }
/** * Updates the score for the new segment. * @param matchedSegment the current segment. * @param incrementScore {@code true} if the score should be incremented, {@code false} otherwise. * The score shouldn't be incremented a picture wasn't taken. */
Updates the score for the new segment
updateGamification
{ "repo_name": "openstreetview/android", "path": "app/src/main/java/com/telenav/osv/recorder/score/ScoreManager.java", "license": "lgpl-3.0", "size": 10789 }
[ "com.telenav.osv.item.Segment", "com.telenav.osv.utils.Log" ]
import com.telenav.osv.item.Segment; import com.telenav.osv.utils.Log;
import com.telenav.osv.item.*; import com.telenav.osv.utils.*;
[ "com.telenav.osv" ]
com.telenav.osv;
2,740,652
public void setUnmodifiedSinceConstraint(Date date) { this.unmodifiedSinceConstraint = date; }
void function(Date date) { this.unmodifiedSinceConstraint = date; }
/** * Sets the optional unmodified constraint that restricts this request * to executing only if the object has <b>not</b> been modified after * the specified date. * <p> * Note that Amazon S3 will ignore any dates occurring in the future. * * @param date * The unmodified constraint that restricts this request to * executing only if the object has <b>not</b> been * modified after this date. * * @see GetObjectRequest#getUnmodifiedSinceConstraint() * @see GetObjectRequest#withUnmodifiedSinceConstraint(Date) */
Sets the optional unmodified constraint that restricts this request to executing only if the object has not been modified after the specified date. Note that Amazon S3 will ignore any dates occurring in the future
setUnmodifiedSinceConstraint
{ "repo_name": "amahule/aws-sdk-for-android", "path": "src/com/amazonaws/services/s3/model/GetObjectRequest.java", "license": "apache-2.0", "size": 23830 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,417,414
protected AccessLogElement[] createLogElements() { List<AccessLogElement> list = new ArrayList<AccessLogElement>(); boolean replace = false; StringBuilder buf = new StringBuilder(); for (int i = 0; i < pattern.length(); i++) { char ch = pattern.charAt(i); if (replace) { if ('{' == ch) { StringBuilder name = new StringBuilder(); int j = i + 1; for (; j < pattern.length() && '}' != pattern.charAt(j); j++) { name.append(pattern.charAt(j)); } if (j + 1 < pattern.length()) { j++; list.add(createAccessLogElement(name.toString(), pattern.charAt(j))); i = j; } else { // D'oh - end of string - pretend we never did this // and do processing the "old way" list.add(createAccessLogElement(ch)); } } else { list.add(createAccessLogElement(ch)); } replace = false; } else if (ch == '%') { replace = true; list.add(new StringElement(buf.toString())); buf = new StringBuilder(); } else { buf.append(ch); } } if (buf.length() > 0) { list.add(new StringElement(buf.toString())); } return list.toArray(new AccessLogElement[0]); }
AccessLogElement[] function() { List<AccessLogElement> list = new ArrayList<AccessLogElement>(); boolean replace = false; StringBuilder buf = new StringBuilder(); for (int i = 0; i < pattern.length(); i++) { char ch = pattern.charAt(i); if (replace) { if ('{' == ch) { StringBuilder name = new StringBuilder(); int j = i + 1; for (; j < pattern.length() && '}' != pattern.charAt(j); j++) { name.append(pattern.charAt(j)); } if (j + 1 < pattern.length()) { j++; list.add(createAccessLogElement(name.toString(), pattern.charAt(j))); i = j; } else { list.add(createAccessLogElement(ch)); } } else { list.add(createAccessLogElement(ch)); } replace = false; } else if (ch == '%') { replace = true; list.add(new StringElement(buf.toString())); buf = new StringBuilder(); } else { buf.append(ch); } } if (buf.length() > 0) { list.add(new StringElement(buf.toString())); } return list.toArray(new AccessLogElement[0]); }
/** * parse pattern string and create the array of AccessLogElement */
parse pattern string and create the array of AccessLogElement
createLogElements
{ "repo_name": "plumer/codana", "path": "tomcat_files/7.0.61/AccessLogValve.java", "license": "mit", "size": 66968 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
834,857
@WebMethod(operationName = "CreateTrack", action = "http://www.onvif.org/ver10/recording/wsdl/CreateTrack") @RequestWrapper(localName = "CreateTrack", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl", className = "org.onvif.ver10.recording.wsdl.CreateTrack") @ResponseWrapper(localName = "CreateTrackResponse", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl", className = "org.onvif.ver10.recording.wsdl.CreateTrackResponse") @WebResult(name = "TrackToken", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl") public java.lang.String createTrack( @WebParam(name = "RecordingToken", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl") java.lang.String recordingToken, @WebParam(name = "TrackConfiguration", targetNamespace = "http://www.onvif.org/ver10/recording/wsdl") org.onvif.ver10.schema.TrackConfiguration trackConfiguration );
@WebMethod(operationName = STR, action = "http: @RequestWrapper(localName = STR, targetNamespace = "http: @ResponseWrapper(localName = "CreateTrackResponseSTRhttp: @WebResult(name = "TrackTokenSTRhttp: java.lang.String function( @WebParam(name = "RecordingTokenSTRhttp: java.lang.String recordingToken, @WebParam(name = "TrackConfigurationSTRhttp: org.onvif.ver10.schema.TrackConfiguration trackConfiguration );
/** * This method shall create a new track within a recording. * * This method is optional. It shall be available if the Recording/DynamicTracks capability is * TRUE. * * A TrackToken in itself does not uniquely identify a specific track. Tracks within different * recordings may have the same TrackToken. * */
This method shall create a new track within a recording. This method is optional. It shall be available if the Recording/DynamicTracks capability is TRUE. A TrackToken in itself does not uniquely identify a specific track. Tracks within different recordings may have the same TrackToken
createTrack
{ "repo_name": "fpompermaier/onvif", "path": "onvif-ws-client/src/main/java/org/onvif/ver10/recording/wsdl/RecordingPort.java", "license": "apache-2.0", "size": 24757 }
[ "javax.jws.WebMethod", "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.RequestWrapper", "javax.xml.ws.ResponseWrapper" ]
import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper;
import javax.jws.*; import javax.xml.ws.*;
[ "javax.jws", "javax.xml" ]
javax.jws; javax.xml;
2,744,303
public static final PluginResourceNotFoundException pluginResourceNotFoundException(String resourceName, PluginCoordinates coordinates) { return new PluginResourceNotFoundException(Messages.i18n.format( "PluginResourceNotFound", resourceName, coordinates.toString())); //$NON-NLS-1$ }
static final PluginResourceNotFoundException function(String resourceName, PluginCoordinates coordinates) { return new PluginResourceNotFoundException(Messages.i18n.format( STR, resourceName, coordinates.toString())); }
/** * Creates an exception. * @param resourceName the resource name * @param coordinates the maven coordinates * @return the exception */
Creates an exception
pluginResourceNotFoundException
{ "repo_name": "KevinHorvatin/apiman", "path": "manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java", "license": "apache-2.0", "size": 17897 }
[ "io.apiman.common.plugin.PluginCoordinates", "io.apiman.manager.api.rest.contract.exceptions.PluginResourceNotFoundException", "io.apiman.manager.api.rest.impl.i18n.Messages" ]
import io.apiman.common.plugin.PluginCoordinates; import io.apiman.manager.api.rest.contract.exceptions.PluginResourceNotFoundException; import io.apiman.manager.api.rest.impl.i18n.Messages;
import io.apiman.common.plugin.*; import io.apiman.manager.api.rest.contract.exceptions.*; import io.apiman.manager.api.rest.impl.i18n.*;
[ "io.apiman.common", "io.apiman.manager" ]
io.apiman.common; io.apiman.manager;
1,071,755
Set<Action> actions(Object s);
Set<Action> actions(Object s);
/** * Given a particular state s, returns the set of actions that can be * executed in s. * * @param s * a particular state. * @return the set of actions that can be executed in s. */
Given a particular state s, returns the set of actions that can be executed in s
actions
{ "repo_name": "eckucukoglu/river-crossing-puzzle-solver", "path": "solver/ActionsFunction.java", "license": "gpl-2.0", "size": 587 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,401,815
private Format getFormat(final String desc) { if (registry != null) { String name = desc; String args = null; final int i = desc.indexOf(START_FMT); if (i > 0) { name = desc.substring(0, i).trim(); args = desc.substring(i + 1).trim(); } final FormatFactory factory = registry.get(name); if (factory != null) { return factory.getFormat(name, args, getLocale()); } } return null; }
Format function(final String desc) { if (registry != null) { String name = desc; String args = null; final int i = desc.indexOf(START_FMT); if (i > 0) { name = desc.substring(0, i).trim(); args = desc.substring(i + 1).trim(); } final FormatFactory factory = registry.get(name); if (factory != null) { return factory.getFormat(name, args, getLocale()); } } return null; }
/** * Gets a custom format from a format description. * * @param desc String * @return Format */
Gets a custom format from a format description
getFormat
{ "repo_name": "MarkDacek/commons-lang", "path": "src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java", "license": "apache-2.0", "size": 19294 }
[ "java.text.Format" ]
import java.text.Format;
import java.text.*;
[ "java.text" ]
java.text;
2,013,258
public void beginPost202Retry200(Product product) throws ServiceException { try { Call<ResponseBody> call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); ServiceResponse<Void> response = beginPost202Retry200Delegate(call.execute(), null); response.getBody(); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException(ex); } }
void function(Product product) throws ServiceException { try { Call<ResponseBody> call = service.beginPost202Retry200(product, this.client.getAcceptLanguage()); ServiceResponse<Void> response = beginPost202Retry200Delegate(call.execute(), null); response.getBody(); } catch (ServiceException ex) { throw ex; } catch (Exception ex) { throw new ServiceException(ex); } }
/** * Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success * * @param product Product to put * @throws ServiceException the exception wrapped in ServiceException if failed. */
Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success
beginPost202Retry200
{ "repo_name": "BretJohnson/autorest", "path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysImpl.java", "license": "mit", "size": 34813 }
[ "com.microsoft.rest.ServiceException", "com.microsoft.rest.ServiceResponse", "com.squareup.okhttp.ResponseBody" ]
import com.microsoft.rest.ServiceException; import com.microsoft.rest.ServiceResponse; import com.squareup.okhttp.ResponseBody;
import com.microsoft.rest.*; import com.squareup.okhttp.*;
[ "com.microsoft.rest", "com.squareup.okhttp" ]
com.microsoft.rest; com.squareup.okhttp;
2,752,199
public Dimension getMinimumSize(JComponent c) { Insets i = c.getInsets(); return new Dimension(i.left + i.right, i.top + i.bottom); }
Dimension function(JComponent c) { Insets i = c.getInsets(); return new Dimension(i.left + i.right, i.top + i.bottom); }
/** * Returns the minimum size for text components. This returns the size * of the component's insets. * * @return the minimum size for text components */
Returns the minimum size for text components. This returns the size of the component's insets
getMinimumSize
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java", "license": "bsd-3-clause", "size": 41609 }
[ "java.awt.Dimension", "java.awt.Insets", "javax.swing.JComponent" ]
import java.awt.Dimension; import java.awt.Insets; import javax.swing.JComponent;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
482,297
public void write(Link link) throws IOException { write(link.dos); }
void function(Link link) throws IOException { write(link.dos); }
/** * Write the properties as several strings. There is a string count (Key * count + value count), and then for each key and value string, a character * count, and the characters. * * @param link the link to write to. */
Write the properties as several strings. There is a string count (Key count + value count), and then for each key and value string, a character count, and the characters
write
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/layer/link/LinkProperties.java", "license": "mit", "size": 15581 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,707,944
private boolean isStateName(String tokenVal) { String[] state = (String[]) usStatesHash.get(tokenVal); if (state != null) { boolean expandState = false; // check to see if the state initials are ambiguous // in the English language if (state[1].equals("ambiguous")) { String previous = (String) tokenItem.findFeature("p.name"); String next = (String) tokenItem.findFeature("n.name"); // System.out.println("previous = " + previous); // System.out.println("next = " + next); int nextLength = next.length(); FeatureSet featureSet = tokenItem.getFeatures(); // check if the previous word starts with a capital letter, // is at least 3 letters long, is an alphabet sequence, // and has a comma. boolean previousIsCity = (isUppercaseLetter(previous.charAt(0)) && previous.length() > 2 && matches(alphabetPattern, previous) && tokenItem.findFeature("p.punc").equals(",")); // check if next token starts with a lower case, or // this is the end of sentence, or if next token // is a period (".") or a zip code (5 or 10 digits). boolean nextIsGood = (isLowercaseLetter(next.charAt(0)) || tokenItem.getNext() == null || featureSet.getString("punc").equals(".") || ((nextLength == 5 || nextLength == 10) && matches(digitsPattern, next))); if (previousIsCity && nextIsGood) { expandState = true; } else { expandState = false; } } else { expandState = true; } if (expandState) { for (int j = 2; j < state.length; j++) { if (state[j] != null) { wordRelation.addWord(state[j]); } } return true; } } return false; }
boolean function(String tokenVal) { String[] state = (String[]) usStatesHash.get(tokenVal); if (state != null) { boolean expandState = false; if (state[1].equals(STR)) { String previous = (String) tokenItem.findFeature(STR); String next = (String) tokenItem.findFeature(STR); int nextLength = next.length(); FeatureSet featureSet = tokenItem.getFeatures(); boolean previousIsCity = (isUppercaseLetter(previous.charAt(0)) && previous.length() > 2 && matches(alphabetPattern, previous) && tokenItem.findFeature(STR).equals(",")); boolean nextIsGood = (isLowercaseLetter(next.charAt(0)) tokenItem.getNext() == null featureSet.getString("punc").equals(".") ((nextLength == 5 nextLength == 10) && matches(digitsPattern, next))); if (previousIsCity && nextIsGood) { expandState = true; } else { expandState = false; } } else { expandState = true; } if (expandState) { for (int j = 2; j < state.length; j++) { if (state[j] != null) { wordRelation.addWord(state[j]); } } return true; } } return false; }
/** * Returns true if the given token is the name of a US state. * If it is, it will add the name of the state to (word) Items in the * WordRelation. * * @param tokenVal the token string */
Returns true if the given token is the name of a US state. If it is, it will add the name of the state to (word) Items in the WordRelation
isStateName
{ "repo_name": "edwardtoday/PolyU_MScST", "path": "COMP5517/JavaSpeech/freetts-1.2.2-src/freetts-1.2.2/com/sun/speech/freetts/en/us/TokenToWords.java", "license": "mit", "size": 34524 }
[ "com.sun.speech.freetts.FeatureSet" ]
import com.sun.speech.freetts.FeatureSet;
import com.sun.speech.freetts.*;
[ "com.sun.speech" ]
com.sun.speech;
418,388
@Override StringBuilder appendTo(StringBuilder sb, boolean forAnnotations) { if (!isPrettyPrint() || this == registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE)) { return sb.append(forAnnotations ? "!Function" : "Function"); } setPrettyPrint(false); sb.append("function("); int paramNum = call.parameters.getChildCount(); boolean hasKnownTypeOfThis = !(typeOfThis instanceof UnknownType); if (hasKnownTypeOfThis) { if (isConstructor()) { sb.append("new:"); } else { sb.append("this:"); } typeOfThis.appendTo(sb, forAnnotations); } if (paramNum > 0) { if (hasKnownTypeOfThis) { sb.append(", "); } Node p = call.parameters.getFirstChild(); appendArgString(sb, p, forAnnotations); p = p.getNext(); while (p != null) { sb.append(", "); appendArgString(sb, p, forAnnotations); p = p.getNext(); } } sb.append("): "); call.returnType.appendAsNonNull(sb, forAnnotations); setPrettyPrint(true); return sb; }
StringBuilder appendTo(StringBuilder sb, boolean forAnnotations) { if (!isPrettyPrint() this == registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE)) { return sb.append(forAnnotations ? STR : STR); } setPrettyPrint(false); sb.append(STR); int paramNum = call.parameters.getChildCount(); boolean hasKnownTypeOfThis = !(typeOfThis instanceof UnknownType); if (hasKnownTypeOfThis) { if (isConstructor()) { sb.append("new:"); } else { sb.append("this:"); } typeOfThis.appendTo(sb, forAnnotations); } if (paramNum > 0) { if (hasKnownTypeOfThis) { sb.append(STR); } Node p = call.parameters.getFirstChild(); appendArgString(sb, p, forAnnotations); p = p.getNext(); while (p != null) { sb.append(STR); appendArgString(sb, p, forAnnotations); p = p.getNext(); } } sb.append(STR); call.returnType.appendAsNonNull(sb, forAnnotations); setPrettyPrint(true); return sb; }
/** * Informally, a function is represented by {@code function (params): returnType} where the {@code * params} is a comma separated list of types, the first one being a special {@code this:T} if the * function expects a known type for {@code this}. */
Informally, a function is represented by function (params): returnType where the params is a comma separated list of types, the first one being a special this:T if the function expects a known type for this
appendTo
{ "repo_name": "tiobe/closure-compiler", "path": "src/com/google/javascript/rhino/jstype/FunctionType.java", "license": "apache-2.0", "size": 52311 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
611,176
public synchronized Map<String, Appender> buildAppenderMap() { if (!appenderMap.isEmpty()) { return appenderMap; } appenderMap.clear(); if (appenders != null) { for (String app : appenders) { Appender appender = AppenderManager.getAppender(app); if (appender == null) { Kernel.logWarn("Cannot find appender " + app); } else { appenderMap.put(appender.getName(), appender); } } } return appenderMap; }
synchronized Map<String, Appender> function() { if (!appenderMap.isEmpty()) { return appenderMap; } appenderMap.clear(); if (appenders != null) { for (String app : appenders) { Appender appender = AppenderManager.getAppender(app); if (appender == null) { Kernel.logWarn(STR + app); } else { appenderMap.put(appender.getName(), appender); } } } return appenderMap; }
/** * Build appenders list from appender tags array * * @return appenders list */
Build appenders list from appender tags array
buildAppenderMap
{ "repo_name": "liulhdarks/darks-logs", "path": "src/darks/log/Category.java", "license": "apache-2.0", "size": 3669 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
655,424
public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(Extension.issuingDistributionPoint.getId()); extns.remove(Extension.deltaCRLIndicator.getId()); return !extns.isEmpty(); }
boolean function() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(Extension.issuingDistributionPoint.getId()); extns.remove(Extension.deltaCRLIndicator.getId()); return !extns.isEmpty(); }
/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */
Will return true if any extensions are present and marked as critical as we currently dont handle any extensions
hasUnsupportedCriticalExtension
{ "repo_name": "adammfrank/Bridge", "path": "AmazonDynamoDB/jars/crypto-152/prov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/x509/X509CRLObject.java", "license": "mit", "size": 18811 }
[ "java.util.Set", "org.bouncycastle.asn1.x509.Extension" ]
import java.util.Set; import org.bouncycastle.asn1.x509.Extension;
import java.util.*; import org.bouncycastle.asn1.x509.*;
[ "java.util", "org.bouncycastle.asn1" ]
java.util; org.bouncycastle.asn1;
2,265,682
//??? doesn't search for all document in this path??? public SearchResult search(String basePath, Condition condition, int order) throws StorageException;
SearchResult function(String basePath, Condition condition, int order) throws StorageException;
/** * Searches for a document in a specified path * @param basePath node from which search is performed * @param condition condition that filters documents * @param order ordering of results (unk, asc, desc) * @return a map containing the result of the search key=doc path value=document content * @throws StorageException */
Searches for a document in a specified path
search
{ "repo_name": "actility/ong", "path": "gscl/storage.driver.api/src/main/java/com/actility/m2m/storage/driver/StorageRequestDriverExecutor.java", "license": "gpl-2.0", "size": 15549 }
[ "com.actility.m2m.storage.Condition", "com.actility.m2m.storage.SearchResult", "com.actility.m2m.storage.StorageException" ]
import com.actility.m2m.storage.Condition; import com.actility.m2m.storage.SearchResult; import com.actility.m2m.storage.StorageException;
import com.actility.m2m.storage.*;
[ "com.actility.m2m" ]
com.actility.m2m;
2,361,045
@Override public void closeAnalyzer() { if (tempFileLocation != null && tempFileLocation.exists()) { LOGGER.debug("Attempting to delete temporary files from `{}`", tempFileLocation.toString()); final boolean success = FileUtils.delete(tempFileLocation); if (!success && tempFileLocation.exists()) { final String[] l = tempFileLocation.list(); if (l != null && l.length > 0) { LOGGER.warn("Failed to delete the JAR Analyzder's temporary files from `{}`, " + "see the log for more details", tempFileLocation.getAbsolutePath()); } } } }
void function() { if (tempFileLocation != null && tempFileLocation.exists()) { LOGGER.debug(STR, tempFileLocation.toString()); final boolean success = FileUtils.delete(tempFileLocation); if (!success && tempFileLocation.exists()) { final String[] l = tempFileLocation.list(); if (l != null && l.length > 0) { LOGGER.warn(STR + STR, tempFileLocation.getAbsolutePath()); } } } }
/** * Deletes any files extracted from the JAR during analysis. */
Deletes any files extracted from the JAR during analysis
closeAnalyzer
{ "repo_name": "awhitford/DependencyCheck", "path": "core/src/main/java/org/owasp/dependencycheck/analyzer/JarAnalyzer.java", "license": "apache-2.0", "size": 59406 }
[ "org.owasp.dependencycheck.utils.FileUtils" ]
import org.owasp.dependencycheck.utils.FileUtils;
import org.owasp.dependencycheck.utils.*;
[ "org.owasp.dependencycheck" ]
org.owasp.dependencycheck;
1,388,221
public void removeFromGateway(API api, String tenantDomain) throws Exception { for (Environment environment : environments) { RESTAPIAdminClient client = new RESTAPIAdminClient(api.getId(), environment); if (client.getApi(tenantDomain) != null) { if (debugEnabled) { log.debug("Removing API " + api.getId().getApiName() + " From environment " + environment.getName()); } String operation ="delete"; client.deleteApi(tenantDomain); undeployCustomSequences(api, tenantDomain,environment); setSecurevaultProperty(api,tenantDomain,environment,operation); } if(api.isPublishedDefaultVersion()){ if(client.getDefaultApi(tenantDomain)!=null){ client.deleteDefaultApi(tenantDomain); } } } }
void function(API api, String tenantDomain) throws Exception { for (Environment environment : environments) { RESTAPIAdminClient client = new RESTAPIAdminClient(api.getId(), environment); if (client.getApi(tenantDomain) != null) { if (debugEnabled) { log.debug(STR + api.getId().getApiName() + STR + environment.getName()); } String operation =STR; client.deleteApi(tenantDomain); undeployCustomSequences(api, tenantDomain,environment); setSecurevaultProperty(api,tenantDomain,environment,operation); } if(api.isPublishedDefaultVersion()){ if(client.getDefaultApi(tenantDomain)!=null){ client.deleteDefaultApi(tenantDomain); } } } }
/** * Removed an API from the configured Gateways * * @param api * - The API to be removed * @param tenantDomain * - Tenant Domain of the publisher * @throws Exception * - Thrown if a failure occurs while removing the API from the * Gateway. A single failure will * stop all subsequent attempts to remove from other Gateways. */
Removed an API from the configured Gateways
removeFromGateway
{ "repo_name": "thushara35/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIGatewayManager.java", "license": "apache-2.0", "size": 22827 }
[ "org.wso2.carbon.apimgt.impl.dto.Environment", "org.wso2.carbon.apimgt.impl.utils.RESTAPIAdminClient" ]
import org.wso2.carbon.apimgt.impl.dto.Environment; import org.wso2.carbon.apimgt.impl.utils.RESTAPIAdminClient;
import org.wso2.carbon.apimgt.impl.dto.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,371,309
@Test public void dropAmountTest() { gh.drop(1); verify(bot).drop(1); }
void function() { gh.drop(1); verify(bot).drop(1); }
/** * Test for drop(amount). */
Test for drop(amount)
dropAmountTest
{ "repo_name": "eishub/BW4T", "path": "bw4t-server/src/test/java/nl/tudelft/bw4t/server/model/robots/handicap/RobotDecoratorTest.java", "license": "gpl-3.0", "size": 6909 }
[ "org.mockito.Mockito" ]
import org.mockito.Mockito;
import org.mockito.*;
[ "org.mockito" ]
org.mockito;
704,061
@Override public void run() { final long currentTime = System.currentTimeMillis(); synchronized (this.collectedEvents) { final Iterator<JobID> it = this.collectedEvents.keySet().iterator(); while (it.hasNext()) { final JobID jobID = it.next(); final List<AbstractEvent> eventList = this.collectedEvents.get(jobID); if (eventList == null) { continue; } final Iterator<AbstractEvent> it2 = eventList.iterator(); while (it2.hasNext()) { final AbstractEvent event = it2.next(); // If the event is older than TIMERTASKINTERVAL, remove it if ((event.getTimestamp() + this.timerTaskInterval) < currentTime) { archiveEvent(jobID, event); it2.remove(); } } if (eventList.isEmpty()) { it.remove(); } } } synchronized (this.recentJobs) { final Iterator<Map.Entry<JobID, RecentJobEvent>> it = this.recentJobs.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<JobID, RecentJobEvent> entry = it.next(); final JobStatus jobStatus = entry.getValue().getJobStatus(); // Only remove jobs from the list which have stopped running if (jobStatus != JobStatus.FINISHED && jobStatus != JobStatus.CANCELED && jobStatus != JobStatus.FAILED) { continue; } // Check time stamp of last job status update if ((entry.getValue().getTimestamp() + this.timerTaskInterval) < currentTime) { archiveJobevent(entry.getKey(), entry.getValue()); it.remove(); synchronized (this.recentManagementGraphs) { archiveManagementGraph(entry.getKey(), this.recentManagementGraphs.get(entry.getKey())); this.recentManagementGraphs.remove(entry.getValue()); } } } } }
void function() { final long currentTime = System.currentTimeMillis(); synchronized (this.collectedEvents) { final Iterator<JobID> it = this.collectedEvents.keySet().iterator(); while (it.hasNext()) { final JobID jobID = it.next(); final List<AbstractEvent> eventList = this.collectedEvents.get(jobID); if (eventList == null) { continue; } final Iterator<AbstractEvent> it2 = eventList.iterator(); while (it2.hasNext()) { final AbstractEvent event = it2.next(); if ((event.getTimestamp() + this.timerTaskInterval) < currentTime) { archiveEvent(jobID, event); it2.remove(); } } if (eventList.isEmpty()) { it.remove(); } } } synchronized (this.recentJobs) { final Iterator<Map.Entry<JobID, RecentJobEvent>> it = this.recentJobs.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<JobID, RecentJobEvent> entry = it.next(); final JobStatus jobStatus = entry.getValue().getJobStatus(); if (jobStatus != JobStatus.FINISHED && jobStatus != JobStatus.CANCELED && jobStatus != JobStatus.FAILED) { continue; } if ((entry.getValue().getTimestamp() + this.timerTaskInterval) < currentTime) { archiveJobevent(entry.getKey(), entry.getValue()); it.remove(); synchronized (this.recentManagementGraphs) { archiveManagementGraph(entry.getKey(), this.recentManagementGraphs.get(entry.getKey())); this.recentManagementGraphs.remove(entry.getValue()); } } } } }
/** * This method will periodically be called to clean up expired * collected events. */
This method will periodically be called to clean up expired collected events
run
{ "repo_name": "citlab/vs.msc.ws14", "path": "flink-0-7-custom/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/EventCollector.java", "license": "apache-2.0", "size": 15351 }
[ "java.util.Iterator", "java.util.List", "java.util.Map", "org.apache.flink.runtime.event.job.AbstractEvent", "org.apache.flink.runtime.event.job.RecentJobEvent", "org.apache.flink.runtime.jobgraph.JobID", "org.apache.flink.runtime.jobgraph.JobStatus" ]
import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.flink.runtime.event.job.AbstractEvent; import org.apache.flink.runtime.event.job.RecentJobEvent; import org.apache.flink.runtime.jobgraph.JobID; import org.apache.flink.runtime.jobgraph.JobStatus;
import java.util.*; import org.apache.flink.runtime.event.job.*; import org.apache.flink.runtime.jobgraph.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
2,509,100
private static DetailNode parseFile(File file) throws IOException { final FileText text = new FileText(file.getAbsoluteFile(), System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); return parseJavadocAsDetailNode(text.getFullText().toString()); }
static DetailNode function(File file) throws IOException { final FileText text = new FileText(file.getAbsoluteFile(), System.getProperty(STR, StandardCharsets.UTF_8.name())); return parseJavadocAsDetailNode(text.getFullText().toString()); }
/** * Parse a file and return the parse tree. * @param file the file to parse. * @return the root node of the parse tree. * @throws IOException if the file could not be read. */
Parse a file and return the parse tree
parseFile
{ "repo_name": "jochenvdv/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java", "license": "lgpl-2.1", "size": 7087 }
[ "com.puppycrawl.tools.checkstyle.api.DetailNode", "com.puppycrawl.tools.checkstyle.api.FileText", "java.io.File", "java.io.IOException", "java.nio.charset.StandardCharsets" ]
import com.puppycrawl.tools.checkstyle.api.DetailNode; import com.puppycrawl.tools.checkstyle.api.FileText; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets;
import com.puppycrawl.tools.checkstyle.api.*; import java.io.*; import java.nio.charset.*;
[ "com.puppycrawl.tools", "java.io", "java.nio" ]
com.puppycrawl.tools; java.io; java.nio;
1,001,060
private static int setColorAlpha(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
static int function(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
/** * Set the alpha value of the {@code color} to be the given {@code alpha} value. */
Set the alpha value of the color to be the given alpha value
setColorAlpha
{ "repo_name": "anycook/anycook-einkaufszettel-android", "path": "app/src/main/java/de/anycook/einkaufszettel/view/SlidingTabStrip.java", "license": "gpl-3.0", "size": 7762 }
[ "android.graphics.Color" ]
import android.graphics.Color;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
525,325
@Override public BitMatrix receive(BitMatrix choices) throws IOException { ReceiveState state = receiveWritingPhase(choices); return receiveReadingPhase(state); }
BitMatrix function(BitMatrix choices) throws IOException { ReceiveState state = receiveWritingPhase(choices); return receiveReadingPhase(state); }
/** * Use the precomputed OTs to receive. * Performs a block of OTs at once. * @param choices a vector of choice bits. The number of OTs in the block is the number of columns in this vector. * @return An m*n matrix (m columns, n rows), where n is the number of OTs and m the string length. Each row of the matrix * is the result of an OT with the corresponding choice bit. * @throws IOException */
Use the precomputed OTs to receive. Performs a block of OTs at once
receive
{ "repo_name": "factcenter/qilin", "path": "src/main/java/org/factcenter/qilin/protocols/generic/PrecomputedOTClient.java", "license": "mit", "size": 10776 }
[ "java.io.IOException", "org.factcenter.qilin.util.BitMatrix" ]
import java.io.IOException; import org.factcenter.qilin.util.BitMatrix;
import java.io.*; import org.factcenter.qilin.util.*;
[ "java.io", "org.factcenter.qilin" ]
java.io; org.factcenter.qilin;
672,830
public synchronized void markJoinEventFired(Player player) { firedJoinEvents.add(player.getUniqueId()); }
synchronized void function(Player player) { firedJoinEvents.add(player.getUniqueId()); }
/** * Mark the event to be fired including the task delay. * * @param player joining player */
Mark the event to be fired including the task delay
markJoinEventFired
{ "repo_name": "games647/FastLogin", "path": "bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java", "license": "mit", "size": 7620 }
[ "org.bukkit.entity.Player" ]
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
[ "org.bukkit.entity" ]
org.bukkit.entity;
436,502
public void setInput(LinkedBlockingQueue<Packet> input) { mS.setDirectInput(true); mS.provideInput(input); }
void function(LinkedBlockingQueue<Packet> input) { mS.setDirectInput(true); mS.provideInput(input); }
/** Used to provide the managerService with direct input from a database or other non-network source * N.B.: input of "" indicates that the user has * clicked on the "clear filters" button on the interface. * @param input - LinkedBlcokingQueue containing packets to be input to the filter */
N.B.: input of "" indicates that the user has clicked on the "clear filters" button on the interface
setInput
{ "repo_name": "rbanna01/Packet-Analyzer", "path": "Thread-Service/src/thread/service/Analyzer.java", "license": "mit", "size": 15134 }
[ "java.util.concurrent.LinkedBlockingQueue" ]
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
238,465
public final String getDescription() { JavaScriptObject jso = JsUtils.getNativePropertyObject(this, "description"); if (jso != null) return JsUtils.getNativePropertyString(jso, "en"); return null; }
final String function() { JavaScriptObject jso = JsUtils.getNativePropertyObject(this, STR); if (jso != null) return JsUtils.getNativePropertyString(jso, "en"); return null; }
/** * Get base (English) description of a Wayf Group * * @return Description of Wayf Group */
Get base (English) description of a Wayf Group
getDescription
{ "repo_name": "zlamalp/perun-wui", "path": "perun-wui-core/src/main/java/cz/metacentrum/perun/wui/model/common/WayfGroup.java", "license": "bsd-2-clause", "size": 2650 }
[ "com.google.gwt.core.client.JavaScriptObject", "cz.metacentrum.perun.wui.client.utils.JsUtils" ]
import com.google.gwt.core.client.JavaScriptObject; import cz.metacentrum.perun.wui.client.utils.JsUtils;
import com.google.gwt.core.client.*; import cz.metacentrum.perun.wui.client.utils.*;
[ "com.google.gwt", "cz.metacentrum.perun" ]
com.google.gwt; cz.metacentrum.perun;
1,908,980
public Date getDate(long value) { this.workingCalendarNoDST.setTime(new Date(value)); return (this.workingCalendarNoDST.getTime()); }
Date function(long value) { this.workingCalendarNoDST.setTime(new Date(value)); return (this.workingCalendarNoDST.getTime()); }
/** * Converts a millisecond value into a {@link Date} object. * * @param value the millisecond value. * * @return The date. */
Converts a millisecond value into a <code>Date</code> object
getDate
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/jfreechart-1.0.5/source/org/jfree/chart/axis/SegmentedTimeline.java", "license": "gpl-2.0", "size": 64698 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
649,245