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
@Override public void onMissing(Detector.Detections<T> detectionResults) { mOverlay.remove(mGraphic); }
void function(Detector.Detections<T> detectionResults) { mOverlay.remove(mGraphic); }
/** * Hide the graphic when the corresponding face was not detected. This can happen for * intermediate frames temporarily, for example if the face was momentarily blocked from * view. */
Hide the graphic when the corresponding face was not detected. This can happen for intermediate frames temporarily, for example if the face was momentarily blocked from view
onMissing
{ "repo_name": "sanjnair/projects", "path": "android/super_duo/alexandria/app/src/main/java/it/jaschke/alexandria/vision/GraphicTracker.java", "license": "mit", "size": 2317 }
[ "com.google.android.gms.vision.Detector" ]
import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.*;
[ "com.google.android" ]
com.google.android;
1,941,929
private class X509CRLParser implements PemObjectParser { public Object parseObject(PemObject obj) throws IOException { try { return new X509CRLHolder(obj.getContent()); } catch (Exception e) { throw new PEMException("problem parsing cert: " + e.toString(), e); } } }
class X509CRLParser implements PemObjectParser { public Object function(PemObject obj) throws IOException { try { return new X509CRLHolder(obj.getContent()); } catch (Exception e) { throw new PEMException(STR + e.toString(), e); } } }
/** * Reads in a X509CRL. * * @return the X509Certificate * @throws java.io.IOException if an I/O error occured */
Reads in a X509CRL
parseObject
{ "repo_name": "partheinstein/bc-java", "path": "pkix/src/main/java/org/bouncycastle/openssl/PEMParser.java", "license": "mit", "size": 16424 }
[ "java.io.IOException", "org.bouncycastle.cert.X509CRLHolder", "org.bouncycastle.util.io.pem.PemObject", "org.bouncycastle.util.io.pem.PemObjectParser" ]
import java.io.IOException; import org.bouncycastle.cert.X509CRLHolder; import org.bouncycastle.util.io.pem.PemObject; import org.bouncycastle.util.io.pem.PemObjectParser;
import java.io.*; import org.bouncycastle.cert.*; import org.bouncycastle.util.io.pem.*;
[ "java.io", "org.bouncycastle.cert", "org.bouncycastle.util" ]
java.io; org.bouncycastle.cert; org.bouncycastle.util;
1,723,366
public Rect getInitialCropWindowRect() { return mInitialCropWindowRect; }
Rect function() { return mInitialCropWindowRect; }
/** * Get crop window initial rectangle. */
Get crop window initial rectangle
getInitialCropWindowRect
{ "repo_name": "woniukeji/jianguo", "path": "cropper/src/main/java/com/theartofdev/edmodo/cropper/CropOverlayView.java", "license": "apache-2.0", "size": 35724 }
[ "android.graphics.Rect" ]
import android.graphics.Rect;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
437,686
public static long getAvgColLenOf(HiveConf conf, ObjectInspector oi, String colType) { long configVarLen = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_STATS_MAX_VARIABLE_LENGTH); String colTypeLowCase = colType.toLowerCase(); if (colTypeLowCase.equals(serdeConstants.STRING_TYPE_NAME)) { // constant string projection Ex: select "hello" from table if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; // if writable constant is null then return size 0 Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof StringObjectInspector) { // some UDFs may emit strings of variable length. like pattern matching // UDFs. it's hard to find the length of such UDFs. // return the variable length from config return configVarLen; } } else if (colTypeLowCase.startsWith(serdeConstants.VARCHAR_TYPE_NAME)) { // constant varchar projection if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; // if writable constant is null then return size 0 Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof HiveVarcharObjectInspector) { VarcharTypeInfo type = (VarcharTypeInfo) ((HiveVarcharObjectInspector) oi).getTypeInfo(); return type.getLength(); } } else if (colTypeLowCase.startsWith(serdeConstants.CHAR_TYPE_NAME)) { // constant char projection if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; // if writable constant is null then return size 0 Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof HiveCharObjectInspector) { CharTypeInfo type = (CharTypeInfo) ((HiveCharObjectInspector) oi).getTypeInfo(); return type.getLength(); } } else if (colTypeLowCase.equals(serdeConstants.BINARY_TYPE_NAME)) { // constant byte arrays if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; // if writable constant is null then return size 0 BytesWritable constantValue = (BytesWritable)coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.getLength(); } else if (oi instanceof BinaryObjectInspector) { // return the variable length from config return configVarLen; } } else { // complex types (map, list, struct, union) return getSizeOfComplexTypes(conf, oi); } throw new IllegalArgumentException("Size requested for unknown type: " + colType + " OI: " + oi.getTypeName()); }
static long function(HiveConf conf, ObjectInspector oi, String colType) { long configVarLen = HiveConf.getIntVar(conf, HiveConf.ConfVars.HIVE_STATS_MAX_VARIABLE_LENGTH); String colTypeLowCase = colType.toLowerCase(); if (colTypeLowCase.equals(serdeConstants.STRING_TYPE_NAME)) { if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof StringObjectInspector) { return configVarLen; } } else if (colTypeLowCase.startsWith(serdeConstants.VARCHAR_TYPE_NAME)) { if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof HiveVarcharObjectInspector) { VarcharTypeInfo type = (VarcharTypeInfo) ((HiveVarcharObjectInspector) oi).getTypeInfo(); return type.getLength(); } } else if (colTypeLowCase.startsWith(serdeConstants.CHAR_TYPE_NAME)) { if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; Object constantValue = coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.toString().length(); } else if (oi instanceof HiveCharObjectInspector) { CharTypeInfo type = (CharTypeInfo) ((HiveCharObjectInspector) oi).getTypeInfo(); return type.getLength(); } } else if (colTypeLowCase.equals(serdeConstants.BINARY_TYPE_NAME)) { if (oi instanceof ConstantObjectInspector) { ConstantObjectInspector coi = (ConstantObjectInspector) oi; BytesWritable constantValue = (BytesWritable)coi.getWritableConstantValue(); return constantValue == null ? 0 : constantValue.getLength(); } else if (oi instanceof BinaryObjectInspector) { return configVarLen; } } else { return getSizeOfComplexTypes(conf, oi); } throw new IllegalArgumentException(STR + colType + STR + oi.getTypeName()); }
/** * Get the raw data size of variable length data types * @param conf * - hive conf * @param oi * - object inspector * @param colType * - column type * @return raw data size */
Get the raw data size of variable length data types
getAvgColLenOf
{ "repo_name": "nishantmonu51/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/stats/StatsUtils.java", "license": "apache-2.0", "size": 86403 }
[ "org.apache.hadoop.hive.conf.HiveConf", "org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveCharObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveVarcharObjectInspector", "org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector", "org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo", "org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo", "org.apache.hadoop.io.BytesWritable" ]
import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveCharObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveVarcharObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector; import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo; import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo; import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.serde2.objectinspector.*; import org.apache.hadoop.hive.serde2.objectinspector.primitive.*; import org.apache.hadoop.hive.serde2.typeinfo.*; import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,025,860
public int addTexture(int drawable){ if (context!=null){ //Check to see if the context has been set for this manager. try{ int rtexture=getResourceTextureID(drawable); //Check to see if the texture has already been added to the ArrayList //(Prevents loading the same texture twice) if(rtexture==-1){ BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inScaled = false; Bitmap bmptexture= BitmapFactory.decodeResource(context.getResources(), drawable,opts); //Load the bitmap IntBuffer textureID=IntBuffer.allocate(1); //Create a textureID buffer. GLES20.glGenTextures(1,textureID); //Generate an Id for the texture. GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,textureID.get(0)); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MAG_FILTER,GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MIN_FILTER,GLES20.GL_NEAREST); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D,0,bmptexture,0); //Pass the texture to openGL Textures.add(new Texture(textureID.get(0), drawable, bmptexture.getWidth(), bmptexture.getHeight()));//Add the textures to the texture list. bmptexture.recycle(); //Release the resource. return textureID.get(0); } else return rtexture; } catch(Exception e) {} //Deal with loading errors. } return -1; }
int function(int drawable){ if (context!=null){ try{ int rtexture=getResourceTextureID(drawable); if(rtexture==-1){ BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inScaled = false; Bitmap bmptexture= BitmapFactory.decodeResource(context.getResources(), drawable,opts); IntBuffer textureID=IntBuffer.allocate(1); GLES20.glGenTextures(1,textureID); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,textureID.get(0)); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MAG_FILTER,GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MIN_FILTER,GLES20.GL_NEAREST); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D,0,bmptexture,0); Textures.add(new Texture(textureID.get(0), drawable, bmptexture.getWidth(), bmptexture.getHeight())); bmptexture.recycle(); return textureID.get(0); } else return rtexture; } catch(Exception e) {} } return -1; }
/** * Adds a texture to the texture manager. * @param drawable Resources Unique Id. * @return Texture id >=0 if successful, otherwise -1; */
Adds a texture to the texture manager
addTexture
{ "repo_name": "bytebyter/CatShanks", "path": "src/main/java/com/weight/craig/catshanks/TextureManager.java", "license": "gpl-3.0", "size": 6686 }
[ "android.graphics.Bitmap", "android.graphics.BitmapFactory", "android.opengl.GLUtils", "java.nio.IntBuffer" ]
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLUtils; import java.nio.IntBuffer;
import android.graphics.*; import android.opengl.*; import java.nio.*;
[ "android.graphics", "android.opengl", "java.nio" ]
android.graphics; android.opengl; java.nio;
2,047,932
public static Element element(Node parent) { for (Node node = parent.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) return (Element) node; } return null; }
static Element function(Node parent) { for (Node node = parent.getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) return (Element) node; } return null; }
/** * Gets the first child element of the given node, or null if not found. */
Gets the first child element of the given node, or null if not found
element
{ "repo_name": "Xenoage/Zong", "path": "utils/utils-jse/src/com/xenoage/utils/jse/xml/XMLReader.java", "license": "agpl-3.0", "size": 8697 }
[ "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import org.w3c.dom.Element; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,429,778
public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { handleContentOutlineSelection(event.getSelection()); } }
void function(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { handleContentOutlineSelection(event.getSelection()); } }
/** * This method is called by the outline page if its selection was changed. This is * accomplished by adding this class as selection change listener to the outline * page, which is performed by the editor. */
This method is called by the outline page if its selection was changed. This is accomplished by adding this class as selection change listener to the outline page, which is performed by the editor
selectionChanged
{ "repo_name": "HyVar/DarwinSPL", "path": "plugins/eu.hyvar.feature.expression.resource.hyexpression.ui/src-gen/eu/hyvar/feature/expression/resource/hyexpression/ui/HyexpressionHighlighting.java", "license": "apache-2.0", "size": 11726 }
[ "org.eclipse.jface.viewers.SelectionChangedEvent", "org.eclipse.jface.viewers.TreeSelection" ]
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,224,572
public T caseDot(Dot object) { return null; }
T function(Dot object) { return null; }
/** * Returns the result of interpreting the object as an instance of * '<em>Dot</em>'. <!-- begin-user-doc --> This implementation returns null; * returning a non-null result will terminate the switch. <!-- end-user-doc --> * * @param object the target of the switch. * @return the result of interpreting the object as an instance of * '<em>Dot</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'Dot'. This implementation returns null; returning a non-null result will terminate the switch.
caseDot
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/dots/util/DotsSwitch.java", "license": "epl-1.0", "size": 8491 }
[ "fr.lip6.move.pnml.pthlpng.dots.Dot" ]
import fr.lip6.move.pnml.pthlpng.dots.Dot;
import fr.lip6.move.pnml.pthlpng.dots.*;
[ "fr.lip6.move" ]
fr.lip6.move;
1,204,401
@Override public void enterSubRule(@NotNull PJParser.SubRuleContext ctx) { }
@Override public void enterSubRule(@NotNull PJParser.SubRuleContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitSwitchRule
{ "repo_name": "Diolor/PJ", "path": "src/main/java/com/lorentzos/pj/PJBaseListener.java", "license": "mit", "size": 73292 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
782,434
public boolean connect() throws IOException{ if( isConnected ){ System.err.println("\tAlready connected to a server!"); return false; } createResources(); isConnected = doConnect(); if( isConnected ){ isJoined = doJoin(); } if( isJoined ){ inThread.start(); outThread.start(); return true; } return false; }
boolean function() throws IOException{ if( isConnected ){ System.err.println(STR); return false; } createResources(); isConnected = doConnect(); if( isConnected ){ isJoined = doJoin(); } if( isJoined ){ inThread.start(); outThread.start(); return true; } return false; }
/**Connects to the Twitch server and joins the appropriate channel. * * @return {@code true} if connection was successful * @throws IOException In case the BufferedReader or BufferedWriter throws an error during connection. Might be due to timeout, socket closing or something else */
Connects to the Twitch server and joins the appropriate channel
connect
{ "repo_name": "Gikkman/StreamUtil", "path": "streamutil/src/main/java/com/gikk/streamutil/irc/TwitchIRC.java", "license": "apache-2.0", "size": 11284 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
19,787
public Enrollment getE2() { return iE2; }
Enrollment function() { return iE2; }
/** Second enrollment * @return second enrollment **/
Second enrollment
getE2
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/studentsct/extension/TimeOverlapsCounter.java", "license": "lgpl-3.0", "size": 30907 }
[ "org.cpsolver.studentsct.model.Enrollment" ]
import org.cpsolver.studentsct.model.Enrollment;
import org.cpsolver.studentsct.model.*;
[ "org.cpsolver.studentsct" ]
org.cpsolver.studentsct;
2,523,564
public Parcelable saveState() { return null; } /** * Restore any instance state associated with this adapter and its pages * that was previously saved by {@link #saveState()}. * * @param state State previously saved by a call to {@link #saveState()}
Parcelable function() { return null; } /** * Restore any instance state associated with this adapter and its pages * that was previously saved by {@link #saveState()}. * * @param state State previously saved by a call to {@link #saveState()}
/** * Save any instance state associated with this adapter and its pages that should be * restored if the current UI state needs to be reconstructed. * * @return Saved state for this adapter */
Save any instance state associated with this adapter and its pages that should be restored if the current UI state needs to be reconstructed
saveState
{ "repo_name": "miku-nyan/Overchan-Android", "path": "src/nya/miku/wishmaster/lib/gallery/verticalviewpager/PagerAdapter.java", "license": "gpl-3.0", "size": 13275 }
[ "android.os.Parcelable" ]
import android.os.Parcelable;
import android.os.*;
[ "android.os" ]
android.os;
541,760
public static void revert(Map<Integer, OpNode> tour, int startRevert, int endRevert) { startRevert = Util.adaptIndex(startRevert, tour.size()); endRevert = Util.adaptIndex(endRevert, tour.size()); OpNode startOpNode = tour.get(startRevert); OpNode endOpNode = tour.get(endRevert); if (startRevert == endRevert) { tour.get(startRevert).revert(); } else { OpNode toRevert = startOpNode; while (true) { OpNode nextToRevert = toRevert.getNext(); toRevert.revert(); toRevert = nextToRevert; if (toRevert.equals(endOpNode)) { break; } } endOpNode.revert(); } }
static void function(Map<Integer, OpNode> tour, int startRevert, int endRevert) { startRevert = Util.adaptIndex(startRevert, tour.size()); endRevert = Util.adaptIndex(endRevert, tour.size()); OpNode startOpNode = tour.get(startRevert); OpNode endOpNode = tour.get(endRevert); if (startRevert == endRevert) { tour.get(startRevert).revert(); } else { OpNode toRevert = startOpNode; while (true) { OpNode nextToRevert = toRevert.getNext(); toRevert.revert(); toRevert = nextToRevert; if (toRevert.equals(endOpNode)) { break; } } endOpNode.revert(); } }
/** * Reverts the edges between start and end. * * @param tour * @param startRevert * @param endRevert */
Reverts the edges between start and end
revert
{ "repo_name": "MayerTh/RVRPSimulator", "path": "vrpsim-simulationmodel-initialbehaviour-simpleapi/src/main/java/vrpsim/simulationmodel/initialbehaviour/simpleapi/impl/us/Util.java", "license": "apache-2.0", "size": 16074 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
713,597
void append(Data buff, UndoLog log) { int p = buff.length(); buff.writeInt(0); buff.writeInt(operation); buff.writeByte(row.isDeleted() ? (byte) 1 : (byte) 0); buff.writeInt(log.getTableId(table)); buff.writeLong(row.getKey()); buff.writeInt(row.getSessionId()); int count = row.getColumnCount(); buff.writeInt(count); for (int i = 0; i < count; i++) { Value v = row.getValue(i); buff.checkCapacity(buff.getValueLen(v)); buff.writeValue(v); } buff.fillAligned(); buff.setInt(p, (buff.length() - p) / Constants.FILE_BLOCK_SIZE); }
void append(Data buff, UndoLog log) { int p = buff.length(); buff.writeInt(0); buff.writeInt(operation); buff.writeByte(row.isDeleted() ? (byte) 1 : (byte) 0); buff.writeInt(log.getTableId(table)); buff.writeLong(row.getKey()); buff.writeInt(row.getSessionId()); int count = row.getColumnCount(); buff.writeInt(count); for (int i = 0; i < count; i++) { Value v = row.getValue(i); buff.checkCapacity(buff.getValueLen(v)); buff.writeValue(v); } buff.fillAligned(); buff.setInt(p, (buff.length() - p) / Constants.FILE_BLOCK_SIZE); }
/** * Append the row to the buffer. * * @param buff the buffer * @param log the undo log */
Append the row to the buffer
append
{ "repo_name": "miloszpiglas/h2mod", "path": "src/main/org/h2/engine/UndoLogRecord.java", "license": "mpl-2.0", "size": 7995 }
[ "org.h2.store.Data", "org.h2.value.Value" ]
import org.h2.store.Data; import org.h2.value.Value;
import org.h2.store.*; import org.h2.value.*;
[ "org.h2.store", "org.h2.value" ]
org.h2.store; org.h2.value;
1,731,691
if (!m_Connected) { m_Terminal = new UDPMasterTerminal(); m_Terminal.setLocalAddress(InetAddress.getLocalHost()); m_Terminal.setLocalPort(5000); m_Terminal.setRemoteAddress(m_Address); m_Terminal.setRemotePort(m_Port); m_Terminal.setTimeout(m_Timeout); m_Terminal.activate(); m_Connected = true; } }// connect
if (!m_Connected) { m_Terminal = new UDPMasterTerminal(); m_Terminal.setLocalAddress(InetAddress.getLocalHost()); m_Terminal.setLocalPort(5000); m_Terminal.setRemoteAddress(m_Address); m_Terminal.setRemotePort(m_Port); m_Terminal.setTimeout(m_Timeout); m_Terminal.activate(); m_Connected = true; } }
/** * Opens this <tt>UDPMasterConnection</tt>. * * @throws Exception if there is a network failure. */
Opens this UDPMasterConnection
connect
{ "repo_name": "paolodenti/openhab", "path": "bundles/binding/org.openhab.binding.modbus/src/main/java/net/wimpi/modbus/net/UDPMasterConnection.java", "license": "epl-1.0", "size": 4758 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
22,889
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { super.getSubItems(par1, par2CreativeTabs, par3List); int var5; if (field_77835_b.isEmpty()) { for (int var4 = 0; var4 <= 15; ++var4) { for (var5 = 0; var5 <= 1; ++var5) { int var6; if (var5 == 0) { var6 = var4 | 8192; } else { var6 = var4 | 16384; } for (int var7 = 0; var7 <= 2; ++var7) { int var8 = var6; if (var7 != 0) { if (var7 == 1) { var8 = var6 | 32; } else if (var7 == 2) { var8 = var6 | 64; } } List var9 = PotionHelper.getPotionEffects(var8, false); if (var9 != null && !var9.isEmpty()) { field_77835_b.put(var9, Integer.valueOf(var8)); } } } } } Iterator var10 = field_77835_b.values().iterator(); while (var10.hasNext()) { var5 = ((Integer)var10.next()).intValue(); par3List.add(new ItemStack(par1, 1, var5)); } }
void function(int par1, CreativeTabs par2CreativeTabs, List par3List) { super.getSubItems(par1, par2CreativeTabs, par3List); int var5; if (field_77835_b.isEmpty()) { for (int var4 = 0; var4 <= 15; ++var4) { for (var5 = 0; var5 <= 1; ++var5) { int var6; if (var5 == 0) { var6 = var4 8192; } else { var6 = var4 16384; } for (int var7 = 0; var7 <= 2; ++var7) { int var8 = var6; if (var7 != 0) { if (var7 == 1) { var8 = var6 32; } else if (var7 == 2) { var8 = var6 64; } } List var9 = PotionHelper.getPotionEffects(var8, false); if (var9 != null && !var9.isEmpty()) { field_77835_b.put(var9, Integer.valueOf(var8)); } } } } } Iterator var10 = field_77835_b.values().iterator(); while (var10.hasNext()) { var5 = ((Integer)var10.next()).intValue(); par3List.add(new ItemStack(par1, 1, var5)); } }
/** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */
returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
getSubItems
{ "repo_name": "LolololTrololol/InsertNameHere", "path": "minecraft/net/minecraft/src/ItemPotion.java", "license": "gpl-2.0", "size": 14632 }
[ "java.util.Iterator", "java.util.List" ]
import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
128,442
@Override public String toString() { return "null"; } } private Map map; public static final Object NULL = new Null(); public JSONObject() { this.map = new HashMap(); } public JSONObject(JSONObject jo, String[] names) { this(); for (int i = 0; i < names.length; i += 1) { try { putOnce(names[i], jo.opt(names[i])); } catch (Exception ignore) { } } } public JSONObject(JSONTokener x) throws JSONException { this(); char c; String key; if (x.nextClean() != '{') { throw x.syntaxError("A JSONObject text must begin with '{' found:" +x.nextClean()); } for (; ;) { c = x.nextClean(); switch (c) { case 0: throw x.syntaxError("A JSONObject text must end with '}'"); case '}': return; default: x.back(); key = x.nextValue().toString(); } // The key is followed by ':'. We will also tolerate '=' or '=>'. c = x.nextClean(); if (c == '=') { if (x.next() != '>') { x.back(); } } else if (c != ':') { throw x.syntaxError("Expected a ':' after a key"); } putOnce(key, x.nextValue()); // Pairs are separated by ','. We will also tolerate ';'. switch (x.nextClean()) { case ';': case ',': if (x.nextClean() == '}') { return; } x.back(); break; case '}': return; default: throw x.syntaxError("Expected a ',' or '}'"); } } } public JSONObject(Map map) { this.map = new HashMap(); if (map != null) { Iterator i = map.entrySet().iterator(); while (i.hasNext()) { Map.Entry e = (Map.Entry) i.next(); Object value = e.getValue(); if (value != null) { this.map.put(e.getKey(), wrap(value)); } } } } public JSONObject(Object bean) { this(); populateMap(bean); } public JSONObject(Object object, String names[]) { this(); Class c = object.getClass(); for (int i = 0; i < names.length; i += 1) { String name = names[i]; try { putOpt(name, c.getField(name).get(object)); } catch (Exception ignore) { } } } public JSONObject(String source) throws JSONException { this(new JSONTokener(source)); } public JSONObject(String baseName, Locale locale) throws JSONException { this(); ResourceBundle r = ResourceBundle.getBundle(baseName, locale, Thread.currentThread().getContextClassLoader()); // Iterate through the keys in the bundle. Enumeration keys = r.getKeys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if (key instanceof String) { // Go through the path, ensuring that there is a nested JSONObject for each // segment except the last. Add the value using the last segment's name into // the deepest nested JSONObject. String[] path = ((String) key).split("\\."); int last = path.length - 1; JSONObject target = this; for (int i = 0; i < last; i += 1) { String segment = path[i]; JSONObject nextTarget = target.optJSONObject(segment); if (nextTarget == null) { nextTarget = new JSONObject(); target.put(segment, nextTarget); } target = nextTarget; } target.put(path[last], r.getString((String) key)); } } }
String function() { return "null"; } } private Map map; public static final Object NULL = new Null(); public JSONObject() { this.map = new HashMap(); } public JSONObject(JSONObject jo, String[] names) { this(); for (int i = 0; i < names.length; i += 1) { try { putOnce(names[i], jo.opt(names[i])); } catch (Exception ignore) { } } } public JSONObject(JSONTokener x) throws JSONException { this(); char c; String key; if (x.nextClean() != '{') { throw x.syntaxError(STR +x.nextClean()); } for (; ;) { c = x.nextClean(); switch (c) { case 0: throw x.syntaxError(STR); case '}': return; default: x.back(); key = x.nextValue().toString(); } c = x.nextClean(); if (c == '=') { if (x.next() != '>') { x.back(); } } else if (c != ':') { throw x.syntaxError(STR); } putOnce(key, x.nextValue()); switch (x.nextClean()) { case ';': case ',': if (x.nextClean() == '}') { return; } x.back(); break; case '}': return; default: throw x.syntaxError(STR); } } } public JSONObject(Map map) { this.map = new HashMap(); if (map != null) { Iterator i = map.entrySet().iterator(); while (i.hasNext()) { Map.Entry e = (Map.Entry) i.next(); Object value = e.getValue(); if (value != null) { this.map.put(e.getKey(), wrap(value)); } } } } public JSONObject(Object bean) { this(); populateMap(bean); } public JSONObject(Object object, String names[]) { this(); Class c = object.getClass(); for (int i = 0; i < names.length; i += 1) { String name = names[i]; try { putOpt(name, c.getField(name).get(object)); } catch (Exception ignore) { } } } public JSONObject(String source) throws JSONException { this(new JSONTokener(source)); } public JSONObject(String baseName, Locale locale) throws JSONException { this(); ResourceBundle r = ResourceBundle.getBundle(baseName, locale, Thread.currentThread().getContextClassLoader()); Enumeration keys = r.getKeys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if (key instanceof String) { String[] path = ((String) key).split("\\."); int last = path.length - 1; JSONObject target = this; for (int i = 0; i < last; i += 1) { String segment = path[i]; JSONObject nextTarget = target.optJSONObject(segment); if (nextTarget == null) { nextTarget = new JSONObject(); target.put(segment, nextTarget); } target = nextTarget; } target.put(path[last], r.getString((String) key)); } } }
/** * Get the "null" string value. * * @return The string "null". */
Get the "null" string value
toString
{ "repo_name": "igorekpotworek/facebook4j", "path": "facebook4j-core/src/main/java/facebook4j/internal/org/json/JSONObject.java", "license": "apache-2.0", "size": 56492 }
[ "java.util.Enumeration", "java.util.HashMap", "java.util.Iterator", "java.util.Locale", "java.util.Map", "java.util.ResourceBundle" ]
import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle;
import java.util.*;
[ "java.util" ]
java.util;
2,680,737
public Builder withStartDate(Date startDate) { this.startDate = startDate; return this; }
Builder function(Date startDate) { this.startDate = startDate; return this; }
/** * The date to start auto transfer * * @param startDate The start date */
The date to start auto transfer
withStartDate
{ "repo_name": "tosanboom/java-sdk", "path": "src/main/java/ir/boommarket/deposits/ListAutoTransferRequest.java", "license": "apache-2.0", "size": 6108 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
711,596
private void translate(final CharSequence input, final Writer out) throws IOException { if (out == null) { throw new IllegalArgumentException("The Writer must not be null"); } if (input == null) { return; } int pos = 0; final int len = input.length(); while (pos < len) { final int consumed = translate(input, pos, out); if (consumed == 0) { // inlined implementation of Character.toChars(Character.codePointAt(input, pos)) // avoids allocating temp char arrays and duplicate checks char c1 = input.charAt(pos); out.write(c1); pos++; if (Character.isHighSurrogate(c1) && pos < len) { char c2 = input.charAt(pos); if (Character.isLowSurrogate(c2)) { out.write(c2); pos++; } } continue; } // contract with translators is that they have to understand codepoints // and they just took care of a surrogate pair for (int pt = 0; pt < consumed; pt++) { pos += Character.charCount(Character.codePointAt(input, pos)); } } }
void function(final CharSequence input, final Writer out) throws IOException { if (out == null) { throw new IllegalArgumentException(STR); } if (input == null) { return; } int pos = 0; final int len = input.length(); while (pos < len) { final int consumed = translate(input, pos, out); if (consumed == 0) { char c1 = input.charAt(pos); out.write(c1); pos++; if (Character.isHighSurrogate(c1) && pos < len) { char c2 = input.charAt(pos); if (Character.isLowSurrogate(c2)) { out.write(c2); pos++; } } continue; } for (int pt = 0; pt < consumed; pt++) { pos += Character.charCount(Character.codePointAt(input, pos)); } } }
/** * Translate an input onto a Writer. This is intentionally final as its algorithm is * tightly coupled with the abstract method of this class. * * @param input CharSequence that is being translated * @param out Writer to translate the text to * @throws IOException if and only if the Writer produces an IOException */
Translate an input onto a Writer. This is intentionally final as its algorithm is tightly coupled with the abstract method of this class
translate
{ "repo_name": "spark/spark-setup-android", "path": "devicesetup/src/main/java/io/particle/android/sdk/devicesetup/commands/CommandClientUtils.java", "license": "apache-2.0", "size": 19210 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,161,382
public HadoopJarStepConfig newInstallPigStep(String... pigVersions) { if (pigVersions != null && pigVersions.length > 0) { return newHivePigStep("pig", "--install-pig", "--pig-versions", StringUtils.join(",", pigVersions)); } return newHivePigStep("pig", "--install-pig", "--pig-versions", "latest"); }
HadoopJarStepConfig function(String... pigVersions) { if (pigVersions != null && pigVersions.length > 0) { return newHivePigStep("pig", STR, STR, StringUtils.join(",", pigVersions)); } return newHivePigStep("pig", STR, STR, STR); }
/** * Step that installs Pig on your job flow. * * @param pigVersions the versions of Pig to install. * * @return HadoopJarStepConfig that can be passed to your job flow. */
Step that installs Pig on your job flow
newInstallPigStep
{ "repo_name": "flofreud/aws-sdk-java", "path": "aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java", "license": "apache-2.0", "size": 10846 }
[ "com.amazonaws.services.elasticmapreduce.model.HadoopJarStepConfig", "com.amazonaws.util.StringUtils" ]
import com.amazonaws.services.elasticmapreduce.model.HadoopJarStepConfig; import com.amazonaws.util.StringUtils;
import com.amazonaws.services.elasticmapreduce.model.*; import com.amazonaws.util.*;
[ "com.amazonaws.services", "com.amazonaws.util" ]
com.amazonaws.services; com.amazonaws.util;
1,161,635
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "alexismp/egress", "path": "server/src/main/java/org/alexismp/egress/ResetStationServlet.java", "license": "apache-2.0", "size": 5804 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
1,595,448
final Resources res = context.getResources(); String delayMinutesStr = PreferenceUtils.getString(PreferenceKeys.SETTINGS_ALARM_REPEAT_FREQUENCY, "15"); // This image is used as the notification's large icon (thumbnail). final Bitmap picture = BitmapFactory.decodeResource(res, R.drawable.ic_event_available_black_48dp); //final Bitmap largeIcon = BitmapFactory.decodeResource(res, R.drawable.ic_pill_48dp); NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); style.setBigContentTitle(description); //style.setSummaryText("Notification Summary"); final String ticker = title; PendingIntent defaultIntent = PendingIntent.getActivity( context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); final NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NotificationHelper.CHANNEL_DEFAULT_ID) // Set appropriate defaults for the notification light, sound, // and vibration. .setDefaults(Notification.DEFAULT_ALL) .setSmallIcon(R.drawable.ic_event_available_white_48dp) .setLargeIcon(picture) .setContentTitle(title) .setContentText(description) .setAutoCancel(true) .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setLargeIcon(picture) .setTicker(ticker) .setContentIntent(defaultIntent) .setStyle(style) //.setSound(ringtoneUri != null ? ringtoneUri : Settings.System.DEFAULT_NOTIFICATION_URI) .setAutoCancel(true); if (NotificationHelper.isNotificationVibrationEnabled(context)) { builder.setVibrate(NotificationHelper.VIBRATION_PATTERN_DEFAULT); } else { builder.setVibrate(NotificationHelper.VIBRATION_PATTERN_NONE); } Notification n = builder.build(); n.defaults = 0; n.ledARGB = 0x00ffa500; n.ledOnMS = 1000; n.ledOffMS = 2000; notify(context, n); }
final Resources res = context.getResources(); String delayMinutesStr = PreferenceUtils.getString(PreferenceKeys.SETTINGS_ALARM_REPEAT_FREQUENCY, "15"); final Bitmap picture = BitmapFactory.decodeResource(res, R.drawable.ic_event_available_black_48dp); NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); style.setBigContentTitle(description); final String ticker = title; PendingIntent defaultIntent = PendingIntent.getActivity( context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); final NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NotificationHelper.CHANNEL_DEFAULT_ID) .setDefaults(Notification.DEFAULT_ALL) .setSmallIcon(R.drawable.ic_event_available_white_48dp) .setLargeIcon(picture) .setContentTitle(title) .setContentText(description) .setAutoCancel(true) .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setLargeIcon(picture) .setTicker(ticker) .setContentIntent(defaultIntent) .setStyle(style) .setAutoCancel(true); if (NotificationHelper.isNotificationVibrationEnabled(context)) { builder.setVibrate(NotificationHelper.VIBRATION_PATTERN_DEFAULT); } else { builder.setVibrate(NotificationHelper.VIBRATION_PATTERN_NONE); } Notification n = builder.build(); n.defaults = 0; n.ledARGB = 0x00ffa500; n.ledOnMS = 1000; n.ledOffMS = 2000; notify(context, n); }
/** * Shows the notification, or updates a previously shown notification of * this type, with the given parameters. * * @see #cancel(android.content.Context) */
Shows the notification, or updates a previously shown notification of this type, with the given parameters
notify
{ "repo_name": "citiususc/calendula", "path": "Calendula/src/main/java/es/usc/citius/servando/calendula/activities/PickupNotification.java", "license": "gpl-3.0", "size": 4788 }
[ "android.app.Notification", "android.app.PendingIntent", "android.content.res.Resources", "android.graphics.Bitmap", "android.graphics.BitmapFactory", "android.support.v4.app.NotificationCompat", "es.usc.citius.servando.calendula.notifications.NotificationHelper", "es.usc.citius.servando.calendula.util.PreferenceKeys", "es.usc.citius.servando.calendula.util.PreferenceUtils" ]
import android.app.Notification; import android.app.PendingIntent; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.support.v4.app.NotificationCompat; import es.usc.citius.servando.calendula.notifications.NotificationHelper; import es.usc.citius.servando.calendula.util.PreferenceKeys; import es.usc.citius.servando.calendula.util.PreferenceUtils;
import android.app.*; import android.content.res.*; import android.graphics.*; import android.support.v4.app.*; import es.usc.citius.servando.calendula.notifications.*; import es.usc.citius.servando.calendula.util.*;
[ "android.app", "android.content", "android.graphics", "android.support", "es.usc.citius" ]
android.app; android.content; android.graphics; android.support; es.usc.citius;
1,711,060
@Test public void testIdleConnectionIsSentKeepAlive() throws SQLException, InterruptedException, CloneNotSupportedException { LinkedBlockingQueue<ConnectionHandle> fakeFreeConnections = new LinkedBlockingQueue<ConnectionHandle>(100); fakeFreeConnections.add(mockConnection); BoneCPConfig localconfig = config.clone(); localconfig.setIdleConnectionTestPeriodInMinutes(1); localconfig.setIdleMaxAgeInMinutes(0); expect(mockPool.getConfig()).andReturn(localconfig).anyTimes(); expect(mockConnectionPartition.getFreeConnections()).andReturn(fakeFreeConnections).anyTimes(); // expect(mockConnectionPartition.getMinConnections()).andReturn(10).once(); expect(mockConnectionPartition.getAvailableConnections()).andReturn(2).anyTimes(); expect(mockConnection.isPossiblyBroken()).andReturn(false); expect(mockConnection.getConnectionLastUsedInMs()).andReturn(0L); expect(mockPool.isConnectionHandleAlive((ConnectionHandle)anyObject())).andReturn(true).anyTimes(); mockPool.putConnectionBackInPartition((ConnectionHandle)anyObject()); replay(mockPool, mockConnection, mockConnectionPartition, mockExecutor); this.testClass = new ConnectionTesterThread(mockConnectionPartition, mockExecutor, mockPool, localconfig.getIdleMaxAgeInMinutes(), localconfig.getIdleConnectionTestPeriodInMinutes(), false); this.testClass.run(); verify(mockPool, mockConnectionPartition, mockExecutor, mockConnection); }
void function() throws SQLException, InterruptedException, CloneNotSupportedException { LinkedBlockingQueue<ConnectionHandle> fakeFreeConnections = new LinkedBlockingQueue<ConnectionHandle>(100); fakeFreeConnections.add(mockConnection); BoneCPConfig localconfig = config.clone(); localconfig.setIdleConnectionTestPeriodInMinutes(1); localconfig.setIdleMaxAgeInMinutes(0); expect(mockPool.getConfig()).andReturn(localconfig).anyTimes(); expect(mockConnectionPartition.getFreeConnections()).andReturn(fakeFreeConnections).anyTimes(); expect(mockConnectionPartition.getAvailableConnections()).andReturn(2).anyTimes(); expect(mockConnection.isPossiblyBroken()).andReturn(false); expect(mockConnection.getConnectionLastUsedInMs()).andReturn(0L); expect(mockPool.isConnectionHandleAlive((ConnectionHandle)anyObject())).andReturn(true).anyTimes(); mockPool.putConnectionBackInPartition((ConnectionHandle)anyObject()); replay(mockPool, mockConnection, mockConnectionPartition, mockExecutor); this.testClass = new ConnectionTesterThread(mockConnectionPartition, mockExecutor, mockPool, localconfig.getIdleMaxAgeInMinutes(), localconfig.getIdleConnectionTestPeriodInMinutes(), false); this.testClass.run(); verify(mockPool, mockConnectionPartition, mockExecutor, mockConnection); }
/** Tests that a connection gets to receive a keep-alive. * @throws SQLException * @throws InterruptedException * @throws CloneNotSupportedException */
Tests that a connection gets to receive a keep-alive
testIdleConnectionIsSentKeepAlive
{ "repo_name": "squidsolutions/bonecp", "path": "bonecp/src/test/java/com/jolbox/bonecp/TestConnectionThreadTester.java", "license": "apache-2.0", "size": 23457 }
[ "java.sql.SQLException", "java.util.concurrent.LinkedBlockingQueue", "org.easymock.EasyMock" ]
import java.sql.SQLException; import java.util.concurrent.LinkedBlockingQueue; import org.easymock.EasyMock;
import java.sql.*; import java.util.concurrent.*; import org.easymock.*;
[ "java.sql", "java.util", "org.easymock" ]
java.sql; java.util; org.easymock;
1,745,668
public int updateValue(Value value, String treeId) throws PdcException;
int function(Value value, String treeId) throws PdcException;
/** * Method declaration * * @param value * @return * @throws PdcException * @see */
Method declaration
updateValue
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-services/pdc/src/main/java/org/silverpeas/core/pdc/pdc/service/PdcManager.java", "license": "agpl-3.0", "size": 15237 }
[ "org.silverpeas.core.pdc.pdc.model.PdcException", "org.silverpeas.core.pdc.pdc.model.Value" ]
import org.silverpeas.core.pdc.pdc.model.PdcException; import org.silverpeas.core.pdc.pdc.model.Value;
import org.silverpeas.core.pdc.pdc.model.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
1,427,565
public synchronized void addItemListener(ItemListener listener) { item_listeners = AWTEventMulticaster.add(item_listeners, listener); }
synchronized void function(ItemListener listener) { item_listeners = AWTEventMulticaster.add(item_listeners, listener); }
/** * Adds a new listeners to the list of registered listeners for this object. * * @param listener The new listener to add. */
Adds a new listeners to the list of registered listeners for this object
addItemListener
{ "repo_name": "unofficial-opensource-apple/gccfast", "path": "libjava/java/awt/Checkbox.java", "license": "gpl-2.0", "size": 10096 }
[ "java.awt.event.ItemListener" ]
import java.awt.event.ItemListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
2,830,892
synchronized void bpRegistrationSucceeded(DatanodeRegistration bpRegistration, String blockPoolId) throws IOException { id = bpRegistration; if(!storage.getDatanodeUuid().equals(bpRegistration.getDatanodeUuid())) { throw new IOException("Inconsistent Datanode IDs. Name-node returned " + bpRegistration.getDatanodeUuid() + ". Expecting " + storage.getDatanodeUuid()); } registerBlockPoolWithSecretManager(bpRegistration, blockPoolId); }
synchronized void bpRegistrationSucceeded(DatanodeRegistration bpRegistration, String blockPoolId) throws IOException { id = bpRegistration; if(!storage.getDatanodeUuid().equals(bpRegistration.getDatanodeUuid())) { throw new IOException(STR + bpRegistration.getDatanodeUuid() + STR + storage.getDatanodeUuid()); } registerBlockPoolWithSecretManager(bpRegistration, blockPoolId); }
/** * Check that the registration returned from a NameNode is consistent * with the information in the storage. If the storage is fresh/unformatted, * sets the storage ID based on this registration. * Also updates the block pool's state in the secret manager. */
Check that the registration returned from a NameNode is consistent with the information in the storage. If the storage is fresh/unformatted, sets the storage ID based on this registration. Also updates the block pool's state in the secret manager
bpRegistrationSucceeded
{ "repo_name": "myeoje/PhillyYarn", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java", "license": "apache-2.0", "size": 118725 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration" ]
import java.io.IOException; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration;
import java.io.*; import org.apache.hadoop.hdfs.server.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
728,138
EReference getQMatch_GetterClosure();
EReference getQMatch_GetterClosure();
/** * Returns the meta object for the reference '{@link org.eclectic.idc.qool.QMatch#getGetterClosure <em>Getter Closure</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference '<em>Getter Closure</em>'. * @see org.eclectic.idc.qool.QMatch#getGetterClosure() * @see #getQMatch() * @generated */
Returns the meta object for the reference '<code>org.eclectic.idc.qool.QMatch#getGetterClosure Getter Closure</code>'.
getQMatch_GetterClosure
{ "repo_name": "jesusc/eclectic", "path": "plugins/org.eclectic.idc/src-gen/org/eclectic/idc/qool/QoolPackage.java", "license": "gpl-3.0", "size": 60729 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
644,477
public static String getPasswordResetToken(final RequestContext requestContext) { val flowScope = requestContext.getFlowScope(); return flowScope.getString(FLOWSCOPE_PARAMETER_NAME_TOKEN); }
static String function(final RequestContext requestContext) { val flowScope = requestContext.getFlowScope(); return flowScope.getString(FLOWSCOPE_PARAMETER_NAME_TOKEN); }
/** * Gets password reset token. * * @param requestContext the request context * @return the password reset token */
Gets password reset token
getPasswordResetToken
{ "repo_name": "rrenomeron/cas", "path": "support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java", "license": "apache-2.0", "size": 4079 }
[ "org.springframework.webflow.execution.RequestContext" ]
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.*;
[ "org.springframework.webflow" ]
org.springframework.webflow;
2,246,018
protected PKIXBuilderParameters getPKIXBuilderParameters(PKIXValidationInformation validationInfo, X509Credential untrustedCredential) throws GeneralSecurityException { Set<TrustAnchor> trustAnchors = getTrustAnchors(validationInfo); if (trustAnchors == null || trustAnchors.isEmpty()) { throw new GeneralSecurityException( "Unable to validate X509 certificate, no trust anchors found in the PKIX validation information"); } X509CertSelector selector = new X509CertSelector(); selector.setCertificate(untrustedCredential.getEntityCertificate()); log.trace("Adding trust anchors to PKIX validator parameters"); PKIXBuilderParameters params = new PKIXBuilderParameters(trustAnchors, selector); Integer effectiveVerifyDepth = getEffectiveVerificationDepth(validationInfo); log.trace("Setting max verification depth to: {} ", effectiveVerifyDepth); params.setMaxPathLength(effectiveVerifyDepth); CertStore certStore = buildCertStore(validationInfo, untrustedCredential); params.addCertStore(certStore); if (storeContainsCRLs(certStore)) { log.trace("At least one CRL was present in cert store, enabling revocation checking"); params.setRevocationEnabled(true); } else { log.trace("No CRLs present in cert store, disabling revocation checking"); params.setRevocationEnabled(false); } return params; }
PKIXBuilderParameters function(PKIXValidationInformation validationInfo, X509Credential untrustedCredential) throws GeneralSecurityException { Set<TrustAnchor> trustAnchors = getTrustAnchors(validationInfo); if (trustAnchors == null trustAnchors.isEmpty()) { throw new GeneralSecurityException( STR); } X509CertSelector selector = new X509CertSelector(); selector.setCertificate(untrustedCredential.getEntityCertificate()); log.trace(STR); PKIXBuilderParameters params = new PKIXBuilderParameters(trustAnchors, selector); Integer effectiveVerifyDepth = getEffectiveVerificationDepth(validationInfo); log.trace(STR, effectiveVerifyDepth); params.setMaxPathLength(effectiveVerifyDepth); CertStore certStore = buildCertStore(validationInfo, untrustedCredential); params.addCertStore(certStore); if (storeContainsCRLs(certStore)) { log.trace(STR); params.setRevocationEnabled(true); } else { log.trace(STR); params.setRevocationEnabled(false); } return params; }
/** * Creates the set of PKIX builder parameters to use when building the cert path builder. * * @param validationInfo PKIX validation information * @param untrustedCredential credential to be validated * * @return PKIX builder params * * @throws GeneralSecurityException thrown if the parameters can not be created */
Creates the set of PKIX builder parameters to use when building the cert path builder
getPKIXBuilderParameters
{ "repo_name": "duck1123/java-xmltooling", "path": "src/main/java/org/opensaml/xml/security/x509/CertPathPKIXTrustEvaluator.java", "license": "apache-2.0", "size": 13227 }
[ "java.security.GeneralSecurityException", "java.security.cert.CertStore", "java.security.cert.PKIXBuilderParameters", "java.security.cert.TrustAnchor", "java.security.cert.X509CertSelector", "java.util.Set" ]
import java.security.GeneralSecurityException; import java.security.cert.CertStore; import java.security.cert.PKIXBuilderParameters; import java.security.cert.TrustAnchor; import java.security.cert.X509CertSelector; import java.util.Set;
import java.security.*; import java.security.cert.*; import java.util.*;
[ "java.security", "java.util" ]
java.security; java.util;
972,498
private void handleLinkedDiagrams(BaseElement baseElement, GenericShape shape, Configuration config) { if(baseElement == null || !shape.getStencilId().matches(".*SubConversation.*")) { return; } String entry = shape.getProperty("entry"); if(entry == null || entry.length() == 0) { return; } SignavioMetaData metaData = new SignavioMetaData("entry", entry); baseElement.getOrCreateExtensionElements().add(metaData); Definitions linkedDiagram = SubprocessFactory.retrieveDefinitionsOfLinkedDiagram(entry, config); if(linkedDiagram == null || linkedDiagram.getRootElement().size() == 0) { return; } for(BaseElement rootEl : linkedDiagram.getRootElement()) { if(rootEl instanceof Collaboration) { Collaboration linkedCon = (Collaboration) rootEl; if(baseElement instanceof SubConversation) { SubConversation subConversation = (SubConversation) baseElement; for(ConversationNode node : linkedCon.getConversationNode()) { subConversation.getConversationNode().add(node); subConversation._diagramElements.add(node._diagramElement); } for(ConversationLink link : linkedCon.getConversationLink()) { subConversation.getConversationLink().add(link); subConversation._diagramElements.add(link._diagramElement); } for(Artifact a : linkedCon.getArtifact()) { subConversation.getArtifact().add(a); subConversation._diagramElements.add(a._diagramElement); } for(MessageFlow m : linkedCon.getMessageFlow()) { subConversation.getMessageFlow().add(m); subConversation._diagramElements.add(m._diagramElement); } for(Participant p : linkedCon.getParticipant()) { subConversation.getParticipantRef().add(p); subConversation._diagramElements.add(p._diagramElement); } for(Association associ : linkedCon.getAssociation()) { subConversation.getAssociation().add(associ); subConversation._diagramElements.add(associ._diagramElement); } } else if(baseElement instanceof CallConversation) { CallConversation callConversation = (CallConversation) baseElement; callConversation.setCalledElementRef(linkedCon); for(BaseElement baseEl : linkedCon.getChilds()) { callConversation._diagramElements.add(baseEl._diagramElement); } } } } }
void function(BaseElement baseElement, GenericShape shape, Configuration config) { if(baseElement == null !shape.getStencilId().matches(STR)) { return; } String entry = shape.getProperty("entry"); if(entry == null entry.length() == 0) { return; } SignavioMetaData metaData = new SignavioMetaData("entry", entry); baseElement.getOrCreateExtensionElements().add(metaData); Definitions linkedDiagram = SubprocessFactory.retrieveDefinitionsOfLinkedDiagram(entry, config); if(linkedDiagram == null linkedDiagram.getRootElement().size() == 0) { return; } for(BaseElement rootEl : linkedDiagram.getRootElement()) { if(rootEl instanceof Collaboration) { Collaboration linkedCon = (Collaboration) rootEl; if(baseElement instanceof SubConversation) { SubConversation subConversation = (SubConversation) baseElement; for(ConversationNode node : linkedCon.getConversationNode()) { subConversation.getConversationNode().add(node); subConversation._diagramElements.add(node._diagramElement); } for(ConversationLink link : linkedCon.getConversationLink()) { subConversation.getConversationLink().add(link); subConversation._diagramElements.add(link._diagramElement); } for(Artifact a : linkedCon.getArtifact()) { subConversation.getArtifact().add(a); subConversation._diagramElements.add(a._diagramElement); } for(MessageFlow m : linkedCon.getMessageFlow()) { subConversation.getMessageFlow().add(m); subConversation._diagramElements.add(m._diagramElement); } for(Participant p : linkedCon.getParticipant()) { subConversation.getParticipantRef().add(p); subConversation._diagramElements.add(p._diagramElement); } for(Association associ : linkedCon.getAssociation()) { subConversation.getAssociation().add(associ); subConversation._diagramElements.add(associ._diagramElement); } } else if(baseElement instanceof CallConversation) { CallConversation callConversation = (CallConversation) baseElement; callConversation.setCalledElementRef(linkedCon); for(BaseElement baseEl : linkedCon.getChilds()) { callConversation._diagramElements.add(baseEl._diagramElement); } } } } }
/** * Transforms linked diagrams of collapsed subprocess and event subprocess. * * @param baseElement * @param shape * @param config */
Transforms linked diagrams of collapsed subprocess and event subprocess
handleLinkedDiagrams
{ "repo_name": "axemblr/activiti-karaf", "path": "bpmn-webui-components/bpmn-webui-bpmn20-model/src/main/java/de/hpi/bpmn2_0/factory/node/ConversationFactory.java", "license": "apache-2.0", "size": 8237 }
[ "de.hpi.bpmn2_0.factory.configuration.Configuration", "de.hpi.bpmn2_0.model.BaseElement", "de.hpi.bpmn2_0.model.Collaboration", "de.hpi.bpmn2_0.model.Definitions", "de.hpi.bpmn2_0.model.artifacts.Artifact", "de.hpi.bpmn2_0.model.connector.Association", "de.hpi.bpmn2_0.model.connector.MessageFlow", "de.hpi.bpmn2_0.model.conversation.CallConversation", "de.hpi.bpmn2_0.model.conversation.ConversationLink", "de.hpi.bpmn2_0.model.conversation.ConversationNode", "de.hpi.bpmn2_0.model.conversation.SubConversation", "de.hpi.bpmn2_0.model.extension.signavio.SignavioMetaData", "de.hpi.bpmn2_0.model.participant.Participant", "org.oryxeditor.server.diagram.generic.GenericShape" ]
import de.hpi.bpmn2_0.factory.configuration.Configuration; import de.hpi.bpmn2_0.model.BaseElement; import de.hpi.bpmn2_0.model.Collaboration; import de.hpi.bpmn2_0.model.Definitions; import de.hpi.bpmn2_0.model.artifacts.Artifact; import de.hpi.bpmn2_0.model.connector.Association; import de.hpi.bpmn2_0.model.connector.MessageFlow; import de.hpi.bpmn2_0.model.conversation.CallConversation; import de.hpi.bpmn2_0.model.conversation.ConversationLink; import de.hpi.bpmn2_0.model.conversation.ConversationNode; import de.hpi.bpmn2_0.model.conversation.SubConversation; import de.hpi.bpmn2_0.model.extension.signavio.SignavioMetaData; import de.hpi.bpmn2_0.model.participant.Participant; import org.oryxeditor.server.diagram.generic.GenericShape;
import de.hpi.bpmn2_0.factory.configuration.*; import de.hpi.bpmn2_0.model.*; import de.hpi.bpmn2_0.model.artifacts.*; import de.hpi.bpmn2_0.model.connector.*; import de.hpi.bpmn2_0.model.conversation.*; import de.hpi.bpmn2_0.model.extension.signavio.*; import de.hpi.bpmn2_0.model.participant.*; import org.oryxeditor.server.diagram.generic.*;
[ "de.hpi.bpmn2_0", "org.oryxeditor.server" ]
de.hpi.bpmn2_0; org.oryxeditor.server;
2,063,378
private static byte[] getDigestC(String algorithm, byte[] digestAC, byte[] sequenceP, byte[] sequenceS, int round) throws NoSuchAlgorithmException { // a) start digest C MessageDigest digestC = getMessageDigest(algorithm); // b) for odd round numbers add the byte sequence P to digest C // c) for even round numbers add digest A/C if (round % 2 != 0) { digestC.update(sequenceP, 0, sequenceP.length); } else { digestC.update(digestAC, 0, digestAC.length); } // d) for all round numbers not divisible by 3 add the byte sequence S if (round % 3 != 0) { digestC.update(sequenceS, 0, sequenceS.length); } // e) for all round numbers not divisible by 7 add the byte sequence P if (round % 7 != 0) { digestC.update(sequenceP, 0, sequenceP.length); } // f) for odd round numbers add digest A/C // g) for even round numbers add the byte sequence P if (round % 2 != 0) { digestC.update(digestAC, 0, digestAC.length); } else { digestC.update(sequenceP, 0, sequenceP.length); } // h) finish digest C. // from the javadoc: After digest has been called, the MessageDigest object is reset to its initialized state. return digestC.digest(); }
static byte[] function(String algorithm, byte[] digestAC, byte[] sequenceP, byte[] sequenceS, int round) throws NoSuchAlgorithmException { MessageDigest digestC = getMessageDigest(algorithm); if (round % 2 != 0) { digestC.update(sequenceP, 0, sequenceP.length); } else { digestC.update(digestAC, 0, digestAC.length); } if (round % 3 != 0) { digestC.update(sequenceS, 0, sequenceS.length); } if (round % 7 != 0) { digestC.update(sequenceP, 0, sequenceP.length); } if (round % 2 != 0) { digestC.update(digestAC, 0, digestAC.length); } else { digestC.update(sequenceP, 0, sequenceP.length); } return digestC.digest(); }
/** * Calculates the "digest C", derived from the sequenceP, sequenceS, digestAC and the iteration round * * @param digestAC the digest A/C * @param sequenceP the sequence P * @param sequenceS the sequence S * @param round the iteration round * @return the resulting digest C * @throws NoSuchAlgorithmException */
Calculates the "digest C", derived from the sequenceP, sequenceS, digestAC and the iteration round
getDigestC
{ "repo_name": "sguilhen/wildfly-elytron", "path": "src/main/java/org/wildfly/security/password/impl/UnixSHACryptPasswordImpl.java", "license": "apache-2.0", "size": 17780 }
[ "java.security.MessageDigest", "java.security.NoSuchAlgorithmException" ]
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException;
import java.security.*;
[ "java.security" ]
java.security;
1,904,573
@Action(enabledProperty = "tableEntriesSelected") public void addLuhmann() { switch (jTabbedPaneMain.getSelectedIndex()) { case TAB_BOOKMARKS: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableBookmarks, 0)); break; case TAB_LINKS: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableLinks, 0)); addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableManLinks, 0)); break; case TAB_TITLES: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableTitles, 0)); break; } }
@Action(enabledProperty = STR) void function() { switch (jTabbedPaneMain.getSelectedIndex()) { case TAB_BOOKMARKS: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableBookmarks, 0)); break; case TAB_LINKS: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableLinks, 0)); addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableManLinks, 0)); break; case TAB_TITLES: addToLuhmann(ZettelkastenViewUtil.retrieveSelectedEntriesFromTable(data, jTableTitles, 0)); break; } }
/** * This method rerieves the selected entries from the current activated tab * in the tabbedpane and adds them as luhmann-numbers (follower) of the * current entry. */
This method rerieves the selected entries from the current activated tab in the tabbedpane and adds them as luhmann-numbers (follower) of the current entry
addLuhmann
{ "repo_name": "ct2034/Zettelkasten", "path": "src/de/danielluedecke/zettelkasten/ZettelkastenView.java", "license": "gpl-3.0", "size": 765056 }
[ "de.danielluedecke.zettelkasten.util.ZettelkastenViewUtil", "org.jdesktop.application.Action" ]
import de.danielluedecke.zettelkasten.util.ZettelkastenViewUtil; import org.jdesktop.application.Action;
import de.danielluedecke.zettelkasten.util.*; import org.jdesktop.application.*;
[ "de.danielluedecke.zettelkasten", "org.jdesktop.application" ]
de.danielluedecke.zettelkasten; org.jdesktop.application;
1,236,088
public double calculateNormalization(final List<ServerHolder> serverHolders) { double cost = 0; for (ServerHolder server : serverHolders) { for (DataSegment segment : server.getServer().getSegments().values()) { cost += computeJointSegmentsCost(segment, segment); } } return cost; }
double function(final List<ServerHolder> serverHolders) { double cost = 0; for (ServerHolder server : serverHolders) { for (DataSegment segment : server.getServer().getSegments().values()) { cost += computeJointSegmentsCost(segment, segment); } } return cost; }
/** * Calculates the cost normalization. This is such that the normalized cost is lower bounded * by 1 (e.g. when each segment gets its own historical node). * * @param serverHolders A list of ServerHolders for a particular tier. * * @return The normalization value (the sum of the diagonal entries in the * pairwise cost matrix). This is the cost of a cluster if each * segment were to get its own historical node. */
Calculates the cost normalization. This is such that the normalized cost is lower bounded by 1 (e.g. when each segment gets its own historical node)
calculateNormalization
{ "repo_name": "praveev/druid", "path": "server/src/main/java/io/druid/server/coordinator/CostBalancerStrategy.java", "license": "apache-2.0", "size": 13319 }
[ "io.druid.timeline.DataSegment", "java.util.List" ]
import io.druid.timeline.DataSegment; import java.util.List;
import io.druid.timeline.*; import java.util.*;
[ "io.druid.timeline", "java.util" ]
io.druid.timeline; java.util;
2,749,491
void append(@Nonnull String key, int value);
void append(@Nonnull String key, int value);
/** * Appends a {@code key} with an {@code int} value. * * @param key key * @param value int value */
Appends a key with an int value
append
{ "repo_name": "SupaHam/Supervisor", "path": "Supervisor-Core/src/main/java/com/supaham/supervisor/report/Amendable.java", "license": "gpl-3.0", "size": 2290 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,647,538
public PathFragment getGcovExecutable() { return getToolPathFragment(CppConfiguration.Tool.GCOV); }
PathFragment function() { return getToolPathFragment(CppConfiguration.Tool.GCOV); }
/** * Returns the path to the GNU binutils 'gcov' binary that should be used * by this build to analyze C++ coverage data. Relative paths are relative to * the execution root. */
Returns the path to the GNU binutils 'gcov' binary that should be used by this build to analyze C++ coverage data. Relative paths are relative to the execution root
getGcovExecutable
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java", "license": "apache-2.0", "size": 77508 }
[ "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
498,617
@GET @Path(WEBUI_INIT) public Response getWebUIInit() { return RestUtils.call(() -> { MasterWebUIInit response = new MasterWebUIInit(); String proxyHostname = NetworkAddressUtils .getConnectHost(NetworkAddressUtils.ServiceType.PROXY_WEB, ServerConfiguration.global()); int proxyPort = ServerConfiguration.getInt(PropertyKey.PROXY_WEB_PORT); Map<String, String> proxyDowloadFileApiUrl = new HashMap<>(); proxyDowloadFileApiUrl .put("prefix", "http://" + proxyHostname + ":" + proxyPort + "/api/v1/paths/"); proxyDowloadFileApiUrl.put("suffix", "/download-file/"); response.setDebug(ServerConfiguration.getBoolean(PropertyKey.DEBUG)) .setNewerVersionAvailable(mMetaMaster.getNewerVersionAvailable()) .setWebFileInfoEnabled(ServerConfiguration.getBoolean(PropertyKey.WEB_FILE_INFO_ENABLED)) .setSecurityAuthorizationPermissionEnabled( ServerConfiguration.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED)) .setWorkerPort(ServerConfiguration.getInt(PropertyKey.WORKER_WEB_PORT)) .setRefreshInterval((int) ServerConfiguration.getMs(PropertyKey.WEB_REFRESH_INTERVAL)) .setProxyDownloadFileApiUrl(proxyDowloadFileApiUrl); return response; }, ServerConfiguration.global()); }
@Path(WEBUI_INIT) Response function() { return RestUtils.call(() -> { MasterWebUIInit response = new MasterWebUIInit(); String proxyHostname = NetworkAddressUtils .getConnectHost(NetworkAddressUtils.ServiceType.PROXY_WEB, ServerConfiguration.global()); int proxyPort = ServerConfiguration.getInt(PropertyKey.PROXY_WEB_PORT); Map<String, String> proxyDowloadFileApiUrl = new HashMap<>(); proxyDowloadFileApiUrl .put(STR, STRsuffixSTR/download-file/"); response.setDebug(ServerConfiguration.getBoolean(PropertyKey.DEBUG)) .setNewerVersionAvailable(mMetaMaster.getNewerVersionAvailable()) .setWebFileInfoEnabled(ServerConfiguration.getBoolean(PropertyKey.WEB_FILE_INFO_ENABLED)) .setSecurityAuthorizationPermissionEnabled( ServerConfiguration.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED)) .setWorkerPort(ServerConfiguration.getInt(PropertyKey.WORKER_WEB_PORT)) .setRefreshInterval((int) ServerConfiguration.getMs(PropertyKey.WEB_REFRESH_INTERVAL)) .setProxyDownloadFileApiUrl(proxyDowloadFileApiUrl); return response; }, ServerConfiguration.global()); }
/** * Gets Web UI initialization data. * * @return the response object */
Gets Web UI initialization data
getWebUIInit
{ "repo_name": "maobaolong/alluxio", "path": "core/server/master/src/main/java/alluxio/master/meta/AlluxioMasterRestServiceHandler.java", "license": "apache-2.0", "size": 52543 }
[ "java.util.HashMap", "java.util.Map", "javax.ws.rs.Path", "javax.ws.rs.core.Response" ]
import java.util.HashMap; import java.util.Map; import javax.ws.rs.Path; import javax.ws.rs.core.Response;
import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "java.util", "javax.ws" ]
java.util; javax.ws;
2,210,514
public void cleanUp() throws JMSException { consumer.close(); session.close(); connection.close(); }
void function() throws JMSException { consumer.close(); session.close(); connection.close(); }
/** * Closes the consumer, the session, and the connection resources. * @throws JMSException */
Closes the consumer, the session, and the connection resources
cleanUp
{ "repo_name": "miguelijordan/Aspect_Generation", "path": "AMQP-ActiveMQ/src/main/java/uma/caosd/amqp/activemq/objects/ActiveMQConsumer.java", "license": "gpl-2.0", "size": 3396 }
[ "javax.jms.JMSException" ]
import javax.jms.JMSException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
1,340,157
public static PasswordManager getInstance() { try { return CACHED_INSTANCES.get(new CachedInstanceKey()); } catch (ExecutionException e) { throw new RuntimeException("Unable to get an instance of PasswordManager", e); } }
static PasswordManager function() { try { return CACHED_INSTANCES.get(new CachedInstanceKey()); } catch (ExecutionException e) { throw new RuntimeException(STR, e); } }
/** * Get an instance with no master password, which cannot encrypt or decrypt passwords. */
Get an instance with no master password, which cannot encrypt or decrypt passwords
getInstance
{ "repo_name": "shirshanka/gobblin", "path": "gobblin-api/src/main/java/org/apache/gobblin/password/PasswordManager.java", "license": "apache-2.0", "size": 11281 }
[ "java.util.concurrent.ExecutionException" ]
import java.util.concurrent.ExecutionException;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
339,836
public int getRetainedWidth() { if ((mStyle == Constants.EN_NONE) || (mStyle == Constants.EN_HIDDEN)) { return 0; } else { return mWidth.getLengthValue(); } }
int function() { if ((mStyle == Constants.EN_NONE) (mStyle == Constants.EN_HIDDEN)) { return 0; } else { return mWidth.getLengthValue(); } }
/** * Convenience method returning the border-width, * taking into account values of "none" and "hidden" * * @return the retained border-width */
Convenience method returning the border-width, taking into account values of "none" and "hidden"
getRetainedWidth
{ "repo_name": "Distrotech/fop", "path": "src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java", "license": "apache-2.0", "size": 27846 }
[ "org.apache.fop.fo.Constants" ]
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.*;
[ "org.apache.fop" ]
org.apache.fop;
2,908,066
public ErrorHandler getErrorHandler() { return errorHandler; }
ErrorHandler function() { return errorHandler; }
/** * Return the error handler. * * @return The error handler. * @see XMLReader#getErrorHandler() */
Return the error handler
getErrorHandler
{ "repo_name": "alastrina123/debrief", "path": "org.mwc.asset.comms/docs/restlet_src/org.restlet.ext.xml/org/restlet/ext/xml/internal/AbstractXmlReader.java", "license": "epl-1.0", "size": 6132 }
[ "org.xml.sax.ErrorHandler" ]
import org.xml.sax.ErrorHandler;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
2,601,814
private static IDataValidator getSecurtityIdValidator() { return new DataValidator() {
static IDataValidator function() { return new DataValidator() {
/** * Validate: First three chars must be alphabetic and the following must be * numeric */
Validate: First three chars must be alphabetic and the following must be numeric
getSecurtityIdValidator
{ "repo_name": "xored/q7.quality.mockups", "path": "plugins/com.xored.q7.quality.mockups.nattable/nattable/com/xored/q7/quality/mockups/nattable/datasets/EditableGridExample.java", "license": "epl-1.0", "size": 27060 }
[ "org.eclipse.nebula.widgets.nattable.data.validate.DataValidator", "org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator" ]
import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator; import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
import org.eclipse.nebula.widgets.nattable.data.validate.*;
[ "org.eclipse.nebula" ]
org.eclipse.nebula;
1,794,044
@Test public void testActionConflictMarksTargetInvalid() throws Exception { if (getInternalTestExecutionMode() != InternalTestExecutionMode.NORMAL) { // TODO(b/67529176): conflicts not detected. return; } useConfiguration("--cpu=k8"); scratch.file( "conflict/BUILD", "cc_library(name='x', srcs=['foo.cc'])", "cc_binary(name='_objs/x/foo.o', srcs=['bar.cc'])"); reporter.removeHandler(failFastHandler); // expect errors int successfulAnalyses = update(defaultFlags().with(Flag.KEEP_GOING), "//conflict:x", "//conflict:_objs/x/foo.pic.o") .getTargetsToBuild() .size(); assertThat(successfulAnalyses).isEqualTo(1); }
void function() throws Exception { if (getInternalTestExecutionMode() != InternalTestExecutionMode.NORMAL) { return; } useConfiguration(STR); scratch.file( STR, STR, STR); reporter.removeHandler(failFastHandler); int successfulAnalyses = update(defaultFlags().with(Flag.KEEP_GOING), " .getTargetsToBuild() .size(); assertThat(successfulAnalyses).isEqualTo(1); }
/** * The current action conflict detection code will only mark one of the targets as having an * error, and with multi-threaded analysis it is not deterministic which one that will be. */
The current action conflict detection code will only mark one of the targets as having an error, and with multi-threaded analysis it is not deterministic which one that will be
testActionConflictMarksTargetInvalid
{ "repo_name": "davidzchen/bazel", "path": "src/test/java/com/google/devtools/build/lib/analysis/AnalysisCachingTest.java", "license": "apache-2.0", "size": 55560 }
[ "com.google.common.truth.Truth", "com.google.devtools.build.lib.testutil.TestConstants" ]
import com.google.common.truth.Truth; import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.common.truth.*; import com.google.devtools.build.lib.testutil.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
317,927
public Workflow load(URI templateID) throws GraphException, WorkflowEngineException, ComponentException { // Don't delete this method because the portal uses it. return load(templateID, WorkflowType.TEMPLATE); }
Workflow function(URI templateID) throws GraphException, WorkflowEngineException, ComponentException { return load(templateID, WorkflowType.TEMPLATE); }
/** * Loads a workflow with s specified workflow template ID. * * @param templateID * The workflow template ID. * @return The workflow loaded * @throws GraphException * @throws WorkflowEngineException * @throws org.apache.airavata.workflow.model.component.ComponentException * */
Loads a workflow with s specified workflow template ID
load
{ "repo_name": "gouravshenoy/airavata", "path": "modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowClient.java", "license": "apache-2.0", "size": 7835 }
[ "org.apache.airavata.workflow.model.component.ComponentException", "org.apache.airavata.workflow.model.graph.GraphException", "org.apache.airavata.workflow.model.wf.Workflow" ]
import org.apache.airavata.workflow.model.component.ComponentException; import org.apache.airavata.workflow.model.graph.GraphException; import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.workflow.model.component.*; import org.apache.airavata.workflow.model.graph.*; import org.apache.airavata.workflow.model.wf.*;
[ "org.apache.airavata" ]
org.apache.airavata;
2,814,073
T visitBooleanType( @NotNull QuestionnaireParser.BooleanTypeContext ctx );
T visitBooleanType( @NotNull QuestionnaireParser.BooleanTypeContext ctx );
/** * Visit a parse tree produced by {@link QuestionnaireParser#booleanType}. * * @param ctx the parse tree * @return the visitor result */
Visit a parse tree produced by <code>QuestionnaireParser#booleanType</code>
visitBooleanType
{ "repo_name": "software-engineering-amsterdam/poly-ql", "path": "SantiagoCarrillo/q-language/src/edu/uva/softwarecons/grammar/QuestionnaireVisitor.java", "license": "apache-2.0", "size": 5749 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
322,925
private View updateAttendeeView(AttendeeItem item) { final Attendee attendee = item.mAttendee; final View view = item.mView; final TextView nameView = (TextView) view.findViewById(R.id.name); nameView.setText(TextUtils.isEmpty(attendee.mName) ? attendee.mEmail : attendee.mName); if (item.mRemoved) { nameView.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG | nameView.getPaintFlags()); } else { nameView.setPaintFlags((~Paint.STRIKE_THRU_TEXT_FLAG) & nameView.getPaintFlags()); } // Set up the Image button even if the view is disabled // Everything will be ready when the view is enabled later final ImageButton button = (ImageButton) view.findViewById(R.id.contact_remove); button.setVisibility(isEnabled() ? View.VISIBLE : View.GONE); button.setTag(item); if (item.mRemoved) { button.setImageResource(R.drawable.ic_menu_add_field_holo_light); button.setContentDescription(mContext.getString(R.string.accessibility_add_attendee)); } else { button.setImageResource(R.drawable.ic_menu_remove_field_holo_light); button.setContentDescription(mContext. getString(R.string.accessibility_remove_attendee)); } button.setOnClickListener(this); final QuickContactBadge badgeView = (QuickContactBadge) view.findViewById(R.id.badge); Drawable badge = null; // Search for photo in recycled photos if (mRecycledPhotos != null) { badge = mRecycledPhotos.get(item.mAttendee.mEmail); } if (badge != null) { item.mBadge = badge; } badgeView.setImageDrawable(item.mBadge); if (item.mAttendee.mStatus == Attendees.ATTENDEE_STATUS_NONE) { item.mBadge.setAlpha(mNoResponsePhotoAlpha); } else { item.mBadge.setAlpha(mDefaultPhotoAlpha); } if (item.mAttendee.mStatus == Attendees.ATTENDEE_STATUS_DECLINED) { item.mBadge.setColorFilter(mGrayscaleFilter); } else { item.mBadge.setColorFilter(null); } // If we know the lookup-uri of the contact, it is a good idea to set this here. This // allows QuickContact to be started without an extra database lookup. If we don't know // the lookup uri (yet), we can set Email and QuickContact will lookup once tapped. if (item.mContactLookupUri != null) { badgeView.assignContactUri(item.mContactLookupUri); } else { badgeView.assignContactFromEmail(item.mAttendee.mEmail, true); } badgeView.setMaxHeight(60); return view; }
View function(AttendeeItem item) { final Attendee attendee = item.mAttendee; final View view = item.mView; final TextView nameView = (TextView) view.findViewById(R.id.name); nameView.setText(TextUtils.isEmpty(attendee.mName) ? attendee.mEmail : attendee.mName); if (item.mRemoved) { nameView.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG nameView.getPaintFlags()); } else { nameView.setPaintFlags((~Paint.STRIKE_THRU_TEXT_FLAG) & nameView.getPaintFlags()); } final ImageButton button = (ImageButton) view.findViewById(R.id.contact_remove); button.setVisibility(isEnabled() ? View.VISIBLE : View.GONE); button.setTag(item); if (item.mRemoved) { button.setImageResource(R.drawable.ic_menu_add_field_holo_light); button.setContentDescription(mContext.getString(R.string.accessibility_add_attendee)); } else { button.setImageResource(R.drawable.ic_menu_remove_field_holo_light); button.setContentDescription(mContext. getString(R.string.accessibility_remove_attendee)); } button.setOnClickListener(this); final QuickContactBadge badgeView = (QuickContactBadge) view.findViewById(R.id.badge); Drawable badge = null; if (mRecycledPhotos != null) { badge = mRecycledPhotos.get(item.mAttendee.mEmail); } if (badge != null) { item.mBadge = badge; } badgeView.setImageDrawable(item.mBadge); if (item.mAttendee.mStatus == Attendees.ATTENDEE_STATUS_NONE) { item.mBadge.setAlpha(mNoResponsePhotoAlpha); } else { item.mBadge.setAlpha(mDefaultPhotoAlpha); } if (item.mAttendee.mStatus == Attendees.ATTENDEE_STATUS_DECLINED) { item.mBadge.setColorFilter(mGrayscaleFilter); } else { item.mBadge.setColorFilter(null); } if (item.mContactLookupUri != null) { badgeView.assignContactUri(item.mContactLookupUri); } else { badgeView.assignContactFromEmail(item.mAttendee.mEmail, true); } badgeView.setMaxHeight(60); return view; }
/** * Set up each element in {@link AttendeeItem#mView} using the latest information. View * object is reused. */
Set up each element in <code>AttendeeItem#mView</code> using the latest information. View object is reused
updateAttendeeView
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/Calendar/src/com/android/calendar/event/AttendeesView.java", "license": "gpl-3.0", "size": 19290 }
[ "android.graphics.Paint", "android.graphics.drawable.Drawable", "android.provider.CalendarContract", "android.text.TextUtils", "android.view.View", "android.widget.ImageButton", "android.widget.QuickContactBadge", "android.widget.TextView", "com.android.calendar.CalendarEventModel", "com.android.calendar.event.EditEventHelper" ]
import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.provider.CalendarContract; import android.text.TextUtils; import android.view.View; import android.widget.ImageButton; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.calendar.CalendarEventModel; import com.android.calendar.event.EditEventHelper;
import android.graphics.*; import android.graphics.drawable.*; import android.provider.*; import android.text.*; import android.view.*; import android.widget.*; import com.android.calendar.*; import com.android.calendar.event.*;
[ "android.graphics", "android.provider", "android.text", "android.view", "android.widget", "com.android.calendar" ]
android.graphics; android.provider; android.text; android.view; android.widget; com.android.calendar;
155,022
public static final LocalDate getUTCDate() { return LocalDate.now( UTC ); }
static final LocalDate function() { return LocalDate.now( UTC ); }
/** * The current date in UTC * * @return */
The current date in UTC
getUTCDate
{ "repo_name": "peter-mount/opendata-common", "path": "core/src/main/java/uk/trainwatch/util/TimeUtils.java", "license": "apache-2.0", "size": 16955 }
[ "java.time.LocalDate" ]
import java.time.LocalDate;
import java.time.*;
[ "java.time" ]
java.time;
1,490,594
public static ASN1OctetString getInstance( Object obj) { if (obj == null || obj instanceof ASN1OctetString) { return (ASN1OctetString)obj; } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } if (obj instanceof ASN1Sequence) { Vector v = new Vector(); Enumeration e = ((ASN1Sequence)obj).getObjects(); while (e.hasMoreElements()) { v.addElement(e.nextElement()); } return new BERConstructedOctetString(v); } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); } public ASN1OctetString( byte[] string) { this.string = string; } public ASN1OctetString( DEREncodable obj) { try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); dOut.writeObject(obj); dOut.close(); this.string = bOut.toByteArray(); } catch (IOException e) { throw new IllegalArgumentException("Error processing object : " + e.toString()); } }
static ASN1OctetString function( Object obj) { if (obj == null obj instanceof ASN1OctetString) { return (ASN1OctetString)obj; } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } if (obj instanceof ASN1Sequence) { Vector v = new Vector(); Enumeration e = ((ASN1Sequence)obj).getObjects(); while (e.hasMoreElements()) { v.addElement(e.nextElement()); } return new BERConstructedOctetString(v); } throw new IllegalArgumentException(STR + obj.getClass().getName()); } public ASN1OctetString( byte[] string) { this.string = string; } public ASN1OctetString( DEREncodable obj) { try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DEROutputStream dOut = new DEROutputStream(bOut); dOut.writeObject(obj); dOut.close(); this.string = bOut.toByteArray(); } catch (IOException e) { throw new IllegalArgumentException(STR + e.toString()); } }
/** * return an Octet String from the given object. * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */
return an Octet String from the given object
getInstance
{ "repo_name": "mobilesec/openuat-platform-j2me", "path": "thirdparty/bouncycastle-x509-deps/org/bouncycastle/asn1/ASN1OctetString.java", "license": "lgpl-3.0", "size": 3352 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.util.Enumeration", "java.util.Vector" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Enumeration; import java.util.Vector;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
649,610
@Override public void addCookie(final Cookie cookie) { // Ignore any call from an included servlet if (included || isCommitted()) { return; } final StringBuffer sb = generateCookieString(cookie); //if we reached here, no exception, cookie is valid // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 ) // RFC2965 is not supported by browsers and the Servlet spec // asks for 2109. addHeader("Set-Cookie", sb.toString()); }
void function(final Cookie cookie) { if (included isCommitted()) { return; } final StringBuffer sb = generateCookieString(cookie); addHeader(STR, sb.toString()); }
/** * Add the specified Cookie to those that will be included with * this Response. * * @param cookie Cookie to be added */
Add the specified Cookie to those that will be included with this Response
addCookie
{ "repo_name": "sdw2330976/apache-tomcat-7.0.57", "path": "target/classes/org/apache/catalina/connector/Response.java", "license": "apache-2.0", "size": 53364 }
[ "javax.servlet.http.Cookie" ]
import javax.servlet.http.Cookie;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
429,499
private void compile(String sourcePath, boolean compressCSS, boolean compressJSON) { Matcher m = PATTERN_THEME_REQUEST_PARTS.matcher(sourcePath); if (m.matches()) { // extract the relevant parts from the request path String prefixPath = m.group(1); String library = m.group(2); String libraryName = library.replace('/', '.'); String theme = m.group(3); String path = prefixPath + theme + "/"; try { URL url = this.findResource(sourcePath); if (url != null) { // read the library.source.less URLConnection conn = url.openConnection(); conn.connect(); // up-to-date check String resources = this.cache.get(path + "resources"); long lastModified = resources != null ? this.getMaxLastModified(resources.split(";")) : -1; if (!this.lastModified.containsKey(sourcePath) || this.lastModified.get(sourcePath) < lastModified) { // some info this.log("Compiling CSS/JSON of library " + libraryName + " for theme " + theme); // read the content InputStream is = conn.getInputStream(); String input = IOUtils.toString(is, "UTF-8"); IOUtils.closeQuietly(is); // time measurement begin long millis = System.currentTimeMillis(); // compile the CSS/JSON Scriptable result = this.compileCSS(input, path, compressCSS, compressJSON, libraryName); // cache the result String css = Context.toString(ScriptableObject.getProperty((Scriptable) result, "css")); this.cache.put(path + "library.css", css); String rtlCss = Context.toString(ScriptableObject.getProperty((Scriptable) result, "cssRtl")); this.cache.put(path + "library-RTL.css", rtlCss); String json = Context.toString(ScriptableObject.getProperty((Scriptable) result, "json")); this.cache.put(path + "library-parameters.json", json); resources = Context.toString(ScriptableObject.getProperty((Scriptable) result, "resources")); this.cache.put(path + "resources", resources); // log the compile duration this.log(" => took " + (System.currentTimeMillis() - millis) + "ms"); // store when the resource has been compiled this.lastModified.put(sourcePath, this.getMaxLastModified(resources.split(";"))); } } else { this.log("The less source file cannot be found: " + sourcePath); } } catch (Exception ex) { // in case of error we also cleanup the cache! this.log("Failed to compile CSS for " + sourcePath, ex); this.cache.remove(path + "library.css"); this.cache.remove(path + "library-RTL.css"); this.cache.remove(path + "library-parameters.json"); this.cache.remove(path + "resources"); this.lastModified.remove(sourcePath); } } } // method: compile
void function(String sourcePath, boolean compressCSS, boolean compressJSON) { Matcher m = PATTERN_THEME_REQUEST_PARTS.matcher(sourcePath); if (m.matches()) { String prefixPath = m.group(1); String library = m.group(2); String libraryName = library.replace('/', '.'); String theme = m.group(3); String path = prefixPath + theme + "/"; try { URL url = this.findResource(sourcePath); if (url != null) { URLConnection conn = url.openConnection(); conn.connect(); String resources = this.cache.get(path + STR); long lastModified = resources != null ? this.getMaxLastModified(resources.split(";")) : -1; if (!this.lastModified.containsKey(sourcePath) this.lastModified.get(sourcePath) < lastModified) { this.log(STR + libraryName + STR + theme); InputStream is = conn.getInputStream(); String input = IOUtils.toString(is, "UTF-8"); IOUtils.closeQuietly(is); long millis = System.currentTimeMillis(); Scriptable result = this.compileCSS(input, path, compressCSS, compressJSON, libraryName); String css = Context.toString(ScriptableObject.getProperty((Scriptable) result, "css")); this.cache.put(path + STR, css); String rtlCss = Context.toString(ScriptableObject.getProperty((Scriptable) result, STR)); this.cache.put(path + STR, rtlCss); String json = Context.toString(ScriptableObject.getProperty((Scriptable) result, "json")); this.cache.put(path + STR, json); resources = Context.toString(ScriptableObject.getProperty((Scriptable) result, STR)); this.cache.put(path + STR, resources); this.log(STR + (System.currentTimeMillis() - millis) + "ms"); this.lastModified.put(sourcePath, this.getMaxLastModified(resources.split(";"))); } } else { this.log(STR + sourcePath); } } catch (Exception ex) { this.log(STR + sourcePath, ex); this.cache.remove(path + STR); this.cache.remove(path + STR); this.cache.remove(path + STR); this.cache.remove(path + STR); this.lastModified.remove(sourcePath); } } }
/** * compiles the CSS, RTL-CSS and theme parameters as JSON * @param sourcePath source path * @param compressCSS true, if CSS should be compressed * @param compressJSON true if JSON should be compressed */
compiles the CSS, RTL-CSS and theme parameters as JSON
compile
{ "repo_name": "awolfish/timetableservices", "path": "client/src/main/java/com/sap/openui5/LessFilter.java", "license": "mit", "size": 13634 }
[ "java.io.InputStream", "java.net.URLConnection", "java.util.regex.Matcher", "org.apache.commons.io.IOUtils", "org.mozilla.javascript.Context", "org.mozilla.javascript.Scriptable", "org.mozilla.javascript.ScriptableObject" ]
import java.io.InputStream; import java.net.URLConnection; import java.util.regex.Matcher; import org.apache.commons.io.IOUtils; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject;
import java.io.*; import java.net.*; import java.util.regex.*; import org.apache.commons.io.*; import org.mozilla.javascript.*;
[ "java.io", "java.net", "java.util", "org.apache.commons", "org.mozilla.javascript" ]
java.io; java.net; java.util; org.apache.commons; org.mozilla.javascript;
1,292,512
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "panossot/jboss-automated-metrics", "path": "ApplicationMetricsStandalone/ApplicationMetricsApiTest14/ApplicationMetricsApiTest14-web/src/main/java/org/jam/metrics/PrintMetrics.java", "license": "apache-2.0", "size": 5248 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
427,130
default AsyncFuture<ModelNode> executeAsync(ModelNode operation, OperationMessageHandler messageHandler) { return executeAsync(Operation.Factory.create(operation), messageHandler); }
default AsyncFuture<ModelNode> executeAsync(ModelNode operation, OperationMessageHandler messageHandler) { return executeAsync(Operation.Factory.create(operation), messageHandler); }
/** * Execute an operation in another thread, optionally receiving progress reports. * * @param operation the operation to execute * @param messageHandler the message handler to use for operation progress reporting, or {@code null} for none * @return the future result of the operation */
Execute an operation in another thread, optionally receiving progress reports
executeAsync
{ "repo_name": "yersan/wildfly-core", "path": "controller-client/src/main/java/org/jboss/as/controller/client/ModelControllerClient.java", "license": "lgpl-2.1", "size": 32352 }
[ "org.jboss.dmr.ModelNode", "org.jboss.threads.AsyncFuture" ]
import org.jboss.dmr.ModelNode; import org.jboss.threads.AsyncFuture;
import org.jboss.dmr.*; import org.jboss.threads.*;
[ "org.jboss.dmr", "org.jboss.threads" ]
org.jboss.dmr; org.jboss.threads;
1,542,102
private synchronized void processingsDone(String ended_message) { logger.info ( "Scanner and processings are completed: update the UI status."); SimpleDateFormat sdf = new SimpleDateFormat ( "EEEE dd MMMM yyyy - HH:mm:ss", Locale.ENGLISH); String processing_message = "Ingestion completed at " + sdf.format (new Date ()) + "<br>with " + endCounter + " products processed and " + errorCounter + " error" + (errorCounter >1?"s":"") + " during this processing.<br>"; if (!processingErrors.isEmpty ()) processing_message += "<u>Processing error(s):</u><br>" + processingErrors; if (ended_message!= null) { processing_message += ended_message + "<br>"; } FileScannerDao fileScannerDao = ApplicationContextProvider.getBean (FileScannerDao.class); persistentScanner=fileScannerDao.read (persistentScanner.getId ()); if (persistentScanner != null) { // Set the scanner info persistentScanner.setStatus (scannerStatus); persistentScanner.setStatusMessage (truncateMessageForDB( persistentScanner.getStatusMessage () + scannerMessage + "<br>" + processing_message)); fileScannerDao.update (persistentScanner); } else { logger.error ("Scanner has been removed."); } }
synchronized void function(String ended_message) { logger.info ( STR); SimpleDateFormat sdf = new SimpleDateFormat ( STR, Locale.ENGLISH); String processing_message = STR + sdf.format (new Date ()) + STR + endCounter + STR + errorCounter + STR + (errorCounter >1?"s":STR during this processing.<br>STR<u>Processing error(s):</u><br>STR<br>STR<br>STRScanner has been removed."); } }
/** * Notifies the scanner that the processings are done. */
Notifies the scanner that the processings are done
processingsDone
{ "repo_name": "diogo-andrade/DataHubSystem", "path": "core/src/main/java/fr/gael/dhus/datastore/scanner/FileScannerWrapper.java", "license": "agpl-3.0", "size": 6481 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.Locale" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
75,464
public void getCollidingBoundingBoxes(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, ArrayList par6ArrayList) { int i = par1World.getBlockMetadata(par2, par3, par4); int j = i & 3; float f = 0.0F; float f1 = 0.5F; float f2 = 0.5F; float f3 = 1.0F; if ((i & 4) != 0) { f = 0.5F; f1 = 1.0F; f2 = 0.0F; f3 = 0.5F; } setBlockBounds(0.0F, f, 0.0F, 1.0F, f1, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); if (j == 0) { setBlockBounds(0.5F, f2, 0.0F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 1) { setBlockBounds(0.0F, f2, 0.0F, 0.5F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 2) { setBlockBounds(0.0F, f2, 0.5F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 3) { setBlockBounds(0.0F, f2, 0.0F, 1.0F, f3, 0.5F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
void function(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, ArrayList par6ArrayList) { int i = par1World.getBlockMetadata(par2, par3, par4); int j = i & 3; float f = 0.0F; float f1 = 0.5F; float f2 = 0.5F; float f3 = 1.0F; if ((i & 4) != 0) { f = 0.5F; f1 = 1.0F; f2 = 0.0F; f3 = 0.5F; } setBlockBounds(0.0F, f, 0.0F, 1.0F, f1, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); if (j == 0) { setBlockBounds(0.5F, f2, 0.0F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 1) { setBlockBounds(0.0F, f2, 0.0F, 0.5F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 2) { setBlockBounds(0.0F, f2, 0.5F, 1.0F, f3, 1.0F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } else if (j == 3) { setBlockBounds(0.0F, f2, 0.0F, 1.0F, f3, 0.5F); super.getCollidingBoundingBoxes(par1World, par2, par3, par4, par5AxisAlignedBB, par6ArrayList); } setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
/** * Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z, * axisAlignedBB, arrayList */
Adds to the supplied array any colliding bounding boxes with the passed in bounding box. Args: world, x, y, z, axisAlignedBB, arrayList
getCollidingBoundingBoxes
{ "repo_name": "sethten/MoDesserts", "path": "mcp50/src/minecraft/net/minecraft/src/BlockStairs.java", "license": "gpl-3.0", "size": 10938 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
395,793
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<AuthorizationRuleInner>> listAuthorizationRulesNextSinglePageAsync( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<AuthorizationRuleInner>> function( String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listAuthorizationRulesNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response from the list namespace operation. */
Get the next page of items
listAuthorizationRulesNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/relay/azure-resourcemanager-relay/src/main/java/com/azure/resourcemanager/relay/implementation/HybridConnectionsClientImpl.java", "license": "mit", "size": 113527 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.relay.fluent.models.AuthorizationRuleInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.relay.fluent.models.AuthorizationRuleInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.relay.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,729,041
public CopyOnWriteList<ItemListener> getJobListeners() { return itemListeners; }
CopyOnWriteList<ItemListener> function() { return itemListeners; }
/** * Gets all the installed {@link ItemListener}s. * * @deprecated as of 1.286. * Use {@link ItemListener#all()}. */
Gets all the installed <code>ItemListener</code>s
getJobListeners
{ "repo_name": "kyoungrok0517/linguist", "path": "samples/Java/Hudson.java", "license": "mit", "size": 11334 }
[ "hudson.model.listeners.ItemListener", "hudson.util.CopyOnWriteList" ]
import hudson.model.listeners.ItemListener; import hudson.util.CopyOnWriteList;
import hudson.model.listeners.*; import hudson.util.*;
[ "hudson.model.listeners", "hudson.util" ]
hudson.model.listeners; hudson.util;
1,136,394
// package-private static String getPossiblyBlankConfigurationString(Configuration configuration, String key, String def) { String value = configuration.getString(key, def); if (value != null) { return value.trim(); } else { return value; } }
static String getPossiblyBlankConfigurationString(Configuration configuration, String key, String def) { String value = configuration.getString(key, def); if (value != null) { return value.trim(); } else { return value; } }
/** * Return the <code>String</code> value for a given, possibly-blank * (i.e. empty or all whitespace) configuration key. * If the value is not defined, the supplied default value is returned. * The value is returned with leading and trailing whitespace removed in both cases. * @param configuration The configuration to look up the key in. * @param key The key to look up. * @param def The default value to return when no valid key value can be found. * @return The value configured for the key. */
Return the <code>String</code> value for a given, possibly-blank (i.e. empty or all whitespace) configuration key. If the value is not defined, the supplied default value is returned. The value is returned with leading and trailing whitespace removed in both cases
getPossiblyBlankConfigurationString
{ "repo_name": "TheLQ/ps3mediaserver", "path": "src/main/java/net/pms/configuration/ConfigurationUtil.java", "license": "gpl-2.0", "size": 2717 }
[ "org.apache.commons.configuration.Configuration" ]
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.*;
[ "org.apache.commons" ]
org.apache.commons;
2,568,225
protected void addToPostDeleteBatch(String sql) throws SQLException { // Note that this is a fudge - in subclasses you will almost certainly want to override this // method to make it actually do what the prototype says. The fudge exists in order to speed // up the SimpleImpl by using only one Statement batch. addToPreDeleteBatch(sql); }
void function(String sql) throws SQLException { addToPreDeleteBatch(sql); }
/** * Adds a statement to the postDeleteBatch. * * @param sql the statement * @throws SQLException if an error occurs */
Adds a statement to the postDeleteBatch
addToPostDeleteBatch
{ "repo_name": "elsiklab/intermine", "path": "intermine/objectstore/main/src/org/intermine/sql/writebatch/BatchWriterSimpleImpl.java", "license": "lgpl-2.1", "size": 19498 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,102,453
public void run() { synchronized (this) { started = true; } finished = false; finish = false; final byte[] buf = new byte[bufferSize]; int length; try { while (true) { waitForInput(is); if (finish || Thread.interrupted()) { break; } length = is.read(buf); if (length <= 0 || finish || Thread.interrupted()) { break; } os.write(buf, 0, length); if (autoflush) { os.flush(); } } os.flush(); } catch (InterruptedException ie) { // likely PumpStreamHandler trying to stop us } catch (Exception e) { synchronized (this) { exception = e; } } finally { if (closeWhenExhausted) { try { os.close(); } catch (IOException e) { LOG.warn("Error closing stream", e); } } finished = true; synchronized (this) { notifyAll(); } } }
void function() { synchronized (this) { started = true; } finished = false; finish = false; final byte[] buf = new byte[bufferSize]; int length; try { while (true) { waitForInput(is); if (finish Thread.interrupted()) { break; } length = is.read(buf); if (length <= 0 finish Thread.interrupted()) { break; } os.write(buf, 0, length); if (autoflush) { os.flush(); } } os.flush(); } catch (InterruptedException ie) { } catch (Exception e) { synchronized (this) { exception = e; } } finally { if (closeWhenExhausted) { try { os.close(); } catch (IOException e) { LOG.warn(STR, e); } } finished = true; synchronized (this) { notifyAll(); } } }
/** * Copies data from the input stream to the output stream. * * Terminates as soon as the input stream is closed or an error occurs. */
Copies data from the input stream to the output stream. Terminates as soon as the input stream is closed or an error occurs
run
{ "repo_name": "cmacnaug/meshkeeper", "path": "meshkeeper-api/src/main/java/org/fusesource/meshkeeper/distribution/provisioner/embedded/StreamPumper.java", "license": "apache-2.0", "size": 7830 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,064,621
private static String urlToText(URL url) throws IOException{ URLConnection urlConn = url.openConnection(); //Open connection //Adding header for user agent is required. Otherwise, Google rejects the request urlConn.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0"); Reader r = new java.io.InputStreamReader(urlConn.getInputStream(), Charset.forName("UTF-8"));//Gets Data Converts to string StringBuilder buf = new StringBuilder(); while (true) {//Reads String from buffer int ch = r.read(); if (ch < 0) break; buf.append((char) ch); } String str = buf.toString(); return str; }
static String function(URL url) throws IOException{ URLConnection urlConn = url.openConnection(); urlConn.addRequestProperty(STR, STR); Reader r = new java.io.InputStreamReader(urlConn.getInputStream(), Charset.forName("UTF-8")); StringBuilder buf = new StringBuilder(); while (true) { int ch = r.read(); if (ch < 0) break; buf.append((char) ch); } String str = buf.toString(); return str; }
/** * Converts a URL to Text * @param url that you want to generate a String from * @return The generated String * @throws IOException if it cannot complete the request */
Converts a URL to Text
urlToText
{ "repo_name": "tsoglani/SpeechRaspberrySmartHouse", "path": "Raspberry_2B-3/raspberry_2a,b_InAndOut_40gpio_pin/com/darkprograms/speech/translator/GoogleTranslate.java", "license": "agpl-3.0", "size": 10414 }
[ "java.io.IOException", "java.io.Reader", "java.net.URLConnection", "java.nio.charset.Charset" ]
import java.io.IOException; import java.io.Reader; import java.net.URLConnection; import java.nio.charset.Charset;
import java.io.*; import java.net.*; import java.nio.charset.*;
[ "java.io", "java.net", "java.nio" ]
java.io; java.net; java.nio;
2,220,064
public List<TMSProjectExchange> getTMSProjectExchanges() throws TorqueException { if (collTMSProjectExchanges == null) { collTMSProjectExchanges = getTMSProjectExchanges(new Criteria(10)); } return collTMSProjectExchanges; }
List<TMSProjectExchange> function() throws TorqueException { if (collTMSProjectExchanges == null) { collTMSProjectExchanges = getTMSProjectExchanges(new Criteria(10)); } return collTMSProjectExchanges; }
/** * If this collection has already been initialized, returns * the collection. Otherwise returns the results of * getTMSProjectExchanges(new Criteria()) * * @return the collection of associated objects * @throws TorqueException */
If this collection has already been initialized, returns the collection. Otherwise returns the results of getTMSProjectExchanges(new Criteria())
getTMSProjectExchanges
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTPerson.java", "license": "gpl-3.0", "size": 1013508 }
[ "java.util.List", "org.apache.torque.TorqueException", "org.apache.torque.util.Criteria" ]
import java.util.List; import org.apache.torque.TorqueException; import org.apache.torque.util.Criteria;
import java.util.*; import org.apache.torque.*; import org.apache.torque.util.*;
[ "java.util", "org.apache.torque" ]
java.util; org.apache.torque;
1,206,989
EClass getCorrelationPropertyBinding();
EClass getCorrelationPropertyBinding();
/** * Returns the meta object for class '{@link org.eclipse.bpmn2.CorrelationPropertyBinding <em>Correlation Property Binding</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Correlation Property Binding</em>'. * @see org.eclipse.bpmn2.CorrelationPropertyBinding * @generated */
Returns the meta object for class '<code>org.eclipse.bpmn2.CorrelationPropertyBinding Correlation Property Binding</code>'.
getCorrelationPropertyBinding
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,179
public Queue<Object> inboundMessages() { if (inboundMessages == null) { inboundMessages = new ArrayDeque<Object>(); } return inboundMessages; } /** * @deprecated use {@link #inboundMessages()}
Queue<Object> function() { if (inboundMessages == null) { inboundMessages = new ArrayDeque<Object>(); } return inboundMessages; } /** * @deprecated use {@link #inboundMessages()}
/** * Returns the {@link Queue} which holds all the {@link Object}s that were received by this {@link Channel}. */
Returns the <code>Queue</code> which holds all the <code>Object</code>s that were received by this <code>Channel</code>
inboundMessages
{ "repo_name": "Apache9/netty", "path": "transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java", "license": "apache-2.0", "size": 27970 }
[ "java.util.ArrayDeque", "java.util.Queue" ]
import java.util.ArrayDeque; import java.util.Queue;
import java.util.*;
[ "java.util" ]
java.util;
2,415,455
public String evaluate(String select, Document document) throws XpathException { try { return xpath.evaluate(select, document); } catch (XPathExpressionException ex) { throw new XpathException(ex); } }
String function(String select, Document document) throws XpathException { try { return xpath.evaluate(select, document); } catch (XPathExpressionException ex) { throw new XpathException(ex); } }
/** * Evaluate the result of executing the specified xpath syntax * <code>select</code> expression on the specified document * @param select * @param document * @return evaluated result * @throws TransformerException * @throws TransformerConfigurationException */
Evaluate the result of executing the specified xpath syntax <code>select</code> expression on the specified document
evaluate
{ "repo_name": "wallymathieu/XmlUnit", "path": "src/java/org/custommonkey/xmlunit/jaxp13/Jaxp13XpathEngine.java", "license": "bsd-3-clause", "size": 4205 }
[ "javax.xml.xpath.XPathExpressionException", "org.custommonkey.xmlunit.exceptions.XpathException", "org.w3c.dom.Document" ]
import javax.xml.xpath.XPathExpressionException; import org.custommonkey.xmlunit.exceptions.XpathException; import org.w3c.dom.Document;
import javax.xml.xpath.*; import org.custommonkey.xmlunit.exceptions.*; import org.w3c.dom.*;
[ "javax.xml", "org.custommonkey.xmlunit", "org.w3c.dom" ]
javax.xml; org.custommonkey.xmlunit; org.w3c.dom;
764,711
public MetaProperty<BusinessDayAdjustment> accrualBusinessDayAdjustment() { return accrualBusinessDayAdjustment; }
MetaProperty<BusinessDayAdjustment> function() { return accrualBusinessDayAdjustment; }
/** * The meta-property for the {@code accrualBusinessDayAdjustment} property. * @return the meta-property, not null */
The meta-property for the accrualBusinessDayAdjustment property
accrualBusinessDayAdjustment
{ "repo_name": "jmptrader/Strata", "path": "modules/product/src/main/java/com/opengamma/strata/product/swap/type/OvernightRateSwapLegConvention.java", "license": "apache-2.0", "size": 60593 }
[ "com.opengamma.strata.basics.date.BusinessDayAdjustment", "org.joda.beans.MetaProperty" ]
import com.opengamma.strata.basics.date.BusinessDayAdjustment; import org.joda.beans.MetaProperty;
import com.opengamma.strata.basics.date.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
2,212,576
public Connection getConnection(CmsDbContext dbc) throws SQLException { if (dbc == null) { LOG.error(Messages.get().getBundle().key(Messages.LOG_NULL_DB_CONTEXT_0)); } // match the ID to a JDBC pool URL of the OpenCms JDBC pools {online|offline|backup} return getConnectionByUrl(m_poolUrl); }
Connection function(CmsDbContext dbc) throws SQLException { if (dbc == null) { LOG.error(Messages.get().getBundle().key(Messages.LOG_NULL_DB_CONTEXT_0)); } return getConnectionByUrl(m_poolUrl); }
/** * Returns a JDBC connection from the connection pool.<p> * * Use this method to get a connection for reading/writing project independent data.<p> * * @param dbc the current database context * * @return a JDBC connection * * @throws SQLException if the project id is not supported */
Returns a JDBC connection from the connection pool. Use this method to get a connection for reading/writing project independent data
getConnection
{ "repo_name": "serrapos/opencms-core", "path": "src/org/opencms/db/generic/CmsSqlManager.java", "license": "lgpl-2.1", "size": 18065 }
[ "java.sql.Connection", "java.sql.SQLException", "org.opencms.db.CmsDbContext" ]
import java.sql.Connection; import java.sql.SQLException; import org.opencms.db.CmsDbContext;
import java.sql.*; import org.opencms.db.*;
[ "java.sql", "org.opencms.db" ]
java.sql; org.opencms.db;
290,845
public boolean isItemValidForSlot(int index, ItemStack stack) { return true; }
boolean function(int index, ItemStack stack) { return true; }
/** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For * guis use Slot.isItemValid */
Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid
isItemValidForSlot
{ "repo_name": "lucemans/ShapeClient-SRC", "path": "net/minecraft/inventory/InventoryCraftResult.java", "license": "mpl-2.0", "size": 3740 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,336,840
@Override public java.lang.String toString() { return "SetInParameterString"; } // BEGIN EXTRA CODE private final ILogNode logNode = Core.getLogger(JdbcConnector.LOGNAME); private final JdbcConnector connector = new JdbcConnector(logNode); // END EXTRA CODE
java.lang.String function() { return STR; } private final ILogNode logNode = Core.getLogger(JdbcConnector.LOGNAME); private final JdbcConnector connector = new JdbcConnector(logNode);
/** * Returns a string representation of this action */
Returns a string representation of this action
toString
{ "repo_name": "ako/OracleConnector", "path": "javasource/oracleconnector/actions/SetInParameterString.java", "license": "apache-2.0", "size": 1428 }
[ "com.mendix.core.Core", "com.mendix.logging.ILogNode" ]
import com.mendix.core.Core; import com.mendix.logging.ILogNode;
import com.mendix.core.*; import com.mendix.logging.*;
[ "com.mendix.core", "com.mendix.logging" ]
com.mendix.core; com.mendix.logging;
1,272,078
private void validate() throws IllegalArgumentException { for (int i=0; i<200; i++) { System.out.print('.'); try { Thread.currentThread().sleep(1); } catch (InterruptedException e) { break; } } if (isLineBreak(delimiter)) { throw new IllegalArgumentException("The delimiter cannot be a line break"); } if (quoteCharacter != null && delimiter == quoteCharacter.charValue()) { throw new IllegalArgumentException("The quoteChar character and the delimiter cannot be the same ('" + quoteCharacter + "')"); } if (escapeCharacter != null && delimiter == escapeCharacter.charValue()) { throw new IllegalArgumentException("The escape character and the delimiter cannot be the same ('" + escapeCharacter + "')"); } if (commentMarker != null && delimiter == commentMarker.charValue()) { throw new IllegalArgumentException("The comment start character and the delimiter cannot be the same ('" + commentMarker + "')"); } if (quoteCharacter != null && quoteCharacter.equals(commentMarker)) { throw new IllegalArgumentException("The comment start character and the quoteChar cannot be the same ('" + commentMarker + "')"); } if (escapeCharacter != null && escapeCharacter.equals(commentMarker)) { throw new IllegalArgumentException("The comment start and the escape character cannot be the same ('" + commentMarker + "')"); } if (escapeCharacter == null && quoteMode == QuoteMode.NONE) { throw new IllegalArgumentException("No quotes mode set but no escape character is set"); } // validate header if (header != null) { final Set<String> dupCheck = new HashSet<String>(); for (final String hdr : header) { if (!dupCheck.add(hdr)) { throw new IllegalArgumentException("The header contains a duplicate entry: '" + hdr + "' in " + Arrays.toString(header)); } } } }
void function() throws IllegalArgumentException { for (int i=0; i<200; i++) { System.out.print('.'); try { Thread.currentThread().sleep(1); } catch (InterruptedException e) { break; } } if (isLineBreak(delimiter)) { throw new IllegalArgumentException(STR); } if (quoteCharacter != null && delimiter == quoteCharacter.charValue()) { throw new IllegalArgumentException(STR + quoteCharacter + "')"); } if (escapeCharacter != null && delimiter == escapeCharacter.charValue()) { throw new IllegalArgumentException(STR + escapeCharacter + "')"); } if (commentMarker != null && delimiter == commentMarker.charValue()) { throw new IllegalArgumentException(STR + commentMarker + "')"); } if (quoteCharacter != null && quoteCharacter.equals(commentMarker)) { throw new IllegalArgumentException(STR + commentMarker + "')"); } if (escapeCharacter != null && escapeCharacter.equals(commentMarker)) { throw new IllegalArgumentException(STR + commentMarker + "')"); } if (escapeCharacter == null && quoteMode == QuoteMode.NONE) { throw new IllegalArgumentException(STR); } if (header != null) { final Set<String> dupCheck = new HashSet<String>(); for (final String hdr : header) { if (!dupCheck.add(hdr)) { throw new IllegalArgumentException(STR + hdr + STR + Arrays.toString(header)); } } } }
/** * Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary. * * @throws IllegalArgumentException */
Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary
validate
{ "repo_name": "khalilrahman/commons-csv", "path": "src/main/java/org/apache/commons/csv/CSVFormat.java", "license": "apache-2.0", "size": 44799 }
[ "java.util.Arrays", "java.util.HashSet", "java.util.Set" ]
import java.util.Arrays; import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,276,138
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // If the user clicks the "Refresh" button. case R.id.menu_refresh: SyncUtils.TriggerRefresh(getContext()); return true; } return super.onOptionsItemSelected(item); }
boolean function(MenuItem item) { switch (item.getItemId()) { case R.id.menu_refresh: SyncUtils.TriggerRefresh(getContext()); return true; } return super.onOptionsItemSelected(item); }
/** * Respond to user gestures on the ActionBar. */
Respond to user gestures on the ActionBar
onOptionsItemSelected
{ "repo_name": "MaxSmile/JsonSyncAdapter", "path": "JsonSyncAdapter/Application/src/main/java/com/vasilkoff/android/UI/FeedListFragment.java", "license": "mit", "size": 7243 }
[ "android.view.MenuItem", "com.vasilkoff.android.Sync" ]
import android.view.MenuItem; import com.vasilkoff.android.Sync;
import android.view.*; import com.vasilkoff.android.*;
[ "android.view", "com.vasilkoff.android" ]
android.view; com.vasilkoff.android;
407,276
interface WithAddressPrefixes { WithCreate withAddressPrefixes(List<String> addressPrefixes); }
interface WithAddressPrefixes { WithCreate withAddressPrefixes(List<String> addressPrefixes); }
/** * Specifies addressPrefixes. * @param addressPrefixes List of address prefixes for the subnet * @return the next definition stage */
Specifies addressPrefixes
withAddressPrefixes
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/Subnet.java", "license": "mit", "size": 16679 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
760,826
protected void locatorParams(String TYPE, String query) { if(TYPE.contentEquals(SUGGEST_PLACE)) { suggestParams = new LocatorSuggestionParameters(query); // Use the centre of the current map extent as the suggest location point suggestParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference()); // Set the radial search distance in meters suggestParams.setDistance(500.0); } else if(TYPE.contentEquals(FIND_PLACE)) { findParams = new LocatorFindParameters(query); //Use the center of the current map extent as the find point findParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference()); // Set the radial search distance in meters findParams.setDistance(500.0); } }
void function(String TYPE, String query) { if(TYPE.contentEquals(SUGGEST_PLACE)) { suggestParams = new LocatorSuggestionParameters(query); suggestParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference()); suggestParams.setDistance(500.0); } else if(TYPE.contentEquals(FIND_PLACE)) { findParams = new LocatorFindParameters(query); findParams.setLocation(mMapView.getCenter(), mMapView.getSpatialReference()); findParams.setDistance(500.0); } }
/** * Initialize the LocatorSuggestionParameters or LocatorFindParameters * * @param query The string for which the locator parameters are to be initialized */
Initialize the LocatorSuggestionParameters or LocatorFindParameters
locatorParams
{ "repo_name": "dimcal7/arcgis-runtime-samples-android", "path": "PlaceSearch/src/main/java/com/arcgis/android/samples/search/placesearch/MainActivity.java", "license": "apache-2.0", "size": 17294 }
[ "com.esri.core.tasks.geocode.LocatorFindParameters", "com.esri.core.tasks.geocode.LocatorSuggestionParameters" ]
import com.esri.core.tasks.geocode.LocatorFindParameters; import com.esri.core.tasks.geocode.LocatorSuggestionParameters;
import com.esri.core.tasks.geocode.*;
[ "com.esri.core" ]
com.esri.core;
1,136,377
public void addTask(ReceivedMessageTask task) { tasks.add(task); Packet packet = task.getPacket(); // don't run the deadlock guard if timeout is <= 0 if (packet.getExpirationTime() > 0L) { // run a deadlock guard so hanging tasks will be interrupted task.runDeadlockFuture(new DeadlockGuard(task)); } if (listener != null) { listener.onTaskAdded(this); } }
void function(ReceivedMessageTask task) { tasks.add(task); Packet packet = task.getPacket(); if (packet.getExpirationTime() > 0L) { task.runDeadlockFuture(new DeadlockGuard(task)); } if (listener != null) { listener.onTaskAdded(this); } }
/** * Adds new task to the end of the queue. * * @param task * received message task */
Adds new task to the end of the queue
addTask
{ "repo_name": "ant-media/Ant-Media-Server", "path": "src/main/java/org/red5/server/net/rtmp/ReceivedMessageTaskQueue.java", "license": "apache-2.0", "size": 5587 }
[ "org.red5.server.net.rtmp.message.Packet" ]
import org.red5.server.net.rtmp.message.Packet;
import org.red5.server.net.rtmp.message.*;
[ "org.red5.server" ]
org.red5.server;
1,118,566
public Observable<ServiceResponse<ServerInner>> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (serverName == null) { throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); }
Observable<ServiceResponse<ServerInner>> function(String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (serverName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); }
/** * Creates a new server, or will overwrite an existing server. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the server. * @param parameters The required parameters for creating or updating a server. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */
Creates a new server, or will overwrite an existing server
beginCreateWithServiceResponseAsync
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/ServersInner.java", "license": "mit", "size": 51773 }
[ "com.microsoft.azure.management.postgresql.v2017_12_01.ServerForCreate", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.management.postgresql.v2017_12_01.ServerForCreate; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.management.postgresql.v2017_12_01.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
299,331
@Test public void testTimeoutDuringSync() throws Exception { LDAPUserRegistry userRegistry = createRegistry(); when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any())) .thenThrow(new NamingException(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE + " test.")); try { userRegistry.getGroups(new Date()); fail("The process should fail with an exception"); } catch (AlfrescoRuntimeException are) { assertEquals("The error message is not of the right format.", "synchronization.err.ldap.search", are.getMsgId()); assertTrue("The error message was not caused by timeout.", are.getCause().getMessage().contains(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE)); } }
void function() throws Exception { LDAPUserRegistry userRegistry = createRegistry(); when(initialDirContext.getAttributes(eq(LDAPUserRegistry.jndiName(MEMBER_ATTRIBUTE_VALUE)), any())) .thenThrow(new NamingException(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE + STR)); try { userRegistry.getGroups(new Date()); fail(STR); } catch (AlfrescoRuntimeException are) { assertEquals(STR, STR, are.getMsgId()); assertTrue(STR, are.getCause().getMessage().contains(LDAPUserRegistry.NAMING_TIMEOUT_EXCEPTION_MESSAGE)); } }
/** * Test for MNT-17966 */
Test for MNT-17966
testTimeoutDuringSync
{ "repo_name": "loftuxab/alfresco-community-loftux", "path": "projects/repository/source/test-java/org/alfresco/repo/security/sync/LDAPUserRegistryTest.java", "license": "lgpl-3.0", "size": 6655 }
[ "java.util.Date", "javax.naming.NamingException", "org.alfresco.error.AlfrescoRuntimeException", "org.alfresco.repo.security.sync.ldap.LDAPUserRegistry", "org.junit.Assert", "org.mockito.Matchers", "org.mockito.Mockito" ]
import java.util.Date; import javax.naming.NamingException; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.security.sync.ldap.LDAPUserRegistry; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito;
import java.util.*; import javax.naming.*; import org.alfresco.error.*; import org.alfresco.repo.security.sync.ldap.*; import org.junit.*; import org.mockito.*;
[ "java.util", "javax.naming", "org.alfresco.error", "org.alfresco.repo", "org.junit", "org.mockito" ]
java.util; javax.naming; org.alfresco.error; org.alfresco.repo; org.junit; org.mockito;
962,638
@Test (groups = "rnaseq-tests") public void testRnaseqTestSkeleton() throws Exception{ try{ // TODO: Test logic here. Assert.assertTrue(true); // pass default } catch (Exception e){ logger.error("Caught unexpected exception: " + e.getLocalizedMessage()); throw e; // re-throw the exception } }
@Test (groups = STR) void function() throws Exception{ try{ Assert.assertTrue(true); } catch (Exception e){ logger.error(STR + e.getLocalizedMessage()); throw e; } }
/** * Simple Test skeleton * @throws Exception */
Simple Test skeleton
testRnaseqTestSkeleton
{ "repo_name": "WASP-System/central", "path": "plugins/rnaseq/src/test/java/edu/yu/einstein/wasp/plugin/rnaseq/RnaseqTestSkeleton.java", "license": "agpl-3.0", "size": 1419 }
[ "org.testng.Assert", "org.testng.annotations.Test" ]
import org.testng.Assert; import org.testng.annotations.Test;
import org.testng.*; import org.testng.annotations.*;
[ "org.testng", "org.testng.annotations" ]
org.testng; org.testng.annotations;
2,834,076
final HttpPost httpPost = createPost(req); final HttpClientContext ctxt = HttpClientContext.create(); try { sign(ctxt, req.requestPath(), req.toSign()); } catch (IOException e) { throw new IdiliaClientException(e); } final CompletableFuture<QueryResponse<T>> future = new CompletableFuture<>(); getClient().execute(httpPost, ctxt, new QueryCB<T>(tpRef, httpPost, ctxt, future)); return future; } private class QueryCB<T> extends HttpCallback<QueryResponse<T>> { final private Class<T> tpRef; public QueryCB(Class<T> tpRef, HttpUriRequest request, HttpClientContext context, CompletableFuture<QueryResponse<T>> future) { super(request, context, future); this.tpRef = tpRef; }
final HttpPost httpPost = createPost(req); final HttpClientContext ctxt = HttpClientContext.create(); try { sign(ctxt, req.requestPath(), req.toSign()); } catch (IOException e) { throw new IdiliaClientException(e); } final CompletableFuture<QueryResponse<T>> future = new CompletableFuture<>(); getClient().execute(httpPost, ctxt, new QueryCB<T>(tpRef, httpPost, ctxt, future)); return future; } private class QueryCB<T> extends HttpCallback<QueryResponse<T>> { final private Class<T> tpRef; public QueryCB(Class<T> tpRef, HttpUriRequest request, HttpClientContext context, CompletableFuture<QueryResponse<T>> future) { super(request, context, future); this.tpRef = tpRef; }
/** * Sends a query request to the kb server. * * Asynchronously sends an HTTP request to the kb server and signals the returned * future when the result is available. * * @param <T> A POJO that can be JSON serialized and reconstituted. The query and responses may include * multiple instances of it. * @param req Request message. One concrete implementation of {@link QueryRequest} * @param tpRef type of the class of object to recover from the JSON response. Can be Object.class * or a user defined class. * @return a CompletableFuture set when the response is available * @throws IdiliaClientException wrapping the actual exception encountered */
Sends a query request to the kb server. Asynchronously sends an HTTP request to the kb server and signals the returned future when the result is available
queryAsync
{ "repo_name": "Idilia/idilia-java-sdk", "path": "src/main/java/com/idilia/services/kb/AsyncClient.java", "license": "apache-2.0", "size": 7985 }
[ "com.idilia.services.base.IdiliaClientException", "java.io.IOException", "java.util.concurrent.CompletableFuture", "org.apache.http.client.methods.HttpPost", "org.apache.http.client.methods.HttpUriRequest", "org.apache.http.client.protocol.HttpClientContext" ]
import com.idilia.services.base.IdiliaClientException; import java.io.IOException; import java.util.concurrent.CompletableFuture; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.protocol.HttpClientContext;
import com.idilia.services.base.*; import java.io.*; import java.util.concurrent.*; import org.apache.http.client.methods.*; import org.apache.http.client.protocol.*;
[ "com.idilia.services", "java.io", "java.util", "org.apache.http" ]
com.idilia.services; java.io; java.util; org.apache.http;
291,594
@Test public void testModelXmlSerialization() throws Exception { Logger.getLogger(getClass()).debug("TEST " + name.getMethodName()); XmlSerializationTester tester = new XmlSerializationTester(object); // The proxy descriptors can have only "id" and "name" set due to xml // transient tester.proxy(Descriptor.class, 1, descriptor1); tester.proxy(Descriptor.class, 2, descriptor2); assertTrue(tester.testXmlSerialization()); }
void function() throws Exception { Logger.getLogger(getClass()).debug(STR + name.getMethodName()); XmlSerializationTester tester = new XmlSerializationTester(object); tester.proxy(Descriptor.class, 1, descriptor1); tester.proxy(Descriptor.class, 2, descriptor2); assertTrue(tester.testXmlSerialization()); }
/** * Test XML serialization. * * @throws Exception the exception */
Test XML serialization
testModelXmlSerialization
{ "repo_name": "WestCoastInformatics/UMLS-Terminology-Server", "path": "jpa-model/src/test/java/com/wci/umls/server/jpa/test/content/DescriptorTreePositionJpaUnitTest.java", "license": "apache-2.0", "size": 7036 }
[ "com.wci.umls.server.helpers.XmlSerializationTester", "com.wci.umls.server.model.content.Descriptor", "org.apache.log4j.Logger", "org.junit.Assert" ]
import com.wci.umls.server.helpers.XmlSerializationTester; import com.wci.umls.server.model.content.Descriptor; import org.apache.log4j.Logger; import org.junit.Assert;
import com.wci.umls.server.helpers.*; import com.wci.umls.server.model.content.*; import org.apache.log4j.*; import org.junit.*;
[ "com.wci.umls", "org.apache.log4j", "org.junit" ]
com.wci.umls; org.apache.log4j; org.junit;
79,274
void processCsvInput( List<List<?>> tableData, List<List<?>> tableData2, TableType type, PersistentReference reference );
void processCsvInput( List<List<?>> tableData, List<List<?>> tableData2, TableType type, PersistentReference reference );
/** * Process the table information given by the List of List for a specified * table type in csv format. * * @param tableData List<List<?>> first sheet containing the main table * data * @param tableData2 List<List<?>> second sheet containing the parameters * and statistics of the analysis * @param reference PersistentReference * @param type TableType */
Process the table information given by the List of List for a specified table type in csv format
processCsvInput
{ "repo_name": "rhilker/ReadXplorer", "path": "readxplorer-ui-importer/src/main/java/de/cebitec/readxplorer/ui/importer/TranscriptomeTableViewI.java", "license": "gpl-3.0", "size": 2545 }
[ "de.cebitec.readxplorer.databackend.dataobjects.PersistentReference", "de.cebitec.readxplorer.parser.tables.TableType", "java.util.List" ]
import de.cebitec.readxplorer.databackend.dataobjects.PersistentReference; import de.cebitec.readxplorer.parser.tables.TableType; import java.util.List;
import de.cebitec.readxplorer.databackend.dataobjects.*; import de.cebitec.readxplorer.parser.tables.*; import java.util.*;
[ "de.cebitec.readxplorer", "java.util" ]
de.cebitec.readxplorer; java.util;
2,511,013
public OvhOrder telephony_new_POST() throws IOException { String qPath = "/order/telephony/new"; StringBuilder sb = path(qPath); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
OvhOrder function() throws IOException { String qPath = STR; StringBuilder sb = path(qPath); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
/** * Create order * * REST: POST /order/telephony/new */
Create order
telephony_new_POST
{ "repo_name": "UrielCh/ovh-java-sdk", "path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java", "license": "bsd-3-clause", "size": 511080 }
[ "java.io.IOException", "net.minidev.ovh.api.order.OvhOrder" ]
import java.io.IOException; import net.minidev.ovh.api.order.OvhOrder;
import java.io.*; import net.minidev.ovh.api.order.*;
[ "java.io", "net.minidev.ovh" ]
java.io; net.minidev.ovh;
1,423,095
@Test public void reportsErrorWhenIndentationIsIncorrect() throws Exception { this.validateCheckstyle( "InvalidIndentation.java", false, Matchers.containsString( "Indentation (14) must be same or less than" ) ); }
void function() throws Exception { this.validateCheckstyle( STR, false, Matchers.containsString( STR ) ); }
/** * CheckstyleValidator reports an error when indentation is not * bigger than previous line by exactly 4. * @throws Exception when error. */
CheckstyleValidator reports an error when indentation is not bigger than previous line by exactly 4
reportsErrorWhenIndentationIsIncorrect
{ "repo_name": "carlosmiranda/qulice", "path": "qulice-checkstyle/src/test/java/com/qulice/checkstyle/CheckstyleValidatorTest.java", "license": "bsd-3-clause", "size": 15108 }
[ "org.hamcrest.Matchers" ]
import org.hamcrest.Matchers;
import org.hamcrest.*;
[ "org.hamcrest" ]
org.hamcrest;
1,028,287
public static <E, Q extends SimpleExpression<? super E>> SetPath<E, Q> setPath(Class<E> type, Class<Q> queryType, PathMetadata metadata) { return new SetPath<E, Q>(type, queryType, metadata); }
static <E, Q extends SimpleExpression<? super E>> SetPath<E, Q> function(Class<E> type, Class<Q> queryType, PathMetadata metadata) { return new SetPath<E, Q>(type, queryType, metadata); }
/** * Create a new Path expression * * @param type element type * @param queryType element expression type * @param metadata path metadata * @param <E> element type * @param <Q> element expression type * @return path expression */
Create a new Path expression
setPath
{ "repo_name": "johnktims/querydsl", "path": "querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java", "license": "apache-2.0", "size": 74346 }
[ "com.querydsl.core.types.PathMetadata" ]
import com.querydsl.core.types.PathMetadata;
import com.querydsl.core.types.*;
[ "com.querydsl.core" ]
com.querydsl.core;
164,422
public static String collectionToDelimitedString(Collection coll, String delim) { return collectionToDelimitedString(coll, delim, "", ""); }
static String function(Collection coll, String delim) { return collectionToDelimitedString(coll, delim, STR"); }
/** * Convenience method to return a Collection as a delimited (e.g. CSV) * String. E.g. useful for <code>toString()</code> implementations. * @param coll the Collection to display * @param delim the delimiter to use (probably a ",") * @return the delimited String * * Borrowed from Spring, under the ASL2.0 license. */
Convenience method to return a Collection as a delimited (e.g. CSV) String. E.g. useful for <code>toString()</code> implementations
collectionToDelimitedString
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/drools-master/drools-core/src/main/java/org/drools/core/util/StringUtils.java", "license": "mit", "size": 41700 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,026,590
public static void setDefaultIcon(ImageIcon icon) { defaultIcon = icon; }
static void function(ImageIcon icon) { defaultIcon = icon; }
/** * Set the default icon. * * @param icon The new default icon. */
Set the default icon
setDefaultIcon
{ "repo_name": "iritgo/iritgo-aktario", "path": "aktario-framework/src/main/java/de/iritgo/aktario/framework/client/gui/OtherFrame.java", "license": "apache-2.0", "size": 6641 }
[ "javax.swing.ImageIcon" ]
import javax.swing.ImageIcon;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,252,863
public Location getLocation(ReferenceHeadMountable hm);
Location function(ReferenceHeadMountable hm);
/** * Returns a clone of the HeadMountable's current location. It's important that the returned * object is a clone, since the caller may modify the returned Location. * * @param hm * @return */
Returns a clone of the HeadMountable's current location. It's important that the returned object is a clone, since the caller may modify the returned Location
getLocation
{ "repo_name": "ChrisPVille/openpnp", "path": "src/main/java/org/openpnp/machine/reference/ReferenceDriver.java", "license": "gpl-3.0", "size": 4444 }
[ "org.openpnp.model.Location" ]
import org.openpnp.model.Location;
import org.openpnp.model.*;
[ "org.openpnp.model" ]
org.openpnp.model;
439,469
private synchronized void readConfiguration() { log.trace("Enter readConfiguration()"); //Read configuration String restUrlParameter = ConfigCollection.getProperties().getProperty( REST_URLS_CONFIGURATION_PARAMETER); String soapUrlParameter = ConfigCollection.getProperties().getProperty( SOAP_URLS_CONFIGURATION_PARAMETER); String ignoredMessagesPath = ConfigCollection.getProperties() .getProperty(IGNOREFILE_CONFIGURATION_PARAMETER); List<String> restStatusUrls; List<String> soapStatusUrls; File ignoredMessagesFile; //Initialize REST status urls if (restUrlParameter == null || restUrlParameter.equals("")) { restStatusUrls = Collections.emptyList(); } else { String[] splits = restUrlParameter.split(";"); restStatusUrls = new ArrayList<String>(); for (String split : splits) { if (split != null && !split.isEmpty()) { restStatusUrls.add(split); } } } if (!restStatusUrls.equals(this.restStatusUrls)) { log.info("Setting list of surveyed REST status URLs to '" + restStatusUrls + "'"); this.restStatusUrls = restStatusUrls; } //Initialize SOAP status urls if (soapUrlParameter == null || soapUrlParameter.equals("")) { soapStatusUrls = Collections.emptyList(); } else { soapStatusUrls = Arrays.asList(soapUrlParameter.split(";")); } if (!soapStatusUrls.equals(this.soapStatusUrls)) { log.info("Setting list of surveyed SOAP status URLs to '" + soapStatusUrls + "'"); this.soapStatusUrls = soapStatusUrls; } //Initialize file with list of ignored messages. if (ignoredMessagesPath == null || ignoredMessagesPath.equals("")) { ignoredMessagesPath = DEFAULT_IGNORED_MESSAGES_PATH; } ignoredMessagesFile = new File(ignoredMessagesPath); if (!ignoredMessagesFile.getAbsoluteFile().getParentFile().isDirectory() || (ignoredMessagesFile.exists() && !ignoredMessagesFile.isFile())) { log.warn("Configuration for file of ignored messages '" + ignoredMessagesPath + "' does not denote a valid file." + " Falling back to default."); ignoredMessagesPath = DEFAULT_IGNORED_MESSAGES_PATH; ignoredMessagesFile = new File(ignoredMessagesPath); } if (!this.ignoredMessagesFile.equals(ignoredMessagesFile)) { log.info("Setting file with list of ignored messages to '" + ignoredMessagesFile + "'"); this.ignoredMessagesFile = ignoredMessagesFile; readIgnoredMessagesFromFile(); } }
synchronized void function() { log.trace(STR); String restUrlParameter = ConfigCollection.getProperties().getProperty( REST_URLS_CONFIGURATION_PARAMETER); String soapUrlParameter = ConfigCollection.getProperties().getProperty( SOAP_URLS_CONFIGURATION_PARAMETER); String ignoredMessagesPath = ConfigCollection.getProperties() .getProperty(IGNOREFILE_CONFIGURATION_PARAMETER); List<String> restStatusUrls; List<String> soapStatusUrls; File ignoredMessagesFile; if (restUrlParameter == null restUrlParameter.equals(STR;STRSetting list of surveyed REST status URLs to 'STR'STRSTR;STRSetting list of surveyed SOAP status URLs to 'STR'STRSTRConfiguration for file of ignored messages 'STR' does not denote a valid file.STR Falling back to default.STRSetting file with list of ignored messages to 'STR'"); this.ignoredMessagesFile = ignoredMessagesFile; readIgnoredMessagesFromFile(); } }
/** * Set configuration. * * This method will read the configuration values, and do initialization * based on this. * * @see #REST_URLS_CONFIGURATION_PARAMETER * @see #SOAP_URLS_CONFIGURATION_PARAMETER * @see #IGNOREFILE_CONFIGURATION_PARAMETER */
Set configuration. This method will read the configuration values, and do initialization based on this
readConfiguration
{ "repo_name": "statsbiblioteket/doms-surveillance", "path": "surveillance-surveyor-service/src/main/java/dk/statsbiblioteket/doms/surveillance/surveyor/WebServiceSurveyor.java", "license": "apache-2.0", "size": 22236 }
[ "dk.statsbiblioteket.sbutil.webservices.configuration.ConfigCollection", "java.io.File", "java.util.List" ]
import dk.statsbiblioteket.sbutil.webservices.configuration.ConfigCollection; import java.io.File; import java.util.List;
import dk.statsbiblioteket.sbutil.webservices.configuration.*; import java.io.*; import java.util.*;
[ "dk.statsbiblioteket.sbutil", "java.io", "java.util" ]
dk.statsbiblioteket.sbutil; java.io; java.util;
2,534,781
public void setTitleColor(int textColor) { verifyMethodCalledFromDelegate("setTitleColor(Integer)"); ((CallVoid1<Integer>) mSuperListeners.pop()).call(textColor); } /** * Specifies whether the screen should be turned on when the {@link Activity} is resumed. * Normally an activity will be transitioned to the stopped state if it is started while the * screen if off, but with this flag set the activity will cause the screen to turn on if the * activity will be visible and resumed due to the screen coming on. The screen will not be * turned on if the activity won't be visible after the screen is turned on. This flag is * normally used in conjunction with the {@link android.R.attr#showWhenLocked} flag to make sure * the activity is visible after the screen is turned on when the lockscreen is up. In addition, * if this flag is set and the activity calls {@link * KeyguardManager#requestDismissKeyguard(Activity, KeyguardManager.KeyguardDismissCallback)}
void function(int textColor) { verifyMethodCalledFromDelegate(STR); ((CallVoid1<Integer>) mSuperListeners.pop()).call(textColor); } /** * Specifies whether the screen should be turned on when the {@link Activity} is resumed. * Normally an activity will be transitioned to the stopped state if it is started while the * screen if off, but with this flag set the activity will cause the screen to turn on if the * activity will be visible and resumed due to the screen coming on. The screen will not be * turned on if the activity won't be visible after the screen is turned on. This flag is * normally used in conjunction with the {@link android.R.attr#showWhenLocked} flag to make sure * the activity is visible after the screen is turned on when the lockscreen is up. In addition, * if this flag is set and the activity calls { * KeyguardManager#requestDismissKeyguard(Activity, KeyguardManager.KeyguardDismissCallback)}
/** * Change the color of the title associated with this activity. * <p> * This method is deprecated starting in API Level 11 and replaced by action * bar styles. For information on styling the Action Bar, read the <a * href="{@docRoot} guide/topics/ui/actionbar.html">Action Bar</a> developer * guide. * * @deprecated Use action bar styles instead. */
Change the color of the title associated with this activity. This method is deprecated starting in API Level 11 and replaced by action bar styles. For information on styling the Action Bar, read the Action Bar developer guide
setTitleColor
{ "repo_name": "passsy/CompositeAndroid", "path": "activity/src/main/java/com/pascalwelsch/compositeandroid/activity/ActivityPlugin.java", "license": "apache-2.0", "size": 278532 }
[ "android.app.Activity", "android.app.KeyguardManager", "com.pascalwelsch.compositeandroid.core.CallVoid1" ]
import android.app.Activity; import android.app.KeyguardManager; import com.pascalwelsch.compositeandroid.core.CallVoid1;
import android.app.*; import com.pascalwelsch.compositeandroid.core.*;
[ "android.app", "com.pascalwelsch.compositeandroid" ]
android.app; com.pascalwelsch.compositeandroid;
1,717,984
@FIXVersion(introduced = "5.0SP1") @TagNumRef(tagNum = TagNum.DerivativePositionLimit) public Integer getDerivativePositionLimit() { return derivativePositionLimit; }
@FIXVersion(introduced = STR) @TagNumRef(tagNum = TagNum.DerivativePositionLimit) Integer function() { return derivativePositionLimit; }
/** * Message field getter. * @return field value */
Message field getter
getDerivativePositionLimit
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/comp/DerivativeInstrument.java", "license": "gpl-3.0", "size": 83551 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
2,057,221
SettingsDecryptionRequest setServers( List<Server> servers );
SettingsDecryptionRequest setServers( List<Server> servers );
/** * Sets the servers whose passwords should be decrypted. * * @param servers The servers to decrypt, may be {@code null}. * @return This request, never {@code null}. */
Sets the servers whose passwords should be decrypted
setServers
{ "repo_name": "runepeter/maven-deploy-plugin-2.8.1", "path": "maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java", "license": "apache-2.0", "size": 1997 }
[ "java.util.List", "org.apache.maven.settings.Server" ]
import java.util.List; import org.apache.maven.settings.Server;
import java.util.*; import org.apache.maven.settings.*;
[ "java.util", "org.apache.maven" ]
java.util; org.apache.maven;
1,535,301
public boolean execute(List<RawResultIterator> unsortedResultIteratorList, List<RawResultIterator> sortedResultIteratorList) throws Exception { List<RawResultIterator> finalIteratorList = new ArrayList<>(unsortedResultIteratorList); finalIteratorList.addAll(sortedResultIteratorList); initRecordHolderHeap(finalIteratorList); boolean mergeStatus = false; int index = 0; boolean isDataPresent = false; try { // add all iterators to the queue for (RawResultIterator leaftTupleIterator : finalIteratorList) { if (leaftTupleIterator.hasNext()) { this.recordHolderHeap.add(leaftTupleIterator); index++; } } RawResultIterator iterator = null; while (index > 1) { // iterator the top record iterator = this.recordHolderHeap.peek(); Object[] convertedRow = iterator.next(); if (null == convertedRow) { index--; iterator.close(); this.recordHolderHeap.poll(); continue; } if (!isDataPresent) { dataHandler.initialise(); isDataPresent = true; } // get the mdkey addRow(convertedRow); // if there is no record in the leaf and all then decrement the // index if (!iterator.hasNext()) { index--; iterator.close(); this.recordHolderHeap.poll(); continue; } // maintain heap this.recordHolderHeap.siftTopDown(); } // if record holder is not empty then iterator the slice holder from // heap iterator = this.recordHolderHeap.poll(); if (null != iterator) { while (true) { Object[] convertedRow = iterator.next(); if (null == convertedRow) { iterator.close(); break; } // do it only once if (!isDataPresent) { dataHandler.initialise(); isDataPresent = true; } addRow(convertedRow); // check if leaf contains no record if (!iterator.hasNext()) { break; } } } if (isDataPresent) { this.dataHandler.finish(); } mergeStatus = true; } catch (Exception e) { mergeStatus = false; LOGGER.error(e.getLocalizedMessage(), e); throw e; } finally { try { if (isDataPresent) { this.dataHandler.closeHandler(); } boolean isMergeIndex = Boolean.parseBoolean(CarbonProperties.getInstance().getProperty( CarbonCommonConstants.CARBON_MERGE_INDEX_IN_SEGMENT, CarbonCommonConstants.CARBON_MERGE_INDEX_IN_SEGMENT_DEFAULT)); // mergeIndex is true, the segment file not need to be written // and will be written during merging index if (partitionSpec != null && !isMergeIndex) { // By default carbon.merge.index.in.segment is true and this code will be used for // developer debugging purpose. SegmentFileStore.writeSegmentFileForPartitionTable(loadModel.getTablePath(), loadModel.getTaskNo(), partitionSpec.getLocation().toString(), loadModel.getFactTimeStamp() + "", partitionSpec.getPartitions()); } } catch (CarbonDataWriterException | IOException e) { mergeStatus = false; throw e; } } return mergeStatus; }
boolean function(List<RawResultIterator> unsortedResultIteratorList, List<RawResultIterator> sortedResultIteratorList) throws Exception { List<RawResultIterator> finalIteratorList = new ArrayList<>(unsortedResultIteratorList); finalIteratorList.addAll(sortedResultIteratorList); initRecordHolderHeap(finalIteratorList); boolean mergeStatus = false; int index = 0; boolean isDataPresent = false; try { for (RawResultIterator leaftTupleIterator : finalIteratorList) { if (leaftTupleIterator.hasNext()) { this.recordHolderHeap.add(leaftTupleIterator); index++; } } RawResultIterator iterator = null; while (index > 1) { iterator = this.recordHolderHeap.peek(); Object[] convertedRow = iterator.next(); if (null == convertedRow) { index--; iterator.close(); this.recordHolderHeap.poll(); continue; } if (!isDataPresent) { dataHandler.initialise(); isDataPresent = true; } addRow(convertedRow); if (!iterator.hasNext()) { index--; iterator.close(); this.recordHolderHeap.poll(); continue; } this.recordHolderHeap.siftTopDown(); } iterator = this.recordHolderHeap.poll(); if (null != iterator) { while (true) { Object[] convertedRow = iterator.next(); if (null == convertedRow) { iterator.close(); break; } if (!isDataPresent) { dataHandler.initialise(); isDataPresent = true; } addRow(convertedRow); if (!iterator.hasNext()) { break; } } } if (isDataPresent) { this.dataHandler.finish(); } mergeStatus = true; } catch (Exception e) { mergeStatus = false; LOGGER.error(e.getLocalizedMessage(), e); throw e; } finally { try { if (isDataPresent) { this.dataHandler.closeHandler(); } boolean isMergeIndex = Boolean.parseBoolean(CarbonProperties.getInstance().getProperty( CarbonCommonConstants.CARBON_MERGE_INDEX_IN_SEGMENT, CarbonCommonConstants.CARBON_MERGE_INDEX_IN_SEGMENT_DEFAULT)); if (partitionSpec != null && !isMergeIndex) { SegmentFileStore.writeSegmentFileForPartitionTable(loadModel.getTablePath(), loadModel.getTaskNo(), partitionSpec.getLocation().toString(), loadModel.getFactTimeStamp() + "", partitionSpec.getPartitions()); } } catch (CarbonDataWriterException IOException e) { mergeStatus = false; throw e; } } return mergeStatus; }
/** * Merge function * */
Merge function
execute
{ "repo_name": "zzcclp/carbondata", "path": "processing/src/main/java/org/apache/carbondata/processing/merger/RowResultMergerProcessor.java", "license": "apache-2.0", "size": 10959 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.carbondata.core.constants.CarbonCommonConstants", "org.apache.carbondata.core.datastore.exception.CarbonDataWriterException", "org.apache.carbondata.core.metadata.SegmentFileStore", "org.apache.carbondata.core.scan.result.iterator.RawResultIterator", "org.apache.carbondata.core.util.CarbonProperties" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.datastore.exception.CarbonDataWriterException; import org.apache.carbondata.core.metadata.SegmentFileStore; import org.apache.carbondata.core.scan.result.iterator.RawResultIterator; import org.apache.carbondata.core.util.CarbonProperties;
import java.io.*; import java.util.*; import org.apache.carbondata.core.constants.*; import org.apache.carbondata.core.datastore.exception.*; import org.apache.carbondata.core.metadata.*; import org.apache.carbondata.core.scan.result.iterator.*; import org.apache.carbondata.core.util.*;
[ "java.io", "java.util", "org.apache.carbondata" ]
java.io; java.util; org.apache.carbondata;
1,978,930
IFunctionInfo finfo = FunctionUtil.getFunctionInfo(new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName().toLowerCase(), signature.getArity())); if (finfo == null) { return false; } return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null; }
IFunctionInfo finfo = FunctionUtil.getFunctionInfo(new FunctionIdentifier(FunctionConstants.ASTERIX_NS, signature.getName().toLowerCase(), signature.getArity())); if (finfo == null) { return false; } return AsterixBuiltinFunctions.getAggregateFunction(finfo.getFunctionIdentifier()) != null; }
/** * Whether a function signature is a SQL-92 core aggregate function. * * @param fs, * the function signature. * @return true if the function signature is a SQL-92 core aggregate, * false otherwise. */
Whether a function signature is a SQL-92 core aggregate function
isSql92AggregateFunction
{ "repo_name": "kisskys/incubator-asterixdb", "path": "asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java", "license": "apache-2.0", "size": 6483 }
[ "org.apache.asterix.common.functions.FunctionConstants", "org.apache.asterix.lang.common.util.FunctionUtil", "org.apache.asterix.om.functions.AsterixBuiltinFunctions", "org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier", "org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo" ]
import org.apache.asterix.common.functions.FunctionConstants; import org.apache.asterix.lang.common.util.FunctionUtil; import org.apache.asterix.om.functions.AsterixBuiltinFunctions; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
import org.apache.asterix.common.functions.*; import org.apache.asterix.lang.common.util.*; import org.apache.asterix.om.functions.*; import org.apache.hyracks.algebricks.core.algebra.functions.*;
[ "org.apache.asterix", "org.apache.hyracks" ]
org.apache.asterix; org.apache.hyracks;
2,519,417
public SimpleSelector createRootNodeSelector() throws CSSException { throw new CSSException("Not implemented in CSS2"); }
SimpleSelector function() throws CSSException { throw new CSSException(STR); }
/** * <b>SAC</b>: Implements {@link * org.w3c.css.sac.SelectorFactory#createRootNodeSelector()}. */
SAC: Implements <code>org.w3c.css.sac.SelectorFactory#createRootNodeSelector()</code>
createRootNodeSelector
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/css/engine/sac/CSSSelectorFactory.java", "license": "apache-2.0", "size": 6104 }
[ "org.w3c.css.sac.CSSException", "org.w3c.css.sac.SimpleSelector" ]
import org.w3c.css.sac.CSSException; import org.w3c.css.sac.SimpleSelector;
import org.w3c.css.sac.*;
[ "org.w3c.css" ]
org.w3c.css;
1,205,981
@Override public void doSaveAs() { SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file != null) { doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); } } }
void function() { SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file != null) { doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); } } }
/** * This also changes the editor's input. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This also changes the editor's input.
doSaveAs
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.editor/src/de/dfki/iui/basys/model/domain/linebalancing/presentation/LinebalancingEditor.java", "license": "epl-1.0", "size": 57540 }
[ "org.eclipse.core.resources.IFile", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.core.runtime.IPath", "org.eclipse.emf.common.util.URI", "org.eclipse.ui.dialogs.SaveAsDialog", "org.eclipse.ui.part.FileEditorInput" ]
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.emf.common.util.*; import org.eclipse.ui.dialogs.*; import org.eclipse.ui.part.*;
[ "org.eclipse.core", "org.eclipse.emf", "org.eclipse.ui" ]
org.eclipse.core; org.eclipse.emf; org.eclipse.ui;
529,847
public static void checkStatusAndLockVm(Guid vmId) { VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(vmId); checkStatusBeforeLock(vmDynamic.getStatus()); lockVm(vmId); }
static void function(Guid vmId) { VmDynamic vmDynamic = DbFacade.getInstance().getVmDynamicDao().get(vmId); checkStatusBeforeLock(vmDynamic.getStatus()); lockVm(vmId); }
/** * Lock VM after check its status, If VM status is locked, we throw an exception. * * @param vmId * - The ID of the VM. */
Lock VM after check its status, If VM status is locked, we throw an exception
checkStatusAndLockVm
{ "repo_name": "yingyun001/ovirt-engine", "path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java", "license": "apache-2.0", "size": 50757 }
[ "org.ovirt.engine.core.common.businessentities.VmDynamic", "org.ovirt.engine.core.compat.Guid", "org.ovirt.engine.core.dal.dbbroker.DbFacade" ]
import org.ovirt.engine.core.common.businessentities.VmDynamic; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dal.dbbroker.DbFacade;
import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.compat.*; import org.ovirt.engine.core.dal.dbbroker.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
1,328,335
@Test public void testThrows_FailableObjLongConsumer_String_IOException() { new FailableObjLongConsumer<String, IOException>() {
void function() { new FailableObjLongConsumer<String, IOException>() {
/** * Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as * generic test types. */
Tests that our failable interface is properly defined to throw any exception using String and IOExceptions as generic test types
testThrows_FailableObjLongConsumer_String_IOException
{ "repo_name": "britter/commons-lang", "path": "src/test/java/org/apache/commons/lang3/function/FailableFunctionsTest.java", "license": "apache-2.0", "size": 95783 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,990,564
public static RuleChain createRuleChain(TestRule gateway, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(timeoutRule).around(gateway); }
static RuleChain function(TestRule gateway, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(timeoutRule).around(gateway); }
/** * Creates a rule (chain) out of a k3po or other rule, adding extra rules as follows:<ol> * <li> a timeout rule * <li> a rule to print console messages at the start and end of each test method and print trace level * log messages on test failure. * </ol> * @param rule Rule to startup and stop gateway * @param timeout The maximum allowed time duration of each test (including Gateway and robot startup and shutdown) * @param timeUnit The unit for the timeout * @return A TestRule which should be the only public @Rule in our robot tests */
Creates a rule (chain) out of a k3po or other rule, adding extra rules as follows: a timeout rule a rule to print console messages at the start and end of each test method and print trace level log messages on test failure.
createRuleChain
{ "repo_name": "chao-sun-kaazing/gateway", "path": "test.util/src/main/java/org/kaazing/test/util/ITUtil.java", "license": "apache-2.0", "size": 5159 }
[ "java.util.concurrent.TimeUnit", "org.junit.rules.DisableOnDebug", "org.junit.rules.RuleChain", "org.junit.rules.TestRule", "org.junit.rules.Timeout" ]
import java.util.concurrent.TimeUnit; import org.junit.rules.DisableOnDebug; import org.junit.rules.RuleChain; import org.junit.rules.TestRule; import org.junit.rules.Timeout;
import java.util.concurrent.*; import org.junit.rules.*;
[ "java.util", "org.junit.rules" ]
java.util; org.junit.rules;
611,031
private static void run(String benchmark, CacheAtomicityMode atomicityMode) throws Exception { run(benchmark, 4, true, atomicityMode, CacheWriteSynchronizationMode.PRIMARY_SYNC); run(benchmark, 4, true, atomicityMode, CacheWriteSynchronizationMode.FULL_SYNC); run(benchmark, 4, false, atomicityMode, CacheWriteSynchronizationMode.PRIMARY_SYNC); run(benchmark, 4, false, atomicityMode, CacheWriteSynchronizationMode.FULL_SYNC); }
static void function(String benchmark, CacheAtomicityMode atomicityMode) throws Exception { run(benchmark, 4, true, atomicityMode, CacheWriteSynchronizationMode.PRIMARY_SYNC); run(benchmark, 4, true, atomicityMode, CacheWriteSynchronizationMode.FULL_SYNC); run(benchmark, 4, false, atomicityMode, CacheWriteSynchronizationMode.PRIMARY_SYNC); run(benchmark, 4, false, atomicityMode, CacheWriteSynchronizationMode.FULL_SYNC); }
/** * Run benchmarks for atomic cache. * * @param benchmark Benchmark name. * @param atomicityMode Atomicity mode. * @throws Exception If failed. */
Run benchmarks for atomic cache
run
{ "repo_name": "samaitra/ignite", "path": "modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheBenchmark.java", "license": "apache-2.0", "size": 5036 }
[ "org.apache.ignite.cache.CacheAtomicityMode", "org.apache.ignite.cache.CacheWriteSynchronizationMode" ]
import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,267,839
EReference getParameterValueMapping_Value();
EReference getParameterValueMapping_Value();
/** * Returns the meta object for the containment reference '{@link ca.mcgill.cs.sel.ram.ParameterValueMapping#getValue <em>Value</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Value</em>'. * @see ca.mcgill.cs.sel.ram.ParameterValueMapping#getValue() * @see #getParameterValueMapping() * @generated */
Returns the meta object for the containment reference '<code>ca.mcgill.cs.sel.ram.ParameterValueMapping#getValue Value</code>'.
getParameterValueMapping_Value
{ "repo_name": "mjorod/textram", "path": "tool/ca.mcgill.sel.ram/src/ca/mcgill/cs/sel/ram/RamPackage.java", "license": "mit", "size": 271132 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,065,355
@Transactional(readOnly = false) @Override public void updateTransportationrisks( Transportationrisks transportationrisks) { getTransportationrisksDAO().updateTransportationrisks( transportationrisks); }
@Transactional(readOnly = false) void function( Transportationrisks transportationrisks) { getTransportationrisksDAO().updateTransportationrisks( transportationrisks); }
/** * Update Transportationrisks * * @param Transportationrisks * transportationrisks */
Update Transportationrisks
updateTransportationrisks
{ "repo_name": "machadolucas/watchout", "path": "src/main/java/com/riskvis/db/service/impl/TransportationrisksService.java", "license": "apache-2.0", "size": 2533 }
[ "com.riskvis.entity.Transportationrisks", "org.springframework.transaction.annotation.Transactional" ]
import com.riskvis.entity.Transportationrisks; import org.springframework.transaction.annotation.Transactional;
import com.riskvis.entity.*; import org.springframework.transaction.annotation.*;
[ "com.riskvis.entity", "org.springframework.transaction" ]
com.riskvis.entity; org.springframework.transaction;
1,571,787
public Collection<MailFolder> listMailboxes(GreenMailUser user, String mailboxPattern) throws FolderException { try { AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword()); return registerMailboxes(imapService.listMailboxes(alfrescoUser, getUnqualifiedMailboxPattern( alfrescoUser, mailboxPattern), false)); } catch (Throwable e) { logger.debug(e.getMessage(), e); throw new FolderException(e.getMessage()); } }
Collection<MailFolder> function(GreenMailUser user, String mailboxPattern) throws FolderException { try { AlfrescoImapUser alfrescoUser = new AlfrescoImapUser(user.getEmail(), user.getLogin(), user.getPassword()); return registerMailboxes(imapService.listMailboxes(alfrescoUser, getUnqualifiedMailboxPattern( alfrescoUser, mailboxPattern), false)); } catch (Throwable e) { logger.debug(e.getMessage(), e); throw new FolderException(e.getMessage()); } }
/** * Returns an collection of mailboxes. Method searches mailboxes under mount points defined for a specific user. * Mount points include user's IMAP Virtualised Views and Email Archive Views. This method serves LIST command * of the IMAP protocol. * * @param user User making the request * @param mailboxPattern String name of a mailbox possible including a wildcard. * @return Collection of mailboxes matching the pattern. * @throws com.icegreen.greenmail.store.FolderException */
Returns an collection of mailboxes. Method searches mailboxes under mount points defined for a specific user. Mount points include user's IMAP Virtualised Views and Email Archive Views. This method serves LIST command of the IMAP protocol
listMailboxes
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/repository/source/java/org/alfresco/repo/imap/AlfrescoImapHostManager.java", "license": "lgpl-3.0", "size": 15916 }
[ "com.icegreen.greenmail.store.FolderException", "com.icegreen.greenmail.store.MailFolder", "com.icegreen.greenmail.user.GreenMailUser", "java.util.Collection" ]
import com.icegreen.greenmail.store.FolderException; import com.icegreen.greenmail.store.MailFolder; import com.icegreen.greenmail.user.GreenMailUser; import java.util.Collection;
import com.icegreen.greenmail.store.*; import com.icegreen.greenmail.user.*; import java.util.*;
[ "com.icegreen.greenmail", "java.util" ]
com.icegreen.greenmail; java.util;
2,381,049
@Deprecated public static IExpr existsLeft(IAST ast, BiPredicate<IExpr, IExpr> stopPredicate, IExpr stopExpr, IExpr resultExpr) { int size = ast.size(); for (int i = 2; i < size; i++) { if (stopPredicate.test(ast.get(i - 1), ast.get(i))) { return stopExpr; } } return resultExpr; }
static IExpr function(IAST ast, BiPredicate<IExpr, IExpr> stopPredicate, IExpr stopExpr, IExpr resultExpr) { int size = ast.size(); for (int i = 2; i < size; i++) { if (stopPredicate.test(ast.get(i - 1), ast.get(i))) { return stopExpr; } } return resultExpr; }
/** * Compare the arguments pairwise with the <code>stopPredicate</code>. If the predicate gives * <code>true</code> return the <code>stopExpr</code>. If the <code>stopPredicate</code> gives * false for each pairwise comparison return the <code>resultExpr</code> * * @param ast * @param stopPredicate * @param stopExpr * @param resultExpr * @return * @deprecated use IAST#existsLeft() */
Compare the arguments pairwise with the <code>stopPredicate</code>. If the predicate gives <code>true</code> return the <code>stopExpr</code>. If the <code>stopPredicate</code> gives false for each pairwise comparison return the <code>resultExpr</code>
existsLeft
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/util/Lambda.java", "license": "gpl-3.0", "size": 5960 }
[ "java.util.function.BiPredicate", "org.matheclipse.core.interfaces.IExpr" ]
import java.util.function.BiPredicate; import org.matheclipse.core.interfaces.IExpr;
import java.util.function.*; import org.matheclipse.core.interfaces.*;
[ "java.util", "org.matheclipse.core" ]
java.util; org.matheclipse.core;
76,715