method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public WindowModel getSource() { return source; }
WindowModel function() { return source; }
/** * Retrieves the window, if any, where the command was entered. * * @return The window the command came from, or null */
Retrieves the window, if any, where the command was entered
getSource
{ "repo_name": "DMDirc/DMDirc", "path": "api/src/main/java/com/dmdirc/commandparser/commands/context/CommandContext.java", "license": "mit", "size": 2473 }
[ "com.dmdirc.interfaces.WindowModel" ]
import com.dmdirc.interfaces.WindowModel;
import com.dmdirc.interfaces.*;
[ "com.dmdirc.interfaces" ]
com.dmdirc.interfaces;
1,891,295
public static void main(String[] args) { try { jFrame = new JFrame(); PanelGroupManager manager = PanelGroupManager.getManager(); manager.registerPanelGroup(TreePanel.class); manager.setDefaultType(TreePanel.class); panelGroup = (TreePanel) manager.getPanelGroup(Samples_ExtensionPointsOfIPanels.REFERENCE1); PanelGroupLoaderFromList loader = new PanelGroupLoaderFromList(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES); // Creates the IWindow PanelGroupDialog panelGroupDialog = new PanelGroupDialog(Samples_ExtensionPointsOfIPanels.REFERENCE1_NAME, "Panel with Buttons", 800, 650, (byte)0, panelGroup); // Begin: Test the normal load panelGroupDialog.loadPanels(loader); // End: Test the normal load
static void function(String[] args) { try { jFrame = new JFrame(); PanelGroupManager manager = PanelGroupManager.getManager(); manager.registerPanelGroup(TreePanel.class); manager.setDefaultType(TreePanel.class); panelGroup = (TreePanel) manager.getPanelGroup(Samples_ExtensionPointsOfIPanels.REFERENCE1); PanelGroupLoaderFromList loader = new PanelGroupLoaderFromList(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES); PanelGroupDialog panelGroupDialog = new PanelGroupDialog(Samples_ExtensionPointsOfIPanels.REFERENCE1_NAME, STR, 800, 650, (byte)0, panelGroup); panelGroupDialog.loadPanels(loader);
/** * <p>Test method for the Test7ButtonsPanel.</p> * * @param args optional arguments */
Test method for the Test7ButtonsPanel
main
{ "repo_name": "iCarto/siga", "path": "appgvSIG/src-test/com/iver/cit/gvsig/panelGroup/Test7ButtonsPanel.java", "license": "gpl-3.0", "size": 4185 }
[ "javax.swing.JFrame", "org.gvsig.gui.beans.panelGroup.PanelGroupManager", "org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList", "org.gvsig.gui.beans.panelGroup.treePanel.TreePanel" ]
import javax.swing.JFrame; import org.gvsig.gui.beans.panelGroup.PanelGroupManager; import org.gvsig.gui.beans.panelGroup.loaders.PanelGroupLoaderFromList; import org.gvsig.gui.beans.panelGroup.treePanel.TreePanel;
import javax.swing.*; import org.gvsig.gui.beans.*;
[ "javax.swing", "org.gvsig.gui" ]
javax.swing; org.gvsig.gui;
1,992,201
@Override public boolean equals( Object o ) { if( this == o ) { return true; } if( o == null || !Proxy.isProxyClass( o.getClass() ) ) { return false; } try { ValueInstance that = (ValueInstance) Proxy.getInvocationHandler( o ); // Descriptor equality if( !descriptor().equals( that.descriptor() ) ) { return false; } // State equality return state.equals( that.state ); } catch( ClassCastException e ) { return false; } }
boolean function( Object o ) { if( this == o ) { return true; } if( o == null !Proxy.isProxyClass( o.getClass() ) ) { return false; } try { ValueInstance that = (ValueInstance) Proxy.getInvocationHandler( o ); if( !descriptor().equals( that.descriptor() ) ) { return false; } return state.equals( that.state ); } catch( ClassCastException e ) { return false; } }
/** * Perform equals with {@code o} argument. * <p> * The definition of equals() for the Value is that if both the state and descriptor are equal, * then the values are equal. * </p> * * @param o The other object to compare. * @return Returns a {@code boolean} indicator whether this object is equals the other. */
Perform equals with o argument. The definition of equals() for the Value is that if both the state and descriptor are equal, then the values are equal.
equals
{ "repo_name": "joobn72/qi4j-sdk", "path": "core/runtime/src/main/java/org/qi4j/runtime/value/ValueInstance.java", "license": "apache-2.0", "size": 5675 }
[ "java.lang.reflect.Proxy" ]
import java.lang.reflect.Proxy;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,589,452
@Generated @Selector("dismissPopoverAnimated:") public native void dismissPopoverAnimated(boolean animated);
@Selector(STR) native void function(boolean animated);
/** * Called to dismiss the popover programmatically. The delegate methods for "should" and "did" dismiss are not called when the popover is dismissed in this way. */
Called to dismiss the popover programmatically. The delegate methods for "should" and "did" dismiss are not called when the popover is dismissed in this way
dismissPopoverAnimated
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIPopoverController.java", "license": "apache-2.0", "size": 12947 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,512,248
public StorageState analyzeStorage(StartupOption startOpt, Storage storage) throws IOException { assert root != null : "root is null"; boolean hadMkdirs = false; String rootPath = root.getCanonicalPath(); try { // check that storage exists if (!root.exists()) { // storage directory does not exist if (startOpt != StartupOption.FORMAT && startOpt != StartupOption.HOTSWAP) { LOG.warn("Storage directory " + rootPath + " does not exist"); return StorageState.NON_EXISTENT; } LOG.info(rootPath + " does not exist. Creating ..."); if (!root.mkdirs()) throw new IOException("Cannot create directory " + rootPath); hadMkdirs = true; } // or is inaccessible if (!root.isDirectory()) { LOG.warn(rootPath + "is not a directory"); return StorageState.NON_EXISTENT; } if (!FileUtil.canWrite(root)) { LOG.warn("Cannot access storage directory " + rootPath); return StorageState.NON_EXISTENT; } } catch(SecurityException ex) { LOG.warn("Cannot access storage directory " + rootPath, ex); return StorageState.NON_EXISTENT; } this.lock(); // lock storage if it exists // If startOpt is HOTSWAP, it returns NOT_FORMATTED for empty directory, // while it also checks the layout version. if (startOpt == HdfsServerConstants.StartupOption.FORMAT || (startOpt == StartupOption.HOTSWAP && hadMkdirs)) return StorageState.NOT_FORMATTED; if (startOpt != HdfsServerConstants.StartupOption.IMPORT) { storage.checkOldLayoutStorage(this); } // check whether current directory is valid File versionFile = getVersionFile(); boolean hasCurrent = versionFile.exists(); // check which directories exist boolean hasPrevious = getPreviousDir().exists(); boolean hasPreviousTmp = getPreviousTmp().exists(); boolean hasRemovedTmp = getRemovedTmp().exists(); boolean hasFinalizedTmp = getFinalizedTmp().exists(); boolean hasCheckpointTmp = getLastCheckpointTmp().exists(); if (!(hasPreviousTmp || hasRemovedTmp || hasFinalizedTmp || hasCheckpointTmp)) { // no temp dirs - no recovery if (hasCurrent) return StorageState.NORMAL; if (hasPrevious) throw new InconsistentFSStateException(root, "version file in current directory is missing."); return StorageState.NOT_FORMATTED; } if ((hasPreviousTmp?1:0) + (hasRemovedTmp?1:0) + (hasFinalizedTmp?1:0) + (hasCheckpointTmp?1:0) > 1) // more than one temp dirs throw new InconsistentFSStateException(root, "too many temporary directories."); // # of temp dirs == 1 should either recover or complete a transition if (hasCheckpointTmp) { return hasCurrent ? StorageState.COMPLETE_CHECKPOINT : StorageState.RECOVER_CHECKPOINT; } if (hasFinalizedTmp) { if (hasPrevious) throw new InconsistentFSStateException(root, STORAGE_DIR_PREVIOUS + " and " + STORAGE_TMP_FINALIZED + "cannot exist together."); return StorageState.COMPLETE_FINALIZE; } if (hasPreviousTmp) { if (hasPrevious) throw new InconsistentFSStateException(root, STORAGE_DIR_PREVIOUS + " and " + STORAGE_TMP_PREVIOUS + " cannot exist together."); if (hasCurrent) return StorageState.COMPLETE_UPGRADE; return StorageState.RECOVER_UPGRADE; } assert hasRemovedTmp : "hasRemovedTmp must be true"; if (!(hasCurrent ^ hasPrevious)) throw new InconsistentFSStateException(root, "one and only one directory " + STORAGE_DIR_CURRENT + " or " + STORAGE_DIR_PREVIOUS + " must be present when " + STORAGE_TMP_REMOVED + " exists."); if (hasCurrent) return StorageState.COMPLETE_ROLLBACK; return StorageState.RECOVER_ROLLBACK; }
StorageState function(StartupOption startOpt, Storage storage) throws IOException { assert root != null : STR; boolean hadMkdirs = false; String rootPath = root.getCanonicalPath(); try { if (!root.exists()) { if (startOpt != StartupOption.FORMAT && startOpt != StartupOption.HOTSWAP) { LOG.warn(STR + rootPath + STR); return StorageState.NON_EXISTENT; } LOG.info(rootPath + STR); if (!root.mkdirs()) throw new IOException(STR + rootPath); hadMkdirs = true; } if (!root.isDirectory()) { LOG.warn(rootPath + STR); return StorageState.NON_EXISTENT; } if (!FileUtil.canWrite(root)) { LOG.warn(STR + rootPath); return StorageState.NON_EXISTENT; } } catch(SecurityException ex) { LOG.warn(STR + rootPath, ex); return StorageState.NON_EXISTENT; } this.lock(); if (startOpt == HdfsServerConstants.StartupOption.FORMAT (startOpt == StartupOption.HOTSWAP && hadMkdirs)) return StorageState.NOT_FORMATTED; if (startOpt != HdfsServerConstants.StartupOption.IMPORT) { storage.checkOldLayoutStorage(this); } File versionFile = getVersionFile(); boolean hasCurrent = versionFile.exists(); boolean hasPrevious = getPreviousDir().exists(); boolean hasPreviousTmp = getPreviousTmp().exists(); boolean hasRemovedTmp = getRemovedTmp().exists(); boolean hasFinalizedTmp = getFinalizedTmp().exists(); boolean hasCheckpointTmp = getLastCheckpointTmp().exists(); if (!(hasPreviousTmp hasRemovedTmp hasFinalizedTmp hasCheckpointTmp)) { if (hasCurrent) return StorageState.NORMAL; if (hasPrevious) throw new InconsistentFSStateException(root, STR); return StorageState.NOT_FORMATTED; } if ((hasPreviousTmp?1:0) + (hasRemovedTmp?1:0) + (hasFinalizedTmp?1:0) + (hasCheckpointTmp?1:0) > 1) throw new InconsistentFSStateException(root, STR); if (hasCheckpointTmp) { return hasCurrent ? StorageState.COMPLETE_CHECKPOINT : StorageState.RECOVER_CHECKPOINT; } if (hasFinalizedTmp) { if (hasPrevious) throw new InconsistentFSStateException(root, STORAGE_DIR_PREVIOUS + STR + STORAGE_TMP_FINALIZED + STR); return StorageState.COMPLETE_FINALIZE; } if (hasPreviousTmp) { if (hasPrevious) throw new InconsistentFSStateException(root, STORAGE_DIR_PREVIOUS + STR + STORAGE_TMP_PREVIOUS + STR); if (hasCurrent) return StorageState.COMPLETE_UPGRADE; return StorageState.RECOVER_UPGRADE; } assert hasRemovedTmp : STR; if (!(hasCurrent ^ hasPrevious)) throw new InconsistentFSStateException(root, STR + STORAGE_DIR_CURRENT + STR + STORAGE_DIR_PREVIOUS + STR + STORAGE_TMP_REMOVED + STR); if (hasCurrent) return StorageState.COMPLETE_ROLLBACK; return StorageState.RECOVER_ROLLBACK; }
/** * Check consistency of the storage directory * * @param startOpt a startup option. * * @return state {@link StorageState} of the storage directory * @throws InconsistentFSStateException if directory state is not * consistent and cannot be recovered. * @throws IOException */
Check consistency of the storage directory
analyzeStorage
{ "repo_name": "messi49/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Storage.java", "license": "apache-2.0", "size": 40355 }
[ "java.io.File", "java.io.IOException", "org.apache.hadoop.fs.FileUtil", "org.apache.hadoop.hdfs.server.common.HdfsServerConstants" ]
import java.io.File; import java.io.IOException; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.server.common.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,681,082
protected void processThumbnailPassComplete(BufferedImage theThumbnail) { if (updateListeners == null) { return; } int numListeners = updateListeners.size(); for (int i = 0; i < numListeners; i++) { IIOReadUpdateListener listener = updateListeners.get(i); listener.thumbnailPassComplete(this, theThumbnail); } } /** * Broadcasts a warning message to all registered * {@code IIOReadWarningListener}s by calling their * {@code warningOccurred} method. Subclasses may use this * method as a convenience. * * @param warning the warning message to send. * * @exception IllegalArgumentException if {@code warning}
void function(BufferedImage theThumbnail) { if (updateListeners == null) { return; } int numListeners = updateListeners.size(); for (int i = 0; i < numListeners; i++) { IIOReadUpdateListener listener = updateListeners.get(i); listener.thumbnailPassComplete(this, theThumbnail); } } /** * Broadcasts a warning message to all registered * {@code IIOReadWarningListener}s by calling their * {@code warningOccurred} method. Subclasses may use this * method as a convenience. * * @param warning the warning message to send. * * @exception IllegalArgumentException if {@code warning}
/** * Broadcasts the end of a thumbnail progressive pass to all * registered {@code IIOReadUpdateListener}s by calling their * {@code thumbnailPassComplete} method. Subclasses may use this * method as a convenience. * * @param theThumbnail the {@code BufferedImage} thumbnail * being updated. */
Broadcasts the end of a thumbnail progressive pass to all registered IIOReadUpdateListeners by calling their thumbnailPassComplete method. Subclasses may use this method as a convenience
processThumbnailPassComplete
{ "repo_name": "md-5/jdk10", "path": "src/java.desktop/share/classes/javax/imageio/ImageReader.java", "license": "gpl-2.0", "size": 114935 }
[ "java.awt.image.BufferedImage", "javax.imageio.event.IIOReadUpdateListener", "javax.imageio.event.IIOReadWarningListener" ]
import java.awt.image.BufferedImage; import javax.imageio.event.IIOReadUpdateListener; import javax.imageio.event.IIOReadWarningListener;
import java.awt.image.*; import javax.imageio.event.*;
[ "java.awt", "javax.imageio" ]
java.awt; javax.imageio;
1,617,730
public static void setVector(VarBinaryVector vector, byte[]... values) { final int length = values.length; vector.allocateNewSafe(); for (int i = 0; i < length; i++) { if (values[i] != null) { vector.set(i, values[i]); } } vector.setValueCount(length); }
static void function(VarBinaryVector vector, byte[]... values) { final int length = values.length; vector.allocateNewSafe(); for (int i = 0; i < length; i++) { if (values[i] != null) { vector.set(i, values[i]); } } vector.setValueCount(length); }
/** * Populate values for VarBinaryVector. */
Populate values for VarBinaryVector
setVector
{ "repo_name": "wesm/arrow", "path": "java/vector/src/test/java/org/apache/arrow/vector/testing/ValueVectorDataPopulator.java", "license": "apache-2.0", "size": 20903 }
[ "org.apache.arrow.vector.VarBinaryVector" ]
import org.apache.arrow.vector.VarBinaryVector;
import org.apache.arrow.vector.*;
[ "org.apache.arrow" ]
org.apache.arrow;
335,790
public Long countInterAtomContacts(String atomNameOne, String atomNameTwo) { return atomContactRdd .filter(t -> CanonNames.getCanonAtomNames(t).equals(CanonNames.getCanonAtomNames( atomAtomContact(atomNameOne,atomNameTwo)))) .count(); }
Long function(String atomNameOne, String atomNameTwo) { return atomContactRdd .filter(t -> CanonNames.getCanonAtomNames(t).equals(CanonNames.getCanonAtomNames( atomAtomContact(atomNameOne,atomNameTwo)))) .count(); }
/** * Get the number of inter-atom name contacts for a given pair of atoms names. * @param atomNameOne the name of the first atom name (e.g. CA for C-alpha) * @param atomNameTwo the name of the second atom name (e.g. CA for C-alpha) * @return the number of contacts between these two groups */
Get the number of inter-atom name contacts for a given pair of atoms names
countInterAtomContacts
{ "repo_name": "abradle/biojava-spark", "path": "src/main/java/org/biojava/spark/data/AtomContactRDD.java", "license": "lgpl-2.1", "size": 9180 }
[ "org.biojava.spark.utils.CanonNames" ]
import org.biojava.spark.utils.CanonNames;
import org.biojava.spark.utils.*;
[ "org.biojava.spark" ]
org.biojava.spark;
613,281
public Bbox readEnvelopeAsBbox(DOMHelper dom, Element envElt) throws XMLReaderException { Envelope env = readEnvelope(dom, envElt); return envelopeToBbox(env); }
Bbox function(DOMHelper dom, Element envElt) throws XMLReaderException { Envelope env = readEnvelope(dom, envElt); return envelopeToBbox(env); }
/** * Reads a GML {@link Envelope} from a DOM element as a {@link Bbox} object * @param dom parent DOM helper instance * @param envElt element to parse from * @return the new Bbox instance * @throws XMLReaderException */
Reads a GML <code>Envelope</code> from a DOM element as a <code>Bbox</code> object
readEnvelopeAsBbox
{ "repo_name": "sensiasoft/lib-swe-common", "path": "swe-common-om/src/main/java/org/vast/ogc/gml/GMLUtils.java", "license": "mpl-2.0", "size": 20800 }
[ "net.opengis.gml.v32.Envelope", "org.vast.util.Bbox", "org.vast.xml.DOMHelper", "org.vast.xml.XMLReaderException", "org.w3c.dom.Element" ]
import net.opengis.gml.v32.Envelope; import org.vast.util.Bbox; import org.vast.xml.DOMHelper; import org.vast.xml.XMLReaderException; import org.w3c.dom.Element;
import net.opengis.gml.v32.*; import org.vast.util.*; import org.vast.xml.*; import org.w3c.dom.*;
[ "net.opengis.gml", "org.vast.util", "org.vast.xml", "org.w3c.dom" ]
net.opengis.gml; org.vast.util; org.vast.xml; org.w3c.dom;
651,746
public SectionStatus getSectionStatusByDeliverable(long deliverableID, String cycle, int year, Boolean upkeep, String sectionName);
SectionStatus function(long deliverableID, String cycle, int year, Boolean upkeep, String sectionName);
/** * This method gets a sectionStatus object by a given sectionStatus identifier. * * @param deliverableID is the deliverable identifier. * @return a SectionStatus object. */
This method gets a sectionStatus object by a given sectionStatus identifier
getSectionStatusByDeliverable
{ "repo_name": "CCAFS/MARLO", "path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/SectionStatusManager.java", "license": "gpl-3.0", "size": 8231 }
[ "org.cgiar.ccafs.marlo.data.model.SectionStatus" ]
import org.cgiar.ccafs.marlo.data.model.SectionStatus;
import org.cgiar.ccafs.marlo.data.model.*;
[ "org.cgiar.ccafs" ]
org.cgiar.ccafs;
1,649,681
public Result getClosestRowBefore(final byte [] row, final byte [] family) throws IOException { if (coprocessorHost != null) { Result result = new Result(); if (coprocessorHost.preGetClosestRowBefore(row, family, result)) { return result; } } // look across all the HStores for this region and determine what the // closest key is across all column families, since the data may be sparse checkRow(row, "getClosestRowBefore"); startRegionOperation(); this.readRequestsCount.increment(); this.opMetrics.setReadRequestCountMetrics(this.readRequestsCount.get()); try { Store store = getStore(family); // get the closest key. (HStore.getRowKeyAtOrBefore can return null) KeyValue key = store.getRowKeyAtOrBefore(row); Result result = null; if (key != null) { Get get = new Get(key.getRow()); get.addFamily(family); result = get(get, null); } if (coprocessorHost != null) { coprocessorHost.postGetClosestRowBefore(row, family, result); } return result; } finally { closeRegionOperation(); } } /** * Return an iterator that scans over the HRegion, returning the indicated * columns and rows specified by the {@link Scan}. * <p> * This Iterator must be closed by the caller. * * @param scan configured {@link Scan}
Result function(final byte [] row, final byte [] family) throws IOException { if (coprocessorHost != null) { Result result = new Result(); if (coprocessorHost.preGetClosestRowBefore(row, family, result)) { return result; } } checkRow(row, STR); startRegionOperation(); this.readRequestsCount.increment(); this.opMetrics.setReadRequestCountMetrics(this.readRequestsCount.get()); try { Store store = getStore(family); KeyValue key = store.getRowKeyAtOrBefore(row); Result result = null; if (key != null) { Get get = new Get(key.getRow()); get.addFamily(family); result = get(get, null); } if (coprocessorHost != null) { coprocessorHost.postGetClosestRowBefore(row, family, result); } return result; } finally { closeRegionOperation(); } } /** * Return an iterator that scans over the HRegion, returning the indicated * columns and rows specified by the {@link Scan}. * <p> * This Iterator must be closed by the caller. * * @param scan configured {@link Scan}
/** * Return all the data for the row that matches <i>row</i> exactly, * or the one that immediately preceeds it, at or immediately before * <i>ts</i>. * * @param row row key * @param family column family to find on * @return map of values * @throws IOException read exceptions */
Return all the data for the row that matches row exactly, or the one that immediately preceeds it, at or immediately before ts
getClosestRowBefore
{ "repo_name": "gdweijin/hindex", "path": "src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java", "license": "apache-2.0", "size": 221667 }
[ "java.io.IOException", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.client.Get", "org.apache.hadoop.hbase.client.Result", "org.apache.hadoop.hbase.client.Scan" ]
import java.io.IOException; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Scan;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,244,124
public InputStream openSchema(String name) throws IOException { return openResource(name); }
InputStream function(String name) throws IOException { return openResource(name); }
/** Opens a schema resource by its name. * Override this method to customize loading schema resources. *@return the stream for the named schema */
Opens a schema resource by its name. Override this method to customize loading schema resources
openSchema
{ "repo_name": "yintaoxue/read-open-source-code", "path": "solr-4.10.4/src/org/apache/solr/core/SolrResourceLoader.java", "license": "apache-2.0", "size": 31079 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,817,101
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) { CategoryDataset dataset = plot.getDataset(); int catIndex = dataset.getColumnIndex(this.category); int catCount = dataset.getColumnCount(); float anchorX = 0.0f; float anchorY = 0.0f; PlotOrientation orientation = plot.getOrientation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( plot.getDomainAxisLocation(), orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( plot.getRangeAxisLocation(), orientation); if (orientation == PlotOrientation.HORIZONTAL) { anchorY = (float) domainAxis.getCategoryJava2DCoordinate( this.categoryAnchor, catIndex, catCount, dataArea, domainEdge); anchorX = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge); } else if (orientation == PlotOrientation.VERTICAL) { anchorX = (float) domainAxis.getCategoryJava2DCoordinate( this.categoryAnchor, catIndex, catCount, dataArea, domainEdge); anchorY = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge); } g2.setFont(getFont()); g2.setPaint(getPaint()); TextUtilities.drawRotatedString(getText(), g2, anchorX, anchorY, getTextAnchor(), getRotationAngle(), getRotationAnchor()); }
void function(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) { CategoryDataset dataset = plot.getDataset(); int catIndex = dataset.getColumnIndex(this.category); int catCount = dataset.getColumnCount(); float anchorX = 0.0f; float anchorY = 0.0f; PlotOrientation orientation = plot.getOrientation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( plot.getDomainAxisLocation(), orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( plot.getRangeAxisLocation(), orientation); if (orientation == PlotOrientation.HORIZONTAL) { anchorY = (float) domainAxis.getCategoryJava2DCoordinate( this.categoryAnchor, catIndex, catCount, dataArea, domainEdge); anchorX = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge); } else if (orientation == PlotOrientation.VERTICAL) { anchorX = (float) domainAxis.getCategoryJava2DCoordinate( this.categoryAnchor, catIndex, catCount, dataArea, domainEdge); anchorY = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge); } g2.setFont(getFont()); g2.setPaint(getPaint()); TextUtilities.drawRotatedString(getText(), g2, anchorX, anchorY, getTextAnchor(), getRotationAngle(), getRotationAnchor()); }
/** * Draws the annotation. * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the data area. * @param domainAxis the domain axis. * @param rangeAxis the range axis. */
Draws the annotation
draw
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/chart/annotations/CategoryTextAnnotation.java", "license": "lgpl-2.1", "size": 9164 }
[ "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.chart.axis.CategoryAxis", "org.jfree.chart.axis.ValueAxis", "org.jfree.chart.plot.CategoryPlot", "org.jfree.chart.plot.Plot", "org.jfree.chart.plot.PlotOrientation", "org.jfree.data.category.CategoryDataset", "org.jfree.text.TextUtilities", "org.jfree.ui.RectangleEdge" ]
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.CategoryDataset; import org.jfree.text.TextUtilities; import org.jfree.ui.RectangleEdge;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.data.category.*; import org.jfree.text.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data", "org.jfree.text", "org.jfree.ui" ]
java.awt; org.jfree.chart; org.jfree.data; org.jfree.text; org.jfree.ui;
4,742
public List<String> getDemoSourceCode() { return demoSourceCode; }
List<String> function() { return demoSourceCode; }
/** * Get the xml sourceCode for the demoGroups' features being demonstrated. * * @return the sourceCode */
Get the xml sourceCode for the demoGroups' features being demonstrated
getDemoSourceCode
{ "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "path": "rice-framework/krad-sampleapp/src/main/java/org/kuali/rice/krad/demo/uif/components/ComponentExhibit.java", "license": "apache-2.0", "size": 8982 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,082,199
public void testInterfaceWithIncorrectGettersAndRelaxedTypeCheckingByProperty() { System.setProperty(SDOHelperContext.STRICT_TYPE_CHECKING_PROPERTY_NAME, "false"); SDOHelperContext helperContext = new SDOHelperContext(); InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream(XML_SCHEMA_INTEFACE_INCORRECT_GETTER); helperContext.getXSDHelper().define(xsd, null); Type type = helperContext.getTypeHelper().getType("urn:customer", "CustomerInterfaceWithIncorrectGetters"); assertSame(CustomerInterfaceWithIncorrectGetters.class, type.getInstanceClass()); DataObject dataObject = helperContext.getDataFactory().create(CustomerInterfaceWithIncorrectGetters.class); assertNotNull(dataObject); assertTrue(dataObject instanceof CustomerInterfaceWithIncorrectGetters); }
void function() { System.setProperty(SDOHelperContext.STRICT_TYPE_CHECKING_PROPERTY_NAME, "false"); SDOHelperContext helperContext = new SDOHelperContext(); InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream(XML_SCHEMA_INTEFACE_INCORRECT_GETTER); helperContext.getXSDHelper().define(xsd, null); Type type = helperContext.getTypeHelper().getType(STR, STR); assertSame(CustomerInterfaceWithIncorrectGetters.class, type.getInstanceClass()); DataObject dataObject = helperContext.getDataFactory().create(CustomerInterfaceWithIncorrectGetters.class); assertNotNull(dataObject); assertTrue(dataObject instanceof CustomerInterfaceWithIncorrectGetters); }
/** * Tests defining new type from XSD with with instanceClass interface not matching the XSD * with relaxed type checking driven by property. * * This tests works only with {@link SDOHelperContext} and subclasses (otherwise tests nothing). */
Tests defining new type from XSD with with instanceClass interface not matching the XSD with relaxed type checking driven by property. This tests works only with <code>SDOHelperContext</code> and subclasses (otherwise tests nothing)
testInterfaceWithIncorrectGettersAndRelaxedTypeCheckingByProperty
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "sdo/eclipselink.sdo.test/src/org/eclipse/persistence/testing/sdo/instanceclass/InstanceClassTestCases.java", "license": "epl-1.0", "size": 8488 }
[ "java.io.InputStream", "org.eclipse.persistence.sdo.helper.SDOHelperContext" ]
import java.io.InputStream; import org.eclipse.persistence.sdo.helper.SDOHelperContext;
import java.io.*; import org.eclipse.persistence.sdo.helper.*;
[ "java.io", "org.eclipse.persistence" ]
java.io; org.eclipse.persistence;
1,642,193
public ZWaveConfigurationParameter getParameter(Integer index) { return configParameters.get(index); }
ZWaveConfigurationParameter function(Integer index) { return configParameters.get(index); }
/** * Gets the stored parameter. * * @param index the parameter to get. * @return the stored parameter value; */
Gets the stored parameter
getParameter
{ "repo_name": "jspuij/openhab2-addons", "path": "addons/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveConfigurationCommandClass.java", "license": "epl-1.0", "size": 11765 }
[ "org.openhab.binding.zwave.internal.protocol.ZWaveConfigurationParameter" ]
import org.openhab.binding.zwave.internal.protocol.ZWaveConfigurationParameter;
import org.openhab.binding.zwave.internal.protocol.*;
[ "org.openhab.binding" ]
org.openhab.binding;
2,804,789
protected InternetAddress[] emails2Internets(List<EmailAddress> emails, List<EmailAddress> invalids) { // set the default return value InternetAddress[] addrs = new InternetAddress[0]; if (emails != null && !emails.isEmpty()) { ArrayList<InternetAddress> laddrs = new ArrayList<InternetAddress>(); for (int i = 0; i < emails.size(); i++) { EmailAddress email = emails.get(i); try { InternetAddress ia = new InternetAddress(email.getAddress(), true); ia.setPersonal(email.getPersonal()); laddrs.add(ia); } catch (AddressException e) { invalids.add(email); } catch (UnsupportedEncodingException e) { invalids.add(email); } } if (!laddrs.isEmpty()) { addrs = laddrs.toArray(addrs); } } return addrs; }
InternetAddress[] function(List<EmailAddress> emails, List<EmailAddress> invalids) { InternetAddress[] addrs = new InternetAddress[0]; if (emails != null && !emails.isEmpty()) { ArrayList<InternetAddress> laddrs = new ArrayList<InternetAddress>(); for (int i = 0; i < emails.size(); i++) { EmailAddress email = emails.get(i); try { InternetAddress ia = new InternetAddress(email.getAddress(), true); ia.setPersonal(email.getPersonal()); laddrs.add(ia); } catch (AddressException e) { invalids.add(email); } catch (UnsupportedEncodingException e) { invalids.add(email); } } if (!laddrs.isEmpty()) { addrs = laddrs.toArray(addrs); } } return addrs; }
/** * Converts a {@link java.util.List} of {@link EmailAddress} to * {@link javax.mail.internet.InternetAddress}. * * @param emails * @return Array will be the same size as the list with converted addresses. If list is null, * the array returned will be 0 length (non-null). * @throws AddressException * @throws UnsupportedEncodingException */
Converts a <code>java.util.List</code> of <code>EmailAddress</code> to <code>javax.mail.internet.InternetAddress</code>
emails2Internets
{ "repo_name": "kingmook/sakai", "path": "kernel/kernel-impl/src/main/java/org/sakaiproject/email/impl/BasicEmailService.java", "license": "apache-2.0", "size": 51869 }
[ "java.io.UnsupportedEncodingException", "java.util.ArrayList", "java.util.List", "javax.mail.internet.AddressException", "javax.mail.internet.InternetAddress", "org.sakaiproject.email.api.EmailAddress" ]
import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import org.sakaiproject.email.api.EmailAddress;
import java.io.*; import java.util.*; import javax.mail.internet.*; import org.sakaiproject.email.api.*;
[ "java.io", "java.util", "javax.mail", "org.sakaiproject.email" ]
java.io; java.util; javax.mail; org.sakaiproject.email;
2,326,633
public void detach() { EventTarget target = (EventTarget) root; target.removeEventListener("DOMNodeRemoved", this, false); done = true; }
void function() { EventTarget target = (EventTarget) root; target.removeEventListener(STR, this, false); done = true; }
/** * <b>DOM L2</b> * Flags the iterator as done, unregistering its event listener so * that the iterator can be garbage collected without relying on weak * references (a "Java 2" feature) in the event subsystem. */
DOM L2 Flags the iterator as done, unregistering its event listener so that the iterator can be garbage collected without relying on weak references (a "Java 2" feature) in the event subsystem
detach
{ "repo_name": "unofficial-opensource-apple/gcc_40", "path": "libjava/gnu/xml/dom/DomIterator.java", "license": "gpl-2.0", "size": 10050 }
[ "org.w3c.dom.events.EventTarget" ]
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.events.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,293,032
@POST @Produces(MediaType.APPLICATION_JSON) @Path("{device}/{port}/{vlan}") public Response provisionSubscriber( @PathParam("device")String device, @PathParam("port")long port, @PathParam("vlan")short vlan) { AccessDeviceService service = get(AccessDeviceService.class); DeviceId deviceId = DeviceId.deviceId(device); PortNumber portNumber = PortNumber.portNumber(port); VlanId vlanId = VlanId.vlanId(vlan); ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); service.provisionSubscriber(connectPoint, vlanId); return ok("").build(); }
@Produces(MediaType.APPLICATION_JSON) @Path(STR) Response function( @PathParam(STR)String device, @PathParam("port")long port, @PathParam("vlan")short vlan) { AccessDeviceService service = get(AccessDeviceService.class); DeviceId deviceId = DeviceId.deviceId(device); PortNumber portNumber = PortNumber.portNumber(port); VlanId vlanId = VlanId.vlanId(vlan); ConnectPoint connectPoint = new ConnectPoint(deviceId, portNumber); service.provisionSubscriber(connectPoint, vlanId); return ok("").build(); }
/** * Provision a subscriber. * * @param device device id * @param port port number * @param vlan vlan id * @return 200 OK */
Provision a subscriber
provisionSubscriber
{ "repo_name": "sonu283304/onos", "path": "apps/olt/app/src/main/java/org/onosproject/olt/rest/OltWebResource.java", "license": "apache-2.0", "size": 2746 }
[ "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.onlab.packet.VlanId", "org.onosproject.net.ConnectPoint", "org.onosproject.net.DeviceId", "org.onosproject.net.PortNumber", "org.onosproject.olt.AccessDeviceService" ]
import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onlab.packet.VlanId; import org.onosproject.net.ConnectPoint; import org.onosproject.net.DeviceId; import org.onosproject.net.PortNumber; import org.onosproject.olt.AccessDeviceService;
import javax.ws.rs.*; import javax.ws.rs.core.*; import org.onlab.packet.*; import org.onosproject.net.*; import org.onosproject.olt.*;
[ "javax.ws", "org.onlab.packet", "org.onosproject.net", "org.onosproject.olt" ]
javax.ws; org.onlab.packet; org.onosproject.net; org.onosproject.olt;
500,895
public void goToThenKill(Class<?> clazz, int flags) { Intent intent = new Intent(this, clazz); intent.addFlags(flags); startActivity(intent); finish(); }
void function(Class<?> clazz, int flags) { Intent intent = new Intent(this, clazz); intent.addFlags(flags); startActivity(intent); finish(); }
/** * startActivity with flags then finish * * @param clazz Activity.class * @param flags FLAG_ACTIVITY */
startActivity with flags then finish
goToThenKill
{ "repo_name": "DragonsQC/QLibrary", "path": "library/src/main/java/com/dqc/qlibrary/activity/QBaseActivity.java", "license": "apache-2.0", "size": 6135 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
348,704
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) { for (BlockStoneSlab.EnumType blockstoneslab$enumtype : BlockStoneSlab.EnumType.values()) { if (blockstoneslab$enumtype != BlockStoneSlab.EnumType.WOOD) { items.add(new ItemStack(this, 1, blockstoneslab$enumtype.getMetadata())); } } }
void function(CreativeTabs itemIn, NonNullList<ItemStack> items) { for (BlockStoneSlab.EnumType blockstoneslab$enumtype : BlockStoneSlab.EnumType.values()) { if (blockstoneslab$enumtype != BlockStoneSlab.EnumType.WOOD) { items.add(new ItemStack(this, 1, blockstoneslab$enumtype.getMetadata())); } } }
/** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */
returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
getSubBlocks
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockStoneSlab.java", "license": "gpl-3.0", "size": 7231 }
[ "net.minecraft.creativetab.CreativeTabs", "net.minecraft.item.ItemStack", "net.minecraft.util.NonNullList" ]
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList;
import net.minecraft.creativetab.*; import net.minecraft.item.*; import net.minecraft.util.*;
[ "net.minecraft.creativetab", "net.minecraft.item", "net.minecraft.util" ]
net.minecraft.creativetab; net.minecraft.item; net.minecraft.util;
1,840,842
private static void verifyJUnit4Present() { try { Class<?> clazz = Class.forName("org.junit.runner.Description"); if (!Serializable.class.isAssignableFrom(clazz)) { JvmExit.halt(SlaveMain.ERR_OLD_JUNIT); } } catch (ClassNotFoundException e) { JvmExit.halt(SlaveMain.ERR_NO_JUNIT); } }
static void function() { try { Class<?> clazz = Class.forName(STR); if (!Serializable.class.isAssignableFrom(clazz)) { JvmExit.halt(SlaveMain.ERR_OLD_JUNIT); } } catch (ClassNotFoundException e) { JvmExit.halt(SlaveMain.ERR_NO_JUNIT); } }
/** * Verify JUnit presence and version. */
Verify JUnit presence and version
verifyJUnit4Present
{ "repo_name": "randomizedtesting/randomizedtesting", "path": "junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/slave/SlaveMainSafe.java", "license": "apache-2.0", "size": 988 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
394,669
public Uri getUri() { return uri; }
Uri function() { return uri; }
/** * Gets the uri of the file * * @return a URI value representing a file's location. Currently, it only supports local files */
Gets the uri of the file
getUri
{ "repo_name": "smartdevicelink/sdl_android", "path": "android/sdl_android/src/main/java/com/smartdevicelink/managers/file/filetypes/SdlFile.java", "license": "bsd-3-clause", "size": 13647 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
1,316,664
public synchronized void clear() { rowModel.rowList.clear(); rowModel.colNames.clear(); rowModel.colCount = 0; formats = new java.util.Hashtable<Integer, DecimalFormat>(); refreshTable(); }
synchronized void function() { rowModel.rowList.clear(); rowModel.colNames.clear(); rowModel.colCount = 0; formats = new java.util.Hashtable<Integer, DecimalFormat>(); refreshTable(); }
/** * Clears data, column names, and format patterns. */
Clears data, column names, and format patterns
clear
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/display/DataRowTable.java", "license": "gpl-3.0", "size": 12041 }
[ "java.text.DecimalFormat" ]
import java.text.DecimalFormat;
import java.text.*;
[ "java.text" ]
java.text;
2,527,438
@Nonnull private JsonArray<Token> parseLine(State parserState, String lineText) throws ParserException { boolean endsWithNewline = lineText.endsWith("\n"); lineText = endsWithNewline ? lineText.substring(0, lineText.length() - 1) : lineText; String tail = null; if (lineText.length() > LINE_LENGTH_LIMIT) { tail = lineText.substring(LINE_LENGTH_LIMIT); lineText = lineText.substring(0, LINE_LENGTH_LIMIT); } try { Stream stream = codeMirrorParser.createStream(lineText); JsonArray<Token> tokens = JsonCollections.createArray(); while (!stream.isEnd()) { codeMirrorParser.parseNext(stream, parserState, tokens); } if (tail != null) { tokens.add(new Token(codeMirrorParser.getName(parserState), TokenType.ERROR, tail)); } if (endsWithNewline) { tokens.add(Token.NEWLINE); } return tokens; } catch (Throwable t) { throw new ParserException(t); } }
JsonArray<Token> function(State parserState, String lineText) throws ParserException { boolean endsWithNewline = lineText.endsWith("\n"); lineText = endsWithNewline ? lineText.substring(0, lineText.length() - 1) : lineText; String tail = null; if (lineText.length() > LINE_LENGTH_LIMIT) { tail = lineText.substring(LINE_LENGTH_LIMIT); lineText = lineText.substring(0, LINE_LENGTH_LIMIT); } try { Stream stream = codeMirrorParser.createStream(lineText); JsonArray<Token> tokens = JsonCollections.createArray(); while (!stream.isEnd()) { codeMirrorParser.parseNext(stream, parserState, tokens); } if (tail != null) { tokens.add(new Token(codeMirrorParser.getName(parserState), TokenType.ERROR, tail)); } if (endsWithNewline) { tokens.add(Token.NEWLINE); } return tokens; } catch (Throwable t) { throw new ParserException(t); } }
/** * Parse line text and return tokens. * * <p>New line char at the end of line is transformed to newline token. */
Parse line text and return tokens. New line char at the end of line is transformed to newline token
parseLine
{ "repo_name": "PP888/collide", "path": "java/com/google/collide/client/documentparser/DocumentParserWorker.java", "license": "apache-2.0", "size": 10050 }
[ "com.google.collide.codemirror2.State", "com.google.collide.codemirror2.Stream", "com.google.collide.codemirror2.Token", "com.google.collide.codemirror2.TokenType", "com.google.collide.json.shared.JsonArray", "com.google.collide.shared.util.JsonCollections" ]
import com.google.collide.codemirror2.State; import com.google.collide.codemirror2.Stream; import com.google.collide.codemirror2.Token; import com.google.collide.codemirror2.TokenType; import com.google.collide.json.shared.JsonArray; import com.google.collide.shared.util.JsonCollections;
import com.google.collide.codemirror2.*; import com.google.collide.json.shared.*; import com.google.collide.shared.util.*;
[ "com.google.collide" ]
com.google.collide;
904,648
public static void removePersonsFromRoles(Integer projectID, Integer roleID, List<Integer> personIDs) { if (projectID!=null && roleID!=null && personIDs!=null && !personIDs.isEmpty()) { for (Integer personID : personIDs) { AccessControlBL.deleteByProjectRolePerson(projectID, roleID, personID); } } }
static void function(Integer projectID, Integer roleID, List<Integer> personIDs) { if (projectID!=null && roleID!=null && personIDs!=null && !personIDs.isEmpty()) { for (Integer personID : personIDs) { AccessControlBL.deleteByProjectRolePerson(projectID, roleID, personID); } } }
/** * Remove persons from roles in project * @param projectID * @param roleID * @param personIDs */
Remove persons from roles in project
removePersonsFromRoles
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/admin/project/assignments/RoleAssignmentsBL.java", "license": "gpl-3.0", "size": 12723 }
[ "com.aurel.track.accessControl.AccessControlBL", "java.util.List" ]
import com.aurel.track.accessControl.AccessControlBL; import java.util.List;
import com.aurel.track.*; import java.util.*;
[ "com.aurel.track", "java.util" ]
com.aurel.track; java.util;
1,654,270
public Set<TrackElement> getAllValuesOfsw() { return rawAccumulateAllValuesOfsw(emptyArray()); }
Set<TrackElement> function() { return rawAccumulateAllValuesOfsw(emptyArray()); }
/** * Retrieve the set of values that occur in matches for sw. * @return the Set of all values or empty set if there are no matches * */
Retrieve the set of values that occur in matches for sw
getAllValuesOfsw
{ "repo_name": "FTSRG/trainbenchmark", "path": "trainbenchmark-tool-viatra-patterns/src-gen/hu/bme/mit/trainbenchmark/benchmark/viatra/HasSensorMatcher.java", "license": "epl-1.0", "size": 8768 }
[ "hu.bme.mit.trainbenchmark.railway.TrackElement", "java.util.Set" ]
import hu.bme.mit.trainbenchmark.railway.TrackElement; import java.util.Set;
import hu.bme.mit.trainbenchmark.railway.*; import java.util.*;
[ "hu.bme.mit", "java.util" ]
hu.bme.mit; java.util;
1,814,655
public List<GKAEdge> shortesPathBroad(String source, String target); public List<GKAEdge> dijkstra(String source, String target);
List<GKAEdge> shortesPathBroad(String source, String target); public List<GKAEdge> function(String source, String target);
/** * Find the way with the smallest Weight from Source to Target * @param source * @param target * @return */
Find the way with the smallest Weight from Source to Target
dijkstra
{ "repo_name": "JanaWengenroth/GKA1", "path": "Project/src/GKA/Graph/GKAGraphInterface.java", "license": "gpl-2.0", "size": 2880 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,525,240
@Override public Adapter createHasHeaderAdapter() { if (hasHeaderItemProvider == null) { hasHeaderItemProvider = new HasHeaderItemProvider(this); } return hasHeaderItemProvider; } protected LengthValidatorItemProvider lengthValidatorItemProvider;
Adapter function() { if (hasHeaderItemProvider == null) { hasHeaderItemProvider = new HasHeaderItemProvider(this); } return hasHeaderItemProvider; } protected LengthValidatorItemProvider lengthValidatorItemProvider;
/** * This creates an adapter for a {@link org.wso2.developerstudio.eclipse.ds.HasHeader}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>org.wso2.developerstudio.eclipse.ds.HasHeader</code>.
createHasHeaderAdapter
{ "repo_name": "harsha1979/developer-studio", "path": "data-services/org.wso2.developerstudio.eclipse.ds.edit/src/org/wso2/developerstudio/eclipse/ds/provider/DsItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 32352 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
894,351
public static boolean putDropInInventoryAllSlots(IInventory source, IInventory destination, EntityItem entity) { boolean flag = false; if (entity == null) { return false; } else { ItemStack itemstack = entity.getItem().copy(); ItemStack itemstack1 = putStackInInventoryAllSlots(source, destination, itemstack, (EnumFacing)null); if (itemstack1.isEmpty()) { flag = true; entity.setDead(); } else { entity.setItem(itemstack1); } return flag; } }
static boolean function(IInventory source, IInventory destination, EntityItem entity) { boolean flag = false; if (entity == null) { return false; } else { ItemStack itemstack = entity.getItem().copy(); ItemStack itemstack1 = putStackInInventoryAllSlots(source, destination, itemstack, (EnumFacing)null); if (itemstack1.isEmpty()) { flag = true; entity.setDead(); } else { entity.setItem(itemstack1); } return flag; } }
/** * Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible. Returns false * if the stackSize of the drop was not depleted. */
Attempts to place the passed EntityItem's stack into the inventory using as many slots as possible. Returns false if the stackSize of the drop was not depleted
putDropInInventoryAllSlots
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/tileentity/TileEntityHopper.java", "license": "gpl-3.0", "size": 21214 }
[ "net.minecraft.entity.item.EntityItem", "net.minecraft.inventory.IInventory", "net.minecraft.item.ItemStack", "net.minecraft.util.EnumFacing" ]
import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing;
import net.minecraft.entity.item.*; import net.minecraft.inventory.*; import net.minecraft.item.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.inventory", "net.minecraft.item", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.inventory; net.minecraft.item; net.minecraft.util;
1,535,793
public void setEnabled(int intEnabled, boolean bRepaint) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setEnabled", intEnabled, bRepaint); ScriptSessions.addScript(script); }
void function(int intEnabled, boolean bRepaint) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + STR, intEnabled, bRepaint); ScriptSessions.addScript(script); }
/** * Sets whether this control is enabled. Disabled controls do not respond to user interaction. * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is equivalent to <code>STATEENABLED</code>. * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting. */
Sets whether this control is enabled. Disabled controls do not respond to user interaction
setEnabled
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/gui/ToolbarButton.java", "license": "apache-2.0", "size": 32579 }
[ "org.directwebremoting.ScriptBuffer", "org.directwebremoting.ScriptSessions" ]
import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions;
import org.directwebremoting.*;
[ "org.directwebremoting" ]
org.directwebremoting;
586,595
public void openChannel(Ssh2Channel channel, byte[] requestdata) throws SshException, ChannelOpenException { verifyConnection(true); connection.openChannel(channel, requestdata); }
void function(Ssh2Channel channel, byte[] requestdata) throws SshException, ChannelOpenException { verifyConnection(true); connection.openChannel(channel, requestdata); }
/** * Additional method to open a custom SSH2 channel. * * @param channel * the channel to open * @param requestdata * the request data * @throws SshException * @throws ChannelOpenException */
Additional method to open a custom SSH2 channel
openChannel
{ "repo_name": "sshtools/j2ssh-maverick", "path": "j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Client.java", "license": "lgpl-3.0", "size": 32107 }
[ "com.sshtools.ssh.ChannelOpenException", "com.sshtools.ssh.SshException" ]
import com.sshtools.ssh.ChannelOpenException; import com.sshtools.ssh.SshException;
import com.sshtools.ssh.*;
[ "com.sshtools.ssh" ]
com.sshtools.ssh;
2,664,397
void afterLogout(final MFSession session);
void afterLogout(final MFSession session);
/** * Called after Logout (note, at this moment session is closed) * * @param session */
Called after Logout (note, at this moment session is closed)
afterLogout
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/base/src/main/java/org/adempiere/ad/security/IUserLoginListener.java", "license": "gpl-2.0", "size": 1572 }
[ "org.adempiere.ad.session.MFSession" ]
import org.adempiere.ad.session.MFSession;
import org.adempiere.ad.session.*;
[ "org.adempiere.ad" ]
org.adempiere.ad;
838,257
public static XContentType guessBodyContentType(final RestRequest request) { final BytesReference restContent = RestActions.getRestContent(request); if (restContent == null) { return null; } return XContentFactory.xContentType(restContent); }
static XContentType function(final RestRequest request) { final BytesReference restContent = RestActions.getRestContent(request); if (restContent == null) { return null; } return XContentFactory.xContentType(restContent); }
/** * guesses the content type from either payload or source parameter * @param request Rest request * @return rest content type or <code>null</code> if not applicable. */
guesses the content type from either payload or source parameter
guessBodyContentType
{ "repo_name": "ESamir/elasticsearch", "path": "core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java", "license": "apache-2.0", "size": 8039 }
[ "org.elasticsearch.common.bytes.BytesReference", "org.elasticsearch.common.xcontent.XContentFactory", "org.elasticsearch.common.xcontent.XContentType", "org.elasticsearch.rest.RestRequest" ]
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.common.bytes.*; import org.elasticsearch.common.xcontent.*; import org.elasticsearch.rest.*;
[ "org.elasticsearch.common", "org.elasticsearch.rest" ]
org.elasticsearch.common; org.elasticsearch.rest;
1,610,007
public static Collection<String> nodeId8s(@Nullable Collection<? extends ClusterNode> nodes) { if (nodes == null || nodes.isEmpty()) return Collections.emptyList(); return F.viewReadOnly(nodes, NODE2ID8); }
static Collection<String> function(@Nullable Collection<? extends ClusterNode> nodes) { if (nodes == null nodes.isEmpty()) return Collections.emptyList(); return F.viewReadOnly(nodes, NODE2ID8); }
/** * Convenient utility method that returns collection of node ID8s for a given * collection of grid nodes. ID8 is a shorter string representation of node ID, * mainly the first 8 characters. * <p> * Note that this method doesn't create a new collection but simply iterates * over the input one. * * @param nodes Collection of grid nodes. * @return Collection of node IDs for given collection of grid nodes. */
Convenient utility method that returns collection of node ID8s for a given collection of grid nodes. ID8 is a shorter string representation of node ID, mainly the first 8 characters. Note that this method doesn't create a new collection but simply iterates over the input one
nodeId8s
{ "repo_name": "dlnufox/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java", "license": "apache-2.0", "size": 157742 }
[ "java.util.Collection", "java.util.Collections", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.util.typedef.F", "org.jetbrains.annotations.Nullable" ]
import java.util.Collection; import java.util.Collections; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.typedef.F; import org.jetbrains.annotations.Nullable;
import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*;
[ "java.util", "org.apache.ignite", "org.jetbrains.annotations" ]
java.util; org.apache.ignite; org.jetbrains.annotations;
1,669,975
@Authorized( { PrivilegeConstants.MANAGE_LOCATION_TAGS }) public LocationTag unretireLocationTag(LocationTag tag) throws APIException;
@Authorized( { PrivilegeConstants.MANAGE_LOCATION_TAGS }) LocationTag function(LocationTag tag) throws APIException;
/** * Unretire the given location tag. This restores a previously retired tag back into circulation * and use. * * @param tag * @return the newly unretired location tag * @throws APIException * @should unretire retired location tag * @since 1.5 */
Unretire the given location tag. This restores a previously retired tag back into circulation and use
unretireLocationTag
{ "repo_name": "nilusi/Legacy-UI", "path": "api/src/main/java/org/openmrs/api/LocationService.java", "license": "mpl-2.0", "size": 20370 }
[ "org.openmrs.LocationTag", "org.openmrs.annotation.Authorized", "org.openmrs.util.PrivilegeConstants" ]
import org.openmrs.LocationTag; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants;
import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*;
[ "org.openmrs", "org.openmrs.annotation", "org.openmrs.util" ]
org.openmrs; org.openmrs.annotation; org.openmrs.util;
84,333
public Builder withCheckDelay(@Nullable final Long checkDelay) { this.bCheckDelay = checkDelay; return this; }
Builder function(@Nullable final Long checkDelay) { this.bCheckDelay = checkDelay; return this; }
/** * Set the amount of time (in milliseconds) to delay between checks of the process. * * @param checkDelay The check delay to use * @return The builder */
Set the amount of time (in milliseconds) to delay between checks of the process
withCheckDelay
{ "repo_name": "Netflix/genie", "path": "genie-common/src/main/java/com/netflix/genie/common/dto/JobExecution.java", "license": "apache-2.0", "size": 8412 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,370,873
CompletableFuture<JsonObject> getInternalInfoAsync(String destination); /** * Get the stats for the partitioned topic * <p> * Response Example: * * <pre> * <code> * { * "msgRateIn" : 100.0, // Total rate of messages published on the partitioned topic. msg/s * "msgThroughputIn" : 10240.0, // Total throughput of messages published on the partitioned topic. byte/s * "msgRateOut" : 100.0, // Total rate of messages delivered on the partitioned topic. msg/s * "msgThroughputOut" : 10240.0, // Total throughput of messages delivered on the partitioned topic. byte/s * "averageMsgSize" : 1024.0, // Average size of published messages. bytes * "publishers" : [ // List of publishes on this partitioned topic with their stats * { * "msgRateIn" : 100.0, // Total rate of messages published by this producer. msg/s * "msgThroughputIn" : 10240.0, // Total throughput of messages published by this producer. byte/s * "averageMsgSize" : 1024.0, // Average size of published messages by this producer. bytes * }, * ], * "subscriptions" : { // Map of subscriptions on this topic * "sub1" : { * "msgRateOut" : 100.0, // Total rate of messages delivered on this subscription. msg/s * "msgThroughputOut" : 10240.0, // Total throughput delivered on this subscription. bytes/s * "msgBacklog" : 0, // Number of messages in the subscriotion backlog * "type" : Exclusive // Whether the subscription is exclusive or shared * "consumers" [ // List of consumers on this subscription * { * "msgRateOut" : 100.0, // Total rate of messages delivered to this consumer. msg/s * "msgThroughputOut" : 10240.0, // Total throughput delivered to this consumer. bytes/s * } * ], * }, * "replication" : { // Replication statistics * "cluster_1" : { // Cluster name in the context of from-cluster or to-cluster * "msgRateIn" : 100.0, // Total rate of messages received from this remote cluster. msg/s * "msgThroughputIn" : 10240.0, // Total throughput received from this remote cluster. bytes/s * "msgRateOut" : 100.0, // Total rate of messages delivered to the replication-subscriber. msg/s * "msgThroughputOut" : 10240.0, // Total throughput delivered to the replication-subscriber. bytes/s * "replicationBacklog" : 0, // Number of messages pending to be replicated to this remote cluster * "connected" : true, // Whether the replication-subscriber is currently connected locally * }, * "cluster_2" : { * "msgRateIn" : 100.0, * "msgThroughputIn" : 10240.0, * "msgRateOut" : 100.0, * "msghroughputOut" : 10240.0, * "replicationBacklog" : 0, * "connected" : true, * } * }, * }
CompletableFuture<JsonObject> getInternalInfoAsync(String destination); /** * Get the stats for the partitioned topic * <p> * Response Example: * * <pre> * <code> * { * STR : 100.0, * STR : 10240.0, * STR : 100.0, * STR : 10240.0, * STR : 1024.0, * STR : [ * { * STR : 100.0, * STR : 10240.0, * STR : 1024.0, * }, * ], * STR : { * "sub1" : { * STR : 100.0, * STR : 10240.0, * STR : 0, * "type" : Exclusive * STR [ * { * STR : 100.0, * STR : 10240.0, * } * ], * }, * STR : { * STR : { * STR : 100.0, * STR : 10240.0, * STR : 100.0, * STR : 10240.0, * STR : 0, * STR : true, * }, * STR : { * STR : 100.0, * STR : 10240.0, * STR : 100.0, * STR : 10240.0, * STR : 0, * STR : true, * } * }, * }
/** * Get a JSON representation of the topic metadata stored in ZooKeeper * * @param destination * Destination name * @return a future to receive the topic internal metadata * @throws NotAuthorizedException * Don't have admin permission * @throws NotFoundException * Topic does not exist * @throws PulsarAdminException * Unexpected error */
Get a JSON representation of the topic metadata stored in ZooKeeper
getInternalInfoAsync
{ "repo_name": "tkb77/pulsar", "path": "pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/PersistentTopics.java", "license": "apache-2.0", "size": 31213 }
[ "com.google.gson.JsonObject", "java.util.concurrent.CompletableFuture" ]
import com.google.gson.JsonObject; import java.util.concurrent.CompletableFuture;
import com.google.gson.*; import java.util.concurrent.*;
[ "com.google.gson", "java.util" ]
com.google.gson; java.util;
1,997,844
public static final Date convertStringToDate(String aMask, String strDate) throws ParseException { SimpleDateFormat df = null; Date date = null; df = new SimpleDateFormat(aMask); if (log.isDebugEnabled()) { log.debug("converting '" + strDate + "' to date with mask '" + aMask + "'"); } try { date = df.parse(strDate); } catch (ParseException pe) { // log.error("ParseException: " + pe); throw new ParseException(pe.getMessage(), pe.getErrorOffset()); } return (date); }
static final Date function(String aMask, String strDate) throws ParseException { SimpleDateFormat df = null; Date date = null; df = new SimpleDateFormat(aMask); if (log.isDebugEnabled()) { log.debug(STR + strDate + STR + aMask + "'"); } try { date = df.parse(strDate); } catch (ParseException pe) { throw new ParseException(pe.getMessage(), pe.getErrorOffset()); } return (date); }
/** * This method generates a string representation of a date/time in the * format you specify on input. * * @param aMask * the date pattern the string is in * @param strDate * a string representation of a date * @return a converted Date object * @throws ParseException * the parse exception * @see java.text.SimpleDateFormat */
This method generates a string representation of a date/time in the format you specify on input
convertStringToDate
{ "repo_name": "8090boy/gomall.la", "path": "legendshop_util/src/java/com/legendshop/util/converter/ConvertDateUtil.java", "license": "apache-2.0", "size": 5448 }
[ "java.text.ParseException", "java.text.SimpleDateFormat", "java.util.Date" ]
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
571,724
public static long copyLarge(InputStream input, OutputStream output, long inputOffset, long length) throws IOException { return copyLarge(input, output, inputOffset, length, new byte[DEFAULT_BUFFER_SIZE]); }
static long function(InputStream input, OutputStream output, long inputOffset, long length) throws IOException { return copyLarge(input, output, inputOffset, length, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Copy some or all bytes from a large (over 2GB) <code>InputStream</code> to an * <code>OutputStream</code>, optionally skipping input bytes. * <p/> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * <p/> * The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}. * * @param input the <code>InputStream</code> to read from * @param output the <code>OutputStream</code> to write to * @param inputOffset : number of bytes to skip from input before copying * -ve values are ignored * @param length : number of bytes to copy. -ve means all * @return the number of bytes copied * @throws NullPointerException if the input or output is null * @throws IOException if an I/O error occurs * @since 2.2 */
Copy some or all bytes from a large (over 2GB) <code>InputStream</code> to an <code>OutputStream</code>, optionally skipping input bytes. This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>. The buffer size is given by <code>#DEFAULT_BUFFER_SIZE</code>
copyLarge
{ "repo_name": "solaris0403/SeleneDemo", "path": "common_lib/src/main/java/com/tony/selene/common/trinea/android/common/io/IOUtil.java", "license": "gpl-2.0", "size": 95443 }
[ "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
347,778
public static SimpleString getDefaultManagementAddress() { return DEFAULT_MANAGEMENT_ADDRESS; }
static SimpleString function() { return DEFAULT_MANAGEMENT_ADDRESS; }
/** * the name of the management address to send management messages to. It is prefixed with "jms.queue" so that JMS clients can send messages to it. */
the name of the management address to send management messages to. It is prefixed with "jms.queue" so that JMS clients can send messages to it
getDefaultManagementAddress
{ "repo_name": "jbertram/activemq-artemis-old", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java", "license": "apache-2.0", "size": 38079 }
[ "org.apache.activemq.artemis.api.core.SimpleString" ]
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.*;
[ "org.apache.activemq" ]
org.apache.activemq;
2,079,005
private long getFreeRAM() throws CommandFailedException { DeviceProfiler profiler = new DeviceProfiler(wrappedDevice); try { Map<String, Long> memUsage = profiler.getMeminfoDataset(); long freeMemory = memUsage.get(DeviceProfiler.FREE_MEMORY_ID); return freeMemory; } catch (IOException | TimeoutException | AdbCommandRejectedException | ShellCommandUnresponsiveException e) { LOGGER.warn("Getting device '" + wrappedDevice.getSerialNumber() + "' memory usage resulted in exception.", e); throw new CommandFailedException("Getting device memory usage resulted in exception.", e); } }
long function() throws CommandFailedException { DeviceProfiler profiler = new DeviceProfiler(wrappedDevice); try { Map<String, Long> memUsage = profiler.getMeminfoDataset(); long freeMemory = memUsage.get(DeviceProfiler.FREE_MEMORY_ID); return freeMemory; } catch (IOException TimeoutException AdbCommandRejectedException ShellCommandUnresponsiveException e) { LOGGER.warn(STR + wrappedDevice.getSerialNumber() + STR, e); throw new CommandFailedException(STR, e); } }
/** * Gets the amount of free RAM on the device. * * @return Memory amount in MB. * @throws CommandFailedException * In case of an error in the execution */
Gets the amount of free RAM on the device
getFreeRAM
{ "repo_name": "MusalaSoft/atmosphere-agent", "path": "src/main/java/com/musala/atmosphere/agent/devicewrapper/AbstractWrapDevice.java", "license": "gpl-3.0", "size": 61687 }
[ "com.android.ddmlib.AdbCommandRejectedException", "com.android.ddmlib.ShellCommandUnresponsiveException", "com.android.ddmlib.TimeoutException", "com.musala.atmosphere.agent.devicewrapper.util.DeviceProfiler", "com.musala.atmosphere.commons.exceptions.CommandFailedException", "java.io.IOException", "java.util.Map" ]
import com.android.ddmlib.AdbCommandRejectedException; import com.android.ddmlib.ShellCommandUnresponsiveException; import com.android.ddmlib.TimeoutException; import com.musala.atmosphere.agent.devicewrapper.util.DeviceProfiler; import com.musala.atmosphere.commons.exceptions.CommandFailedException; import java.io.IOException; import java.util.Map;
import com.android.ddmlib.*; import com.musala.atmosphere.agent.devicewrapper.util.*; import com.musala.atmosphere.commons.exceptions.*; import java.io.*; import java.util.*;
[ "com.android.ddmlib", "com.musala.atmosphere", "java.io", "java.util" ]
com.android.ddmlib; com.musala.atmosphere; java.io; java.util;
626,388
Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException;
Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException;
/** * Add the given <code>{@link org.quartz.jobs.JobDetail}</code> to the Scheduler, and associate the given <code>{@link OperableTrigger}</code> with * it. * <p> * If the given Trigger does not reference any <code>Job</code>, then it will be set to reference the Job passed with it into this method. * </p> * * @throws SchedulerException if the Job or Trigger cannot be added to the Scheduler, or there is an internal Scheduler error. */
Add the given <code><code>org.quartz.jobs.JobDetail</code></code> to the Scheduler, and associate the given <code><code>OperableTrigger</code></code> with it. If the given Trigger does not reference any <code>Job</code>, then it will be set to reference the Job passed with it into this method.
scheduleJob
{ "repo_name": "micke-a/Sundial", "path": "src/main/java/org/quartz/core/Scheduler.java", "license": "apache-2.0", "size": 14322 }
[ "java.util.Date", "org.quartz.exceptions.SchedulerException", "org.quartz.jobs.JobDetail", "org.quartz.triggers.OperableTrigger" ]
import java.util.Date; import org.quartz.exceptions.SchedulerException; import org.quartz.jobs.JobDetail; import org.quartz.triggers.OperableTrigger;
import java.util.*; import org.quartz.exceptions.*; import org.quartz.jobs.*; import org.quartz.triggers.*;
[ "java.util", "org.quartz.exceptions", "org.quartz.jobs", "org.quartz.triggers" ]
java.util; org.quartz.exceptions; org.quartz.jobs; org.quartz.triggers;
131,582
public CmsADECache getCache() { return m_cache; }
CmsADECache function() { return m_cache; }
/** * Gets the containerpage cache instance.<p> * * @return the containerpage cache instance */
Gets the containerpage cache instance
getCache
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/ade/configuration/CmsADEManager.java", "license": "lgpl-2.1", "size": 50482 }
[ "org.opencms.xml.containerpage.CmsADECache" ]
import org.opencms.xml.containerpage.CmsADECache;
import org.opencms.xml.containerpage.*;
[ "org.opencms.xml" ]
org.opencms.xml;
548,133
public int refreshNodes() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy: proxies) { proxy.getProxy().refreshNodes(); System.out.println("Refresh nodes successful for " + proxy.getAddress()); } } else { dfs.refreshNodes(); System.out.println("Refresh nodes successful"); } exitCode = 0; return exitCode; }
int function() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy: proxies) { proxy.getProxy().refreshNodes(); System.out.println(STR + proxy.getAddress()); } } else { dfs.refreshNodes(); System.out.println(STR); } exitCode = 0; return exitCode; }
/** * Command to ask the namenode to reread the hosts and excluded hosts * file. * Usage: hdfs dfsadmin -refreshNodes * @exception IOException */
Command to ask the namenode to reread the hosts and excluded hosts file. Usage: hdfs dfsadmin -refreshNodes
refreshNodes
{ "repo_name": "vesense/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java", "license": "apache-2.0", "size": 74442 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hdfs.DistributedFileSystem", "org.apache.hadoop.hdfs.HAUtil", "org.apache.hadoop.hdfs.NameNodeProxies", "org.apache.hadoop.hdfs.protocol.ClientProtocol" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.HAUtil; import org.apache.hadoop.hdfs.NameNodeProxies; import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,436,962
public void addInitializers(ApplicationContextInitializer<?>... initializers) { this.initializers.addAll(Arrays.asList(initializers)); }
void function(ApplicationContextInitializer<?>... initializers) { this.initializers.addAll(Arrays.asList(initializers)); }
/** * Add {@link ApplicationContextInitializer}s to be applied to the Spring * {@link ApplicationContext}. * @param initializers the initializers to add */
Add <code>ApplicationContextInitializer</code>s to be applied to the Spring <code>ApplicationContext</code>
addInitializers
{ "repo_name": "vandan16/Vandan", "path": "spring-boot/src/main/java/org/springframework/boot/SpringApplication.java", "license": "apache-2.0", "size": 36408 }
[ "java.util.Arrays", "org.springframework.context.ApplicationContextInitializer" ]
import java.util.Arrays; import org.springframework.context.ApplicationContextInitializer;
import java.util.*; import org.springframework.context.*;
[ "java.util", "org.springframework.context" ]
java.util; org.springframework.context;
1,930,241
public List<P2SVpnServerConfigurationInner> p2SVpnServerConfigurations() { return this.p2SVpnServerConfigurations; }
List<P2SVpnServerConfigurationInner> function() { return this.p2SVpnServerConfigurations; }
/** * Get list of all P2SVpnServerConfigurations associated with the virtual wan. * * @return the p2SVpnServerConfigurations value */
Get list of all P2SVpnServerConfigurations associated with the virtual wan
p2SVpnServerConfigurations
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/VirtualWANInner.java", "license": "mit", "size": 8561 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,689,075
public boolean requiresInputMaxSize(){ return (ColumnType.STRING.equals(type) || ColumnType.LINK.equals(type)); }
boolean function(){ return (ColumnType.STRING.equals(type) ColumnType.LINK.equals(type)); }
/** * Does this type require an input maximum size? * * @return */
Does this type require an input maximum size
requiresInputMaxSize
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "lib/lib-table-cluster/src/main/java/org/sagebionetworks/table/cluster/ColumnTypeInfo.java", "license": "apache-2.0", "size": 5462 }
[ "org.sagebionetworks.repo.model.table.ColumnType" ]
import org.sagebionetworks.repo.model.table.ColumnType;
import org.sagebionetworks.repo.model.table.*;
[ "org.sagebionetworks.repo" ]
org.sagebionetworks.repo;
1,822,841
public File getReportResourcesDirectory() { return xmlResourcesDirectory; }
File function() { return xmlResourcesDirectory; }
/** * By default, the report resources directory is * given by a configuration variable. */
By default, the report resources directory is given by a configuration variable
getReportResourcesDirectory
{ "repo_name": "Uni-Sol/batik", "path": "test-sources/org/apache/batik/test/xml/XMLTestReportProcessor.java", "license": "apache-2.0", "size": 20787 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,300,117
public static <K, V extends Comparable<V>> List<Entry<K, V>> sortByValue(Map<K, V> map) { List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>(map.entrySet()); Collections.sort(entries, new ByValue<K, V>()); return entries; }
static <K, V extends Comparable<V>> List<Entry<K, V>> function(Map<K, V> map) { List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>(map.entrySet()); Collections.sort(entries, new ByValue<K, V>()); return entries; }
/** * Generic method to sort a map by value * @param <K> * @param <V> * @param map * @return */
Generic method to sort a map by value
sortByValue
{ "repo_name": "guiquanz/seldon-server", "path": "web-item-importer/src/main/java/io/seldon/utils/CollectionTools.java", "license": "apache-2.0", "size": 6104 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "java.util.Map" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,237,632
public UserAgentParser loadParser() throws IOException, ParseException { // Use all default fields final Set<BrowsCapField> defaultFields = Stream.of(BrowsCapField.values()).filter(BrowsCapField::isDefault).collect(toSet()); return createParserWithFields(defaultFields); }
UserAgentParser function() throws IOException, ParseException { final Set<BrowsCapField> defaultFields = Stream.of(BrowsCapField.values()).filter(BrowsCapField::isDefault).collect(toSet()); return createParserWithFields(defaultFields); }
/** * Returns a parser based on the bundled BrowsCap version * @return the user agent parser */
Returns a parser based on the bundled BrowsCap version
loadParser
{ "repo_name": "blueconic/browscap-java", "path": "src/main/java/com/blueconic/browscap/UserAgentService.java", "license": "mit", "size": 4244 }
[ "java.io.IOException", "java.util.Set", "java.util.stream.Stream" ]
import java.io.IOException; import java.util.Set; import java.util.stream.Stream;
import java.io.*; import java.util.*; import java.util.stream.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,743,583
public void setCharset(Charset charset) { this.charset = charset; } /** * Converts a byte array into an {@link OSCPacket}
void function(Charset charset) { this.charset = charset; } /** * Converts a byte array into an {@link OSCPacket}
/** * Sets the character set used to decode message addresses * and string parameters. * @param charset the desired character-encoding-set to be used by this converter */
Sets the character set used to decode message addresses and string parameters
setCharset
{ "repo_name": "mzed/wekimini", "path": "src/com/illposed/osc/utility/OSCByteArrayToJavaConverter.java", "license": "gpl-2.0", "size": 13963 }
[ "com.illposed.osc.OSCPacket", "java.nio.charset.Charset" ]
import com.illposed.osc.OSCPacket; import java.nio.charset.Charset;
import com.illposed.osc.*; import java.nio.charset.*;
[ "com.illposed.osc", "java.nio" ]
com.illposed.osc; java.nio;
2,799,564
public ReferenceLinker getReferenceLinker() { return referenceLinker; }
ReferenceLinker function() { return referenceLinker; }
/** * Gets the reference linker. * * @return the reference linker. */
Gets the reference linker
getReferenceLinker
{ "repo_name": "geothomasp/kualico-rice-kc", "path": "rice-framework/krad-data/src/main/java/org/kuali/rice/krad/data/provider/impl/ProviderBasedDataObjectService.java", "license": "apache-2.0", "size": 12484 }
[ "org.kuali.rice.krad.data.util.ReferenceLinker" ]
import org.kuali.rice.krad.data.util.ReferenceLinker;
import org.kuali.rice.krad.data.util.*;
[ "org.kuali.rice" ]
org.kuali.rice;
2,149,249
public static long max(long... array) { checkArgument(array.length > 0); long max = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] > max) { max = array[i]; } } return max; }
static long function(long... array) { checkArgument(array.length > 0); long max = array[0]; for (int i = 1; i < array.length; i++) { if (array[i] > max) { max = array[i]; } } return max; }
/** * Returns the greatest value present in {@code array}. * * @param array a <i>nonempty</i> array of {@code long} values * @return the value present in {@code array} that is greater than or equal to * every other value in the array * @throws IllegalArgumentException if {@code array} is empty */
Returns the greatest value present in array
max
{ "repo_name": "cogitate/guava-libraries", "path": "guava/src/com/google/common/primitives/Longs.java", "license": "apache-2.0", "size": 21989 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,594,442
final File outputDir = new File(dir); if (!outputDir.isDirectory()) { TextUi.errorPrint("Output directory: " + outputDir + " does not exist!"); if (!outputDir.mkdirs()) { TextUi.errorPrint("Creation of output directory: " + outputDir + " unsuccessful."); System.exit(1); } else { return outputDir; } } return outputDir; }
final File outputDir = new File(dir); if (!outputDir.isDirectory()) { TextUi.errorPrint(STR + outputDir + STR); if (!outputDir.mkdirs()) { TextUi.errorPrint(STR + outputDir + STR); System.exit(1); } else { return outputDir; } } return outputDir; }
/** * Guarantees that a given directory exists or exits!!! * * @param dir * @return */
Guarantees that a given directory exists or exits!!
guaranteeDirectory
{ "repo_name": "NetMoc/Yaes", "path": "src/main/java/yaes/util/DirUtil.java", "license": "apache-2.0", "size": 928 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,316,363
void onPlaylistRefreshRequired(HlsMasterPlaylist.HlsUrl playlistUrl); } private static final int PRIMARY_TYPE_NONE = 0; private static final int PRIMARY_TYPE_TEXT = 1; private static final int PRIMARY_TYPE_AUDIO = 2; private static final int PRIMARY_TYPE_VIDEO = 3; private final int trackType; private final Callback callback; private final HlsChunkSource chunkSource; private final Allocator allocator; private final Format muxedAudioFormat; private final Format muxedCaptionFormat; private final int minLoadableRetryCount; private final Loader loader; private final EventDispatcher eventDispatcher; private final HlsChunkSource.HlsChunkHolder nextChunkHolder; private final SparseArray<DefaultTrackOutput> sampleQueues; private final LinkedList<HlsMediaChunk> mediaChunks; private final Runnable maybeFinishPrepareRunnable; private final Handler handler; private boolean sampleQueuesBuilt; private boolean prepared; private int enabledTrackCount; private Format downstreamTrackFormat; private int upstreamChunkUid; private boolean released; // Tracks are complicated in HLS. See documentation of buildTracks for details. // Indexed by track (as exposed by this source). private TrackGroupArray trackGroups; private int primaryTrackGroupIndex; // Indexed by group. private boolean[] groupEnabledStates; private long lastSeekPositionUs; private long pendingResetPositionUs; private boolean loadingFinished;
void onPlaylistRefreshRequired(HlsMasterPlaylist.HlsUrl playlistUrl); } private static final int PRIMARY_TYPE_NONE = 0; private static final int PRIMARY_TYPE_TEXT = 1; private static final int PRIMARY_TYPE_AUDIO = 2; private static final int PRIMARY_TYPE_VIDEO = 3; private final int trackType; private final Callback callback; private final HlsChunkSource chunkSource; private final Allocator allocator; private final Format muxedAudioFormat; private final Format muxedCaptionFormat; private final int minLoadableRetryCount; private final Loader loader; private final EventDispatcher eventDispatcher; private final HlsChunkSource.HlsChunkHolder nextChunkHolder; private final SparseArray<DefaultTrackOutput> sampleQueues; private final LinkedList<HlsMediaChunk> mediaChunks; private final Runnable maybeFinishPrepareRunnable; private final Handler handler; private boolean sampleQueuesBuilt; private boolean prepared; private int enabledTrackCount; private Format downstreamTrackFormat; private int upstreamChunkUid; private boolean released; private TrackGroupArray trackGroups; private int primaryTrackGroupIndex; private boolean[] groupEnabledStates; private long lastSeekPositionUs; private long pendingResetPositionUs; private boolean loadingFinished;
/** * Called to schedule a {@link #continueLoading(long)} call when the playlist referred by the * given url changes. */
Called to schedule a <code>#continueLoading(long)</code> call when the playlist referred by the given url changes
onPlaylistRefreshRequired
{ "repo_name": "muxinc/stats-sdk-exoplayer", "path": "library/src/main/java/com/google/android/exoplayer2/source/hls/HlsSampleStreamWrapper.java", "license": "apache-2.0", "size": 25706 }
[ "android.os.Handler", "android.util.SparseArray", "com.google.android.exoplayer2.Format", "com.google.android.exoplayer2.extractor.DefaultTrackOutput", "com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener", "com.google.android.exoplayer2.source.TrackGroupArray", "com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist", "com.google.android.exoplayer2.upstream.Allocator", "com.google.android.exoplayer2.upstream.Loader", "java.util.LinkedList" ]
import android.os.Handler; import android.util.SparseArray; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.extractor.DefaultTrackOutput; import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist; import com.google.android.exoplayer2.upstream.Allocator; import com.google.android.exoplayer2.upstream.Loader; import java.util.LinkedList;
import android.os.*; import android.util.*; import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.extractor.*; import com.google.android.exoplayer2.source.*; import com.google.android.exoplayer2.source.hls.playlist.*; import com.google.android.exoplayer2.upstream.*; import java.util.*;
[ "android.os", "android.util", "com.google.android", "java.util" ]
android.os; android.util; com.google.android; java.util;
2,405,833
protected void validateHavingClause(SqlSelect select) { try { super.validateHavingClause(select); } catch (CalciteException e) { Util.swallow(e, TRACER); } }
void function(SqlSelect select) { try { super.validateHavingClause(select); } catch (CalciteException e) { Util.swallow(e, TRACER); } }
/** * Calls the parent class method and masks Farrago exception thrown. */
Calls the parent class method and masks Farrago exception thrown
validateHavingClause
{ "repo_name": "xhoong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisorValidator.java", "license": "apache-2.0", "size": 7014 }
[ "org.apache.calcite.runtime.CalciteException", "org.apache.calcite.sql.SqlSelect", "org.apache.calcite.util.Util" ]
import org.apache.calcite.runtime.CalciteException; import org.apache.calcite.sql.SqlSelect; import org.apache.calcite.util.Util;
import org.apache.calcite.runtime.*; import org.apache.calcite.sql.*; import org.apache.calcite.util.*;
[ "org.apache.calcite" ]
org.apache.calcite;
875,864
public BitSet prob0(STPG stpg, BitSet remain, BitSet target, boolean min1, boolean min2) { int n, iters; BitSet u, soln, unknown; boolean u_done; long timer; // Start precomputation timer = System.currentTimeMillis(); if (verbosity >= 1) mainLog.println("Starting Prob0 (" + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")..."); // Special case: no target states if (target.cardinality() == 0) { soln = new BitSet(stpg.getNumStates()); soln.set(0, stpg.getNumStates()); return soln; } // Initialise vectors n = stpg.getNumStates(); u = new BitSet(n); soln = new BitSet(n); // Determine set of states actually need to perform computation for unknown = new BitSet(); unknown.set(0, n); unknown.andNot(target); if (remain != null) unknown.and(remain); // Fixed point loop iters = 0; u_done = false; // Least fixed point - should start from 0 but we optimise by // starting from 'target', thus bypassing first iteration u.or(target); soln.or(target); while (!u_done) { iters++; // Single step of Prob0 stpg.prob0step(unknown, u, min1, min2, soln); // Check termination u_done = soln.equals(u); // u = soln u.clear(); u.or(soln); } // Negate u.flip(0, n); // Finished precomputation timer = System.currentTimeMillis() - timer; if (verbosity >= 1) { mainLog.print("Prob0 (" + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")"); mainLog.println(" took " + iters + " iterations and " + timer / 1000.0 + " seconds."); } return u; }
BitSet function(STPG stpg, BitSet remain, BitSet target, boolean min1, boolean min2) { int n, iters; BitSet u, soln, unknown; boolean u_done; long timer; timer = System.currentTimeMillis(); if (verbosity >= 1) mainLog.println(STR + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")..."); if (target.cardinality() == 0) { soln = new BitSet(stpg.getNumStates()); soln.set(0, stpg.getNumStates()); return soln; } n = stpg.getNumStates(); u = new BitSet(n); soln = new BitSet(n); unknown = new BitSet(); unknown.set(0, n); unknown.andNot(target); if (remain != null) unknown.and(remain); iters = 0; u_done = false; u.or(target); soln.or(target); while (!u_done) { iters++; stpg.prob0step(unknown, u, min1, min2, soln); u_done = soln.equals(u); u.clear(); u.or(soln); } u.flip(0, n); timer = System.currentTimeMillis() - timer; if (verbosity >= 1) { mainLog.print(STR + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")"); mainLog.println(STR + iters + STR + timer / 1000.0 + STR); } return u; }
/** * Prob0 precomputation algorithm. * i.e. determine the states of an STPG which, with min/max probability 0, * reach a state in {@code target}, while remaining in those in {@code remain}. * {@code min}=true gives Prob0E, {@code min}=false gives Prob0A. * @param stpg The STPG * @param remain Remain in these states (optional: null means "all") * @param target Target states * @param min1 Min or max probabilities for player 1 (true=min, false=max) * @param min2 Min or max probabilities for player 2 (true=min, false=max) */
Prob0 precomputation algorithm. i.e. determine the states of an STPG which, with min/max probability 0, reach a state in target, while remaining in those in remain. min=true gives Prob0E, min=false gives Prob0A
prob0
{ "repo_name": "nicodelpiano/prism", "path": "src/explicit/STPGModelChecker.java", "license": "gpl-2.0", "size": 32072 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
821,117
public QuotaCounts getQuotaCounts() { return new QuotaCounts.Builder(). nameSpace(HdfsConstants.QUOTA_RESET). storageSpace(HdfsConstants.QUOTA_RESET). typeSpaces(HdfsConstants.QUOTA_RESET). build(); }
QuotaCounts function() { return new QuotaCounts.Builder(). nameSpace(HdfsConstants.QUOTA_RESET). storageSpace(HdfsConstants.QUOTA_RESET). typeSpaces(HdfsConstants.QUOTA_RESET). build(); }
/** * Get the quota set for this inode * @return the quota counts. The count is -1 if it is not set. */
Get the quota set for this inode
getQuotaCounts
{ "repo_name": "ronny-macmaster/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INode.java", "license": "apache-2.0", "size": 35786 }
[ "org.apache.hadoop.hdfs.protocol.HdfsConstants" ]
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.hdfs.protocol.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,214,977
protected Node exitSetType(Production node) throws ParseException { return node; }
Node function(Production node) throws ParseException { return node; }
/** * Called when exiting a parse tree node. * * @param node the node being exited * * @return the node to add to the parse tree, or * null if no parse tree should be created * * @throws ParseException if the node analysis discovered errors */
Called when exiting a parse tree node
exitSetType
{ "repo_name": "richb-hanover/mibble-2.9.2", "path": "src/java/net/percederberg/mibble/asn1/Asn1Analyzer.java", "license": "gpl-2.0", "size": 275483 }
[ "net.percederberg.grammatica.parser.Node", "net.percederberg.grammatica.parser.ParseException", "net.percederberg.grammatica.parser.Production" ]
import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.ParseException; import net.percederberg.grammatica.parser.Production;
import net.percederberg.grammatica.parser.*;
[ "net.percederberg.grammatica" ]
net.percederberg.grammatica;
447,607
@Test public void testMasterRestartWhenTableInEnabling() throws KeeperException, IOException, Exception { enabling = true; this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, DefaultLoadBalancer.class, LoadBalancer.class); Map<ServerName, HServerLoad> serverAndLoad = new HashMap<ServerName, HServerLoad>(); serverAndLoad.put(SERVERNAME_A, null); Mockito.when(this.serverManager.getOnlineServers()).thenReturn(serverAndLoad); Mockito.when(this.serverManager.isServerOnline(SERVERNAME_B)).thenReturn(false); Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(true); HTU.getConfiguration().setInt(HConstants.MASTER_PORT, 0); Server server = new HMaster(HTU.getConfiguration()); Whitebox.setInternalState(server, "serverManager", this.serverManager); assignmentCount = 0; AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(server, this.serverManager); am.regionOnline(new HRegionInfo("t1".getBytes(), HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW), SERVERNAME_A); am.gate.set(false); try { // set table in enabling state. am.getZKTable().setEnablingTable(REGIONINFO.getTableNameAsString()); ZKAssign.createNodeOffline(this.watcher, REGIONINFO_2, SERVERNAME_B); am.joinCluster(); while (!am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString())) { Thread.sleep(10); } assertEquals("Number of assignments should be equal.", 2, assignmentCount); assertTrue("Table should be enabled.", am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString())); } finally { enabling = false; am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString()); am.shutdown(); ZKAssign.deleteAllNodes(this.watcher); assignmentCount = 0; } }
void function() throws KeeperException, IOException, Exception { enabling = true; this.server.getConfiguration().setClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS, DefaultLoadBalancer.class, LoadBalancer.class); Map<ServerName, HServerLoad> serverAndLoad = new HashMap<ServerName, HServerLoad>(); serverAndLoad.put(SERVERNAME_A, null); Mockito.when(this.serverManager.getOnlineServers()).thenReturn(serverAndLoad); Mockito.when(this.serverManager.isServerOnline(SERVERNAME_B)).thenReturn(false); Mockito.when(this.serverManager.isServerOnline(SERVERNAME_A)).thenReturn(true); HTU.getConfiguration().setInt(HConstants.MASTER_PORT, 0); Server server = new HMaster(HTU.getConfiguration()); Whitebox.setInternalState(server, STR, this.serverManager); assignmentCount = 0; AssignmentManagerWithExtrasForTesting am = setUpMockedAssignmentManager(server, this.serverManager); am.regionOnline(new HRegionInfo("t1".getBytes(), HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW), SERVERNAME_A); am.gate.set(false); try { am.getZKTable().setEnablingTable(REGIONINFO.getTableNameAsString()); ZKAssign.createNodeOffline(this.watcher, REGIONINFO_2, SERVERNAME_B); am.joinCluster(); while (!am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString())) { Thread.sleep(10); } assertEquals(STR, 2, assignmentCount); assertTrue(STR, am.getZKTable().isEnabledTable(REGIONINFO.getTableNameAsString())); } finally { enabling = false; am.getZKTable().setEnabledTable(REGIONINFO.getTableNameAsString()); am.shutdown(); ZKAssign.deleteAllNodes(this.watcher); assignmentCount = 0; } }
/** * Test verifies whether all the enabling table regions assigned only once during master startup. * * @throws KeeperException * @throws IOException * @throws Exception */
Test verifies whether all the enabling table regions assigned only once during master startup
testMasterRestartWhenTableInEnabling
{ "repo_name": "infospace/hbase", "path": "src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java", "license": "apache-2.0", "size": 53132 }
[ "java.io.IOException", "java.util.HashMap", "java.util.Map", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.HServerLoad", "org.apache.hadoop.hbase.Server", "org.apache.hadoop.hbase.ServerName", "org.apache.hadoop.hbase.zookeeper.ZKAssign", "org.apache.zookeeper.KeeperException", "org.junit.Assert", "org.mockito.Mockito", "org.mockito.internal.util.reflection.Whitebox" ]
import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HServerLoad; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.zookeeper.ZKAssign; import org.apache.zookeeper.KeeperException; import org.junit.Assert; import org.mockito.Mockito; import org.mockito.internal.util.reflection.Whitebox;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*; import org.junit.*; import org.mockito.*; import org.mockito.internal.util.reflection.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.apache.zookeeper", "org.junit", "org.mockito", "org.mockito.internal" ]
java.io; java.util; org.apache.hadoop; org.apache.zookeeper; org.junit; org.mockito; org.mockito.internal;
836,322
public Set<InternalDistributedMember> getMembersInThisZone();
Set<InternalDistributedMember> function();
/** * Return all members that are on the the this host * * @return set of {@link InternalDistributedMember} including this VM * @since GemFire 5.9 */
Return all members that are on the the this host
getMembersInThisZone
{ "repo_name": "pivotal-amurmann/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java", "license": "apache-2.0", "size": 15231 }
[ "java.util.Set", "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import java.util.Set; import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import java.util.*; import org.apache.geode.distributed.internal.membership.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,850,045
ServerGroup getCurrentServerGroup();
ServerGroup getCurrentServerGroup();
/** * Get the current server group. * * @returns The currently chosen group if sufficient server group selection * criteria has been provided. Otherwise null. */
Get the current server group
getCurrentServerGroup
{ "repo_name": "richardgutkowski/ansible-roles", "path": "stash/files/mysql-connector-java-5.1.35/src/com/mysql/fabric/jdbc/FabricMySQLConnection.java", "license": "mit", "size": 3300 }
[ "com.mysql.fabric.ServerGroup" ]
import com.mysql.fabric.ServerGroup;
import com.mysql.fabric.*;
[ "com.mysql.fabric" ]
com.mysql.fabric;
1,378,557
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(copy(result)); return os.toByteArray(); }
final ByteArrayOutputStream os = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(copy(result)); return os.toByteArray(); }
/** * Serializes the result into a binary representation. To ensure it can be deserialized without the test classes, * all references to test files are removed by transfering to Java basic classes. * * @param result * the result to be serialized * * @return a serialized representation of the result * * @throws Exception * if the result can not be deserialized */
Serializes the result into a binary representation. To ensure it can be deserialized without the test classes, all references to test files are removed by transfering to Java basic classes
serialize
{ "repo_name": "tourniquet-io/tourniquet-junit", "path": "tourniquet-core/src/main/java/io/tourniquet/junit/util/ResultHelper.java", "license": "apache-2.0", "size": 5265 }
[ "java.io.ByteArrayOutputStream", "java.io.ObjectOutputStream" ]
import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
81,493
@Test(dependsOnMethods = { "test09RemoveGroupFromGroup" }) public void test10RemoveUserFromGroup() throws Exception { // remove user 4 from group2 Long group2Id = UserAndGroupTestUtils.findGroup(getHierarchicalGroupAlias(2)).getId(); Long fourthUserId = UserAndGroupTestUtils.findNthUser( getHierarchicalGroupUserAliasPattern(2), 4).getId(); AuthenticationTestUtils.setSecurityContext(manager); getGroupMemberManagement().removeEntityFromGroup(group2Id, fourthUserId); assertBlogAccess(blogId, fourthUserId, null, false, true); // everthing else must be unchanged Long userId = UserAndGroupTestUtils.findNthUser(getHierarchicalGroupUserAliasPattern(2), 3) .getId(); Set<Long> usersToSkip = new HashSet<Long>(); usersToSkip.add(userId); assertGroupBlogAccess(blogId, group2Id, BlogRole.MANAGER, false, usersToSkip); assertBlogAccess(blogId, userId, BlogRole.MANAGER, false, true); usersToSkip.addAll(ServiceLocator.findService(UserOfGroupDao.class).getUsersOfGroup( group2Id)); Long group1Id = UserAndGroupTestUtils.findGroup(getHierarchicalGroupAlias(1)).getId(); assertGroupBlogAccess(blogId, group1Id, BlogRole.VIEWER, false, usersToSkip); }
@Test(dependsOnMethods = { STR }) void function() throws Exception { Long group2Id = UserAndGroupTestUtils.findGroup(getHierarchicalGroupAlias(2)).getId(); Long fourthUserId = UserAndGroupTestUtils.findNthUser( getHierarchicalGroupUserAliasPattern(2), 4).getId(); AuthenticationTestUtils.setSecurityContext(manager); getGroupMemberManagement().removeEntityFromGroup(group2Id, fourthUserId); assertBlogAccess(blogId, fourthUserId, null, false, true); Long userId = UserAndGroupTestUtils.findNthUser(getHierarchicalGroupUserAliasPattern(2), 3) .getId(); Set<Long> usersToSkip = new HashSet<Long>(); usersToSkip.add(userId); assertGroupBlogAccess(blogId, group2Id, BlogRole.MANAGER, false, usersToSkip); assertBlogAccess(blogId, userId, BlogRole.MANAGER, false, true); usersToSkip.addAll(ServiceLocator.findService(UserOfGroupDao.class).getUsersOfGroup( group2Id)); Long group1Id = UserAndGroupTestUtils.findGroup(getHierarchicalGroupAlias(1)).getId(); assertGroupBlogAccess(blogId, group1Id, BlogRole.VIEWER, false, usersToSkip); }
/** * Tests removing a user from a subgroup. * * @throws Exception * if the test fails */
Tests removing a user from a subgroup
test10RemoveUserFromGroup
{ "repo_name": "Communote/communote-server", "path": "communote/tests/all-versions/integration/src/test/java/com/communote/server/core/blog/BlogRightsHierarchicalGroupsTest.java", "license": "apache-2.0", "size": 26170 }
[ "com.communote.server.api.ServiceLocator", "com.communote.server.model.blog.BlogRole", "com.communote.server.persistence.user.group.UserOfGroupDao", "com.communote.server.test.util.AuthenticationTestUtils", "com.communote.server.test.util.UserAndGroupTestUtils", "java.util.HashSet", "java.util.Set", "org.testng.annotations.Test" ]
import com.communote.server.api.ServiceLocator; import com.communote.server.model.blog.BlogRole; import com.communote.server.persistence.user.group.UserOfGroupDao; import com.communote.server.test.util.AuthenticationTestUtils; import com.communote.server.test.util.UserAndGroupTestUtils; import java.util.HashSet; import java.util.Set; import org.testng.annotations.Test;
import com.communote.server.api.*; import com.communote.server.model.blog.*; import com.communote.server.persistence.user.group.*; import com.communote.server.test.util.*; import java.util.*; import org.testng.annotations.*;
[ "com.communote.server", "java.util", "org.testng.annotations" ]
com.communote.server; java.util; org.testng.annotations;
1,801,581
public void loadAndPrepareRenderingSettings(Set<Long> pixelsIds) { loadAndPrepareRenderingSettings(Pixels.class, pixelsIds); }
void function(Set<Long> pixelsIds) { loadAndPrepareRenderingSettings(Pixels.class, pixelsIds); }
/** * Bulk loads a set of rendering settings for a group of pixels sets and * prepares our internal data structures. * @param pixelsIds Set of Pixels IDs to prepare rendering settings for. */
Bulk loads a set of rendering settings for a group of pixels sets and prepares our internal data structures
loadAndPrepareRenderingSettings
{ "repo_name": "jballanc/openmicroscopy", "path": "components/server/src/ome/services/ThumbnailCtx.java", "license": "gpl-2.0", "size": 40123 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,777,366
public void testNutchDocumentNullIndexingFilter() throws IndexingException{ Configuration conf = NutchConfiguration.create(); conf.addResource("nutch-default.xml"); conf.addResource("crawl-tests.xml"); IndexingFilters filters = new IndexingFilters(conf); NutchDocument doc = filters.filter(null, new ParseImpl("text", new ParseData( new ParseStatus(), "title", new Outlink[0], new Metadata())), new Text( "http://www.example.com/"), new CrawlDatum(), new Inlinks()); assertNull(doc); }
void function() throws IndexingException{ Configuration conf = NutchConfiguration.create(); conf.addResource(STR); conf.addResource(STR); IndexingFilters filters = new IndexingFilters(conf); NutchDocument doc = filters.filter(null, new ParseImpl("text", new ParseData( new ParseStatus(), "title", new Outlink[0], new Metadata())), new Text( "http: assertNull(doc); }
/** * Test behaviour when NutchDOcument is null */
Test behaviour when NutchDOcument is null
testNutchDocumentNullIndexingFilter
{ "repo_name": "fogbeam/Heceta_nutch", "path": "src/test/org/apache/nutch/indexer/TestIndexingFilters.java", "license": "apache-2.0", "size": 4273 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.io.Text", "org.apache.nutch.metadata.Metadata", "org.apache.nutch.parse.Outlink", "org.apache.nutch.parse.ParseData", "org.apache.nutch.parse.ParseImpl", "org.apache.nutch.parse.ParseStatus", "org.apache.nutch.util.NutchConfiguration" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.nutch.metadata.Metadata; import org.apache.nutch.parse.Outlink; import org.apache.nutch.parse.ParseData; import org.apache.nutch.parse.ParseImpl; import org.apache.nutch.parse.ParseStatus; import org.apache.nutch.util.NutchConfiguration;
import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import org.apache.nutch.metadata.*; import org.apache.nutch.parse.*; import org.apache.nutch.util.*;
[ "org.apache.hadoop", "org.apache.nutch" ]
org.apache.hadoop; org.apache.nutch;
1,104,384
public Intent putExtra(String name, double[] value) { if (mExtras == null) { mExtras = new Bundle(); } mExtras.putDoubleArray(name, value); return this; }
Intent function(String name, double[] value) { if (mExtras == null) { mExtras = new Bundle(); } mExtras.putDoubleArray(name, value); return this; }
/** * Add extended data to the intent. The name must include a package * prefix, for example the app com.android.contacts would use names * like "com.android.contacts.ShowAll". * * @param name The name of the extra data, with package prefix. * @param value The double array data value. * * @return Returns the same Intent object, for chaining multiple calls * into a single statement. * * @see #putExtras * @see #removeExtra * @see #getDoubleArrayExtra(String) */
Add extended data to the intent. The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll"
putExtra
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/content/Intent.java", "license": "gpl-3.0", "size": 343964 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
2,598,440
String calculateValue(QueryOptions queryOptions);
String calculateValue(QueryOptions queryOptions);
/** * Gets the name of the primary group, or null. * * @param queryOptions the query options to lookup with * @return the name of the primary group, or null. */
Gets the name of the primary group, or null
calculateValue
{ "repo_name": "lucko/LuckPerms", "path": "common/src/main/java/me/lucko/luckperms/common/model/PrimaryGroupHolder.java", "license": "mit", "size": 5122 }
[ "net.luckperms.api.query.QueryOptions" ]
import net.luckperms.api.query.QueryOptions;
import net.luckperms.api.query.*;
[ "net.luckperms.api" ]
net.luckperms.api;
612,557
public static void main(final String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: " + ConstructorGenerator.class.getName() + " <class>"); System.exit(1); } final String className = args[0].replace('.', '/'); final ScriptClassInfo sci = getScriptClassInfo(className + ".class"); if (sci == null) { System.err.println("No @ScriptClass in " + className); System.exit(2); throw new IOException(); // get rid of warning for sci.verify() below - may be null } try { sci.verify(); } catch (final Exception e) { System.err.println(e.getMessage()); System.exit(3); } final ConstructorGenerator gen = new ConstructorGenerator(sci); try (FileOutputStream fos = new FileOutputStream(className + CONSTRUCTOR_SUFFIX + ".class")) { fos.write(gen.getClassBytes()); } }
static void function(final String[] args) throws IOException { if (args.length != 1) { System.err.println(STR + ConstructorGenerator.class.getName() + STR); System.exit(1); } final String className = args[0].replace('.', '/'); final ScriptClassInfo sci = getScriptClassInfo(className + STR); if (sci == null) { System.err.println(STR + className); System.exit(2); throw new IOException(); } try { sci.verify(); } catch (final Exception e) { System.err.println(e.getMessage()); System.exit(3); } final ConstructorGenerator gen = new ConstructorGenerator(sci); try (FileOutputStream fos = new FileOutputStream(className + CONSTRUCTOR_SUFFIX + STR)) { fos.write(gen.getClassBytes()); } }
/** * Entry point for ConstructorGenerator run separately as an application. Will display * usage. Takes one argument, a class name. * @param args args vector * @throws IOException if class can't be read */
Entry point for ConstructorGenerator run separately as an application. Will display usage. Takes one argument, a class name
main
{ "repo_name": "lizhekang/TCJDK", "path": "sources/openjdk8/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java", "license": "gpl-2.0", "size": 11685 }
[ "java.io.FileOutputStream", "java.io.IOException" ]
import java.io.FileOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,800,405
public Long addPlace(Place place) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(COLUMN_PLACES_NAME, place.getName()); Long id = db.insert(TABLE_PLACES, null, values); db.close(); return id; }
Long function(Place place) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(COLUMN_PLACES_NAME, place.getName()); Long id = db.insert(TABLE_PLACES, null, values); db.close(); return id; }
/** * Saves a place to the database * * @param place */
Saves a place to the database
addPlace
{ "repo_name": "simonjrp/ESCAPE", "path": "ESCAPE/src/se/chalmers/dat255/group22/escape/database/DBHandler.java", "license": "gpl-3.0", "size": 53985 }
[ "android.content.ContentValues", "android.database.sqlite.SQLiteDatabase", "se.chalmers.dat255.group22.escape.objects.Place" ]
import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase; import se.chalmers.dat255.group22.escape.objects.Place;
import android.content.*; import android.database.sqlite.*; import se.chalmers.dat255.group22.escape.objects.*;
[ "android.content", "android.database", "se.chalmers.dat255" ]
android.content; android.database; se.chalmers.dat255;
165,820
@Test public void initiateMessageTest34() throws PcepParseException, PcepOutOfBoundMessageException { // SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, // ERO, LSPA OBJECT. // byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50, 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object 0x07, 0x10, 0x00, 0x04, //ERO object 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; byte[] testInitiateCreationMsg = {0}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(initiateCreationMsg); PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); PcepMessage message = null; message = reader.readFrom(buffer); assertThat(message, instanceOf(PcepInitiateMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); testInitiateCreationMsg = buf.array(); int iReadLen = buf.writerIndex(); testInitiateCreationMsg = new byte[iReadLen]; buf.readBytes(testInitiateCreationMsg, 0, iReadLen); assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); }
void function() throws PcepParseException, PcepOutOfBoundMessageException { 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, 0x00, 0x17, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x07, 0x10, 0x00, 0x04, 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00}; byte[] testInitiateCreationMsg = {0}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(initiateCreationMsg); PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); PcepMessage message = null; message = reader.readFrom(buffer); assertThat(message, instanceOf(PcepInitiateMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); testInitiateCreationMsg = buf.array(); int iReadLen = buf.writerIndex(); testInitiateCreationMsg = new byte[iReadLen]; buf.readBytes(testInitiateCreationMsg, 0, iReadLen); assertThat(testInitiateCreationMsg, is(initiateCreationMsg)); }
/** * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, * ERO, LSPA OBJECT objects in PcInitiate message. */
This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message
initiateMessageTest34
{ "repo_name": "sonu283304/onos", "path": "protocols/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepInitiateMsgExtTest.java", "license": "apache-2.0", "size": 81890 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.hamcrest.core.Is", "org.jboss.netty.buffer.ChannelBuffer", "org.jboss.netty.buffer.ChannelBuffers", "org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException", "org.onosproject.pcepio.exceptions.PcepParseException" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.core.Is; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException; import org.onosproject.pcepio.exceptions.PcepParseException;
import org.hamcrest.*; import org.hamcrest.core.*; import org.jboss.netty.buffer.*; import org.onosproject.pcepio.exceptions.*;
[ "org.hamcrest", "org.hamcrest.core", "org.jboss.netty", "org.onosproject.pcepio" ]
org.hamcrest; org.hamcrest.core; org.jboss.netty; org.onosproject.pcepio;
1,652,578
public static void tryPutPieceNoCopy(PlayingPiece piece, Game game, HashMap trackers) { if (piece != null) { game.putTempPiece(piece); Iterator trackersIter = trackers.values().iterator(); while (trackersIter.hasNext()) { PlayerTracker tracker = (PlayerTracker) trackersIter.next(); switch (piece.getType()) { case PlayingPiece.ROAD: tracker.addNewRoad((Road) piece, trackers); break; case PlayingPiece.SETTLEMENT: tracker.addNewSettlement((Settlement) piece, trackers); break; case PlayingPiece.CITY: tracker.addOurNewCity((City) piece); break; } } } }
static void function(PlayingPiece piece, Game game, HashMap trackers) { if (piece != null) { game.putTempPiece(piece); Iterator trackersIter = trackers.values().iterator(); while (trackersIter.hasNext()) { PlayerTracker tracker = (PlayerTracker) trackersIter.next(); switch (piece.getType()) { case PlayingPiece.ROAD: tracker.addNewRoad((Road) piece, trackers); break; case PlayingPiece.SETTLEMENT: tracker.addNewSettlement((Settlement) piece, trackers); break; case PlayingPiece.CITY: tracker.addOurNewCity((City) piece); break; } } } }
/** * same as tryPutPiece, but we don't make a copy of the player trackers * instead you supply the copy * * @param piece the piece to build * @param game the game * @param trackers the player trackers */
same as tryPutPiece, but we don't make a copy of the player trackers instead you supply the copy
tryPutPieceNoCopy
{ "repo_name": "nsp/OpenSettlers", "path": "src/java/soc/robot/PlayerTracker.java", "license": "gpl-3.0", "size": 162138 }
[ "java.util.HashMap", "java.util.Iterator" ]
import java.util.HashMap; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
849,668
HtmlDoclet doclet = new HtmlJmlDoclet(); return doclet.start(doclet, root); }
HtmlDoclet doclet = new HtmlJmlDoclet(); return doclet.start(doclet, root); }
/** Starts in the standard way, by instantiating this class and calling * the non-static start method. * @param root the root of the javadoc class document tree * @return true if the process executed without error */
Starts in the standard way, by instantiating this class and calling the non-static start method
start
{ "repo_name": "shunghsiyu/OpenJML_XOR", "path": "OpenJML/src/org/jmlspecs/openjml/jmldoc/HtmlJmlDoclet.java", "license": "gpl-2.0", "size": 4748 }
[ "com.sun.tools.doclets.formats.html.HtmlDoclet" ]
import com.sun.tools.doclets.formats.html.HtmlDoclet;
import com.sun.tools.doclets.formats.html.*;
[ "com.sun.tools" ]
com.sun.tools;
2,308,443
@Override public Resource getSmallTypeIcon() { return null; }
Resource function() { return null; }
/** * These type icons are for legacy support and shown in very few places. Feel free to make icons of your own. Do bear in mind that these icons are shown in very few places anymore. * * @return An image for this exercise type. */
These type icons are for legacy support and shown in very few places. Feel free to make icons of your own. Do bear in mind that these icons are shown in very few places anymore
getSmallTypeIcon
{ "repo_name": "Rassukka/Rapidnaming", "path": "Rapidnaming/src/main/java/fi/utu/ville/exercises/rapidnaming/RapidnamingDescriptor.java", "license": "mit", "size": 3320 }
[ "com.vaadin.server.Resource" ]
import com.vaadin.server.Resource;
import com.vaadin.server.*;
[ "com.vaadin.server" ]
com.vaadin.server;
338,288
private static MediaCodecInfo selectCodec(String mimeType) { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); if (!codecInfo.isEncoder()) { continue; } String[] types = codecInfo.getSupportedTypes(); for (int j = 0; j < types.length; j++) { if (types[j].equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; }
static MediaCodecInfo function(String mimeType) { int numCodecs = MediaCodecList.getCodecCount(); for (int i = 0; i < numCodecs; i++) { MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i); if (!codecInfo.isEncoder()) { continue; } String[] types = codecInfo.getSupportedTypes(); for (int j = 0; j < types.length; j++) { if (types[j].equalsIgnoreCase(mimeType)) { return codecInfo; } } } return null; }
/** * Returns the first codec capable of encoding the specified MIME type, or null if no * match was found. */
Returns the first codec capable of encoding the specified MIME type, or null if no match was found
selectCodec
{ "repo_name": "quanhua92/AudioVideoRecorder", "path": "buffertobuffermediacodec/src/main/java/com/quan404/buffertobuffermediacodec/MainActivity.java", "license": "mit", "size": 27454 }
[ "android.media.MediaCodecInfo", "android.media.MediaCodecList" ]
import android.media.MediaCodecInfo; import android.media.MediaCodecList;
import android.media.*;
[ "android.media" ]
android.media;
2,694,189
public boolean othersInsertsAreVisible(int type) throws SQLException { return false; }
boolean function(int type) throws SQLException { return false; }
/** * DOCUMENT ME! * * @param type * DOCUMENT ME! * @return DOCUMENT ME! * @throws SQLException * DOCUMENT ME! */
DOCUMENT ME
othersInsertsAreVisible
{ "repo_name": "shubhanshu-gupta/Apache-Solr", "path": "example/solr/collection1/lib/mysql-connector-java-5.1.32/src/com/mysql/jdbc/DatabaseMetaData.java", "license": "apache-2.0", "size": 287958 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
371,052
//----------------------------------------------------------------------- public StandardId getLegalEntityId() { return legalEntityId; }
StandardId function() { return legalEntityId; }
/** * Gets the legal entity identifier. * <p> * This identifier is used for the reference legal entity of the CDS. * @return the value of the property, not null */
Gets the legal entity identifier. This identifier is used for the reference legal entity of the CDS
getLegalEntityId
{ "repo_name": "OpenGamma/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/curve/node/CdsIsdaCreditCurveNode.java", "license": "apache-2.0", "size": 26279 }
[ "com.opengamma.strata.basics.StandardId" ]
import com.opengamma.strata.basics.StandardId;
import com.opengamma.strata.basics.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
2,024,142
public StringBindingAssert hasNotNullValue() { new ObservableValueAssertions<>(actual).hasNotNullValue(); return this; }
StringBindingAssert function() { new ObservableValueAssertions<>(actual).hasNotNullValue(); return this; }
/** * Verifies that the actual observable has NOT a value of <code>null</code>. * * @return {@code this} assertion instance. */
Verifies that the actual observable has NOT a value of <code>null</code>
hasNotNullValue
{ "repo_name": "lestard/assertj-javafx", "path": "src/main/java/eu/lestard/assertj/javafx/api/StringBindingAssert.java", "license": "apache-2.0", "size": 2669 }
[ "eu.lestard.assertj.javafx.internal.ObservableValueAssertions" ]
import eu.lestard.assertj.javafx.internal.ObservableValueAssertions;
import eu.lestard.assertj.javafx.internal.*;
[ "eu.lestard.assertj" ]
eu.lestard.assertj;
494,431
private void editBuild(long rowId) { Intent i = new Intent(getActivity(), EditBuildActivity.class); i.putExtra(KEY_BUILD_ID, rowId); startActivity(i); }
void function(long rowId) { Intent i = new Intent(getActivity(), EditBuildActivity.class); i.putExtra(KEY_BUILD_ID, rowId); startActivity(i); }
/** * Starts the build editor activity, passing ID of build in the database */
Starts the build editor activity, passing ID of build in the database
editBuild
{ "repo_name": "kiwiandroiddev/starcraft-2-build-player", "path": "app/src/main/java/com/kiwiandroiddev/sc2buildassistant/activity/fragment/RaceFragment.java", "license": "mit", "size": 16739 }
[ "android.content.Intent", "com.kiwiandroiddev.sc2buildassistant.activity.EditBuildActivity" ]
import android.content.Intent; import com.kiwiandroiddev.sc2buildassistant.activity.EditBuildActivity;
import android.content.*; import com.kiwiandroiddev.sc2buildassistant.activity.*;
[ "android.content", "com.kiwiandroiddev.sc2buildassistant" ]
android.content; com.kiwiandroiddev.sc2buildassistant;
513,603
@SuppressWarnings("unchecked") @Override public void handlePut() { boolean canPut = true; if (getRequest().getConditions().hasSome()) { Variant preferredVariant = null; if (isNegotiateContent()) { preferredVariant = getPreferredVariant(); } else { final List<Variant> variants = getVariants(); if (variants.size() == 1) { preferredVariant = variants.get(0); } else { getResponse().setStatus( Status.CLIENT_ERROR_PRECONDITION_FAILED); canPut = false; } } // The conditions have to be checked // even if there is no preferred variant. if (canPut) { final Status status = getRequest().getConditions().getStatus( getRequest().getMethod(), getRepresentation(preferredVariant)); if (status != null) { getResponse().setStatus(status); canPut = false; } } } if (canPut) { // Check the Content-Range HTTP Header // in order to prevent usage of partial PUTs Object oHeaders = getRequest().getAttributes().get( HeaderConstants.ATTRIBUTE_HEADERS); if (oHeaders != null) { Series<Parameter> headers = (Series<Parameter>) oHeaders; if (headers.getFirst("Content-Range", true) != null) { getResponse() .setStatus( new Status( Status.SERVER_ERROR_NOT_IMPLEMENTED, "The Content-Range header is not understood")); canPut = false; } } } if (canPut) { try { storeRepresentation(getRequest().getEntity()); } catch (ResourceException re) { getResponse().setStatus(re.getStatus(), re); } // HTTP specification says that PUT may return // the list of allowed methods updateAllowedMethods(); } }
@SuppressWarnings(STR) void function() { boolean canPut = true; if (getRequest().getConditions().hasSome()) { Variant preferredVariant = null; if (isNegotiateContent()) { preferredVariant = getPreferredVariant(); } else { final List<Variant> variants = getVariants(); if (variants.size() == 1) { preferredVariant = variants.get(0); } else { getResponse().setStatus( Status.CLIENT_ERROR_PRECONDITION_FAILED); canPut = false; } } if (canPut) { final Status status = getRequest().getConditions().getStatus( getRequest().getMethod(), getRepresentation(preferredVariant)); if (status != null) { getResponse().setStatus(status); canPut = false; } } } if (canPut) { Object oHeaders = getRequest().getAttributes().get( HeaderConstants.ATTRIBUTE_HEADERS); if (oHeaders != null) { Series<Parameter> headers = (Series<Parameter>) oHeaders; if (headers.getFirst(STR, true) != null) { getResponse() .setStatus( new Status( Status.SERVER_ERROR_NOT_IMPLEMENTED, STR)); canPut = false; } } } if (canPut) { try { storeRepresentation(getRequest().getEntity()); } catch (ResourceException re) { getResponse().setStatus(re.getStatus(), re); } updateAllowedMethods(); } }
/** * Handles a PUT call by invoking the * {@link #storeRepresentation(Representation)} method. It also handles * conditional PUTs and forbids partial PUTs as they are not supported yet. * Finally, it prevents PUT with no entity by setting the response status to * {@link Status#CLIENT_ERROR_BAD_REQUEST} following the HTTP * specifications. */
Handles a PUT call by invoking the <code>#storeRepresentation(Representation)</code> method. It also handles conditional PUTs and forbids partial PUTs as they are not supported yet. Finally, it prevents PUT with no entity by setting the response status to <code>Status#CLIENT_ERROR_BAD_REQUEST</code> following the HTTP specifications
handlePut
{ "repo_name": "debrief/debrief", "path": "org.mwc.asset.comms/docs/restlet_src/org.restlet/org/restlet/resource/Resource.java", "license": "epl-1.0", "size": 29357 }
[ "java.util.List", "org.restlet.data.Parameter", "org.restlet.data.Status", "org.restlet.engine.http.header.HeaderConstants", "org.restlet.representation.Variant", "org.restlet.util.Series" ]
import java.util.List; import org.restlet.data.Parameter; import org.restlet.data.Status; import org.restlet.engine.http.header.HeaderConstants; import org.restlet.representation.Variant; import org.restlet.util.Series;
import java.util.*; import org.restlet.data.*; import org.restlet.engine.http.header.*; import org.restlet.representation.*; import org.restlet.util.*;
[ "java.util", "org.restlet.data", "org.restlet.engine", "org.restlet.representation", "org.restlet.util" ]
java.util; org.restlet.data; org.restlet.engine; org.restlet.representation; org.restlet.util;
1,274,979
public static Date parse(String src, String ptrn) throws java.text.ParseException { java.text.DateFormat format = new java.text.SimpleDateFormat(ptrn); return format.parse(src); }
static Date function(String src, String ptrn) throws java.text.ParseException { java.text.DateFormat format = new java.text.SimpleDateFormat(ptrn); return format.parse(src); }
/** * Parses passed string with specified date. * * @param src String to parse. * @param ptrn Pattern. * @return Parsed date. * @throws java.text.ParseException If exception occurs while parsing. */
Parses passed string with specified date
parse
{ "repo_name": "shurun19851206/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 289056 }
[ "java.text.SimpleDateFormat", "java.util.Date" ]
import java.text.SimpleDateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
1,743,069
public void updateAnnotation(final AnnotationImpl<XTYPE> annotation, final XTYPE position, final double value, final Point offset) { annotation.setLocation(position, value); annotation.setOffset(offset); requestUpdate(); fireAnnotationsChanged(); }
void function(final AnnotationImpl<XTYPE> annotation, final XTYPE position, final double value, final Point offset) { annotation.setLocation(position, value); annotation.setOffset(offset); requestUpdate(); fireAnnotationsChanged(); }
/** Update location and value of annotation * @param annotation {@link AnnotationImpl} to update * @param position New position * @param value New value */
Update location and value of annotation
updateAnnotation
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "applications/appunorganized/appunorganized-plugins/org.csstudio.rap.rtplot/src/org/csstudio/swt/rtplot/internal/Plot.java", "license": "epl-1.0", "size": 43505 }
[ "org.eclipse.swt.graphics.Point" ]
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,369,984
@Override public void onServiceDisconnected(ComponentName name) { mDownloadCall = null; } };
void function(ComponentName name) { mDownloadCall = null; } };
/** * Called if the remote service crashes and is no longer * available. The ServiceConnection will remain bound, * but the service will not respond to any requests. */
Called if the remote service crashes and is no longer available. The ServiceConnection will remain bound, but the service will not respond to any requests
onServiceDisconnected
{ "repo_name": "ridethepenguin/coursera", "path": "POSA-14/W8-A7-ThreadedDownloads-BoundServices/peers/DownloadActivityStudent1.java", "license": "gpl-2.0", "size": 8820 }
[ "android.content.ComponentName" ]
import android.content.ComponentName;
import android.content.*;
[ "android.content" ]
android.content;
883,356
public Boolean isNull(JsonElement source) { return null == source || source.isJsonNull(); }
Boolean function(JsonElement source) { return null == source source.isJsonNull(); }
/** * Checks if is null. * * @param source the source * @return the boolean */
Checks if is null
isNull
{ "repo_name": "balajeetm/json-mystique", "path": "json-mystique-utils/gson-utils/src/main/java/com/balajeetm/mystique/util/gson/lever/JsonLever.java", "license": "apache-2.0", "size": 77289 }
[ "com.google.gson.JsonElement" ]
import com.google.gson.JsonElement;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
2,740,956
@Deprecated public WALEdit add(KeyValue kv) { this.kvs.add(kv); return this; }
WALEdit function(KeyValue kv) { this.kvs.add(kv); return this; }
/** * Adds a KeyValue to this edit * @param kv * @return this for chained action * @deprecated Use {@link #add(Cell)} instead */
Adds a KeyValue to this edit
add
{ "repo_name": "Jackygq1982/hbase_src", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java", "license": "apache-2.0", "size": 10079 }
[ "org.apache.hadoop.hbase.KeyValue" ]
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,956,627
public static synchronized void warning(Class<?> clazz, String function, String... message) { Check.notNull(clazz); Check.notNull(function); Check.notNull(message); if (LEVELS.contains(WARNING)) { LOGGER.logp(Level.WARNING, clazz.getName(), function, getMessage(message)); } }
static synchronized void function(Class<?> clazz, String function, String... message) { Check.notNull(clazz); Check.notNull(function); Check.notNull(message); if (LEVELS.contains(WARNING)) { LOGGER.logp(Level.WARNING, clazz.getName(), function, getMessage(message)); } }
/** * Display a check verbose message to error output. * * @param clazz The current class name (must not be <code>null</code>). * @param function The current function name (must not be <code>null</code>). * @param message The list of messages (must not be <code>null</code>). * @see Verbose#WARNING */
Display a check verbose message to error output
warning
{ "repo_name": "b3dgs/lionengine", "path": "lionengine-core/src/main/java/com/b3dgs/lionengine/Verbose.java", "license": "gpl-3.0", "size": 7427 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
539,442
@Override() public java.lang.Class getJavaClass( ) { return org.chocolate_milk.model.QBXMLSubscriptionMsgsRq.class; }
@Override() java.lang.Class function( ) { return org.chocolate_milk.model.QBXMLSubscriptionMsgsRq.class; }
/** * Method getJavaClass. * * @return the Java class represented by this descriptor. */
Method getJavaClass
getJavaClass
{ "repo_name": "galleon1/chocolate-milk", "path": "src/org/chocolate_milk/model/descriptors/QBXMLSubscriptionMsgsRqDescriptor.java", "license": "lgpl-3.0", "size": 6292 }
[ "org.chocolate_milk.model.QBXMLSubscriptionMsgsRq" ]
import org.chocolate_milk.model.QBXMLSubscriptionMsgsRq;
import org.chocolate_milk.model.*;
[ "org.chocolate_milk.model" ]
org.chocolate_milk.model;
33,352
protected DataSet materializeMainSchemaTable(Table table, List<SelectItem> selectItems, List<FilterItem> whereItems, int firstRow, int maxRows) { final List<SelectItem> workingSelectItems = buildWorkingSelectItems(selectItems, whereItems); DataSet dataSet; if (whereItems.isEmpty()) { // paging is pushed down to materializeMainSchemaTable dataSet = materializeMainSchemaTableSelect(table, workingSelectItems, firstRow, maxRows); dataSet = MetaModelHelper.getSelection(selectItems, dataSet); } else { // do not push down paging, first we have to apply filtering dataSet = materializeMainSchemaTableSelect(table, workingSelectItems, 1, -1); dataSet = MetaModelHelper.getFiltered(dataSet, whereItems); dataSet = MetaModelHelper.getPaged(dataSet, firstRow, maxRows); dataSet = MetaModelHelper.getSelection(selectItems, dataSet); } return dataSet; }
DataSet function(Table table, List<SelectItem> selectItems, List<FilterItem> whereItems, int firstRow, int maxRows) { final List<SelectItem> workingSelectItems = buildWorkingSelectItems(selectItems, whereItems); DataSet dataSet; if (whereItems.isEmpty()) { dataSet = materializeMainSchemaTableSelect(table, workingSelectItems, firstRow, maxRows); dataSet = MetaModelHelper.getSelection(selectItems, dataSet); } else { dataSet = materializeMainSchemaTableSelect(table, workingSelectItems, 1, -1); dataSet = MetaModelHelper.getFiltered(dataSet, whereItems); dataSet = MetaModelHelper.getPaged(dataSet, firstRow, maxRows); dataSet = MetaModelHelper.getSelection(selectItems, dataSet); } return dataSet; }
/** * Execute a simple one-table query against a table in the main schema of the subclasses of this class. This default * implementation will delegate to {@link #materializeMainSchemaTable(Table, List, int, int)} and apply WHERE item * filtering afterwards. * * @param table * @param selectItems * @param whereItems * @param firstRow * @param maxRows * @return */
Execute a simple one-table query against a table in the main schema of the subclasses of this class. This default implementation will delegate to <code>#materializeMainSchemaTable(Table, List, int, int)</code> and apply WHERE item filtering afterwards
materializeMainSchemaTable
{ "repo_name": "apache/metamodel", "path": "core/src/main/java/org/apache/metamodel/QueryPostprocessDataContext.java", "license": "apache-2.0", "size": 34167 }
[ "java.util.List", "org.apache.metamodel.data.DataSet", "org.apache.metamodel.query.FilterItem", "org.apache.metamodel.query.SelectItem", "org.apache.metamodel.schema.Table" ]
import java.util.List; import org.apache.metamodel.data.DataSet; import org.apache.metamodel.query.FilterItem; import org.apache.metamodel.query.SelectItem; import org.apache.metamodel.schema.Table;
import java.util.*; import org.apache.metamodel.data.*; import org.apache.metamodel.query.*; import org.apache.metamodel.schema.*;
[ "java.util", "org.apache.metamodel" ]
java.util; org.apache.metamodel;
1,607,745
public List<TreeModification> toTreeModifications( Repository repository, ProjectState projectState, ObjectId patchSetCommitId, List<FixReplacement> fixReplacements) throws ResourceNotFoundException, IOException, ResourceConflictException { requireNonNull(fixReplacements, "Fix replacements must not be null"); Map<String, List<FixReplacement>> fixReplacementsPerFilePath = fixReplacements.stream().collect(groupingBy(fixReplacement -> fixReplacement.path)); List<TreeModification> treeModifications = new ArrayList<>(); for (Map.Entry<String, List<FixReplacement>> entry : fixReplacementsPerFilePath.entrySet()) { TreeModification treeModification = toTreeModification( repository, projectState, patchSetCommitId, entry.getKey(), entry.getValue()); treeModifications.add(treeModification); } return treeModifications; }
List<TreeModification> function( Repository repository, ProjectState projectState, ObjectId patchSetCommitId, List<FixReplacement> fixReplacements) throws ResourceNotFoundException, IOException, ResourceConflictException { requireNonNull(fixReplacements, STR); Map<String, List<FixReplacement>> fixReplacementsPerFilePath = fixReplacements.stream().collect(groupingBy(fixReplacement -> fixReplacement.path)); List<TreeModification> treeModifications = new ArrayList<>(); for (Map.Entry<String, List<FixReplacement>> entry : fixReplacementsPerFilePath.entrySet()) { TreeModification treeModification = toTreeModification( repository, projectState, patchSetCommitId, entry.getKey(), entry.getValue()); treeModifications.add(treeModification); } return treeModifications; }
/** * Transforms the given {@code FixReplacement}s into {@code TreeModification}s. * * @param repository the affected Git repository * @param projectState the affected project * @param patchSetCommitId the patch set which should be modified * @param fixReplacements the replacements which should be applied * @return a list of {@code TreeModification}s representing the given replacements * @throws ResourceNotFoundException if a file to which one of the replacements refers doesn't * exist * @throws ResourceConflictException if the replacements can't be transformed into {@code * TreeModification}s */
Transforms the given FixReplacements into TreeModifications
toTreeModifications
{ "repo_name": "WANdisco/gerrit", "path": "java/com/google/gerrit/server/fixes/FixReplacementInterpreter.java", "license": "apache-2.0", "size": 6806 }
[ "com.google.gerrit.extensions.restapi.ResourceConflictException", "com.google.gerrit.extensions.restapi.ResourceNotFoundException", "com.google.gerrit.reviewdb.client.FixReplacement", "com.google.gerrit.server.edit.tree.TreeModification", "com.google.gerrit.server.project.ProjectState", "java.io.IOException", "java.util.ArrayList", "java.util.List", "java.util.Map", "java.util.Objects", "org.eclipse.jgit.lib.ObjectId", "org.eclipse.jgit.lib.Repository" ]
import com.google.gerrit.extensions.restapi.ResourceConflictException; import com.google.gerrit.extensions.restapi.ResourceNotFoundException; import com.google.gerrit.reviewdb.client.FixReplacement; import com.google.gerrit.server.edit.tree.TreeModification; import com.google.gerrit.server.project.ProjectState; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Repository;
import com.google.gerrit.extensions.restapi.*; import com.google.gerrit.reviewdb.client.*; import com.google.gerrit.server.edit.tree.*; import com.google.gerrit.server.project.*; import java.io.*; import java.util.*; import org.eclipse.jgit.lib.*;
[ "com.google.gerrit", "java.io", "java.util", "org.eclipse.jgit" ]
com.google.gerrit; java.io; java.util; org.eclipse.jgit;
224,269
@Override public JPanel getPanel() { return panel; }
JPanel function() { return panel; }
/** * Gets the panel. * * @return the panel */
Gets the panel
getPanel
{ "repo_name": "robward-scisys/sldeditor", "path": "modules/import/export-sld/src/main/java/com/sldeditor/common/datasource/connector/instance/DataSourceConnectorArcSDE.java", "license": "gpl-3.0", "size": 9949 }
[ "javax.swing.JPanel" ]
import javax.swing.JPanel;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
478,267
public static String getIPAddress( String networkInterfaceName ) throws SocketException { NetworkInterface networkInterface = NetworkInterface.getByName( networkInterfaceName ); Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while ( ipAddresses.hasMoreElements() ) { InetAddress inetAddress = ipAddresses.nextElement(); if ( !inetAddress.isLoopbackAddress() && inetAddress.toString().indexOf( ":" ) < 0 ) { String hostname = inetAddress.getHostAddress(); return hostname; } } return null; }
static String function( String networkInterfaceName ) throws SocketException { NetworkInterface networkInterface = NetworkInterface.getByName( networkInterfaceName ); Enumeration<InetAddress> ipAddresses = networkInterface.getInetAddresses(); while ( ipAddresses.hasMoreElements() ) { InetAddress inetAddress = ipAddresses.nextElement(); if ( !inetAddress.isLoopbackAddress() && inetAddress.toString().indexOf( ":" ) < 0 ) { String hostname = inetAddress.getHostAddress(); return hostname; } } return null; }
/** * Get the primary IP address tied to a network interface (excluding loop-back etc) * * @param networkInterfaceName * the name of the network interface to interrogate * @return null if the network interface or address wasn't found. * * @throws SocketException * in case of a security or network error */
Get the primary IP address tied to a network interface (excluding loop-back etc)
getIPAddress
{ "repo_name": "alina-ipatina/pentaho-kettle", "path": "core/src/org/pentaho/di/core/Const.java", "license": "apache-2.0", "size": 114871 }
[ "java.net.InetAddress", "java.net.NetworkInterface", "java.net.SocketException", "java.util.Enumeration" ]
import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
916,391
public Properties getAllowedCredentials(OperationCode[] opCodes, String[] regionNames, int[] keyIndices, int num);
Properties function(OperationCode[] opCodes, String[] regionNames, int[] keyIndices, int num);
/** * Get allowed credentials for the given set of operations in the given regions and indices of * KEYS in the <code>KEYS</code> array */
Get allowed credentials for the given set of operations in the given regions and indices of KEYS in the <code>KEYS</code> array
getAllowedCredentials
{ "repo_name": "davebarnes97/geode", "path": "geode-dunit/src/main/java/org/apache/geode/security/ClientAuthorizationTestCase.java", "license": "apache-2.0", "size": 50348 }
[ "java.util.Properties", "org.apache.geode.cache.operations.OperationContext" ]
import java.util.Properties; import org.apache.geode.cache.operations.OperationContext;
import java.util.*; import org.apache.geode.cache.operations.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,686,924
public static TEnviCTe montaCte(ConfiguracoesCte configuracoesCte, TEnviCTe enviCTe, boolean valida) throws CteException { return EnvioCte.montaCte(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesCte), enviCTe, valida); }
static TEnviCTe function(ConfiguracoesCte configuracoesCte, TEnviCTe enviCTe, boolean valida) throws CteException { return EnvioCte.montaCte(ConfiguracoesUtil.iniciaConfiguracoes(configuracoesCte), enviCTe, valida); }
/** * Metodo para Montar a CTE. * * @param configuracoesCte * @param enviCTe * @param valida * @return * @throws CteException */
Metodo para Montar a CTE
montaCte
{ "repo_name": "Samuel-Oliveira/Java_CTe", "path": "src/main/java/br/com/swconsultoria/cte/Cte.java", "license": "mit", "size": 8955 }
[ "br.com.swconsultoria.cte.dom.ConfiguracoesCte", "br.com.swconsultoria.cte.exception.CteException", "br.com.swconsultoria.cte.schema_300.enviCTe.TEnviCTe", "br.com.swconsultoria.cte.util.ConfiguracoesUtil" ]
import br.com.swconsultoria.cte.dom.ConfiguracoesCte; import br.com.swconsultoria.cte.exception.CteException; import br.com.swconsultoria.cte.schema_300.enviCTe.TEnviCTe; import br.com.swconsultoria.cte.util.ConfiguracoesUtil;
import br.com.swconsultoria.cte.dom.*; import br.com.swconsultoria.cte.exception.*; import br.com.swconsultoria.cte.schema_300.*; import br.com.swconsultoria.cte.util.*;
[ "br.com.swconsultoria" ]
br.com.swconsultoria;
137,774
private static void loadExperienceList() { vExperienceTypes = new Hashtable<Integer, Experience>(); Statement s = null; ResultSet result = null; try { String query = "Select * from `xp`"; s = conn.createStatement(); if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { Experience e = new Experience(); e.sExperienceName = result.getString(2); e.iExperienceID = result.getInt(1); vExperienceTypes.put(e.iExperienceID, e); } } } catch (Exception e) { System.out.println("Error loading experience list." + e.toString()); e.printStackTrace(); } finally { try { if (result != null) { result.close(); result =null; } if (s != null) { s.close(); s = null; } } catch (Exception e) { // Oh well! } } }
static void function() { vExperienceTypes = new Hashtable<Integer, Experience>(); Statement s = null; ResultSet result = null; try { String query = STR; s = conn.createStatement(); if (s.execute(query)) { result = s.getResultSet(); while (result.next()) { Experience e = new Experience(); e.sExperienceName = result.getString(2); e.iExperienceID = result.getInt(1); vExperienceTypes.put(e.iExperienceID, e); } } } catch (Exception e) { System.out.println(STR + e.toString()); e.printStackTrace(); } finally { try { if (result != null) { result.close(); result =null; } if (s != null) { s.close(); s = null; } } catch (Exception e) { } } }
/** * Loads the Experience strings from the database. */
Loads the Experience strings from the database
loadExperienceList
{ "repo_name": "oswin06082/SwgAnh1.0a", "path": "SWGCombined/src/DatabaseInterface.java", "license": "gpl-3.0", "size": 320465 }
[ "java.sql.ResultSet", "java.sql.Statement", "java.util.Hashtable" ]
import java.sql.ResultSet; import java.sql.Statement; import java.util.Hashtable;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
1,705,953
if (file == null) return false; if (StringUtils.isEmpty(file.getName())) return false; switch (type) { case FILE: return file.isFile(); case DIRECTORY: return file.isDirectory(); default: return false; } } public enum Type { FILE, DIRECTORY;
if (file == null) return false; if (StringUtils.isEmpty(file.getName())) return false; switch (type) { case FILE: return file.isFile(); case DIRECTORY: return file.isDirectory(); default: return false; } } public enum Type { FILE, DIRECTORY;
/** * Filter {@link File} by type. * * @param file * {@link File} which should be filtered, can be {@code null} * @return {@code true} if {@link File} is valid */
Filter <code>File</code> by type
accept
{ "repo_name": "Squadity/bb-gest", "path": "fs/common/src/net/bolbat/gest/fs/common/filter/FileTypeFilter.java", "license": "mit", "size": 2802 }
[ "net.bolbat.utils.lang.StringUtils" ]
import net.bolbat.utils.lang.StringUtils;
import net.bolbat.utils.lang.*;
[ "net.bolbat.utils" ]
net.bolbat.utils;
1,100,282
HttpAction redirect(WebContext context) throws HttpAction;
HttpAction redirect(WebContext context) throws HttpAction;
/** * <p>Redirect to the authentication provider for an indirect client.</p> * * @param context the current web context * @return the performed redirection * @throws HttpAction whether an additional HTTP action is required */
Redirect to the authentication provider for an indirect client
redirect
{ "repo_name": "topicusonderwijs/pac4j", "path": "pac4j-core/src/main/java/org/pac4j/core/client/Client.java", "license": "apache-2.0", "size": 3272 }
[ "org.pac4j.core.context.WebContext", "org.pac4j.core.exception.HttpAction" ]
import org.pac4j.core.context.WebContext; import org.pac4j.core.exception.HttpAction;
import org.pac4j.core.context.*; import org.pac4j.core.exception.*;
[ "org.pac4j.core" ]
org.pac4j.core;
1,552,369
public static Map<String, Map<String, InetSocketAddress>> getHaNnRpcAddresses( Configuration conf) { return DFSUtilClient.getAddresses(conf, null, DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY); }
static Map<String, Map<String, InetSocketAddress>> function( Configuration conf) { return DFSUtilClient.getAddresses(conf, null, DFSConfigKeys.DFS_NAMENODE_RPC_ADDRESS_KEY); }
/** * Returns list of InetSocketAddress corresponding to HA NN RPC addresses from * the configuration. * * @param conf configuration * @return list of InetSocketAddresses */
Returns list of InetSocketAddress corresponding to HA NN RPC addresses from the configuration
getHaNnRpcAddresses
{ "repo_name": "simbadzina/hadoop-fcfs", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java", "license": "apache-2.0", "size": 56642 }
[ "java.net.InetSocketAddress", "java.util.Map", "org.apache.hadoop.conf.Configuration" ]
import java.net.InetSocketAddress; import java.util.Map; import org.apache.hadoop.conf.Configuration;
import java.net.*; import java.util.*; import org.apache.hadoop.conf.*;
[ "java.net", "java.util", "org.apache.hadoop" ]
java.net; java.util; org.apache.hadoop;
1,496,568
ImmutableList<SchemaOrgType> getCaloriesList();
ImmutableList<SchemaOrgType> getCaloriesList();
/** * Returns the value list of property calories. Empty list is returned if the property not set in * current object. */
Returns the value list of property calories. Empty list is returned if the property not set in current object
getCaloriesList
{ "repo_name": "google/schemaorg-java", "path": "src/main/java/com/google/schemaorg/core/NutritionInformation.java", "license": "apache-2.0", "size": 11061 }
[ "com.google.common.collect.ImmutableList", "com.google.schemaorg.SchemaOrgType" ]
import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType;
import com.google.common.collect.*; import com.google.schemaorg.*;
[ "com.google.common", "com.google.schemaorg" ]
com.google.common; com.google.schemaorg;
2,106,310
public String getStringFromFile(String file) { String string = ""; AssetManager manager = context.getAssets(); try { InputStream stream = manager.open(file); string = convertStreamToString(stream); stream.close(); } catch (Exception e) { Log.d(Constants.TAG, e.getMessage(), e); } return string; }
String function(String file) { String string = ""; AssetManager manager = context.getAssets(); try { InputStream stream = manager.open(file); string = convertStreamToString(stream); stream.close(); } catch (Exception e) { Log.d(Constants.TAG, e.getMessage(), e); } return string; }
/** * Gets the content of a file in the assets folder. * * @param file the name of the file * * @return the file in String format */
Gets the content of a file in the assets folder
getStringFromFile
{ "repo_name": "Siziksu/AndroidArchitecture", "path": "app/src/main/java/com/siziksu/architecture/common/FileUtils.java", "license": "apache-2.0", "size": 2503 }
[ "android.content.res.AssetManager", "android.util.Log", "java.io.InputStream" ]
import android.content.res.AssetManager; import android.util.Log; import java.io.InputStream;
import android.content.res.*; import android.util.*; import java.io.*;
[ "android.content", "android.util", "java.io" ]
android.content; android.util; java.io;
2,487,642