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 boolean enter() throws KeeperException, InterruptedException{ zooKeeper.create(rootPath + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); while (true) { synchronized (mutex) { List<String> list = zooKeeper.getChildren(rootPath, true); if (list.size() < size) { mutex.wait(); } else { return true; } } } }
boolean function() throws KeeperException, InterruptedException{ zooKeeper.create(rootPath + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); while (true) { synchronized (mutex) { List<String> list = zooKeeper.getChildren(rootPath, true); if (list.size() < size) { mutex.wait(); } else { return true; } } } }
/** * Wait until required number of nodes join barrier * * @return true when required number of nodes have entered barrier, else wait * @throws KeeperException If a keeper exception occurred * @throws InterruptedException If interrupted */
Wait until required number of nodes join barrier
enter
{ "repo_name": "SalesforceEng/Argus", "path": "ArgusCore/src/main/java/com/salesforce/dva/argus/util/zookeeper/Barrier.java", "license": "bsd-3-clause", "size": 6002 }
[ "java.util.List", "org.apache.zookeeper.CreateMode", "org.apache.zookeeper.KeeperException", "org.apache.zookeeper.ZooDefs" ]
import java.util.List; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.ZooDefs;
import java.util.*; import org.apache.zookeeper.*;
[ "java.util", "org.apache.zookeeper" ]
java.util; org.apache.zookeeper;
254,052
@Override @Transactional(propagation = Propagation.REQUIRES_NEW) public EmrCluster getCluster(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, String emrClusterId, String emrStepId, boolean verbose, boolean retrieveOozieJobs) throws Exception { return getClusterImpl(emrClusterAlternateKeyDto, emrClusterId, emrStepId, verbose, retrieveOozieJobs); }
@Transactional(propagation = Propagation.REQUIRES_NEW) EmrCluster function(EmrClusterAlternateKeyDto emrClusterAlternateKeyDto, String emrClusterId, String emrStepId, boolean verbose, boolean retrieveOozieJobs) throws Exception { return getClusterImpl(emrClusterAlternateKeyDto, emrClusterId, emrStepId, verbose, retrieveOozieJobs); }
/** * Gets details of an existing EMR Cluster. Creates its own transaction. * * @param emrClusterAlternateKeyDto the EMR cluster alternate key * @param emrClusterId the cluster id of the cluster to get details * @param emrStepId the step id of the step to get details * @param verbose parameter for whether to return detailed information * @param retrieveOozieJobs parameter for whether to retrieve oozie job information * * @return the EMR Cluster object with details. * @throws Exception */
Gets details of an existing EMR Cluster. Creates its own transaction
getCluster
{ "repo_name": "seoj/herd", "path": "herd-code/herd-service/src/main/java/org/finra/herd/service/impl/EmrServiceImpl.java", "license": "apache-2.0", "size": 55398 }
[ "org.finra.herd.model.api.xml.EmrCluster", "org.finra.herd.model.dto.EmrClusterAlternateKeyDto", "org.springframework.transaction.annotation.Propagation", "org.springframework.transaction.annotation.Transactional" ]
import org.finra.herd.model.api.xml.EmrCluster; import org.finra.herd.model.dto.EmrClusterAlternateKeyDto; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional;
import org.finra.herd.model.api.xml.*; import org.finra.herd.model.dto.*; import org.springframework.transaction.annotation.*;
[ "org.finra.herd", "org.springframework.transaction" ]
org.finra.herd; org.springframework.transaction;
2,631,791
@Test(timeout=20000) public void test_ComboBoxes() throws Exception { test(ControlsFactory.ComboBoxes.name()); }
@Test(timeout=20000) void function() throws Exception { test(ControlsFactory.ComboBoxes.name()); }
/** * for ComboBoxes **/
for ComboBoxes
test_ComboBoxes
{ "repo_name": "teamfx/openjfx-8u-dev-tests", "path": "functional/ControlsTests/test/javafx/scene/control/test/focus/FocusOwnerRequestTest.java", "license": "gpl-2.0", "size": 7606 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,859,926
public static void initTableSnapshotMapperJob(String snapshotName, Scan scan, Class<? extends TableMapper> mapper, Class<?> outputKeyClass, Class<?> outputValueClass, Job job, boolean addDependencyJars, Path tmpRestoreDir) throws IOException { TableSnapshotInputFormat.setInput(job, snapshotName, tmpRestoreDir); initTableMapperJob(snapshotName, scan, mapper, outputKeyClass, outputValueClass, job, addDependencyJars, false, TableSnapshotInputFormat.class); resetCacheConfig(job.getConfiguration()); }
static void function(String snapshotName, Scan scan, Class<? extends TableMapper> mapper, Class<?> outputKeyClass, Class<?> outputValueClass, Job job, boolean addDependencyJars, Path tmpRestoreDir) throws IOException { TableSnapshotInputFormat.setInput(job, snapshotName, tmpRestoreDir); initTableMapperJob(snapshotName, scan, mapper, outputKeyClass, outputValueClass, job, addDependencyJars, false, TableSnapshotInputFormat.class); resetCacheConfig(job.getConfiguration()); }
/** * Sets up the job for reading from a table snapshot. It bypasses hbase servers * and read directly from snapshot files. * * @param snapshotName The name of the snapshot (of a table) to read from. * @param scan The scan instance with the columns, time range etc. * @param mapper The mapper class to use. * @param outputKeyClass The class of the output key. * @param outputValueClass The class of the output value. * @param job The current job to adjust. Make sure the passed job is * carrying all necessary HBase configuration. * @param addDependencyJars upload HBase jars and jars for any of the configured * job classes via the distributed cache (tmpjars). * * @param tmpRestoreDir a temporary directory to copy the snapshot files into. Current user should * have write permissions to this directory, and this should not be a subdirectory of rootdir. * After the job is finished, restore directory can be deleted. * @throws IOException When setting up the details fails. * @see TableSnapshotInputFormat */
Sets up the job for reading from a table snapshot. It bypasses hbase servers and read directly from snapshot files
initTableSnapshotMapperJob
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.java", "license": "apache-2.0", "size": 43465 }
[ "java.io.IOException", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.client.Scan", "org.apache.hadoop.mapreduce.Job" ]
import java.io.IOException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.mapreduce.Job;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.mapreduce.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,457,919
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { // Update the viewport height when the parent View's height changes (e.g. after rotation). int currentParentHeight = getParent() == null ? 0 : ((View) getParent()).getHeight(); if (mParentHeight != currentParentHeight) { mParentHeight = currentParentHeight; mGestureState = GESTURE_NONE; if (mCurrentAnimation != null) mCurrentAnimation.end(); } // Update the known effective height of the View. MarginLayoutParams params = (MarginLayoutParams) getLayoutParams(); mTotalHeight = getMeasuredHeight() + params.topMargin + params.bottomMargin; super.onLayout(changed, l, t, r, b); }
void function(boolean changed, int l, int t, int r, int b) { int currentParentHeight = getParent() == null ? 0 : ((View) getParent()).getHeight(); if (mParentHeight != currentParentHeight) { mParentHeight = currentParentHeight; mGestureState = GESTURE_NONE; if (mCurrentAnimation != null) mCurrentAnimation.end(); } MarginLayoutParams params = (MarginLayoutParams) getLayoutParams(); mTotalHeight = getMeasuredHeight() + params.topMargin + params.bottomMargin; super.onLayout(changed, l, t, r, b); }
/** * See {@link #android.view.ViewGroup.onLayout(boolean, int, int, int, int)}. */
See <code>#android.view.ViewGroup.onLayout(boolean, int, int, int, int)</code>
onLayout
{ "repo_name": "js0701/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/banners/SwipableOverlayView.java", "license": "bsd-3-clause", "size": 16516 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,346,854
public NoteCreateRequest contents(final String contents) throws ApiRequestException { checkNotNull(contents); NoteCreateRequest request = new NoteCreateRequest(this); request.contents = contents; return request; }
NoteCreateRequest function(final String contents) throws ApiRequestException { checkNotNull(contents); NoteCreateRequest request = new NoteCreateRequest(this); request.contents = contents; return request; }
/** * The ticket note contents. * * @param contents contents * @return request instance * @throws ApiRequestException in case argument is null */
The ticket note contents
contents
{ "repo_name": "penguinboy/kayako-api", "path": "src/main/java/org/penguin/kayako/TicketNoteConnector.java", "license": "mit", "size": 9507 }
[ "org.penguin.kayako.exception.ApiRequestException" ]
import org.penguin.kayako.exception.ApiRequestException;
import org.penguin.kayako.exception.*;
[ "org.penguin.kayako" ]
org.penguin.kayako;
2,445,663
protected File createSourceFile(String fileName, String javaCode, File pathToFolder) { // create new tempfile File tempfile = new File(pathToFolder, fileName + ".java"); // add the temp file to the tempfile array so we can delete it at the end this.tempfilelist.add(tempfile); // write sourcecode into tempfile try { BufferedWriter out = new BufferedWriter(new FileWriter(tempfile)); out.write(javaCode); out.close(); } catch (FileNotFoundException e) { } catch (IOException e) { } // return the tempfile return tempfile; }
File function(String fileName, String javaCode, File pathToFolder) { File tempfile = new File(pathToFolder, fileName + ".java"); this.tempfilelist.add(tempfile); try { BufferedWriter out = new BufferedWriter(new FileWriter(tempfile)); out.write(javaCode); out.close(); } catch (FileNotFoundException e) { } catch (IOException e) { } return tempfile; }
/** * Write the {@code javaCode} into a temporary file named {@code fileName} into the folder {@code pathToFolder}. * @param fileName The filename to the temporary file. * @param javaCode The java code which should be written into the temporary file. * @param pathToFolder The path where the temporary file should be saved. * @return The temporary file. */
Write the javaCode into a temporary file named fileName into the folder pathToFolder
createSourceFile
{ "repo_name": "lsubel/jmutops", "path": "testsrc/mutationoperators/BasicTest.java", "license": "mit", "size": 8461 }
[ "java.io.BufferedWriter", "java.io.File", "java.io.FileNotFoundException", "java.io.FileWriter", "java.io.IOException" ]
import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,459,462
public ListLoadResult<GwtPackageOperation> getDownloadOperations(String scopeShortId, String deviceShortId) throws GwtKapuaException;
ListLoadResult<GwtPackageOperation> function(String scopeShortId, String deviceShortId) throws GwtKapuaException;
/** * Get the status of downloads operations running on the device * * @param scopeShortId * device scope id in short form * @param deviceShortId * device id in short form * @return list of current running download operation on the device * * @throws GwtKapuaException * * @since 1.0.0 */
Get the status of downloads operations running on the device
getDownloadOperations
{ "repo_name": "muros-ct/kapua", "path": "org.eclipse.kapua.app.console/src/main/java/org/eclipse/kapua/app/console/shared/service/GwtDeviceManagementService.java", "license": "epl-1.0", "size": 5695 }
[ "com.extjs.gxt.ui.client.data.ListLoadResult", "org.eclipse.kapua.app.console.shared.GwtKapuaException", "org.eclipse.kapua.app.console.shared.model.device.management.packages.GwtPackageOperation" ]
import com.extjs.gxt.ui.client.data.ListLoadResult; import org.eclipse.kapua.app.console.shared.GwtKapuaException; import org.eclipse.kapua.app.console.shared.model.device.management.packages.GwtPackageOperation;
import com.extjs.gxt.ui.client.data.*; import org.eclipse.kapua.app.console.shared.*; import org.eclipse.kapua.app.console.shared.model.device.management.packages.*;
[ "com.extjs.gxt", "org.eclipse.kapua" ]
com.extjs.gxt; org.eclipse.kapua;
1,778,198
Object updateJob(Object job, Object imported, Object associate, Map params); /** * Validate the associated object for the job, the default validation will apply normal Property validation to the * value return from {@link #getInputPropertyValues(Object, Object)}
Object updateJob(Object job, Object imported, Object associate, Map params); /** * Validate the associated object for the job, the default validation will apply normal Property validation to the * value return from {@link #getInputPropertyValues(Object, Object)}
/** * Update a job given the imported definition or web parameters * @param job job to update, may be a new job * @param imported imported job definition to apply to update job, may be null * @param associate associated object created via {@link #importCanonicalMap(Object, Map)}, may be null * @param params web parameters * @return */
Update a job given the imported definition or web parameters
updateJob
{ "repo_name": "rundeck/rundeck", "path": "core/src/main/java/org/rundeck/app/components/jobs/JobDefinitionComponent.java", "license": "apache-2.0", "size": 4989 }
[ "com.dtolabs.rundeck.core.plugins.configuration.Property", "java.util.Map" ]
import com.dtolabs.rundeck.core.plugins.configuration.Property; import java.util.Map;
import com.dtolabs.rundeck.core.plugins.configuration.*; import java.util.*;
[ "com.dtolabs.rundeck", "java.util" ]
com.dtolabs.rundeck; java.util;
4,014
private static JdbcThinTcpIo io(Connection conn) throws Exception { JdbcThinConnection conn0 = conn.unwrap(JdbcThinConnection.class); return GridTestUtils.getFieldValue(conn0, JdbcThinConnection.class, "cliIo"); }
static JdbcThinTcpIo function(Connection conn) throws Exception { JdbcThinConnection conn0 = conn.unwrap(JdbcThinConnection.class); return GridTestUtils.getFieldValue(conn0, JdbcThinConnection.class, "cliIo"); }
/** * Get client socket for connection. * * @param conn Connection. * @return Socket. * @throws Exception If failed. */
Get client socket for connection
io
{ "repo_name": "WilliamDo/ignite", "path": "modules/clients/src/test/java/org/apache/ignite/jdbc/thin/JdbcThinConnectionSelfTest.java", "license": "apache-2.0", "size": 61943 }
[ "java.sql.Connection", "org.apache.ignite.internal.jdbc.thin.JdbcThinConnection", "org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo", "org.apache.ignite.testframework.GridTestUtils" ]
import java.sql.Connection; import org.apache.ignite.internal.jdbc.thin.JdbcThinConnection; import org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo; import org.apache.ignite.testframework.GridTestUtils;
import java.sql.*; import org.apache.ignite.internal.jdbc.thin.*; import org.apache.ignite.testframework.*;
[ "java.sql", "org.apache.ignite" ]
java.sql; org.apache.ignite;
391,853
public StackInteger stacks(StackInteger stack, int[] array, int begin, int length) { this.validateArgs(stack, array); StackInteger result = new StackInteger(stack.rows(), stack.columns()); Iterator<PlateInteger> iter1 = stack.iterator(); while(iter1.hasNext()) { PlateInteger resultPlate = this.plates(iter1.next(), array, begin, length); result.add(resultPlate); } return result; }
StackInteger function(StackInteger stack, int[] array, int begin, int length) { this.validateArgs(stack, array); StackInteger result = new StackInteger(stack.rows(), stack.columns()); Iterator<PlateInteger> iter1 = stack.iterator(); while(iter1.hasNext()) { PlateInteger resultPlate = this.plates(iter1.next(), array, begin, length); result.add(resultPlate); } return result; }
/** * Returns the result of the mathematical operation. Missing data points due * to uneven data stack lengths are treated as zeroes. * @param StackInteger the stack * @param int[] array for the operation * @param int beginning index of subset * @param int length of the subset * @return result of the operation */
Returns the result of the mathematical operation. Missing data points due to uneven data stack lengths are treated as zeroes
stacks
{ "repo_name": "jessemull/MicroFlex", "path": "src/main/java/com/github/jessemull/microflex/integerflex/math/MathOperationIntegerBinary.java", "license": "apache-2.0", "size": 68307 }
[ "com.github.jessemull.microflex.integerflex.plate.PlateInteger", "com.github.jessemull.microflex.integerflex.plate.StackInteger", "java.util.Iterator" ]
import com.github.jessemull.microflex.integerflex.plate.PlateInteger; import com.github.jessemull.microflex.integerflex.plate.StackInteger; import java.util.Iterator;
import com.github.jessemull.microflex.integerflex.plate.*; import java.util.*;
[ "com.github.jessemull", "java.util" ]
com.github.jessemull; java.util;
31,639
public Map<String, String> getVariables() { return new TreeMap<>(variables); } /** * Substitutes variables in the string and returns the substituted one. * @param string the target string * @return the substituted string * @throws IllegalArgumentException if the string contains some undefined variables, or it is {@code null}
Map<String, String> function() { return new TreeMap<>(variables); } /** * Substitutes variables in the string and returns the substituted one. * @param string the target string * @return the substituted string * @throws IllegalArgumentException if the string contains some undefined variables, or it is {@code null}
/** * Returns the variables names and their replacements in this table. * @return the variable map */
Returns the variables names and their replacements in this table
getVariables
{ "repo_name": "cocoatomo/asakusafw", "path": "core-project/asakusa-runtime/src/main/java/com/asakusafw/runtime/util/VariableTable.java", "license": "apache-2.0", "size": 11501 }
[ "java.util.Map", "java.util.TreeMap" ]
import java.util.Map; import java.util.TreeMap;
import java.util.*;
[ "java.util" ]
java.util;
2,860,989
public List<User> getUsers() { return this.users; }
List<User> function() { return this.users; }
/** * Get users. * @return List<User>. */
Get users
getUsers
{ "repo_name": "Apeksi1990/asemenov", "path": "chapter_009/echo/src/main/java/ru/asemenov/echo/UserStorage.java", "license": "apache-2.0", "size": 1421 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,960,830
public Coordinate[] getCoordinates() { Coordinate coord[] = new Coordinate[end - start + 1]; int index = 0; for (int i = start; i <= end; i++) { coord[index++] = pts[i]; } return coord; }
Coordinate[] function() { Coordinate coord[] = new Coordinate[end - start + 1]; int index = 0; for (int i = start; i <= end; i++) { coord[index++] = pts[i]; } return coord; }
/** * Return the subsequence of coordinates forming this chain. * Allocates a new array to hold the Coordinates */
Return the subsequence of coordinates forming this chain. Allocates a new array to hold the Coordinates
getCoordinates
{ "repo_name": "Semantive/jts", "path": "src/main/java/com/vividsolutions/jts/index/chain/MonotoneChain.java", "license": "lgpl-3.0", "size": 9141 }
[ "com.vividsolutions.jts.geom.Coordinate" ]
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.*;
[ "com.vividsolutions.jts" ]
com.vividsolutions.jts;
2,043,366
public static RoleCollection getGroupRoles(int[] ids) { return (RoleCollection)cache.get(FQN, SecurityCommon.groupIdAsString(ids)); }
static RoleCollection function(int[] ids) { return (RoleCollection)cache.get(FQN, SecurityCommon.groupIdAsString(ids)); }
/** * Get merged roles from a set of groups * @param ids The group ids * @return The roles, if found, or <code>null</code> otherwise. */
Get merged roles from a set of groups
getGroupRoles
{ "repo_name": "dalinhuang/suduforum", "path": "src/net/jforum/repository/RolesRepository.java", "license": "bsd-3-clause", "size": 3353 }
[ "net.jforum.dao.generic.security.SecurityCommon", "net.jforum.security.RoleCollection" ]
import net.jforum.dao.generic.security.SecurityCommon; import net.jforum.security.RoleCollection;
import net.jforum.dao.generic.security.*; import net.jforum.security.*;
[ "net.jforum.dao", "net.jforum.security" ]
net.jforum.dao; net.jforum.security;
1,066,904
public void setAllParentCategoryXrefs(List<CategoryXref> allParentCategories);
void function(List<CategoryXref> allParentCategories);
/** * Set all the xref entities linking this product to parent categories */
Set all the xref entities linking this product to parent categories
setAllParentCategoryXrefs
{ "repo_name": "cloudbearings/BroadleafCommerce", "path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/catalog/domain/Category.java", "license": "apache-2.0", "size": 24718 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
927,567
private String canonicalBase64Encode( String in ) throws IOException { Charset charset = Charset.forName( DEFAULT_ENCODING ); CharsetEncoder encoder = charset.newEncoder(); encoder.reset(); ByteBuffer baosbf = encoder.encode( CharBuffer.wrap( in ) ); byte[] bytes = new byte[baosbf.limit()]; baosbf.get( bytes ); ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream( baos ); gzos.write( bytes ); gzos.close(); String encoded = new String( Base64.encodeBase64( baos.toByteArray() ) ); return encoded; }
String function( String in ) throws IOException { Charset charset = Charset.forName( DEFAULT_ENCODING ); CharsetEncoder encoder = charset.newEncoder(); encoder.reset(); ByteBuffer baosbf = encoder.encode( CharBuffer.wrap( in ) ); byte[] bytes = new byte[baosbf.limit()]; baosbf.get( bytes ); ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = new GZIPOutputStream( baos ); gzos.write( bytes ); gzos.close(); String encoded = new String( Base64.encodeBase64( baos.toByteArray() ) ); return encoded; }
/** * https://www.securecoding.cert.org/confluence/display/java/IDS12-J.+Perform+lossless+conversion+ * of+String+data+between+differing+character+encodings * * @param in * string to encode * @return * @throws IOException */
HREF of+String+data+between+differing+character+encodings
canonicalBase64Encode
{ "repo_name": "IvanNikolaychuk/pentaho-kettle", "path": "core/test-src/org/pentaho/di/cluster/HttpUtilTest.java", "license": "apache-2.0", "size": 4117 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.nio.ByteBuffer", "java.nio.CharBuffer", "java.nio.charset.Charset", "java.nio.charset.CharsetEncoder", "java.util.zip.GZIPOutputStream", "org.apache.commons.codec.binary.Base64" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.util.zip.GZIPOutputStream; import org.apache.commons.codec.binary.Base64;
import java.io.*; import java.nio.*; import java.nio.charset.*; import java.util.zip.*; import org.apache.commons.codec.binary.*;
[ "java.io", "java.nio", "java.util", "org.apache.commons" ]
java.io; java.nio; java.util; org.apache.commons;
1,667,767
void ExecuteAction(int action, boolean val); } private Commands _commands; private Camera _camera; private ControlPad _controlPad = null; private Vector3 _tempVector = new Vector3();
void ExecuteAction(int action, boolean val); } private Commands _commands; private Camera _camera; private ControlPad _controlPad = null; private Vector3 _tempVector = new Vector3();
/** * Execute action. * * @param action the action * @param val the val */
Execute action
ExecuteAction
{ "repo_name": "DDuarte/feup-lpoo-maze_and_bombermen", "path": "bombermen2/bombermen/src/pt/up/fe/lpoo/bombermen/Input.java", "license": "mit", "size": 8289 }
[ "com.badlogic.gdx.graphics.Camera", "com.badlogic.gdx.math.Vector3" ]
import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.graphics.*; import com.badlogic.gdx.math.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
2,533,698
@LangMethodDefinition(AsType = LangMethodDefinition.LangMethodType.Property) public String type() { if (this.inner.display() == null) { return null; } return this.inner.display().operation(); }
@LangMethodDefinition(AsType = LangMethodDefinition.LangMethodType.Property) String function() { if (this.inner.display() == null) { return null; } return this.inner.display().operation(); }
/** * Get the operation value. * * @return the operation value */
Get the operation value
type
{ "repo_name": "jianghaolu/azure-sdk-for-java", "path": "azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/Operation.java", "license": "mit", "size": 2039 }
[ "com.microsoft.azure.management.apigeneration.LangMethodDefinition" ]
import com.microsoft.azure.management.apigeneration.LangMethodDefinition;
import com.microsoft.azure.management.apigeneration.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,003,778
//- SECTION :: HELPER -// private ValidationError processFieldErrors( List<FieldError> fieldErrors ) { //- Result -// ValidationError validationError = new ValidationError(); fieldErrors.forEach( fieldError -> { //- Add field's errors -// validationError.addFieldError( fieldError.getField(), this.resolveLocalizedErrorMessage( fieldError ) ); } ); return validationError; }
ValidationError function( List<FieldError> fieldErrors ) { ValidationError validationError = new ValidationError(); fieldErrors.forEach( fieldError -> { validationError.addFieldError( fieldError.getField(), this.resolveLocalizedErrorMessage( fieldError ) ); } ); return validationError; }
/** * Helper for filling field's errors. * * @param fieldErrors List of fields with errors. * * @return ValidationError Object for response about error. */
Helper for filling field's errors
processFieldErrors
{ "repo_name": "coffeine-009/Virtuoso", "path": "src/main/java/com/thecoffeine/virtuoso/error/controller/ErrorController.java", "license": "mit", "size": 4570 }
[ "com.thecoffeine.virtuoso.error.model.entity.ValidationError", "java.util.List", "org.springframework.validation.FieldError" ]
import com.thecoffeine.virtuoso.error.model.entity.ValidationError; import java.util.List; import org.springframework.validation.FieldError;
import com.thecoffeine.virtuoso.error.model.entity.*; import java.util.*; import org.springframework.validation.*;
[ "com.thecoffeine.virtuoso", "java.util", "org.springframework.validation" ]
com.thecoffeine.virtuoso; java.util; org.springframework.validation;
1,440,252
private List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> potentiallyConnectSentinels() { List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> connectionFutures = new ArrayList<>(); for (RedisURI sentinel : sentinels) { if (pubSubConnections.containsKey(sentinel)) { continue; } ConnectionFuture<StatefulRedisPubSubConnection<String, String>> future = redisClient.connectPubSubAsync(CODEC, sentinel); pubSubConnections.put(sentinel, future); future.whenComplete((connection, throwable) -> { if (throwable != null || closed) { pubSubConnections.remove(sentinel); } if (closed) { connection.closeAsync(); } }); connectionFutures.add(future); } return connectionFutures; }
List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> function() { List<ConnectionFuture<StatefulRedisPubSubConnection<String, String>>> connectionFutures = new ArrayList<>(); for (RedisURI sentinel : sentinels) { if (pubSubConnections.containsKey(sentinel)) { continue; } ConnectionFuture<StatefulRedisPubSubConnection<String, String>> future = redisClient.connectPubSubAsync(CODEC, sentinel); pubSubConnections.put(sentinel, future); future.whenComplete((connection, throwable) -> { if (throwable != null closed) { pubSubConnections.remove(sentinel); } if (closed) { connection.closeAsync(); } }); connectionFutures.add(future); } return connectionFutures; }
/** * Inspect whether additional Sentinel connections are required based on the which Sentinels are currently connected. * * @return list of futures that are notified with the connection progress. */
Inspect whether additional Sentinel connections are required based on the which Sentinels are currently connected
potentiallyConnectSentinels
{ "repo_name": "lettuce-io/lettuce-core", "path": "src/main/java/io/lettuce/core/masterreplica/SentinelTopologyRefresh.java", "license": "apache-2.0", "size": 15155 }
[ "io.lettuce.core.ConnectionFuture", "io.lettuce.core.RedisURI", "io.lettuce.core.pubsub.StatefulRedisPubSubConnection", "java.util.ArrayList", "java.util.List" ]
import io.lettuce.core.ConnectionFuture; import io.lettuce.core.RedisURI; import io.lettuce.core.pubsub.StatefulRedisPubSubConnection; import java.util.ArrayList; import java.util.List;
import io.lettuce.core.*; import io.lettuce.core.pubsub.*; import java.util.*;
[ "io.lettuce.core", "java.util" ]
io.lettuce.core; java.util;
720,944
@Test public void testUnsupportedTransaction2() throws Exception { expExc.expect(IllegalStateException.class); expExc.expectMessage("transactional"); FileSystemResolver resolver = new FileSystemResolver(); resolver.setName("test"); resolver.setSettings(settings); resolver.setTransactional("true"); // the two patterns are inconsistent and thus not supported for transactions resolver.addIvyPattern(settings.getBaseDir() + "/test/repositories/1/[organisation]-[module]/[revision]/[artifact]-[revision].[ext]"); resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"); ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", "mymodule", "myrevision"); Artifact ivyArtifact = new DefaultArtifact(mrid, new Date(), "ivy", "ivy", "xml"); Artifact artifact = new DefaultArtifact(mrid, new Date(), "myartifact", "mytype", "myext"); File src = new File("test/repositories/ivysettings.xml"); resolver.beginPublishTransaction(mrid, false); resolver.publish(ivyArtifact, src, false); resolver.publish(artifact, src, false); }
void function() throws Exception { expExc.expect(IllegalStateException.class); expExc.expectMessage(STR); FileSystemResolver resolver = new FileSystemResolver(); resolver.setName("test"); resolver.setSettings(settings); resolver.setTransactional("true"); resolver.addIvyPattern(settings.getBaseDir() + STR); resolver.addArtifactPattern(settings.getBaseDir() + STR); ModuleRevisionId mrid = ModuleRevisionId.newInstance("myorg", STR, STR); Artifact ivyArtifact = new DefaultArtifact(mrid, new Date(), "ivy", "ivy", "xml"); Artifact artifact = new DefaultArtifact(mrid, new Date(), STR, STR, "myext"); File src = new File(STR); resolver.beginPublishTransaction(mrid, false); resolver.publish(ivyArtifact, src, false); resolver.publish(artifact, src, false); }
/** * Publishing with transaction=true and an unsupported combination of patterns must fail. * * @throws Exception if something goes wrong */
Publishing with transaction=true and an unsupported combination of patterns must fail
testUnsupportedTransaction2
{ "repo_name": "apache/ant-ivy", "path": "test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java", "license": "apache-2.0", "size": 50578 }
[ "java.io.File", "java.util.Date", "org.apache.ivy.core.module.descriptor.Artifact", "org.apache.ivy.core.module.descriptor.DefaultArtifact", "org.apache.ivy.core.module.id.ModuleRevisionId" ]
import java.io.File; import java.util.Date; import org.apache.ivy.core.module.descriptor.Artifact; import org.apache.ivy.core.module.descriptor.DefaultArtifact; import org.apache.ivy.core.module.id.ModuleRevisionId;
import java.io.*; import java.util.*; import org.apache.ivy.core.module.descriptor.*; import org.apache.ivy.core.module.id.*;
[ "java.io", "java.util", "org.apache.ivy" ]
java.io; java.util; org.apache.ivy;
1,789,119
protected final BigDecimal stepNextInScale(BigDecimal decimal) { BigDecimal step = BigDecimal.ONE.scaleByPowerOfTen(-getRoundingScale()); return decimal.add(step); }
final BigDecimal function(BigDecimal decimal) { BigDecimal step = BigDecimal.ONE.scaleByPowerOfTen(-getRoundingScale()); return decimal.add(step); }
/** * Produces a value one "step" forward in this expression's rounding scale. * For example with a scale of 2, "2.5" would be stepped forward to "2.51". */
Produces a value one "step" forward in this expression's rounding scale. For example with a scale of 2, "2.5" would be stepped forward to "2.51"
stepNextInScale
{ "repo_name": "julianhyde/phoenix", "path": "phoenix-core/src/main/java/org/apache/phoenix/expression/function/RoundDecimalExpression.java", "license": "apache-2.0", "size": 16023 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
2,512,718
private void appendControlPointText( SingleCurvedGeometry cg, int level, boolean doIndent, Writer writer) throws IOException { if (((Geometry) cg).isEmpty()) { writer.write("EMPTY"); } else { if (doIndent) indent(level, writer); writer.write("("); double[] controlPoints = cg.getControlPoints(); for (int i = 0; i < controlPoints.length; i += 2) { if (i > 0) { writer.write(", "); if (coordsPerLine > 0 && i % coordsPerLine == 0) { indent(level + 1, writer); } } appendControlPoint(controlPoints[i], controlPoints[i + 1], writer); } writer.write(")"); } }
void function( SingleCurvedGeometry cg, int level, boolean doIndent, Writer writer) throws IOException { if (((Geometry) cg).isEmpty()) { writer.write("EMPTY"); } else { if (doIndent) indent(level, writer); writer.write("("); double[] controlPoints = cg.getControlPoints(); for (int i = 0; i < controlPoints.length; i += 2) { if (i > 0) { writer.write(STR); if (coordsPerLine > 0 && i % coordsPerLine == 0) { indent(level + 1, writer); } } appendControlPoint(controlPoints[i], controlPoints[i + 1], writer); } writer.write(")"); } }
/** * Writes out a {@link SingleCurvedGeometry} control points * * @param cg the <code>SingleCurvedGeometry</code> to process * @param writer the output writer to append to */
Writes out a <code>SingleCurvedGeometry</code> control points
appendControlPointText
{ "repo_name": "geotools/geotools", "path": "modules/library/main/src/main/java/org/geotools/geometry/jts/WKTWriter2.java", "license": "lgpl-2.1", "size": 30217 }
[ "java.io.IOException", "java.io.Writer", "org.locationtech.jts.geom.Geometry" ]
import java.io.IOException; import java.io.Writer; import org.locationtech.jts.geom.Geometry;
import java.io.*; import org.locationtech.jts.geom.*;
[ "java.io", "org.locationtech.jts" ]
java.io; org.locationtech.jts;
1,266,818
logger = LoggerFactory.getLogger(DropboxActivator.class); context = bc; logger.debug("Dropbox I/O Bundle has been started."); }
logger = LoggerFactory.getLogger(DropboxActivator.class); context = bc; logger.debug(STR); }
/** * Called whenever the OSGi framework starts our bundle */
Called whenever the OSGi framework starts our bundle
start
{ "repo_name": "theoweiss/openhab", "path": "bundles/io/org.openhab.io.dropbox/src/main/java/org/openhab/io/dropbox/internal/DropboxActivator.java", "license": "epl-1.0", "size": 1522 }
[ "org.slf4j.LoggerFactory" ]
import org.slf4j.LoggerFactory;
import org.slf4j.*;
[ "org.slf4j" ]
org.slf4j;
385,566
protected final void check(PortletRequest request, PortletResponse response) throws PortletException { if (this.requireSession) { if (request.getPortletSession(false) == null) { throw new PortletSessionRequiredException("Pre-existing session required but none found"); } } }
final void function(PortletRequest request, PortletResponse response) throws PortletException { if (this.requireSession) { if (request.getPortletSession(false) == null) { throw new PortletSessionRequiredException(STR); } } }
/** * Check and prepare the given request and response according to the settings * of this generator. Checks for a required session, and applies the number of * cache seconds configured for this generator (if it is a render request/response). * @param request current portlet request * @param response current portlet response * @throws PortletException if the request cannot be handled because a check failed */
Check and prepare the given request and response according to the settings of this generator. Checks for a required session, and applies the number of cache seconds configured for this generator (if it is a render request/response)
check
{ "repo_name": "cbeams-archive/spring-framework-2.5.x", "path": "src/org/springframework/web/portlet/handler/PortletContentGenerator.java", "license": "apache-2.0", "size": 5617 }
[ "javax.portlet.PortletException", "javax.portlet.PortletRequest", "javax.portlet.PortletResponse" ]
import javax.portlet.PortletException; import javax.portlet.PortletRequest; import javax.portlet.PortletResponse;
import javax.portlet.*;
[ "javax.portlet" ]
javax.portlet;
1,521,692
private static void populateBaseQueryData(Ignite node, int parallelism) { node.createCache(cacheConfiguration(parallelism, "pers", Person.class)); node.createCache(cacheConfiguration(parallelism, "persTask", PersonTask.class)); IgniteCache<Long, Object> pers = cache(node, "pers"); for (long i = 0; i < KEY_CNT; i++) pers.put(i, new Person(i)); IgniteCache<Long, Object> comp = cache(node, "persTask"); for (long i = 0; i < KEY_CNT; i++) comp.put(i, new PersonTask(i)); }
static void function(Ignite node, int parallelism) { node.createCache(cacheConfiguration(parallelism, "pers", Person.class)); node.createCache(cacheConfiguration(parallelism, STR, PersonTask.class)); IgniteCache<Long, Object> pers = cache(node, "pers"); for (long i = 0; i < KEY_CNT; i++) pers.put(i, new Person(i)); IgniteCache<Long, Object> comp = cache(node, STR); for (long i = 0; i < KEY_CNT; i++) comp.put(i, new PersonTask(i)); }
/** * Populate base query data. * * @param node Node. * @param parallelism Query parallelism. */
Populate base query data
populateBaseQueryData
{ "repo_name": "andrey-kuznetsov/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/AbstractQueryTableLockAndConnectionPoolSelfTest.java", "license": "apache-2.0", "size": 25325 }
[ "org.apache.ignite.Ignite", "org.apache.ignite.IgniteCache" ]
import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,347,224
protected void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) { window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L;
void function(final ModalWindow window, final WebMarkupContainer container) { window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 8804221891699487139L;
/** * Set a WindowClosedCallback for a ModalWindow instance. * * @param window window * @param container container */
Set a WindowClosedCallback for a ModalWindow instance
setWindowClosedCallback
{ "repo_name": "massx1/syncope", "path": "client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java", "license": "apache-2.0", "size": 3974 }
[ "org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow", "org.apache.wicket.markup.html.WebMarkupContainer" ]
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.extensions.ajax.markup.html.modal.*; import org.apache.wicket.markup.html.*;
[ "org.apache.wicket" ]
org.apache.wicket;
166,358
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) servletRequest; if (req.getRequestURI().contains("/signin")) { filterChain.doFilter(servletRequest, servletResponse); } else { HttpSession session = req.getSession(); HttpServletResponse resp = (HttpServletResponse) servletResponse; if (session.getAttribute("login") == null) { resp.sendRedirect(String.format("%s/signin", req.getContextPath())); return; } filterChain.doFilter(servletRequest, servletResponse); } }
void function(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) servletRequest; if (req.getRequestURI().contains(STR)) { filterChain.doFilter(servletRequest, servletResponse); } else { HttpSession session = req.getSession(); HttpServletResponse resp = (HttpServletResponse) servletResponse; if (session.getAttribute("login") == null) { resp.sendRedirect(String.format(STR, req.getContextPath())); return; } filterChain.doFilter(servletRequest, servletResponse); } }
/** * Filter session info. * @param servletRequest - servlter request. * @param servletResponse - servlet response. * @param filterChain - other filters. * @throws IOException - exception. * @throws ServletException - exception. */
Filter session info
doFilter
{ "repo_name": "wamdue/agorbunov", "path": "chapter_009/src/main/java/ru/job4j/crud/controller/AuthFilter.java", "license": "apache-2.0", "size": 1896 }
[ "java.io.IOException", "javax.servlet.FilterChain", "javax.servlet.ServletException", "javax.servlet.ServletRequest", "javax.servlet.ServletResponse", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "javax.servlet.http.HttpSession" ]
import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
2,257,333
private void createCrf(OverflowOplog previous) throws IOException { File f = new File(this.diskFile.getPath() + CRF_FILE_EXT); if (logger.isDebugEnabled()) { logger.debug("Creating operation log file {}", f); } this.crf.f = f; this.crf.raf = new RandomAccessFile(f, "rw"); this.crf.writeBuf = allocateWriteBuf(previous); preblow(); logger.info(LocalizedMessage.create(LocalizedStrings.Oplog_CREATE_0_1_2, new Object[] {toString(), "crf", this.parent.getName()})); this.crf.channel = this.crf.raf.getChannel(); this.stats.incOpenOplogs(); }
void function(OverflowOplog previous) throws IOException { File f = new File(this.diskFile.getPath() + CRF_FILE_EXT); if (logger.isDebugEnabled()) { logger.debug(STR, f); } this.crf.f = f; this.crf.raf = new RandomAccessFile(f, "rw"); this.crf.writeBuf = allocateWriteBuf(previous); preblow(); logger.info(LocalizedMessage.create(LocalizedStrings.Oplog_CREATE_0_1_2, new Object[] {toString(), "crf", this.parent.getName()})); this.crf.channel = this.crf.raf.getChannel(); this.stats.incOpenOplogs(); }
/** * Creates the crf oplog file */
Creates the crf oplog file
createCrf
{ "repo_name": "prasi-in/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/OverflowOplog.java", "license": "apache-2.0", "size": 53207 }
[ "java.io.File", "java.io.IOException", "java.io.RandomAccessFile", "org.apache.geode.internal.i18n.LocalizedStrings", "org.apache.geode.internal.logging.log4j.LocalizedMessage" ]
import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import org.apache.geode.internal.i18n.LocalizedStrings; import org.apache.geode.internal.logging.log4j.LocalizedMessage;
import java.io.*; import org.apache.geode.internal.i18n.*; import org.apache.geode.internal.logging.log4j.*;
[ "java.io", "org.apache.geode" ]
java.io; org.apache.geode;
1,102,302
public void enableLocationProviders(HashMap<String, LocationProviderProxy> locationProviders) { if (KrollRuntime.getInstance().isRuntimeThread()) { doEnableLocationProviders(locationProviders); } else { Message message = getRuntimeHandler().obtainMessage(MSG_ENABLE_LOCATION_PROVIDERS, locationProviders); message.sendToTarget(); } }
void function(HashMap<String, LocationProviderProxy> locationProviders) { if (KrollRuntime.getInstance().isRuntimeThread()) { doEnableLocationProviders(locationProviders); } else { Message message = getRuntimeHandler().obtainMessage(MSG_ENABLE_LOCATION_PROVIDERS, locationProviders); message.sendToTarget(); } }
/** * Wrapper to ensure task executes on the runtime thread * * @param locationProviders list of location providers to enable by registering * the providers with the OS */
Wrapper to ensure task executes on the runtime thread
enableLocationProviders
{ "repo_name": "ashcoding/titanium_mobile", "path": "android/modules/geolocation/src/java/ti/modules/titanium/geolocation/GeolocationModule.java", "license": "apache-2.0", "size": 36967 }
[ "android.os.Message", "java.util.HashMap", "org.appcelerator.kroll.KrollRuntime" ]
import android.os.Message; import java.util.HashMap; import org.appcelerator.kroll.KrollRuntime;
import android.os.*; import java.util.*; import org.appcelerator.kroll.*;
[ "android.os", "java.util", "org.appcelerator.kroll" ]
android.os; java.util; org.appcelerator.kroll;
1,285,178
private void checkAudioTrackInitialized() throws ExoPlaybackException { int audioTrackState = audioTrack.getState(); if (audioTrackState == AudioTrack.STATE_INITIALIZED) { return; } // The track is not successfully initialized. Release and null the track. try { audioTrack.release(); } catch (Exception e) { // The track has already failed to initialize, so it wouldn't be that surprising if release // were to fail too. Swallow the exception. } finally { audioTrack = null; } // Propagate the relevant exceptions. AudioTrackInitializationException exception = new AudioTrackInitializationException( audioTrackState, sampleRate, channelConfig, bufferSize); notifyAudioTrackInitializationError(exception); throw new ExoPlaybackException(exception); }
void function() throws ExoPlaybackException { int audioTrackState = audioTrack.getState(); if (audioTrackState == AudioTrack.STATE_INITIALIZED) { return; } try { audioTrack.release(); } catch (Exception e) { } finally { audioTrack = null; } AudioTrackInitializationException exception = new AudioTrackInitializationException( audioTrackState, sampleRate, channelConfig, bufferSize); notifyAudioTrackInitializationError(exception); throw new ExoPlaybackException(exception); }
/** * Checks that {@link #audioTrack} has been successfully initialized. If it has then calling this * method is a no-op. If it hasn't then {@link #audioTrack} is released and set to null, and an * exception is thrown. * * @throws ExoPlaybackException If {@link #audioTrack} has not been successfully initialized. */
Checks that <code>#audioTrack</code> has been successfully initialized. If it has then calling this method is a no-op. If it hasn't then <code>#audioTrack</code> is released and set to null, and an exception is thrown
checkAudioTrackInitialized
{ "repo_name": "Invisibi/ExoPlayer", "path": "library/src/main/java/com/google/android/exoplayer/MediaCodecHooloopAudioTrackRenderer.java", "license": "apache-2.0", "size": 35643 }
[ "android.media.AudioTrack" ]
import android.media.AudioTrack;
import android.media.*;
[ "android.media" ]
android.media;
2,903,047
public @NonNull String getPlaceholderValue( final @NonNull String key, final @NonNull PlotPlayer<?> player ) { final Placeholder placeholder = getPlaceholder(key); if (placeholder == null) { return ""; } String placeholderValue = ""; try { placeholderValue = placeholder.getValue(player); // If a placeholder for some reason decides to be disobedient, we catch it here if (placeholderValue == null) { new RuntimeException(String .format("Placeholder '%s' returned null for player '%s'", placeholder.getKey(), player.getName() )).printStackTrace(); } } catch (final Exception exception) { new RuntimeException(String .format("Placeholder '%s' failed to evaluate for player '%s'", placeholder.getKey(), player.getName() ), exception).printStackTrace(); } return placeholderValue; }
@NonNull String function( final @NonNull String key, final @NonNull PlotPlayer<?> player ) { final Placeholder placeholder = getPlaceholder(key); if (placeholder == null) { return STRSTRPlaceholder '%s' returned null for player '%s'STRPlaceholder '%s' failed to evaluate for player '%s'", placeholder.getKey(), player.getName() ), exception).printStackTrace(); } return placeholderValue; }
/** * Get the placeholder value evaluated for a player, and catch and deal with any problems * occurring while doing so * * @param key Placeholder key * @param player Player to evaluate for * @return Replacement value */
Get the placeholder value evaluated for a player, and catch and deal with any problems occurring while doing so
getPlaceholderValue
{ "repo_name": "IntellectualCrafters/PlotSquared", "path": "Core/src/main/java/com/plotsquared/core/util/placeholders/PlaceholderRegistry.java", "license": "gpl-3.0", "size": 14119 }
[ "com.plotsquared.core.player.PlotPlayer", "org.checkerframework.checker.nullness.qual.NonNull" ]
import com.plotsquared.core.player.PlotPlayer; import org.checkerframework.checker.nullness.qual.NonNull;
import com.plotsquared.core.player.*; import org.checkerframework.checker.nullness.qual.*;
[ "com.plotsquared.core", "org.checkerframework.checker" ]
com.plotsquared.core; org.checkerframework.checker;
2,275,485
public static Matcher<View> isOfClass(final Class<? extends View> clazz) { if (clazz == null) { Assert.fail("Passed null Class instance"); }
static Matcher<View> function(final Class<? extends View> clazz) { if (clazz == null) { Assert.fail(STR); }
/** * Returns a matcher that matches Views which are an instance of the provided class. */
Returns a matcher that matches Views which are an instance of the provided class
isOfClass
{ "repo_name": "madhavanks26/com.vliesaputra.deviceinformation", "path": "src/com/vliesaputra/cordova/plugins/android/support/v4/src/tests/java/android/support/v4/testutils/TestUtilsMatchers.java", "license": "mit", "size": 10413 }
[ "android.view.View", "junit.framework.Assert", "org.hamcrest.Matcher" ]
import android.view.View; import junit.framework.Assert; import org.hamcrest.Matcher;
import android.view.*; import junit.framework.*; import org.hamcrest.*;
[ "android.view", "junit.framework", "org.hamcrest" ]
android.view; junit.framework; org.hamcrest;
2,260,235
@Test public void testBuildReportChunkNullStream() { try { instance.buildReportChunk(tchunk, null, false); fail("An exception should have been thrown but wasn't"); } catch (Exception e) { assertTrue(e instanceof ExplanationException); String expResult = "The entered stream must not be null"; String result = e.getMessage(); assertEquals(expResult, result); } }
void function() { try { instance.buildReportChunk(tchunk, null, false); fail(STR); } catch (Exception e) { assertTrue(e instanceof ExplanationException); String expResult = STR; String result = e.getMessage(); assertEquals(expResult, result); } }
/** * Test of buildReportChunk method, of class PDFTextChunkBuilder. * Test case: unsuccessfull execution - null stream */
Test of buildReportChunk method, of class PDFTextChunkBuilder. Test case: unsuccessfull execution - null stream
testBuildReportChunkNullStream
{ "repo_name": "mladensavic94/jeff", "path": "src/test/java/org/goodoldai/jeff/report/pdf/PDFTextChunkBuilderTest.java", "license": "lgpl-3.0", "size": 7892 }
[ "org.goodoldai.jeff.explanation.ExplanationException", "org.junit.Assert" ]
import org.goodoldai.jeff.explanation.ExplanationException; import org.junit.Assert;
import org.goodoldai.jeff.explanation.*; import org.junit.*;
[ "org.goodoldai.jeff", "org.junit" ]
org.goodoldai.jeff; org.junit;
2,478,227
return new BlackFunctions().getObjectCreating(); } public static class Defaults extends AbstractFunctionConfigurationBean { public static class CurrencyInfo implements InitializingBean { private String _curveConfig; private String _surfaceName;
return new BlackFunctions().getObjectCreating(); } public static class Defaults extends AbstractFunctionConfigurationBean { public static class CurrencyInfo implements InitializingBean { private String _curveConfig; private String _surfaceName;
/** * Default instance of a repository configuration source exposing the functions from this package. * * @return the configuration source exposing functions from this package */
Default instance of a repository configuration source exposing the functions from this package
instance
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-Financial/src/main/java/com/opengamma/financial/analytics/model/swaption/black/BlackFunctions.java", "license": "apache-2.0", "size": 5395 }
[ "com.opengamma.engine.function.config.AbstractFunctionConfigurationBean", "org.springframework.beans.factory.InitializingBean" ]
import com.opengamma.engine.function.config.AbstractFunctionConfigurationBean; import org.springframework.beans.factory.InitializingBean;
import com.opengamma.engine.function.config.*; import org.springframework.beans.factory.*;
[ "com.opengamma.engine", "org.springframework.beans" ]
com.opengamma.engine; org.springframework.beans;
2,389,826
public static Vector<Plottable> getNonWatchables(final Layer thisLayer) { final Vector<Plottable> res = new Vector<Plottable>(0, 1); // is this layer visible? if (thisLayer.getVisible()) { if (thisLayer instanceof Layer.BackgroundLayer) { res.addElement(thisLayer); } else if ((thisLayer instanceof FixWrapper) || (thisLayer instanceof TrackWrapper) || (thisLayer instanceof BuoyPatternWrapper) || (thisLayer instanceof SensorWrapper) || (thisLayer instanceof TMAWrapper) || (thisLayer instanceof TrackSegment) || (thisLayer instanceof SegmentList)) { // ignore it - it's clearly tactical, and there's just no way // it can contain non-tactical child elements } else { // just see if this layer is one of our back-ground layesr final Enumeration<Editable> iter = thisLayer.elements(); while (iter.hasMoreElements()) { final Plottable thisPlottable = (Plottable) iter.nextElement(); if (thisPlottable instanceof ShapeWrapper) { // see if has a valid DTG -- IS IT TIME-RELATED? final ShapeWrapper swp = (ShapeWrapper) thisPlottable; final HiResDate dat = swp.getStartDTG(); if (dat == null) { // let's use it res.addElement(thisPlottable); } else { // so it's got a date, check if the date represents our null // value // anyway if (dat.getMicros() == -1) res.addElement(thisPlottable); } } else if (thisPlottable instanceof LabelWrapper) { // see if has a valid DTG -- IS IT TIME-RELATED? final LabelWrapper lwp = (LabelWrapper) thisPlottable; final HiResDate dat = lwp.getStartDTG(); // check if it is using our "null" date value if (dat == null) { // let's use it res.addElement(thisPlottable); } else { // it's got a date, which makes it one of our watchables, it // will // get caught elsewhere } } else { // it's not a shape - it's probably the grid or the scale, res.addElement(thisPlottable); } // whether it's a labelwrapper } // looping through the elements of this layer } // if this is a background layer (or not) } // whether this layer is visible return res; }
static Vector<Plottable> function(final Layer thisLayer) { final Vector<Plottable> res = new Vector<Plottable>(0, 1); if (thisLayer.getVisible()) { if (thisLayer instanceof Layer.BackgroundLayer) { res.addElement(thisLayer); } else if ((thisLayer instanceof FixWrapper) (thisLayer instanceof TrackWrapper) (thisLayer instanceof BuoyPatternWrapper) (thisLayer instanceof SensorWrapper) (thisLayer instanceof TMAWrapper) (thisLayer instanceof TrackSegment) (thisLayer instanceof SegmentList)) { } else { final Enumeration<Editable> iter = thisLayer.elements(); while (iter.hasMoreElements()) { final Plottable thisPlottable = (Plottable) iter.nextElement(); if (thisPlottable instanceof ShapeWrapper) { final ShapeWrapper swp = (ShapeWrapper) thisPlottable; final HiResDate dat = swp.getStartDTG(); if (dat == null) { res.addElement(thisPlottable); } else { if (dat.getMicros() == -1) res.addElement(thisPlottable); } } else if (thisPlottable instanceof LabelWrapper) { final LabelWrapper lwp = (LabelWrapper) thisPlottable; final HiResDate dat = lwp.getStartDTG(); if (dat == null) { res.addElement(thisPlottable); } else { } } else { res.addElement(thisPlottable); } } } } return res; }
/** * method to return the non-tactical items on the plot, such as scale, grid, * coast etc. */
method to return the non-tactical items on the plot, such as scale, grid, coast etc
getNonWatchables
{ "repo_name": "pecko/debrief", "path": "org.mwc.debrief.legacy/src/Debrief/GUI/Tote/Painters/SnailPainter.java", "license": "epl-1.0", "size": 31700 }
[ "java.util.Enumeration", "java.util.Vector" ]
import java.util.Enumeration; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,597,992
@Override protected InputStream doGetInputStream() throws Exception { return file.getContent().getInputStream(); }
InputStream function() throws Exception { return file.getContent().getInputStream(); }
/** * Creates an input stream to read the file content from. */
Creates an input stream to read the file content from
doGetInputStream
{ "repo_name": "EsupPortail/commons-vfs2-project-2.0", "path": "core/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java", "license": "apache-2.0", "size": 11370 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
258,233
public void testRemainingCapacity() { int size = ThreadLocalRandom.current().nextInt(1, SIZE); BlockingQueue q = populatedQueue(size, size, 2 * size, false); int spare = q.remainingCapacity(); int capacity = spare + size; for (int i = 0; i < size; i++) { assertEquals(spare + i, q.remainingCapacity()); assertEquals(capacity, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < size; i++) { assertEquals(capacity - i, q.remainingCapacity()); assertEquals(capacity, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
void function() { int size = ThreadLocalRandom.current().nextInt(1, SIZE); BlockingQueue q = populatedQueue(size, size, 2 * size, false); int spare = q.remainingCapacity(); int capacity = spare + size; for (int i = 0; i < size; i++) { assertEquals(spare + i, q.remainingCapacity()); assertEquals(capacity, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < size; i++) { assertEquals(capacity - i, q.remainingCapacity()); assertEquals(capacity, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
/** * remainingCapacity decreases on add, increases on remove */
remainingCapacity decreases on add, increases on remove
testRemainingCapacity
{ "repo_name": "md-5/jdk10", "path": "test/jdk/java/util/concurrent/tck/ArrayBlockingQueueTest.java", "license": "gpl-2.0", "size": 33781 }
[ "java.util.concurrent.BlockingQueue", "java.util.concurrent.ThreadLocalRandom" ]
import java.util.concurrent.BlockingQueue; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,174,923
@SuppressWarnings("unchecked") protected Object resolveType(ClassLoader classLoader, Class pluginClass, Class type) { if (type.isAssignableFrom(PluginManager.class)) { return pluginManager; } else if (type.isAssignableFrom(Watcher.class)) { return pluginManager.getWatcher(); } else if (type.isAssignableFrom(Scheduler.class)) { return pluginManager.getScheduler(); } else if (type.isAssignableFrom(HotswapTransformer.class)) { return pluginManager.getHotswapTransformer(); } else if (type.isAssignableFrom(PluginConfiguration.class)) { return pluginManager.getPluginConfiguration(classLoader); } else if (type.isAssignableFrom(ClassLoader.class)) { return classLoader; } else if (type.isAssignableFrom(Instrumentation.class)) { return pluginManager.getInstrumentation(); } else { LOGGER.error("Unable process @Init on plugin '{}'." + " Type '" + type + "' is not recognized for @Init annotation.", pluginClass); return null; } }
@SuppressWarnings(STR) Object function(ClassLoader classLoader, Class pluginClass, Class type) { if (type.isAssignableFrom(PluginManager.class)) { return pluginManager; } else if (type.isAssignableFrom(Watcher.class)) { return pluginManager.getWatcher(); } else if (type.isAssignableFrom(Scheduler.class)) { return pluginManager.getScheduler(); } else if (type.isAssignableFrom(HotswapTransformer.class)) { return pluginManager.getHotswapTransformer(); } else if (type.isAssignableFrom(PluginConfiguration.class)) { return pluginManager.getPluginConfiguration(classLoader); } else if (type.isAssignableFrom(ClassLoader.class)) { return classLoader; } else if (type.isAssignableFrom(Instrumentation.class)) { return pluginManager.getInstrumentation(); } else { LOGGER.error(STR + STR + type + STR, pluginClass); return null; } }
/** * Support for autowiring of agent services - resolve instance by class. * * @param classLoader application classloader * @param pluginClass used only for debugging messages * @param type requested type * @return resolved instance or null (error is logged) */
Support for autowiring of agent services - resolve instance by class
resolveType
{ "repo_name": "The-Alchemist/HotswapAgent", "path": "hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/InitHandler.java", "license": "gpl-2.0", "size": 6346 }
[ "java.lang.instrument.Instrumentation", "org.hotswap.agent.command.Scheduler", "org.hotswap.agent.config.PluginConfiguration", "org.hotswap.agent.config.PluginManager", "org.hotswap.agent.util.HotswapTransformer", "org.hotswap.agent.watch.Watcher" ]
import java.lang.instrument.Instrumentation; import org.hotswap.agent.command.Scheduler; import org.hotswap.agent.config.PluginConfiguration; import org.hotswap.agent.config.PluginManager; import org.hotswap.agent.util.HotswapTransformer; import org.hotswap.agent.watch.Watcher;
import java.lang.instrument.*; import org.hotswap.agent.command.*; import org.hotswap.agent.config.*; import org.hotswap.agent.util.*; import org.hotswap.agent.watch.*;
[ "java.lang", "org.hotswap.agent" ]
java.lang; org.hotswap.agent;
630,279
@TearDown(Level.Trial) public void tearDown() { allocator.close(); }
@TearDown(Level.Trial) void function() { allocator.close(); }
/** * Tear down benchmarks. */
Tear down benchmarks
tearDown
{ "repo_name": "cpcloud/arrow", "path": "java/performance/src/test/java/org/apache/arrow/vector/VectorUnloaderBenchmark.java", "license": "apache-2.0", "size": 3214 }
[ "org.openjdk.jmh.annotations.Level", "org.openjdk.jmh.annotations.TearDown" ]
import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.*;
[ "org.openjdk.jmh" ]
org.openjdk.jmh;
563,087
public static void loadRemotes(String[] aRemotesNames, JSObject aOnSuccess, JSObject aOnFailure) throws Exception { sRequire(aRemotesNames, Scripts.getSpace(), aOnSuccess != null ? (Void v) -> { aOnSuccess.call(null, new Object[]{}); } : null, aOnFailure != null ? (Exception aReason) -> { aOnFailure.call(null, new Object[]{aReason.getMessage()}); } : null); }
static void function(String[] aRemotesNames, JSObject aOnSuccess, JSObject aOnFailure) throws Exception { sRequire(aRemotesNames, Scripts.getSpace(), aOnSuccess != null ? (Void v) -> { aOnSuccess.call(null, new Object[]{}); } : null, aOnFailure != null ? (Exception aReason) -> { aOnFailure.call(null, new Object[]{aReason.getMessage()}); } : null); }
/** * Part of manual dependencies resolving process * * @param aRemotesNames * @param aOnSuccess * @param aOnFailure * @throws java.lang.Exception */
Part of manual dependencies resolving process
loadRemotes
{ "repo_name": "jskonst/PlatypusJS", "path": "application/src/components/Modules/src/com/eas/client/scripts/ScriptedResource.java", "license": "apache-2.0", "size": 46678 }
[ "com.eas.script.Scripts" ]
import com.eas.script.Scripts;
import com.eas.script.*;
[ "com.eas.script" ]
com.eas.script;
1,656,900
Completable validate(SchemaModel schema);
Completable validate(SchemaModel schema);
/** * Validate the schema model and the included ES settings against ES by creating a index template. * * @param schema * @return */
Validate the schema model and the included ES settings against ES by creating a index template
validate
{ "repo_name": "gentics/mesh", "path": "mdm/api/src/main/java/com/gentics/mesh/core/search/index/node/NodeIndexHandler.java", "license": "apache-2.0", "size": 649 }
[ "com.gentics.mesh.core.rest.schema.SchemaModel", "io.reactivex.Completable" ]
import com.gentics.mesh.core.rest.schema.SchemaModel; import io.reactivex.Completable;
import com.gentics.mesh.core.rest.schema.*; import io.reactivex.*;
[ "com.gentics.mesh", "io.reactivex" ]
com.gentics.mesh; io.reactivex;
514,717
@SuppressWarnings("deprecation") public static void displayBlockDust(Location center, double range, MaterialData data, Vector offset, float speed, int amount) { Validate.notNull(center, "The center location must not be null."); Validate.notNull(center.getWorld(), "The center location must not be null."); Validate.notNull(offset, "The offset values must not be null."); Validate.isTrue(data != null && data.getItemType().isBlock(), "The specified material is not a valid block."); // Really no point to enforcing, just don't use huge values if (range > MAX_RANGE){ // Enforced server-side to promote efficiency // throw new IllegalArgumentException("The range of particle recipients cannot exceed the maximum value of " + MAX_RANGE +", a limitation of the client."); Bukkit.getLogger().log(Level.WARNING, "A particle is being displayed with the range set to " + range + ", higher than the recommended maximum of " + MAX_RANGE + ", which will potentially result in inefficiency."); } sendPacket(Utilities.Entities.getEntitiesInRange(center, range, Player.class), instantiateBlockDustPacket(data.getItemTypeId(), data.getData(), center, (float)offset.getX(), (float)offset.getY(), (float)offset.getZ(), speed, amount)); }
@SuppressWarnings(STR) static void function(Location center, double range, MaterialData data, Vector offset, float speed, int amount) { Validate.notNull(center, STR); Validate.notNull(center.getWorld(), STR); Validate.notNull(offset, STR); Validate.isTrue(data != null && data.getItemType().isBlock(), STR); if (range > MAX_RANGE){ Bukkit.getLogger().log(Level.WARNING, STR + range + STR + MAX_RANGE + STR); } sendPacket(Utilities.Entities.getEntitiesInRange(center, range, Player.class), instantiateBlockDustPacket(data.getItemTypeId(), data.getData(), center, (float)offset.getX(), (float)offset.getY(), (float)offset.getZ(), speed, amount)); }
/** * Displays a block dust particle effect which is only visible for players within a certain range of the centerpoint. * @param center The center location of the particle effect. * @param data The material data (which includes type) of the represented block. This value may not be {@code null}. * @param offset A vector representing the maximum distance particles can fly away from the center location on each axis (independently). * @param speed "Speed" of the particles, a data value of sorts. * @param amount The number of particles to display. * @param range The range which binds all players that will receive the packet. */
Displays a block dust particle effect which is only visible for players within a certain range of the centerpoint
displayBlockDust
{ "repo_name": "glen3b/BukkitLib", "path": "src/main/java/me/pagekite/glen3b/library/bukkit/Utilities.java", "license": "gpl-3.0", "size": 73311 }
[ "java.util.logging.Level", "org.apache.commons.lang.Validate", "org.bukkit.Bukkit", "org.bukkit.Location", "org.bukkit.entity.Player", "org.bukkit.material.MaterialData", "org.bukkit.util.Vector" ]
import java.util.logging.Level; import org.apache.commons.lang.Validate; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.material.MaterialData; import org.bukkit.util.Vector;
import java.util.logging.*; import org.apache.commons.lang.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.material.*; import org.bukkit.util.*;
[ "java.util", "org.apache.commons", "org.bukkit", "org.bukkit.entity", "org.bukkit.material", "org.bukkit.util" ]
java.util; org.apache.commons; org.bukkit; org.bukkit.entity; org.bukkit.material; org.bukkit.util;
126,437
private byte[] convertBitmapToByteArray(Bitmap bitmap){ ByteArrayOutputStream byteStream = null; try { byteStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream); return byteStream.toByteArray(); }finally { try { if(byteStream != null) { byteStream.close(); } }catch (IOException e){ Log.e(TAG, Log.getStackTraceString(e)); } } }
byte[] function(Bitmap bitmap){ ByteArrayOutputStream byteStream = null; try { byteStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream); return byteStream.toByteArray(); }finally { try { if(byteStream != null) { byteStream.close(); } }catch (IOException e){ Log.e(TAG, Log.getStackTraceString(e)); } } }
/** * Convert <code>Bitmap</code> to byte array. * @param bitmap to be converted into a byteArray * @return <code>byte[]</code> that was converted from <code>Bitmap</code> */
Convert <code>Bitmap</code> to byte array
convertBitmapToByteArray
{ "repo_name": "marcochin/Go-Ubiquitous-Sunshine-Watch-Face", "path": "app/src/main/java/com/example/android/sunshine/app/wearable/MyWearableListenerService.java", "license": "apache-2.0", "size": 7941 }
[ "android.graphics.Bitmap", "android.util.Log", "java.io.ByteArrayOutputStream", "java.io.IOException" ]
import android.graphics.Bitmap; import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.IOException;
import android.graphics.*; import android.util.*; import java.io.*;
[ "android.graphics", "android.util", "java.io" ]
android.graphics; android.util; java.io;
2,457,817
public CallFuture call(Call call);
CallFuture function(Call call);
/** * asynchronous call. * * @param call * @return */
asynchronous call
call
{ "repo_name": "dinstone/com.dinstone.rpc", "path": "rpc-core/src/main/java/com/dinstone/rpc/client/Connection.java", "license": "apache-2.0", "size": 1065 }
[ "com.dinstone.rpc.CallFuture", "com.dinstone.rpc.protocol.Call" ]
import com.dinstone.rpc.CallFuture; import com.dinstone.rpc.protocol.Call;
import com.dinstone.rpc.*; import com.dinstone.rpc.protocol.*;
[ "com.dinstone.rpc" ]
com.dinstone.rpc;
2,393,167
public Properties getOutputFormat() { Properties def = new Properties(); { Set s = getOutputPropDefaultKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyDefault(key); def.put(key, val); } } Properties props = new Properties(def); { Set s = getOutputPropKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyNonDefault(key); if (val != null) props.put(key, val); } } return props; }
Properties function() { Properties def = new Properties(); { Set s = getOutputPropDefaultKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyDefault(key); def.put(key, val); } } Properties props = new Properties(def); { Set s = getOutputPropKeys(); Iterator i = s.iterator(); while (i.hasNext()) { String key = (String) i.next(); String val = getOutputPropertyNonDefault(key); if (val != null) props.put(key, val); } } return props; }
/** * Returns the output format for this serializer. * * @return The output format in use */
Returns the output format for this serializer
getOutputFormat
{ "repo_name": "srnsw/xena", "path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xml/serializer/ToStream.java", "license": "gpl-3.0", "size": 128094 }
[ "java.util.Iterator", "java.util.Properties", "java.util.Set" ]
import java.util.Iterator; import java.util.Properties; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,302,982
public void setShape(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; }
void function(Shape shape){ if (shape == null) { throw new IllegalArgumentException(); } this.shape = shape; }
/** * Sets the Shape this shape painter is associated with. * * @param shape new shape this painter should be associated with. * Should not be null. */
Sets the Shape this shape painter is associated with
setShape
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/gvt/FillShapePainter.java", "license": "apache-2.0", "size": 4261 }
[ "java.awt.Shape" ]
import java.awt.Shape;
import java.awt.*;
[ "java.awt" ]
java.awt;
515,469
public void readPacketData(PacketBuffer buf) throws IOException { this.compressionThreshold = buf.readVarInt(); }
void function(PacketBuffer buf) throws IOException { this.compressionThreshold = buf.readVarInt(); }
/** * Reads the raw packet data from the data stream. */
Reads the raw packet data from the data stream
readPacketData
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/network/login/server/SPacketEnableCompression.java", "license": "gpl-3.0", "size": 1332 }
[ "java.io.IOException", "net.minecraft.network.PacketBuffer" ]
import java.io.IOException; import net.minecraft.network.PacketBuffer;
import java.io.*; import net.minecraft.network.*;
[ "java.io", "net.minecraft.network" ]
java.io; net.minecraft.network;
406,937
public void setMaximumDate(Date maximumDate) { if (maximumDate == null) { throw new IllegalArgumentException("Null 'maximumDate' argument."); } // check the new maximum date relative to the current minimum date Date minDate = getMinimumDate(); long minMillis = minDate.getTime(); long newMaxMillis = maximumDate.getTime(); if (minMillis >= newMaxMillis) { Date oldMax = getMaximumDate(); long length = oldMax.getTime() - minMillis; minDate = new Date(newMaxMillis - length); } setRange(new DateRange(minDate, maximumDate), true, false); notifyListeners(new AxisChangeEvent(this)); }
void function(Date maximumDate) { if (maximumDate == null) { throw new IllegalArgumentException(STR); } Date minDate = getMinimumDate(); long minMillis = minDate.getTime(); long newMaxMillis = maximumDate.getTime(); if (minMillis >= newMaxMillis) { Date oldMax = getMaximumDate(); long length = oldMax.getTime() - minMillis; minDate = new Date(newMaxMillis - length); } setRange(new DateRange(minDate, maximumDate), true, false); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the maximum date visible on the axis and sends an * {@link AxisChangeEvent} to all registered listeners. If * <code>maximumDate</code> is on or before the current minimum date for * the axis, the minimum date will be shifted to preserve the current * length of the axis. * * @param maximumDate the date (<code>null</code> not permitted). * * @see #getMinimumDate() * @see #setMinimumDate(Date) */
Sets the maximum date visible on the axis and sends an <code>AxisChangeEvent</code> to all registered listeners. If <code>maximumDate</code> is on or before the current minimum date for the axis, the minimum date will be shifted to preserve the current length of the axis
setMaximumDate
{ "repo_name": "SOCR/HTML5_WebSite", "path": "SOCR2.8/src/jfreechart/org/jfree/chart/axis/DateAxis.java", "license": "lgpl-3.0", "size": 70762 }
[ "java.util.Date", "org.jfree.chart.event.AxisChangeEvent", "org.jfree.data.time.DateRange" ]
import java.util.Date; import org.jfree.chart.event.AxisChangeEvent; import org.jfree.data.time.DateRange;
import java.util.*; import org.jfree.chart.event.*; import org.jfree.data.time.*;
[ "java.util", "org.jfree.chart", "org.jfree.data" ]
java.util; org.jfree.chart; org.jfree.data;
2,383,358
public DataSource getDataSource() { return this.dataSource; }
DataSource function() { return this.dataSource; }
/** * Return the data source to retrieve the value from. */
Return the data source to retrieve the value from
getDataSource
{ "repo_name": "dachengxi/spring1.1.1_source", "path": "src/org/springframework/jdbc/support/incrementer/AbstractDataFieldMaxValueIncrementer.java", "license": "mit", "size": 3402 }
[ "javax.sql.DataSource" ]
import javax.sql.DataSource;
import javax.sql.*;
[ "javax.sql" ]
javax.sql;
252,295
public static void removeDirectoryContent(String directory){ File dir = new File(directory); if(dir.isDirectory()){ for (File file: dir.listFiles()){ deleteRecursive(file); } } }
static void function(String directory){ File dir = new File(directory); if(dir.isDirectory()){ for (File file: dir.listFiles()){ deleteRecursive(file); } } }
/** * Remove the content of a directory in the file system, without removing the directory itself * * @param directory The directory whose content need to be removed */
Remove the content of a directory in the file system, without removing the directory itself
removeDirectoryContent
{ "repo_name": "CMUPracticum/TrailScribe", "path": "TrailScribe/src/edu/cmu/sv/trailscribe/utils/StorageSystemHelper.java", "license": "mit", "size": 9264 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,320,277
public DatabaseMapping addDirectMapping(String attributeName, String xpathString) { XMLDirectMapping mapping = new XMLDirectMapping(); mapping.setAttributeName(attributeName); mapping.setXPath(xpathString); return addMapping(mapping); }
DatabaseMapping function(String attributeName, String xpathString) { XMLDirectMapping mapping = new XMLDirectMapping(); mapping.setAttributeName(attributeName); mapping.setXPath(xpathString); return addMapping(mapping); }
/** * PUBLIC: * Add a direct mapping to the receiver. The new mapping specifies that * an instance variable of the class of objects which the receiver describes maps in * the default manner for its type to the indicated database field. * * @param attributeName the name of an instance variable of the * class which the receiver describes. * @param xpathString the xpath of the xml element or attribute which corresponds * with the designated instance variable. * @return The newly created DatabaseMapping is returned. */
Add a direct mapping to the receiver. The new mapping specifies that an instance variable of the class of objects which the receiver describes maps in the default manner for its type to the indicated database field
addDirectMapping
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/oxm/XMLDescriptor.java", "license": "epl-1.0", "size": 45778 }
[ "org.eclipse.persistence.mappings.DatabaseMapping", "org.eclipse.persistence.oxm.mappings.XMLDirectMapping" ]
import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.oxm.mappings.XMLDirectMapping;
import org.eclipse.persistence.mappings.*; import org.eclipse.persistence.oxm.mappings.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
172,692
public Object parse(URL url, Map params) { return parseURL(url, params); }
Object function(URL url, Map params) { return parseURL(url, params); }
/** * Parse a JSON data structure from content at a given URL. * * @param url URL containing JSON content * @param params connection parameters * @return a data structure of lists and maps * @since 2.2.0 */
Parse a JSON data structure from content at a given URL
parse
{ "repo_name": "komalsukhani/debian-groovy2", "path": "subprojects/groovy-json/src/main/java/groovy/json/JsonSlurperClassic.java", "license": "apache-2.0", "size": 16197 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,515,329
Application create(InputStream appDescStream);
Application create(InputStream appDescStream);
/** * Creates the application from the specified application descriptor * input stream. * * @param appDescStream application archive input stream * @return application descriptor */
Creates the application from the specified application descriptor input stream
create
{ "repo_name": "packet-tracker/onos", "path": "core/api/src/main/java/org/onosproject/app/ApplicationStore.java", "license": "apache-2.0", "size": 3013 }
[ "java.io.InputStream", "org.onosproject.core.Application" ]
import java.io.InputStream; import org.onosproject.core.Application;
import java.io.*; import org.onosproject.core.*;
[ "java.io", "org.onosproject.core" ]
java.io; org.onosproject.core;
113,802
public String tryObjectToString(Object value) { if (value == null) return "null"; if (value instanceof String) return (String) value; if (value instanceof Double) return doubleToString(((Double) value).doubleValue()); if (value instanceof Float) return floatToString(((Float) value).floatValue()); if (value instanceof Long) return Int64ToString(((Long) value).longValue()); if (value instanceof Date) return DateTimeToString((Date) value); if (value instanceof Boolean) return booleanToString(((Boolean) value).booleanValue()); return "unsupportedtype(" + value.getClass().getName() + ")"; }
String function(Object value) { if (value == null) return "null"; if (value instanceof String) return (String) value; if (value instanceof Double) return doubleToString(((Double) value).doubleValue()); if (value instanceof Float) return floatToString(((Float) value).floatValue()); if (value instanceof Long) return Int64ToString(((Long) value).longValue()); if (value instanceof Date) return DateTimeToString((Date) value); if (value instanceof Boolean) return booleanToString(((Boolean) value).booleanValue()); return STR + value.getClass().getName() + ")"; }
/** * Tries to convert an object to a String * * @param value * @return */
Tries to convert an object to a String
tryObjectToString
{ "repo_name": "dopidaniel/fortesreport-ce", "path": "Demos/Datasnap/Server/proxy/java_blackberry/com/embarcadero/javablackberry/DBXDefaultFormatter.java", "license": "apache-2.0", "size": 14446 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,041,131
final Set<String> keywords() { return Collections.unmodifiableSet(keywords); }
final Set<String> keywords() { return Collections.unmodifiableSet(keywords); }
/** * Returns the keywords for test purpose. */
Returns the keywords for test purpose
keywords
{ "repo_name": "desruisseaux/sis", "path": "storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java", "license": "apache-2.0", "size": 6317 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
108,178
protected void insertBulk(Object entry, int level){ if (treePath.size() <= level) { BPlusTree.Node newNode = (BPlusTree.Node)btree.createNode(level); Object newId = determineTreeContainer.invoke(newNode).reserve(new Constant(newNode)); treePath.add(new MapEntry<Object,BPlusTree.Node>(newId, newNode)); } BPlusTree.Node node = treePath.get(level).getValue(); Object id = treePath.get(level).getKey(); insertIntoNode(node, entry ); if (treeOverflows.invoke(node)) { BPlusTree.Node newNode = (BPlusTree.Node)btree.createNode(node.level); Object newId = determineTreeContainer.invoke(newNode).reserve(new Constant(newNode)); insertIntoNode(newNode, entry); treePath.set(level, new MapEntry<Object,BPlusTree.Node>(newId, newNode)); Iterator entries; for (entries = node.entries(); !entries.next().equals(entry); ); entries.remove(); if (descending){ newNode.nextNeighbor = (BPlusTree.IndexEntry)btree.createIndexEntry(level+1); newNode.nextNeighbor.initialize(id); } else{ node.nextNeighbor = (BPlusTree.IndexEntry)btree.createIndexEntry(level+1); node.nextNeighbor.initialize(newId); } if (bufferPath.size() <= level){ bufferPath.add(new MapEntry<Object,BPlusTree.Node>(id, node)); } else{ bufferPath.set(level, new MapEntry<Object,BPlusTree.Node>(id, node)); } insertBulk(saveBulk(id, node, btree.isDuplicatesEnabled()), level+1); } }
void function(Object entry, int level){ if (treePath.size() <= level) { BPlusTree.Node newNode = (BPlusTree.Node)btree.createNode(level); Object newId = determineTreeContainer.invoke(newNode).reserve(new Constant(newNode)); treePath.add(new MapEntry<Object,BPlusTree.Node>(newId, newNode)); } BPlusTree.Node node = treePath.get(level).getValue(); Object id = treePath.get(level).getKey(); insertIntoNode(node, entry ); if (treeOverflows.invoke(node)) { BPlusTree.Node newNode = (BPlusTree.Node)btree.createNode(node.level); Object newId = determineTreeContainer.invoke(newNode).reserve(new Constant(newNode)); insertIntoNode(newNode, entry); treePath.set(level, new MapEntry<Object,BPlusTree.Node>(newId, newNode)); Iterator entries; for (entries = node.entries(); !entries.next().equals(entry); ); entries.remove(); if (descending){ newNode.nextNeighbor = (BPlusTree.IndexEntry)btree.createIndexEntry(level+1); newNode.nextNeighbor.initialize(id); } else{ node.nextNeighbor = (BPlusTree.IndexEntry)btree.createIndexEntry(level+1); node.nextNeighbor.initialize(newId); } if (bufferPath.size() <= level){ bufferPath.add(new MapEntry<Object,BPlusTree.Node>(id, node)); } else{ bufferPath.set(level, new MapEntry<Object,BPlusTree.Node>(id, node)); } insertBulk(saveBulk(id, node, btree.isDuplicatesEnabled()), level+1); } }
/** * Inserts an entry into the given level. * @param entry * @param level */
Inserts an entry into the given level
insertBulk
{ "repo_name": "hannoman/xxl", "path": "src/xxl/core/indexStructures/BPlusTreeBulkLoading.java", "license": "lgpl-3.0", "size": 11328 }
[ "java.util.Iterator", "xxl.core.collections.MapEntry", "xxl.core.functions.Constant", "xxl.core.indexStructures.BPlusTree" ]
import java.util.Iterator; import xxl.core.collections.MapEntry; import xxl.core.functions.Constant; import xxl.core.indexStructures.BPlusTree;
import java.util.*; import xxl.core.*; import xxl.core.collections.*; import xxl.core.functions.*;
[ "java.util", "xxl.core", "xxl.core.collections", "xxl.core.functions" ]
java.util; xxl.core; xxl.core.collections; xxl.core.functions;
2,645,939
void updateCurrentContainerView(ViewGroup containerView) { ViewGroup oldContainerView = mCurrentContainerView.get(); mCurrentContainerView = new WeakReference<>(containerView); for (Entry<View, Position> entry : mAnchorViews.entrySet()) { View anchorView = entry.getKey(); Position position = entry.getValue(); if (oldContainerView != null) { oldContainerView.removeView(anchorView); } containerView.addView(anchorView); if (position != null) { doSetAnchorViewPosition(anchorView, position.mX, position.mY, position.mWidth, position.mHeight); } } } } private static class ContentViewWebContentsObserver extends WebContentsObserver { // Using a weak reference avoids cycles that might prevent GC of WebView's WebContents. private final WeakReference<ContentViewCore> mWeakContentViewCore; ContentViewWebContentsObserver(ContentViewCore contentViewCore) { super(contentViewCore.getWebContents()); mWeakContentViewCore = new WeakReference<ContentViewCore>(contentViewCore); }
void updateCurrentContainerView(ViewGroup containerView) { ViewGroup oldContainerView = mCurrentContainerView.get(); mCurrentContainerView = new WeakReference<>(containerView); for (Entry<View, Position> entry : mAnchorViews.entrySet()) { View anchorView = entry.getKey(); Position position = entry.getValue(); if (oldContainerView != null) { oldContainerView.removeView(anchorView); } containerView.addView(anchorView); if (position != null) { doSetAnchorViewPosition(anchorView, position.mX, position.mY, position.mWidth, position.mHeight); } } } } private static class ContentViewWebContentsObserver extends WebContentsObserver { private final WeakReference<ContentViewCore> mWeakContentViewCore; ContentViewWebContentsObserver(ContentViewCore contentViewCore) { super(contentViewCore.getWebContents()); mWeakContentViewCore = new WeakReference<ContentViewCore>(contentViewCore); }
/** * Updates (or sets for the first time) the current container view to which * this class delegates. Existing anchor views are transferred from the old to * the new container view. */
Updates (or sets for the first time) the current container view to which this class delegates. Existing anchor views are transferred from the old to the new container view
updateCurrentContainerView
{ "repo_name": "Just-D/chromium-1", "path": "content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java", "license": "bsd-3-clause", "size": 132915 }
[ "android.view.View", "android.view.ViewGroup", "java.lang.ref.WeakReference", "java.util.Map", "org.chromium.content_public.browser.WebContentsObserver" ]
import android.view.View; import android.view.ViewGroup; import java.lang.ref.WeakReference; import java.util.Map; import org.chromium.content_public.browser.WebContentsObserver;
import android.view.*; import java.lang.ref.*; import java.util.*; import org.chromium.content_public.browser.*;
[ "android.view", "java.lang", "java.util", "org.chromium.content_public" ]
android.view; java.lang; java.util; org.chromium.content_public;
2,384,096
@Nonnull public HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder homeRealmDiscoveryPolicies() { return new HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder(getRequestUrlWithAdditionalSegment("homeRealmDiscoveryPolicies"), getClient(), null); }
HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder function() { return new HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder(getRequestUrlWithAdditionalSegment(STR), getClient(), null); }
/** * Gets a request builder for the HomeRealmDiscoveryPolicy collection * * @return the collection request builder */
Gets a request builder for the HomeRealmDiscoveryPolicy collection
homeRealmDiscoveryPolicies
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/ServicePrincipalRequestBuilder.java", "license": "mit", "size": 39127 }
[ "com.microsoft.graph.requests.HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder" ]
import com.microsoft.graph.requests.HomeRealmDiscoveryPolicyCollectionWithReferencesRequestBuilder;
import com.microsoft.graph.requests.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
340,223
public static void showAlert(Context context, int titleId, String message) { showAlert(context, context.getString(titleId), message); }
static void function(Context context, int titleId, String message) { showAlert(context, context.getString(titleId), message); }
/** * Show Alert Dialog * @param context * @param titleId * @param message */
Show Alert Dialog
showAlert
{ "repo_name": "kingsor/SampleAlertDialog", "path": "src/com/neetpiq/android/samplealertdialog/util/AlertUtil.java", "license": "mit", "size": 4637 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
741,927
public AbstractSemanticValidator getSemanticValidator( String name ) { return semanticValidators.get( name ); }
AbstractSemanticValidator function( String name ) { return semanticValidators.get( name ); }
/** * Returns the semantic validator given the name. * * @param name * the validator name * @return the semantic validator with the given name. Or return * <code>null</code>, the there is no validator with the given name. */
Returns the semantic validator given the name
getSemanticValidator
{ "repo_name": "Charling-Huang/birt", "path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/metadata/MetaDataDictionary.java", "license": "epl-1.0", "size": 35900 }
[ "org.eclipse.birt.report.model.validators.AbstractSemanticValidator" ]
import org.eclipse.birt.report.model.validators.AbstractSemanticValidator;
import org.eclipse.birt.report.model.validators.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
394,753
public ListBoxModel doFillNoOfDisplayedBuildsItems() { final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel(); final List<String> noOfBuilds = new ArrayList<String>(); noOfBuilds.add("1"); //$NON-NLS-1$ noOfBuilds.add("2"); //$NON-NLS-1$ noOfBuilds.add("3"); //$NON-NLS-1$ noOfBuilds.add("5"); //$NON-NLS-1$ noOfBuilds.add("10"); //$NON-NLS-1$ noOfBuilds.add("20"); //$NON-NLS-1$ noOfBuilds.add("50"); //$NON-NLS-1$ noOfBuilds.add("100"); //$NON-NLS-1$ noOfBuilds.add("200"); //$NON-NLS-1$ noOfBuilds.add("500"); //$NON-NLS-1$ for (final String noOfBuild : noOfBuilds) { options.add(noOfBuild); } return options; }
ListBoxModel function() { final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel(); final List<String> noOfBuilds = new ArrayList<String>(); noOfBuilds.add("1"); noOfBuilds.add("2"); noOfBuilds.add("3"); noOfBuilds.add("5"); noOfBuilds.add("10"); noOfBuilds.add("20"); noOfBuilds.add("50"); noOfBuilds.add("100"); noOfBuilds.add("200"); noOfBuilds.add("500"); for (final String noOfBuild : noOfBuilds) { options.add(noOfBuild); } return options; }
/** * Display No Of Builds Items in the Edit View Page * * @return ListBoxModel */
Display No Of Builds Items in the Edit View Page
doFillNoOfDisplayedBuildsItems
{ "repo_name": "mbidewell/build-pipeline-plugin", "path": "src/main/java/au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView.java", "license": "mit", "size": 33936 }
[ "hudson.util.ListBoxModel", "java.util.ArrayList", "java.util.List" ]
import hudson.util.ListBoxModel; import java.util.ArrayList; import java.util.List;
import hudson.util.*; import java.util.*;
[ "hudson.util", "java.util" ]
hudson.util; java.util;
1,745,551
public static void systemTopicEventSubscriptionsUpdate( com.azure.resourcemanager.eventgrid.EventGridManager manager) { manager .systemTopicEventSubscriptions() .update( "examplerg", "exampleSystemTopic1", "exampleEventSubscriptionName1", new EventSubscriptionUpdateParameters() .withDestination( new WebhookEventSubscriptionDestination().withEndpointUrl("https://requestb.in/15ksip71")) .withFilter( new EventSubscriptionFilter() .withSubjectBeginsWith("existingPrefix") .withSubjectEndsWith("newSuffix") .withIsSubjectCaseSensitive(true)) .withLabels(Arrays.asList("label1", "label2")), Context.NONE); }
static void function( com.azure.resourcemanager.eventgrid.EventGridManager manager) { manager .systemTopicEventSubscriptions() .update( STR, STR, STR, new EventSubscriptionUpdateParameters() .withDestination( new WebhookEventSubscriptionDestination().withEndpointUrl(STRexistingPrefixSTRnewSuffixSTRlabel1STRlabel2")), Context.NONE); }
/** * Sample code: SystemTopicEventSubscriptions_Update. * * @param manager Entry point to EventGridManager. */
Sample code: SystemTopicEventSubscriptions_Update
systemTopicEventSubscriptionsUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/eventgrid/azure-resourcemanager-eventgrid/src/samples/java/com/azure/resourcemanager/eventgrid/generated/SystemTopicEventSubscriptionsUpdateSamples.java", "license": "mit", "size": 1879 }
[ "com.azure.core.util.Context", "com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters", "com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination" ]
import com.azure.core.util.Context; import com.azure.resourcemanager.eventgrid.models.EventSubscriptionUpdateParameters; import com.azure.resourcemanager.eventgrid.models.WebhookEventSubscriptionDestination;
import com.azure.core.util.*; import com.azure.resourcemanager.eventgrid.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,138,214
public void onReceivedNotification(final Notification notification) { GenericLogger logger = nativePlatform.getNativeLogger(); if (stopReceiving) { logger.debug(TAG, "In stopSending mode NOT delivering notifications!!!"); return; }
void function(final Notification notification) { GenericLogger logger = nativePlatform.getNativeLogger(); if (stopReceiving) { logger.debug(TAG, STR); return; }
/** * Received notification, call the notification receiver callback to pass the notification * @param notification */
Received notification, call the notification receiver callback to pass the notification
onReceivedNotification
{ "repo_name": "hybridgroup/alljoyn", "path": "alljoyn/services/notification/java/NotificationService/src/org/alljoyn/ns/transport/consumer/ReceiverTransport.java", "license": "isc", "size": 23793 }
[ "org.alljoyn.ns.Notification", "org.alljoyn.ns.commons.GenericLogger" ]
import org.alljoyn.ns.Notification; import org.alljoyn.ns.commons.GenericLogger;
import org.alljoyn.ns.*; import org.alljoyn.ns.commons.*;
[ "org.alljoyn.ns" ]
org.alljoyn.ns;
1,660,838
MParameterValueExpression getDefaultValue();
MParameterValueExpression getDefaultValue();
/** * Returns the default value of the parameter for the given platform. * @return the default value of the parameter. * @see #setDefaultValue(MParameterValueExpression) * @see es.uah.aut.srg.micobs.pdl.pdlPackage#getMParameterOSSPSwitchCase_DefaultValue() * @model containment="true" required="true" * @generated */
Returns the default value of the parameter for the given platform
getDefaultValue
{ "repo_name": "parraman/micobs", "path": "common/es.uah.aut.srg.micobs.pdl/src/es/uah/aut/srg/micobs/pdl/MParameterOSSPSwitchCase.java", "license": "epl-1.0", "size": 2356 }
[ "es.uah.aut.srg.micobs.common.MParameterValueExpression" ]
import es.uah.aut.srg.micobs.common.MParameterValueExpression;
import es.uah.aut.srg.micobs.common.*;
[ "es.uah.aut" ]
es.uah.aut;
152,285
List<UserAccount> findAll();
List<UserAccount> findAll();
/** * Finds all normal Converge {@link UserAccount}s. * * @return {@link List} of Converge {@link UserAccount}s */
Finds all normal Converge <code>UserAccount</code>s
findAll
{ "repo_name": "getconverge/converge-1.x", "path": "modules/converge-ejb/src/main/java/dk/i2m/converge/ejb/services/UserServiceLocal.java", "license": "gpl-3.0", "size": 5727 }
[ "dk.i2m.converge.core.security.UserAccount", "java.util.List" ]
import dk.i2m.converge.core.security.UserAccount; import java.util.List;
import dk.i2m.converge.core.security.*; import java.util.*;
[ "dk.i2m.converge", "java.util" ]
dk.i2m.converge; java.util;
1,169,782
@Deprecated List<User> getAdmins(PerunSession sess, Facility facility) throws InternalErrorException;
List<User> getAdmins(PerunSession sess, Facility facility) throws InternalErrorException;
/** * Gets list of all user administrators of the Facility. * If some group is administrator of the given group, all members are included in the list. * * @param sess * @param facility * @return list of Users who are admins in the facility * @throws InternalErrorException */
Gets list of all user administrators of the Facility. If some group is administrator of the given group, all members are included in the list
getAdmins
{ "repo_name": "Holdo/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/FacilitiesManagerBl.java", "license": "bsd-2-clause", "size": 34151 }
[ "cz.metacentrum.perun.core.api.Facility", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.User", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,453,006
public List<TableGetResultsInner> listTables(String resourceGroupName, String accountName) { return listTablesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
List<TableGetResultsInner> function(String resourceGroupName, String accountName) { return listTablesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
/** * Lists the Tables under an existing Azure Cosmos DB database account. * * @param resourceGroupName Name of an Azure resource group. * @param accountName Cosmos DB database account name. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List&lt;TableGetResultsInner&gt; object if successful. */
Lists the Tables under an existing Azure Cosmos DB database account
listTables
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesInner.java", "license": "mit", "size": 56548 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,538,377
public static boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest(final WebContext context, final ZonedDateTime authenticationDate) { val maxAge = getOidcMaxAgeFromAuthorizationRequest(context); if (maxAge.isPresent() && maxAge.get() > 0) { val now = ZonedDateTime.now(ZoneOffset.UTC).toEpochSecond(); val authTime = authenticationDate.toEpochSecond(); val diffInSeconds = now - authTime; if (diffInSeconds > maxAge.get()) { LOGGER.info("Authentication is too old: [{}] and was created [{}] seconds ago.", authTime, diffInSeconds); return true; } } return false; }
static boolean function(final WebContext context, final ZonedDateTime authenticationDate) { val maxAge = getOidcMaxAgeFromAuthorizationRequest(context); if (maxAge.isPresent() && maxAge.get() > 0) { val now = ZonedDateTime.now(ZoneOffset.UTC).toEpochSecond(); val authTime = authenticationDate.toEpochSecond(); val diffInSeconds = now - authTime; if (diffInSeconds > maxAge.get()) { LOGGER.info(STR, authTime, diffInSeconds); return true; } } return false; }
/** * Is cas authentication old for max age authorization request boolean. * * @param context the context * @param authenticationDate the authentication date * @return true/false */
Is cas authentication old for max age authorization request boolean
isCasAuthenticationOldForMaxAgeAuthorizationRequest
{ "repo_name": "pdrados/cas", "path": "support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/util/OidcAuthorizationRequestSupport.java", "license": "apache-2.0", "size": 7923 }
[ "java.time.ZoneOffset", "java.time.ZonedDateTime", "org.pac4j.core.context.WebContext" ]
import java.time.ZoneOffset; import java.time.ZonedDateTime; import org.pac4j.core.context.WebContext;
import java.time.*; import org.pac4j.core.context.*;
[ "java.time", "org.pac4j.core" ]
java.time; org.pac4j.core;
1,391,024
public static String getSpawnedRecordID(final lotus.domino.Name name) { WrapperFactory wf = Factory.getWrapperFactory(); return Strings.getSpawnedRecordID(wf.fromLotus(name, Name.SCHEMA, null)); }
static String function(final lotus.domino.Name name) { WrapperFactory wf = Factory.getWrapperFactory(); return Strings.getSpawnedRecordID(wf.fromLotus(name, Name.SCHEMA, null)); }
/** * Generates a RecordID from a Name * * Format: Name.idPrefix (4 Alpha characters) + "-" + Dates.TimeCode (6 character base36 value representing the time). * * @param name * Name for which to generate a RecordID * * @return new RecordID * * @see Name#getIDprefix() * @see Dates#getTimeCode() * */
Generates a RecordID from a Name Format: Name.idPrefix (4 Alpha characters) + "-" + Dates.TimeCode (6 character base36 value representing the time)
getSpawnedRecordID
{ "repo_name": "rPraml/org.openntf.domino", "path": "domino/deprecated/src/main/java/org/openntf/domino/utils/Strings.java", "license": "apache-2.0", "size": 35606 }
[ "org.openntf.domino.Name", "org.openntf.domino.WrapperFactory" ]
import org.openntf.domino.Name; import org.openntf.domino.WrapperFactory;
import org.openntf.domino.*;
[ "org.openntf.domino" ]
org.openntf.domino;
2,143,247
private Message obtainCompleteMessage() { return obtainCompleteMessage(EVENT_OPERATION_COMPLETE); }
Message function() { return obtainCompleteMessage(EVENT_OPERATION_COMPLETE); }
/** * Obtain a message to use for signalling "invoke getCurrentCalls() when * this operation and all other pending operations are complete */
Obtain a message to use for signalling "invoke getCurrentCalls() when this operation and all other pending operations are complete
obtainCompleteMessage
{ "repo_name": "mateor/pdroid", "path": "android-4.0.3_r1/trunk/frameworks/base/telephony/java/com/android/internal/telephony/cdma/CdmaCallTracker.java", "license": "gpl-3.0", "size": 41879 }
[ "android.os.Message" ]
import android.os.Message;
import android.os.*;
[ "android.os" ]
android.os;
1,074,416
public static String[] tokenize(String entry, String delimiters) { final Collection<String> tokens = tokenize(entry, delimiters, new LinkedList<String>()); return tokens.toArray(new String[tokens.size()]); }
static String[] function(String entry, String delimiters) { final Collection<String> tokens = tokenize(entry, delimiters, new LinkedList<String>()); return tokens.toArray(new String[tokens.size()]); }
/** * Get a canonical array of tokens from a String entry * that may contain zero or more tokens separated by characters in * delimiters string. * * @param entry a String that may contain zero or more * delimiters separated tokens. * @param delimiters string with delimiters, every character represents one * delimiter. * @return the array of tokens, each tokens is trimmed, the array will * not contain any empty or {@code null} entries. */
Get a canonical array of tokens from a String entry that may contain zero or more tokens separated by characters in delimiters string
tokenize
{ "repo_name": "agentlab/org.glassfish.jersey", "path": "plugins/org.glassfish.jersey.common/src/main/java/org/glassfish/jersey/internal/util/Tokenizer.java", "license": "epl-1.0", "size": 7065 }
[ "java.util.Collection", "java.util.LinkedList" ]
import java.util.Collection; import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
331,274
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncClientStreamingCall( final ClientStreamingMethod<ReqT, RespT> method) { return asyncStreamingRequestCall(method); }
static <ReqT, RespT> ServerCallHandler<ReqT, RespT> function( final ClientStreamingMethod<ReqT, RespT> method) { return asyncStreamingRequestCall(method); }
/** * Creates a {@code ServerCallHandler} for a client streaming method of the service. * * @param method an adaptor to the actual method on the service implementation. */
Creates a ServerCallHandler for a client streaming method of the service
asyncClientStreamingCall
{ "repo_name": "anuraaga/grpc-java", "path": "stub/src/main/java/io/grpc/stub/ServerCalls.java", "license": "bsd-3-clause", "size": 13343 }
[ "io.grpc.ServerCallHandler" ]
import io.grpc.ServerCallHandler;
import io.grpc.*;
[ "io.grpc" ]
io.grpc;
1,515,012
final long timeCreate = 15; String[] answer = {"0", "ss", "d", "d", "15", "y"}; System.setOut(new PrintStream(out)); boolean check = false; StartUI stUI = new StartUI(new StubInput(answer)); stUI.init(tracker); if (out.toString().contains("Please, enter number")) { check = true; } Item item = new Item("ss", "d", timeCreate); List<Item> res = stUI.getTracker().getByFilter(new Filter("ss")); assertThat(res.get(0).getName(), is(item.getName())); assertThat(check, is(true)); }
final long timeCreate = 15; String[] answer = {"0", "ss", "d", "d", "15", "y"}; System.setOut(new PrintStream(out)); boolean check = false; StartUI stUI = new StartUI(new StubInput(answer)); stUI.init(tracker); if (out.toString().contains(STR)) { check = true; } Item item = new Item("ss", "d", timeCreate); List<Item> res = stUI.getTracker().getByFilter(new Filter("ss")); assertThat(res.get(0).getName(), is(item.getName())); assertThat(check, is(true)); }
/** * Test for paragraph 0 in menu StartUI(MenuTracker). */
Test for paragraph 0 in menu StartUI(MenuTracker)
whenUserSet0inMenuThenResultIs
{ "repo_name": "MorpG/Java-course", "path": "package_2/sql/jdbc/src/test/java/ru/agolovin/start/StartUITest.java", "license": "apache-2.0", "size": 4967 }
[ "java.io.PrintStream", "java.util.List", "org.hamcrest.core.Is", "org.junit.Assert", "ru.agolovin.models.Filter", "ru.agolovin.models.Item" ]
import java.io.PrintStream; import java.util.List; import org.hamcrest.core.Is; import org.junit.Assert; import ru.agolovin.models.Filter; import ru.agolovin.models.Item;
import java.io.*; import java.util.*; import org.hamcrest.core.*; import org.junit.*; import ru.agolovin.models.*;
[ "java.io", "java.util", "org.hamcrest.core", "org.junit", "ru.agolovin.models" ]
java.io; java.util; org.hamcrest.core; org.junit; ru.agolovin.models;
2,446,634
private void subscribe(Throwable exception) { Connection c = Connections.getInstance(context).getConnection(clientHandle); String action = context.getString(R.string.toast_sub_failed, (Object[]) additionalArgs); c.addAction(action); Notify.toast(context, action, Toast.LENGTH_SHORT); }
void function(Throwable exception) { Connection c = Connections.getInstance(context).getConnection(clientHandle); String action = context.getString(R.string.toast_sub_failed, (Object[]) additionalArgs); c.addAction(action); Notify.toast(context, action, Toast.LENGTH_SHORT); }
/** * A subscribe action was unsuccessful, notify user and update client history * @param exception This argument is not used */
A subscribe action was unsuccessful, notify user and update client history
subscribe
{ "repo_name": "jacarrichan/org.eclipse.paho.mqtt.java", "path": "org.eclipse.paho.android.service/org.eclipse.paho.android.service.sample/src/org/eclipse/paho/android/service/sample/ActionListener.java", "license": "epl-1.0", "size": 7245 }
[ "android.widget.Toast" ]
import android.widget.Toast;
import android.widget.*;
[ "android.widget" ]
android.widget;
2,327,168
public StoreFileScanner getStreamScanner(boolean canUseDropBehind, boolean cacheBlocks, boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) throws IOException { return createStreamReader(canUseDropBehind).getStoreFileScanner(cacheBlocks, false, isCompaction, readPt, scannerOrder, canOptimizeForNonNullColumn); }
StoreFileScanner function(boolean canUseDropBehind, boolean cacheBlocks, boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) throws IOException { return createStreamReader(canUseDropBehind).getStoreFileScanner(cacheBlocks, false, isCompaction, readPt, scannerOrder, canOptimizeForNonNullColumn); }
/** * Get a scanner which uses streaming read. * <p> * Must be called after initReader. */
Get a scanner which uses streaming read. Must be called after initReader
getStreamScanner
{ "repo_name": "JingchengDu/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStoreFile.java", "license": "apache-2.0", "size": 20338 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,682,996
public static void systemCallLabelSetHorizontalAlignment( int labelID, HorizontalAlignment horizontalAlignment, Wrapper<ReturnCode> outReturnCode, Wrapper<GuiReturnCode> outGuiReturnCode ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(labelID)); params.add(Parameter.createInt(horizontalAlignment.getValue())); QAMessage response = Kernel.systemCall("de.silveryard.basesystem.systemcall.gui.label.sethorizontalalignment", params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outGuiReturnCode.value = GuiReturnCode.getEnumValue(response.getParameters().get(1).getInt()); }
static void function( int labelID, HorizontalAlignment horizontalAlignment, Wrapper<ReturnCode> outReturnCode, Wrapper<GuiReturnCode> outGuiReturnCode ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(labelID)); params.add(Parameter.createInt(horizontalAlignment.getValue())); QAMessage response = Kernel.systemCall(STR, params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outGuiReturnCode.value = GuiReturnCode.getEnumValue(response.getParameters().get(1).getInt()); }
/** * Sets the horizontal alignment of a given label * @param labelID ID of the label * @param horizontalAlignment Horizontal Alignment Value * @param outReturnCode General Return Code * @param outGuiReturnCode Gui Return Code */
Sets the horizontal alignment of a given label
systemCallLabelSetHorizontalAlignment
{ "repo_name": "Silveryard/BaseSystem", "path": "Libraries/App/Java/AppSDK/src/main/java/de/silveryard/basesystem/sdk/kernel/gui/Label.java", "license": "mit", "size": 20098 }
[ "de.silveryard.basesystem.sdk.kernel.Kernel", "de.silveryard.basesystem.sdk.kernel.ReturnCode", "de.silveryard.basesystem.sdk.kernel.Wrapper", "de.silveryard.transport.Parameter", "de.silveryard.transport.highlevelprotocols.qa.QAMessage", "java.util.ArrayList", "java.util.List" ]
import de.silveryard.basesystem.sdk.kernel.Kernel; import de.silveryard.basesystem.sdk.kernel.ReturnCode; import de.silveryard.basesystem.sdk.kernel.Wrapper; import de.silveryard.transport.Parameter; import de.silveryard.transport.highlevelprotocols.qa.QAMessage; import java.util.ArrayList; import java.util.List;
import de.silveryard.basesystem.sdk.kernel.*; import de.silveryard.transport.*; import de.silveryard.transport.highlevelprotocols.qa.*; import java.util.*;
[ "de.silveryard.basesystem", "de.silveryard.transport", "java.util" ]
de.silveryard.basesystem; de.silveryard.transport; java.util;
2,270,078
public void delete(int i) { if (i < 0 || i >= n) throw new IndexOutOfBoundsException(); if (!contains(i)) throw new NoSuchElementException("Specified index is not in the queue"); toTheRoot(i); Node<Key> x = erase(i); if (x.child != null) { Node<Key> y = x; x = x.child; y.child = null; Node<Key> prevx = null, nextx = x.sibling; while (nextx != null) { x.parent = null; x.sibling = prevx; prevx = x; x = nextx; nextx = nextx.sibling; } x.parent = null; x.sibling = prevx; IndexBinomialMinPQ<Key> H = new IndexBinomialMinPQ<Key>(); H.head = x; head = union(H).head; } }
void function(int i) { if (i < 0 i >= n) throw new IndexOutOfBoundsException(); if (!contains(i)) throw new NoSuchElementException(STR); toTheRoot(i); Node<Key> x = erase(i); if (x.child != null) { Node<Key> y = x; x = x.child; y.child = null; Node<Key> prevx = null, nextx = x.sibling; while (nextx != null) { x.parent = null; x.sibling = prevx; prevx = x; x = nextx; nextx = nextx.sibling; } x.parent = null; x.sibling = prevx; IndexBinomialMinPQ<Key> H = new IndexBinomialMinPQ<Key>(); H.head = x; head = union(H).head; } }
/** * Deletes the key associated the given index * Worst case is O(log(n)) * @param i an index * @throws java.lang.IndexOutOfBoundsException if the specified index is invalid * @throws java.util.NoSuchElementException if the given index has no key associated with */
Deletes the key associated the given index Worst case is O(log(n))
delete
{ "repo_name": "ahmedkhaled4d/php-pages", "path": "Algorithms/src/IndexBinomialMinPQ.java", "license": "gpl-2.0", "size": 17668 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
1,263,418
public boolean areRestrictionsInclusive() { for (Map.Entry<Subpart, Set<Section>> entry: getSections().entrySet()) { if (getConfigs().contains(entry.getKey().getConfig())) return true; } return false; }
boolean function() { for (Map.Entry<Subpart, Set<Section>> entry: getSections().entrySet()) { if (getConfigs().contains(entry.getKey().getConfig())) return true; } return false; }
/** * Check if restrictions are inclusive (that is for each section, the reservation also contains all its parents and the configuration) */
Check if restrictions are inclusive (that is for each section, the reservation also contains all its parents and the configuration)
areRestrictionsInclusive
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/studentsct/reservation/Reservation.java", "license": "lgpl-3.0", "size": 26577 }
[ "java.util.Map", "java.util.Set", "org.cpsolver.studentsct.model.Section", "org.cpsolver.studentsct.model.Subpart" ]
import java.util.Map; import java.util.Set; import org.cpsolver.studentsct.model.Section; import org.cpsolver.studentsct.model.Subpart;
import java.util.*; import org.cpsolver.studentsct.model.*;
[ "java.util", "org.cpsolver.studentsct" ]
java.util; org.cpsolver.studentsct;
2,519,132
@Override public Set<Entry<Object, HashTree>> entrySet() { return data.entrySet(); }
Set<Entry<Object, HashTree>> function() { return data.entrySet(); }
/** * Exists to satisfy the Map interface. * * @see java.util.Map#entrySet() */
Exists to satisfy the Map interface
entrySet
{ "repo_name": "aksivaram2k2/jmeter-trunk", "path": "src/jorphan/org/apache/jorphan/collections/HashTree.java", "license": "apache-2.0", "size": 36043 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,491,997
Array readArray(InputStream jsonStream) throws IOException;
Array readArray(InputStream jsonStream) throws IOException;
/** * Read an array from the supplied stream. * * @param jsonStream the input stream to be read; may not be null * @return the array instance; never null * @throws IOException if an array could not be read from the supplied stream */
Read an array from the supplied stream
readArray
{ "repo_name": "rhauch/debezium-proto", "path": "debezium/src/main/java/org/debezium/message/ArrayReader.java", "license": "apache-2.0", "size": 3178 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,564,174
@Then("^application version must be \"(.*?)\"$") public static void assertAppVersion(String version){ assertAppInfo("version", version); }
@Then(STR(.*?)\"$") static void function(String version){ assertAppInfo(STR, version); }
/** * Checks the application version. Stops the test in case of failure. * * @param version the application version to check */
Checks the application version. Stops the test in case of failure
assertAppVersion
{ "repo_name": "Project-Quantum/Quantum", "path": "src/main/java/com/quantum/steps/PerfectoApplicationSteps.java", "license": "mit", "size": 26664 }
[ "com.quantum.utils.DeviceUtils" ]
import com.quantum.utils.DeviceUtils;
import com.quantum.utils.*;
[ "com.quantum.utils" ]
com.quantum.utils;
1,836,311
public float getRotation() { if ( rotation == null ) { rotation = (SFFloat)getField( "rotation" ); } return( rotation.getValue( ) ); }
float function() { if ( rotation == null ) { rotation = (SFFloat)getField( STR ); } return( rotation.getValue( ) ); }
/** Return the rotation float value. * @return The rotation float value. */
Return the rotation float value
getRotation
{ "repo_name": "Norkart/NK-VirtualGlobe", "path": "Xj3D/src/java/org/xj3d/sai/external/node/texturing/SAITextureTransform.java", "license": "gpl-2.0", "size": 3600 }
[ "org.web3d.x3d.sai.SFFloat" ]
import org.web3d.x3d.sai.SFFloat;
import org.web3d.x3d.sai.*;
[ "org.web3d.x3d" ]
org.web3d.x3d;
858,924
@Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) public void testCheckXPathExpression22() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is), STRING); } }
@Test(groups = {STR}, expectedExceptions = NullPointerException.class) void function() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is), STRING); } }
/** * evaluate(InputSource source,QName returnType) throws NPE if expression is * null. * * @throws Exception If any errors occur. */
evaluate(InputSource source,QName returnType) throws NPE if expression is null
testCheckXPathExpression22
{ "repo_name": "lostdj/Jaklin-OpenJDK-JAXP", "path": "test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java", "license": "gpl-2.0", "size": 17755 }
[ "java.io.InputStream", "java.nio.file.Files", "org.testng.annotations.Test", "org.xml.sax.InputSource" ]
import java.io.InputStream; import java.nio.file.Files; import org.testng.annotations.Test; import org.xml.sax.InputSource;
import java.io.*; import java.nio.file.*; import org.testng.annotations.*; import org.xml.sax.*;
[ "java.io", "java.nio", "org.testng.annotations", "org.xml.sax" ]
java.io; java.nio; org.testng.annotations; org.xml.sax;
1,272,833
public void setSuffixText(@Nullable final CharSequence suffixText) { this.suffixText = TextUtils.isEmpty(suffixText) ? null : suffixText; suffixTextView.setText(suffixText); updateSuffixTextVisibility(); }
void function(@Nullable final CharSequence suffixText) { this.suffixText = TextUtils.isEmpty(suffixText) ? null : suffixText; suffixTextView.setText(suffixText); updateSuffixTextVisibility(); }
/** * Sets suffix text that will be displayed in the input area when the hint is collapsed before * text is entered. If the {@code suffix} is {@code null}, any previous suffix text will be hidden * and no suffix text will be shown. * * @param suffixText Suffix text to display * @see #getSuffixText() */
Sets suffix text that will be displayed in the input area when the hint is collapsed before text is entered. If the suffix is null, any previous suffix text will be hidden and no suffix text will be shown
setSuffixText
{ "repo_name": "material-components/material-components-android", "path": "lib/java/com/google/android/material/textfield/TextInputLayout.java", "license": "apache-2.0", "size": 171507 }
[ "android.text.TextUtils", "androidx.annotation.Nullable" ]
import android.text.TextUtils; import androidx.annotation.Nullable;
import android.text.*; import androidx.annotation.*;
[ "android.text", "androidx.annotation" ]
android.text; androidx.annotation;
1,858,292
DateTime getLastReviewDateByExpertId(Integer expertId);
DateTime getLastReviewDateByExpertId(Integer expertId);
/** * Gets the date of the last disease occurrence review submitted by a specific expert. * @param expertId The expert's Id. * @return The date of the last disease occurrence review. */
Gets the date of the last disease occurrence review submitted by a specific expert
getLastReviewDateByExpertId
{ "repo_name": "SEEG-Oxford/ABRAID-MP", "path": "src/Common/src/uk/ac/ox/zoo/seeg/abraid/mp/common/dao/DiseaseOccurrenceReviewDao.java", "license": "apache-2.0", "size": 2244 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
550,128
public static Set<CharSequence> toSet(CharSequence self) { return new HashSet<CharSequence>(toList(self)); }
static Set<CharSequence> function(CharSequence self) { return new HashSet<CharSequence>(toList(self)); }
/** * Converts the given CharSequence into a Set of unique CharSequence of one character. * * @param self a CharSequence * @return a Set of unique character CharSequence (each a 1-character CharSequence) * @see #toSet(String) * @since 1.8.2 */
Converts the given CharSequence into a Set of unique CharSequence of one character
toSet
{ "repo_name": "xien777/yajsw", "path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "lgpl-2.1", "size": 704150 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,416,208
public List<Varbind> getVarbindCollection( ) { return this.m_varbindList; }
List<Varbind> function( ) { return this.m_varbindList; }
/** * Method getVarbindCollection.Returns a reference to * '_varbindList'. No type checking is performed on any * modifications to the Vector. * * @return a reference to the Vector backing this class */
Method getVarbindCollection.Returns a reference to '_varbindList'. No type checking is performed on any modifications to the Vector
getVarbindCollection
{ "repo_name": "vishwaAbhinav/OpenNMS", "path": "opennms-config/src/main/java/org/opennms/netmgt/xml/eventconf/Mask.java", "license": "gpl-2.0", "size": 18137 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
895,278
private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtils.writePaint(this.paint, stream); SerialUtils.writeStroke(this.stroke, stream); }
void function(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtils.writePaint(this.paint, stream); SerialUtils.writeStroke(this.stroke, stream); }
/** * Provides serialization support. * * @param stream the output stream. * * @throws IOException if there is an I/O error. */
Provides serialization support
writeObject
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/main/java/org/jfree/chart/block/LineBorder.java", "license": "lgpl-2.1", "size": 7553 }
[ "java.io.IOException", "java.io.ObjectOutputStream", "org.jfree.chart.util.SerialUtils" ]
import java.io.IOException; import java.io.ObjectOutputStream; import org.jfree.chart.util.SerialUtils;
import java.io.*; import org.jfree.chart.util.*;
[ "java.io", "org.jfree.chart" ]
java.io; org.jfree.chart;
2,055,727
public ParcelFileDescriptor executeForBlobFileDescriptor(String sql, Object[] bindArgs, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException("sql must not be null."); } final int cookie = mRecentOperations.beginOperation("executeForBlobFileDescriptor", sql, bindArgs); try { final PreparedStatement statement = acquirePreparedStatement(sql); try { throwIfStatementForbidden(statement); bindArguments(statement, bindArgs); applyBlockGuardPolicy(statement); attachCancellationSignal(cancellationSignal); try { int fd = nativeExecuteForBlobFileDescriptor( mConnectionPtr, statement.mStatementPtr); return fd >= 0 ? ParcelFileDescriptor.adoptFd(fd) : null; } finally { detachCancellationSignal(cancellationSignal); } } finally { releasePreparedStatement(statement); } } catch (RuntimeException ex) { mRecentOperations.failOperation(cookie, ex); throw ex; } finally { mRecentOperations.endOperation(cookie); } }
ParcelFileDescriptor function(String sql, Object[] bindArgs, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException(STR); } final int cookie = mRecentOperations.beginOperation(STR, sql, bindArgs); try { final PreparedStatement statement = acquirePreparedStatement(sql); try { throwIfStatementForbidden(statement); bindArguments(statement, bindArgs); applyBlockGuardPolicy(statement); attachCancellationSignal(cancellationSignal); try { int fd = nativeExecuteForBlobFileDescriptor( mConnectionPtr, statement.mStatementPtr); return fd >= 0 ? ParcelFileDescriptor.adoptFd(fd) : null; } finally { detachCancellationSignal(cancellationSignal); } } finally { releasePreparedStatement(statement); } } catch (RuntimeException ex) { mRecentOperations.failOperation(cookie, ex); throw ex; } finally { mRecentOperations.endOperation(cookie); } }
/** * Executes a statement that returns a single BLOB result as a * file descriptor to a shared memory region. * * @param sql The SQL statement to execute. * @param bindArgs The arguments to bind, or null if none. * @param cancellationSignal A signal to cancel the operation in progress, or null if none. * @return The file descriptor for a shared memory region that contains * the value of the first column in the first row of the result set as a BLOB, * or null if none. * * @throws SQLiteException if an error occurs, such as a syntax error * or invalid number of bind arguments. * @throws OperationCanceledException if the operation was canceled. */
Executes a statement that returns a single BLOB result as a file descriptor to a shared memory region
executeForBlobFileDescriptor
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/database/sqlite/SQLiteConnection.java", "license": "apache-2.0", "size": 62507 }
[ "android.os.CancellationSignal", "android.os.ParcelFileDescriptor" ]
import android.os.CancellationSignal; import android.os.ParcelFileDescriptor;
import android.os.*;
[ "android.os" ]
android.os;
2,062,415
public void deleteSubCollection(final String id) throws IOException { final Subcollection subCol = getSubColection(id); if (subCol != null) { collectionMap.remove(id); } }
void function(final String id) throws IOException { final Subcollection subCol = getSubColection(id); if (subCol != null) { collectionMap.remove(id); } }
/** * Delete named subcollection * * @param id * Id of SubCollection to delete */
Delete named subcollection
deleteSubCollection
{ "repo_name": "kkllwww007/anthelion", "path": "src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java", "license": "apache-2.0", "size": 7210 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,098,158
EReference getCCGR_CECtl();
EReference getCCGR_CECtl();
/** * Returns the meta object for the reference '{@link substationStandard.LNNodes.LNGroupC.CCGR#getCECtl <em>CE Ctl</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference '<em>CE Ctl</em>'. * @see substationStandard.LNNodes.LNGroupC.CCGR#getCECtl() * @see #getCCGR() * @generated */
Returns the meta object for the reference '<code>substationStandard.LNNodes.LNGroupC.CCGR#getCECtl CE Ctl</code>'.
getCCGR_CECtl
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/substationStandard/LNNodes/LNGroupC/LNGroupCPackage.java", "license": "mit", "size": 45797 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
780,872
@Transactional(readOnly=true) public PageList<ControlSchedule> getPendingControlActions(AuthzSubject subject, int rows) throws ApplicationException { StopWatch watch = new StopWatch(); // this routine ignores sort attribute! try { Collection<ControlSchedule> pending = controlScheduleDAO.findByFireTime(false); // Run through the list only returning entities the user // has the ability to see int count = 0; for (Iterator<ControlSchedule> i = pending.iterator(); i.hasNext();) { ControlSchedule sLocal = i.next(); AppdefEntityID entity = new AppdefEntityID(sLocal.getEntityType().intValue(), sLocal.getEntityId()); try { checkControlPermission(subject, entity); if (++count > rows) break; } catch (PermissionException e) { i.remove(); } } // This will remove stale data and update fire times which // may result in the list being out of order. We should // probably sort a second time PageList<ControlSchedule> list = schedulePager.seek(pending, 0, rows); return list; } finally { if (log.isDebugEnabled()) log.debug("getPendingControlActions(): " + watch.getElapsed()); } }
@Transactional(readOnly=true) PageList<ControlSchedule> function(AuthzSubject subject, int rows) throws ApplicationException { StopWatch watch = new StopWatch(); try { Collection<ControlSchedule> pending = controlScheduleDAO.findByFireTime(false); int count = 0; for (Iterator<ControlSchedule> i = pending.iterator(); i.hasNext();) { ControlSchedule sLocal = i.next(); AppdefEntityID entity = new AppdefEntityID(sLocal.getEntityType().intValue(), sLocal.getEntityId()); try { checkControlPermission(subject, entity); if (++count > rows) break; } catch (PermissionException e) { i.remove(); } } PageList<ControlSchedule> list = schedulePager.seek(pending, 0, rows); return list; } finally { if (log.isDebugEnabled()) log.debug(STR + watch.getElapsed()); } }
/** * Get a list of pending control actions in decending order * * * */
Get a list of pending control actions in decending order
getPendingControlActions
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/control/server/session/ControlScheduleManagerImpl.java", "license": "unlicense", "size": 28539 }
[ "java.util.Collection", "java.util.Iterator", "org.hyperic.hq.appdef.shared.AppdefEntityID", "org.hyperic.hq.authz.server.session.AuthzSubject", "org.hyperic.hq.authz.shared.PermissionException", "org.hyperic.hq.common.ApplicationException", "org.hyperic.util.pager.PageList", "org.hyperic.util.timer.StopWatch", "org.springframework.transaction.annotation.Transactional" ]
import java.util.Collection; import java.util.Iterator; import org.hyperic.hq.appdef.shared.AppdefEntityID; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.common.ApplicationException; import org.hyperic.util.pager.PageList; import org.hyperic.util.timer.StopWatch; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import org.hyperic.hq.appdef.shared.*; import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; import org.hyperic.hq.common.*; import org.hyperic.util.pager.*; import org.hyperic.util.timer.*; import org.springframework.transaction.annotation.*;
[ "java.util", "org.hyperic.hq", "org.hyperic.util", "org.springframework.transaction" ]
java.util; org.hyperic.hq; org.hyperic.util; org.springframework.transaction;
1,369,768
@ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<Void>, Void> beginAttachAsync( String resourceGroupName, String labName, String username, String name, AttachDiskProperties attachDiskProperties) { Mono<Response<Flux<ByteBuffer>>> mono = attachWithResponseAsync(resourceGroupName, labName, username, name, attachDiskProperties); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); }
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> function( String resourceGroupName, String labName, String username, String name, AttachDiskProperties attachDiskProperties) { Mono<Response<Flux<ByteBuffer>>> mono = attachWithResponseAsync(resourceGroupName, labName, username, name, attachDiskProperties); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); }
/** * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. * * @param resourceGroupName The name of the resource group. * @param labName The name of the lab. * @param username The name of the user profile. * @param name The name of the disk. * @param attachDiskProperties Properties of the disk to attach. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete
beginAttachAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksClientImpl.java", "license": "mit", "size": 103311 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.PollerFlux", "com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.PollerFlux; import com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.devtestlabs.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
1,376,401
public List<? extends TransitiveInfoCollection> getPrerequisites(String attributeName, Mode mode) { return Lists.transform( getPrerequisiteConfiguredTargetAndTargets(attributeName, mode), ConfiguredTargetAndData::getConfiguredTarget); }
List<? extends TransitiveInfoCollection> function(String attributeName, Mode mode) { return Lists.transform( getPrerequisiteConfiguredTargetAndTargets(attributeName, mode), ConfiguredTargetAndData::getConfiguredTarget); }
/** * Returns the list of transitive info collections that feed into this target through the * specified attribute. Note that you need to specify the correct mode for the attribute, * otherwise an assertion will be raised. */
Returns the list of transitive info collections that feed into this target through the specified attribute. Note that you need to specify the correct mode for the attribute, otherwise an assertion will be raised
getPrerequisites
{ "repo_name": "ButterflyNetwork/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java", "license": "apache-2.0", "size": 82210 }
[ "com.google.common.collect.Lists", "com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget", "com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData", "java.util.List" ]
import com.google.common.collect.Lists; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget; import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData; import java.util.List;
import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.configuredtargets.*; import com.google.devtools.build.lib.skyframe.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
19,558
EReference getConversationNode_ParticipantRefs();
EReference getConversationNode_ParticipantRefs();
/** * Returns the meta object for the reference list '{@link org.eclipse.bpmn2.ConversationNode#getParticipantRefs <em>Participant Refs</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Participant Refs</em>'. * @see org.eclipse.bpmn2.ConversationNode#getParticipantRefs() * @see #getConversationNode() * @generated */
Returns the meta object for the reference list '<code>org.eclipse.bpmn2.ConversationNode#getParticipantRefs Participant Refs</code>'.
getConversationNode_ParticipantRefs
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,168
public static void showHtml(Vector vec) throws IOException { showHtml(vec, mkVectorColorMapper(vec)); }
static void function(Vector vec) throws IOException { showHtml(vec, mkVectorColorMapper(vec)); }
/** * Shows given vector in the browser with D3-based visualization. * * @param vec Vector to show. * @throws IOException Thrown in case of any errors. */
Shows given vector in the browser with D3-based visualization
showHtml
{ "repo_name": "nivanov/ignite", "path": "modules/math/src/main/java/org/apache/ignite/math/Tracer.java", "license": "apache-2.0", "size": 14147 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
459,400
public Triple<EObject, EReference, INode> decode(Resource res, String uriFragment) { if (isUseIndexFragment(res)) { return getLazyProxyInformation(res, uriFragment); } List<String> split = Strings.split(uriFragment, SEP); EObject source = resolveShortFragment(res, split.get(1)); EReference ref = fromShortExternalForm(source.eClass(), split.get(2)); INode compositeNode = NodeModelUtils.getNode(source); if (compositeNode==null) throw new IllegalStateException("Couldn't resolve lazy link, because no node model is attached."); INode textNode = getNode(compositeNode, split.get(3)); return Tuples.create(source, ref, textNode); }
Triple<EObject, EReference, INode> function(Resource res, String uriFragment) { if (isUseIndexFragment(res)) { return getLazyProxyInformation(res, uriFragment); } List<String> split = Strings.split(uriFragment, SEP); EObject source = resolveShortFragment(res, split.get(1)); EReference ref = fromShortExternalForm(source.eClass(), split.get(2)); INode compositeNode = NodeModelUtils.getNode(source); if (compositeNode==null) throw new IllegalStateException(STR); INode textNode = getNode(compositeNode, split.get(3)); return Tuples.create(source, ref, textNode); }
/** * decodes the uriFragment * * @param res the resource that contains the feature holder * @param uriFragment the fragment that should be decoded * @return the decoded information * @see LazyURIEncoder#encode(EObject, EReference, INode) */
decodes the uriFragment
decode
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyURIEncoder.java", "license": "epl-1.0", "size": 8804 }
[ "java.util.List", "org.eclipse.emf.ecore.EObject", "org.eclipse.emf.ecore.EReference", "org.eclipse.emf.ecore.resource.Resource", "org.eclipse.xtext.nodemodel.INode", "org.eclipse.xtext.nodemodel.util.NodeModelUtils", "org.eclipse.xtext.util.Strings", "org.eclipse.xtext.util.Triple", "org.eclipse.xtext.util.Tuples" ]
import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.eclipse.xtext.util.Strings; import org.eclipse.xtext.util.Triple; import org.eclipse.xtext.util.Tuples;
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.emf.ecore.resource.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.nodemodel.util.*; import org.eclipse.xtext.util.*;
[ "java.util", "org.eclipse.emf", "org.eclipse.xtext" ]
java.util; org.eclipse.emf; org.eclipse.xtext;
2,572,451
public Document getFboxXmlResponse(String url) { Document tr064response = null; HttpGet httpGet = new HttpGet(url); boolean exceptionOccurred = false; try { CloseableHttpResponse resp = _httpClient.execute(httpGet, _httpClientContext); int responseCode = resp.getStatusLine().getStatusCode(); if (responseCode == 200) { HttpEntity entity = resp.getEntity(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); tr064response = db.parse(entity.getContent()); EntityUtils.consume(entity); } else { logger.error("Failed to receive valid response from httpGet"); } } catch (Exception e) { exceptionOccurred = true; logger.error("Failed to receive valid response from httpGet: {}", e.getMessage()); } finally { // Make sure connection is released. If error occurred make sure to print in log if (exceptionOccurred) { logger.error("Releasing connection to FritzBox because of error!"); } else { logger.debug("Releasing connection"); } httpGet.releaseConnection(); } return tr064response; }
Document function(String url) { Document tr064response = null; HttpGet httpGet = new HttpGet(url); boolean exceptionOccurred = false; try { CloseableHttpResponse resp = _httpClient.execute(httpGet, _httpClientContext); int responseCode = resp.getStatusLine().getStatusCode(); if (responseCode == 200) { HttpEntity entity = resp.getEntity(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); tr064response = db.parse(entity.getContent()); EntityUtils.consume(entity); } else { logger.error(STR); } } catch (Exception e) { exceptionOccurred = true; logger.error(STR, e.getMessage()); } finally { if (exceptionOccurred) { logger.error(STR); } else { logger.debug(STR); } httpGet.releaseConnection(); } return tr064response; }
/*** * sets up a raw http(s) connection to Fbox and gets xml response * as XML Document, ready for parsing * * @return */
sets up a raw http(s) connection to Fbox and gets xml response as XML Document, ready for parsing
getFboxXmlResponse
{ "repo_name": "cdjackson/openhab", "path": "bundles/binding/org.openhab.binding.fritzboxtr064/src/main/java/org/openhab/binding/fritzboxtr064/internal/Tr064Comm.java", "license": "epl-1.0", "size": 43398 }
[ "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "org.apache.http.HttpEntity", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpGet", "org.apache.http.util.EntityUtils", "org.w3c.dom.Document" ]
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import org.w3c.dom.Document;
import javax.xml.parsers.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.util.*; import org.w3c.dom.*;
[ "javax.xml", "org.apache.http", "org.w3c.dom" ]
javax.xml; org.apache.http; org.w3c.dom;
892,937