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 void createPartControl(Composite parent){ logger = LoggerFactory.getLogger(this.getClass()); GridLayout gridLayout = new GridLayout(1, false); gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; parent.setLayout(gridLayout); Composite topArea = new Composite(parent, SWT.NONE); topArea.setLayoutData(SWTHelper.getFillGridData(1, false, 1, false)); topArea.setLayout(new GridLayout()); Composite bottomArea = new Composite(parent, SWT.NONE); bottomArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); bottomArea.setLayout(new GridLayout()); // check boxes Composite pathArea = new Composite(topArea, SWT.NONE); pathArea.setLayout(new GridLayout(4, false));
void function(Composite parent){ logger = LoggerFactory.getLogger(this.getClass()); GridLayout gridLayout = new GridLayout(1, false); gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; parent.setLayout(gridLayout); Composite topArea = new Composite(parent, SWT.NONE); topArea.setLayoutData(SWTHelper.getFillGridData(1, false, 1, false)); topArea.setLayout(new GridLayout()); Composite bottomArea = new Composite(parent, SWT.NONE); bottomArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); bottomArea.setLayout(new GridLayout()); Composite pathArea = new Composite(topArea, SWT.NONE); pathArea.setLayout(new GridLayout(4, false));
/** * This is a callback that will allow us to create the viewer and initialize it. */
This is a callback that will allow us to create the viewer and initialize it
createPartControl
{ "repo_name": "DavidGutknecht/elexis-3-base", "path": "bundles/ch.elexis.externe_dokumente/src/ch/elexis/extdoc/views/ExterneDokumente.java", "license": "epl-1.0", "size": 25085 }
[ "ch.elexis.core.ui.util.SWTHelper", "org.eclipse.swt.layout.GridLayout", "org.eclipse.swt.widgets.Composite", "org.slf4j.LoggerFactory" ]
import ch.elexis.core.ui.util.SWTHelper; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.slf4j.LoggerFactory;
import ch.elexis.core.ui.util.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.slf4j.*;
[ "ch.elexis.core", "org.eclipse.swt", "org.slf4j" ]
ch.elexis.core; org.eclipse.swt; org.slf4j;
1,093,400
public Ip4Address routerId() { return routerId; }
Ip4Address function() { return routerId; }
/** * Gets the router id. * * @return router id */
Gets the router id
routerId
{ "repo_name": "kuujo/onos", "path": "protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/area/OspfAreaImpl.java", "license": "apache-2.0", "size": 27942 }
[ "org.onlab.packet.Ip4Address" ]
import org.onlab.packet.Ip4Address;
import org.onlab.packet.*;
[ "org.onlab.packet" ]
org.onlab.packet;
2,908,654
@Test public void testWriteMp4FileWithPaddingAfterLastAtom() { File orig = new File("testdata", "test35.m4a"); if (!orig.isFile()) { System.err.println("Unable to test file - not available" + orig); return; } File testFile = null; Exception exceptionCaught = null; try { testFile = TestUtil.copyAudioToTmp("test35.m4a"); //Add a v24Tag AudioFile af = AudioFileIO.read(testFile); af.getTag().or(NullTag.INSTANCE).setField(FieldKey.ALBUM, "NewValue"); af.save(); } catch (Exception e) { e.printStackTrace(); exceptionCaught = e; } //Ensure temp file deleted File[] files = testFile.getParentFile().listFiles(); for (File file : files) { System.out.println("Checking " + file.getName()); Assert.assertFalse(file.getName().matches(".*test35.*.tmp")); } Assert.assertNull(exceptionCaught); }
@Test void function() { File orig = new File(STR, STR); if (!orig.isFile()) { System.err.println(STR + orig); return; } File testFile = null; Exception exceptionCaught = null; try { testFile = TestUtil.copyAudioToTmp(STR); AudioFile af = AudioFileIO.read(testFile); af.getTag().or(NullTag.INSTANCE).setField(FieldKey.ALBUM, STR); af.save(); } catch (Exception e) { e.printStackTrace(); exceptionCaught = e; } File[] files = testFile.getParentFile().listFiles(); for (File file : files) { System.out.println(STR + file.getName()); Assert.assertFalse(file.getName().matches(STR)); } Assert.assertNull(exceptionCaught); }
/** * Test Mp4 with padding after last atom */
Test Mp4 with padding after last atom
testWriteMp4FileWithPaddingAfterLastAtom
{ "repo_name": "pandasys/ealvatag", "path": "ealvatag/src/test/java/ealvatag/issues/Issue255Test.java", "license": "lgpl-3.0", "size": 3488 }
[ "java.io.File", "org.junit.Assert", "org.junit.Test" ]
import java.io.File; import org.junit.Assert; import org.junit.Test;
import java.io.*; import org.junit.*;
[ "java.io", "org.junit" ]
java.io; org.junit;
1,832,174
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP * <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "aadityabagga/bugtrackingportal", "path": "src/java/Expert/ExpertReport.java", "license": "bsd-2-clause", "size": 4158 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
1,984,253
public T caseTestContainmentIndex(TestContainmentIndex object) { return null; }
T function(TestContainmentIndex object) { return null; }
/** * Returns the result of interpreting the object as an instance of '<em>Test Containment Index</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Test Containment Index</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'Test Containment Index'. This implementation returns null; returning a non-null result will terminate the switch.
caseTestContainmentIndex
{ "repo_name": "markus1978/emf-fragments", "path": "de.hub.emffrag.testmodels/gen-src/de/hub/emffrag/testmodels/testmodel/regular/util/TestModelSwitch.java", "license": "apache-2.0", "size": 8220 }
[ "de.hub.emffrag.testmodels.testmodel.TestContainmentIndex" ]
import de.hub.emffrag.testmodels.testmodel.TestContainmentIndex;
import de.hub.emffrag.testmodels.testmodel.*;
[ "de.hub.emffrag" ]
de.hub.emffrag;
1,672,993
private int _adjRevIvl(Card card, int idealIvl) { int idealDue = mToday + idealIvl; JSONObject conf; try { conf = _revConf(card); // find sibling positions ArrayList<Integer> dues = mCol.getDb() .queryColumn( Integer.class, "SELECT due FROM cards WHERE nid = " + card.getNid() + " AND type = 2 AND id != " + card.getId(), 0); if (dues.size() == 0 || !dues.contains(idealDue)) { return idealIvl; } else { int leeway = Math.max(conf.getInt("minSpace"), (int) (idealIvl * conf.getDouble("fuzz"))); int fudge = 0; // do we have any room to adjust the interval? if (leeway != 0) { // loop through possible due dates for an empty one for (int diff = 1; diff < leeway + 1; diff++) { // ensure we're due at least tomorrow if ((idealIvl - diff >= 1) && !dues.contains(idealDue - diff)) { fudge = -diff; break; } else if (!dues.contains(idealDue + diff)) { fudge = diff; break; } } } return idealIvl + fudge; } } catch (JSONException e) { throw new RuntimeException(e); } }
int function(Card card, int idealIvl) { int idealDue = mToday + idealIvl; JSONObject conf; try { conf = _revConf(card); ArrayList<Integer> dues = mCol.getDb() .queryColumn( Integer.class, STR + card.getNid() + STR + card.getId(), 0); if (dues.size() == 0 !dues.contains(idealDue)) { return idealIvl; } else { int leeway = Math.max(conf.getInt(STR), (int) (idealIvl * conf.getDouble("fuzz"))); int fudge = 0; if (leeway != 0) { for (int diff = 1; diff < leeway + 1; diff++) { if ((idealIvl - diff >= 1) && !dues.contains(idealDue - diff)) { fudge = -diff; break; } else if (!dues.contains(idealDue + diff)) { fudge = diff; break; } } } return idealIvl + fudge; } } catch (JSONException e) { throw new RuntimeException(e); } }
/** * Given IDEALIVL, return an IVL away from siblings. */
Given IDEALIVL, return an IVL away from siblings
_adjRevIvl
{ "repo_name": "zeejan/DeckPicker", "path": "src/com/ichi2/libanki/Sched.java", "license": "gpl-3.0", "size": 93271 }
[ "java.util.ArrayList", "org.json.JSONException", "org.json.JSONObject" ]
import java.util.ArrayList; import org.json.JSONException; import org.json.JSONObject;
import java.util.*; import org.json.*;
[ "java.util", "org.json" ]
java.util; org.json;
1,460,431
public static void catchErrorStackTrace(String messageTag, StackTraceElement[] stackTrace, HttpServletRequest request) throws ServletException, IOException { final HttpSession session = request.getSession(true); session.setAttribute("alert", new Alert(Alert.TYPE_ERROR, messageTag, stackTrace, new ArrayList<String>())); }
static void function(String messageTag, StackTraceElement[] stackTrace, HttpServletRequest request) throws ServletException, IOException { final HttpSession session = request.getSession(true); session.setAttribute("alert", new Alert(Alert.TYPE_ERROR, messageTag, stackTrace, new ArrayList<String>())); }
/** * Catch error stack trace. * * @param messageTag * the message tag * @param stackTrace * the stack trace * @param request * the request * * @throws ServletException * the servlet exception * @throws IOException * Signals that an I/O exception has occurred. */
Catch error stack trace
catchErrorStackTrace
{ "repo_name": "bschiefer/sqlcoach", "path": "sqlcoach-war/src/main/java/de/sqlcoach/bean/Alert.java", "license": "agpl-3.0", "size": 9420 }
[ "java.io.IOException", "java.util.ArrayList", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpSession" ]
import java.io.IOException; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;
import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "java.util", "javax.servlet" ]
java.io; java.util; javax.servlet;
1,475,035
public static InlineLabel newInlineLabel (String text, String... styles) { return setStyleNames(new InlineLabel(text), styles); }
static InlineLabel function (String text, String... styles) { return setStyleNames(new InlineLabel(text), styles); }
/** * Creates an inline label with optional styles. */
Creates an inline label with optional styles
newInlineLabel
{ "repo_name": "threerings/gwt-utils", "path": "src/main/java/com/threerings/gwt/ui/Widgets.java", "license": "lgpl-2.1", "size": 15875 }
[ "com.google.gwt.user.client.ui.InlineLabel" ]
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.*;
[ "com.google.gwt" ]
com.google.gwt;
1,271,527
public static TableName getTableName(Path tablePath) { return TableName.valueOf(tablePath.getParent().getName(), tablePath.getName()); }
static TableName function(Path tablePath) { return TableName.valueOf(tablePath.getParent().getName(), tablePath.getName()); }
/** * Returns the {@link org.apache.hadoop.hbase.TableName} object representing * the table directory under * path rootdir * * @param tablePath path of table * @return {@link org.apache.hadoop.fs.Path} for table */
Returns the <code>org.apache.hadoop.hbase.TableName</code> object representing the table directory under path rootdir
getTableName
{ "repo_name": "cloud-software-foundation/c5", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 67483 }
[ "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.TableName" ]
import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
124,578
public void unfold(View coverView, View detailsView) { if (mCoverView == coverView && mDetailsView == detailsView) return; // already in place if ((mCoverView != null && mCoverView != coverView) || (mDetailsView != null && mDetailsView != detailsView)) { // cover or details view is differ - closing details and schedule reopening mScheduledDetailsView = detailsView; mScheduledCoverView = coverView; foldBack(); return; } setCoverViewInternal(coverView); setDetailsViewInternal(detailsView); // initializing foldable views setAdapter(mAdapter); // starting unfold animation scrollToPosition(1); }
void function(View coverView, View detailsView) { if (mCoverView == coverView && mDetailsView == detailsView) return; if ((mCoverView != null && mCoverView != coverView) (mDetailsView != null && mDetailsView != detailsView)) { mScheduledDetailsView = detailsView; mScheduledCoverView = coverView; foldBack(); return; } setCoverViewInternal(coverView); setDetailsViewInternal(detailsView); setAdapter(mAdapter); scrollToPosition(1); }
/** * Starting unfold animation for given views */
Starting unfold animation for given views
unfold
{ "repo_name": "0359xiaodong/FoldableLayout", "path": "library/src/main/java/com/alexvasilkov/foldablelayout/UnfoldableView.java", "license": "apache-2.0", "size": 14762 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,433,144
private void syncShardStatsOnNewMaster(ClusterChangedEvent event) { SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE); if (snapshotsInProgress == null) { return; } for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) { if (snapshot.state() == SnapshotsInProgress.State.STARTED || snapshot.state() == SnapshotsInProgress.State.ABORTED) { Map<ShardId, IndexShardSnapshotStatus> localShards = currentSnapshotShards(snapshot.snapshotId()); if (localShards != null) { ImmutableMap<ShardId, SnapshotsInProgress.ShardSnapshotStatus> masterShards = snapshot.shards(); for(Map.Entry<ShardId, IndexShardSnapshotStatus> localShard : localShards.entrySet()) { ShardId shardId = localShard.getKey(); IndexShardSnapshotStatus localShardStatus = localShard.getValue(); SnapshotsInProgress.ShardSnapshotStatus masterShard = masterShards.get(shardId); if (masterShard != null && masterShard.state().completed() == false) { // Master knows about the shard and thinks it has not completed if (localShardStatus.stage() == IndexShardSnapshotStatus.Stage.DONE) { // but we think the shard is done - we need to make new master know that the shard is done logger.debug("[{}] new master thinks the shard [{}] is not completed but the shard is done locally, updating status on the master", snapshot.snapshotId(), shardId); updateIndexShardSnapshotStatus(snapshot.snapshotId(), shardId, new SnapshotsInProgress.ShardSnapshotStatus(event.state().nodes().localNodeId(), SnapshotsInProgress.State.SUCCESS)); } else if (localShard.getValue().stage() == IndexShardSnapshotStatus.Stage.FAILURE) { // but we think the shard failed - we need to make new master know that the shard failed logger.debug("[{}] new master thinks the shard [{}] is not completed but the shard failed locally, updating status on master", snapshot.snapshotId(), shardId); updateIndexShardSnapshotStatus(snapshot.snapshotId(), shardId, new SnapshotsInProgress.ShardSnapshotStatus(event.state().nodes().localNodeId(), SnapshotsInProgress.State.FAILED, localShardStatus.failure())); } } } } } } } private static class SnapshotShards { private final Map<ShardId, IndexShardSnapshotStatus> shards; private SnapshotShards(ImmutableMap<ShardId, IndexShardSnapshotStatus> shards) { this.shards = shards; } } public static class UpdateIndexShardSnapshotStatusRequest extends TransportRequest { private SnapshotId snapshotId; private ShardId shardId; private SnapshotsInProgress.ShardSnapshotStatus status; private volatile boolean processed; // state field, no need to serialize public UpdateIndexShardSnapshotStatusRequest() { } public UpdateIndexShardSnapshotStatusRequest(SnapshotId snapshotId, ShardId shardId, SnapshotsInProgress.ShardSnapshotStatus status) { this.snapshotId = snapshotId; this.shardId = shardId; this.status = status; }
void function(ClusterChangedEvent event) { SnapshotsInProgress snapshotsInProgress = event.state().custom(SnapshotsInProgress.TYPE); if (snapshotsInProgress == null) { return; } for (SnapshotsInProgress.Entry snapshot : snapshotsInProgress.entries()) { if (snapshot.state() == SnapshotsInProgress.State.STARTED snapshot.state() == SnapshotsInProgress.State.ABORTED) { Map<ShardId, IndexShardSnapshotStatus> localShards = currentSnapshotShards(snapshot.snapshotId()); if (localShards != null) { ImmutableMap<ShardId, SnapshotsInProgress.ShardSnapshotStatus> masterShards = snapshot.shards(); for(Map.Entry<ShardId, IndexShardSnapshotStatus> localShard : localShards.entrySet()) { ShardId shardId = localShard.getKey(); IndexShardSnapshotStatus localShardStatus = localShard.getValue(); SnapshotsInProgress.ShardSnapshotStatus masterShard = masterShards.get(shardId); if (masterShard != null && masterShard.state().completed() == false) { if (localShardStatus.stage() == IndexShardSnapshotStatus.Stage.DONE) { logger.debug(STR, snapshot.snapshotId(), shardId); updateIndexShardSnapshotStatus(snapshot.snapshotId(), shardId, new SnapshotsInProgress.ShardSnapshotStatus(event.state().nodes().localNodeId(), SnapshotsInProgress.State.SUCCESS)); } else if (localShard.getValue().stage() == IndexShardSnapshotStatus.Stage.FAILURE) { logger.debug(STR, snapshot.snapshotId(), shardId); updateIndexShardSnapshotStatus(snapshot.snapshotId(), shardId, new SnapshotsInProgress.ShardSnapshotStatus(event.state().nodes().localNodeId(), SnapshotsInProgress.State.FAILED, localShardStatus.failure())); } } } } } } } private static class SnapshotShards { private final Map<ShardId, IndexShardSnapshotStatus> shards; private SnapshotShards(ImmutableMap<ShardId, IndexShardSnapshotStatus> shards) { this.shards = shards; } } public static class UpdateIndexShardSnapshotStatusRequest extends TransportRequest { private SnapshotId snapshotId; private ShardId shardId; private SnapshotsInProgress.ShardSnapshotStatus status; private volatile boolean processed; public UpdateIndexShardSnapshotStatusRequest() { } public UpdateIndexShardSnapshotStatusRequest(SnapshotId snapshotId, ShardId shardId, SnapshotsInProgress.ShardSnapshotStatus status) { this.snapshotId = snapshotId; this.shardId = shardId; this.status = status; }
/** * Checks if any shards were processed that the new master doesn't know about */
Checks if any shards were processed that the new master doesn't know about
syncShardStatsOnNewMaster
{ "repo_name": "mcku/elasticsearch", "path": "core/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java", "license": "apache-2.0", "size": 29334 }
[ "com.google.common.collect.ImmutableMap", "java.util.Map", "org.elasticsearch.cluster.ClusterChangedEvent", "org.elasticsearch.cluster.SnapshotsInProgress", "org.elasticsearch.cluster.metadata.SnapshotId", "org.elasticsearch.index.shard.ShardId", "org.elasticsearch.index.snapshots.IndexShardSnapshotStatus", "org.elasticsearch.transport.TransportRequest" ]
import com.google.common.collect.ImmutableMap; import java.util.Map; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.SnapshotsInProgress; import org.elasticsearch.cluster.metadata.SnapshotId; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; import org.elasticsearch.transport.TransportRequest;
import com.google.common.collect.*; import java.util.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.index.shard.*; import org.elasticsearch.index.snapshots.*; import org.elasticsearch.transport.*;
[ "com.google.common", "java.util", "org.elasticsearch.cluster", "org.elasticsearch.index", "org.elasticsearch.transport" ]
com.google.common; java.util; org.elasticsearch.cluster; org.elasticsearch.index; org.elasticsearch.transport;
2,551,713
public void saveCurrentPosition(SharedPreferences pref, int newPosition);
void function(SharedPreferences pref, int newPosition);
/** * Saves the current position of this object. Implementations can use the * provided SharedPreference to save this information and retrieve it later * via PlayableUtils.createInstanceFromPreferences. */
Saves the current position of this object. Implementations can use the provided SharedPreference to save this information and retrieve it later via PlayableUtils.createInstanceFromPreferences
saveCurrentPosition
{ "repo_name": "jkaplon/alyt-app", "path": "src/de/danoeh/antennapodsp/util/playback/Playable.java", "license": "mit", "size": 8551 }
[ "android.content.SharedPreferences" ]
import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
894,430
public List<Action> getTransientActions() { List<Action> actions = new ArrayList<Action>(); for (TransientUserActionFactory factory: TransientUserActionFactory.all()) { actions.addAll(factory.createFor(this)); } return Collections.unmodifiableList(actions); }
List<Action> function() { List<Action> actions = new ArrayList<Action>(); for (TransientUserActionFactory factory: TransientUserActionFactory.all()) { actions.addAll(factory.createFor(this)); } return Collections.unmodifiableList(actions); }
/** * Return all transient actions associated with this user. * * @return the list can be empty but never null. read only. */
Return all transient actions associated with this user
getTransientActions
{ "repo_name": "kohsuke/hudson", "path": "core/src/main/java/hudson/model/User.java", "license": "mit", "size": 52731 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,465,844
@OverrideOnDemand protected void beforeExecuteInScope (@Nonnull final JobDataMap aJobDataMap, @Nonnull final IJobExecutionContext aContext) {}
void function (@Nonnull final JobDataMap aJobDataMap, @Nonnull final IJobExecutionContext aContext) {}
/** * Called before the job gets executed. This method is called after the scopes * are initialized! * * @param aJobDataMap * The current job data map. Never <code>null</code>. * @param aContext * The current job execution context. Never <code>null</code>. */
Called before the job gets executed. This method is called after the scopes are initialized
beforeExecuteInScope
{ "repo_name": "phax/ph-web", "path": "ph-web/src/main/java/com/helger/web/scope/util/AbstractScopeAwareJob.java", "license": "apache-2.0", "size": 4961 }
[ "com.helger.quartz.IJobExecutionContext", "com.helger.quartz.JobDataMap", "javax.annotation.Nonnull" ]
import com.helger.quartz.IJobExecutionContext; import com.helger.quartz.JobDataMap; import javax.annotation.Nonnull;
import com.helger.quartz.*; import javax.annotation.*;
[ "com.helger.quartz", "javax.annotation" ]
com.helger.quartz; javax.annotation;
2,139,112
protected static BigInteger calcVal( final int cnt ) { BigInteger ret = TEN; for( int i = 0 ; i < cnt ; i++ ) { ret = ret.multiply( TEN ); } return( ret ); } static final BigInteger baseVal = calcVal( 800 ); protected static final BigInteger finalBaseValSq = baseVal.multiply( baseVal );
static BigInteger function( final int cnt ) { BigInteger ret = TEN; for( int i = 0 ; i < cnt ; i++ ) { ret = ret.multiply( TEN ); } return( ret ); } static final BigInteger baseVal = calcVal( 800 ); protected static final BigInteger finalBaseValSq = baseVal.multiply( baseVal );
/** * Returns the number <math display="inline"> * <mrow> * <msup> * <mn>10</mn> * <mrow> * <mi>X</mi> * <mo>+</mo> * <mn>1</mn> * </mrow> * </msup> * </mrow> * </math>, where X is the input parameter. * * @param cnt The input parameter. * @return The value <math display="inline"> * <mrow> * <msup> * <mn>10</mn> * <mrow> * <mi>X</mi> * <mo>+</mo> * <mn>1</mn> * </mrow> * </msup> * </mrow> * </math>. */
Returns the number 10 X + 1 , where X is the input parameter
calcVal
{ "repo_name": "viridian1138/SimpleAlgebra_V2", "path": "src/test_simplealgebra/TestAtan2BigFixed.java", "license": "gpl-3.0", "size": 18390 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,796,437
public void selectAsTheOnlyOneSelected(NodeView newSelected) { logger.finest("selectAsTheOnlyOneSelected"); List<NodeView> oldSelecteds = getSelecteds(); // select new node this.selected.clear(); this.selected.add(newSelected); // getController().getMode().getDefaultMindMapController().onSelectHook(newSelected.getModel()); // set last focused as preferred (PN) if (newSelected.getModel().getParentNode() != null) { ((NodeView) newSelected.getParent()).setPreferredChild(newSelected); } scrollNodeToVisible(newSelected); newSelected.repaintSelected(); for (NodeView oldSelected : oldSelecteds) { if (oldSelected != null) { oldSelected.repaintSelected(); } } }
void function(NodeView newSelected) { logger.finest(STR); List<NodeView> oldSelecteds = getSelecteds(); this.selected.clear(); this.selected.add(newSelected); if (newSelected.getModel().getParentNode() != null) { ((NodeView) newSelected.getParent()).setPreferredChild(newSelected); } scrollNodeToVisible(newSelected); newSelected.repaintSelected(); for (NodeView oldSelected : oldSelecteds) { if (oldSelected != null) { oldSelected.repaintSelected(); } } }
/** * Select the node, resulting in only that one being selected. */
Select the node, resulting in only that one being selected
selectAsTheOnlyOneSelected
{ "repo_name": "Rogach/SimplyMindMap", "path": "src/org/rogach/simplymindmap/view/MapView.java", "license": "gpl-2.0", "size": 34784 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,645,612
@Test public void testIterationLoad() { // get the database connection final DbDataRetriever retriever = (DbDataRetriever) model .getDataModel().getDataRetriever("db_tida"); final DbQueryConfig config = new DbQueryConfig(); config.setLanguage("SQL"); config.setQuery("SELECT KEY, PERSON, TASKTYPE, WORKAREA, INTERVAL_START, INTERVAL_END FROM SMC_DATA WHERE ROWNUM() <= " + amount); final DbDataCollection data = retriever.retrieve(config); final DbDataIterator it = data.iterator(); // add the retrieved data step by step while (it.hasNext()) { model.loadRecord(new DataRetrieverDataSetRecord(it.next())); } cacheBmpSizeIterationLoad = ((FileBitmapCache) model .getBitmapCache()).getCacheSize(); cacheFactsSizeIterationLoad = ((FileFactDescriptorModelSetCache) model .getFactsCache()).getCacheSize(); // release everything data.release(); retriever.release(); }
void function() { final DbDataRetriever retriever = (DbDataRetriever) model .getDataModel().getDataRetriever(STR); final DbQueryConfig config = new DbQueryConfig(); config.setLanguage("SQL"); config.setQuery(STR + amount); final DbDataCollection data = retriever.retrieve(config); final DbDataIterator it = data.iterator(); while (it.hasNext()) { model.loadRecord(new DataRetrieverDataSetRecord(it.next())); } cacheBmpSizeIterationLoad = ((FileBitmapCache) model .getBitmapCache()).getCacheSize(); cacheFactsSizeIterationLoad = ((FileFactDescriptorModelSetCache) model .getFactsCache()).getCacheSize(); data.release(); retriever.release(); }
/** * Test the loading of data iteratively. */
Test the loading of data iteratively
testIterationLoad
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "test/net/meisen/dissertation/impl/cache/TestFileCaches.java", "license": "bsd-3-clause", "size": 11622 }
[ "net.meisen.dissertation.impl.dataretriever.DbDataCollection", "net.meisen.dissertation.impl.dataretriever.DbDataIterator", "net.meisen.dissertation.impl.dataretriever.DbDataRetriever", "net.meisen.dissertation.impl.dataretriever.DbQueryConfig", "net.meisen.dissertation.impl.datasets.DataRetrieverDataSetRecord" ]
import net.meisen.dissertation.impl.dataretriever.DbDataCollection; import net.meisen.dissertation.impl.dataretriever.DbDataIterator; import net.meisen.dissertation.impl.dataretriever.DbDataRetriever; import net.meisen.dissertation.impl.dataretriever.DbQueryConfig; import net.meisen.dissertation.impl.datasets.DataRetrieverDataSetRecord;
import net.meisen.dissertation.impl.dataretriever.*; import net.meisen.dissertation.impl.datasets.*;
[ "net.meisen.dissertation" ]
net.meisen.dissertation;
2,850,451
final public static FormattingTuple arrayFormat(final String messagePattern, final Object[] argArray) { Throwable throwableCandidate = getThrowableCandidate(argArray); if (messagePattern == null) { return new FormattingTuple(null, argArray, throwableCandidate); } if (argArray == null) { return new FormattingTuple(messagePattern); } int i = 0; int j; // use string builder for better multicore performance StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50); int L; for (L = 0; L < argArray.length; L++) { j = messagePattern.indexOf(DELIM_STR, i); if (j == -1) { // no more variables if (i == 0) { // this is a simple string return new FormattingTuple(messagePattern, argArray, throwableCandidate); } else { // add the tail string which contains no variables and return // the result. sbuf.append(messagePattern.substring(i, messagePattern.length())); return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate); } } else { if (isEscapedDelimeter(messagePattern, j)) { if (!isDoubleEscaped(messagePattern, j)) { L--; // DELIM_START was escaped, thus should not be incremented sbuf.append(messagePattern.substring(i, j - 1)); sbuf.append(DELIM_START); i = j + 1; } else { // The escape character preceding the delimiter start is // itself escaped: "abc x:\\{}" // we have to consume one backward slash sbuf.append(messagePattern.substring(i, j - 1)); deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Object>()); i = j + 2; } } else { // normal case sbuf.append(messagePattern.substring(i, j)); deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Object>()); i = j + 2; } } } // append the characters following the last {} pair. sbuf.append(messagePattern.substring(i, messagePattern.length())); if (L < argArray.length - 1) { return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate); } else { return new FormattingTuple(sbuf.toString(), argArray, null); } }
final static FormattingTuple function(final String messagePattern, final Object[] argArray) { Throwable throwableCandidate = getThrowableCandidate(argArray); if (messagePattern == null) { return new FormattingTuple(null, argArray, throwableCandidate); } if (argArray == null) { return new FormattingTuple(messagePattern); } int i = 0; int j; StringBuilder sbuf = new StringBuilder(messagePattern.length() + 50); int L; for (L = 0; L < argArray.length; L++) { j = messagePattern.indexOf(DELIM_STR, i); if (j == -1) { if (i == 0) { return new FormattingTuple(messagePattern, argArray, throwableCandidate); } else { sbuf.append(messagePattern.substring(i, messagePattern.length())); return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate); } } else { if (isEscapedDelimeter(messagePattern, j)) { if (!isDoubleEscaped(messagePattern, j)) { L--; sbuf.append(messagePattern.substring(i, j - 1)); sbuf.append(DELIM_START); i = j + 1; } else { sbuf.append(messagePattern.substring(i, j - 1)); deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Object>()); i = j + 2; } } else { sbuf.append(messagePattern.substring(i, j)); deeplyAppendParameter(sbuf, argArray[L], new HashMap<Object[], Object>()); i = j + 2; } } } sbuf.append(messagePattern.substring(i, messagePattern.length())); if (L < argArray.length - 1) { return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate); } else { return new FormattingTuple(sbuf.toString(), argArray, null); } }
/** * Same principle as the {@link #format(String, Object)} and * {@link #format(String, Object, Object)} methods except that any number of * arguments can be passed in an array. * * @param messagePattern * The message pattern which will be parsed and formatted * @param argArray * An array of arguments to be substituted in place of formatting * anchors * @return The formatted message */
Same principle as the <code>#format(String, Object)</code> and <code>#format(String, Object, Object)</code> methods except that any number of arguments can be passed in an array
arrayFormat
{ "repo_name": "xiaob/slf4j", "path": "slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java", "license": "mit", "size": 13463 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,478,180
Intent intent = new Intent(fragment.getContext(), DayActivity.class); intent.putExtra(DAY_ACTIVITY_EXTRA_DATE, date); intent.putExtra(DAY_ACTIVITY_EXTRA_PROFILE, profile); fragment.startActivityForResult(intent, REQUEST_START_ACTIVITY); }
Intent intent = new Intent(fragment.getContext(), DayActivity.class); intent.putExtra(DAY_ACTIVITY_EXTRA_DATE, date); intent.putExtra(DAY_ACTIVITY_EXTRA_PROFILE, profile); fragment.startActivityForResult(intent, REQUEST_START_ACTIVITY); }
/** * Starts an activity. * @param fragment The Android fragment. * @param date The date used for the extra part. * @param profile True from a profile. */
Starts an activity
startActivity
{ "repo_name": "Keidan/WorkTime", "path": "app/src/main/java/fr/ralala/worktime/ui/activities/DayActivity.java", "license": "gpl-3.0", "size": 29950 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
197,282
private void setupChat() { Log.d(TAG, "setupChat()"); // Initialize the array adapter for the conversation thread mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message); mConversationView.setAdapter(mConversationArrayAdapter); // Initialize the compose field with a listener for the return key mOutEditText.setOnEditorActionListener(mWriteListener);
void function() { Log.d(TAG, STR); mConversationArrayAdapter = new ArrayAdapter<String>(getActivity(), R.layout.message); mConversationView.setAdapter(mConversationArrayAdapter); mOutEditText.setOnEditorActionListener(mWriteListener);
/** * Set up the UI and background operations for chat. */
Set up the UI and background operations for chat
setupChat
{ "repo_name": "NeilSoul/FlowNet", "path": "tryouts/app/BluetoothChat/Application/src/main/java/com/example/android/bluetoothchat/BluetoothChatFragment.java", "license": "unlicense", "size": 14935 }
[ "android.widget.ArrayAdapter", "com.example.android.common.logger.Log" ]
import android.widget.ArrayAdapter; import com.example.android.common.logger.Log;
import android.widget.*; import com.example.android.common.logger.*;
[ "android.widget", "com.example.android" ]
android.widget; com.example.android;
1,329,607
public ObjectAdapter load(ConcurrencyChecking concurrencyChecking) { if (adapterMemento == null) { return null; } final ObjectAdapter objectAdapter = adapterMemento.getObjectAdapter(concurrencyChecking); return objectAdapter; }
ObjectAdapter function(ConcurrencyChecking concurrencyChecking) { if (adapterMemento == null) { return null; } final ObjectAdapter objectAdapter = adapterMemento.getObjectAdapter(concurrencyChecking); return objectAdapter; }
/** * Not Wicket API, but used by <tt>EntityPage</tt> to do eager loading * when rendering after post-and-redirect. * @return */
Not Wicket API, but used by EntityPage to do eager loading when rendering after post-and-redirect
load
{ "repo_name": "howepeng/isis", "path": "core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java", "license": "apache-2.0", "size": 24225 }
[ "org.apache.isis.core.metamodel.adapter.ObjectAdapter", "org.apache.isis.core.metamodel.adapter.mgr.AdapterManager" ]
import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.*; import org.apache.isis.core.metamodel.adapter.mgr.*;
[ "org.apache.isis" ]
org.apache.isis;
1,229,284
private void doRecoil(Player player) { if (getRecoil() != 0.0D) { Location ploc = player.getLocation(); double dir = -ploc.getYaw() - 90.0F; double pitch = -ploc.getPitch() - 180.0F; double xd = Math.cos(Math.toRadians(dir)) * Math.cos(Math.toRadians(pitch)); double yd = Math.sin(Math.toRadians(pitch)); double zd = -Math.sin(Math.toRadians(dir)) * Math.cos(Math.toRadians(pitch)); Vector vec = new Vector(xd, yd, zd); vec.multiply(getRecoil() / 2.0D).setY(0); player.setVelocity(vec); // Too jerky to work well //ploc.setPitch((float)Math.min(Math.max(-90, ploc.getPitch() - getRecoil()), 90)); //player.teleport(ploc); } }
void function(Player player) { if (getRecoil() != 0.0D) { Location ploc = player.getLocation(); double dir = -ploc.getYaw() - 90.0F; double pitch = -ploc.getPitch() - 180.0F; double xd = Math.cos(Math.toRadians(dir)) * Math.cos(Math.toRadians(pitch)); double yd = Math.sin(Math.toRadians(pitch)); double zd = -Math.sin(Math.toRadians(dir)) * Math.cos(Math.toRadians(pitch)); Vector vec = new Vector(xd, yd, zd); vec.multiply(getRecoil() / 2.0D).setY(0); player.setVelocity(vec); } }
/** * Handles recoil for a player * * @param player {@link Player} to handle recoil for */
Handles recoil for a player
doRecoil
{ "repo_name": "phantamanta44/SwornGuns", "path": "src/main/java/net/dmulloy2/swornguns/types/Gun.java", "license": "gpl-3.0", "size": 20520 }
[ "org.bukkit.Location", "org.bukkit.entity.Player", "org.bukkit.util.Vector" ]
import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.util.Vector;
import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.util.*;
[ "org.bukkit", "org.bukkit.entity", "org.bukkit.util" ]
org.bukkit; org.bukkit.entity; org.bukkit.util;
304,424
@Test public void printEdgeCases() throws Exception { String jsonGolden = loadJson("spec/hl7.fhir.core/3.0.1/package/Patient-null.json"); Patient.Builder patient = Patient.newBuilder(); mergeText("examples/Patient-null.prototxt", patient); String jsonTest = jsonPrinter.print(patient); assertThat(canonicalizeJson(jsonTest)).isEqualTo(canonicalizeJson(jsonGolden)); }
void function() throws Exception { String jsonGolden = loadJson(STR); Patient.Builder patient = Patient.newBuilder(); mergeText(STR, patient); String jsonTest = jsonPrinter.print(patient); assertThat(canonicalizeJson(jsonTest)).isEqualTo(canonicalizeJson(jsonGolden)); }
/** * Test printing JSON edge cases. Since this json file is not sorted in any particular way, we * sort the json objects directly and compare them instead of comparing the raw strings. */
Test printing JSON edge cases. Since this json file is not sorted in any particular way, we sort the json objects directly and compare them instead of comparing the raw strings
printEdgeCases
{ "repo_name": "google/fhir", "path": "javatests/com/google/fhir/stu3/JsonFormatTest.java", "license": "apache-2.0", "size": 109648 }
[ "com.google.common.truth.Truth", "com.google.fhir.stu3.proto.Patient" ]
import com.google.common.truth.Truth; import com.google.fhir.stu3.proto.Patient;
import com.google.common.truth.*; import com.google.fhir.stu3.proto.*;
[ "com.google.common", "com.google.fhir" ]
com.google.common; com.google.fhir;
530,557
protected Controller createController(ActionExtension ae, UserRequest ureq) { // default implementation for simple case where action extension. return ae.createController(ureq, getWindowControl(), null); }
Controller function(ActionExtension ae, UserRequest ureq) { return ae.createController(ureq, getWindowControl(), null); }
/** * creates Controller for clicked Node, default implementation. * * @param ae * @param ureq * @return corresponding controller */
creates Controller for clicked Node, default implementation
createController
{ "repo_name": "RLDevOps/Scholastic", "path": "src/main/java/org/olat/core/gui/control/generic/layout/GenericMainController.java", "license": "apache-2.0", "size": 10125 }
[ "org.olat.core.extensions.action.ActionExtension", "org.olat.core.gui.UserRequest", "org.olat.core.gui.control.Controller" ]
import org.olat.core.extensions.action.ActionExtension; import org.olat.core.gui.UserRequest; import org.olat.core.gui.control.Controller;
import org.olat.core.extensions.action.*; import org.olat.core.gui.*; import org.olat.core.gui.control.*;
[ "org.olat.core" ]
org.olat.core;
1,177,861
public WorkspaceWidget getWidgetAt(Point point){ Iterator<WorkspaceWidget> it = workspaceWidgets.iterator(); //TODO: HUGE HACK, get rid of this. bascally, the facotry has priority if(factory.contains( SwingUtilities.convertPoint(ws, point, factory.getJComponent()).x, SwingUtilities.convertPoint(ws, point, factory.getJComponent()).y)) return factory; WorkspaceWidget widget = null; while(it.hasNext()){ //convert point to the widgets' coordinate system widget = it.next(); p = SwingUtilities.convertPoint(ws, point, widget.getJComponent()); //test if widget contains point and widget is visible if(widget.contains(p.x, p.y) && widget.getJComponent().isVisible()) { return widget; // because these are sorted by draw depth, the first hit is on top } } return null; // hopefully we never get here }
WorkspaceWidget function(Point point){ Iterator<WorkspaceWidget> it = workspaceWidgets.iterator(); if(factory.contains( SwingUtilities.convertPoint(ws, point, factory.getJComponent()).x, SwingUtilities.convertPoint(ws, point, factory.getJComponent()).y)) return factory; WorkspaceWidget widget = null; while(it.hasNext()){ widget = it.next(); p = SwingUtilities.convertPoint(ws, point, widget.getJComponent()); if(widget.contains(p.x, p.y) && widget.getJComponent().isVisible()) { return widget; } } return null; }
/** * Returns the WorkspaceWidget currently at the specified point * @param point the <code>Point2D</code> to get the widget at, given * in Workspace (i.e. window) coordinates * @return the WorkspaceWidget currently at the specified point */
Returns the WorkspaceWidget currently at the specified point
getWidgetAt
{ "repo_name": "ajhalbleib/aicg", "path": "appinventor/blockslib/src/openblocks/workspace/Workspace.java", "license": "mit", "size": 31600 }
[ "java.awt.Point", "java.util.Iterator", "javax.swing.SwingUtilities" ]
import java.awt.Point; import java.util.Iterator; import javax.swing.SwingUtilities;
import java.awt.*; import java.util.*; import javax.swing.*;
[ "java.awt", "java.util", "javax.swing" ]
java.awt; java.util; javax.swing;
2,616,359
public boolean hit(Rectangle rect, Shape s, boolean onStroke) { if (onStroke) { s = stroke.createStrokedShape(s); } s = transformShape(s); if ((constrainX|constrainY) != 0) { rect = new Rectangle(rect); rect.translate(constrainX, constrainY); } return s.intersects(rect); }
boolean function(Rectangle rect, Shape s, boolean onStroke) { if (onStroke) { s = stroke.createStrokedShape(s); } s = transformShape(s); if ((constrainX constrainY) != 0) { rect = new Rectangle(rect); rect.translate(constrainX, constrainY); } return s.intersects(rect); }
/** * Checks to see if a Path intersects the specified Rectangle in device * space. The rendering attributes taken into account include the * clip, transform, and stroke attributes. * @param rect The area in device space to check for a hit. * @param s The path to check for a hit. * @param onStroke Flag to choose between testing the stroked or * the filled path. * @return True if there is a hit, false otherwise. * @see #setStroke * @see #fill(Shape) * @see #draw(Shape) * @see #transform * @see #setTransform * @see #clip * @see #setClip */
Checks to see if a Path intersects the specified Rectangle in device space. The rendering attributes taken into account include the clip, transform, and stroke attributes
hit
{ "repo_name": "universsky/openjdk", "path": "jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java", "license": "gpl-2.0", "size": 134380 }
[ "java.awt.Rectangle", "java.awt.Shape" ]
import java.awt.Rectangle; import java.awt.Shape;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,589,039
public static String getPrefix(File file) { return JMString.getPrefixOfFileName(file.getName()); }
static String function(File file) { return JMString.getPrefixOfFileName(file.getName()); }
/** * Gets prefix. * * @param file the file * @return the prefix */
Gets prefix
getPrefix
{ "repo_name": "JM-Lab/utils-java8", "path": "src/main/java/kr/jm/utils/helper/JMFiles.java", "license": "apache-2.0", "size": 10033 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
239,560
void termVectors(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener);
void termVectors(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener);
/** * An action that returns the term vectors for a specific document. * * @param request The term vector request */
An action that returns the term vectors for a specific document
termVectors
{ "repo_name": "ern/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/Client.java", "license": "apache-2.0", "size": 15097 }
[ "org.elasticsearch.action.ActionListener", "org.elasticsearch.action.termvectors.TermVectorsRequest", "org.elasticsearch.action.termvectors.TermVectorsResponse" ]
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.action.termvectors.TermVectorsResponse;
import org.elasticsearch.action.*; import org.elasticsearch.action.termvectors.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
344,583
public void testPortWithComposite() { QName serviceQName = new QName(namespaceURI, svcLocalPart); QName portQName = new QName(namespaceURI, portLocalPart); Service service = Service.create(serviceQName); // Create a composite with a JAXB Handler Config DescriptionBuilderComposite sparseComposite = new DescriptionBuilderComposite(); HandlerChainsType handlerChainsType = getHandlerChainsType(); sparseComposite.setHandlerChainsType(handlerChainsType); ServiceDelegate.setPortMetadata(sparseComposite); ClientMetadataHandlerChainTestSEI port = service.getPort(portQName, ClientMetadataHandlerChainTestSEI.class); // Verify the HandlerResolver on the service knows about the handlers in the sparse composite HandlerResolver resolver = service.getHandlerResolver(); assertNotNull(resolver); PortInfo pi = new DummyPortInfo(); List<Handler> list = resolver.getHandlerChain(pi); assertEquals(2, list.size()); // Verify that the port created with the sparse metadata has those handlers BindingProvider bindingProvider = (BindingProvider) port; Binding binding = (Binding) bindingProvider.getBinding(); List<Handler> portHandlers = binding.getHandlerChain(); assertEquals(2, portHandlers.size()); assertTrue(containSameHandlers(portHandlers, list)); // Verify that a creating another instance of the same port also gets those handlers ClientMetadataHandlerChainTestSEI port2 = service.getPort(portQName, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider2 = (BindingProvider) port2; Binding binding2 = (Binding) bindingProvider2.getBinding(); List<Handler> portHandlers2 = binding2.getHandlerChain(); assertNotSame(port, port2); assertEquals(2, portHandlers2.size()); assertTrue(containSameHandlers(portHandlers2, list)); // Verify that createing a different port doesn't get the handlers QName portQName3 = new QName(namespaceURI, portLocalPart + "3"); ClientMetadataHandlerChainTestSEI port3 = service.getPort(portQName3, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider3 = (BindingProvider) port3; Binding binding3 = (Binding) bindingProvider3.getBinding(); List<Handler> portHandlers3 = binding3.getHandlerChain(); assertEquals(0, portHandlers3.size()); // Verify setting the metadata on a different port (a different QName) will get handlers. QName portQName4 = new QName(namespaceURI, portLocalPart + "4"); ServiceDelegate.setPortMetadata(sparseComposite); ClientMetadataHandlerChainTestSEI port4 = service.getPort(portQName4, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider4 = (BindingProvider) port4; Binding binding4 = (Binding) bindingProvider4.getBinding(); List<Handler> portHandlers4 = binding4.getHandlerChain(); assertEquals(2, portHandlers4.size()); // Verify the service handler resolver knows about boths sets of handlers // attached to the two different port QNames and none are attached for the third port List<Handler> listForPort = resolver.getHandlerChain(pi); assertEquals(2, listForPort.size()); PortInfo pi4 = new DummyPortInfo(portQName4); List<Handler> listForPort4 = resolver.getHandlerChain(pi4); assertEquals(2, listForPort4.size()); PortInfo pi3 = new DummyPortInfo(portQName3); List<Handler> listForPort3 = resolver.getHandlerChain(pi3); assertEquals(0, listForPort3.size()); }
void function() { QName serviceQName = new QName(namespaceURI, svcLocalPart); QName portQName = new QName(namespaceURI, portLocalPart); Service service = Service.create(serviceQName); DescriptionBuilderComposite sparseComposite = new DescriptionBuilderComposite(); HandlerChainsType handlerChainsType = getHandlerChainsType(); sparseComposite.setHandlerChainsType(handlerChainsType); ServiceDelegate.setPortMetadata(sparseComposite); ClientMetadataHandlerChainTestSEI port = service.getPort(portQName, ClientMetadataHandlerChainTestSEI.class); HandlerResolver resolver = service.getHandlerResolver(); assertNotNull(resolver); PortInfo pi = new DummyPortInfo(); List<Handler> list = resolver.getHandlerChain(pi); assertEquals(2, list.size()); BindingProvider bindingProvider = (BindingProvider) port; Binding binding = (Binding) bindingProvider.getBinding(); List<Handler> portHandlers = binding.getHandlerChain(); assertEquals(2, portHandlers.size()); assertTrue(containSameHandlers(portHandlers, list)); ClientMetadataHandlerChainTestSEI port2 = service.getPort(portQName, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider2 = (BindingProvider) port2; Binding binding2 = (Binding) bindingProvider2.getBinding(); List<Handler> portHandlers2 = binding2.getHandlerChain(); assertNotSame(port, port2); assertEquals(2, portHandlers2.size()); assertTrue(containSameHandlers(portHandlers2, list)); QName portQName3 = new QName(namespaceURI, portLocalPart + "3"); ClientMetadataHandlerChainTestSEI port3 = service.getPort(portQName3, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider3 = (BindingProvider) port3; Binding binding3 = (Binding) bindingProvider3.getBinding(); List<Handler> portHandlers3 = binding3.getHandlerChain(); assertEquals(0, portHandlers3.size()); QName portQName4 = new QName(namespaceURI, portLocalPart + "4"); ServiceDelegate.setPortMetadata(sparseComposite); ClientMetadataHandlerChainTestSEI port4 = service.getPort(portQName4, ClientMetadataHandlerChainTestSEI.class); BindingProvider bindingProvider4 = (BindingProvider) port4; Binding binding4 = (Binding) bindingProvider4.getBinding(); List<Handler> portHandlers4 = binding4.getHandlerChain(); assertEquals(2, portHandlers4.size()); List<Handler> listForPort = resolver.getHandlerChain(pi); assertEquals(2, listForPort.size()); PortInfo pi4 = new DummyPortInfo(portQName4); List<Handler> listForPort4 = resolver.getHandlerChain(pi4); assertEquals(2, listForPort4.size()); PortInfo pi3 = new DummyPortInfo(portQName3); List<Handler> listForPort3 = resolver.getHandlerChain(pi3); assertEquals(0, listForPort3.size()); }
/** * Set a sparse composite on a specific Port. Verify that instances of that Port have the * correct handlers associated and other Ports do not. */
Set a sparse composite on a specific Port. Verify that instances of that Port have the correct handlers associated and other Ports do not
testPortWithComposite
{ "repo_name": "sandamal/wso2-axis2", "path": "modules/jaxws/test/org/apache/axis2/jaxws/spi/ClientMetadataHandlerChainTest.java", "license": "apache-2.0", "size": 28604 }
[ "java.util.List", "javax.xml.namespace.QName", "javax.xml.ws.Service", "javax.xml.ws.handler.Handler", "javax.xml.ws.handler.HandlerResolver", "javax.xml.ws.handler.PortInfo", "org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite", "org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType" ]
import java.util.List; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.handler.Handler; import javax.xml.ws.handler.HandlerResolver; import javax.xml.ws.handler.PortInfo; import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite; import org.apache.axis2.jaxws.description.xml.handler.HandlerChainsType;
import java.util.*; import javax.xml.namespace.*; import javax.xml.ws.*; import javax.xml.ws.handler.*; import org.apache.axis2.jaxws.description.builder.*; import org.apache.axis2.jaxws.description.xml.handler.*;
[ "java.util", "javax.xml", "org.apache.axis2" ]
java.util; javax.xml; org.apache.axis2;
985,262
public synchronized void markBandwidth(List<CrossConnection> xcons, BasicTracker externalTracker) { if (xcons == null) { log.error("null bandwith provided to markBandwidth"); return; } StringBuilder sb = new StringBuilder(); for (CrossConnection con : xcons) { sb.append(con.toString()); sb.append("\n"); } log.debug("markBandwidth: Excluding " + sb.toString()); for (CrossConnection conn : xcons) { try { String source = conn.getSourceNeId(); String target = conn.getTargetNeId(); String srcPort = conn.getSourcePortAid(); String dstPort = conn.getTargetPortAid(); String rate = conn.getRate(); String srcChan = conn.getSourceChannel(); String dstChan = conn.getTargetChannel(); int srcChanInt = Integer.parseInt(srcChan); int dstChanInt = Integer.parseInt(dstChan); // Fix 1+1 ROUTING! String swMatePort = conn.getSwMatePortAid(); String swMateChan = conn.getSwMateChannel(); int swMateChanInt = -1; if (swMateChan != null) { swMateChanInt = Integer.parseInt(swMateChan); } if (conn.isDracLoopback()) { log.debug("Not populating marking bandwidth for connection with ID: " + conn.getId()); continue; } StringBuilder builder = new StringBuilder(); builder.append("markBandwidth::Populating: source: " + source + " srcPort: " + srcPort + "target: " + target + " dstPort : " + dstPort + " rate: " + rate + "srcChan: " + srcChanInt + " dstChan: " + dstChanInt); builder.append(" swMatePort: " + swMatePort + " swMateChan: " + swMateChanInt); log.debug(builder.toString()); // rate here is a string like "STS1" "STS3C" etc.. must convert it to a // Mb/s rate rate = Utility.convertSTS2Mb(rate); Map<String, LpcpFacility> facMapSrc = model.get(source); Map<String, LpcpFacility> facMapDst = model.get(target); if (facMapSrc != null && facMapDst != null) { LpcpFacility srcFacility = facMapSrc.get(srcPort); LpcpFacility dstFacility = facMapDst.get(dstPort); LpcpFacility swMateFacility = null; // NOTE on SWMATE if (swMatePort != null) { swMateFacility = facMapSrc.get(swMatePort); } // if (!srcFacility.isL2SS()) // { // // (1) EPL // srcPort = Utility.convertWAN2ETH(srcPort); // srcFacility = facMapSrc.get(srcPort); // } // // if (!dstFacility.isL2SS()) // { // // (1) EPL // dstPort = Utility.convertWAN2ETH(dstPort); // dstFacility = facMapDst.get(dstPort); // } // // if (swMateFacility != null && !swMateFacility.isL2SS()) // { // // (1) EPL // swMatePort = Utility.convertWAN2ETH(swMatePort); // swMateFacility = facMapSrc.get(swMatePort); // } boolean gotBW = false; if (srcFacility != null || dstFacility != null) { BasicTracker srcTracker = srcFacility != null ? srcFacility.getTracker() : null; BasicTracker dstTracker = dstFacility != null ? dstFacility.getTracker() : null; BasicTracker swMateTracker = swMateFacility != null ? swMateFacility.getTracker() : null; // int trackerRate = Utility.convertStringRateToInt(rate); // // OpticalFacilityTracker. { // gotBW = srcTracker != null ? srcTracker.takeBandwidth(conID, // srcChanInt, // trackerRate) : false; gotBW = srcTracker != null ? srcTracker.takeBandwidth(conn) : false; if (!gotBW && !(srcTracker == null)) { log.debug("Bandwidth overlap detected: srcFacility: " + srcFacility + " srcChan: " + srcChan + " rate: " + rate); } else if (!gotBW && srcTracker == null) { log.debug("Null srcTracker detected: srcFacility: " + srcFacility + " srcChan: " + srcChan + " rate: " + rate); } } { // gotBW = dstTracker != null ? dstTracker.takeBandwidth(conID, // dstChanInt, // trackerRate) : null; gotBW = dstTracker != null ? dstTracker.takeBandwidth(conn) : false; if (!gotBW && !(dstTracker == null)) { log.debug("Bandwidth overlap detected: dstFacility: " + dstFacility + " dstChan: " + dstChan + " rate: " + rate); } else if (!gotBW && dstTracker == null) { log.debug("Null dstTracker detected: srcFacility: " + srcFacility + " srcChan: " + srcChan + " rate: " + rate); } } // SWMATE TRACKER if (swMatePort != null) { gotBW = swMateTracker != null ? swMateTracker.takeBandwidth(conn) : false; if (!gotBW && !(swMateTracker == null)) { log.debug("Bandwidth overlap detected: swMateFacility: " + swMateFacility + " swMateChan: " + swMateChan + " rate: " + rate); } else if (!gotBW && swMateTracker == null) { log.debug("Null swMateFacility detected: swMateFacility: " + swMateFacility + " swMateChan: " + swMateChan + " rate: " + rate); } } if (externalTracker != null) { if (source != null && source.equals(externalTracker.getNeid()) && srcPort != null && srcPort.equals(externalTracker.getAid())) { externalTracker.takeBandwidth(conn); } else if (target != null && target.equals(externalTracker.getNeid()) && dstPort != null && dstPort.equals(externalTracker.getAid())) { externalTracker.takeBandwidth(conn); } } } } } catch (Exception e) { log.error("markBandwidth failed to mark " + conn); } } }
synchronized void function(List<CrossConnection> xcons, BasicTracker externalTracker) { if (xcons == null) { log.error(STR); return; } StringBuilder sb = new StringBuilder(); for (CrossConnection con : xcons) { sb.append(con.toString()); sb.append("\n"); } log.debug(STR + sb.toString()); for (CrossConnection conn : xcons) { try { String source = conn.getSourceNeId(); String target = conn.getTargetNeId(); String srcPort = conn.getSourcePortAid(); String dstPort = conn.getTargetPortAid(); String rate = conn.getRate(); String srcChan = conn.getSourceChannel(); String dstChan = conn.getTargetChannel(); int srcChanInt = Integer.parseInt(srcChan); int dstChanInt = Integer.parseInt(dstChan); String swMatePort = conn.getSwMatePortAid(); String swMateChan = conn.getSwMateChannel(); int swMateChanInt = -1; if (swMateChan != null) { swMateChanInt = Integer.parseInt(swMateChan); } if (conn.isDracLoopback()) { log.debug(STR + conn.getId()); continue; } StringBuilder builder = new StringBuilder(); builder.append(STR + source + STR + srcPort + STR + target + STR + dstPort + STR + rate + STR + srcChanInt + STR + dstChanInt); builder.append(STR + swMatePort + STR + swMateChanInt); log.debug(builder.toString()); rate = Utility.convertSTS2Mb(rate); Map<String, LpcpFacility> facMapSrc = model.get(source); Map<String, LpcpFacility> facMapDst = model.get(target); if (facMapSrc != null && facMapDst != null) { LpcpFacility srcFacility = facMapSrc.get(srcPort); LpcpFacility dstFacility = facMapDst.get(dstPort); LpcpFacility swMateFacility = null; if (swMatePort != null) { swMateFacility = facMapSrc.get(swMatePort); } boolean gotBW = false; if (srcFacility != null dstFacility != null) { BasicTracker srcTracker = srcFacility != null ? srcFacility.getTracker() : null; BasicTracker dstTracker = dstFacility != null ? dstFacility.getTracker() : null; BasicTracker swMateTracker = swMateFacility != null ? swMateFacility.getTracker() : null; { gotBW = srcTracker != null ? srcTracker.takeBandwidth(conn) : false; if (!gotBW && !(srcTracker == null)) { log.debug(STR + srcFacility + STR + srcChan + STR + rate); } else if (!gotBW && srcTracker == null) { log.debug(STR + srcFacility + STR + srcChan + STR + rate); } } { gotBW = dstTracker != null ? dstTracker.takeBandwidth(conn) : false; if (!gotBW && !(dstTracker == null)) { log.debug(STR + dstFacility + STR + dstChan + STR + rate); } else if (!gotBW && dstTracker == null) { log.debug(STR + srcFacility + STR + srcChan + STR + rate); } } if (swMatePort != null) { gotBW = swMateTracker != null ? swMateTracker.takeBandwidth(conn) : false; if (!gotBW && !(swMateTracker == null)) { log.debug(STR + swMateFacility + STR + swMateChan + STR + rate); } else if (!gotBW && swMateTracker == null) { log.debug(STR + swMateFacility + STR + swMateChan + STR + rate); } } if (externalTracker != null) { if (source != null && source.equals(externalTracker.getNeid()) && srcPort != null && srcPort.equals(externalTracker.getAid())) { externalTracker.takeBandwidth(conn); } else if (target != null && target.equals(externalTracker.getNeid()) && dstPort != null && dstPort.equals(externalTracker.getAid())) { externalTracker.takeBandwidth(conn); } } } } } catch (Exception e) { log.error(STR + conn); } } }
/** * BitBandwidthTrackerI externalTracker: A stand-alone tracker to be evaluated * against the list of xcons passed in. It can be used to evaluate * provisioning conditions independently of the trackers set normally in the * network model. See additional notes below. */
BitBandwidthTrackerI externalTracker: A stand-alone tracker to be evaluated against the list of xcons passed in. It can be used to evaluate provisioning conditions independently of the trackers set normally in the network model. See additional notes below
markBandwidth
{ "repo_name": "jmacauley/OpenDRAC", "path": "Server/Lpcp/src/main/java/com/nortel/appcore/app/drac/server/lpcp/routing/HierarchicalModel.java", "license": "gpl-3.0", "size": 38220 }
[ "com.nortel.appcore.app.drac.common.types.CrossConnection", "com.nortel.appcore.app.drac.server.lpcp.common.Utility", "com.nortel.appcore.app.drac.server.lpcp.trackers.BasicTracker", "com.nortel.appcore.app.drac.server.lpcp.trackers.LpcpFacility", "java.util.List", "java.util.Map" ]
import com.nortel.appcore.app.drac.common.types.CrossConnection; import com.nortel.appcore.app.drac.server.lpcp.common.Utility; import com.nortel.appcore.app.drac.server.lpcp.trackers.BasicTracker; import com.nortel.appcore.app.drac.server.lpcp.trackers.LpcpFacility; import java.util.List; import java.util.Map;
import com.nortel.appcore.app.drac.common.types.*; import com.nortel.appcore.app.drac.server.lpcp.common.*; import com.nortel.appcore.app.drac.server.lpcp.trackers.*; import java.util.*;
[ "com.nortel.appcore", "java.util" ]
com.nortel.appcore; java.util;
912,734
public void setUuid(String v) { if (!ObjectUtils.equals(this.uuid, v)) { this.uuid = v; setModified(true); } } private TScreen aTScreen;
void function(String v) { if (!ObjectUtils.equals(this.uuid, v)) { this.uuid = v; setModified(true); } } private TScreen aTScreen;
/** * Set the value of Uuid * * @param v new value */
Set the value of Uuid
setUuid
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTScreenTab.java", "license": "gpl-3.0", "size": 39316 }
[ "com.aurel.track.persist.TScreen", "org.apache.commons.lang.ObjectUtils" ]
import com.aurel.track.persist.TScreen; import org.apache.commons.lang.ObjectUtils;
import com.aurel.track.persist.*; import org.apache.commons.lang.*;
[ "com.aurel.track", "org.apache.commons" ]
com.aurel.track; org.apache.commons;
2,491,737
private static boolean isPropertyEnabled(Dictionary<?, ?> properties, String propertyName) { boolean enabled = false; try { String flag = (String) properties.get(propertyName); if (flag != null) { enabled = flag.trim().equals("true"); } } catch (ClassCastException e) { // No propertyName defined. enabled = false; } return enabled; }
static boolean function(Dictionary<?, ?> properties, String propertyName) { boolean enabled = false; try { String flag = (String) properties.get(propertyName); if (flag != null) { enabled = flag.trim().equals("true"); } } catch (ClassCastException e) { enabled = false; } return enabled; }
/** * Check property name is defined and set to true. * * @param properties properties to be looked up * @param propertyName the name of the property to look up * @return true when the propertyName is defined and set to true */
Check property name is defined and set to true
isPropertyEnabled
{ "repo_name": "fp7-netide/Engine", "path": "onos-shim/src/main/java/eu/netide/shim/ShimLayer.java", "license": "epl-1.0", "size": 8585 }
[ "java.util.Dictionary", "org.onlab.util.Tools" ]
import java.util.Dictionary; import org.onlab.util.Tools;
import java.util.*; import org.onlab.util.*;
[ "java.util", "org.onlab.util" ]
java.util; org.onlab.util;
2,045,278
public static HDFSBlocksDistribution computeHDFSBlocksDistribution(final Configuration conf, final HTableDescriptor tableDescriptor, final HRegionInfo regionInfo, Path tablePath) throws IOException { HDFSBlocksDistribution hdfsBlocksDistribution = new HDFSBlocksDistribution(); FileSystem fs = tablePath.getFileSystem(conf); HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tablePath, regionInfo); for (HColumnDescriptor family: tableDescriptor.getFamilies()) { Collection<StoreFileInfo> storeFiles = regionFs.getStoreFiles(family.getNameAsString()); if (storeFiles == null) continue; for (StoreFileInfo storeFileInfo : storeFiles) { hdfsBlocksDistribution.add(storeFileInfo.computeHDFSBlocksDistribution(fs)); } } return hdfsBlocksDistribution; }
static HDFSBlocksDistribution function(final Configuration conf, final HTableDescriptor tableDescriptor, final HRegionInfo regionInfo, Path tablePath) throws IOException { HDFSBlocksDistribution hdfsBlocksDistribution = new HDFSBlocksDistribution(); FileSystem fs = tablePath.getFileSystem(conf); HRegionFileSystem regionFs = new HRegionFileSystem(conf, fs, tablePath, regionInfo); for (HColumnDescriptor family: tableDescriptor.getFamilies()) { Collection<StoreFileInfo> storeFiles = regionFs.getStoreFiles(family.getNameAsString()); if (storeFiles == null) continue; for (StoreFileInfo storeFileInfo : storeFiles) { hdfsBlocksDistribution.add(storeFileInfo.computeHDFSBlocksDistribution(fs)); } } return hdfsBlocksDistribution; }
/** * This is a helper function to compute HDFS block distribution on demand * @param conf configuration * @param tableDescriptor HTableDescriptor of the table * @param regionInfo encoded name of the region * @param tablePath the table directory * @return The HDFS blocks distribution for the given region. * @throws IOException */
This is a helper function to compute HDFS block distribution on demand
computeHDFSBlocksDistribution
{ "repo_name": "ZhangXFeng/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java", "license": "apache-2.0", "size": 259731 }
[ "java.io.IOException", "java.util.Collection", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.HColumnDescriptor", "org.apache.hadoop.hbase.HDFSBlocksDistribution", "org.apache.hadoop.hbase.HRegionInfo", "org.apache.hadoop.hbase.HTableDescriptor" ]
import java.io.IOException; import java.util.Collection; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HDFSBlocksDistribution; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor;
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
469,411
@ApiModelProperty(value = "Error of the parameter value") public String getError() { return error; }
@ApiModelProperty(value = STR) String function() { return error; }
/** * Error of the parameter value * @return error **/
Error of the parameter value
getError
{ "repo_name": "SiLeBAT/FSK-Lab", "path": "de.bund.bfr.knime.fsklab.metadata.model/gen/de/bund/bfr/metadata/swagger/Parameter.java", "license": "gpl-3.0", "size": 16903 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,160,124
protected void addClassNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_ClassDetails_className_feature"), getString("_UI_PropertyDescriptor_description", "_UI_ClassDetails_className_feature", "_UI_ClassDetails_type"), MapperPackage.Literals.CLASS_DETAILS__CLASS_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), MapperPackage.Literals.CLASS_DETAILS__CLASS_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Class Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Class Name feature.
addClassNamePropertyDescriptor
{ "repo_name": "openmapsoftware/mappingtools", "path": "openmap-mapper-edit/src/main/java/com/openMap1/mapper/provider/ClassDetailsItemProvider.java", "license": "epl-1.0", "size": 7193 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
383,665
public Date getUnsharedDate() { return (Date) mProperties.get(FIELD_UNSHARED_AT); }
Date function() { return (Date) mProperties.get(FIELD_UNSHARED_AT); }
/** * Gets the time that this shared link will be deactivated. * * @return the time that this shared link will be deactivated. */
Gets the time that this shared link will be deactivated
getUnsharedDate
{ "repo_name": "MariusVolkhart/box-android-sdk", "path": "box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxSharedLink.java", "license": "apache-2.0", "size": 9418 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,244,398
public List<Criteria> getOredCriteria() { return oredCriteria; }
List<Criteria> function() { return oredCriteria; }
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table g_role * * @mbg.generated Sun Nov 27 01:44:02 CST 2016 */
This method was generated by MyBatis Generator. This method corresponds to the database table g_role
getOredCriteria
{ "repo_name": "csycurry/cloud.group", "path": "cloud.group.api/src/main/java/com/csy/model/RoleExample.java", "license": "gpl-3.0", "size": 23972 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
140,529
public static float getJsonObjectFloatFieldValue(JsonObject p_151217_0_, String p_151217_1_) { if (p_151217_0_.has(p_151217_1_)) { return getJsonElementFloatValue(p_151217_0_.get(p_151217_1_), p_151217_1_); } else { throw new JsonSyntaxException("Missing " + p_151217_1_ + ", expected to find a Float"); } }
static float function(JsonObject p_151217_0_, String p_151217_1_) { if (p_151217_0_.has(p_151217_1_)) { return getJsonElementFloatValue(p_151217_0_.get(p_151217_1_), p_151217_1_); } else { throw new JsonSyntaxException(STR + p_151217_1_ + STR); } }
/** * Gets the float value of the field on the JsonObject with the given name. */
Gets the float value of the field on the JsonObject with the given name
getJsonObjectFloatFieldValue
{ "repo_name": "Hexeption/Youtube-Hacked-Client-1.8", "path": "minecraft/net/minecraft/util/JsonUtils.java", "license": "mit", "size": 12217 }
[ "com.google.gson.JsonObject", "com.google.gson.JsonSyntaxException" ]
import com.google.gson.JsonObject; import com.google.gson.JsonSyntaxException;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
2,878,453
@Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mPreferredLocale != null) { applyPreferredLocaleIfNecessary(getBaseContext().getResources()); } } private static ArrayList<String> mSupportedLocales = null;
void function(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (mPreferredLocale != null) { applyPreferredLocaleIfNecessary(getBaseContext().getResources()); } } private static ArrayList<String> mSupportedLocales = null;
/** * Monitor configuration changes (like rotation) to make sure we reset the * locale. * * @param newConfig */
Monitor configuration changes (like rotation) to make sure we reset the locale
onConfigurationChanged
{ "repo_name": "zawsx/app-Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/BookCatalogueApp.java", "license": "gpl-3.0", "size": 21588 }
[ "android.content.res.Configuration", "java.util.ArrayList" ]
import android.content.res.Configuration; import java.util.ArrayList;
import android.content.res.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
451,781
public void removeListener(ILabelProviderListener listener) { myAdapterFactoryLabelProvider.removeListener(listener); }
void function(ILabelProviderListener listener) { myAdapterFactoryLabelProvider.removeListener(listener); }
/** * Removes the listener. * * @param listener the listener * @generated */
Removes the listener
removeListener
{ "repo_name": "albertfdp/petrinet", "path": "src/dk.dtu.se2.geometry.diagram/src/geometry/diagram/navigator/GeometryDomainNavigatorLabelProvider.java", "license": "mit", "size": 3094 }
[ "org.eclipse.jface.viewers.ILabelProviderListener" ]
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
9,399
public BigDecimal getVersion() { return version; }
BigDecimal function() { return version; }
/** * This method was generated by MyBatis Generator. * This method returns the value of the database column MS_KPP.VERSION * * @return the value of MS_KPP.VERSION * * @mbggenerated Tue Nov 19 14:55:02 ICT 2013 */
This method was generated by MyBatis Generator. This method returns the value of the database column MS_KPP.VERSION
getVersion
{ "repo_name": "arkenoid/rest-server-client-chain", "path": "maven/sidjp-djpcm/djpcm-bridge/src/main/java/id/go/djp/cm/bridge/sidjp/model/MsKpp.java", "license": "mit", "size": 7367 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
1,994,250
public long getEditTime() throws ParseException { if(this.edited_timestamp == null) { return 0; } return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse(this.edited_timestamp.substring(0, this.edited_timestamp.length() - 9)).getTime() / 1000L; }
long function() throws ParseException { if(this.edited_timestamp == null) { return 0; } return new SimpleDateFormat(STR).parse(this.edited_timestamp.substring(0, this.edited_timestamp.length() - 9)).getTime() / 1000L; }
/** * Get Edit Time * * @return The UNIX timestamp of the message's last edit or 0 if not edited. * @throws ParseException In case the parsing of the date went wrong. * @see Message#getEditMillis() * @since 1.2 */
Get Edit Time
getEditTime
{ "repo_name": "timmyrs/SuprDiscordBot", "path": "src/de/timmyrs/suprdiscordbot/structures/Message.java", "license": "mit", "size": 6520 }
[ "java.text.ParseException", "java.text.SimpleDateFormat" ]
import java.text.ParseException; import java.text.SimpleDateFormat;
import java.text.*;
[ "java.text" ]
java.text;
1,029,605
private IConstant<IV<?, ?>> makeLiteral(final String s) { final BigdataLiteral value = valueFactory.createLiteral(s); final TermId<BigdataLiteral> termId = new TermId<BigdataLiteral>( VTE.LITERAL, nextId++); termId.setValue(value); return new Constant<IV<?, ?>>(termId); }
IConstant<IV<?, ?>> function(final String s) { final BigdataLiteral value = valueFactory.createLiteral(s); final TermId<BigdataLiteral> termId = new TermId<BigdataLiteral>( VTE.LITERAL, nextId++); termId.setValue(value); return new Constant<IV<?, ?>>(termId); }
/** * Create an {@link IV} for a {@link BigdataLiteral}, set the * {@link IVCache} association, and wrap it as an {@link IConstant}. * * @param s * The literal value. * * @return The {@link IConstant}. */
Create an <code>IV</code> for a <code>BigdataLiteral</code>, set the <code>IVCache</code> association, and wrap it as an <code>IConstant</code>
makeLiteral
{ "repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes", "path": "bigdata/src/test/com/bigdata/bop/fed/TestThickChunkMessage.java", "license": "gpl-2.0", "size": 10892 }
[ "com.bigdata.bop.Constant", "com.bigdata.bop.IConstant", "com.bigdata.rdf.internal.impl.TermId", "com.bigdata.rdf.model.BigdataLiteral" ]
import com.bigdata.bop.Constant; import com.bigdata.bop.IConstant; import com.bigdata.rdf.internal.impl.TermId; import com.bigdata.rdf.model.BigdataLiteral;
import com.bigdata.bop.*; import com.bigdata.rdf.internal.impl.*; import com.bigdata.rdf.model.*;
[ "com.bigdata.bop", "com.bigdata.rdf" ]
com.bigdata.bop; com.bigdata.rdf;
794,657
Map readValue(Object body, Exchange exchange);
Map readValue(Object body, Exchange exchange);
/** * Attempt to read/convert the message body into a {@link Map} type * * @param body the message body * @param exchange the Camel exchange * @return converted as {@link Map} or <tt>null</tt> if not possible */
Attempt to read/convert the message body into a <code>Map</code> type
readValue
{ "repo_name": "nikhilvibhav/camel", "path": "components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathAdapter.java", "license": "apache-2.0", "size": 1741 }
[ "java.util.Map", "org.apache.camel.Exchange" ]
import java.util.Map; import org.apache.camel.Exchange;
import java.util.*; import org.apache.camel.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
560,982
public Resource getResource() { return resource; }
Resource function() { return resource; }
/** * Return the {@link Resource} object (if a {@link ResourceLoader} is available) from the given location (if any). * * @return {@link Resource} object for the given location */
Return the <code>Resource</code> object (if a <code>ResourceLoader</code> is available) from the given location (if any)
getResource
{ "repo_name": "eclipse/gemini.blueprint", "path": "core/src/main/java/org/eclipse/gemini/blueprint/bundle/BundleFactoryBean.java", "license": "apache-2.0", "size": 11054 }
[ "org.springframework.core.io.Resource" ]
import org.springframework.core.io.Resource;
import org.springframework.core.io.*;
[ "org.springframework.core" ]
org.springframework.core;
2,168,717
public void setHE2_h(FunctionOptimisationProblem problem) { this.he2_h_problem = problem; this.he2_h = (ContinuousFunction) problem.getFunction(); }
void function(FunctionOptimisationProblem problem) { this.he2_h_problem = problem; this.he2_h = (ContinuousFunction) problem.getFunction(); }
/** * Sets the h function with a specified problem. * @param problem FunctionOptimisationProblem used for the h function. */
Sets the h function with a specified problem
setHE2_h
{ "repo_name": "filinep/cilib", "path": "library/src/main/java/net/sourceforge/cilib/functions/discontinuous/dynamic/moo/he2/HE2_f2.java", "license": "gpl-3.0", "size": 3783 }
[ "net.sourceforge.cilib.functions.ContinuousFunction", "net.sourceforge.cilib.problem.FunctionOptimisationProblem" ]
import net.sourceforge.cilib.functions.ContinuousFunction; import net.sourceforge.cilib.problem.FunctionOptimisationProblem;
import net.sourceforge.cilib.functions.*; import net.sourceforge.cilib.problem.*;
[ "net.sourceforge.cilib" ]
net.sourceforge.cilib;
399,947
@Test(enabled = false, groups = { "setup", "service", "projectrest" }) public void createBadProjectTest() throws Exception { final WifProject project = new WifProject(); project.setName("badProjectProjectServiceRESTIT"); project.setOriginalUnits("metric"); LOGGER.debug("createbut badProjectTest: " + project.getLabel()); final String uri = "badUrl"; project.setUazDataStoreURI(uri); badProjectId = projectServiceClient.createProject(roleId, project); Assert.assertNotNull(badProjectId); LOGGER.debug("project uuid: " + badProjectId); Assert.assertNotNull(badProjectId); LOGGER.debug("project Id " + badProjectId); HashMap<String, String> resp = new HashMap<String, String>(); do { LOGGER.debug("Waiting for setup to complete..."); Thread.sleep(100); resp = projectServiceClient.getStatus(roleId, badProjectId); LOGGER.debug("Status is " + resp.get(WifKeys.STATUS_KEY)); } while (!resp.get(WifKeys.STATUS_KEY).equals(WifKeys.PROCESS_STATE_FAILED)); LOGGER.debug("Setup failed..."); }
@Test(enabled = false, groups = { "setup", STR, STR }) void function() throws Exception { final WifProject project = new WifProject(); project.setName(STR); project.setOriginalUnits(STR); LOGGER.debug(STR + project.getLabel()); final String uri = STR; project.setUazDataStoreURI(uri); badProjectId = projectServiceClient.createProject(roleId, project); Assert.assertNotNull(badProjectId); LOGGER.debug(STR + badProjectId); Assert.assertNotNull(badProjectId); LOGGER.debug(STR + badProjectId); HashMap<String, String> resp = new HashMap<String, String>(); do { LOGGER.debug(STR); Thread.sleep(100); resp = projectServiceClient.getStatus(roleId, badProjectId); LOGGER.debug(STR + resp.get(WifKeys.STATUS_KEY)); } while (!resp.get(WifKeys.STATUS_KEY).equals(WifKeys.PROCESS_STATE_FAILED)); LOGGER.debug(STR); }
/** * Creates the bad project test. * * @throws Exception * the exception */
Creates the bad project test
createBadProjectTest
{ "repo_name": "tosseto/online-whatif", "path": "src/test/java/au/org/aurin/wif/restclient/ProjectServiceRestIT.java", "license": "mit", "size": 8753 }
[ "au.org.aurin.wif.model.WifProject", "au.org.aurin.wif.svc.WifKeys", "java.util.HashMap", "org.testng.Assert", "org.testng.annotations.Test" ]
import au.org.aurin.wif.model.WifProject; import au.org.aurin.wif.svc.WifKeys; import java.util.HashMap; import org.testng.Assert; import org.testng.annotations.Test;
import au.org.aurin.wif.model.*; import au.org.aurin.wif.svc.*; import java.util.*; import org.testng.*; import org.testng.annotations.*;
[ "au.org.aurin", "java.util", "org.testng", "org.testng.annotations" ]
au.org.aurin; java.util; org.testng; org.testng.annotations;
1,971,800
public static Optional<FieldChange> updateField(BibEntry be, String field, String newValue, Boolean nullFieldIfValueIsTheSame) { String writtenValue = null; String oldValue = null; if (be.hasField(field)) { oldValue = be.getField(field); if ((newValue == null) || (oldValue.equals(newValue) && nullFieldIfValueIsTheSame)) { // If the new field value is null or the old and the new value are the same and flag is set // Clear the field be.clearField(field); } else if (!oldValue.equals(newValue)) { // Update writtenValue = newValue; be.setField(field, newValue); } else { // Values are the same, do nothing return Optional.empty(); } } else { // old field value not set if (newValue == null) { // Do nothing return Optional.empty(); } else { // Set new value writtenValue = newValue; be.setField(field, newValue); } } return Optional.of(new FieldChange(be, field, oldValue, writtenValue)); }
static Optional<FieldChange> function(BibEntry be, String field, String newValue, Boolean nullFieldIfValueIsTheSame) { String writtenValue = null; String oldValue = null; if (be.hasField(field)) { oldValue = be.getField(field); if ((newValue == null) (oldValue.equals(newValue) && nullFieldIfValueIsTheSame)) { be.clearField(field); } else if (!oldValue.equals(newValue)) { writtenValue = newValue; be.setField(field, newValue); } else { return Optional.empty(); } } else { if (newValue == null) { return Optional.empty(); } else { writtenValue = newValue; be.setField(field, newValue); } } return Optional.of(new FieldChange(be, field, oldValue, writtenValue)); }
/** * Undoable change of field value * * @param be BibEntry * @param field Field name * @param newValue New field value * @param nullFieldIfValueIsTheSame If true the field value is removed when the current value is equals to newValue */
Undoable change of field value
updateField
{ "repo_name": "fc7/jabref", "path": "src/main/java/net/sf/jabref/logic/util/UpdateField.java", "license": "gpl-2.0", "size": 6130 }
[ "java.util.Optional", "net.sf.jabref.logic.FieldChange", "net.sf.jabref.model.entry.BibEntry" ]
import java.util.Optional; import net.sf.jabref.logic.FieldChange; import net.sf.jabref.model.entry.BibEntry;
import java.util.*; import net.sf.jabref.logic.*; import net.sf.jabref.model.entry.*;
[ "java.util", "net.sf.jabref" ]
java.util; net.sf.jabref;
172,718
ServiceResponse<Product> beginPutNonRetry201Creating400InvalidJson() throws CloudException, IOException;
ServiceResponse<Product> beginPutNonRetry201Creating400InvalidJson() throws CloudException, IOException;
/** * Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. * * @throws CloudException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Product object wrapped in {@link ServiceResponse} if successful. */
Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code
beginPutNonRetry201Creating400InvalidJson
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/lro/LROSADs.java", "license": "mit", "size": 104951 }
[ "com.microsoft.azure.CloudException", "com.microsoft.rest.ServiceResponse", "java.io.IOException" ]
import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponse; import java.io.IOException;
import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.azure", "com.microsoft.rest", "java.io" ]
com.microsoft.azure; com.microsoft.rest; java.io;
2,216,108
public void close() throws IOException { ClassFactory.cleanCache(); }
void function() throws IOException { ClassFactory.cleanCache(); }
/** * Must be called from same thread which created the UnmarshallerImpl instance. * @throws IOException */
Must be called from same thread which created the UnmarshallerImpl instance
close
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java", "license": "mit", "size": 21477 }
[ "com.sun.xml.internal.bind.v2.ClassFactory", "java.io.IOException" ]
import com.sun.xml.internal.bind.v2.ClassFactory; import java.io.IOException;
import com.sun.xml.internal.bind.v2.*; import java.io.*;
[ "com.sun.xml", "java.io" ]
com.sun.xml; java.io;
605,637
public boolean processBackward(IInstruction instruction) { LOG.trace("processing: {}", instruction); if (getPushedSize(instruction) > 0) { size--; if (offset == size) { if (instruction instanceof LoadInstruction) { LoadInstruction load = (LoadInstruction) instruction; local = load.getVarIndex(); } return true; } } size += getPoppedCount(instruction); LOG.trace("stack size={}", size); return false; }
boolean function(IInstruction instruction) { LOG.trace(STR, instruction); if (getPushedSize(instruction) > 0) { size--; if (offset == size) { if (instruction instanceof LoadInstruction) { LoadInstruction load = (LoadInstruction) instruction; local = load.getVarIndex(); } return true; } } size += getPoppedCount(instruction); LOG.trace(STR, size); return false; }
/** * simulates the proccessing of the given instruction * * @param instruction the instruction to process * @return <code>true</code> if the value has left the stack, <code>false</code> otherwise */
simulates the proccessing of the given instruction
processBackward
{ "repo_name": "wondee/faststring", "path": "analysis/src/main/java/de/unifrankfurt/faststring/analysis/StackSimulator.java", "license": "mit", "size": 2555 }
[ "com.ibm.wala.shrikeBT.IInstruction", "com.ibm.wala.shrikeBT.LoadInstruction" ]
import com.ibm.wala.shrikeBT.IInstruction; import com.ibm.wala.shrikeBT.LoadInstruction;
import com.ibm.wala.*;
[ "com.ibm.wala" ]
com.ibm.wala;
34,819
@Override public void reset() { Log.d(SBMP_TAG, "reset() 523"); if (pmInterface == null) { if (!ConnectPlayMediaService()) { ServiceBackedAudioPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); } } try { pmInterface.reset(ServiceBackedAudioPlayer.this.sessionId); } catch (RemoteException e) { e.printStackTrace(); ServiceBackedAudioPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); } stayAwake(false); }
void function() { Log.d(SBMP_TAG, STR); if (pmInterface == null) { if (!ConnectPlayMediaService()) { ServiceBackedAudioPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); } } try { pmInterface.reset(ServiceBackedAudioPlayer.this.sessionId); } catch (RemoteException e) { e.printStackTrace(); ServiceBackedAudioPlayer.this.error(MediaPlayer.MEDIA_ERROR_UNKNOWN, 0); } stayAwake(false); }
/** * Functions identically to android.media.MediaPlayer.reset() * Resets the track to idle state */
Functions identically to android.media.MediaPlayer.reset() Resets the track to idle state
reset
{ "repo_name": "AntennaPod/AntennaPod-AudioPlayer", "path": "library/src/main/java/org/antennapod/audio/ServiceBackedAudioPlayer.java", "license": "apache-2.0", "size": 48383 }
[ "android.os.RemoteException", "android.util.Log" ]
import android.os.RemoteException; import android.util.Log;
import android.os.*; import android.util.*;
[ "android.os", "android.util" ]
android.os; android.util;
2,638,562
public Array getArray( int nIndex ) { try { Array res = _resultSet.getArray( nIndex ); registerArray( res ); return res; } catch( SQLException e ) { free( ); throw new AppException( getErrorMessage( e ), e ); } }
Array function( int nIndex ) { try { Array res = _resultSet.getArray( nIndex ); registerArray( res ); return res; } catch( SQLException e ) { free( ); throw new AppException( getErrorMessage( e ), e ); } }
/** * Get an Array value * * @see ResultSet#getArray(int) * @since 5.1.1 * @param nIndex * the index * @return the array value */
Get an Array value
getArray
{ "repo_name": "rzara/lutece-core", "path": "src/java/fr/paris/lutece/util/sql/DAOUtil.java", "license": "bsd-3-clause", "size": 83663 }
[ "fr.paris.lutece.portal.service.util.AppException", "java.sql.Array", "java.sql.SQLException" ]
import fr.paris.lutece.portal.service.util.AppException; import java.sql.Array; import java.sql.SQLException;
import fr.paris.lutece.portal.service.util.*; import java.sql.*;
[ "fr.paris.lutece", "java.sql" ]
fr.paris.lutece; java.sql;
860,033
@Deprecated public List<RowMetaAndData> getResultRows() { return resultRows; }
List<RowMetaAndData> function() { return resultRows; }
/** * Gets the result rows. * * @return a list containing the result rows. * @deprecated Moved to Trans to make this class stateless */
Gets the result rows
getResultRows
{ "repo_name": "Advent51/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 225587 }
[ "java.util.List", "org.pentaho.di.core.RowMetaAndData" ]
import java.util.List; import org.pentaho.di.core.RowMetaAndData;
import java.util.*; import org.pentaho.di.core.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
2,713,028
@SuppressWarnings({"BusyWait", "unchecked"}) public void safeSend(Collection<? extends ClusterNode> nodes, GridCacheMessage msg, byte plc, @Nullable IgnitePredicate<ClusterNode> fallback) throws IgniteCheckedException { assert nodes != null; assert msg != null; if (nodes.isEmpty()) { if (log.isDebugEnabled()) log.debug("Message will not be sent as collection of nodes is empty: " + msg); return; } if (!onSend(msg, null)) return; if (log.isDebugEnabled()) log.debug("Sending cache message [msg=" + msg + ", nodes=" + U.toShortString(nodes) + ']'); final Collection<UUID> leftIds = new GridLeanSet<>(); int cnt = 0;
@SuppressWarnings({STR, STR}) void function(Collection<? extends ClusterNode> nodes, GridCacheMessage msg, byte plc, @Nullable IgnitePredicate<ClusterNode> fallback) throws IgniteCheckedException { assert nodes != null; assert msg != null; if (nodes.isEmpty()) { if (log.isDebugEnabled()) log.debug(STR + msg); return; } if (!onSend(msg, null)) return; if (log.isDebugEnabled()) log.debug(STR + msg + STR + U.toShortString(nodes) + ']'); final Collection<UUID> leftIds = new GridLeanSet<>(); int cnt = 0;
/** * Sends message and automatically accounts for lefts nodes. * * @param nodes Nodes to send to. * @param msg Message to send. * @param plc IO policy. * @param fallback Callback for failed nodes. * @throws IgniteCheckedException If send failed. */
Sends message and automatically accounts for lefts nodes
safeSend
{ "repo_name": "tkpanther/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java", "license": "apache-2.0", "size": 47020 }
[ "java.util.Collection", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.util.GridLeanSet", "org.apache.ignite.internal.util.typedef.internal.U", "org.apache.ignite.lang.IgnitePredicate", "org.jetbrains.annotations.Nullable" ]
import java.util.Collection; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.GridLeanSet; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.Nullable;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*;
[ "java.util", "org.apache.ignite", "org.jetbrains.annotations" ]
java.util; org.apache.ignite; org.jetbrains.annotations;
1,593,758
protected java.sql.Date getNativeDate(int columnIndex) throws SQLException { return getNativeDate(columnIndex, null); }
java.sql.Date function(int columnIndex) throws SQLException { return getNativeDate(columnIndex, null); }
/** * Get the value of a column in the current row as a java.sql.Date object * * @param columnIndex * the first column is 1, the second is 2... * * @return the column value; null if SQL NULL * * @exception SQLException * if a database access error occurs */
Get the value of a column in the current row as a java.sql.Date object
getNativeDate
{ "repo_name": "shubhanshu-gupta/Apache-Solr", "path": "example/solr/collection1/lib/mysql-connector-java-5.1.32/src/com/mysql/jdbc/ResultSetImpl.java", "license": "apache-2.0", "size": 247329 }
[ "java.sql.Date", "java.sql.SQLException" ]
import java.sql.Date; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
545,727
public static TransferJob createNearlineTransferJob() throws InstantiationException, IllegalAccessException, IOException { Date date = TransferJobUtils.createDate(START_DATE); TimeOfDay time = TransferJobUtils.createTimeOfDay(START_TIME); TransferJob transferJob = TransferJob.class .newInstance() .setDescription(JOB_DESC) .setProjectId(PROJECT_ID) .setTransferSpec( TransferSpec.class .newInstance() .setGcsDataSource(GcsData.class.newInstance().setBucketName(GCS_SOURCE_NAME)) .setGcsDataSink(GcsData.class.newInstance().setBucketName(NEARLINE_SINK_NAME)) .setObjectConditions( ObjectConditions.class.newInstance().setMinTimeElapsedSinceLastModification("2592000s")) .setTransferOptions( TransferOptions.class.newInstance().setDeleteObjectsFromSourceAfterTransfer(true))) .setSchedule(Schedule.class.newInstance().setScheduleStartDate(date) .setStartTimeOfDay(time)) .setStatus("ENABLED"); Storagetransfer client = TransferClientCreator.createStorageTransferClient(); return client.transferJobs().create(transferJob).execute(); }
static TransferJob function() throws InstantiationException, IllegalAccessException, IOException { Date date = TransferJobUtils.createDate(START_DATE); TimeOfDay time = TransferJobUtils.createTimeOfDay(START_TIME); TransferJob transferJob = TransferJob.class .newInstance() .setDescription(JOB_DESC) .setProjectId(PROJECT_ID) .setTransferSpec( TransferSpec.class .newInstance() .setGcsDataSource(GcsData.class.newInstance().setBucketName(GCS_SOURCE_NAME)) .setGcsDataSink(GcsData.class.newInstance().setBucketName(NEARLINE_SINK_NAME)) .setObjectConditions( ObjectConditions.class.newInstance().setMinTimeElapsedSinceLastModification(STR)) .setTransferOptions( TransferOptions.class.newInstance().setDeleteObjectsFromSourceAfterTransfer(true))) .setSchedule(Schedule.class.newInstance().setScheduleStartDate(date) .setStartTimeOfDay(time)) .setStatus(STR); Storagetransfer client = TransferClientCreator.createStorageTransferClient(); return client.transferJobs().create(transferJob).execute(); }
/** * Creates and executes a request for a TransferJob to Cloud Storage Nearline. * * @return the response TransferJob if the request is successful * @throws InstantiationException * if instantiation fails when building the TransferJob * @throws IllegalAccessException * if an illegal access occurs when building the TransferJob * @throws IOException * if the client failed to complete the request */
Creates and executes a request for a TransferJob to Cloud Storage Nearline
createNearlineTransferJob
{ "repo_name": "ErinJoan/mostly_empty_directory", "path": "storage/storage-transfer/src/main/java/com/google/cloud/storage/storagetransfer/samples/NearlineRequester.java", "license": "apache-2.0", "size": 4119 }
[ "com.google.api.services.storagetransfer.Storagetransfer", "com.google.api.services.storagetransfer.model.Date", "com.google.api.services.storagetransfer.model.GcsData", "com.google.api.services.storagetransfer.model.ObjectConditions", "com.google.api.services.storagetransfer.model.Schedule", "com.google.api.services.storagetransfer.model.TimeOfDay", "com.google.api.services.storagetransfer.model.TransferJob", "com.google.api.services.storagetransfer.model.TransferOptions", "com.google.api.services.storagetransfer.model.TransferSpec", "java.io.IOException" ]
import com.google.api.services.storagetransfer.Storagetransfer; import com.google.api.services.storagetransfer.model.Date; import com.google.api.services.storagetransfer.model.GcsData; import com.google.api.services.storagetransfer.model.ObjectConditions; import com.google.api.services.storagetransfer.model.Schedule; import com.google.api.services.storagetransfer.model.TimeOfDay; import com.google.api.services.storagetransfer.model.TransferJob; import com.google.api.services.storagetransfer.model.TransferOptions; import com.google.api.services.storagetransfer.model.TransferSpec; import java.io.IOException;
import com.google.api.services.storagetransfer.*; import com.google.api.services.storagetransfer.model.*; import java.io.*;
[ "com.google.api", "java.io" ]
com.google.api; java.io;
2,102,634
@CallSuper protected void onPageScrolled(int position, float offset, int offsetPixels) { // Offset any decor views if needed - keep them on-screen at all times. if (mDecorChildCount > 0) { final int scrollX = getScrollX(); int paddingLeft = getPaddingLeft(); int paddingRight = getPaddingRight(); final int width = getWidth(); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (!lp.isDecor) continue; final int hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK; int childLeft = 0; switch (hgrav) { default: childLeft = paddingLeft; break; case Gravity.LEFT: childLeft = paddingLeft; paddingLeft += child.getWidth(); break; case Gravity.CENTER_HORIZONTAL: childLeft = Math.max((width - child.getMeasuredWidth()) / 2, paddingLeft); break; case Gravity.RIGHT: childLeft = width - paddingRight - child.getMeasuredWidth(); paddingRight += child.getMeasuredWidth(); break; } childLeft += scrollX; final int childOffset = childLeft - child.getLeft(); if (childOffset != 0) { child.offsetLeftAndRight(childOffset); } } } dispatchOnPageScrolled(position, offset, offsetPixels); if (mPageTransformer != null) { final int scrollX = getScrollX(); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.isDecor) continue; final float transformPos = (float) (child.getLeft() - scrollX) / getClientWidth(); mPageTransformer.transformPage(child, transformPos); } } mCalledSuper = true; }
void function(int position, float offset, int offsetPixels) { if (mDecorChildCount > 0) { final int scrollX = getScrollX(); int paddingLeft = getPaddingLeft(); int paddingRight = getPaddingRight(); final int width = getWidth(); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (!lp.isDecor) continue; final int hgrav = lp.gravity & Gravity.HORIZONTAL_GRAVITY_MASK; int childLeft = 0; switch (hgrav) { default: childLeft = paddingLeft; break; case Gravity.LEFT: childLeft = paddingLeft; paddingLeft += child.getWidth(); break; case Gravity.CENTER_HORIZONTAL: childLeft = Math.max((width - child.getMeasuredWidth()) / 2, paddingLeft); break; case Gravity.RIGHT: childLeft = width - paddingRight - child.getMeasuredWidth(); paddingRight += child.getMeasuredWidth(); break; } childLeft += scrollX; final int childOffset = childLeft - child.getLeft(); if (childOffset != 0) { child.offsetLeftAndRight(childOffset); } } } dispatchOnPageScrolled(position, offset, offsetPixels); if (mPageTransformer != null) { final int scrollX = getScrollX(); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.isDecor) continue; final float transformPos = (float) (child.getLeft() - scrollX) / getClientWidth(); mPageTransformer.transformPage(child, transformPos); } } mCalledSuper = true; }
/** * This method will be invoked when the current page is scrolled, either as part * of a programmatically initiated smooth scroll or a user initiated touch scroll. * If you override this method you must call through to the superclass implementation * (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled * returns. * * @param position Position index of the first page currently being displayed. * Page position+1 will be visible if positionOffset is nonzero. * @param offset Value from [0, 1) indicating the offset from the page at position. * @param offsetPixels Value in pixels indicating the offset from position. */
This method will be invoked when the current page is scrolled, either as part of a programmatically initiated smooth scroll or a user initiated touch scroll. If you override this method you must call through to the superclass implementation (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled returns
onPageScrolled
{ "repo_name": "kazi-mifta/Campus-App", "path": "material-intro-screen/src/main/java/android/support/v4/view/CustomViewPager.java", "license": "mit", "size": 123780 }
[ "android.view.Gravity", "android.view.View" ]
import android.view.Gravity; import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
606,887
private Document parseContents(final Text node, final Element domElement) throws UnmarshallingException { String textContent = StringSupport.trimOrNull(node.getWholeText()); if (textContent == null) { log.error("Expected Base64 encoded address elements"); return null; } // First Base64-decode the contents ... // final byte[] bytes = Base64Support.decode(textContent); final String addressElements = new String(bytes); // Then build a fake XML document holding the contents in element form. // // The elements represented in 'addressElements' may have a namespace prefix // so we find out if we need to include that in the XML definition. final Map<String, String> bindings = getNamespaceBindings(domElement); // There has been cases when the eidas: namespace prefix has been used to represent // address elements, but the response/assertion itself did not define that prefix. // So, let's be a little bit proactive ... // if (!bindings.containsKey(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_PREFIX)) { bindings.put(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_PREFIX, EidasConstants.EIDAS_NP_NS); } if (!bindings.containsKey(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_NP_PREFIX)) { bindings.put(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_NP_PREFIX, EidasConstants.EIDAS_NP_NS); } final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append("<" + domElement.getNodeName()); for (Map.Entry<String, String> entry : bindings.entrySet()) { sb.append(" " + entry.getKey() + "=\"" + entry.getValue() + "\""); } sb.append('>'); sb.append(addressElements); sb.append("</" + domElement.getNodeName() + ">"); // Parse into an XML document. // try { final Document doc = XMLObjectProviderRegistrySupport.getParserPool().parse(new ByteArrayInputStream(sb.toString().getBytes("UTF-8"))); // Copy the input dom element and replace its child node with our new nodes. // final Document newDoc = XMLObjectProviderRegistrySupport.getParserPool().newDocument(); final Element newDom = (Element) domElement.cloneNode(true); for (Map.Entry<String, String> entry : bindings.entrySet()) { newDom.setAttributeNS(XMLConstants.XMLNS_NS, entry.getKey(), entry.getValue()); } newDoc.adoptNode(newDom); for (Node child; (child = newDom.getFirstChild()) != null; newDom.removeChild(child)) ; Node newChild = doc.getDocumentElement().getFirstChild(); while (newChild != null) { final Node importedChild = newDoc.importNode(newChild, true); newDom.appendChild(importedChild); newChild = newChild.getNextSibling(); } newDoc.appendChild(newDom); return newDoc; } catch (IOException | XMLParserException e) { throw new UnmarshallingException(e); } }
Document function(final Text node, final Element domElement) throws UnmarshallingException { String textContent = StringSupport.trimOrNull(node.getWholeText()); if (textContent == null) { log.error(STR); return null; } final String addressElements = new String(bytes); final Map<String, String> bindings = getNamespaceBindings(domElement); bindings.put(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_PREFIX, EidasConstants.EIDAS_NP_NS); } if (!bindings.containsKey(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_NP_PREFIX)) { bindings.put(XMLConstants.XMLNS_PREFIX + ":" + EidasConstants.EIDAS_NP_PREFIX, EidasConstants.EIDAS_NP_NS); } final StringBuilder sb = new StringBuilder(); sb.append(STR1.0\STRUTF-8\"?>"); sb.append("<" + domElement.getNodeName()); for (Map.Entry<String, String> entry : bindings.entrySet()) { sb.append(" " + entry.getKey() + "=\"STR\STR</STR>STRUTF-8"))); final Element newDom = (Element) domElement.cloneNode(true); for (Map.Entry<String, String> entry : bindings.entrySet()) { newDom.setAttributeNS(XMLConstants.XMLNS_NS, entry.getKey(), entry.getValue()); } newDoc.adoptNode(newDom); for (Node child; (child = newDom.getFirstChild()) != null; newDom.removeChild(child)) ; Node newChild = doc.getDocumentElement().getFirstChild(); while (newChild != null) { final Node importedChild = newDoc.importNode(newChild, true); newDom.appendChild(importedChild); newChild = newChild.getNextSibling(); } newDoc.appendChild(newDom); return newDoc; } catch (IOException XMLParserException e) { throw new UnmarshallingException(e); } }
/** * Parses the Base64-encoded contents of a {@code CurrentAddressType} element into the actual elements that this * encoding represents. * * @param node * the text node to parse * @param domElement * the DOM element that we are unmarshalling * @return a new DOM document holding a clone of the {@code domElement} with its previous text node child replaced * with the parsed elements * @throws UnmarshallingException * for unmarshalling errors */
Parses the Base64-encoded contents of a CurrentAddressType element into the actual elements that this encoding represents
parseContents
{ "repo_name": "litsec/eidas-opensaml", "path": "opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/impl/CurrentAddressTypeUnmarshaller.java", "license": "apache-2.0", "size": 7601 }
[ "java.io.IOException", "java.util.Map", "net.shibboleth.utilities.java.support.primitive.StringSupport", "net.shibboleth.utilities.java.support.xml.XMLConstants", "net.shibboleth.utilities.java.support.xml.XMLParserException", "org.opensaml.core.xml.io.UnmarshallingException", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.Text", "se.litsec.eidas.opensaml.common.EidasConstants" ]
import java.io.IOException; import java.util.Map; import net.shibboleth.utilities.java.support.primitive.StringSupport; import net.shibboleth.utilities.java.support.xml.XMLConstants; import net.shibboleth.utilities.java.support.xml.XMLParserException; import org.opensaml.core.xml.io.UnmarshallingException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; import se.litsec.eidas.opensaml.common.EidasConstants;
import java.io.*; import java.util.*; import net.shibboleth.utilities.java.support.primitive.*; import net.shibboleth.utilities.java.support.xml.*; import org.opensaml.core.xml.io.*; import org.w3c.dom.*; import se.litsec.eidas.opensaml.common.*;
[ "java.io", "java.util", "net.shibboleth.utilities", "org.opensaml.core", "org.w3c.dom", "se.litsec.eidas" ]
java.io; java.util; net.shibboleth.utilities; org.opensaml.core; org.w3c.dom; se.litsec.eidas;
2,552,818
public void addTweet(Tweet tweet) throws IOException { SAXReader reader = new SAXReader(); try { Document document = reader.read(context.openFileInput(filePath)); Element root = document.getRootElement(); if(root != null) { Element tweetElement = DocumentHelper.createElement("tweet"); tweetElement.addAttribute("position", tweet.getPosition() + ""); root.add(tweetElement); Element textElement = DocumentHelper.createElement("text"); textElement.setText(tweet.getText()); tweetElement.add(textElement); XMLWriter output = new XMLWriter(context.openFileOutput(filePath, Context.MODE_PRIVATE)); output.write(document); output.close(); } } catch (DocumentException e) { e.printStackTrace(); } }
void function(Tweet tweet) throws IOException { SAXReader reader = new SAXReader(); try { Document document = reader.read(context.openFileInput(filePath)); Element root = document.getRootElement(); if(root != null) { Element tweetElement = DocumentHelper.createElement("tweet"); tweetElement.addAttribute(STR, tweet.getPosition() + STRtext"); textElement.setText(tweet.getText()); tweetElement.add(textElement); XMLWriter output = new XMLWriter(context.openFileOutput(filePath, Context.MODE_PRIVATE)); output.write(document); output.close(); } } catch (DocumentException e) { e.printStackTrace(); } }
/** * Add a tweet in a specific day to xml file. * @param tweet that is about to store. * @throws IOException in XML file. */
Add a tweet in a specific day to xml file
addTweet
{ "repo_name": "LangleyChang/ABit", "path": "app/src/main/java/org/bitoo/abit/mission/TweetXmlParser.java", "license": "gpl-2.0", "size": 3506 }
[ "android.content.Context", "java.io.IOException", "org.dom4j.Document", "org.dom4j.DocumentException", "org.dom4j.DocumentHelper", "org.dom4j.Element", "org.dom4j.io.SAXReader", "org.dom4j.io.XMLWriter" ]
import android.content.Context; import java.io.IOException; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.SAXReader; import org.dom4j.io.XMLWriter;
import android.content.*; import java.io.*; import org.dom4j.*; import org.dom4j.io.*;
[ "android.content", "java.io", "org.dom4j", "org.dom4j.io" ]
android.content; java.io; org.dom4j; org.dom4j.io;
28,174
public void testArithmeticEvalWithNull() { ExpressionsManager manager = createManager(); Integer evaluated = manager.evaluate("${=2 + 2 * 1/1 + (0*null)}", Integer.class); Assert.assertEquals(evaluated, Integer.valueOf(4)); }
void function() { ExpressionsManager manager = createManager(); Integer evaluated = manager.evaluate(STR, Integer.class); Assert.assertEquals(evaluated, Integer.valueOf(4)); }
/** * Test arithmetic eval with null. */
Test arithmetic eval with null
testArithmeticEvalWithNull
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-core/src/test/java/com/sirma/itt/seip/expressions/ArithmeticEvaluatorTest.java", "license": "lgpl-3.0", "size": 2292 }
[ "org.testng.Assert" ]
import org.testng.Assert;
import org.testng.*;
[ "org.testng" ]
org.testng;
360,005
protected Point getTextLocation() { if (textLocation != null) return textLocation; calculateLocations(); return textLocation; }
Point function() { if (textLocation != null) return textLocation; calculateLocations(); return textLocation; }
/** * Returns the location of the label's text relative to the label. * * @return the text location * @since 2.0 */
Returns the location of the label's text relative to the label
getTextLocation
{ "repo_name": "opensagres/xdocreport.eclipse", "path": "rap/org.eclipse.draw2d/src/org/eclipse/draw2d/Label.java", "license": "lgpl-2.1", "size": 19122 }
[ "org.eclipse.draw2d.geometry.Point" ]
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
2,205,605
void setRoutingService(RoutingService routingService);
void setRoutingService(RoutingService routingService);
/** * Another hack to solve dep injection problem..., note, this will be called before * any start is called. */
Another hack to solve dep injection problem..., note, this will be called before any start is called
setRoutingService
{ "repo_name": "camilojd/elasticsearch", "path": "core/src/main/java/org/elasticsearch/discovery/Discovery.java", "license": "apache-2.0", "size": 3420 }
[ "org.elasticsearch.cluster.routing.RoutingService" ]
import org.elasticsearch.cluster.routing.RoutingService;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
840,139
public static < T extends Type< T > > int[] commonSize( final List< Image< T > > images ) { if ( images == null || images.size() == 0 ) return null; int[] size = images.get( 0 ).getDimensions(); for ( final Image< ? > image : images ) for ( int d = 0; d < image.getNumDimensions(); ++d ) size[ d ] = Math.max( size[ d ], image.getDimension( d ) ); return size; }
static < T extends Type< T > > int[] function( final List< Image< T > > images ) { if ( images == null images.size() == 0 ) return null; int[] size = images.get( 0 ).getDimensions(); for ( final Image< ? > image : images ) for ( int d = 0; d < image.getNumDimensions(); ++d ) size[ d ] = Math.max( size[ d ], image.getDimension( d ) ); return size; }
/** * Returns the bounding box so that all images can fit in there * or null if input is null or input.size is 0 * * @param images * @return */
Returns the bounding box so that all images can fit in there or null if input is null or input.size is 0
commonSize
{ "repo_name": "bigdataviewer/SPIM_Registration", "path": "src/main/java/mpicbg/spim/postprocessing/deconvolution/ExtractPSF.java", "license": "gpl-2.0", "size": 20146 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,088,243
public long getCredentialExpirationTime(Credential credential) { Preconditions.checkNotNull(credential); return Verification.maximumExpirationTime(getJointVerifications(credential)); }
long function(Credential credential) { Preconditions.checkNotNull(credential); return Verification.maximumExpirationTime(getJointVerifications(credential)); }
/** * Gets the expiration time of a credential. * * @param credential A credential to get the expiration time for. * @return The credential's expiration time, or {@code 0} if the credential * isn't verified. */
Gets the expiration time of a credential
getCredentialExpirationTime
{ "repo_name": "googlegsa/secmgr", "path": "src/main/java/com/google/enterprise/secmgr/authncontroller/SessionView.java", "license": "apache-2.0", "size": 20003 }
[ "com.google.common.base.Preconditions", "com.google.enterprise.secmgr.identity.Credential", "com.google.enterprise.secmgr.identity.Verification" ]
import com.google.common.base.Preconditions; import com.google.enterprise.secmgr.identity.Credential; import com.google.enterprise.secmgr.identity.Verification;
import com.google.common.base.*; import com.google.enterprise.secmgr.identity.*;
[ "com.google.common", "com.google.enterprise" ]
com.google.common; com.google.enterprise;
604,432
public Color getBackground(){ return gc.getBackground(); }
Color function(){ return gc.getBackground(); }
/** * Returns the background color used for clearing a region. * @return the current <code>Graphics2D</code> <code>Color</code>, * which defines the background color. * @see #setBackground */
Returns the background color used for clearing a region
getBackground
{ "repo_name": "adufilie/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/g2d/AbstractGraphics2D.java", "license": "apache-2.0", "size": 60727 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,268,556
private Color calculateMovementDependentDeltaColor(final Color shine, Color color, final Boid boid) { Polar2D polarDirection = boid.getDirectionPolar(); Polar2D polarPreviousDirection = boid.getPreviousDirectionPolar(); double deltaAngle = (Double.isNaN(polarDirection.getAngle()) || Double.isNaN(polarPreviousDirection.getAngle())) ? 0 : Math.abs(polarDirection.getAngle() - polarPreviousDirection.getAngle()); if (deltaAngle > Math.PI) { deltaAngle = 2 * Math.PI - deltaAngle; } int deltaRed = calculateDeltaColorValue(shine.getRed(), color.getRed(), deltaAngle); int deltaGreen = calculateDeltaColorValue(shine.getGreen(), color.getGreen(), deltaAngle); int deltaBlue = calculateDeltaColorValue(shine.getBlue(), color.getBlue(), deltaAngle); return new Color(color.getRed() + deltaRed, color.getGreen() + deltaGreen, color.getBlue() + deltaBlue); }
Color function(final Color shine, Color color, final Boid boid) { Polar2D polarDirection = boid.getDirectionPolar(); Polar2D polarPreviousDirection = boid.getPreviousDirectionPolar(); double deltaAngle = (Double.isNaN(polarDirection.getAngle()) Double.isNaN(polarPreviousDirection.getAngle())) ? 0 : Math.abs(polarDirection.getAngle() - polarPreviousDirection.getAngle()); if (deltaAngle > Math.PI) { deltaAngle = 2 * Math.PI - deltaAngle; } int deltaRed = calculateDeltaColorValue(shine.getRed(), color.getRed(), deltaAngle); int deltaGreen = calculateDeltaColorValue(shine.getGreen(), color.getGreen(), deltaAngle); int deltaBlue = calculateDeltaColorValue(shine.getBlue(), color.getBlue(), deltaAngle); return new Color(color.getRed() + deltaRed, color.getGreen() + deltaGreen, color.getBlue() + deltaBlue); }
/** * calculates color-change dependent on the angle-change of movement. * * @param shine * @param color * @param boid * @return */
calculates color-change dependent on the angle-change of movement
calculateMovementDependentDeltaColor
{ "repo_name": "friezi/sims-and-algs", "path": "src/main/java/de/zintel/sim/CollectiveIntelligence.java", "license": "gpl-3.0", "size": 24236 }
[ "de.zintel.ci.Boid", "de.zintel.math.Polar2D", "java.awt.Color" ]
import de.zintel.ci.Boid; import de.zintel.math.Polar2D; import java.awt.Color;
import de.zintel.ci.*; import de.zintel.math.*; import java.awt.*;
[ "de.zintel.ci", "de.zintel.math", "java.awt" ]
de.zintel.ci; de.zintel.math; java.awt;
988,098
if (inputList.size() == 0) { return new IntList(0); } IntList outputList = new IntList(inputList.size()); if (propertyPath.contains(".") || propertyPath.contains("[")) { String[] properties = StringScanner.splitByDelimiters(propertyPath, ".[]"); for (Object o : inputList) { outputList.add(BeanUtils.getPropertyInt(o, properties)); } } else { Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(inputList.iterator().next()); FieldAccess fieldAccess = fields.get(propertyPath); for (Object o : inputList) { outputList.add(fieldAccess.getInt(o)); } } return outputList; }
if (inputList.size() == 0) { return new IntList(0); } IntList outputList = new IntList(inputList.size()); if (propertyPath.contains(".") propertyPath.contains("[")) { String[] properties = StringScanner.splitByDelimiters(propertyPath, ".[]"); for (Object o : inputList) { outputList.add(BeanUtils.getPropertyInt(o, properties)); } } else { Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(inputList.iterator().next()); FieldAccess fieldAccess = fields.get(propertyPath); for (Object o : inputList) { outputList.add(fieldAccess.getInt(o)); } } return outputList; }
/** * Creates a primitive list based on an input list and a property path * * @param inputList input list * @param propertyPath property path * @return primitive list */
Creates a primitive list based on an input list and a property path
toIntList
{ "repo_name": "advantageous/boon", "path": "util/src/main/java/io/advantageous/boon/collections/IntList.java", "license": "apache-2.0", "size": 9270 }
[ "io.advantageous.boon.core.StringScanner", "io.advantageous.boon.core.reflection.BeanUtils", "io.advantageous.boon.core.reflection.fields.FieldAccess", "java.util.Map" ]
import io.advantageous.boon.core.StringScanner; import io.advantageous.boon.core.reflection.BeanUtils; import io.advantageous.boon.core.reflection.fields.FieldAccess; import java.util.Map;
import io.advantageous.boon.core.*; import io.advantageous.boon.core.reflection.*; import io.advantageous.boon.core.reflection.fields.*; import java.util.*;
[ "io.advantageous.boon", "java.util" ]
io.advantageous.boon; java.util;
764,570
public Setting get(Setting setting) throws InvalidAppConfigException, DAOException { String clause=null; String clauseValue=null; if(setting.getId()!=null) { clause = "ID = ?"; clauseValue = Long.toString(setting.getId()); } else if(setting.getKey()!=null) { clause = "KEY = ?"; clauseValue = setting.getKey(); } try { SQLiteDatabase db = database.getReadableDatabase(); if(db != null) { Cursor cursor = db.query(TABLE_NAME, new String[]{"ID", "KEY", "VALUE"}, clause, new String[]{clauseValue}, null, null, null, null); if (cursor != null && cursor.getCount() != 0) { cursor.moveToFirst(); setting = new Setting(cursor.getLong(0), cursor.getString(1), cursor.getString(2)); cursor.close(); } else { db.close(); return null; } db.close(); return setting; } return null; } catch (SQLiteException e) { e.printStackTrace(); throw new DAOException(ResourceHelper.getStringResource(R.string.settings_query_exception),e); } }
Setting function(Setting setting) throws InvalidAppConfigException, DAOException { String clause=null; String clauseValue=null; if(setting.getId()!=null) { clause = STR; clauseValue = Long.toString(setting.getId()); } else if(setting.getKey()!=null) { clause = STR; clauseValue = setting.getKey(); } try { SQLiteDatabase db = database.getReadableDatabase(); if(db != null) { Cursor cursor = db.query(TABLE_NAME, new String[]{"ID", "KEY", "VALUE"}, clause, new String[]{clauseValue}, null, null, null, null); if (cursor != null && cursor.getCount() != 0) { cursor.moveToFirst(); setting = new Setting(cursor.getLong(0), cursor.getString(1), cursor.getString(2)); cursor.close(); } else { db.close(); return null; } db.close(); return setting; } return null; } catch (SQLiteException e) { e.printStackTrace(); throw new DAOException(ResourceHelper.getStringResource(R.string.settings_query_exception),e); } }
/** * Get settings by ID or by KEY in this order priority. Uses the same reference of the parameters * @param setting Setting id OR key to search (reference will be used as return if valid) * @return * @throws InvalidAppConfigException * @throws DAOException */
Get settings by ID or by KEY in this order priority. Uses the same reference of the parameters
get
{ "repo_name": "FUNCATE/TerraMobile", "path": "app/src/main/java/br/org/funcate/terramobile/model/db/dao/SettingsDAO.java", "license": "apache-2.0", "size": 5904 }
[ "android.database.Cursor", "android.database.sqlite.SQLiteDatabase", "android.database.sqlite.SQLiteException", "br.org.funcate.terramobile.model.domain.Setting", "br.org.funcate.terramobile.model.exception.DAOException", "br.org.funcate.terramobile.model.exception.InvalidAppConfigException", "br.org.funcate.terramobile.util.ResourceHelper" ]
import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import br.org.funcate.terramobile.model.domain.Setting; import br.org.funcate.terramobile.model.exception.DAOException; import br.org.funcate.terramobile.model.exception.InvalidAppConfigException; import br.org.funcate.terramobile.util.ResourceHelper;
import android.database.*; import android.database.sqlite.*; import br.org.funcate.terramobile.model.domain.*; import br.org.funcate.terramobile.model.exception.*; import br.org.funcate.terramobile.util.*;
[ "android.database", "br.org.funcate" ]
android.database; br.org.funcate;
2,302,662
public List<AuditLogEntry> search(SearchRequest searchRequest) throws ApiException { return searchWithHttpInfo(searchRequest).getData(); }
List<AuditLogEntry> function(SearchRequest searchRequest) throws ApiException { return searchWithHttpInfo(searchRequest).getData(); }
/** * Search logged entries * Perform search using a Lucene query. The lucene query syntax can be &lt;a href&#x3D;\&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax\&quot;&gt;found here&lt;/a&gt; * @param searchRequest searchRequest (required) * @return List&lt;AuditLogEntry&gt; * @throws ApiException if fails to make API call */
Search logged entries Perform search using a Lucene query. The lucene query syntax can be &lt;a href&#x3D;\&quot;HREF here&lt;/a&gt
search
{ "repo_name": "LogSentinel/logsentinel-java-client", "path": "src/main/java/com/logsentinel/api/SearchApi.java", "license": "mit", "size": 15829 }
[ "com.logsentinel.ApiException", "com.logsentinel.model.AuditLogEntry", "com.logsentinel.model.SearchRequest", "java.util.List" ]
import com.logsentinel.ApiException; import com.logsentinel.model.AuditLogEntry; import com.logsentinel.model.SearchRequest; import java.util.List;
import com.logsentinel.*; import com.logsentinel.model.*; import java.util.*;
[ "com.logsentinel", "com.logsentinel.model", "java.util" ]
com.logsentinel; com.logsentinel.model; java.util;
1,738,162
public List list(Class clazz, String key, Object value) { EntityManager entityManager = null; try { entityManager = entityManagers.poll(); Query query = entityManager.createQuery("SELECT c FROM " + clazz.getCanonicalName() + " c where c." + key + " = :param"); query.setParameter("param", value); return query.getResultList(); } catch (Exception e) { e.printStackTrace(); } finally { if(entityManager != null) entityManagers.add(entityManager); } return null; }
List function(Class clazz, String key, Object value) { EntityManager entityManager = null; try { entityManager = entityManagers.poll(); Query query = entityManager.createQuery(STR + clazz.getCanonicalName() + STR + key + STR); query.setParameter("param", value); return query.getResultList(); } catch (Exception e) { e.printStackTrace(); } finally { if(entityManager != null) entityManagers.add(entityManager); } return null; }
/** * Execute query with criteria of key = key. This will auto generate a sql statement. * * @param clazz Entity to query * @param key Attribute to predicate upon * @param value Attribute key to predicate upon * @return List of entities that match the criteria */
Execute query with criteria of key = key. This will auto generate a sql statement
list
{ "repo_name": "OnyxDevTools/onyx-database-parent", "path": "onyx-database-examples/performance-benchmarks/src/main/java/com/onyxdevtools/provider/manager/JPAPersistenceManager.java", "license": "agpl-3.0", "size": 6127 }
[ "java.util.List", "javax.persistence.EntityManager", "javax.persistence.Query" ]
import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query;
import java.util.*; import javax.persistence.*;
[ "java.util", "javax.persistence" ]
java.util; javax.persistence;
1,245,277
registry.addInterceptor(new PreservesHttpHeadersInterceptor(properties.buildEntriesFilter())).addPathPatterns("/**"); log.info("Context propagation enabled for http request on keys={}.", properties.getKeys()); }
registry.addInterceptor(new PreservesHttpHeadersInterceptor(properties.buildEntriesFilter())).addPathPatterns("/**"); log.info(STR, properties.getKeys()); }
/** * Adds http request interceptor copying headers from the request to the context * * @param registry the interceptor registry */
Adds http request interceptor copying headers from the request to the context
addInterceptors
{ "repo_name": "enadim/spring-cloud-ribbon-extensions", "path": "src/main/java/com/github/enadim/spring/cloud/ribbon/support/strategy/PreservesHeadersInboundHttpRequestStrategy.java", "license": "apache-2.0", "size": 2465 }
[ "com.github.enadim.spring.cloud.ribbon.propagator.servlet.PreservesHttpHeadersInterceptor" ]
import com.github.enadim.spring.cloud.ribbon.propagator.servlet.PreservesHttpHeadersInterceptor;
import com.github.enadim.spring.cloud.ribbon.propagator.servlet.*;
[ "com.github.enadim" ]
com.github.enadim;
2,836,773
public final InternalDistributedMember basicGetPrimaryMember() { return (InternalDistributedMember) this.primaryMember.get(); }
final InternalDistributedMember function() { return (InternalDistributedMember) this.primaryMember.get(); }
/** * Check the primary member shortcut. Does not query the advisor. Should * only be used when the advisor should not be consulted directly. * * @return the member or null if no primary exists */
Check the primary member shortcut. Does not query the advisor. Should only be used when the advisor should not be consulted directly
basicGetPrimaryMember
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketAdvisor.java", "license": "apache-2.0", "size": 109254 }
[ "com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember" ]
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
2,908,774
public UserProcessAction getProcessAction() { return processAction; }
UserProcessAction function() { return processAction; }
/** * Gets the process action. * * @return the process action. */
Gets the process action
getProcessAction
{ "repo_name": "lorislab/appky", "path": "appky-process/src/main/java/org/lorislab/appky/application/wrapper/model/PlatformWrapper.java", "license": "apache-2.0", "size": 5636 }
[ "org.lorislab.appky.application.wrapper.model.enums.UserProcessAction" ]
import org.lorislab.appky.application.wrapper.model.enums.UserProcessAction;
import org.lorislab.appky.application.wrapper.model.enums.*;
[ "org.lorislab.appky" ]
org.lorislab.appky;
2,514,668
public Iterator<ClientEntry> getEntries() throws ProponoException { return new EntryIterator(this); }
Iterator<ClientEntry> function() throws ProponoException { return new EntryIterator(this); }
/** * Get iterator over entries in this collection. Entries returned are considered to be partial * entries cannot be saved/updated. */
Get iterator over entries in this collection. Entries returned are considered to be partial entries cannot be saved/updated
getEntries
{ "repo_name": "rometools/rome-propono", "path": "src/main/java/com/rometools/propono/atom/client/ClientCollection.java", "license": "apache-2.0", "size": 8774 }
[ "com.rometools.propono.utils.ProponoException", "java.util.Iterator" ]
import com.rometools.propono.utils.ProponoException; import java.util.Iterator;
import com.rometools.propono.utils.*; import java.util.*;
[ "com.rometools.propono", "java.util" ]
com.rometools.propono; java.util;
2,370,211
@PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateEquivalencia(Equivalencia equivalencia) { RotondAndesTM tm = new RotondAndesTM(getPath()); try { tm.updateEquivalencia(equivalencia); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(equivalencia).build(); }
@Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response function(Equivalencia equivalencia) { RotondAndesTM tm = new RotondAndesTM(getPath()); try { tm.updateEquivalencia(equivalencia); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(equivalencia).build(); }
/** * Metodo que expone servicio REST usando PUT que actualiza el equivalencia que recibe en Json * <b>URL: </b> http://"ip o nombre de host":8080/VideoAndes/rest/equivalencias * @param equivalencia - equivalencia a actualizar. * @return Json con el equivalencia que actualizo o Json con el error que se produjo */
Metodo que expone servicio REST usando PUT que actualiza el equivalencia que recibe en Json
updateEquivalencia
{ "repo_name": "rafafor24/Iteracion_2", "path": "src/rest/EquivalenciaServices.java", "license": "mit", "size": 4929 }
[ "javax.ws.rs.Consumes", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
413,609
public void handleNetworkException(VDSNetworkException ex) { boolean saveToDb = true; if (cachedVds.getStatus() != VDSStatus.Down) { long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), cachedVds.getSpmStatus()); if (isHostInGracePeriod(false)) { if (cachedVds.getStatus() != VDSStatus.Connecting && cachedVds.getStatus() != VDSStatus.PreparingForMaintenance && cachedVds.getStatus() != VDSStatus.NonResponsive) { setStatus(VDSStatus.Connecting, cachedVds); logChangeStatusToConnecting(timeoutToFence); } else { saveToDb = false; } unrespondedAttempts.incrementAndGet(); } else { if (cachedVds.getStatus() == VDSStatus.Maintenance) { saveToDb = false; } else { if (cachedVds.getStatus() != VDSStatus.NonResponsive) { setStatus(VDSStatus.NonResponsive, cachedVds); moveVMsToUnknown(); logHostFailToRespond(ex, timeoutToFence); resourceManager.getEventListener().vdsNotResponding(cachedVds); } else { setStatus(VDSStatus.NonResponsive, cachedVds); } } } } if (saveToDb) { updateDynamicData(cachedVds.getDynamicData()); updateStatisticsData(cachedVds.getStatisticsData()); } }
void function(VDSNetworkException ex) { boolean saveToDb = true; if (cachedVds.getStatus() != VDSStatus.Down) { long timeoutToFence = calcTimeoutToFence(cachedVds.getVmCount(), cachedVds.getSpmStatus()); if (isHostInGracePeriod(false)) { if (cachedVds.getStatus() != VDSStatus.Connecting && cachedVds.getStatus() != VDSStatus.PreparingForMaintenance && cachedVds.getStatus() != VDSStatus.NonResponsive) { setStatus(VDSStatus.Connecting, cachedVds); logChangeStatusToConnecting(timeoutToFence); } else { saveToDb = false; } unrespondedAttempts.incrementAndGet(); } else { if (cachedVds.getStatus() == VDSStatus.Maintenance) { saveToDb = false; } else { if (cachedVds.getStatus() != VDSStatus.NonResponsive) { setStatus(VDSStatus.NonResponsive, cachedVds); moveVMsToUnknown(); logHostFailToRespond(ex, timeoutToFence); resourceManager.getEventListener().vdsNotResponding(cachedVds); } else { setStatus(VDSStatus.NonResponsive, cachedVds); } } } } if (saveToDb) { updateDynamicData(cachedVds.getDynamicData()); updateStatisticsData(cachedVds.getStatisticsData()); } }
/** * Handle network exception * * @param ex exception to handle * @return */
Handle network exception
handleNetworkException
{ "repo_name": "eayun/ovirt-engine", "path": "backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java", "license": "apache-2.0", "size": 47192 }
[ "org.ovirt.engine.core.common.businessentities.VDSStatus", "org.ovirt.engine.core.vdsbroker.vdsbroker.VDSNetworkException" ]
import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.vdsbroker.vdsbroker.VDSNetworkException;
import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.vdsbroker.vdsbroker.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
1,693,024
EAttribute getValidation_Mandatory();
EAttribute getValidation_Mandatory();
/** * Returns the meta object for the attribute '{@link org.openhealthtools.mdht.uml.cda.core.profile.Validation#isMandatory <em>Mandatory</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Mandatory</em>'. * @see org.openhealthtools.mdht.uml.cda.core.profile.Validation#isMandatory() * @see #getValidation() * @generated */
Returns the meta object for the attribute '<code>org.openhealthtools.mdht.uml.cda.core.profile.Validation#isMandatory Mandatory</code>'.
getValidation_Mandatory
{ "repo_name": "sarpkayanehta/mdht", "path": "cda/plugins/org.openhealthtools.mdht.uml.cda.core/src/org/openhealthtools/mdht/uml/cda/core/profile/CDAPackage.java", "license": "epl-1.0", "size": 105536 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,683,997
private int lowerBound(int startingPosition, int first, int last, int probePosition, Page allProbeChannelsPage) { int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; if (!applyLessThanFunction(startingPosition, middle, probePosition, allProbeChannelsPage)) { first = ++middle; count -= step + 1; } else { count = step; } } return first; }
int function(int startingPosition, int first, int last, int probePosition, Page allProbeChannelsPage) { int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; if (!applyLessThanFunction(startingPosition, middle, probePosition, allProbeChannelsPage)) { first = ++middle; count -= step + 1; } else { count = step; } } return first; }
/** * Find the first element in position links that is NOT smaller than probePosition */
Find the first element in position links that is NOT smaller than probePosition
lowerBound
{ "repo_name": "mandusm/presto", "path": "presto-main/src/main/java/com/facebook/presto/operator/SortedPositionLinks.java", "license": "apache-2.0", "size": 11819 }
[ "com.facebook.presto.spi.Page" ]
import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.*;
[ "com.facebook.presto" ]
com.facebook.presto;
1,194,519
Execs.exec("tesseract " + imagePath + " " + imagePath + " -l chi_sim -psm 10"); try { return StringUtils.trim(IOUtils.toString(new FileInputStream(imagePath + ".txt"), "UTF-8")); } catch (final IOException e) { return null; } } private Tesseracts() { }
Execs.exec(STR + imagePath + " " + imagePath + STR); try { return StringUtils.trim(IOUtils.toString(new FileInputStream(imagePath + ".txt"), "UTF-8")); } catch (final IOException e) { return null; } } private Tesseracts() { }
/** * Recognizes a single character from the specified image file path. * * @param imagePath the specified image file path * @return the recognized character */
Recognizes a single character from the specified image file path
recognizeCharacter
{ "repo_name": "billho/symphony", "path": "src/main/java/org/b3log/symphony/util/Tesseracts.java", "license": "apache-2.0", "size": 1831 }
[ "java.io.FileInputStream", "java.io.IOException", "org.apache.commons.io.IOUtils", "org.apache.commons.lang.StringUtils", "org.b3log.latke.util.Execs" ]
import java.io.FileInputStream; import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.b3log.latke.util.Execs;
import java.io.*; import org.apache.commons.io.*; import org.apache.commons.lang.*; import org.b3log.latke.util.*;
[ "java.io", "org.apache.commons", "org.b3log.latke" ]
java.io; org.apache.commons; org.b3log.latke;
1,128,764
public void updateEntity(Entity entity, boolean doCommit) { // do merge action instead of update if possible. A merge action at ADF BC SDO service // can also insert new children, an update cannot. ClassMappingDescriptor descriptor = ClassMappingDescriptor.getInstance(entity.getClass()); Method method = descriptor.isMergeSupported()? descriptor.getMergeMethod(): descriptor.getUpdateMethod(); sendWriteRequest(entity, method,ACTION_UPDATE); }
void function(Entity entity, boolean doCommit) { ClassMappingDescriptor descriptor = ClassMappingDescriptor.getInstance(entity.getClass()); Method method = descriptor.isMergeSupported()? descriptor.getMergeMethod(): descriptor.getUpdateMethod(); sendWriteRequest(entity, method,ACTION_UPDATE); }
/** * Do web service call that updates data of the entity passed in. * This method calls sendWriteRequest method. * @param entity * @param doCommit */
Do web service call that updates data of the entity passed in. This method calls sendWriteRequest method
updateEntity
{ "repo_name": "oracle/mobile-persistence", "path": "Projects/Framework/Runtime/src/oracle/ateam/sample/mobile/v2/persistence/manager/AbstractRemotePersistenceManager.java", "license": "mit", "size": 16445 }
[ "oracle.ateam.sample.mobile.v2.persistence.metadata.ClassMappingDescriptor", "oracle.ateam.sample.mobile.v2.persistence.metadata.Method", "oracle.ateam.sample.mobile.v2.persistence.model.Entity" ]
import oracle.ateam.sample.mobile.v2.persistence.metadata.ClassMappingDescriptor; import oracle.ateam.sample.mobile.v2.persistence.metadata.Method; import oracle.ateam.sample.mobile.v2.persistence.model.Entity;
import oracle.ateam.sample.mobile.v2.persistence.metadata.*; import oracle.ateam.sample.mobile.v2.persistence.model.*;
[ "oracle.ateam.sample" ]
oracle.ateam.sample;
1,633,249
public static void checkShortCircuitReadBufferSize(final Configuration conf) { final int defaultSize = HConstants.DEFAULT_BLOCKSIZE * 2; final int notSet = -1; // DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_BUFFER_SIZE_KEY is only defined in h2 final String dfsKey = "dfs.client.read.shortcircuit.buffer.size"; int size = conf.getInt(dfsKey, notSet); // If a size is set, return -- we will use it. if (size != notSet) return; // But short circuit buffer size is normally not set. Put in place the hbase wanted size. int hbaseSize = conf.getInt("hbase." + dfsKey, defaultSize); conf.setIfUnset(dfsKey, Integer.toString(hbaseSize)); }
static void function(final Configuration conf) { final int defaultSize = HConstants.DEFAULT_BLOCKSIZE * 2; final int notSet = -1; final String dfsKey = STR; int size = conf.getInt(dfsKey, notSet); if (size != notSet) return; int hbaseSize = conf.getInt(STR + dfsKey, defaultSize); conf.setIfUnset(dfsKey, Integer.toString(hbaseSize)); }
/** * Check if short circuit read buffer size is set and if not, set it to hbase value. * @param conf */
Check if short circuit read buffer size is set and if not, set it to hbase value
checkShortCircuitReadBufferSize
{ "repo_name": "andrewmains12/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 77341 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.HConstants" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,804,492
protected void addSelects(StringBuilder builder) { // Add columns to select Set<FieldName> names = accessProfile.getFieldNames(); if (null == names) { throw (new SecurityException("Cannot generate Sql command for null field set.")); } if (names.isEmpty()) { // Empty select list means "return all columns". builder.append(" *"); } else { // Add comma separated list of select terms. Need to detect the last // operation so use old style iterator. Iterator<FieldName> iterator = names.iterator(); while (iterator.hasNext()) { FieldName name = iterator.next(); addSelect(builder, name); // If not the last entry if (iterator.hasNext()) { builder.append(","); } } } }
void function(StringBuilder builder) { Set<FieldName> names = accessProfile.getFieldNames(); if (null == names) { throw (new SecurityException(STR)); } if (names.isEmpty()) { builder.append(STR); } else { Iterator<FieldName> iterator = names.iterator(); while (iterator.hasNext()) { FieldName name = iterator.next(); addSelect(builder, name); if (iterator.hasNext()) { builder.append(","); } } } }
/** * Add Selected column names to query * * @param builder */
Add Selected column names to query
addSelects
{ "repo_name": "schwadorf/IRIS", "path": "interaction-jdbc-producer/src/main/java/com/temenos/interaction/jdbc/producer/sql/SqlBuilder.java", "license": "agpl-3.0", "size": 12600 }
[ "com.temenos.interaction.odataext.odataparser.data.FieldName", "java.util.Iterator", "java.util.Set" ]
import com.temenos.interaction.odataext.odataparser.data.FieldName; import java.util.Iterator; import java.util.Set;
import com.temenos.interaction.odataext.odataparser.data.*; import java.util.*;
[ "com.temenos.interaction", "java.util" ]
com.temenos.interaction; java.util;
1,974,705
public BigDecimal getQtyBook(); public static final String COLUMNNAME_QtyCount = "QtyCount";
BigDecimal function(); public static final String COLUMNNAME_QtyCount = STR;
/** Get Quantity book. * Book Quantity */
Get Quantity book. Book Quantity
getQtyBook
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/I_I_Inventory.java", "license": "gpl-2.0", "size": 11263 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
378,062
public void addMillisecondObserver(Observer newObserver) { millisecondObservable.addObserver(newObserver); hasMillisecondObservers = true;
void function(Observer newObserver) { millisecondObservable.addObserver(newObserver); hasMillisecondObservers = true;
/** * Add millisecond observer. * This observer is notified once every simulated millisecond. * * @see #deleteMillisecondObserver(Observer) * @param newObserver Observer */
Add millisecond observer. This observer is notified once every simulated millisecond
addMillisecondObserver
{ "repo_name": "vijaysrao/dipa", "path": "tools/cooja/java/org/contikios/cooja/Simulation.java", "license": "gpl-3.0", "size": 32179 }
[ "java.util.Observer" ]
import java.util.Observer;
import java.util.*;
[ "java.util" ]
java.util;
369,184
public StepMeta getStep(int i) { return steps.get(i); }
StepMeta function(int i) { return steps.get(i); }
/** * Retrieves a step on a certain location. * * @param i * The location. * @return The step information. */
Retrieves a step on a certain location
getStep
{ "repo_name": "panbasten/imeta", "path": "imeta2.x/imeta-src/imeta/src/main/java/com/panet/imeta/trans/TransMeta.java", "license": "gpl-2.0", "size": 209743 }
[ "com.panet.imeta.trans.step.StepMeta" ]
import com.panet.imeta.trans.step.StepMeta;
import com.panet.imeta.trans.step.*;
[ "com.panet.imeta" ]
com.panet.imeta;
2,303,796
@Override @Retries.RetryTranslated public MultipartUploadListing next() throws IOException { if (firstListing) { firstListing = false; } else { if (listing == null || !listing.isTruncated()) { // nothing more to request: fail. throw new NoSuchElementException("No more uploads under " + prefix); } // need to request a new set of objects. requestNextBatch(); } return listing; }
@Retries.RetryTranslated MultipartUploadListing function() throws IOException { if (firstListing) { firstListing = false; } else { if (listing == null !listing.isTruncated()) { throw new NoSuchElementException(STR + prefix); } requestNextBatch(); } return listing; }
/** * Get next listing. First call, this returns initial set (possibly * empty) obtained from S3. Subsequent calls my block on I/O or fail. * @return next upload listing. * @throws IOException if S3 operation fails. * @throws NoSuchElementException if there are no more uploads. */
Get next listing. First call, this returns initial set (possibly empty) obtained from S3. Subsequent calls my block on I/O or fail
next
{ "repo_name": "steveloughran/hadoop", "path": "hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/MultipartUtils.java", "license": "apache-2.0", "size": 6954 }
[ "com.amazonaws.services.s3.model.MultipartUploadListing", "java.io.IOException", "java.util.NoSuchElementException" ]
import com.amazonaws.services.s3.model.MultipartUploadListing; import java.io.IOException; import java.util.NoSuchElementException;
import com.amazonaws.services.s3.model.*; import java.io.*; import java.util.*;
[ "com.amazonaws.services", "java.io", "java.util" ]
com.amazonaws.services; java.io; java.util;
1,726,050
public List<String> getNicknames() { return nicknames; }
List<String> function() { return nicknames; }
/** * Gets the nicknames. * * @return the nicknames */
Gets the nicknames
getNicknames
{ "repo_name": "ravisund/Kundera", "path": "src/kundera-cassandra/cassandra-ds-driver/src/test/java/com/impetus/client/cassandra/udt/PersonUDT.java", "license": "apache-2.0", "size": 6477 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,510,208
@Test public void testOnAcquireFail() throws SQLException { hookClass = new CustomHook(); reset(mockConfig); mockConfig.sanitize(); expectLastCall().anyTimes(); driver.setConnection(null); driver.setMockJDBCAnswer(new MockJDBCAnswer() {
void function() throws SQLException { hookClass = new CustomHook(); reset(mockConfig); mockConfig.sanitize(); expectLastCall().anyTimes(); driver.setConnection(null); driver.setMockJDBCAnswer(new MockJDBCAnswer() {
/** * Test method for {@link com.jolbox.bonecp.hooks.AbstractConnectionHook#onDestroy(com.jolbox.bonecp.ConnectionHandle)}. * @throws SQLException */
Test method for <code>com.jolbox.bonecp.hooks.AbstractConnectionHook#onDestroy(com.jolbox.bonecp.ConnectionHandle)</code>
testOnAcquireFail
{ "repo_name": "liuxing521a/itas-core", "path": "core/src/test/java/org/itas/core/dbpool/hooks/TestConnectionHook.java", "license": "apache-2.0", "size": 12367 }
[ "com.jolbox.bonecp.hooks.CustomHook", "java.sql.SQLException", "org.easymock.EasyMock", "org.easymock.classextension.EasyMock", "org.itas.core.dbpool.MockJDBCAnswer" ]
import com.jolbox.bonecp.hooks.CustomHook; import java.sql.SQLException; import org.easymock.EasyMock; import org.easymock.classextension.EasyMock; import org.itas.core.dbpool.MockJDBCAnswer;
import com.jolbox.bonecp.hooks.*; import java.sql.*; import org.easymock.*; import org.easymock.classextension.*; import org.itas.core.dbpool.*;
[ "com.jolbox.bonecp", "java.sql", "org.easymock", "org.easymock.classextension", "org.itas.core" ]
com.jolbox.bonecp; java.sql; org.easymock; org.easymock.classextension; org.itas.core;
1,919,980
public static Row findRowByEntry(Index index, Object... entryValues) throws IOException { return createCursor(index).findRowByEntry(entryValues); }
static Row function(Index index, Object... entryValues) throws IOException { return createCursor(index).findRowByEntry(entryValues); }
/** * Convenience method for finding a specific row (as defined by the cursor) * where the index entries match the given values. See {@link * IndexCursor#findRowByEntry(Object...)} for details on the entryValues. * * @param index the index to search * @param entryValues the column values for the index's columns. * @return the matching row or {@code null} if a match could not be found. */
Convenience method for finding a specific row (as defined by the cursor) where the index entries match the given values. See <code>IndexCursor#findRowByEntry(Object...)</code> for details on the entryValues
findRowByEntry
{ "repo_name": "jahlborn/jackcess", "path": "src/main/java/com/healthmarketscience/jackcess/CursorBuilder.java", "license": "apache-2.0", "size": 17523 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,148,293
public Map<JobHistoryKeys, String> getValues(){ return values; } } public static class JobInfo extends KeyValuePair{ private Map<String, Task> allTasks = new TreeMap<String, Task>(); private Map<JobACL, AccessControlList> jobACLs = new HashMap<JobACL, AccessControlList>(); private String queueName = null;// queue to which this job was submitted to public JobInfo(String jobId){ set(JobHistoryKeys.JOBID, jobId); } public Map<String, Task> getAllTasks() { return allTasks; }
Map<JobHistoryKeys, String> function(){ return values; } } public static class JobInfo extends KeyValuePair{ private Map<String, Task> allTasks = new TreeMap<String, Task>(); private Map<JobACL, AccessControlList> jobACLs = new HashMap<JobACL, AccessControlList>(); private String queueName = null; public JobInfo(String jobId){ set(JobHistoryKeys.JOBID, jobId); } public Map<String, Task> getAllTasks() { return allTasks; }
/** * Returns Map containing all key-values. */
Returns Map containing all key-values
getValues
{ "repo_name": "InMobi/hraven", "path": "hraven-etl/src/main/java/org/apache/hadoop/mapred/JobHistoryCopy.java", "license": "apache-2.0", "size": 82907 }
[ "com.twitter.hraven.JobHistoryKeys", "java.util.HashMap", "java.util.Map", "java.util.TreeMap", "org.apache.hadoop.mapreduce.JobACL", "org.apache.hadoop.security.authorize.AccessControlList" ]
import com.twitter.hraven.JobHistoryKeys; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; import org.apache.hadoop.mapreduce.JobACL; import org.apache.hadoop.security.authorize.AccessControlList;
import com.twitter.hraven.*; import java.util.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.security.authorize.*;
[ "com.twitter.hraven", "java.util", "org.apache.hadoop" ]
com.twitter.hraven; java.util; org.apache.hadoop;
2,812,467
Server refresh(Context context);
Server refresh(Context context);
/** * Refreshes the resource to sync with Azure. * * @param context The context to associate with this operation. * @return the refreshed resource. */
Refreshes the resource to sync with Azure
refresh
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Server.java", "license": "mit", "size": 14052 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,126,946
public VendorPayment categorizeAsVendorPayment(String transactionId, VendorPayment vendorPayment)throws Exception { String urlString = url+"/uncategorized/"+transactionId+"/categorize/vendorpayments"; //No I18N HashMap<String, Object> requestBody = getQueryMap(); requestBody.put("JSONString", vendorPayment.toJSON().toString()); String response = ZohoHTTPClient.post(urlString, requestBody); return new VendorPaymentParser().getVendorPayment(response); }
VendorPayment function(String transactionId, VendorPayment vendorPayment)throws Exception { String urlString = url+STR+transactionId+STR; HashMap<String, Object> requestBody = getQueryMap(); requestBody.put(STR, vendorPayment.toJSON().toString()); String response = ZohoHTTPClient.post(urlString, requestBody); return new VendorPaymentParser().getVendorPayment(response); }
/** * Categorize an uncategorized transaction as Vendor Payment. * Pass the transactionId and VendorPayment object to categorize the transaction as vendor payment. * The VendorPayment object which contains vendorId and amount are the mandatory parameters. * It returns the VendorPayment object. * @param transactionId ID of the transaction. * @param vendorPayment VendorPayment object. * @return Returns the VendorPayment object. */
Categorize an uncategorized transaction as Vendor Payment. Pass the transactionId and VendorPayment object to categorize the transaction as vendor payment. The VendorPayment object which contains vendorId and amount are the mandatory parameters. It returns the VendorPayment object
categorizeAsVendorPayment
{ "repo_name": "zoho/books-java-wrappers", "path": "source/com/zoho/books/api/BankTransactionsApi.java", "license": "mit", "size": 18879 }
[ "com.zoho.books.model.VendorPayment", "com.zoho.books.parser.VendorPaymentParser", "com.zoho.books.util.ZohoHTTPClient", "java.util.HashMap" ]
import com.zoho.books.model.VendorPayment; import com.zoho.books.parser.VendorPaymentParser; import com.zoho.books.util.ZohoHTTPClient; import java.util.HashMap;
import com.zoho.books.model.*; import com.zoho.books.parser.*; import com.zoho.books.util.*; import java.util.*;
[ "com.zoho.books", "java.util" ]
com.zoho.books; java.util;
2,493,585
@SuppressWarnings("unchecked") public void emitLogsAndMetrics( @Nullable final Throwable e, @Nullable final String remoteAddress, final long bytesWritten ) { if (baseQuery == null) { // Never initialized, don't log or emit anything. return; } if (state == State.DONE) { log.warn("Tried to emit logs and metrics twice for query[%s]!", baseQuery.getId()); } state = State.DONE; final boolean success = e == null; try { final long queryTimeNs = System.nanoTime() - startNs; QueryMetrics queryMetrics = DruidMetrics.makeRequestMetrics( queryMetricsFactory, toolChest, baseQuery, StringUtils.nullToEmptyNonDruidDataString(remoteAddress) ); queryMetrics.success(success); queryMetrics.reportQueryTime(queryTimeNs); if (bytesWritten >= 0) { queryMetrics.reportQueryBytes(bytesWritten); } if (authenticationResult != null) { queryMetrics.identity(authenticationResult.getIdentity()); } queryMetrics.emit(emitter); final Map<String, Object> statsMap = new LinkedHashMap<>(); statsMap.put("query/time", TimeUnit.NANOSECONDS.toMillis(queryTimeNs)); statsMap.put("query/bytes", bytesWritten); statsMap.put("success", success); if (authenticationResult != null) { statsMap.put("identity", authenticationResult.getIdentity()); } if (e != null) { statsMap.put("exception", e.toString()); log.noStackTrace().warn(e, "Exception while processing queryId [%s]", baseQuery.getId()); if (e instanceof QueryInterruptedException || e instanceof QueryTimeoutException) { // Mimic behavior from QueryResource, where this code was originally taken from. statsMap.put("interrupted", true); statsMap.put("reason", e.toString()); } } requestLogger.logNativeQuery( RequestLogLine.forNative( baseQuery, DateTimes.utc(startMs), StringUtils.nullToEmptyNonDruidDataString(remoteAddress), new QueryStats(statsMap) ) ); } catch (Exception ex) { log.error(ex, "Unable to log query [%s]!", baseQuery); } }
@SuppressWarnings(STR) void function( @Nullable final Throwable e, @Nullable final String remoteAddress, final long bytesWritten ) { if (baseQuery == null) { return; } if (state == State.DONE) { log.warn(STR, baseQuery.getId()); } state = State.DONE; final boolean success = e == null; try { final long queryTimeNs = System.nanoTime() - startNs; QueryMetrics queryMetrics = DruidMetrics.makeRequestMetrics( queryMetricsFactory, toolChest, baseQuery, StringUtils.nullToEmptyNonDruidDataString(remoteAddress) ); queryMetrics.success(success); queryMetrics.reportQueryTime(queryTimeNs); if (bytesWritten >= 0) { queryMetrics.reportQueryBytes(bytesWritten); } if (authenticationResult != null) { queryMetrics.identity(authenticationResult.getIdentity()); } queryMetrics.emit(emitter); final Map<String, Object> statsMap = new LinkedHashMap<>(); statsMap.put(STR, TimeUnit.NANOSECONDS.toMillis(queryTimeNs)); statsMap.put(STR, bytesWritten); statsMap.put(STR, success); if (authenticationResult != null) { statsMap.put(STR, authenticationResult.getIdentity()); } if (e != null) { statsMap.put(STR, e.toString()); log.noStackTrace().warn(e, STR, baseQuery.getId()); if (e instanceof QueryInterruptedException e instanceof QueryTimeoutException) { statsMap.put(STR, true); statsMap.put(STR, e.toString()); } } requestLogger.logNativeQuery( RequestLogLine.forNative( baseQuery, DateTimes.utc(startMs), StringUtils.nullToEmptyNonDruidDataString(remoteAddress), new QueryStats(statsMap) ) ); } catch (Exception ex) { log.error(ex, STR, baseQuery); } }
/** * Emit logs and metrics for this query. * * @param e exception that occurred while processing this query * @param remoteAddress remote address, for logging; or null if unknown * @param bytesWritten number of bytes written; will become a query/bytes metric if >= 0 */
Emit logs and metrics for this query
emitLogsAndMetrics
{ "repo_name": "mghosh4/druid", "path": "server/src/main/java/org/apache/druid/server/QueryLifecycle.java", "license": "apache-2.0", "size": 12966 }
[ "java.util.LinkedHashMap", "java.util.Map", "java.util.concurrent.TimeUnit", "javax.annotation.Nullable", "org.apache.druid.java.util.common.DateTimes", "org.apache.druid.java.util.common.StringUtils", "org.apache.druid.query.DruidMetrics", "org.apache.druid.query.QueryInterruptedException", "org.apache.druid.query.QueryMetrics", "org.apache.druid.query.QueryTimeoutException" ]
import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Nullable; import org.apache.druid.java.util.common.DateTimes; import org.apache.druid.java.util.common.StringUtils; import org.apache.druid.query.DruidMetrics; import org.apache.druid.query.QueryInterruptedException; import org.apache.druid.query.QueryMetrics; import org.apache.druid.query.QueryTimeoutException;
import java.util.*; import java.util.concurrent.*; import javax.annotation.*; import org.apache.druid.java.util.common.*; import org.apache.druid.query.*;
[ "java.util", "javax.annotation", "org.apache.druid" ]
java.util; javax.annotation; org.apache.druid;
216,768
@SuppressWarnings("unchecked") private void setValueInChildPath(String path, Object value) { Map<String, Object> node = root; String[] keys = path.split("\\."); for (int i = 0; i < keys.length - 1; ++i) { Object child = node.get(keys[i]); if (child instanceof Map<?, ?>) { node = (Map<String, Object>) child; } else { // child is null or some other value - replace with map Map<String, Object> newEntry = new HashMap<>(); node.put(keys[i], newEntry); if (value == null) { // For consistency, replace whatever value/null here with an empty map, // but if the value is null our work here is done. return; } node = newEntry; } } // node now contains the parent map (existing or newly created) if (value == null) { node.remove(keys[keys.length - 1]); } else { node.put(keys[keys.length - 1], value); } }
@SuppressWarnings(STR) void function(String path, Object value) { Map<String, Object> node = root; String[] keys = path.split("\\."); for (int i = 0; i < keys.length - 1; ++i) { Object child = node.get(keys[i]); if (child instanceof Map<?, ?>) { node = (Map<String, Object>) child; } else { Map<String, Object> newEntry = new HashMap<>(); node.put(keys[i], newEntry); if (value == null) { return; } node = newEntry; } } if (value == null) { node.remove(keys[keys.length - 1]); } else { node.put(keys[keys.length - 1], value); } }
/** * Sets the value at the given path. This method is used when the root is a map and not a specific object. * * @param path the path to set the value at * @param value the value to set */
Sets the value at the given path. This method is used when the root is a map and not a specific object
setValueInChildPath
{ "repo_name": "Maxetto/AuthMeReloaded", "path": "src/main/java/fr/xephi/authme/message/updater/MessageMigraterPropertyReader.java", "license": "gpl-3.0", "size": 5189 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
649,390
protected ApplicationUser createNewApplicationUser() { return new ApplicationUser(this.getClass()); }
ApplicationUser function() { return new ApplicationUser(this.getClass()); }
/** * A Factory Method for creating a new <code>ApplicationUser</code>. Provide ability for subclasses to override this if a custom user class is required. The * custom user class must extend <code>ApplicationUser</code>. * * @return ApplicationUser (or a subtype) */
A Factory Method for creating a new <code>ApplicationUser</code>. Provide ability for subclasses to override this if a custom user class is required. The custom user class must extend <code>ApplicationUser</code>
createNewApplicationUser
{ "repo_name": "FINRAOS/herd", "path": "herd-code/herd-app/src/main/java/org/finra/herd/app/security/HttpHeaderApplicationUserBuilder.java", "license": "apache-2.0", "size": 20619 }
[ "org.finra.herd.model.dto.ApplicationUser" ]
import org.finra.herd.model.dto.ApplicationUser;
import org.finra.herd.model.dto.*;
[ "org.finra.herd" ]
org.finra.herd;
1,643,151
public void doReturn_preview_grade_submission(RunData data) { if (!"POST".equals(data.getRequest().getMethod())) { return; } grade_submission_option(data, "return"); } // doReturn_grade_preview_submission
void function(RunData data) { if (!"POST".equals(data.getRequest().getMethod())) { return; } grade_submission_option(data, STR); }
/** * Action is to return submission with or without grade from preview */
Action is to return submission with or without grade from preview
doReturn_preview_grade_submission
{ "repo_name": "tl-its-umich-edu/sakai", "path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java", "license": "apache-2.0", "size": 671846 }
[ "org.sakaiproject.cheftool.RunData" ]
import org.sakaiproject.cheftool.RunData;
import org.sakaiproject.cheftool.*;
[ "org.sakaiproject.cheftool" ]
org.sakaiproject.cheftool;
909,019
public void login(AuthnRequestParams authnRequestParams) throws IOException, SettingsException { login(null, authnRequestParams); }
void function(AuthnRequestParams authnRequestParams) throws IOException, SettingsException { login(null, authnRequestParams); }
/** * Initiates the SSO process. * * @param authnRequestParams * the authentication request input parameters * * @throws IOException * @throws SettingsException */
Initiates the SSO process
login
{ "repo_name": "onelogin/java-saml", "path": "toolkit/src/main/java/com/onelogin/saml2/Auth.java", "license": "mit", "size": 63952 }
[ "com.onelogin.saml2.authn.AuthnRequestParams", "com.onelogin.saml2.exception.SettingsException", "java.io.IOException" ]
import com.onelogin.saml2.authn.AuthnRequestParams; import com.onelogin.saml2.exception.SettingsException; import java.io.IOException;
import com.onelogin.saml2.authn.*; import com.onelogin.saml2.exception.*; import java.io.*;
[ "com.onelogin.saml2", "java.io" ]
com.onelogin.saml2; java.io;
1,944,341
public void pull(float delta) { if (!isEnabled()) return; if (!mIsBeingDragged) return; delta *= DRAG_RATE; float max_delta = mTotalDragDistance / MIN_PULLS_TO_ACTIVATE; delta = Math.max(-max_delta, Math.min(max_delta, delta)); mTotalMotionY += delta; // See ACTION_MOVE handling in {@link #onTouchEvent(...)}. final float overscrollTop = mTotalMotionY; mProgress.showArrow(true); float originalDragPercent = overscrollTop / mTotalDragDistance; if (originalDragPercent < 0) return; float dragPercent = Math.min(1f, Math.abs(originalDragPercent)); float adjustedPercent = (float) Math.max(dragPercent - .4, 0) * 5 / 3; float extraOS = Math.abs(overscrollTop) - mTotalDragDistance; float slingshotDist = mUsingCustomStart ? mSpinnerFinalOffset - mOriginalOffsetTop : mSpinnerFinalOffset; float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2) / slingshotDist); float tensionPercent = (float) ((tensionSlingshotPercent / 4) - Math.pow( (tensionSlingshotPercent / 4), 2)) * 2f; float extraMove = (slingshotDist) * tensionPercent * 2; int targetY = mOriginalOffsetTop + (int) ((slingshotDist * dragPercent) + extraMove); // where 1.0f is a full circle if (mCircleView.getVisibility() != View.VISIBLE) { mCircleView.setVisibility(View.VISIBLE); } if (!mScale) { mCircleView.setScaleX(1f); mCircleView.setScaleY(1f); } if (overscrollTop < mTotalDragDistance) { if (mScale) { setAnimationProgress(overscrollTop / mTotalDragDistance); } } float strokeStart = (float) (adjustedPercent * .8f); mProgress.setStartEndTrim(0f, Math.min(MAX_PROGRESS_ANGLE, strokeStart)); mProgress.setArrowScale(Math.min(1f, adjustedPercent)); float alphaStrength = Math.max(0f, Math.min(1f, (dragPercent - .9f) / .1f)); int alpha = STARTING_PROGRESS_ALPHA; alpha += (int) (alphaStrength * (MAX_ALPHA - STARTING_PROGRESS_ALPHA)); mProgress.setAlpha(alpha); float rotation = (-0.25f + .4f * adjustedPercent + tensionPercent * 2) * .5f; mProgress.setProgressRotation(rotation); setTargetOffsetTopAndBottom(targetY - mCurrentTargetOffsetTop, true ); }
void function(float delta) { if (!isEnabled()) return; if (!mIsBeingDragged) return; delta *= DRAG_RATE; float max_delta = mTotalDragDistance / MIN_PULLS_TO_ACTIVATE; delta = Math.max(-max_delta, Math.min(max_delta, delta)); mTotalMotionY += delta; final float overscrollTop = mTotalMotionY; mProgress.showArrow(true); float originalDragPercent = overscrollTop / mTotalDragDistance; if (originalDragPercent < 0) return; float dragPercent = Math.min(1f, Math.abs(originalDragPercent)); float adjustedPercent = (float) Math.max(dragPercent - .4, 0) * 5 / 3; float extraOS = Math.abs(overscrollTop) - mTotalDragDistance; float slingshotDist = mUsingCustomStart ? mSpinnerFinalOffset - mOriginalOffsetTop : mSpinnerFinalOffset; float tensionSlingshotPercent = Math.max(0, Math.min(extraOS, slingshotDist * 2) / slingshotDist); float tensionPercent = (float) ((tensionSlingshotPercent / 4) - Math.pow( (tensionSlingshotPercent / 4), 2)) * 2f; float extraMove = (slingshotDist) * tensionPercent * 2; int targetY = mOriginalOffsetTop + (int) ((slingshotDist * dragPercent) + extraMove); if (mCircleView.getVisibility() != View.VISIBLE) { mCircleView.setVisibility(View.VISIBLE); } if (!mScale) { mCircleView.setScaleX(1f); mCircleView.setScaleY(1f); } if (overscrollTop < mTotalDragDistance) { if (mScale) { setAnimationProgress(overscrollTop / mTotalDragDistance); } } float strokeStart = (float) (adjustedPercent * .8f); mProgress.setStartEndTrim(0f, Math.min(MAX_PROGRESS_ANGLE, strokeStart)); mProgress.setArrowScale(Math.min(1f, adjustedPercent)); float alphaStrength = Math.max(0f, Math.min(1f, (dragPercent - .9f) / .1f)); int alpha = STARTING_PROGRESS_ALPHA; alpha += (int) (alphaStrength * (MAX_ALPHA - STARTING_PROGRESS_ALPHA)); mProgress.setAlpha(alpha); float rotation = (-0.25f + .4f * adjustedPercent + tensionPercent * 2) * .5f; mProgress.setProgressRotation(rotation); setTargetOffsetTopAndBottom(targetY - mCurrentTargetOffsetTop, true ); }
/** * Apply a pull impulse to the effect. If the effect is disabled or has yet * to start, the pull will be ignored. * @param delta the magnitude of the pull. */
Apply a pull impulse to the effect. If the effect is disabled or has yet to start, the pull will be ignored
pull
{ "repo_name": "ltilve/chromium", "path": "third_party/android_swipe_refresh/java/src/org/chromium/third_party/android/swiperefresh/SwipeRefreshLayout.java", "license": "bsd-3-clause", "size": 29822 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,179,905
public void reqOfflineData(int sectionId, int ownerId, int noteId, boolean deleteOnFinished, int[] pageIds) throws ProtocolNotSupportedException, OutOfRangeException;
void function(int sectionId, int ownerId, int noteId, boolean deleteOnFinished, int[] pageIds) throws ProtocolNotSupportedException, OutOfRangeException;
/** * The pen is stored in an offline transfer of data requested. * supported from Protocol 2.0 * * @param sectionId the section id * @param ownerId the owner id * @param noteId the note id * @param deleteOnFinished delete offline data when transmission is finished * @param pageIds the page ids * @throws ProtocolNotSupportedException the protocol not supported exception */
The pen is stored in an offline transfer of data requested. supported from Protocol 2.0
reqOfflineData
{ "repo_name": "NeoSmartpen/AndroidSDK2.0", "path": "NASDK2.0_Studio/app/src/main/java/kr/neolab/sdk/pen/IPenAdt.java", "license": "gpl-3.0", "size": 22799 }
[ "kr.neolab.sdk.pen.bluetooth.lib.OutOfRangeException", "kr.neolab.sdk.pen.bluetooth.lib.ProtocolNotSupportedException" ]
import kr.neolab.sdk.pen.bluetooth.lib.OutOfRangeException; import kr.neolab.sdk.pen.bluetooth.lib.ProtocolNotSupportedException;
import kr.neolab.sdk.pen.bluetooth.lib.*;
[ "kr.neolab.sdk" ]
kr.neolab.sdk;
2,681,613