method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public MOB fetchInhabitant(String inhabitantID); public List<MOB> fetchInhabitants(String inhabitantID); public Enumeration<MOB> inhabitants(); public void addInhabitant(MOB mob); public void delInhabitant(MOB mob); public void delAllInhabitants(boolean destroy); public int numInhabitants(); public boolean isInhabitant(MOB mob); public MOB fetchRandomInhabitant(); public MOB fetchInhabitant(int i); public int numPCInhabitants(); public void bringMobHere(MOB mob, boolean andFollowers); public void eachInhabitant(final EachApplicable<MOB> applier);
MOB fetchInhabitant(String inhabitantID); public List<MOB> fetchInhabitants(String inhabitantID); public Enumeration<MOB> inhabitants(); public void addInhabitant(MOB mob); public void delInhabitant(MOB mob); public void delAllInhabitants(boolean destroy); public int numInhabitants(); public boolean isInhabitant(MOB mob); public MOB fetchRandomInhabitant(); public MOB fetchInhabitant(int i); public int numPCInhabitants(); public void bringMobHere(MOB mob, boolean andFollowers); public void function(final EachApplicable<MOB> applier);
/** * Applies the given code to each mob in this room * @param applier code to execute against each object */
Applies the given code to each mob in this room
eachInhabitant
{ "repo_name": "ConsecroMUD/ConsecroMUD", "path": "com/suscipio_solutions/consecro_mud/Locales/interfaces/Room.java", "license": "apache-2.0", "size": 8100 }
[ "com.suscipio_solutions.consecro_mud.core.interfaces.EachApplicable", "java.util.Enumeration", "java.util.List" ]
import com.suscipio_solutions.consecro_mud.core.interfaces.EachApplicable; import java.util.Enumeration; import java.util.List;
import com.suscipio_solutions.consecro_mud.core.interfaces.*; import java.util.*;
[ "com.suscipio_solutions.consecro_mud", "java.util" ]
com.suscipio_solutions.consecro_mud; java.util;
709,288
public synchronized void run() { if (fullInit == true) {// run already ran, or the file didn't // exist return; } try { fullInit = true; finishInitialization(); // finish initialization of table // The list isn't be closed as it's supposed to, and this // is causing a leak. We'll just avoid the list for now // and just close the files after we've read them. // BinaryFile.addClosable(this); } catch (FormatException f) { // close(); //invalidate some stuff } close(); }
synchronized void function() { if (fullInit == true) { return; } try { fullInit = true; finishInitialization(); } catch (FormatException f) { } close(); }
/** * Complete the initialization of the FeatureClassInfo. This function can be * called more than once. */
Complete the initialization of the FeatureClassInfo. This function can be called more than once
run
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/layer/vpf/FeatureClassInfo.java", "license": "mit", "size": 16577 }
[ "com.bbn.openmap.io.FormatException" ]
import com.bbn.openmap.io.FormatException;
import com.bbn.openmap.io.*;
[ "com.bbn.openmap" ]
com.bbn.openmap;
2,140,309
void setIcon(@DrawableRes int resourceId);
void setIcon(@DrawableRes int resourceId);
/** * Sets the icon of the dialog. * * @param resourceId * The resource id of the icon, which should be set, as an {@link Integer} value. The * resource id must correspond to a valid drawable resource */
Sets the icon of the dialog
setIcon
{ "repo_name": "michael-rapp/AndroidMaterialDialog", "path": "library/src/main/java/de/mrapp/android/dialog/model/MaterialDialogDecorator.java", "license": "apache-2.0", "size": 29588 }
[ "androidx.annotation.DrawableRes" ]
import androidx.annotation.DrawableRes;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
2,788,958
public long contentLength() throws IOException { return -1; }
long function() throws IOException { return -1; }
/** * Returns the number of bytes that will be written to {@code out} in a call * to {@link #writeTo}, or -1 if that count is unknown. */
Returns the number of bytes that will be written to out in a call to <code>#writeTo</code>, or -1 if that count is unknown
contentLength
{ "repo_name": "iooly/okhttp", "path": "okhttp/src/main/java/com/squareup/okhttp/RequestBody.java", "license": "apache-2.0", "size": 3503 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
810,998
public String jsGet_statusText() throws ScriptException { return this.statusLine.getReasonPhrase(); }
String function() throws ScriptException { return this.statusLine.getReasonPhrase(); }
/** * This corresponds to the readyonly statusText property of XHR. * * @return * @throws ScriptException */
This corresponds to the readyonly statusText property of XHR
jsGet_statusText
{ "repo_name": "wso2/jaggery", "path": "components/hostobjects/org.jaggeryjs.hostobjects.xhr/src/main/java/org/jaggeryjs/hostobjects/xhr/XMLHttpRequestHostObject.java", "license": "apache-2.0", "size": 30017 }
[ "org.jaggeryjs.scriptengine.exceptions.ScriptException" ]
import org.jaggeryjs.scriptengine.exceptions.ScriptException;
import org.jaggeryjs.scriptengine.exceptions.*;
[ "org.jaggeryjs.scriptengine" ]
org.jaggeryjs.scriptengine;
1,106,313
@Generated @Selector("initWithNode:bus:") public native AVAudioConnectionPoint initWithNodeBus(AVAudioNode node, @NUInt long bus);
@Selector(STR) native AVAudioConnectionPoint function(AVAudioNode node, @NUInt long bus);
/** * initWithNode:bus: * <p> * Create a connection point object. * <p> * If the node is nil, this method fails (returns nil). * * @param node the source or destination node * @param bus the output or input bus on the node */
initWithNode:bus: Create a connection point object. If the node is nil, this method fails (returns nil)
initWithNodeBus
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/avfaudio/AVAudioConnectionPoint.java", "license": "apache-2.0", "size": 5342 }
[ "org.moe.natj.general.ann.NUInt", "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.general.ann.NUInt; import org.moe.natj.objc.ann.Selector;
import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
228,909
public static SafeImplicitOutputsFunction fromTemplates(String... templates) { return fromTemplates(Arrays.asList(templates)); } /** * The implicit output function that generates files based on a set of * template substitutions using rule attribute values. * * @param templates The templates used to construct the name of the implicit * output file target. The substring "%{name}" will be replaced by the * actual name of the rule, the substring "%{srcs}" will be replaced by the * name of each source file without its extension. If multiple %{}
static SafeImplicitOutputsFunction function(String... templates) { return fromTemplates(Arrays.asList(templates)); } /** * The implicit output function that generates files based on a set of * template substitutions using rule attribute values. * * @param templates The templates used to construct the name of the implicit * output file target. The substring STR will be replaced by the * actual name of the rule, the substring STR will be replaced by the * name of each source file without its extension. If multiple %{}
/** * A convenience wrapper for {@link #fromTemplates(Iterable)}. */
A convenience wrapper for <code>#fromTemplates(Iterable)</code>
fromTemplates
{ "repo_name": "damienmg/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/ImplicitOutputsFunction.java", "license": "apache-2.0", "size": 17049 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
763,022
public Adapter createToolInfoAdapter() { return null; }
Adapter function() { return null; }
/** * Creates a new adapter for an object of class '{@link fr.lip6.move.pnml.pnmlcoremodel.ToolInfo <em>Tool Info</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see fr.lip6.move.pnml.pnmlcoremodel.ToolInfo * @generated */
Creates a new adapter for an object of class '<code>fr.lip6.move.pnml.pnmlcoremodel.ToolInfo Tool Info</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
createToolInfoAdapter
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-CoreModel/src/fr/lip6/move/pnml/pnmlcoremodel/util/PnmlcoremodelAdapterFactory.java", "license": "epl-1.0", "size": 22786 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,275,216
public Properties getCurrentProperties() throws Exception { try { setUpSocket(); writeCommandHeader(COMMAND_PROPERTIES); send(); byte[] val = readBytesReply("DRDA_PropertyError.S"); Properties p = new Properties(); try { ByteArrayInputStream bs = new ByteArrayInputStream(val); p.load(bs); } catch (IOException io) { consolePropertyMessage("DRDA_IOException.S", io.getMessage()); } return p; } finally { closeSocket(); } }
Properties function() throws Exception { try { setUpSocket(); writeCommandHeader(COMMAND_PROPERTIES); send(); byte[] val = readBytesReply(STR); Properties p = new Properties(); try { ByteArrayInputStream bs = new ByteArrayInputStream(val); p.load(bs); } catch (IOException io) { consolePropertyMessage(STR, io.getMessage()); } return p; } finally { closeSocket(); } }
/** * Get current properties * * @return Properties object containing properties * @exception Exception throws an exception if an error occurs */
Get current properties
getCurrentProperties
{ "repo_name": "gemxd/gemfirexd-oss", "path": "gemfirexd/core/src/drda/java/com/pivotal/gemfirexd/internal/impl/drda/NetworkServerControlImpl.java", "license": "apache-2.0", "size": 138102 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.util.Properties" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Properties;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
784,826
public Map<TypeWID,Double> getWorkerReliabilityMap() { assert hasWorkerReliabilityMap():"Worker Reliability Map not initiliazed"; return workerReliabilityMap;}
Map<TypeWID,Double> function() { assert hasWorkerReliabilityMap():STR; return workerReliabilityMap;}
/** * Get worker reliability * @return worker reliability as a Map from workers to doubles */
Get worker reliability
getWorkerReliabilityMap
{ "repo_name": "utir/square-2.0", "path": "SQUARE/src/main/java/org/square/qa/utilities/constructs/Models.java", "license": "mit", "size": 24464 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,549,856
protected void cleanup( TestParameters tParam, PrintWriter log ) { log.println( " disposing xDrawDoc " ); util.DesktopTools.closeDoc(xDrawDoc); }
void function( TestParameters tParam, PrintWriter log ) { log.println( STR ); util.DesktopTools.closeDoc(xDrawDoc); }
/** * in general this method disposes the testenvironment and document * * @param tParam class which contains additional test parameters * @param log class to log the test state and result * * * @see TestParameters * @see PrintWriter * */
in general this method disposes the testenvironment and document
cleanup
{ "repo_name": "qt-haiku/LibreOffice", "path": "qadevOOo/tests/java/mod/_svx/SvxShapeCollection.java", "license": "gpl-3.0", "size": 4614 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,447,110
public void setLoginTimeout(int seconds) throws SQLException { }
void function(int seconds) throws SQLException { }
/** * DOCUMENT ME! * * @param seconds * DOCUMENT ME! * * @throws SQLException * DOCUMENT ME! */
DOCUMENT ME
setLoginTimeout
{ "repo_name": "suthat/signal", "path": "vendor/mysql-connector-java-5.1.26/src/com/mysql/jdbc/jdbc2/optional/MysqlDataSource.java", "license": "apache-2.0", "size": 10364 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
880,485
StringBuffer buf = new StringBuffer(); buf.append("("); if (flags.contains(Flags.Flag.ANSWERED)) { buf.append("\\Answered "); } if (flags.contains(Flags.Flag.DELETED)) { buf.append("\\Deleted "); } if (flags.contains(Flags.Flag.DRAFT)) { buf.append("\\Draft "); } if (flags.contains(Flags.Flag.FLAGGED)) { buf.append("\\Flagged "); } if (flags.contains(Flags.Flag.RECENT)) { buf.append("\\Recent "); } if (flags.contains(Flags.Flag.SEEN)) { buf.append("\\Seen "); } // Remove the trailing space, if necessary. if (buf.length() > 1) { buf.setLength(buf.length() - 1); } buf.append(")"); return buf.toString(); }
StringBuffer buf = new StringBuffer(); buf.append("("); if (flags.contains(Flags.Flag.ANSWERED)) { buf.append(STR); } if (flags.contains(Flags.Flag.DELETED)) { buf.append(STR); } if (flags.contains(Flags.Flag.DRAFT)) { buf.append(STR); } if (flags.contains(Flags.Flag.FLAGGED)) { buf.append(STR); } if (flags.contains(Flags.Flag.RECENT)) { buf.append(STR); } if (flags.contains(Flags.Flag.SEEN)) { buf.append(STR); } if (buf.length() > 1) { buf.setLength(buf.length() - 1); } buf.append(")"); return buf.toString(); }
/** * Returns IMAP formatted String of MessageFlags for named user */
Returns IMAP formatted String of MessageFlags for named user
format
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/3rd-party/greenmail/source/java/com/icegreen/greenmail/store/MessageFlags.java", "license": "lgpl-3.0", "size": 2460 }
[ "javax.mail.Flags" ]
import javax.mail.Flags;
import javax.mail.*;
[ "javax.mail" ]
javax.mail;
1,535,378
public void addNewEQPreset(String presetName, int fiftyHertz, int oneThirtyHertz, int threeTwentyHertz, int eightHundredHertz, int twoKilohertz, int fiveKilohertz, int twelvePointFiveKilohertz, short virtualizer, short bassBoost, short reverb) { ContentValues values = new ContentValues(); values.put(PRESET_NAME, presetName); values.put(EQ_50_HZ, fiftyHertz); values.put(EQ_130_HZ, threeTwentyHertz); values.put(EQ_320_HZ, threeTwentyHertz); values.put(EQ_800_HZ, eightHundredHertz); values.put(EQ_2000_HZ, twoKilohertz); values.put(EQ_5000_HZ, fiveKilohertz); values.put(EQ_12500_HZ, twelvePointFiveKilohertz); values.put(VIRTUALIZER, virtualizer); values.put(BASS_BOOST, bassBoost); values.put(REVERB, reverb); getDatabase().insert(EQUALIZER_PRESETS_TABLE, null, values); }
void function(String presetName, int fiftyHertz, int oneThirtyHertz, int threeTwentyHertz, int eightHundredHertz, int twoKilohertz, int fiveKilohertz, int twelvePointFiveKilohertz, short virtualizer, short bassBoost, short reverb) { ContentValues values = new ContentValues(); values.put(PRESET_NAME, presetName); values.put(EQ_50_HZ, fiftyHertz); values.put(EQ_130_HZ, threeTwentyHertz); values.put(EQ_320_HZ, threeTwentyHertz); values.put(EQ_800_HZ, eightHundredHertz); values.put(EQ_2000_HZ, twoKilohertz); values.put(EQ_5000_HZ, fiveKilohertz); values.put(EQ_12500_HZ, twelvePointFiveKilohertz); values.put(VIRTUALIZER, virtualizer); values.put(BASS_BOOST, bassBoost); values.put(REVERB, reverb); getDatabase().insert(EQUALIZER_PRESETS_TABLE, null, values); }
/** * Adds a new EQ preset to the table. */
Adds a new EQ preset to the table
addNewEQPreset
{ "repo_name": "yongjiliu/MusicPlayer", "path": "ACEMusicPlayer/src/main/java/com/aniruddhc/acemusic/player/DBHelpers/DBAccessHelper.java", "license": "gpl-2.0", "size": 72380 }
[ "android.content.ContentValues" ]
import android.content.ContentValues;
import android.content.*;
[ "android.content" ]
android.content;
1,180,956
DatanodeCommand[] handleHeartbeat(DatanodeRegistration nodeReg, long capacity, long dfsUsed, long remaining, int xceiverCount, int xmitsInProgress) throws IOException { DatanodeCommand cmd = null; synchronized (heartbeats) { synchronized (datanodeMap) { DatanodeDescriptor nodeinfo = null; try { nodeinfo = getDatanode(nodeReg); } catch(UnregisteredDatanodeException e) { return new DatanodeCommand[]{DatanodeCommand.REGISTER}; } // Check if this datanode should actually be shutdown instead. if (nodeinfo != null && shouldNodeShutdown(nodeinfo)) { setDatanodeDead(nodeinfo); throw new DisallowedDatanodeException(nodeinfo); } if (nodeinfo == null || !nodeinfo.isAlive) { return new DatanodeCommand[]{DatanodeCommand.REGISTER}; } updateStats(nodeinfo, false); nodeinfo.updateHeartbeat(capacity, dfsUsed, remaining, xceiverCount); updateStats(nodeinfo, true); //check lease recovery cmd = nodeinfo.getLeaseRecoveryCommand(Integer.MAX_VALUE); if (cmd != null) { return new DatanodeCommand[] {cmd}; } ArrayList<DatanodeCommand> cmds = new ArrayList<DatanodeCommand>(); //check pending replication cmd = nodeinfo.getReplicationCommand( maxReplicationStreams - xmitsInProgress); if (cmd != null) { cmds.add(cmd); } //check block invalidation cmd = nodeinfo.getInvalidateBlocks(blockInvalidateLimit); if (cmd != null) { cmds.add(cmd); } // check access key update if (isAccessTokenEnabled && nodeinfo.needKeyUpdate) { cmds.add(new KeyUpdateCommand(accessTokenHandler.exportKeys())); nodeinfo.needKeyUpdate = false; } // check for balancer bandwidth update if (nodeinfo.getBalancerBandwidth() > 0) { cmds.add(new BalancerBandwidthCommand(nodeinfo.getBalancerBandwidth())); // set back to 0 to indicate that datanode has been sent the new value nodeinfo.setBalancerBandwidth(0); } if (!cmds.isEmpty()) { return cmds.toArray(new DatanodeCommand[cmds.size()]); } } } //check distributed upgrade cmd = getDistributedUpgradeCommand(); if (cmd != null) { return new DatanodeCommand[] {cmd}; } return null; }
DatanodeCommand[] handleHeartbeat(DatanodeRegistration nodeReg, long capacity, long dfsUsed, long remaining, int xceiverCount, int xmitsInProgress) throws IOException { DatanodeCommand cmd = null; synchronized (heartbeats) { synchronized (datanodeMap) { DatanodeDescriptor nodeinfo = null; try { nodeinfo = getDatanode(nodeReg); } catch(UnregisteredDatanodeException e) { return new DatanodeCommand[]{DatanodeCommand.REGISTER}; } if (nodeinfo != null && shouldNodeShutdown(nodeinfo)) { setDatanodeDead(nodeinfo); throw new DisallowedDatanodeException(nodeinfo); } if (nodeinfo == null !nodeinfo.isAlive) { return new DatanodeCommand[]{DatanodeCommand.REGISTER}; } updateStats(nodeinfo, false); nodeinfo.updateHeartbeat(capacity, dfsUsed, remaining, xceiverCount); updateStats(nodeinfo, true); cmd = nodeinfo.getLeaseRecoveryCommand(Integer.MAX_VALUE); if (cmd != null) { return new DatanodeCommand[] {cmd}; } ArrayList<DatanodeCommand> cmds = new ArrayList<DatanodeCommand>(); cmd = nodeinfo.getReplicationCommand( maxReplicationStreams - xmitsInProgress); if (cmd != null) { cmds.add(cmd); } cmd = nodeinfo.getInvalidateBlocks(blockInvalidateLimit); if (cmd != null) { cmds.add(cmd); } if (isAccessTokenEnabled && nodeinfo.needKeyUpdate) { cmds.add(new KeyUpdateCommand(accessTokenHandler.exportKeys())); nodeinfo.needKeyUpdate = false; } if (nodeinfo.getBalancerBandwidth() > 0) { cmds.add(new BalancerBandwidthCommand(nodeinfo.getBalancerBandwidth())); nodeinfo.setBalancerBandwidth(0); } if (!cmds.isEmpty()) { return cmds.toArray(new DatanodeCommand[cmds.size()]); } } } cmd = getDistributedUpgradeCommand(); if (cmd != null) { return new DatanodeCommand[] {cmd}; } return null; }
/** * The given node has reported in. This method should: * 1) Record the heartbeat, so the datanode isn't timed out * 2) Adjust usage stats for future block allocation * * If a substantial amount of time passed since the last datanode * heartbeat then request an immediate block report. * * @return an array of datanode commands * @throws IOException */
The given node has reported in. This method should: 1) Record the heartbeat, so the datanode isn't timed out 2) Adjust usage stats for future block allocation If a substantial amount of time passed since the last datanode heartbeat then request an immediate block report
handleHeartbeat
{ "repo_name": "andy8788/hadoop-hdfs", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 214042 }
[ "java.io.IOException", "java.util.ArrayList", "org.apache.hadoop.hdfs.protocol.UnregisteredDatanodeException", "org.apache.hadoop.hdfs.server.protocol.BalancerBandwidthCommand", "org.apache.hadoop.hdfs.server.protocol.DatanodeCommand", "org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration", "org.apache.hadoop.hdfs.server.protocol.DisallowedDatanodeException", "org.apache.hadoop.hdfs.server.protocol.KeyUpdateCommand" ]
import java.io.IOException; import java.util.ArrayList; import org.apache.hadoop.hdfs.protocol.UnregisteredDatanodeException; import org.apache.hadoop.hdfs.server.protocol.BalancerBandwidthCommand; import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; import org.apache.hadoop.hdfs.server.protocol.DisallowedDatanodeException; import org.apache.hadoop.hdfs.server.protocol.KeyUpdateCommand;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.protocol.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,530,282
public final OperationsClient getOperationsClient() { return operationsClient; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Certificates in a given project and location. * * <p>Sample code: * * <pre>{@code * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); * for (Certificate element : certificateManagerClient.listCertificates(parent).iterateAll()) { * // doThingsWith(element); * } * }
final OperationsClient function() { return operationsClient; } /** * Lists Certificates in a given project and location. * * <p>Sample code: * * <pre>{ * try (CertificateManagerClient certificateManagerClient = CertificateManagerClient.create()) { * LocationName parent = LocationName.of(STR, STR); * for (Certificate element : certificateManagerClient.listCertificates(parent).iterateAll()) { * * } * }
/** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call
getOperationsClient
{ "repo_name": "googleapis/java-certificate-manager", "path": "google-cloud-certificate-manager/src/main/java/com/google/cloud/certificatemanager/v1/CertificateManagerClient.java", "license": "apache-2.0", "size": 122857 }
[ "com.google.longrunning.OperationsClient" ]
import com.google.longrunning.OperationsClient;
import com.google.longrunning.*;
[ "com.google.longrunning" ]
com.google.longrunning;
221,386
@BeforeClass protected void createFilter() throws IOException { injector = ContextBuilder .newBuilder("azureblob") .endpoint("https://${jclouds.identity}.blob.core.windows.net") .credentials(ACCOUNT, "credential") .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())) .buildInjector(); filter = injector.getInstance(SharedKeyLiteAuthentication.class); }
void function() throws IOException { injector = ContextBuilder .newBuilder(STR) .endpoint(STRcredential") .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())) .buildInjector(); filter = injector.getInstance(SharedKeyLiteAuthentication.class); }
/** * before class, as we need to ensure that the filter is threadsafe. * * @throws IOException * */
before class, as we need to ensure that the filter is threadsafe
createFilter
{ "repo_name": "yanzhijun/jclouds-aliyun", "path": "providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java", "license": "apache-2.0", "size": 5613 }
[ "com.google.common.collect.ImmutableSet", "com.google.inject.Module", "java.io.IOException", "org.jclouds.ContextBuilder", "org.jclouds.logging.config.NullLoggingModule", "org.jclouds.rest.internal.BaseRestApiTest" ]
import com.google.common.collect.ImmutableSet; import com.google.inject.Module; import java.io.IOException; import org.jclouds.ContextBuilder; import org.jclouds.logging.config.NullLoggingModule; import org.jclouds.rest.internal.BaseRestApiTest;
import com.google.common.collect.*; import com.google.inject.*; import java.io.*; import org.jclouds.*; import org.jclouds.logging.config.*; import org.jclouds.rest.internal.*;
[ "com.google.common", "com.google.inject", "java.io", "org.jclouds", "org.jclouds.logging", "org.jclouds.rest" ]
com.google.common; com.google.inject; java.io; org.jclouds; org.jclouds.logging; org.jclouds.rest;
687,833
public void test_doAs_02() { Subject subj = new Subject(); PrivilegedExceptionAction<Object> pea = new myPrivilegedExceptionAction(); PrivilegedExceptionAction<Object> peaNull = null; try { Object obj = Subject.doAs(null, pea); } catch (Exception e) { fail("Unexpected exception: " + e); } try { Object obj = Subject.doAs(subj, pea); } catch (Exception e) { fail("Unexpected exception: " + e); } try { Object obj = Subject.doAs(subj, peaNull); fail("NullPointerException wasn't thrown"); } catch (NullPointerException npe) { } catch (Exception e) { fail(e + " was thrown instead of NullPointerException"); }
void function() { Subject subj = new Subject(); PrivilegedExceptionAction<Object> pea = new myPrivilegedExceptionAction(); PrivilegedExceptionAction<Object> peaNull = null; try { Object obj = Subject.doAs(null, pea); } catch (Exception e) { fail(STR + e); } try { Object obj = Subject.doAs(subj, pea); } catch (Exception e) { fail(STR + e); } try { Object obj = Subject.doAs(subj, peaNull); fail(STR); } catch (NullPointerException npe) { } catch (Exception e) { fail(e + STR); }
/** * javax.security.auth.Subject#doAs(Subject subject, PrivilegedExceptionAction action) */
javax.security.auth.Subject#doAs(Subject subject, PrivilegedExceptionAction action)
test_doAs_02
{ "repo_name": "mirego/j2objc", "path": "jre_emul/android/platform/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/auth/SubjectTest.java", "license": "apache-2.0", "size": 10808 }
[ "java.security.PrivilegedExceptionAction", "javax.security.auth.Subject" ]
import java.security.PrivilegedExceptionAction; import javax.security.auth.Subject;
import java.security.*; import javax.security.auth.*;
[ "java.security", "javax.security" ]
java.security; javax.security;
2,841,533
List<BusinessEventEntity> findBySupplierIdAndPendingIsTrueAndPaymentResponsibleAndStartTimeBetween(String supplierId, String paymentResponsible, Date startTime, Date endTime, Pageable pageable);
List<BusinessEventEntity> findBySupplierIdAndPendingIsTrueAndPaymentResponsibleAndStartTimeBetween(String supplierId, String paymentResponsible, Date startTime, Date endTime, Pageable pageable);
/** * Returns entities for a supplier and payment responsible, and where start time is within a period of time. * * @param supplierId the supplier id. * @param paymentResponsible the payment responsible. * @param startTime the period start time. * @param endTime the period end time. * @param pageable page info. * * @return the list of matching events, might be empty when none matches the criteria. */
Returns entities for a supplier and payment responsible, and where start time is within a period of time
findBySupplierIdAndPendingIsTrueAndPaymentResponsibleAndStartTimeBetween
{ "repo_name": "KentorJava/sll-invoice-data-tmp", "path": "invoice-data/invoice-data-core/src/main/java/se/sll/invoicedata/core/model/repository/BusinessEventRepository.java", "license": "lgpl-3.0", "size": 4667 }
[ "java.util.Date", "java.util.List", "org.springframework.data.domain.Pageable", "se.sll.invoicedata.core.model.entity.BusinessEventEntity" ]
import java.util.Date; import java.util.List; import org.springframework.data.domain.Pageable; import se.sll.invoicedata.core.model.entity.BusinessEventEntity;
import java.util.*; import org.springframework.data.domain.*; import se.sll.invoicedata.core.model.entity.*;
[ "java.util", "org.springframework.data", "se.sll.invoicedata" ]
java.util; org.springframework.data; se.sll.invoicedata;
1,186,984
public final Point getCentroid() { return this.centroid; }
final Point function() { return this.centroid; }
/** * Return the center of the polygon. * @return centroid The center of the polygon. */
Return the center of the polygon
getCentroid
{ "repo_name": "Nantes1900/Nantes-1900-PGROU-IHM", "path": "src/fr/nantes1900/view/display3d/PolygonView.java", "license": "gpl-3.0", "size": 4892 }
[ "fr.nantes1900.models.basis.Point" ]
import fr.nantes1900.models.basis.Point;
import fr.nantes1900.models.basis.*;
[ "fr.nantes1900.models" ]
fr.nantes1900.models;
115,535
public ColourNames getBorderLeftColor$() { return borderLeftColor$; }
public ColourNames getBorderLeftColor$() { return borderLeftColor$; }
/** * Gets the colour of the left border * * @return */
Gets the colour of the left border
getBorderLeftColor$
{ "repo_name": "GedMarc/JWebSwing", "path": "src/main/java/com/jwebmp/core/htmlbuilder/css/borders/BorderLeftCSSImpl.java", "license": "gpl-3.0", "size": 3852 }
[ "com.jwebmp.core.htmlbuilder.css.colours.ColourNames" ]
import com.jwebmp.core.htmlbuilder.css.colours.ColourNames;
import com.jwebmp.core.htmlbuilder.css.colours.*;
[ "com.jwebmp.core" ]
com.jwebmp.core;
2,547,964
protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
void function(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */
Set the range of pages from a Book to be printed. Both 'firstPage' and 'lastPage' are zero based page indices. If either parameter is less than zero then the page range is set to be from the first page to the last
setPageRange
{ "repo_name": "md-5/jdk10", "path": "src/java.desktop/share/classes/sun/print/RasterPrinterJob.java", "license": "gpl-2.0", "size": 98245 }
[ "java.awt.print.Pageable" ]
import java.awt.print.Pageable;
import java.awt.print.*;
[ "java.awt" ]
java.awt;
2,041,525
@Override protected void visitSoyNode(SoyNode node) { if (node instanceof ExprHolderNode) { for (ExprUnion exprUnion : ((ExprHolderNode) node).getAllExprUnions()) { if (exprUnion.getExpr() == null) { continue; } new CheckFunctionCallsExprVisitor().exec(exprUnion.getExpr()); } } if (node instanceof ParentSoyNode<?>) { visitChildren((ParentSoyNode<?>) node); } } private final class CheckFunctionCallsExprVisitor extends AbstractExprNodeVisitor<Void> {
@Override void function(SoyNode node) { if (node instanceof ExprHolderNode) { for (ExprUnion exprUnion : ((ExprHolderNode) node).getAllExprUnions()) { if (exprUnion.getExpr() == null) { continue; } new CheckFunctionCallsExprVisitor().exec(exprUnion.getExpr()); } } if (node instanceof ParentSoyNode<?>) { visitChildren((ParentSoyNode<?>) node); } } private final class CheckFunctionCallsExprVisitor extends AbstractExprNodeVisitor<Void> {
/** * Recursively identifies all Soy nodes that contain expressions, and recurse to * each expression. */
Recursively identifies all Soy nodes that contain expressions, and recurse to each expression
visitSoyNode
{ "repo_name": "SerkanSipahi/closure-templates", "path": "java/src/com/google/template/soy/parsepasses/CheckFunctionCallsVisitor.java", "license": "apache-2.0", "size": 7661 }
[ "com.google.template.soy.exprtree.AbstractExprNodeVisitor", "com.google.template.soy.soytree.ExprUnion", "com.google.template.soy.soytree.SoyNode" ]
import com.google.template.soy.exprtree.AbstractExprNodeVisitor; import com.google.template.soy.soytree.ExprUnion; import com.google.template.soy.soytree.SoyNode;
import com.google.template.soy.exprtree.*; import com.google.template.soy.soytree.*;
[ "com.google.template" ]
com.google.template;
1,706,760
private ReplicaInfo getReplicaInfo(String bpid, long blkid) throws ReplicaNotFoundException { ReplicaInfo info = volumeMap.get(bpid, blkid); if (info == null) { throw new ReplicaNotFoundException( ReplicaNotFoundException.NON_EXISTENT_REPLICA + bpid + ":" + blkid); } return info; }
ReplicaInfo function(String bpid, long blkid) throws ReplicaNotFoundException { ReplicaInfo info = volumeMap.get(bpid, blkid); if (info == null) { throw new ReplicaNotFoundException( ReplicaNotFoundException.NON_EXISTENT_REPLICA + bpid + ":" + blkid); } return info; }
/** * Get the meta info of a block stored in volumeMap. Block is looked up * without matching the generation stamp. * @param bpid block pool Id * @param blkid block Id * @return the meta replica information; null if block was not found * @throws ReplicaNotFoundException if no entry is in the map or * there is a generation stamp mismatch */
Get the meta info of a block stored in volumeMap. Block is looked up without matching the generation stamp
getReplicaInfo
{ "repo_name": "xuchenCN/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java", "license": "apache-2.0", "size": 100444 }
[ "org.apache.hadoop.hdfs.server.datanode.ReplicaInfo", "org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException" ]
import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo; import org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException;
import org.apache.hadoop.hdfs.server.datanode.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,790,099
public void clearPlayerData() { player.getInventory().clear(); player.getInventory().setArmorContents(null); player.setExp(0f); player.setLevel(0); double maxHealth; if (is1_9) { AttributeUtil.resetPlayerAttributes(player); maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); } else { maxHealth = player.getMaxHealth(); } player.setHealth(maxHealth); player.setFoodLevel(20); player.setExp(0f); player.setLevel(0); for (PotionEffect effect : player.getActivePotionEffects()) { player.removePotionEffect(effect.getType()); } if (is1_9) { player.setCollidable(true); player.setInvulnerable(false); } }
void function() { player.getInventory().clear(); player.getInventory().setArmorContents(null); player.setExp(0f); player.setLevel(0); double maxHealth; if (is1_9) { AttributeUtil.resetPlayerAttributes(player); maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue(); } else { maxHealth = player.getMaxHealth(); } player.setHealth(maxHealth); player.setFoodLevel(20); player.setExp(0f); player.setLevel(0); for (PotionEffect effect : player.getActivePotionEffects()) { player.removePotionEffect(effect.getType()); } if (is1_9) { player.setCollidable(true); player.setInvulnerable(false); } }
/** * Clear the player's inventory, potion effects etc. * <p> * Does NOT handle flight. */
Clear the player's inventory, potion effects etc. Does NOT handle flight
clearPlayerData
{ "repo_name": "DRE2N/DungeonsXL", "path": "core/src/main/java/de/erethon/dungeonsxl/player/DInstancePlayer.java", "license": "gpl-3.0", "size": 4329 }
[ "de.erethon.dungeonsxl.util.AttributeUtil", "org.bukkit.attribute.Attribute", "org.bukkit.potion.PotionEffect" ]
import de.erethon.dungeonsxl.util.AttributeUtil; import org.bukkit.attribute.Attribute; import org.bukkit.potion.PotionEffect;
import de.erethon.dungeonsxl.util.*; import org.bukkit.attribute.*; import org.bukkit.potion.*;
[ "de.erethon.dungeonsxl", "org.bukkit.attribute", "org.bukkit.potion" ]
de.erethon.dungeonsxl; org.bukkit.attribute; org.bukkit.potion;
1,162,476
public void setDefaultAction(Action a);
void function(Action a);
/** * Set the default action to fire if a key is typed. * * @param a the action */
Set the default action to fire if a key is typed
setDefaultAction
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/javax/swing/text/Keymap.java", "license": "gpl-2.0", "size": 4289 }
[ "javax.swing.Action" ]
import javax.swing.Action;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,264,301
@CalledByNative private void requestRemotePlayback() { if (mDebug) Log.i(TAG, "requestRemotePlayback"); if (mRouteController == null) return; // Clear out the state mPauseRequested = false; mSeekRequested = false; RemoteMediaPlayerController.instance().requestRemotePlayback( mMediaStateListener, mRouteController); }
void function() { if (mDebug) Log.i(TAG, STR); if (mRouteController == null) return; mPauseRequested = false; mSeekRequested = false; RemoteMediaPlayerController.instance().requestRemotePlayback( mMediaStateListener, mRouteController); }
/** * Called when a lower layer requests that a video be cast. This will typically be a request * from Blink when the cast button is pressed on the default video controls. */
Called when a lower layer requests that a video be cast. This will typically be a request from Blink when the cast button is pressed on the default video controls
requestRemotePlayback
{ "repo_name": "Bysmyyr/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/media/remote/RemoteMediaPlayerBridge.java", "license": "bsd-3-clause", "size": 13522 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,893,373
@Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "BaSys-PC1/models", "path": "de.dfki.iui.basys.model.domain.edit/src/de/dfki/iui/basys/model/domain/resourcetype/provider/RobotItemProvider.java", "license": "epl-1.0", "size": 2628 }
[ "org.eclipse.emf.common.notify.Notification" ]
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,528,879
private static Map<String, OptionDetails> computeOptionsMap(BuildOptions buildOptions, Iterable<Fragment> fragments) { // Collect from our fragments "alternative defaults" for options where the default // should be something other than what's specified in Option.defaultValue. Map<String, Object> lateBoundDefaults = Maps.newHashMap(); for (Fragment fragment : fragments) { lateBoundDefaults.putAll(fragment.lateBoundOptionDefaults()); } ImmutableMap.Builder<String, OptionDetails> map = ImmutableMap.builder(); try { for (FragmentOptions options : buildOptions.getOptions()) { for (Field field : options.getClass().getFields()) { if (field.isAnnotationPresent(Option.class)) { Option option = field.getAnnotation(Option.class); Object value = field.get(options); if (value == null) { if (lateBoundDefaults.containsKey(option.name())) { value = lateBoundDefaults.get(option.name()); } else if (!option.defaultValue().equals("null")) { // See {@link Option#defaultValue} for an explanation of default "null" strings. value = option.defaultValue(); } } map.put(option.name(), new OptionDetails(options.getClass(), value, option.allowMultiple())); } } } } catch (IllegalAccessException e) { throw new IllegalStateException( "Unexpected illegal access trying to create this configuration's options map: ", e); } return map.build(); }
static Map<String, OptionDetails> function(BuildOptions buildOptions, Iterable<Fragment> fragments) { Map<String, Object> lateBoundDefaults = Maps.newHashMap(); for (Fragment fragment : fragments) { lateBoundDefaults.putAll(fragment.lateBoundOptionDefaults()); } ImmutableMap.Builder<String, OptionDetails> map = ImmutableMap.builder(); try { for (FragmentOptions options : buildOptions.getOptions()) { for (Field field : options.getClass().getFields()) { if (field.isAnnotationPresent(Option.class)) { Option option = field.getAnnotation(Option.class); Object value = field.get(options); if (value == null) { if (lateBoundDefaults.containsKey(option.name())) { value = lateBoundDefaults.get(option.name()); } else if (!option.defaultValue().equals("null")) { value = option.defaultValue(); } } map.put(option.name(), new OptionDetails(options.getClass(), value, option.allowMultiple())); } } } } catch (IllegalAccessException e) { throw new IllegalStateException( STR, e); } return map.build(); }
/** * Computes and returns the transitive optionName -> "option info" map for * this configuration. */
Computes and returns the transitive optionName -> "option info" map for this configuration
computeOptionsMap
{ "repo_name": "bitemyapp/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java", "license": "apache-2.0", "size": 73993 }
[ "com.google.common.collect.ImmutableMap", "com.google.common.collect.Maps", "com.google.devtools.common.options.Option", "java.lang.reflect.Field", "java.util.Map" ]
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.devtools.common.options.Option; import java.lang.reflect.Field; import java.util.Map;
import com.google.common.collect.*; import com.google.devtools.common.options.*; import java.lang.reflect.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.lang", "java.util" ]
com.google.common; com.google.devtools; java.lang; java.util;
1,908,722
@Override public void loadConfig() { try { properties.setProperty("description", ""); properties.setProperty("title", ""); properties.setProperty("persistent", "false"); properties.setProperty("defaultmodel", "model.jam"); properties.setProperty("INPUT_DIR_NAME", INPUT_DIR_NAME); properties.setProperty("OUTPUT_DIR_NAME", OUTPUT_DIR_NAME); properties.setProperty("TEMP_DIR_NAME", TEMP_DIR_NAME); properties.setProperty("LOCAL_INDIR_NAME", LOCAL_INDIR_NAME); properties.setProperty("DUMP_DIR_NAME", DUMP_DIR_NAME); properties.setProperty("EXPLORER_DIR_NAME", EXPLORER_DIR_NAME); File file = new File(directory, CONFIG_FILE_NAME); if (file.exists()) { BufferedInputStream is = new BufferedInputStream(new FileInputStream(file)); properties.load(is); is.close(); } else { BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file)); properties.store(os, CONFIG_FILE_COMMENT); os.close(); } if (properties.containsKey("readonly")){ this.readonly = Boolean.parseBoolean(properties.getProperty("readonly")); } } catch (IOException ioe) { runtime.handle(ioe); } }
void function() { try { properties.setProperty(STR, STRtitle", STRpersistentSTRfalseSTRdefaultmodelSTRmodel.jamSTRINPUT_DIR_NAMESTROUTPUT_DIR_NAMESTRTEMP_DIR_NAMESTRLOCAL_INDIR_NAMESTRDUMP_DIR_NAMESTREXPLORER_DIR_NAMESTRreadonlySTRreadonly")); } } catch (IOException ioe) { runtime.handle(ioe); } }
/** * Loads the workspace config from the config file in the root of the * workspace directory */
Loads the workspace config from the config file in the root of the workspace directory
loadConfig
{ "repo_name": "kralisch/jams", "path": "JAMSmain/src/jams/workspace/JAMSWorkspace.java", "license": "lgpl-3.0", "size": 34353 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,024,041
public void scale(double scaleFactor) { checkArgument(scaleFactor > 0, "scale factor must be > 0"); // Compress the scaled digest. compress(); // Scale all the counts. for (int i = 0; i < weight.length; i++) { weight[i] *= scaleFactor; } totalWeight *= scaleFactor; }
void function(double scaleFactor) { checkArgument(scaleFactor > 0, STR); compress(); for (int i = 0; i < weight.length; i++) { weight[i] *= scaleFactor; } totalWeight *= scaleFactor; }
/** * Scale all the counts by the given scale factor. */
Scale all the counts by the given scale factor
scale
{ "repo_name": "zzhao0/presto", "path": "presto-main/src/main/java/com/facebook/presto/tdigest/TDigest.java", "license": "apache-2.0", "size": 26231 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,414,900
public void lDelete(int itemNum, Item deleteditem) { // if the previous item has new line after, or the next item has // new line before, and it's not the last item, // than we could just mark the next item as actualBoundsInvalid[Y] if (itemNum < (numOfLFs-1)) { if (((itemNum > 0) && (itemLFs[itemNum-1].equateNLA()) || itemLFs[itemNum+1].equateNLB()) && itemLFs[itemNum+1].isNewLine) { if (Logging.REPORT_LEVEL <= Logging.INFORMATION) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, " setting actualBoundsInvalid[Y] #" + (itemNum + 1)); if (itemNum > 0) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, " | itemLFs[itemNum-1] = "+ itemLFs[itemNum - 1]); } Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, " | itemLFs[itemNum] = " + itemLFs[itemNum]); if (itemNum < numOfLFs - 1) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, " | itemLFs[itemNum+1] = " + itemLFs[itemNum+1]); } } itemLFs[itemNum+1].actualBoundsInvalid[Y] = true; } else { itemLFs[itemNum+1].actualBoundsInvalid[X] = true; } } if (traverseIndex == itemNum) { lastTraverseItem = itemLFs[traverseIndex]; } if (traverseIndex >= 0 && traverseIndex >= itemNum) { traverseIndex--; } numOfLFs--; itemsModified = true; if (itemNum < numOfLFs) { System.arraycopy(itemLFs, itemNum + 1, itemLFs, itemNum, numOfLFs - itemNum); } // Delete reference to the last item view // that was left after array copy itemLFs[numOfLFs] = null; if (pendingCurrentItem == deleteditem) { pendingCurrentItem = null; } lRequestInvalidate(); }
void function(int itemNum, Item deleteditem) { if (itemNum < (numOfLFs-1)) { if (((itemNum > 0) && (itemLFs[itemNum-1].equateNLA()) itemLFs[itemNum+1].equateNLB()) && itemLFs[itemNum+1].isNewLine) { if (Logging.REPORT_LEVEL <= Logging.INFORMATION) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, STR + (itemNum + 1)); if (itemNum > 0) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, STR+ itemLFs[itemNum - 1]); } Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, STR + itemLFs[itemNum]); if (itemNum < numOfLFs - 1) { Logging.report(Logging.INFORMATION, LogChannels.LC_HIGHUI_FORM_LAYOUT, STR + itemLFs[itemNum+1]); } } itemLFs[itemNum+1].actualBoundsInvalid[Y] = true; } else { itemLFs[itemNum+1].actualBoundsInvalid[X] = true; } } if (traverseIndex == itemNum) { lastTraverseItem = itemLFs[traverseIndex]; } if (traverseIndex >= 0 && traverseIndex >= itemNum) { traverseIndex--; } numOfLFs--; itemsModified = true; if (itemNum < numOfLFs) { System.arraycopy(itemLFs, itemNum + 1, itemLFs, itemNum, numOfLFs - itemNum); } itemLFs[numOfLFs] = null; if (pendingCurrentItem == deleteditem) { pendingCurrentItem = null; } lRequestInvalidate(); }
/** * Notifies look&amp;feel object of an item deleted in the corresponding * <code>Form</code>. * * @param itemNum the index of the deleted item * @param deleteditem the item deleted in the corresponding form */
Notifies look&amp;feel object of an item deleted in the corresponding <code>Form</code>
lDelete
{ "repo_name": "tommythorn/yari", "path": "shared/cacao-related/phoneme_feature/midp/src/highlevelui/lcdlf/lfplatform/classes/javax/microedition/lcdui/FormLFImpl.java", "license": "gpl-2.0", "size": 84531 }
[ "com.sun.midp.log.LogChannels", "com.sun.midp.log.Logging" ]
import com.sun.midp.log.LogChannels; import com.sun.midp.log.Logging;
import com.sun.midp.log.*;
[ "com.sun.midp" ]
com.sun.midp;
612,970
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { currentContext = callbackContext; try { if (action.equals("switchToSettings")){ switchToAppSettings(); callbackContext.success(); } else if (action.equals("switchToLocationSettings")){ switchToLocationSettings(); callbackContext.success(); } else if (action.equals("switchToMobileDataSettings")){ switchToMobileDataSettings(); callbackContext.success(); } else if (action.equals("switchToBluetoothSettings")){ switchToBluetoothSettings(); callbackContext.success(); } else if (action.equals("switchToWifiSettings")){ switchToWifiSettings(); callbackContext.success(); } else if(action.equals("isLocationAvailable")) { callbackContext.success(isGpsLocationAvailable() || isNetworkLocationAvailable() ? 1 : 0); } else if(action.equals("isLocationEnabled")) { callbackContext.success(isGpsLocationEnabled() || isNetworkLocationEnabled() ? 1 : 0); } else if(action.equals("isGpsLocationAvailable")) { callbackContext.success(isGpsLocationAvailable() ? 1 : 0); } else if(action.equals("isNetworkLocationAvailable")) { callbackContext.success(isNetworkLocationAvailable() ? 1 : 0); } else if(action.equals("isGpsLocationEnabled")) { callbackContext.success(isGpsLocationEnabled() ? 1 : 0); } else if(action.equals("isNetworkLocationEnabled")) { callbackContext.success(isNetworkLocationEnabled() ? 1 : 0); } else if(action.equals("getLocationMode")) { callbackContext.success(getLocationModeName()); } else if(action.equals("isWifiAvailable")) { callbackContext.success(isWifiAvailable() ? 1 : 0); } else if(action.equals("isCameraPresent")) { callbackContext.success(isCameraPresent() ? 1 : 0); } else if(action.equals("isBluetoothAvailable")) { callbackContext.success(isBluetoothAvailable() ? 1 : 0); }else if(action.equals("isBluetoothEnabled")) { callbackContext.success(isBluetoothEnabled() ? 1 : 0); } else if(action.equals("hasBluetoothSupport")) { callbackContext.success(hasBluetoothSupport() ? 1 : 0); } else if(action.equals("hasBluetoothLESupport")) { callbackContext.success(hasBluetoothLESupport() ? 1 : 0); } else if(action.equals("hasBluetoothLEPeripheralSupport")) { callbackContext.success(hasBluetoothLEPeripheralSupport() ? 1 : 0); } else if(action.equals("setWifiState")) { setWifiState(args.getBoolean(0)); callbackContext.success(); } else if(action.equals("setBluetoothState")) { setBluetoothState(args.getBoolean(0)); callbackContext.success(); } else if(action.equals("getBluetoothState")) { callbackContext.success(getBluetoothState()); } else if(action.equals("initializeBluetoothListener")) { initializeBluetoothListener(); callbackContext.success(); } else if(action.equals("getPermissionAuthorizationStatus")) { this.getPermissionAuthorizationStatus(args); } else if(action.equals("getPermissionsAuthorizationStatus")) { this.getPermissionsAuthorizationStatus(args); } else if(action.equals("requestRuntimePermission")) { this.requestRuntimePermission(args); } else if(action.equals("requestRuntimePermissions")) { this.requestRuntimePermissions(args); }else { handleError("Invalid action"); return false; } }catch(Exception e ) { handleError("Exception occurred: ".concat(e.getMessage())); return false; } return true; }
boolean function(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { currentContext = callbackContext; try { if (action.equals(STR)){ switchToAppSettings(); callbackContext.success(); } else if (action.equals(STR)){ switchToLocationSettings(); callbackContext.success(); } else if (action.equals(STR)){ switchToMobileDataSettings(); callbackContext.success(); } else if (action.equals(STR)){ switchToBluetoothSettings(); callbackContext.success(); } else if (action.equals(STR)){ switchToWifiSettings(); callbackContext.success(); } else if(action.equals(STR)) { callbackContext.success(isGpsLocationAvailable() isNetworkLocationAvailable() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isGpsLocationEnabled() isNetworkLocationEnabled() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isGpsLocationAvailable() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isNetworkLocationAvailable() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isGpsLocationEnabled() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isNetworkLocationEnabled() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(getLocationModeName()); } else if(action.equals(STR)) { callbackContext.success(isWifiAvailable() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isCameraPresent() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(isBluetoothAvailable() ? 1 : 0); }else if(action.equals(STR)) { callbackContext.success(isBluetoothEnabled() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(hasBluetoothSupport() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(hasBluetoothLESupport() ? 1 : 0); } else if(action.equals(STR)) { callbackContext.success(hasBluetoothLEPeripheralSupport() ? 1 : 0); } else if(action.equals(STR)) { setWifiState(args.getBoolean(0)); callbackContext.success(); } else if(action.equals(STR)) { setBluetoothState(args.getBoolean(0)); callbackContext.success(); } else if(action.equals(STR)) { callbackContext.success(getBluetoothState()); } else if(action.equals(STR)) { initializeBluetoothListener(); callbackContext.success(); } else if(action.equals(STR)) { this.getPermissionAuthorizationStatus(args); } else if(action.equals(STR)) { this.getPermissionsAuthorizationStatus(args); } else if(action.equals(STR)) { this.requestRuntimePermission(args); } else if(action.equals(STR)) { this.requestRuntimePermissions(args); }else { handleError(STR); return false; } }catch(Exception e ) { handleError(STR.concat(e.getMessage())); return false; } return true; }
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackContext The callback id used when calling back into JavaScript. * @return True if the action was valid, false if not. */
Executes the request and returns PluginResult
execute
{ "repo_name": "OZhurbenko/ESIT-web", "path": "ios/plugins/cordova.plugins.diagnostic/src/android/Diagnostic.java", "license": "mit", "size": 36654 }
[ "org.apache.cordova.CallbackContext", "org.json.JSONArray", "org.json.JSONException" ]
import org.apache.cordova.CallbackContext; import org.json.JSONArray; import org.json.JSONException;
import org.apache.cordova.*; import org.json.*;
[ "org.apache.cordova", "org.json" ]
org.apache.cordova; org.json;
2,544,689
public LabelBuilder setShadowOffsetY(int shadowOffsetY) { IsBuilder.checkIfValid(getOptionsBuilder()); label.setShadowOffsetY(shadowOffsetY); return this; }
LabelBuilder function(int shadowOffsetY) { IsBuilder.checkIfValid(getOptionsBuilder()); label.setShadowOffsetY(shadowOffsetY); return this; }
/** * Sets the text shadow Y offset. * * @param shadowOffsetY the text shadow Y offset. * @return builder instance */
Sets the text shadow Y offset
setShadowOffsetY
{ "repo_name": "pepstock-org/Charba", "path": "src/org/pepstock/charba/client/labels/LabelBuilder.java", "license": "apache-2.0", "size": 9629 }
[ "org.pepstock.charba.client.commons.IsBuilder" ]
import org.pepstock.charba.client.commons.IsBuilder;
import org.pepstock.charba.client.commons.*;
[ "org.pepstock.charba" ]
org.pepstock.charba;
2,221,709
@Pure public XBlockExpression getXBlockExpression() { return this.builder.getXBlockExpression(); }
XBlockExpression function() { return this.builder.getXBlockExpression(); }
/** An empty block expression. * @return the block expression. */
An empty block expression
getXBlockExpression
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/BlockExpressionSourceAppender.java", "license": "apache-2.0", "size": 5235 }
[ "org.eclipse.xtext.xbase.XBlockExpression" ]
import org.eclipse.xtext.xbase.XBlockExpression;
import org.eclipse.xtext.xbase.*;
[ "org.eclipse.xtext" ]
org.eclipse.xtext;
1,198,356
public ClassInfoList getClassesWithMethodParameterAnnotation() { // Get all classes that have a method annotated or meta-annotated with this annotation final Set<ClassInfo> classesWithMethodParameterAnnotation = new HashSet<>( getClassesWithFieldOrMethodAnnotation(RelType.CLASSES_WITH_METHOD_PARAMETER_ANNOTATION)); // Add subclasses of all classes with a method that is non-privately annotated or meta-annotated with // this annotation (non-private methods are inherited) for (final ClassInfo classWithNonprivateMethodParameterAnnotationOrMetaAnnotation : // getClassesWithFieldOrMethodAnnotation(RelType.CLASSES_WITH_NONPRIVATE_METHOD_PARAMETER_ANNOTATION)) { classesWithMethodParameterAnnotation .addAll(classWithNonprivateMethodParameterAnnotationOrMetaAnnotation.getSubclasses()); } return new ClassInfoList(classesWithMethodParameterAnnotation, new HashSet<>(getClassesWithMethodParameterAnnotationDirectOnly()), true); }
ClassInfoList function() { final Set<ClassInfo> classesWithMethodParameterAnnotation = new HashSet<>( getClassesWithFieldOrMethodAnnotation(RelType.CLASSES_WITH_METHOD_PARAMETER_ANNOTATION)); for (final ClassInfo classWithNonprivateMethodParameterAnnotationOrMetaAnnotation : classesWithMethodParameterAnnotation .addAll(classWithNonprivateMethodParameterAnnotationOrMetaAnnotation.getSubclasses()); } return new ClassInfoList(classesWithMethodParameterAnnotation, new HashSet<>(getClassesWithMethodParameterAnnotationDirectOnly()), true); }
/** * Get all classes that have this class as a method parameter annotation, and their subclasses, if the method is * non-private. * * @return A list of classes that have a declared method with a parameter that is annotated with this annotation * or meta-annotation, or the empty list if none. */
Get all classes that have this class as a method parameter annotation, and their subclasses, if the method is non-private
getClassesWithMethodParameterAnnotation
{ "repo_name": "classgraph/classgraph", "path": "src/main/java/io/github/classgraph/ClassInfo.java", "license": "mit", "size": 140633 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,885,132
public StorageDomainStaticDAO getStorageDomainStaticDao() { return getDao(StorageDomainStaticDAO.class); }
StorageDomainStaticDAO function() { return getDao(StorageDomainStaticDAO.class); }
/** * Returns the singleton instance of {@link StorageDomainDAO}. * * @return the dao */
Returns the singleton instance of <code>StorageDomainDAO</code>
getStorageDomainStaticDao
{ "repo_name": "halober/ovirt-engine", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java", "license": "apache-2.0", "size": 34736 }
[ "org.ovirt.engine.core.dao.StorageDomainStaticDAO" ]
import org.ovirt.engine.core.dao.StorageDomainStaticDAO;
import org.ovirt.engine.core.dao.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
2,509,162
public synchronized Timestamp getTimestamp( int parameterIndex) throws SQLException { TimestampData t = (TimestampData) getColumnInType(parameterIndex, Type.SQL_TIMESTAMP); if (t == null) { return null; } return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t); } //---------------------------------------------------------------------- // Advanced features:
synchronized Timestamp function( int parameterIndex) throws SQLException { TimestampData t = (TimestampData) getColumnInType(parameterIndex, Type.SQL_TIMESTAMP); if (t == null) { return null; } return (Timestamp) Type.SQL_TIMESTAMP.convertSQLToJava(session, t); }
/** * <!-- start generic documentation --> * * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> * parameter as a <code>java.sql.Timestamp</code> object. <p> * * <!-- end generic documentation --> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB supports this feature. <p> * * </div> * <!-- end release-specific documentation --> * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL <code>NULL</code>, the result * is <code>null</code>. * @exception SQLException if a database access error occurs or * this method is called on a closed <code>CallableStatement</code> * @see #setTimestamp */
Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a <code>java.sql.Timestamp</code> object. HSQLDB-Specific Information: HSQLDB supports this feature.
getTimestamp
{ "repo_name": "ifcharming/voltdb2.0", "path": "src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java", "license": "gpl-3.0", "size": 185755 }
[ "java.sql.SQLException", "java.sql.Timestamp", "org.hsqldb_voltpatches.types.TimestampData", "org.hsqldb_voltpatches.types.Type" ]
import java.sql.SQLException; import java.sql.Timestamp; import org.hsqldb_voltpatches.types.TimestampData; import org.hsqldb_voltpatches.types.Type;
import java.sql.*; import org.hsqldb_voltpatches.types.*;
[ "java.sql", "org.hsqldb_voltpatches.types" ]
java.sql; org.hsqldb_voltpatches.types;
2,458,740
public DatasetGraph set(DatasetGraph dsg) { return dsgx.getAndSet(dsg); }
DatasetGraph function(DatasetGraph dsg) { return dsgx.getAndSet(dsg); }
/** Set the base {@link DatasetGraph}. * Returns the old value. */
Set the base <code>DatasetGraph</code>. Returns the old value
set
{ "repo_name": "apache/jena", "path": "jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/store/DatasetGraphSwitchable.java", "license": "apache-2.0", "size": 4400 }
[ "org.apache.jena.sparql.core.DatasetGraph" ]
import org.apache.jena.sparql.core.DatasetGraph;
import org.apache.jena.sparql.core.*;
[ "org.apache.jena" ]
org.apache.jena;
1,482,585
public void setMatchHighlighter(AbstractHighlighter hl) { removeHighlighter(matchHighlighter); matchHighlighter = hl; if (markByHighlighter()) { moveMatchMarker(); } }
void function(AbstractHighlighter hl) { removeHighlighter(matchHighlighter); matchHighlighter = hl; if (markByHighlighter()) { moveMatchMarker(); } }
/** * Sets the AbstractHighlighter to use as match marker, if enabled. A null value * will re-install the default. * * @param hl the Highlighter to use as match marker. */
Sets the AbstractHighlighter to use as match marker, if enabled. A null value will re-install the default
setMatchHighlighter
{ "repo_name": "trejkaz/swingx", "path": "swingx-core/src/main/java/org/jdesktop/swingx/search/AbstractSearchable.java", "license": "lgpl-2.1", "size": 23818 }
[ "org.jdesktop.swingx.decorator.AbstractHighlighter" ]
import org.jdesktop.swingx.decorator.AbstractHighlighter;
import org.jdesktop.swingx.decorator.*;
[ "org.jdesktop.swingx" ]
org.jdesktop.swingx;
1,966,983
private void endSceneDescription() { switch (outputFormat) { case X3D: endX3dDescription(false); break; case X3DOM: endX3dDescription(true); break; case VRML: endVrmlDescription(); break; case KML: endKmlDescription(); break; default: throw new T3dException("The output format '" + outputFormat.toString() + "' is not yet supported! Please consider to use format 'X3D' instead."); } }
void function() { switch (outputFormat) { case X3D: endX3dDescription(false); break; case X3DOM: endX3dDescription(true); break; case VRML: endVrmlDescription(); break; case KML: endKmlDescription(); break; default: throw new T3dException(STR + outputFormat.toString() + STR); } }
/** * Used to end a concrete scene-description (e.g. an X3D- or X3DOM-file). */
Used to end a concrete scene-description (e.g. an X3D- or X3DOM-file)
endSceneDescription
{ "repo_name": "cDanowski/worldviz", "path": "src/main/java/org/n52/v3d/worldviz/worldscene/VsAbstractWorldScene.java", "license": "gpl-2.0", "size": 10980 }
[ "org.n52.v3d.triturus.core.T3dException" ]
import org.n52.v3d.triturus.core.T3dException;
import org.n52.v3d.triturus.core.*;
[ "org.n52.v3d" ]
org.n52.v3d;
1,074,155
@Override public void gotDeSelected() { joystick_.unsetJoystick(Joystick.Keys.JOYSTICK, (JSAxisData) joystickBox_.getSelectedItem()); joystick_.unsetJoystick(Joystick.Keys.RIGHT_WHEEL, (JSAxisData) rightWheelBox_.getSelectedItem()); joystick_.unsetJoystick(Joystick.Keys.LEFT_WHEEL, (JSAxisData) leftWheelBox_.getSelectedItem()); }
void function() { joystick_.unsetJoystick(Joystick.Keys.JOYSTICK, (JSAxisData) joystickBox_.getSelectedItem()); joystick_.unsetJoystick(Joystick.Keys.RIGHT_WHEEL, (JSAxisData) rightWheelBox_.getSelectedItem()); joystick_.unsetJoystick(Joystick.Keys.LEFT_WHEEL, (JSAxisData) leftWheelBox_.getSelectedItem()); }
/** * Should be called when enclosing panel loses focus. */
Should be called when enclosing panel loses focus
gotDeSelected
{ "repo_name": "kmdouglass/Micro-Manager", "path": "plugins/ASIdiSPIM/src/org/micromanager/asidispim/JoystickSubPanel.java", "license": "mit", "size": 10341 }
[ "org.micromanager.asidispim.Data" ]
import org.micromanager.asidispim.Data;
import org.micromanager.asidispim.*;
[ "org.micromanager.asidispim" ]
org.micromanager.asidispim;
1,006,423
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String accountName, String assetName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, assetName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String accountName, String assetName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, assetName), serviceCallback); }
/** * Delete an Asset. * Deletes an Asset in the Media Services account. * * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param assetName The Asset name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Delete an Asset. Deletes an Asset in the Media Services account
deleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/mediaservices/mgmt-v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/AssetsInner.java", "license": "mit", "size": 64209 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
171,378
JPopupMenu createBugPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); JMenuItem filterMenuItem = MainFrameHelper.newJMenuItem("menu.filterBugsLikeThis", "Filter bugs like this"); filterMenuItem.addActionListener(evt -> { new NewFilterFromBug(new FilterFromBugPicker(currentSelectedBugLeaf.getBug(), Arrays.asList(mainFrame.getAvailableSortables())), new ApplyNewFilter(mainFrame.getProject().getSuppressionFilter(), PreferencesFrame.getInstance(), new FilterActivityNotifier())); mainFrame.setProjectChanged(true); mainFrame.getTree().setSelectionRow(0); // Selects the top of the Jtree so the CommentsArea syncs up. }); popupMenu.add(filterMenuItem); return popupMenu; }
JPopupMenu createBugPopupMenu() { JPopupMenu popupMenu = new JPopupMenu(); JMenuItem filterMenuItem = MainFrameHelper.newJMenuItem(STR, STR); filterMenuItem.addActionListener(evt -> { new NewFilterFromBug(new FilterFromBugPicker(currentSelectedBugLeaf.getBug(), Arrays.asList(mainFrame.getAvailableSortables())), new ApplyNewFilter(mainFrame.getProject().getSuppressionFilter(), PreferencesFrame.getInstance(), new FilterActivityNotifier())); mainFrame.setProjectChanged(true); mainFrame.getTree().setSelectionRow(0); }); popupMenu.add(filterMenuItem); return popupMenu; }
/** * Creates popup menu for bugs on tree. */
Creates popup menu for bugs on tree
createBugPopupMenu
{ "repo_name": "sewe/spotbugs", "path": "spotbugs/src/gui/edu/umd/cs/findbugs/gui2/MainFrameTree.java", "license": "lgpl-2.1", "size": 23104 }
[ "edu.umd.cs.findbugs.gui2.FilterActivity", "java.util.Arrays", "javax.swing.JMenuItem", "javax.swing.JPopupMenu" ]
import edu.umd.cs.findbugs.gui2.FilterActivity; import java.util.Arrays; import javax.swing.JMenuItem; import javax.swing.JPopupMenu;
import edu.umd.cs.findbugs.gui2.*; import java.util.*; import javax.swing.*;
[ "edu.umd.cs", "java.util", "javax.swing" ]
edu.umd.cs; java.util; javax.swing;
2,155,361
void receivedReply(ValidateMemoryReply reply);
void receivedReply(ValidateMemoryReply reply);
/** * Invoked after a Validate Memory reply was received from the debug client. * * @param reply The received reply. */
Invoked after a Validate Memory reply was received from the debug client
receivedReply
{ "repo_name": "google/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/debug/debugger/interfaces/IDebugEventListener.java", "license": "apache-2.0", "size": 13661 }
[ "com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply" ]
import com.google.security.zynamics.binnavi.debug.connection.packets.replies.ValidateMemoryReply;
import com.google.security.zynamics.binnavi.debug.connection.packets.replies.*;
[ "com.google.security" ]
com.google.security;
1,628,009
private long runLoop(ExtendedBlock suspectBlock) { long bytesScanned = -1; boolean scanError = false; ExtendedBlock block = null; try { long monotonicMs = Time.monotonicNow(); expireOldScannedBytesRecords(monotonicMs); if (!calculateShouldScan(volume.getStorageID(), conf.targetBytesPerSec, scannedBytesSum, startMinute, curMinute)) { // If neededBytesPerSec is too low, then wait few seconds for some old // scannedBytes records to expire. return 30000L; } // Find a usable block pool to scan. if (suspectBlock != null) { block = suspectBlock; } else { if ((curBlockIter == null) || curBlockIter.atEnd()) { long timeout = findNextUsableBlockIter(); if (timeout > 0) { LOG.trace("{}: no block pools are ready to scan yet. Waiting " + "{} ms.", this, timeout); synchronized (stats) { stats.nextBlockPoolScanStartMs = Time.monotonicNow() + timeout; } return timeout; } synchronized (stats) { stats.scansSinceRestart++; stats.blocksScannedInCurrentPeriod = 0; stats.nextBlockPoolScanStartMs = -1; } return 0L; } try { block = curBlockIter.nextBlock(); } catch (IOException e) { // There was an error listing the next block in the volume. This is a // serious issue. LOG.warn("{}: nextBlock error on {}", this, curBlockIter); // On the next loop iteration, curBlockIter#eof will be set to true, and // we will pick a different block iterator. return 0L; } if (block == null) { // The BlockIterator is at EOF. LOG.info("{}: finished scanning block pool {}", this, curBlockIter.getBlockPoolId()); saveBlockIterator(curBlockIter); return 0; } } if (curBlockIter != null) { long saveDelta = monotonicMs - curBlockIter.getLastSavedMs(); if (saveDelta >= conf.cursorSaveMs) { LOG.debug("{}: saving block iterator {} after {} ms.", this, curBlockIter, saveDelta); saveBlockIterator(curBlockIter); } } bytesScanned = scanBlock(block, conf.targetBytesPerSec); if (bytesScanned >= 0) { scannedBytesSum += bytesScanned; scannedBytes[(int)(curMinute % MINUTES_PER_HOUR)] += bytesScanned; } else { scanError = true; } return 0L; } finally { synchronized (stats) { stats.bytesScannedInPastHour = scannedBytesSum; if (bytesScanned > 0) { stats.blocksScannedInCurrentPeriod++; stats.blocksScannedSinceRestart++; } if (scanError) { stats.scanErrorsSinceRestart++; } if (block != null) { stats.lastBlockScanned = block; } if (curBlockIter == null) { stats.eof = true; stats.blockPoolPeriodEndsMs = -1; } else { stats.eof = curBlockIter.atEnd(); stats.blockPoolPeriodEndsMs = curBlockIter.getIterStartMs() + conf.scanPeriodMs; } } } }
long function(ExtendedBlock suspectBlock) { long bytesScanned = -1; boolean scanError = false; ExtendedBlock block = null; try { long monotonicMs = Time.monotonicNow(); expireOldScannedBytesRecords(monotonicMs); if (!calculateShouldScan(volume.getStorageID(), conf.targetBytesPerSec, scannedBytesSum, startMinute, curMinute)) { return 30000L; } if (suspectBlock != null) { block = suspectBlock; } else { if ((curBlockIter == null) curBlockIter.atEnd()) { long timeout = findNextUsableBlockIter(); if (timeout > 0) { LOG.trace(STR + STR, this, timeout); synchronized (stats) { stats.nextBlockPoolScanStartMs = Time.monotonicNow() + timeout; } return timeout; } synchronized (stats) { stats.scansSinceRestart++; stats.blocksScannedInCurrentPeriod = 0; stats.nextBlockPoolScanStartMs = -1; } return 0L; } try { block = curBlockIter.nextBlock(); } catch (IOException e) { LOG.warn(STR, this, curBlockIter); return 0L; } if (block == null) { LOG.info(STR, this, curBlockIter.getBlockPoolId()); saveBlockIterator(curBlockIter); return 0; } } if (curBlockIter != null) { long saveDelta = monotonicMs - curBlockIter.getLastSavedMs(); if (saveDelta >= conf.cursorSaveMs) { LOG.debug(STR, this, curBlockIter, saveDelta); saveBlockIterator(curBlockIter); } } bytesScanned = scanBlock(block, conf.targetBytesPerSec); if (bytesScanned >= 0) { scannedBytesSum += bytesScanned; scannedBytes[(int)(curMinute % MINUTES_PER_HOUR)] += bytesScanned; } else { scanError = true; } return 0L; } finally { synchronized (stats) { stats.bytesScannedInPastHour = scannedBytesSum; if (bytesScanned > 0) { stats.blocksScannedInCurrentPeriod++; stats.blocksScannedSinceRestart++; } if (scanError) { stats.scanErrorsSinceRestart++; } if (block != null) { stats.lastBlockScanned = block; } if (curBlockIter == null) { stats.eof = true; stats.blockPoolPeriodEndsMs = -1; } else { stats.eof = curBlockIter.atEnd(); stats.blockPoolPeriodEndsMs = curBlockIter.getIterStartMs() + conf.scanPeriodMs; } } } }
/** * Run an iteration of the VolumeScanner loop. * * @param suspectBlock A suspect block which we should scan, or null to * scan the next regularly scheduled block. * * @return The number of milliseconds to delay before running the loop * again, or 0 to re-run the loop immediately. */
Run an iteration of the VolumeScanner loop
runLoop
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/VolumeScanner.java", "license": "apache-2.0", "size": 26086 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.ExtendedBlock", "org.apache.hadoop.util.Time" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; import org.apache.hadoop.util.Time;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
84,969
public void setSafe(int index, int isSet, long value) { handleSafe(index); set(index, isSet, value); } /** * Construct a TransferPair comprising of this and and a target vector of * the same type. * * @param ref name of the target vector * @param allocator allocator for the target vector * @return {@link TransferPair}
void function(int index, int isSet, long value) { handleSafe(index); set(index, isSet, value); } /** * Construct a TransferPair comprising of this and and a target vector of * the same type. * * @param ref name of the target vector * @param allocator allocator for the target vector * @return {@link TransferPair}
/** * Same as {@link #set(int, int, long)} except that it handles the case * when index is greater than or equal to current value capacity of the * vector. * * @param index position of the new value * @param isSet 0 for NULL value, 1 otherwise * @param value The duration value (in the timeunit associated with this vector) */
Same as <code>#set(int, int, long)</code> except that it handles the case when index is greater than or equal to current value capacity of the vector
setSafe
{ "repo_name": "majetideepak/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/DurationVector.java", "license": "apache-2.0", "size": 12859 }
[ "org.apache.arrow.vector.util.TransferPair" ]
import org.apache.arrow.vector.util.TransferPair;
import org.apache.arrow.vector.util.*;
[ "org.apache.arrow" ]
org.apache.arrow;
564,721
public boolean injectOfMessage(IOFSwitch sw, OFMessage msg);
boolean function(IOFSwitch sw, OFMessage msg);
/** * Re-injects an OFMessage back into the packet processing chain * @param sw The switch to use for the message * @param msg the message to inject * @return True if successfully re-injected, false otherwise */
Re-injects an OFMessage back into the packet processing chain
injectOfMessage
{ "repo_name": "fbotelho-university-code/poseidon", "path": "src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java", "license": "apache-2.0", "size": 6929 }
[ "org.openflow.protocol.OFMessage" ]
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.*;
[ "org.openflow.protocol" ]
org.openflow.protocol;
1,981,449
public static NativeCalls getInstance() { return instance; } private static class POSIXNativeCalls extends NativeCalls { static { Native.register("c"); }
static NativeCalls function() { return instance; } private static class POSIXNativeCalls extends NativeCalls { static { Native.register("c"); }
/** * Get an instance of JNA based implementation of {@link NativeCalls} for the current platform. */
Get an instance of JNA based implementation of <code>NativeCalls</code> for the current platform
getInstance
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/shared/NativeCallsJNAImpl.java", "license": "apache-2.0", "size": 34202 }
[ "com.sun.jna.Native" ]
import com.sun.jna.Native;
import com.sun.jna.*;
[ "com.sun.jna" ]
com.sun.jna;
2,414,642
public static Resource subtractFromNonNegative(Resource lhs, Resource rhs) { subtractFrom(lhs, rhs); if (lhs.getMemorySize() < 0) { lhs.setMemorySize(0); } if (lhs.getVirtualCores() < 0) { lhs.setVirtualCores(0); } return lhs; }
static Resource function(Resource lhs, Resource rhs) { subtractFrom(lhs, rhs); if (lhs.getMemorySize() < 0) { lhs.setMemorySize(0); } if (lhs.getVirtualCores() < 0) { lhs.setVirtualCores(0); } return lhs; }
/** * Subtract <code>rhs</code> from <code>lhs</code> and reset any negative * values to zero. * @param lhs {@link Resource} to subtract from * @param rhs {@link Resource} to subtract * @return the value of lhs after subtraction */
Subtract <code>rhs</code> from <code>lhs</code> and reset any negative values to zero
subtractFromNonNegative
{ "repo_name": "wenxinhe/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java", "license": "apache-2.0", "size": 16480 }
[ "org.apache.hadoop.yarn.api.records.Resource" ]
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,821,277
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String routeTableName, String routeName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, routeTableName, routeName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String routeTableName, String routeName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, routeTableName, routeName), serviceCallback); }
/** * Deletes the specified route from a route table. * * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. * @param routeName The name of the route. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Deletes the specified route from a route table
beginDeleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/RoutesInner.java", "license": "mit", "size": 43032 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
989,045
private void ensureLocationPermissions() { //Check if we have the right permissions to use location Boolean i = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED; if (i) { mMap.setMyLocationEnabled(true); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0); } }
void function() { Boolean i = ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED; if (i) { mMap.setMyLocationEnabled(true); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 0); } }
/** * A quick permission check to ensure that we location services enabled */
A quick permission check to ensure that we location services enabled
ensureLocationPermissions
{ "repo_name": "CMPUT301F16T11/a2b", "path": "app/src/main/java/com/cmput301f16t11/a2b/RiderLocationActivity.java", "license": "apache-2.0", "size": 30140 }
[ "android.content.pm.PackageManager", "android.support.v4.app.ActivityCompat", "android.support.v4.content.ContextCompat" ]
import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat;
import android.content.pm.*; import android.support.v4.app.*; import android.support.v4.content.*;
[ "android.content", "android.support" ]
android.content; android.support;
2,183,261
public ViewResultSet execute(Connection cn, String query, String dataBaseProductName) { ViewResultSet viewResultSet = null; viewResultSet = createDatabasebyKey(dataBaseProductName).execute(query, cn); return viewResultSet; }
ViewResultSet function(Connection cn, String query, String dataBaseProductName) { ViewResultSet viewResultSet = null; viewResultSet = createDatabasebyKey(dataBaseProductName).execute(query, cn); return viewResultSet; }
/** * Create explain plan for trainee query * * @param cn * @param query * @param dataBaseProductName * @return ViewResultSet */
Create explain plan for trainee query
execute
{ "repo_name": "bschiefer/sqlcoach", "path": "sqlcoach-persistence/src/main/java/de/sqlcoach/db/executionPlan/Facade.java", "license": "agpl-3.0", "size": 2949 }
[ "de.sqlcoach.util.ViewResultSet", "java.sql.Connection" ]
import de.sqlcoach.util.ViewResultSet; import java.sql.Connection;
import de.sqlcoach.util.*; import java.sql.*;
[ "de.sqlcoach.util", "java.sql" ]
de.sqlcoach.util; java.sql;
2,887,371
public String collectDeviceData(Activity activity, BraintreeEnvironment environment) { return collectDeviceData(activity, environment.getMerchantId(), environment.getCollectorUrl()); }
String function(Activity activity, BraintreeEnvironment environment) { return collectDeviceData(activity, environment.getMerchantId(), environment.getCollectorUrl()); }
/** * Collect device information for fraud identification purposes. * * @param activity The currently visible activity. * @param environment The Braintree environment to use. * @return device_id String to send to Braintree. * @see com.braintreepayments.api.data.BraintreeData */
Collect device information for fraud identification purposes
collectDeviceData
{ "repo_name": "lgvalle/braintree_android", "path": "BraintreeApi/src/main/java/com/braintreepayments/api/BraintreeApi.java", "license": "mit", "size": 17197 }
[ "android.app.Activity", "com.braintreepayments.api.data.BraintreeEnvironment" ]
import android.app.Activity; import com.braintreepayments.api.data.BraintreeEnvironment;
import android.app.*; import com.braintreepayments.api.data.*;
[ "android.app", "com.braintreepayments.api" ]
android.app; com.braintreepayments.api;
2,528,279
@Operation(desc = "Destroy a queue", impact = MBeanOperationInfo.ACTION) void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy") String name) throws Exception;
@Operation(desc = STR, impact = MBeanOperationInfo.ACTION) void destroyQueue(@Parameter(name = "name", desc = STR) String name) throws Exception;
/** * Destroys the queue corresponding to the specified name. */
Destroys the queue corresponding to the specified name
destroyQueue
{ "repo_name": "johnament/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.java", "license": "apache-2.0", "size": 58028 }
[ "javax.management.MBeanOperationInfo" ]
import javax.management.MBeanOperationInfo;
import javax.management.*;
[ "javax.management" ]
javax.management;
1,356,574
public static String getUserUuid() { Authentication authentication = getAuthentication(); UserDetails springSecurityUser = null; String userName = null; if (authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
static String function() { Authentication authentication = getAuthentication(); UserDetails springSecurityUser = null; String userName = null; if (authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
/** * Get the login of the current user. */
Get the login of the current user
getUserUuid
{ "repo_name": "esutoniagodesu/egd-web", "path": "src/main/java/ee/esutoniagodesu/security/SecurityUtils.java", "license": "gpl-2.0", "size": 2669 }
[ "org.springframework.security.core.Authentication", "org.springframework.security.core.userdetails.UserDetails" ]
import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.*; import org.springframework.security.core.userdetails.*;
[ "org.springframework.security" ]
org.springframework.security;
2,536,063
public static List<Tuple<int[],Double>> distanceSortedEdges(List<String> cells, Point point) { final List<BoundingBox> boxes = new ArrayList<BoundingBox>(); for(final String cell : cells) { boxes.add(computeBox(cell)); } double maxNorth = Double.NEGATIVE_INFINITY; double maxEast = Double.NEGATIVE_INFINITY; double maxSouth = Double.POSITIVE_INFINITY; double maxWest = Double.POSITIVE_INFINITY; for(final BoundingBox box : boxes) { maxNorth = Math.max(maxNorth, box.getNorth()); maxEast = Math.max(maxEast, box.getEast()); maxSouth = Math.min(maxSouth, box.getSouth()); maxWest = Math.min(maxWest, box.getWest()); } final List<Tuple<int[],Double>> result = new ArrayList<Tuple<int[],Double>>(); result.add(new Tuple<int[], Double>(SOUTH, distance(new Point(maxSouth, point.getLon()), point))); result.add(new Tuple<int[], Double>(NORTH, distance(new Point(maxNorth, point.getLon()), point))); result.add(new Tuple<int[], Double>(WEST, distance(new Point(point.getLat(), maxWest), point))); result.add(new Tuple<int[], Double>(EAST, distance(new Point(point.getLat(), maxEast), point))); Collections.sort(result, new DoubleTupleComparator()); return result; }
static List<Tuple<int[],Double>> function(List<String> cells, Point point) { final List<BoundingBox> boxes = new ArrayList<BoundingBox>(); for(final String cell : cells) { boxes.add(computeBox(cell)); } double maxNorth = Double.NEGATIVE_INFINITY; double maxEast = Double.NEGATIVE_INFINITY; double maxSouth = Double.POSITIVE_INFINITY; double maxWest = Double.POSITIVE_INFINITY; for(final BoundingBox box : boxes) { maxNorth = Math.max(maxNorth, box.getNorth()); maxEast = Math.max(maxEast, box.getEast()); maxSouth = Math.min(maxSouth, box.getSouth()); maxWest = Math.min(maxWest, box.getWest()); } final List<Tuple<int[],Double>> result = new ArrayList<Tuple<int[],Double>>(); result.add(new Tuple<int[], Double>(SOUTH, distance(new Point(maxSouth, point.getLon()), point))); result.add(new Tuple<int[], Double>(NORTH, distance(new Point(maxNorth, point.getLon()), point))); result.add(new Tuple<int[], Double>(WEST, distance(new Point(point.getLat(), maxWest), point))); result.add(new Tuple<int[], Double>(EAST, distance(new Point(point.getLat(), maxEast), point))); Collections.sort(result, new DoubleTupleComparator()); return result; }
/** * Returns the edges of the rectangular region containing all of the given geocells, sorted by distance from the given point, along with the actual distances from the point to these edges. * * @param cells: The cells (should be adjacent) defining the rectangular region whose edge distances are requested. * @param point: The point that should determine the edge sort order. * @return A list of (direction, distance) tuples, where direction is the edge and distance is the distance from the point to that edge. A direction value of (0,-1), for example, corresponds to the South edge of the rectangular region containing all of the given geocells. * * TODO(romannurik): Assert that lat,lon are actually inside the geocell. */
Returns the edges of the rectangular region containing all of the
distanceSortedEdges
{ "repo_name": "mitmel/Locast-Core-Android", "path": "src/com/beoui/geocell/GeocellUtils.java", "license": "gpl-2.0", "size": 22325 }
[ "com.beoui.geocell.comparator.DoubleTupleComparator", "com.beoui.geocell.model.BoundingBox", "com.beoui.geocell.model.Point", "com.beoui.geocell.model.Tuple", "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import com.beoui.geocell.comparator.DoubleTupleComparator; import com.beoui.geocell.model.BoundingBox; import com.beoui.geocell.model.Point; import com.beoui.geocell.model.Tuple; import java.util.ArrayList; import java.util.Collections; import java.util.List;
import com.beoui.geocell.comparator.*; import com.beoui.geocell.model.*; import java.util.*;
[ "com.beoui.geocell", "java.util" ]
com.beoui.geocell; java.util;
1,431,559
public void call(String name, Writable json) throws IOException { writeName(name); verifyValue(); if(json instanceof GString) { writer.write(generator.toJson(json.toString())); } else { json.writeTo(writer); } }
void function(String name, Writable json) throws IOException { writeName(name); verifyValue(); if(json instanceof GString) { writer.write(generator.toJson(json.toString())); } else { json.writeTo(writer); } }
/** * Writes the given Writable as the value of the given attribute name * * @param name The attribute name * @param json The writable value * @throws IOException */
Writes the given Writable as the value of the given attribute name
call
{ "repo_name": "russel/incubator-groovy", "path": "subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java", "license": "apache-2.0", "size": 31416 }
[ "groovy.lang.GString", "groovy.lang.Writable", "java.io.IOException" ]
import groovy.lang.GString; import groovy.lang.Writable; import java.io.IOException;
import groovy.lang.*; import java.io.*;
[ "groovy.lang", "java.io" ]
groovy.lang; java.io;
2,044,414
public void removeWay( OverlayWay overlayWay ) { synchronized (this.overlayWays) { this.overlayWays.remove(overlayWay); } populate(); }
void function( OverlayWay overlayWay ) { synchronized (this.overlayWays) { this.overlayWays.remove(overlayWay); } populate(); }
/** * Removes the given way from the overlay. * * @param overlayWay * the way that should be removed from the overlay. */
Removes the given way from the overlay
removeWay
{ "repo_name": "gabrielmancilla/mtisig", "path": "geopaparazzi.app/src/eu/hydrologis/geopaparazzi/maps/overlays/ArrayGeopaparazziOverlay.java", "license": "gpl-3.0", "size": 5265 }
[ "org.mapsforge.android.maps.overlay.OverlayWay" ]
import org.mapsforge.android.maps.overlay.OverlayWay;
import org.mapsforge.android.maps.overlay.*;
[ "org.mapsforge.android" ]
org.mapsforge.android;
2,436,201
public void testTwoOutOfThreeSamePriorTherapy() throws Exception { ExpeditedAdverseEventReport aeReport = createAEReport(); aeReport.addSaeReportPriorTherapies(aeReport.getSaeReportPriorTherapies().get(1)); ValidationErrors errors = fireRules(aeReport); assertCorrectErrorCode(errors, "PTY_UK_ERR"); assertSameErrorCount(errors, 1); assertEquals("Replacement variable incorrect", 3, errors.getErrorAt(0).getReplacementVariables()[0]); }
void function() throws Exception { ExpeditedAdverseEventReport aeReport = createAEReport(); aeReport.addSaeReportPriorTherapies(aeReport.getSaeReportPriorTherapies().get(1)); ValidationErrors errors = fireRules(aeReport); assertCorrectErrorCode(errors, STR); assertSameErrorCount(errors, 1); assertEquals(STR, 3, errors.getErrorAt(0).getReplacementVariables()[0]); }
/** * RuleName : PTY_UK_CHK Logic : Prior Therapy must be unique Error Code : PTY_UK_ERR Error * Message : PRIOR_THERAPY must be unique */
RuleName : PTY_UK_CHK Logic : Prior Therapy must be unique Error Code : PTY_UK_ERR Error Message : PRIOR_THERAPY must be unique
testTwoOutOfThreeSamePriorTherapy
{ "repo_name": "CBIIT/caaers", "path": "caAERS/software/core/src/test/java/gov/nih/nci/cabig/caaers/rules/deploy/PriorTherapyBusinessRulesTest.java", "license": "bsd-3-clause", "size": 21550 }
[ "gov.nih.nci.cabig.caaers.domain.ExpeditedAdverseEventReport", "gov.nih.nci.cabig.caaers.validation.ValidationErrors" ]
import gov.nih.nci.cabig.caaers.domain.ExpeditedAdverseEventReport; import gov.nih.nci.cabig.caaers.validation.ValidationErrors;
import gov.nih.nci.cabig.caaers.domain.*; import gov.nih.nci.cabig.caaers.validation.*;
[ "gov.nih.nci" ]
gov.nih.nci;
1,637,429
public Properties toProperties() { return toProperties(false ); }
Properties function() { return toProperties(false ); }
/** * Converts the contents of this config to a property instance. * * @return contents of this config as java.util.Properties */
Converts the contents of this config to a property instance
toProperties
{ "repo_name": "davebarnes97/geode", "path": "geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AgentConfigImpl.java", "license": "apache-2.0", "size": 65588 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
92,786
protected void addOutput__oAnalogScaledPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CtrlUnit10_Output__oAnalogScaled_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CtrlUnit10_Output__oAnalogScaled_feature", "_UI_CtrlUnit10_type"), WTSpecPackage.eINSTANCE.getCtrlUnit10_Output__oAnalogScaled(), true, false, true, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), WTSpecPackage.eINSTANCE.getCtrlUnit10_Output__oAnalogScaled(), true, false, true, null, null, null)); }
/** * This adds a property descriptor for the Output oAnalog Scaled feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Output oAnalog Scaled feature.
addOutput__oAnalogScaledPropertyDescriptor
{ "repo_name": "FTSRG/mondo-collab-framework", "path": "archive/workspaceTracker/VA/ikerlanEMF.edit/src/eu/mondo/collaboration/operationtracemodel/example/WTSpec/provider/CtrlUnit10ItemProvider.java", "license": "epl-1.0", "size": 10941 }
[ "eu.mondo.collaboration.operationtracemodel.example.WTSpec", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import eu.mondo.collaboration.operationtracemodel.example.WTSpec; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import eu.mondo.collaboration.operationtracemodel.example.*; import org.eclipse.emf.edit.provider.*;
[ "eu.mondo.collaboration", "org.eclipse.emf" ]
eu.mondo.collaboration; org.eclipse.emf;
2,327,193
public final MetaProperty<BusinessDayConvention> businessDayConvention() { return _businessDayConvention; }
final MetaProperty<BusinessDayConvention> function() { return _businessDayConvention; }
/** * The meta-property for the {@code businessDayConvention} property. * @return the meta-property, not null */
The meta-property for the businessDayConvention property
businessDayConvention
{ "repo_name": "McLeodMoores/starling", "path": "projects/financial-types/src/main/java/com/opengamma/financial/convention/BondConvention.java", "license": "apache-2.0", "size": 15941 }
[ "com.opengamma.financial.convention.businessday.BusinessDayConvention", "org.joda.beans.MetaProperty" ]
import com.opengamma.financial.convention.businessday.BusinessDayConvention; import org.joda.beans.MetaProperty;
import com.opengamma.financial.convention.businessday.*; import org.joda.beans.*;
[ "com.opengamma.financial", "org.joda.beans" ]
com.opengamma.financial; org.joda.beans;
1,282,969
private boolean isNewer(JsonObject release) { if (!release.has("tag_name")) { return false; } Version releaseVer = new Version(release.get("tag_name").getAsString()); Version installedVer = new Version(currentVersion); return releaseVer.isNewerThan(installedVer); }
boolean function(JsonObject release) { if (!release.has(STR)) { return false; } Version releaseVer = new Version(release.get(STR).getAsString()); Version installedVer = new Version(currentVersion); return releaseVer.isNewerThan(installedVer); }
/** * True if release version differs from current version. */
True if release version differs from current version
isNewer
{ "repo_name": "tmc-cli/tmc-cli", "path": "src/main/java/fi/helsinki/cs/tmc/cli/updater/AutoUpdater.java", "license": "mit", "size": 7911 }
[ "com.google.gson.JsonObject" ]
import com.google.gson.JsonObject;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
747,874
public static boolean delQuota(ZooKeeper zk, String path, boolean bytes, boolean numNodes) throws KeeperException, IOException, InterruptedException { String parentPath = Quotas.quotaZookeeper + path; String quotaPath = Quotas.quotaZookeeper + path + "/" + Quotas.limitNode; if (zk.exists(quotaPath, false) == null) { System.out.println("Quota does not exist for " + path); return true; } byte[] data = null; try { data = zk.getData(quotaPath, false, new Stat()); } catch(KeeperException.NoNodeException ne) { System.err.println("quota does not exist for " + path); return true; } StatsTrack strack = new StatsTrack(new String(data)); if (bytes && !numNodes) { strack.setBytes(-1L); zk.setData(quotaPath, strack.toString().getBytes(), -1); } else if (!bytes && numNodes) { strack.setCount(-1); zk.setData(quotaPath, strack.toString().getBytes(), -1); } else if (bytes && numNodes) { // delete till you can find a node with more than // one child List<String> children = zk.getChildren(parentPath, false); /// delete the direct children first for (String child: children) { zk.delete(parentPath + "/" + child, -1); } // cut the tree till their is more than one child trimProcQuotas(zk, parentPath); } return true; }
static boolean function(ZooKeeper zk, String path, boolean bytes, boolean numNodes) throws KeeperException, IOException, InterruptedException { String parentPath = Quotas.quotaZookeeper + path; String quotaPath = Quotas.quotaZookeeper + path + "/" + Quotas.limitNode; if (zk.exists(quotaPath, false) == null) { System.out.println(STR + path); return true; } byte[] data = null; try { data = zk.getData(quotaPath, false, new Stat()); } catch(KeeperException.NoNodeException ne) { System.err.println(STR + path); return true; } StatsTrack strack = new StatsTrack(new String(data)); if (bytes && !numNodes) { strack.setBytes(-1L); zk.setData(quotaPath, strack.toString().getBytes(), -1); } else if (!bytes && numNodes) { strack.setCount(-1); zk.setData(quotaPath, strack.toString().getBytes(), -1); } else if (bytes && numNodes) { List<String> children = zk.getChildren(parentPath, false); for (String child: children) { zk.delete(parentPath + "/" + child, -1); } trimProcQuotas(zk, parentPath); } return true; }
/** * this method deletes quota for a node. * @param zk the zookeeper client * @param path the path to delete quota for * @param bytes true if number of bytes needs to * be unset * @param numNodes true if number of nodes needs * to be unset * @return true if quota deletion is successful * @throws KeeperException * @throws IOException * @throws InterruptedException */
this method deletes quota for a node
delQuota
{ "repo_name": "apurtell/zookeeper", "path": "src/java/main/org/apache/zookeeper/ZooKeeperMain.java", "license": "apache-2.0", "size": 32750 }
[ "java.io.IOException", "java.util.List", "org.apache.zookeeper.data.Stat" ]
import java.io.IOException; import java.util.List; import org.apache.zookeeper.data.Stat;
import java.io.*; import java.util.*; import org.apache.zookeeper.data.*;
[ "java.io", "java.util", "org.apache.zookeeper" ]
java.io; java.util; org.apache.zookeeper;
1,127,238
EClass getState();
EClass getState();
/** * Returns the meta object for class '{@link simplefsmtest.timedfsmmt.fsm.State <em>State</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>State</em>'. * @see simplefsmtest.timedfsmmt.fsm.State * @generated */
Returns the meta object for class '<code>simplefsmtest.timedfsmmt.fsm.State State</code>'.
getState
{ "repo_name": "diverse-project/melange", "path": "tests/fr.inria.diverse.melange.tests/src/main/java/simplefsmtest/timedfsmmt/fsm/FsmPackage.java", "license": "epl-1.0", "size": 15500 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
851,906
public void testPositionOffsetGapDeprecation() throws Exception { // test deprecation exceptions on newly created indexes String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("properties") .startObject("field1") .field("type", "string") .field("position_increment_gap", 10) .endObject() .startObject("field2") .field("type", "string") .field("position_offset_gap", 50) .field("analyzer", "standard") .endObject().endObject().endObject().endObject().string(); try { parser.parse(mapping); fail("Mapping definition should fail with the position_offset_gap setting"); }catch (MapperParsingException e) { assertEquals(e.getMessage(), "Mapping definition for [field2] has unsupported parameters: [position_offset_gap : 50]"); } }
void function() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject(STR) .startObject(STR) .field("type", STR) .field(STR, 10) .endObject() .startObject(STR) .field("type", STR) .field(STR, 50) .field(STR, STR) .endObject().endObject().endObject().endObject().string(); try { parser.parse(mapping); fail(STR); }catch (MapperParsingException e) { assertEquals(e.getMessage(), STR); } }
/** * Test that expected exceptions are thrown when creating a new index with position_offset_gap */
Test that expected exceptions are thrown when creating a new index with position_offset_gap
testPositionOffsetGapDeprecation
{ "repo_name": "wbowling/elasticsearch", "path": "core/src/test/java/org/elasticsearch/index/mapper/string/SimpleStringMappingTests.java", "license": "apache-2.0", "size": 27327 }
[ "org.elasticsearch.common.xcontent.XContentFactory", "org.elasticsearch.index.mapper.MapperParsingException" ]
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.common.xcontent.*; import org.elasticsearch.index.mapper.*;
[ "org.elasticsearch.common", "org.elasticsearch.index" ]
org.elasticsearch.common; org.elasticsearch.index;
2,749,808
public static ClosableIterator<Resource> getAllMember(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource) { return Base.getAll(model, instanceResource, MEMBER, Resource.class); }
static ClosableIterator<Resource> function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource) { return Base.getAll(model, instanceResource, MEMBER, Resource.class); }
/** * Get all values of property Member * * @param model an RDF2Go model * * @param instanceResource an RDF2Go resource * @return a ClosableIterator of $type * * [Generated from RDFReactor template rule #get11static] */
Get all values of property Member
getAllMember
{ "repo_name": "semweb4j/semweb4j", "path": "org.semweb4j.rdfreactor.generator/src/main/java/org/ontoware/rdfreactor/schema/bootstrap/Resource.java", "license": "bsd-2-clause", "size": 83665 }
[ "org.ontoware.aifbcommons.collection.ClosableIterator", "org.ontoware.rdf2go.model.Model", "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.aifbcommons.collection.ClosableIterator; import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.aifbcommons.collection.*; import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.aifbcommons", "org.ontoware.rdf2go", "org.ontoware.rdfreactor" ]
org.ontoware.aifbcommons; org.ontoware.rdf2go; org.ontoware.rdfreactor;
1,541,686
protected static LocaleContext buildLocaleContext(final HttpServletRequest request) { Locale locale = localeResolver.resolveLocale(request); return new SimpleLocaleContext(locale); }
static LocaleContext function(final HttpServletRequest request) { Locale locale = localeResolver.resolveLocale(request); return new SimpleLocaleContext(locale); }
/** * Build a LocaleContext for the given request, exposing the request's * primary locale as current locale. * <p>The default implementation uses the dispatcher's LocaleResolver * to obtain the current locale, which might change during a request. * @param request current HTTP request * @return the corresponding LocaleContext */
Build a LocaleContext for the given request, exposing the request's primary locale as current locale. The default implementation uses the dispatcher's LocaleResolver to obtain the current locale, which might change during a request
buildLocaleContext
{ "repo_name": "shufudong/bboss", "path": "bboss-mvc/src/org/frameworkset/web/servlet/DispatchServlet.java", "license": "apache-2.0", "size": 72693 }
[ "java.util.Locale", "javax.servlet.http.HttpServletRequest", "org.frameworkset.spi.support.LocaleContext", "org.frameworkset.spi.support.SimpleLocaleContext" ]
import java.util.Locale; import javax.servlet.http.HttpServletRequest; import org.frameworkset.spi.support.LocaleContext; import org.frameworkset.spi.support.SimpleLocaleContext;
import java.util.*; import javax.servlet.http.*; import org.frameworkset.spi.support.*;
[ "java.util", "javax.servlet", "org.frameworkset.spi" ]
java.util; javax.servlet; org.frameworkset.spi;
922,278
@Override public void run() { long nextSequence; boolean processedSequence = true; try { //while(processor.alive() && processor.upstreamSubscription == null); Thread.currentThread() .setContextClassLoader(processor.contextClassLoader); subscriber.onSubscribe(this); long cachedAvailableSequence = Long.MIN_VALUE; nextSequence = sequence.getAsLong(); Slot<T> event = null; final boolean unbounded = pendingRequest.getAsLong() == Long.MAX_VALUE; if (!EventLoopProcessor.waitRequestOrTerminalEvent(pendingRequest, barrier, running, sequence, waiter) && replay(unbounded)) { if(!running.get()){ return; } if(processor.terminated == SHUTDOWN) { if (processor.ringBuffer.getAsLong() == -1L) { if (processor.error != null) { subscriber.onError(processor.error); return; } subscriber.onComplete(); return; } } else if (processor.terminated == FORCED_SHUTDOWN) { return; } } while (true) { try { // if previous sequence was processed - fetch the next sequence and set // that we have successfully processed the previous sequence // typically, this will be true // this prevents the sequence getting too far forward if an error // is thrown from the WorkHandler if (processedSequence) { if(!running.get()){ break; } processedSequence = false; do { nextSequence = processor.workSequence.getAsLong() + 1L; while ((!unbounded && pendingRequest.getAsLong() == 0L)) { if (!isRunning()) { WaitStrategy.alert(); } LockSupport.parkNanos(1L); } sequence.set(nextSequence - 1L); } while (!processor.workSequence.compareAndSet(nextSequence - 1L, nextSequence)); } if (cachedAvailableSequence >= nextSequence) { event = processor.ringBuffer.get(nextSequence); try { readNextEvent(unbounded); } catch (Exception ce) { if (!running.get() || !WaitStrategy.isAlert(ce)) { throw ce; } barrier.clearAlert(); } processedSequence = true; subscriber.onNext(event.value); } else { processor.readWait.signalAllWhenBlocking(); cachedAvailableSequence = barrier.waitFor(nextSequence, waiter); } } catch (InterruptedException | RuntimeException ce) { if (ce instanceof InterruptedException) { Thread.currentThread().interrupt(); } if (Exceptions.isCancel(ce)){ reschedule(event); break; } if (!WaitStrategy.isAlert(ce)) { throw Exceptions.propagate(ce); } barrier.clearAlert(); if (!running.get()) { break; } if(processor.terminated == SHUTDOWN) { if (processor.error != null) { processedSequence = true; subscriber.onError(processor.error); break; } if (processor.ringBuffer.getPending() == 0) { processedSequence = true; subscriber.onComplete(); break; } } else if (processor.terminated == FORCED_SHUTDOWN) { break; } //processedSequence = true; //continue event-loop } } } finally { processor.decrementSubscribers(); running.set(false); if(!processedSequence) { processor.claimedDisposed.add(sequence); } else{ processor.ringBuffer.removeGatingSequence(sequence); } processor.writeWait.signalAllWhenBlocking(); } }
void function() { long nextSequence; boolean processedSequence = true; try { Thread.currentThread() .setContextClassLoader(processor.contextClassLoader); subscriber.onSubscribe(this); long cachedAvailableSequence = Long.MIN_VALUE; nextSequence = sequence.getAsLong(); Slot<T> event = null; final boolean unbounded = pendingRequest.getAsLong() == Long.MAX_VALUE; if (!EventLoopProcessor.waitRequestOrTerminalEvent(pendingRequest, barrier, running, sequence, waiter) && replay(unbounded)) { if(!running.get()){ return; } if(processor.terminated == SHUTDOWN) { if (processor.ringBuffer.getAsLong() == -1L) { if (processor.error != null) { subscriber.onError(processor.error); return; } subscriber.onComplete(); return; } } else if (processor.terminated == FORCED_SHUTDOWN) { return; } } while (true) { try { if (processedSequence) { if(!running.get()){ break; } processedSequence = false; do { nextSequence = processor.workSequence.getAsLong() + 1L; while ((!unbounded && pendingRequest.getAsLong() == 0L)) { if (!isRunning()) { WaitStrategy.alert(); } LockSupport.parkNanos(1L); } sequence.set(nextSequence - 1L); } while (!processor.workSequence.compareAndSet(nextSequence - 1L, nextSequence)); } if (cachedAvailableSequence >= nextSequence) { event = processor.ringBuffer.get(nextSequence); try { readNextEvent(unbounded); } catch (Exception ce) { if (!running.get() !WaitStrategy.isAlert(ce)) { throw ce; } barrier.clearAlert(); } processedSequence = true; subscriber.onNext(event.value); } else { processor.readWait.signalAllWhenBlocking(); cachedAvailableSequence = barrier.waitFor(nextSequence, waiter); } } catch (InterruptedException RuntimeException ce) { if (ce instanceof InterruptedException) { Thread.currentThread().interrupt(); } if (Exceptions.isCancel(ce)){ reschedule(event); break; } if (!WaitStrategy.isAlert(ce)) { throw Exceptions.propagate(ce); } barrier.clearAlert(); if (!running.get()) { break; } if(processor.terminated == SHUTDOWN) { if (processor.error != null) { processedSequence = true; subscriber.onError(processor.error); break; } if (processor.ringBuffer.getPending() == 0) { processedSequence = true; subscriber.onComplete(); break; } } else if (processor.terminated == FORCED_SHUTDOWN) { break; } } } } finally { processor.decrementSubscribers(); running.set(false); if(!processedSequence) { processor.claimedDisposed.add(sequence); } else{ processor.ringBuffer.removeGatingSequence(sequence); } processor.writeWait.signalAllWhenBlocking(); } }
/** * It is ok to have another thread rerun this method after a halt(). */
It is ok to have another thread rerun this method after a halt()
run
{ "repo_name": "reactor/reactor-extensions", "path": "reactor-extra/src/main/java/reactor/extra/processor/WorkQueueProcessor.java", "license": "apache-2.0", "size": 22641 }
[ "java.util.concurrent.locks.LockSupport" ]
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
195,607
private void loadHistory(final int itemToLoad, RevWalk walk) { if (itemToLoad == INITIAL_ITEM) { job = new GenerateHistoryJob(this, graph.getControl(), walk, resources); job.setRule(this); } job.setLoadHint(itemToLoad); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), "Scheduling GenerateHistoryJob"); //$NON-NLS-1$ schedule(job); }
void function(final int itemToLoad, RevWalk walk) { if (itemToLoad == INITIAL_ITEM) { job = new GenerateHistoryJob(this, graph.getControl(), walk, resources); job.setRule(this); } job.setLoadHint(itemToLoad); if (trace) GitTraceLocation.getTrace().trace( GitTraceLocation.HISTORYVIEW.getLocation(), STR); schedule(job); }
/** * Load history items incrementally * @param itemToLoad hint for index of item that should be loaded * @param walk the revwalk, used only if itemToLoad == INITIAL_ITEM */
Load history items incrementally
loadHistory
{ "repo_name": "blizzy78/egit", "path": "org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java", "license": "epl-1.0", "size": 71372 }
[ "org.eclipse.egit.ui.internal.trace.GitTraceLocation", "org.eclipse.jgit.revwalk.RevWalk" ]
import org.eclipse.egit.ui.internal.trace.GitTraceLocation; import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.egit.ui.internal.trace.*; import org.eclipse.jgit.revwalk.*;
[ "org.eclipse.egit", "org.eclipse.jgit" ]
org.eclipse.egit; org.eclipse.jgit;
1,975,743
@SuppressWarnings("unchecked") public Set<V> getValuesByKey(final K key, final int numberOfValues, final Set<V> _blackListedIDs) { if (key == null) { throw new RuntimeException("invalid arguments k=" + key); } // define the result Set<V> result = new HashSet<V>(); // determine the current write position int[] temp = this.listIndexByKey.get(key); // search backward in the ring buffer starting just at the last written position if (temp != null){ int currentIndex = temp[0]; // limit the number of search steps // since the lists may contain duplicates, searches may needs more steps for (int i = 0; i < 3 * numberOfValues; i++) { // determine the last position if (currentIndex <= 0) { currentIndex = maximalNumberOfItemsPerKey; } currentIndex = currentIndex-1; V currentObject = (V) this.listByKey.get(key)[currentIndex]; // the itemID may not be null, already contained in the result list, or contained in the black list if (currentObject != null && !result.contains(currentObject) && !_blackListedIDs.contains(currentObject)) { result.add(currentObject); } if (result.size() >= numberOfValues) { break; } } } return result; }
@SuppressWarnings(STR) Set<V> function(final K key, final int numberOfValues, final Set<V> _blackListedIDs) { if (key == null) { throw new RuntimeException(STR + key); } Set<V> result = new HashSet<V>(); int[] temp = this.listIndexByKey.get(key); if (temp != null){ int currentIndex = temp[0]; for (int i = 0; i < 3 * numberOfValues; i++) { if (currentIndex <= 0) { currentIndex = maximalNumberOfItemsPerKey; } currentIndex = currentIndex-1; V currentObject = (V) this.listByKey.get(key)[currentIndex]; if (currentObject != null && !result.contains(currentObject) && !_blackListedIDs.contains(currentObject)) { result.add(currentObject); } if (result.size() >= numberOfValues) { break; } } } return result; }
/** * Get some values from the ring buffer. * This method is NOT synchronized and may return inconsistent values. * This method does not block. It always returns an HashSet (might be empty) * values refer to all items which are in the publisher's item list * * @param key * @param numberOfValues * @param _blackListedIDs * @return */
Get some values from the ring buffer. This method is NOT synchronized and may return inconsistent values. This method does not block. It always returns an HashSet (might be empty) values refer to all items which are in the publisher's item list
getValuesByKey
{ "repo_name": "andreas-dai/NewsREEL-Template", "path": "src/main/java/de/dailab/plistacontest/client/DirtyRingBuffer.java", "license": "mit", "size": 6593 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,366,324
public String decryptAsNeeded(final String value) { try { // Try a decryption return decrypt(value); } catch (final EncryptionOperationNotPossibleException e) { // NOSONAR - Ignore raw value // Value could be encrypted, but was not return value; } }
String function(final String value) { try { return decrypt(value); } catch (final EncryptionOperationNotPossibleException e) { return value; } }
/** * Decrypt a potentially encrypted value. * * @param value The encrypted value to decrypt if not <code>null</code>. * @return the decrypted value. */
Decrypt a potentially encrypted value
decryptAsNeeded
{ "repo_name": "ligoj/bootstrap", "path": "bootstrap-core/src/main/java/org/ligoj/bootstrap/core/crypto/CryptoHelper.java", "license": "mit", "size": 2605 }
[ "org.jasypt.exceptions.EncryptionOperationNotPossibleException" ]
import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
import org.jasypt.exceptions.*;
[ "org.jasypt.exceptions" ]
org.jasypt.exceptions;
203,643
public void testCanonicalize() throws EncodingException { System.out.println("canonicalize"); ArrayList<String> list = new ArrayList<String>(); list.add( "HTMLEntityCodec" ); list.add( "PercentCodec" ); Encoder instance = new DefaultEncoder( list ); // Test null paths assertEquals( null, instance.canonicalize(null)); assertEquals( null, instance.canonicalize(null, true)); assertEquals( null, instance.canonicalize(null, false)); assertEquals( null, instance.canonicalize(null, true, true)); assertEquals( null, instance.canonicalize(null, true, false)); assertEquals( null, instance.canonicalize(null, false, true)); assertEquals( null, instance.canonicalize(null, false, false)); // test exception paths assertEquals( "%", instance.canonicalize("%25", true)); assertEquals( "%", instance.canonicalize("%25", false)); assertEquals( "%", instance.canonicalize("%25")); assertEquals( "%F", instance.canonicalize("%25F")); assertEquals( "<", instance.canonicalize("%3c")); assertEquals( "<", instance.canonicalize("%3C")); assertEquals( "%X1", instance.canonicalize("%X1")); assertEquals( "<", instance.canonicalize("&lt")); assertEquals( "<", instance.canonicalize("&LT")); assertEquals( "<", instance.canonicalize("&lt;")); assertEquals( "<", instance.canonicalize("&LT;")); assertEquals( "%", instance.canonicalize("&#37;")); assertEquals( "%", instance.canonicalize("&#37")); assertEquals( "%b", instance.canonicalize("&#37b")); assertEquals( "<", instance.canonicalize("&#x3c")); assertEquals( "<", instance.canonicalize("&#x3c;")); assertEquals( "<", instance.canonicalize("&#x3C")); assertEquals( "<", instance.canonicalize("&#X3c")); assertEquals( "<", instance.canonicalize("&#X3C")); assertEquals( "<", instance.canonicalize("&#X3C;")); // percent encoding assertEquals( "<", instance.canonicalize("%3c")); assertEquals( "<", instance.canonicalize("%3C")); // html entity encoding assertEquals( "<", instance.canonicalize("&#60")); assertEquals( "<", instance.canonicalize("&#060")); assertEquals( "<", instance.canonicalize("&#0060")); assertEquals( "<", instance.canonicalize("&#00060")); assertEquals( "<", instance.canonicalize("&#000060")); assertEquals( "<", instance.canonicalize("&#0000060")); assertEquals( "<", instance.canonicalize("&#60;")); assertEquals( "<", instance.canonicalize("&#060;")); assertEquals( "<", instance.canonicalize("&#0060;")); assertEquals( "<", instance.canonicalize("&#00060;")); assertEquals( "<", instance.canonicalize("&#000060;")); assertEquals( "<", instance.canonicalize("&#0000060;")); assertEquals( "<", instance.canonicalize("&#x3c")); assertEquals( "<", instance.canonicalize("&#x03c")); assertEquals( "<", instance.canonicalize("&#x003c")); assertEquals( "<", instance.canonicalize("&#x0003c")); assertEquals( "<", instance.canonicalize("&#x00003c")); assertEquals( "<", instance.canonicalize("&#x000003c")); assertEquals( "<", instance.canonicalize("&#x3c;")); assertEquals( "<", instance.canonicalize("&#x03c;")); assertEquals( "<", instance.canonicalize("&#x003c;")); assertEquals( "<", instance.canonicalize("&#x0003c;")); assertEquals( "<", instance.canonicalize("&#x00003c;")); assertEquals( "<", instance.canonicalize("&#x000003c;")); assertEquals( "<", instance.canonicalize("&#X3c")); assertEquals( "<", instance.canonicalize("&#X03c")); assertEquals( "<", instance.canonicalize("&#X003c")); assertEquals( "<", instance.canonicalize("&#X0003c")); assertEquals( "<", instance.canonicalize("&#X00003c")); assertEquals( "<", instance.canonicalize("&#X000003c")); assertEquals( "<", instance.canonicalize("&#X3c;")); assertEquals( "<", instance.canonicalize("&#X03c;")); assertEquals( "<", instance.canonicalize("&#X003c;")); assertEquals( "<", instance.canonicalize("&#X0003c;")); assertEquals( "<", instance.canonicalize("&#X00003c;")); assertEquals( "<", instance.canonicalize("&#X000003c;")); assertEquals( "<", instance.canonicalize("&#x3C")); assertEquals( "<", instance.canonicalize("&#x03C")); assertEquals( "<", instance.canonicalize("&#x003C")); assertEquals( "<", instance.canonicalize("&#x0003C")); assertEquals( "<", instance.canonicalize("&#x00003C")); assertEquals( "<", instance.canonicalize("&#x000003C")); assertEquals( "<", instance.canonicalize("&#x3C;")); assertEquals( "<", instance.canonicalize("&#x03C;")); assertEquals( "<", instance.canonicalize("&#x003C;")); assertEquals( "<", instance.canonicalize("&#x0003C;")); assertEquals( "<", instance.canonicalize("&#x00003C;")); assertEquals( "<", instance.canonicalize("&#x000003C;")); assertEquals( "<", instance.canonicalize("&#X3C")); assertEquals( "<", instance.canonicalize("&#X03C")); assertEquals( "<", instance.canonicalize("&#X003C")); assertEquals( "<", instance.canonicalize("&#X0003C")); assertEquals( "<", instance.canonicalize("&#X00003C")); assertEquals( "<", instance.canonicalize("&#X000003C")); assertEquals( "<", instance.canonicalize("&#X3C;")); assertEquals( "<", instance.canonicalize("&#X03C;")); assertEquals( "<", instance.canonicalize("&#X003C;")); assertEquals( "<", instance.canonicalize("&#X0003C;")); assertEquals( "<", instance.canonicalize("&#X00003C;")); assertEquals( "<", instance.canonicalize("&#X000003C;")); assertEquals( "<", instance.canonicalize("&lt")); assertEquals( "<", instance.canonicalize("&lT")); assertEquals( "<", instance.canonicalize("&Lt")); assertEquals( "<", instance.canonicalize("&LT")); assertEquals( "<", instance.canonicalize("&lt;")); assertEquals( "<", instance.canonicalize("&lT;")); assertEquals( "<", instance.canonicalize("&Lt;")); assertEquals( "<", instance.canonicalize("&LT;")); assertEquals( "<script>alert(\"hello\");</script>", instance.canonicalize("%3Cscript%3Ealert%28%22hello%22%29%3B%3C%2Fscript%3E") ); assertEquals( "<script>alert(\"hello\");</script>", instance.canonicalize("%3Cscript&#x3E;alert%28%22hello&#34%29%3B%3C%2Fscript%3E", false) ); // javascript escape syntax ArrayList<String> js = new ArrayList<String>(); js.add( "JavaScriptCodec" ); instance = new DefaultEncoder( js ); System.out.println( "JavaScript Decoding" ); assertEquals( "\0", instance.canonicalize("\\0")); assertEquals( "\b", instance.canonicalize("\\b")); assertEquals( "\t", instance.canonicalize("\\t")); assertEquals( "\n", instance.canonicalize("\\n")); assertEquals( ""+(char)0x0b, instance.canonicalize("\\v")); assertEquals( "\f", instance.canonicalize("\\f")); assertEquals( "\r", instance.canonicalize("\\r")); assertEquals( "\'", instance.canonicalize("\\'")); assertEquals( "\"", instance.canonicalize("\\\"")); assertEquals( "\\", instance.canonicalize("\\\\")); assertEquals( "<", instance.canonicalize("\\<")); assertEquals( "<", instance.canonicalize("\\u003c")); assertEquals( "<", instance.canonicalize("\\U003c")); assertEquals( "<", instance.canonicalize("\\u003C")); assertEquals( "<", instance.canonicalize("\\U003C")); assertEquals( "<", instance.canonicalize("\\x3c")); assertEquals( "<", instance.canonicalize("\\X3c")); assertEquals( "<", instance.canonicalize("\\x3C")); assertEquals( "<", instance.canonicalize("\\X3C")); // css escape syntax // be careful because some codecs see \0 as null byte ArrayList<String> css = new ArrayList<String>(); css.add( "CSSCodec" ); instance = new DefaultEncoder( css ); System.out.println( "CSS Decoding" ); assertEquals( "<", instance.canonicalize("\\3c")); // add strings to prevent null byte assertEquals( "<", instance.canonicalize("\\03c")); assertEquals( "<", instance.canonicalize("\\003c")); assertEquals( "<", instance.canonicalize("\\0003c")); assertEquals( "<", instance.canonicalize("\\00003c")); assertEquals( "<", instance.canonicalize("\\3C")); assertEquals( "<", instance.canonicalize("\\03C")); assertEquals( "<", instance.canonicalize("\\003C")); assertEquals( "<", instance.canonicalize("\\0003C")); assertEquals( "<", instance.canonicalize("\\00003C")); }
void function() throws EncodingException { System.out.println(STR); ArrayList<String> list = new ArrayList<String>(); list.add( STR ); list.add( STR ); Encoder instance = new DefaultEncoder( list ); assertEquals( null, instance.canonicalize(null)); assertEquals( null, instance.canonicalize(null, true)); assertEquals( null, instance.canonicalize(null, false)); assertEquals( null, instance.canonicalize(null, true, true)); assertEquals( null, instance.canonicalize(null, true, false)); assertEquals( null, instance.canonicalize(null, false, true)); assertEquals( null, instance.canonicalize(null, false, false)); assertEquals( "%STR%25", true)); assertEquals( "%STR%25", false)); assertEquals( "%STR%25STR%FSTR%25FSTR<STR%3cSTR<STR%3CSTR%X1STR%X1STR<STR&ltSTR<STR&LTSTR<STR&lt;STR<STR&LT;STR%STR&#37;STR%STR&#37STR%bSTR&#37bSTR<STR&#x3cSTR<", instance.canonicalize(STR)); assertEquals( "<STR&#x3CSTR<STR&#X3cSTR<STR&#X3CSTR<", instance.canonicalize(STR)); assertEquals( "<STR%3cSTR<STR%3CSTR<STR&#60STR<STR&#060STR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&#60;STR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&#x3cSTR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&#X3cSTR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&#x3CSTR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&#X3CSTR<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<", instance.canonicalize(STR)); assertEquals( "<STR&ltSTR<STR&lTSTR<STR&LtSTR<STR&LTSTR<STR&lt;STR<STR&lT;STR<STR&Lt;STR<STR&LT;")); assertEquals( STRhello\STR, instance.canonicalize(STR) ); assertEquals( STRhello\STR, instance.canonicalize(STR, false) ); ArrayList<String> js = new ArrayList<String>(); js.add( STR ); instance = new DefaultEncoder( js ); System.out.println( STR ); assertEquals( "\0STR\\0STR\bSTR\\bSTR\tSTR\\tSTR\nSTR\\n")); assertEquals( STR\\vSTR\fSTR\\fSTR\rSTR\\rSTR\'STR\\'STR\"STR\\\"STR\\STR\\\\STR<STR\\<STR<STR\\u003cSTR<STR\\U003cSTR<STR\\u003CSTR<STR\\U003CSTR<STR\\x3cSTR<STR\\X3cSTR<STR\\x3CSTR<STR\\X3CSTRCSSCodecSTRCSS DecodingSTR<STR\\3cSTR<STR\\03cSTR<STR\\003cSTR<STR\\0003cSTR<STR\\00003cSTR<STR\\3CSTR<STR\\03CSTR<STR\\003CSTR<STR\\0003CSTR<STR\\00003C")); }
/** * Test of canonicalize method, of class org.owasp.esapi.Encoder. * * @throws EncodingException */
Test of canonicalize method, of class org.owasp.esapi.Encoder
testCanonicalize
{ "repo_name": "marylinh/ESAPI_JAVA_ALL", "path": "src/test/java/org/owasp/esapi/reference/EncoderTest.java", "license": "bsd-3-clause", "size": 35801 }
[ "java.util.ArrayList", "org.owasp.esapi.Encoder", "org.owasp.esapi.errors.EncodingException" ]
import java.util.ArrayList; import org.owasp.esapi.Encoder; import org.owasp.esapi.errors.EncodingException;
import java.util.*; import org.owasp.esapi.*; import org.owasp.esapi.errors.*;
[ "java.util", "org.owasp.esapi" ]
java.util; org.owasp.esapi;
2,119,786
@PublicEvolving public ResourceSpec getMinResources() { return transformation.getMinResources(); }
ResourceSpec function() { return transformation.getMinResources(); }
/** * Gets the minimum resources for this operator. * * @return The minimum resources set for this operator. */
Gets the minimum resources for this operator
getMinResources
{ "repo_name": "darionyaphet/flink", "path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java", "license": "apache-2.0", "size": 51499 }
[ "org.apache.flink.api.common.operators.ResourceSpec" ]
import org.apache.flink.api.common.operators.ResourceSpec;
import org.apache.flink.api.common.operators.*;
[ "org.apache.flink" ]
org.apache.flink;
2,783,790
Chunk getChunk();
Chunk getChunk();
/** * Gets the chunk which contains this block * * @return Containing Chunk */
Gets the chunk which contains this block
getChunk
{ "repo_name": "Scrik/Cauldron-1", "path": "eclipse/cauldron/src/main/java/org/bukkit/block/Block.java", "license": "gpl-3.0", "size": 9885 }
[ "org.bukkit.Chunk" ]
import org.bukkit.Chunk;
import org.bukkit.*;
[ "org.bukkit" ]
org.bukkit;
1,166,666
@ApiModelProperty(value = "The postal code for the billing address.") public String getPreviousUri() { return previousUri; }
@ApiModelProperty(value = STR) String function() { return previousUri; }
/** * The postal code for the billing address.. * @return previousUri **/
The postal code for the billing address.
getPreviousUri
{ "repo_name": "docusign/docusign-java-client", "path": "src/main/java/com/docusign/esign/model/BillingPaymentsResponse.java", "license": "mit", "size": 4576 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,916,090
public static java.util.Set extractPathwayHistorySet(ims.domain.ILightweightDomainFactory domainFactory, ims.pathways.vo.PathwayHistoryVoCollection voCollection) { return extractPathwayHistorySet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.pathways.vo.PathwayHistoryVoCollection voCollection) { return extractPathwayHistorySet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.pathways.domain.objects.PathwayHistory set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.pathways.domain.objects.PathwayHistory set from the value object collection
extractPathwayHistorySet
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/pathways/vo/domain/PathwayHistoryVoAssembler.java", "license": "agpl-3.0", "size": 17981 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
979,832
private static AnalyticsInfoDTO toAnalyticsDTO(RegistrationSummary registrationSummary) { AnalyticsInfoDTO analyticsInfoDTO = new AnalyticsInfoDTO(); analyticsInfoDTO.serverURL(registrationSummary.getAnalyticsInfo().getDasServerURL()); analyticsInfoDTO.setEnabled(registrationSummary.getAnalyticsInfo().isEnabled()); CredentialsDTO analyticsServerCredentials = new CredentialsDTO(); analyticsServerCredentials.setUsername(registrationSummary.getAnalyticsInfo().getDasServerCredentials() .getUsername()); analyticsServerCredentials.setPassword(registrationSummary.getAnalyticsInfo().getDasServerCredentials() .getPassword()); analyticsInfoDTO.setCredentials(analyticsServerCredentials); return analyticsInfoDTO; }
static AnalyticsInfoDTO function(RegistrationSummary registrationSummary) { AnalyticsInfoDTO analyticsInfoDTO = new AnalyticsInfoDTO(); analyticsInfoDTO.serverURL(registrationSummary.getAnalyticsInfo().getDasServerURL()); analyticsInfoDTO.setEnabled(registrationSummary.getAnalyticsInfo().isEnabled()); CredentialsDTO analyticsServerCredentials = new CredentialsDTO(); analyticsServerCredentials.setUsername(registrationSummary.getAnalyticsInfo().getDasServerCredentials() .getUsername()); analyticsServerCredentials.setPassword(registrationSummary.getAnalyticsInfo().getDasServerCredentials() .getPassword()); analyticsInfoDTO.setCredentials(analyticsServerCredentials); return analyticsInfoDTO; }
/** * Converts RegistrationSummary analytics information into AnalyticsInfoDTO * * @param registrationSummary the registration summary required by gateway * @return AnalyticsInfoDTO */
Converts RegistrationSummary analytics information into AnalyticsInfoDTO
toAnalyticsDTO
{ "repo_name": "abimarank/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.core/src/main/java/org/wso2/carbon/apimgt/rest/api/core/utils/MappingUtil.java", "license": "apache-2.0", "size": 15421 }
[ "org.wso2.carbon.apimgt.core.models.RegistrationSummary", "org.wso2.carbon.apimgt.rest.api.core.dto.AnalyticsInfoDTO", "org.wso2.carbon.apimgt.rest.api.core.dto.CredentialsDTO" ]
import org.wso2.carbon.apimgt.core.models.RegistrationSummary; import org.wso2.carbon.apimgt.rest.api.core.dto.AnalyticsInfoDTO; import org.wso2.carbon.apimgt.rest.api.core.dto.CredentialsDTO;
import org.wso2.carbon.apimgt.core.models.*; import org.wso2.carbon.apimgt.rest.api.core.dto.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,327,843
protected static List<File> getExpectedOutputFile( File dir, String baseName ) { List<File> files = new ArrayList<File>(); File expected = new File( dir, baseName + ".fail.txt" ); if ( expected.exists() ) { files.add( expected ); } for ( String extension : new String[] { ".txt", ".csv", ".xml" } ) { expected = new File( dir, baseName + ".expected" + extension ); if ( expected.exists() ) { files.add( expected ); } // now see if there are perhaps multiple files generated... // boolean found = true; int nr = 0; while ( found ) { expected = new File( dir, baseName + ".expected_" + nr + extension ); if ( expected.exists() ) { files.add( expected ); nr++; } else { found = false; } } } return files; }
static List<File> function( File dir, String baseName ) { List<File> files = new ArrayList<File>(); File expected = new File( dir, baseName + STR ); if ( expected.exists() ) { files.add( expected ); } for ( String extension : new String[] { ".txt", ".csv", ".xml" } ) { expected = new File( dir, baseName + STR + extension ); if ( expected.exists() ) { files.add( expected ); } int nr = 0; while ( found ) { expected = new File( dir, baseName + STR + nr + extension ); if ( expected.exists() ) { files.add( expected ); nr++; } else { found = false; } } } return files; }
/** * Tries to find an output file to match a transformation or job file * * @param dir * The directory to look in * @param baseName * Name of the transformation or the job without the extension * @return list of output files */
Tries to find an output file to match a transformation or job file
getExpectedOutputFile
{ "repo_name": "apratkin/pentaho-kettle", "path": "test/org/pentaho/di/blackbox/BlackBoxTests.java", "license": "apache-2.0", "size": 13564 }
[ "java.io.File", "java.util.ArrayList", "java.util.List" ]
import java.io.File; import java.util.ArrayList; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
684,437
interface UpdateStages { interface WithTags { Update withTags(Map<String, String> tags); } }
interface UpdateStages { interface WithTags { Update withTags(Map<String, String> tags); } }
/** * Specifies the tags property: Resource tags. * * @param tags Resource tags. * @return the next definition stage. */
Specifies the tags property: Resource tags
withTags
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/deviceprovisioningservices/azure-resourcemanager-deviceprovisioningservices/src/main/java/com/azure/resourcemanager/deviceprovisioningservices/models/ProvisioningServiceDescription.java", "license": "mit", "size": 10004 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,256,567
public Map<IndexDescriptor, IndexConditionInfo> getFirstKeyIndexConditionMap() { Map<IndexDescriptor, IndexConditionInfo> indexInfoMap = Maps.newLinkedHashMap(); RexNode initCondition = condition; for (IndexDescriptor index : indexes) { List<LogicalExpression> leadingColumns = new ArrayList<>(); if (initCondition.isAlwaysTrue()) { break; } // TODO: Ensure we dont get NULL pointer exceptions leadingColumns.add(index.getIndexColumns().get(0)); IndexConditionInfo info = indexConditionRelatedToFields(leadingColumns, initCondition); if (info == null || info.hasIndexCol == false) { // No info found, based on remaining condition. Check if the leading columns are same as another index IndexConditionInfo origInfo = indexConditionRelatedToFields(leadingColumns, condition); if (origInfo == null || origInfo.hasIndexCol == false) { // do nothing } else { indexInfoMap.put(index, origInfo); // Leave the initCondition as-is, since this is a duplicate condition } continue; } indexInfoMap.put(index, info); initCondition = info.remainderCondition; } return indexInfoMap; }
Map<IndexDescriptor, IndexConditionInfo> function() { Map<IndexDescriptor, IndexConditionInfo> indexInfoMap = Maps.newLinkedHashMap(); RexNode initCondition = condition; for (IndexDescriptor index : indexes) { List<LogicalExpression> leadingColumns = new ArrayList<>(); if (initCondition.isAlwaysTrue()) { break; } leadingColumns.add(index.getIndexColumns().get(0)); IndexConditionInfo info = indexConditionRelatedToFields(leadingColumns, initCondition); if (info == null info.hasIndexCol == false) { IndexConditionInfo origInfo = indexConditionRelatedToFields(leadingColumns, condition); if (origInfo == null origInfo.hasIndexCol == false) { } else { indexInfoMap.put(index, origInfo); } continue; } indexInfoMap.put(index, info); initCondition = info.remainderCondition; } return indexInfoMap; }
/** * Get a map of Index=>IndexConditionInfo, each IndexConditionInfo has the separated condition and remainder condition. * The map is ordered, so the last IndexDescriptor will have the final remainderCondition after separating conditions * that are relevant to this.indexes. The conditions are separated on LEADING index columns. * @return Map containing index{@link IndexDescriptor} and condition {@link IndexConditionInfo} pairs */
Get a map of Index=>IndexConditionInfo, each IndexConditionInfo has the separated condition and remainder condition. The map is ordered, so the last IndexDescriptor will have the final remainderCondition after separating conditions that are relevant to this.indexes. The conditions are separated on LEADING index columns
getFirstKeyIndexConditionMap
{ "repo_name": "apache/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/index/IndexConditionInfo.java", "license": "apache-2.0", "size": 10612 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "org.apache.calcite.rex.RexNode", "org.apache.drill.common.expression.LogicalExpression", "org.apache.drill.shaded.guava.com.google.common.collect.Maps" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.calcite.rex.RexNode; import org.apache.drill.common.expression.LogicalExpression; import org.apache.drill.shaded.guava.com.google.common.collect.Maps;
import java.util.*; import org.apache.calcite.rex.*; import org.apache.drill.common.expression.*; import org.apache.drill.shaded.guava.com.google.common.collect.*;
[ "java.util", "org.apache.calcite", "org.apache.drill" ]
java.util; org.apache.calcite; org.apache.drill;
1,548,614
void addException(String word, ArrayList hyphenatedword);
void addException(String word, ArrayList hyphenatedword);
/** * Add a hyphenation exception. An exception replaces the * result obtained by the algorithm for cases for which this * fails or the user wants to provide his own hyphenation. * A hyphenatedword is a vector of alternating String's and * {@link Hyphen Hyphen} instances */
Add a hyphenation exception. An exception replaces the result obtained by the algorithm for cases for which this fails or the user wants to provide his own hyphenation. A hyphenatedword is a vector of alternating String's and <code>Hyphen Hyphen</code> instances
addException
{ "repo_name": "venanciolm/afirma-ui-miniapplet_x_x", "path": "afirma_ui_miniapplet/src/main/java/com/lowagie/text/pdf/hyphenation/PatternConsumer.java", "license": "mit", "size": 1765 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,895,351
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginRestoreFiles( String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotRestoreFiles body, Context context);
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginRestoreFiles( String resourceGroupName, String accountName, String poolName, String volumeName, String snapshotName, SnapshotRestoreFiles body, Context context);
/** * Restore the specified files from the specified snapshot to the active filesystem. * * @param resourceGroupName The name of the resource group. * @param accountName The name of the NetApp account. * @param poolName The name of the capacity pool. * @param volumeName The name of the volume. * @param snapshotName The name of the snapshot. * @param body Restore payload supplied in the body of the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 {@link SyncPoller} for polling of long-running operation. */
Restore the specified files from the specified snapshot to the active filesystem
beginRestoreFiles
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/SnapshotsClient.java", "license": "mit", "size": 21515 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.netapp.models.SnapshotRestoreFiles" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.netapp.models.SnapshotRestoreFiles;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.netapp.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,073,388
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ReservationSummaryInner> list(String scope, Datagrain grain) { final String startDate = null; final String endDate = null; final String filter = null; final String reservationId = null; final String reservationOrderId = null; return new PagedIterable<>( listAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ReservationSummaryInner> function(String scope, Datagrain grain) { final String startDate = null; final String endDate = null; final String filter = null; final String reservationId = null; final String reservationOrderId = null; return new PagedIterable<>( listAsync(scope, grain, startDate, endDate, filter, reservationId, reservationOrderId)); }
/** * Lists the reservations summaries for the defined scope daily or monthly grain. * * @param scope The scope associated with reservations summaries operations. This includes * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for BillingAccount scope (legacy), and * '/providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for * BillingProfile scope (modern). * @param grain Can be daily or monthly. * @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 result of listing reservation summaries. */
Lists the reservations summaries for the defined scope daily or monthly grain
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/consumption/azure-resourcemanager-consumption/src/main/java/com/azure/resourcemanager/consumption/implementation/ReservationsSummariesClientImpl.java", "license": "mit", "size": 53960 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner", "com.azure.resourcemanager.consumption.models.Datagrain" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.consumption.fluent.models.ReservationSummaryInner; import com.azure.resourcemanager.consumption.models.Datagrain;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.consumption.fluent.models.*; import com.azure.resourcemanager.consumption.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
589,492
@Deprecated @JsonProperty("booleanDataTypeRefsetIdentifier") public String getBooleanDatatypeRefsetIdentifier() { return booleanDatatypeRefsetIdentifier; }
@JsonProperty(STR) String function() { return booleanDatatypeRefsetIdentifier; }
/** * The ID of the boolean datatype reference set identifier concept * * @return the booleanDatatypeRefsetIdentifier */
The ID of the boolean datatype reference set identifier concept
getBooleanDatatypeRefsetIdentifier
{ "repo_name": "b2ihealthcare/snow-owl", "path": "snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/config/SnomedCoreConfiguration.java", "license": "apache-2.0", "size": 7645 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,160,681
@XmlElementWrapper(name = "epcs") @XmlElement(name = "epc") public List<ElectronicProductCode> getEpcEntry() { return epcEntry; }
@XmlElementWrapper(name = "epcs") @XmlElement(name = "epc") List<ElectronicProductCode> function() { return epcEntry; }
/** * Method description * * * @return */
Method description
getEpcEntry
{ "repo_name": "Fosstrak/fosstrak-webadapters", "path": "src/main/java/org/fosstrak/webadapters/epcis/model/events/ObjectEvent.java", "license": "gpl-3.0", "size": 6128 }
[ "java.util.List", "javax.xml.bind.annotation.XmlElement", "javax.xml.bind.annotation.XmlElementWrapper", "org.fosstrak.webadapters.epcis.model.epc.ElectronicProductCode" ]
import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import org.fosstrak.webadapters.epcis.model.epc.ElectronicProductCode;
import java.util.*; import javax.xml.bind.annotation.*; import org.fosstrak.webadapters.epcis.model.epc.*;
[ "java.util", "javax.xml", "org.fosstrak.webadapters" ]
java.util; javax.xml; org.fosstrak.webadapters;
1,633,670
public final Rectangle mouseDragged(final MouseEvent e) { if (resizeDirection == RESIZE_NONE) { Point p = keepPointInsideOfDragArea(e); p.translate(-start.x, -start.y); Rectangle r = oldBounds.getBounds(); r.translate(p.x, p.y); return r; } return getNewBounds(e); }
final Rectangle function(final MouseEvent e) { if (resizeDirection == RESIZE_NONE) { Point p = keepPointInsideOfDragArea(e); p.translate(-start.x, -start.y); Rectangle r = oldBounds.getBounds(); r.translate(p.x, p.y); return r; } return getNewBounds(e); }
/** * This function is called when the mouse is dragged during * resizing/moving operation. It receives the <code>MOUSE_DRAGGED</code> * event and returns the new bounds of the component being dragged/resized. * * @param e the <code>MOUSE_DRAGGED</code> event * * @return the new bounds of the component being dragged/resized */
This function is called when the mouse is dragged during resizing/moving operation. It receives the <code>MOUSE_DRAGGED</code> event and returns the new bounds of the component being dragged/resized
mouseDragged
{ "repo_name": "skyHALud/codenameone", "path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/swing/src/main/java/common/org/apache/harmony/x/swing/ComponentDragImplHelper.java", "license": "gpl-2.0", "size": 15198 }
[ "java.awt.Point", "java.awt.Rectangle", "java.awt.event.MouseEvent" ]
import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent;
import java.awt.*; import java.awt.event.*;
[ "java.awt" ]
java.awt;
834,528
public Path getPathToAllLibsDir() { return getBinPath(); }
Path function() { return getBinPath(); }
/** * Returns the path that is the immediate parent of {@link #getPathToNativeLibsAssetsDir()} and * {@link #getPathToNativeLibsDir()}. */
Returns the path that is the immediate parent of <code>#getPathToNativeLibsAssetsDir()</code> and <code>#getPathToNativeLibsDir()</code>
getPathToAllLibsDir
{ "repo_name": "raviagarwal7/buck", "path": "src/com/facebook/buck/android/CopyNativeLibraries.java", "license": "apache-2.0", "size": 13826 }
[ "java.nio.file.Path" ]
import java.nio.file.Path;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
2,220,383
try { ResourceBundle resourceBundle; resourceBundle = ResourceBundle.getBundle(bundleName, locale); return MessageFormat.format(resourceBundle.getString(key), param); } catch (MissingResourceException e) { return "!!" + key + "!!"; } }
try { ResourceBundle resourceBundle; resourceBundle = ResourceBundle.getBundle(bundleName, locale); return MessageFormat.format(resourceBundle.getString(key), param); } catch (MissingResourceException e) { return "!!" + key + "!!"; } }
/** * Return the corresponding value of a given key and string parameter. * @param key the given key * @param bundleName the bundle name * @param params the parameter * @return the corresponding key value */
Return the corresponding value of a given key and string parameter
getString
{ "repo_name": "jph-axelor/axelor-business-suite", "path": "axelor-account/src/main/java/com/axelor/apps/account/ebics/messages/Messages.java", "license": "agpl-3.0", "size": 5057 }
[ "java.text.MessageFormat", "java.util.MissingResourceException", "java.util.ResourceBundle" ]
import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
647,117
public void render(Graphics g){ //draw box g.setColor(cBg); g.fillRect(x, y, width, height); //write string g.setColor(cText); g.drawString(getText(), x+4, y+14); }
void function(Graphics g){ g.setColor(cBg); g.fillRect(x, y, width, height); g.setColor(cText); g.drawString(getText(), x+4, y+14); }
/** * Render the button * @param g */
Render the button
render
{ "repo_name": "wcecil/colony-game", "path": "src/colonygame/ui/UIButton.java", "license": "cc0-1.0", "size": 1996 }
[ "java.awt.Graphics" ]
import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,355,590
public int getPrecision(int column) throws SQLException { Field f = getField(column); if (f.getMysqlType().isDecimal()) { if (f.getDecimals() > 0) { return clampedGetLength(f) - 1 + getPrecisionAdjustFactor(f); } return clampedGetLength(f) + getPrecisionAdjustFactor(f); } switch (f.getMysqlType()) { case TINYBLOB: case BLOB: case MEDIUMBLOB: case LONGBLOB: // for binary BLOBS returning the full length, *TEXT types are handled by default clause below return clampedGetLength(f); default: return clampedGetLength(f) / this.session.getServerSession().getMaxBytesPerChar(f.getCollationIndex(), f.getEncoding()); } }
int function(int column) throws SQLException { Field f = getField(column); if (f.getMysqlType().isDecimal()) { if (f.getDecimals() > 0) { return clampedGetLength(f) - 1 + getPrecisionAdjustFactor(f); } return clampedGetLength(f) + getPrecisionAdjustFactor(f); } switch (f.getMysqlType()) { case TINYBLOB: case BLOB: case MEDIUMBLOB: case LONGBLOB: return clampedGetLength(f); default: return clampedGetLength(f) / this.session.getServerSession().getMaxBytesPerChar(f.getCollationIndex(), f.getEncoding()); } }
/** * What is a column's number of decimal digits. * * @param column * the first column is 1, the second is 2... * * @return the precision * * @throws SQLException * if a database access error occurs */
What is a column's number of decimal digits
getPrecision
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/mysql-connector/com/mysql/cj/jdbc/result/ResultSetMetaData.java", "license": "gpl-2.0", "size": 20084 }
[ "com.mysql.cj.result.Field", "java.sql.SQLException" ]
import com.mysql.cj.result.Field; import java.sql.SQLException;
import com.mysql.cj.result.*; import java.sql.*;
[ "com.mysql.cj", "java.sql" ]
com.mysql.cj; java.sql;
261,710
@Function(name = "next", arity = 0, nativeId = SetIteratorPrototypeNext.class) public static Object next(ExecutionContext cx, Object thisValue) { if (!(thisValue instanceof SetIteratorObject)) { throw newTypeError(cx, Messages.Key.IncompatibleThis, "%SetIteratorPrototype%.next", Type.of(thisValue).toString()); } SetIteratorObject o = (SetIteratorObject) thisValue; Iterator<Entry<Object, Void>> iter = o.getIterator(); SetIterationKind itemKind = o.getIterationKind(); if (iter == null) { return CreateIterResultObject(cx, UNDEFINED, true); } if (iter.hasNext()) { Entry<Object, Void> e = iter.next(); Object result; if (itemKind != SetIterationKind.KeyValue) { result = e.getKey(); } else { result = CreateArrayFromList(cx, e.getKey(), e.getKey()); } return CreateIterResultObject(cx, result, false); } o.setIterator(null); return CreateIterResultObject(cx, UNDEFINED, true); } @Value(name = "[Symbol.toStringTag]", symbol = BuiltinSymbol.toStringTag, attributes = @Attributes(writable = false, enumerable = false, configurable = true)) public static final String toStringTag = "Set Iterator"; }
@Function(name = "next", arity = 0, nativeId = SetIteratorPrototypeNext.class) static Object function(ExecutionContext cx, Object thisValue) { if (!(thisValue instanceof SetIteratorObject)) { throw newTypeError(cx, Messages.Key.IncompatibleThis, STR, Type.of(thisValue).toString()); } SetIteratorObject o = (SetIteratorObject) thisValue; Iterator<Entry<Object, Void>> iter = o.getIterator(); SetIterationKind itemKind = o.getIterationKind(); if (iter == null) { return CreateIterResultObject(cx, UNDEFINED, true); } if (iter.hasNext()) { Entry<Object, Void> e = iter.next(); Object result; if (itemKind != SetIterationKind.KeyValue) { result = e.getKey(); } else { result = CreateArrayFromList(cx, e.getKey(), e.getKey()); } return CreateIterResultObject(cx, result, false); } o.setIterator(null); return CreateIterResultObject(cx, UNDEFINED, true); } @Value(name = STR, symbol = BuiltinSymbol.toStringTag, attributes = @Attributes(writable = false, enumerable = false, configurable = true)) public static final String toStringTag = STR; }
/** * 23.2.5.2.1 %SetIteratorPrototype%.next( ) * * @param cx * the execution context * @param thisValue * the function this-value * @return the next iterator result object */
23.2.5.2.1 %SetIteratorPrototype%.next( )
next
{ "repo_name": "anba/es6draft", "path": "src/main/java/com/github/anba/es6draft/runtime/objects/collection/SetIteratorPrototype.java", "license": "mit", "size": 6551 }
[ "com.github.anba.es6draft.runtime.AbstractOperations", "com.github.anba.es6draft.runtime.ExecutionContext", "com.github.anba.es6draft.runtime.internal.Errors", "com.github.anba.es6draft.runtime.internal.Messages", "com.github.anba.es6draft.runtime.internal.Properties", "com.github.anba.es6draft.runtime.objects.collection.SetIteratorObject", "com.github.anba.es6draft.runtime.types.BuiltinSymbol", "com.github.anba.es6draft.runtime.types.Type", "java.util.Iterator", "java.util.Map" ]
import com.github.anba.es6draft.runtime.AbstractOperations; import com.github.anba.es6draft.runtime.ExecutionContext; import com.github.anba.es6draft.runtime.internal.Errors; import com.github.anba.es6draft.runtime.internal.Messages; import com.github.anba.es6draft.runtime.internal.Properties; import com.github.anba.es6draft.runtime.objects.collection.SetIteratorObject; import com.github.anba.es6draft.runtime.types.BuiltinSymbol; import com.github.anba.es6draft.runtime.types.Type; import java.util.Iterator; import java.util.Map;
import com.github.anba.es6draft.runtime.*; import com.github.anba.es6draft.runtime.internal.*; import com.github.anba.es6draft.runtime.objects.collection.*; import com.github.anba.es6draft.runtime.types.*; import java.util.*;
[ "com.github.anba", "java.util" ]
com.github.anba; java.util;
2,487,055
boolean loadReader(Configuration.Item item, Reader reader) throws InterruptedException { int count = 0; try { Log.d(TAG, "loadBlockedHosts: Reading: " + item.location); try (BufferedReader br = new BufferedReader(reader)) { String line; while ((line = br.readLine()) != null) { if (Thread.interrupted()) throw new InterruptedException("Interrupted"); String host = parseLine(line); if (host != null) { count += 1; addHost(item, host); } } } Log.d(TAG, "loadBlockedHosts: Loaded " + count + " hosts from " + item.location); return true; } catch (IOException e) { Log.e(TAG, "loadBlockedHosts: Error while reading " + item.location + " after " + count + " items", e); return false; } finally { FileHelper.closeOrWarn(reader, TAG, "loadBlockedHosts: Error closing " + item.location); } }
boolean loadReader(Configuration.Item item, Reader reader) throws InterruptedException { int count = 0; try { Log.d(TAG, STR + item.location); try (BufferedReader br = new BufferedReader(reader)) { String line; while ((line = br.readLine()) != null) { if (Thread.interrupted()) throw new InterruptedException(STR); String host = parseLine(line); if (host != null) { count += 1; addHost(item, host); } } } Log.d(TAG, STR + count + STR + item.location); return true; } catch (IOException e) { Log.e(TAG, STR + item.location + STR + count + STR, e); return false; } finally { FileHelper.closeOrWarn(reader, TAG, STR + item.location); } }
/** * Load a single file * * @param item The configuration item referencing the file * @param reader A reader to read lines from * @throws InterruptedException If thread was interrupted */
Load a single file
loadReader
{ "repo_name": "julian-klode/dns66", "path": "app/src/main/java/org/jak_linux/dns66/db/RuleDatabase.java", "license": "gpl-3.0", "size": 7267 }
[ "android.util.Log", "java.io.BufferedReader", "java.io.IOException", "java.io.Reader", "org.jak_linux.dns66.Configuration", "org.jak_linux.dns66.FileHelper" ]
import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import org.jak_linux.dns66.Configuration; import org.jak_linux.dns66.FileHelper;
import android.util.*; import java.io.*; import org.jak_linux.dns66.*;
[ "android.util", "java.io", "org.jak_linux.dns66" ]
android.util; java.io; org.jak_linux.dns66;
1,150,377
void setTableProperties(Properties tableProperties) { this.tableProperties = tableProperties; }
void setTableProperties(Properties tableProperties) { this.tableProperties = tableProperties; }
/** * Set the table properties for this table. * * @param tableProperties The new table properties. */
Set the table properties for this table
setTableProperties
{ "repo_name": "apache/derby", "path": "java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/FromBaseTable.java", "license": "apache-2.0", "size": 160988 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,490,631
public boolean checkCertificate(byte[] certificate) throws AS400SecurityException, ErrorCompletingRequestException, ExtendedIOException, InterruptedException, IOException, ObjectDoesNotExistException { int rc; if (null == certificate) { Trace.log(Trace.ERROR, "Parameter 'certificate' is null."); throw new NullPointerException("certificate"); } if (isConnected() == false) connect(); //makes either remote or local call rc = vldlImpl_.callcheckCertificate( certificate, certificate.length, ifsPathName_, ifsPathName_.length(), 1); if (rc != SUCCESS) { throwException(vldlImpl_.cpfError_, ifsPathName_, rc); } return ((vldlImpl_.present_ == 1) ? true : false); }
boolean function(byte[] certificate) throws AS400SecurityException, ErrorCompletingRequestException, ExtendedIOException, InterruptedException, IOException, ObjectDoesNotExistException { int rc; if (null == certificate) { Trace.log(Trace.ERROR, STR); throw new NullPointerException(STR); } if (isConnected() == false) connect(); rc = vldlImpl_.callcheckCertificate( certificate, certificate.length, ifsPathName_, ifsPathName_.length(), 1); if (rc != SUCCESS) { throwException(vldlImpl_.cpfError_, ifsPathName_, rc); } return ((vldlImpl_.present_ == 1) ? true : false); }
/** * Determines if the certificate is in the validation list. * * @param certificate The ASN.1 encoded X.509 certificate to search for in the validation list. * * @return true if the certificate is found in the validation list; false otherwise. * * @exception AS400SecurityException If a security or authority error occurs. * @exception ErrorCompletingRequestException If an error occurs before the request is completed. * @exception ExtendedIllegalArgumentException If invalid certificate. * @exception ExtendedIOException If other IBM i certificate access errors. * @exception InterruptedException If this thread is interrupted. * @exception IOException If an error occurs while communicating with the system. * @exception ObjectDoesNotExistException If the IBM i object does not exist. */
Determines if the certificate is in the validation list
checkCertificate
{ "repo_name": "devjunix/libjt400-java", "path": "src/com/ibm/as400/access/AS400CertificateVldlUtil.java", "license": "epl-1.0", "size": 17731 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
27,412
public HtmlData getInquiryUrlForGeneralLedgerEntryDocumentNumber(Entry entry);
HtmlData function(Entry entry);
/** * When handed a GeneralLedger, determines and returns the url which will point to the labor ledger entries "inquiry" related to the given entry. * The url will be linked via the document number * @param entry an entry to find a labor ledger inquiry on the document number was * @return the inquiry HtmlData for the given general ledger entry */
When handed a GeneralLedger, determines and returns the url which will point to the labor ledger entries "inquiry" related to the given entry. The url will be linked via the document number
getInquiryUrlForGeneralLedgerEntryDocumentNumber
{ "repo_name": "bhutchinson/kfs", "path": "kfs-core/src/main/java/org/kuali/kfs/integration/ld/LaborModuleService.java", "license": "agpl-3.0", "size": 10774 }
[ "org.kuali.kfs.gl.businessobject.Entry", "org.kuali.rice.kns.lookup.HtmlData" ]
import org.kuali.kfs.gl.businessobject.Entry; import org.kuali.rice.kns.lookup.HtmlData;
import org.kuali.kfs.gl.businessobject.*; import org.kuali.rice.kns.lookup.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
1,421,560
protected BusinessObjectDefinitionEntity createBusinessObjectDefinitionEntity(String namespaceCode, String businessObjectDefinitionName, String dataProviderName, String businessObjectDefinitionDescription) { return createBusinessObjectDefinitionEntity(namespaceCode, businessObjectDefinitionName, dataProviderName, businessObjectDefinitionDescription, null); }
BusinessObjectDefinitionEntity function(String namespaceCode, String businessObjectDefinitionName, String dataProviderName, String businessObjectDefinitionDescription) { return createBusinessObjectDefinitionEntity(namespaceCode, businessObjectDefinitionName, dataProviderName, businessObjectDefinitionDescription, null); }
/** * Creates and persists a new business object definition. * * @return the newly created business object definition. */
Creates and persists a new business object definition
createBusinessObjectDefinitionEntity
{ "repo_name": "seoj/herd", "path": "herd-code/herd-dao/src/test/java/org/finra/herd/dao/AbstractDaoTest.java", "license": "apache-2.0", "size": 127305 }
[ "org.finra.herd.model.jpa.BusinessObjectDefinitionEntity" ]
import org.finra.herd.model.jpa.BusinessObjectDefinitionEntity;
import org.finra.herd.model.jpa.*;
[ "org.finra.herd" ]
org.finra.herd;
1,538,460
Node n1 = testRootNode.addNode(nodeName1, testNodeType); testRootNode.save(); assertEquals("Wrong node name.", n1.getName(), nodeName1); }
Node n1 = testRootNode.addNode(nodeName1, testNodeType); testRootNode.save(); assertEquals(STR, n1.getName(), nodeName1); }
/** * Tests if the name of the created node is correct. */
Tests if the name of the created node is correct
testName
{ "repo_name": "jalkanen/Priha", "path": "tests/tck/org/apache/jackrabbit/test/api/AddNodeTest.java", "license": "apache-2.0", "size": 7928 }
[ "javax.jcr.Node" ]
import javax.jcr.Node;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
150,594
public synchronized <K, V> MappingType createMap(IDType fromIDType, IDType toIDType, boolean isMultiMap, boolean createReverseMap) { MappingType mappingType = MappingType.registerMappingType(fromIDType, toIDType, isMultiMap, createReverseMap); if (hashMappingType2Map.containsKey(mappingType)) return mappingType; if (!mappingGraph.containsVertex(fromIDType)) mappingGraph.addVertex(fromIDType); if (!mappingGraph.containsVertex(toIDType)) mappingGraph.addVertex(toIDType); mappingGraph.addEdge(fromIDType, toIDType, mappingType); if (mappingType.isMultiMap()) { hashMappingType2Map.put(mappingType, new MultiHashMap<K, V>()); mappingGraph.setEdgeWeight(mappingType, Double.MAX_VALUE); } else { hashMappingType2Map.put(mappingType, new HashMap<K, V>()); mappingGraph.setEdgeWeight(mappingType, 1); } if (createReverseMap) { createReverseMap(mappingType); } if (idCategory.isPrimaryMappingTypeDefault()) { // in this case we need to create a mapping for the primary type to // non-internal types if (!fromIDType.isInternalType() && !fromIDType.equals(idCategory.getPrimaryMappingType()) && MappingType.getType(fromIDType, idCategory.getPrimaryMappingType()) == null) { createMap(fromIDType, idCategory.getPrimaryMappingType(), false, true); } if (!toIDType.isInternalType() && !toIDType.equals(idCategory.getPrimaryMappingType()) && MappingType.getType(toIDType, idCategory.getPrimaryMappingType()) == null) { createMap(toIDType, idCategory.getPrimaryMappingType(), false, true); } } return mappingType; }
synchronized <K, V> MappingType function(IDType fromIDType, IDType toIDType, boolean isMultiMap, boolean createReverseMap) { MappingType mappingType = MappingType.registerMappingType(fromIDType, toIDType, isMultiMap, createReverseMap); if (hashMappingType2Map.containsKey(mappingType)) return mappingType; if (!mappingGraph.containsVertex(fromIDType)) mappingGraph.addVertex(fromIDType); if (!mappingGraph.containsVertex(toIDType)) mappingGraph.addVertex(toIDType); mappingGraph.addEdge(fromIDType, toIDType, mappingType); if (mappingType.isMultiMap()) { hashMappingType2Map.put(mappingType, new MultiHashMap<K, V>()); mappingGraph.setEdgeWeight(mappingType, Double.MAX_VALUE); } else { hashMappingType2Map.put(mappingType, new HashMap<K, V>()); mappingGraph.setEdgeWeight(mappingType, 1); } if (createReverseMap) { createReverseMap(mappingType); } if (idCategory.isPrimaryMappingTypeDefault()) { if (!fromIDType.isInternalType() && !fromIDType.equals(idCategory.getPrimaryMappingType()) && MappingType.getType(fromIDType, idCategory.getPrimaryMappingType()) == null) { createMap(fromIDType, idCategory.getPrimaryMappingType(), false, true); } if (!toIDType.isInternalType() && !toIDType.equals(idCategory.getPrimaryMappingType()) && MappingType.getType(toIDType, idCategory.getPrimaryMappingType()) == null) { createMap(toIDType, idCategory.getPrimaryMappingType(), false, true); } } return mappingType; }
/** * <p> * Adds a new map for the specified mapping type. To fill that map with elements, use the * {@link #addMapping(MappingType, Object, Object)} method. * </p> * <p> * </p> * * @param <K> * Type of Keys of the map * @param <V> * Type of Values of the map * @param fromIDType * Specifies the source ID type. * @param toIDType * Specifies the target ID type. * @param isMultiMap * If true, a multi-map will be created (i.e,. multiple values of toIDType can map to one key), else only * a single key-value relationship is allowed * @param createReverseMap * Flag that determines whether the resolution of fromIDType to toIDType should also be created from * toIDType to fromIDType */
Adds a new map for the specified mapping type. To fill that map with elements, use the <code>#addMapping(MappingType, Object, Object)</code> method.
createMap
{ "repo_name": "Caleydo/caleydo", "path": "org.caleydo.core/src/org/caleydo/core/id/IDMappingManager.java", "license": "bsd-3-clause", "size": 31084 }
[ "java.util.HashMap", "java.util.Map", "org.caleydo.core.util.collection.MultiHashMap" ]
import java.util.HashMap; import java.util.Map; import org.caleydo.core.util.collection.MultiHashMap;
import java.util.*; import org.caleydo.core.util.collection.*;
[ "java.util", "org.caleydo.core" ]
java.util; org.caleydo.core;
2,691,111