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
void addHighlightRule( IHighlightRule rule ) throws SemanticException;
void addHighlightRule( IHighlightRule rule ) throws SemanticException;
/** * Adds high light rule. * * @param rule * @throws SemanticException */
Adds high light rule
addHighlightRule
{ "repo_name": "sguan-actuate/birt", "path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IReportItem.java", "license": "epl-1.0", "size": 8125 }
[ "org.eclipse.birt.report.model.api.activity.SemanticException" ]
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.activity.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
2,649,578
NetworkState getNetworkState(WifiManagerDelegate wifiManagerDelegate) { Network network = null; NetworkInfo networkInfo; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { network = getDefaultNetwork(); networkInfo = getNetworkInfo(network); } else { networkInfo = mConnectivityManager.getActiveNetworkInfo(); } networkInfo = processActiveNetworkInfo(networkInfo); if (networkInfo == null) { return new NetworkState(false, -1, -1, null, false, ""); } if (network != null) { DnsStatus dnsStatus = AndroidNetworkLibrary.getDnsStatus(network); if (dnsStatus == null) { return new NetworkState(true, networkInfo.getType(), networkInfo.getSubtype(), String.valueOf(networkToNetId(network)), false, ""); } else { return new NetworkState(true, networkInfo.getType(), networkInfo.getSubtype(), String.valueOf(networkToNetId(network)), dnsStatus.getPrivateDnsActive(), dnsStatus.getPrivateDnsServerName()); } } assert Build.VERSION.SDK_INT < Build.VERSION_CODES.M; // If Wifi, then fetch SSID also if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) { // Since Android 4.2 the SSID can be retrieved from NetworkInfo.getExtraInfo(). if (networkInfo.getExtraInfo() != null && !"".equals(networkInfo.getExtraInfo())) { return new NetworkState(true, networkInfo.getType(), networkInfo.getSubtype(), networkInfo.getExtraInfo(), false, ""); } // Fetch WiFi SSID directly from WifiManagerDelegate if not in NetworkInfo. return new NetworkState(true, networkInfo.getType(), networkInfo.getSubtype(), wifiManagerDelegate.getWifiSsid(), false, ""); } return new NetworkState( true, networkInfo.getType(), networkInfo.getSubtype(), null, false, ""); }
NetworkState getNetworkState(WifiManagerDelegate wifiManagerDelegate) { Network network = null; NetworkInfo networkInfo; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { network = getDefaultNetwork(); networkInfo = getNetworkInfo(network); } else { networkInfo = mConnectivityManager.getActiveNetworkInfo(); } networkInfo = processActiveNetworkInfo(networkInfo); if (networkInfo == null) { return new NetworkState(false, -1, -1, null, false, STRSTRSTRSTRSTR"); }
/** * Returns connection type and status information about the current * default network. */
Returns connection type and status information about the current default network
getNetworkState
{ "repo_name": "scheib/chromium", "path": "net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java", "license": "bsd-3-clause", "size": 60035 }
[ "android.net.Network", "android.net.NetworkInfo", "android.os.Build" ]
import android.net.Network; import android.net.NetworkInfo; import android.os.Build;
import android.net.*; import android.os.*;
[ "android.net", "android.os" ]
android.net; android.os;
269,660
public HanaProvisioningStatesEnum provisioningState() { return this.provisioningState; }
HanaProvisioningStatesEnum function() { return this.provisioningState; }
/** * Get state of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating'. * * @return the provisioningState value */
Get state of provisioning of the HanaInstance. Possible values include: 'Accepted', 'Creating', 'Updating', 'Failed', 'Succeeded', 'Deleting', 'Migrating'
provisioningState
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/hanaonazure/mgmt-v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstanceInner.java", "license": "mit", "size": 7427 }
[ "com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaProvisioningStatesEnum" ]
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaProvisioningStatesEnum;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,596,034
default DoubleSummaryStatistics summarizeFloat(FloatFunction<? super T> function) { DoubleSummaryStatistics stats = new DoubleSummaryStatistics(); this.each(each -> stats.accept(function.floatValueOf(each))); return stats; }
default DoubleSummaryStatistics summarizeFloat(FloatFunction<? super T> function) { DoubleSummaryStatistics stats = new DoubleSummaryStatistics(); this.each(each -> stats.accept(function.floatValueOf(each))); return stats; }
/** * Returns the result of summarizing the value returned from applying the FloatFunction to * each element of the iterable. * <p> * <pre> * DoubleSummaryStatistics stats = * Lists.mutable.with(1, 2, 3).summarizeFloat(Integer::floatValue); * </pre> * * @since 8.0 */
Returns the result of summarizing the value returned from applying the FloatFunction to each element of the iterable. <code> DoubleSummaryStatistics stats = Lists.mutable.with(1, 2, 3).summarizeFloat(Integer::floatValue); </code>
summarizeFloat
{ "repo_name": "bhav0904/eclipse-collections", "path": "eclipse-collections-api/src/main/java/org/eclipse/collections/api/RichIterable.java", "license": "bsd-3-clause", "size": 82747 }
[ "java.util.DoubleSummaryStatistics", "org.eclipse.collections.api.block.function.primitive.FloatFunction" ]
import java.util.DoubleSummaryStatistics; import org.eclipse.collections.api.block.function.primitive.FloatFunction;
import java.util.*; import org.eclipse.collections.api.block.function.primitive.*;
[ "java.util", "org.eclipse.collections" ]
java.util; org.eclipse.collections;
156,176
public static ThreadPoolExecutor defaultPool(String memberName, int procThreads, long keepAliveMillis) { return new ThreadPoolExecutor(1, procThreads, keepAliveMillis, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory("member: '" + memberName + "' subprocedure-pool")); }
static ThreadPoolExecutor function(String memberName, int procThreads, long keepAliveMillis) { return new ThreadPoolExecutor(1, procThreads, keepAliveMillis, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory(STR + memberName + STR)); }
/** * Default thread pool for the procedure * * @param memberName * @param procThreads the maximum number of threads to allow in the pool * @param keepAliveMillis the maximum time (ms) that excess idle threads will wait for new tasks */
Default thread pool for the procedure
defaultPool
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ProcedureMember.java", "license": "apache-2.0", "size": 9283 }
[ "java.util.concurrent.SynchronousQueue", "java.util.concurrent.ThreadPoolExecutor", "java.util.concurrent.TimeUnit", "org.apache.hadoop.hbase.DaemonThreadFactory" ]
import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.apache.hadoop.hbase.DaemonThreadFactory;
import java.util.concurrent.*; import org.apache.hadoop.hbase.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,182,089
public void setSeverity(@CheckForNull final String severity) { this.severity = severity; }
void function(@CheckForNull final String severity) { this.severity = severity; }
/** * Setter for severtiy-Field. * * @param severity setter */
Setter for severtiy-Field
setSeverity
{ "repo_name": "jenkinsci/analysis-model", "path": "src/main/java/edu/hm/hafner/analysis/parser/jcreport/Item.java", "license": "mit", "size": 3851 }
[ "edu.umd.cs.findbugs.annotations.CheckForNull" ]
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.*;
[ "edu.umd.cs" ]
edu.umd.cs;
1,695,856
public IBinder getWindowToken() { return mAttachInfo != null ? mAttachInfo.mWindowToken : null; }
IBinder function() { return mAttachInfo != null ? mAttachInfo.mWindowToken : null; }
/** * Retrieve a unique token identifying the window this view is attached to. * @return Return the window's token for use in * {@link WindowManager.LayoutParams#token WindowManager.LayoutParams.token}. */
Retrieve a unique token identifying the window this view is attached to
getWindowToken
{ "repo_name": "lynnlyc/for-honeynet-reviewers", "path": "CallbackDroid/android-environment/src/base/core/java/android/view/View.java", "license": "gpl-3.0", "size": 348539 }
[ "android.os.IBinder" ]
import android.os.IBinder;
import android.os.*;
[ "android.os" ]
android.os;
773,814
public void addCookie(Cookie cookie) { cookieSupport.addCookie(cookie); }
void function(Cookie cookie) { cookieSupport.addCookie(cookie); }
/** * Set cookie * @param cookie Cookie */
Set cookie
addCookie
{ "repo_name": "nleite/sling", "path": "testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/servlet/MockSlingHttpServletRequest.java", "license": "apache-2.0", "size": 24665 }
[ "javax.servlet.http.Cookie" ]
import javax.servlet.http.Cookie;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
829,684
private static void findFragmentsWithPartitionSender(Fragment currentRootFragment, PlanningSet planningSet, List<Integer> deMuxFragments, List<Integer> htrFragments) { if (currentRootFragment != null) { final Exchange sendingExchange = currentRootFragment.getSendingExchange(); if (sendingExchange != null) { final int majorFragmentId = planningSet.get(currentRootFragment).getMajorFragmentId(); if (sendingExchange instanceof UnorderedDeMuxExchange) { deMuxFragments.add(majorFragmentId); } else if (sendingExchange instanceof HashToRandomExchange) { htrFragments.add(majorFragmentId); } } for(ExchangeFragmentPair e : currentRootFragment.getReceivingExchangePairs()) { findFragmentsWithPartitionSender(e.getNode(), planningSet, deMuxFragments, htrFragments); } } }
static void function(Fragment currentRootFragment, PlanningSet planningSet, List<Integer> deMuxFragments, List<Integer> htrFragments) { if (currentRootFragment != null) { final Exchange sendingExchange = currentRootFragment.getSendingExchange(); if (sendingExchange != null) { final int majorFragmentId = planningSet.get(currentRootFragment).getMajorFragmentId(); if (sendingExchange instanceof UnorderedDeMuxExchange) { deMuxFragments.add(majorFragmentId); } else if (sendingExchange instanceof HashToRandomExchange) { htrFragments.add(majorFragmentId); } } for(ExchangeFragmentPair e : currentRootFragment.getReceivingExchangePairs()) { findFragmentsWithPartitionSender(e.getNode(), planningSet, deMuxFragments, htrFragments); } } }
/** * Helper method to find the major fragment ids of fragments that have PartitionSender. * A fragment can have PartitionSender if sending exchange of the current fragment is a * 1. DeMux Exchange -> goes in deMuxFragments * 2. HashToRandomExchange -> goes into htrFragments */
Helper method to find the major fragment ids of fragments that have PartitionSender. A fragment can have PartitionSender if sending exchange of the current fragment is a 1. DeMux Exchange -> goes in deMuxFragments 2. HashToRandomExchange -> goes into htrFragments
findFragmentsWithPartitionSender
{ "repo_name": "shakamunyi/drill", "path": "exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestLocalExchange.java", "license": "apache-2.0", "size": 21833 }
[ "java.util.List", "org.apache.drill.exec.physical.base.Exchange", "org.apache.drill.exec.physical.config.HashToRandomExchange", "org.apache.drill.exec.physical.config.UnorderedDeMuxExchange", "org.apache.drill.exec.planner.fragment.Fragment", "org.apache.drill.exec.planner.fragment.PlanningSet" ]
import java.util.List; import org.apache.drill.exec.physical.base.Exchange; import org.apache.drill.exec.physical.config.HashToRandomExchange; import org.apache.drill.exec.physical.config.UnorderedDeMuxExchange; import org.apache.drill.exec.planner.fragment.Fragment; import org.apache.drill.exec.planner.fragment.PlanningSet;
import java.util.*; import org.apache.drill.exec.physical.base.*; import org.apache.drill.exec.physical.config.*; import org.apache.drill.exec.planner.fragment.*;
[ "java.util", "org.apache.drill" ]
java.util; org.apache.drill;
2,330,566
Collection<InflightExchange> browse(String fromRouteId, int limit, boolean sortByLongestDuration);
Collection<InflightExchange> browse(String fromRouteId, int limit, boolean sortByLongestDuration);
/** * A <i>read-only</i> browser of the {@link InflightExchange}s that are currently inflight that started from the given route. * * @param fromRouteId the route id, or <tt>null</tt> for all routes. * @param limit maximum number of entries to return * @param sortByLongestDuration to sort by the longest duration. Set to <tt>true</tt> to include the exchanges that has been inflight the longest time, * set to <tt>false</tt> to sort by exchange id */
A read-only browser of the <code>InflightExchange</code>s that are currently inflight that started from the given route
browse
{ "repo_name": "jmandawg/camel", "path": "camel-core/src/main/java/org/apache/camel/spi/InflightRepository.java", "license": "apache-2.0", "size": 5711 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,858,178
public boolean check(Set<ContextParameter> ctxParamsFeature) { for (ContextParameter contextParameter : ctxParamsFeature) { // check type if (contextParameter.getType().getTypeId() == this.type.getTypeId() || (contextParameter.getType().getTypeId() == ContextParamType.DATETIME && this.type.getTypeId() == ContextParamType.SLIDING)) { // compare ComparisonOperator comparisonOperator = this.compOp; // FIXME: db4o <-> enums ... equals and == DON'T return true on // equally enums ... :-/ // switch (this.type) { if (this.type.getTypeId() == ContextParamType.TRUSTLEVEL) { // case TRUSTLEVEL:{ int desired = Integer.parseInt(this.value); int actual = Integer.parseInt(contextParameter.getValue()); logger.debug("Actual TL " + actual + " should be " + this.compOp + " than desired TL " + desired); switch (comparisonOperator) { case EQ: return desired == actual; case ST: return desired > actual; case GT: return desired < actual; case NE: return desired != actual; case SE: return desired >= actual; case GE: return desired <= actual; default: return false; } } else if (this.type.getTypeId() == ContextParamType.DATETIME) { // case DATETIME:{ Calendar actualDateTime = Helper .getXsdStringAsCalendar(contextParameter.getValue()); String[] timeString = this.value.split(":"); Calendar desiredDateTime = new GregorianCalendar( actualDateTime.get(GregorianCalendar.YEAR), actualDateTime.get(GregorianCalendar.MONTH), actualDateTime.get(GregorianCalendar.DATE), Integer.parseInt(timeString[0]), Integer.parseInt(timeString[1]), 0); // TODO // evil // and // dirty // hack desiredDateTime.setTimeZone(actualDateTime.getTimeZone()); logger.debug("Feature date/time: " + Helper.getCalendarAsXsdDateTime(actualDateTime)); logger.debug("Desired date/time: " + Helper.getCalendarAsXsdDateTime(desiredDateTime)); switch (comparisonOperator) { case EQ: return actualDateTime.compareTo(desiredDateTime) == 0; case GE: return actualDateTime.compareTo(desiredDateTime) >= 0; case GT: return actualDateTime.compareTo(desiredDateTime) > 0; case NE: return actualDateTime.compareTo(desiredDateTime) != 0; case SE: return actualDateTime.compareTo(desiredDateTime) <= 0; case ST: return actualDateTime.compareTo(desiredDateTime) < 0; default: return false; } } else if (this.type.getTypeId() == ContextParamType.SLIDING) { // case SLIDING:{ Calendar featureDateTime = Helper .getXsdStringAsCalendar(contextParameter.getValue()); String[] timeString = this.value.split(":"); if (timeString.length != 3) { logger.error("Wrong time format for sliding context!"); return false; } long delta = Long.parseLong(timeString[0]) * 3600 * 1000 + Long.parseLong(timeString[1]) * 60 * 1000 + Long.parseLong(timeString[2]) * 1000; long current = System.currentTimeMillis(); long featureTime = featureDateTime.getTimeInMillis(); logger.debug("Feature date/time: " + Helper.getCalendarAsXsdDateTime(featureDateTime)); logger.debug("Sliding intervall (secs): " + delta / 1000.f + "current time: " + (new Date(current)).toString()); switch (comparisonOperator) { case EQ: return featureTime >= (current - delta); case NE: return featureTime < (current - delta); default: return false; } } else { // case LOCATION: // case OTHERDEVICES: // default: return super.evaluateCompOpOnString(this.compOp, contextParameter.getValue(), this.value); } } } return false; }
boolean function(Set<ContextParameter> ctxParamsFeature) { for (ContextParameter contextParameter : ctxParamsFeature) { if (contextParameter.getType().getTypeId() == this.type.getTypeId() (contextParameter.getType().getTypeId() == ContextParamType.DATETIME && this.type.getTypeId() == ContextParamType.SLIDING)) { ComparisonOperator comparisonOperator = this.compOp; if (this.type.getTypeId() == ContextParamType.TRUSTLEVEL) { int desired = Integer.parseInt(this.value); int actual = Integer.parseInt(contextParameter.getValue()); logger.debug(STR + actual + STR + this.compOp + STR + desired); switch (comparisonOperator) { case EQ: return desired == actual; case ST: return desired > actual; case GT: return desired < actual; case NE: return desired != actual; case SE: return desired >= actual; case GE: return desired <= actual; default: return false; } } else if (this.type.getTypeId() == ContextParamType.DATETIME) { Calendar actualDateTime = Helper .getXsdStringAsCalendar(contextParameter.getValue()); String[] timeString = this.value.split(":"); Calendar desiredDateTime = new GregorianCalendar( actualDateTime.get(GregorianCalendar.YEAR), actualDateTime.get(GregorianCalendar.MONTH), actualDateTime.get(GregorianCalendar.DATE), Integer.parseInt(timeString[0]), Integer.parseInt(timeString[1]), 0); desiredDateTime.setTimeZone(actualDateTime.getTimeZone()); logger.debug(STR + Helper.getCalendarAsXsdDateTime(actualDateTime)); logger.debug(STR + Helper.getCalendarAsXsdDateTime(desiredDateTime)); switch (comparisonOperator) { case EQ: return actualDateTime.compareTo(desiredDateTime) == 0; case GE: return actualDateTime.compareTo(desiredDateTime) >= 0; case GT: return actualDateTime.compareTo(desiredDateTime) > 0; case NE: return actualDateTime.compareTo(desiredDateTime) != 0; case SE: return actualDateTime.compareTo(desiredDateTime) <= 0; case ST: return actualDateTime.compareTo(desiredDateTime) < 0; default: return false; } } else if (this.type.getTypeId() == ContextParamType.SLIDING) { Calendar featureDateTime = Helper .getXsdStringAsCalendar(contextParameter.getValue()); String[] timeString = this.value.split(":"); if (timeString.length != 3) { logger.error(STR); return false; } long delta = Long.parseLong(timeString[0]) * 3600 * 1000 + Long.parseLong(timeString[1]) * 60 * 1000 + Long.parseLong(timeString[2]) * 1000; long current = System.currentTimeMillis(); long featureTime = featureDateTime.getTimeInMillis(); logger.debug(STR + Helper.getCalendarAsXsdDateTime(featureDateTime)); logger.debug(STR + delta / 1000.f + STR + (new Date(current)).toString()); switch (comparisonOperator) { case EQ: return featureTime >= (current - delta); case NE: return featureTime < (current - delta); default: return false; } } else { return super.evaluateCompOpOnString(this.compOp, contextParameter.getValue(), this.value); } } } return false; }
/** * If types do not match, false is returned. * * @param ctxParamsFeature * @return */
If types do not match, false is returned
check
{ "repo_name": "trustathsh/irondetect", "path": "src/main/java/de/hshannover/f4/trust/irondetect/model/ContextParameterPol.java", "license": "apache-2.0", "size": 8988 }
[ "de.hshannover.f4.trust.irondetect.util.ComparisonOperator", "de.hshannover.f4.trust.irondetect.util.Helper", "java.util.Calendar", "java.util.Date", "java.util.GregorianCalendar", "java.util.Set" ]
import de.hshannover.f4.trust.irondetect.util.ComparisonOperator; import de.hshannover.f4.trust.irondetect.util.Helper; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.Set;
import de.hshannover.f4.trust.irondetect.util.*; import java.util.*;
[ "de.hshannover.f4", "java.util" ]
de.hshannover.f4; java.util;
1,999,508
private void processRegularGroup(LOCogroup loCogroup) throws FrontendException { final List<RelBuilder.GroupKey> groupKeys = new ArrayList<>(); final int numRels = loCogroup.getExpressionPlans().size(); // Project out the group keys and the whole row, which will be aggregated with // COLLECT operator later. preprocessCogroup(loCogroup, false); // Build the group key for (Integer key : loCogroup.getExpressionPlans().keySet()) { final int groupCount = loCogroup.getExpressionPlans().get(key).size(); final List<RexNode> relKeys = new ArrayList<>(); for (int i = 0; i < groupCount; i++) { relKeys.add(builder.field(numRels - key, 0, i)); } groupKeys.add(builder.groupKey(relKeys)); } // The do COLLECT aggregate. builder.cogroup(groupKeys); }
void function(LOCogroup loCogroup) throws FrontendException { final List<RelBuilder.GroupKey> groupKeys = new ArrayList<>(); final int numRels = loCogroup.getExpressionPlans().size(); preprocessCogroup(loCogroup, false); for (Integer key : loCogroup.getExpressionPlans().keySet()) { final int groupCount = loCogroup.getExpressionPlans().get(key).size(); final List<RexNode> relKeys = new ArrayList<>(); for (int i = 0; i < groupCount; i++) { relKeys.add(builder.field(numRels - key, 0, i)); } groupKeys.add(builder.groupKey(relKeys)); } builder.cogroup(groupKeys); }
/** * Processes regular a group/group. * * @param loCogroup Pig logical group operator * @throws FrontendException Exception during processing Pig operators */
Processes regular a group/group
processRegularGroup
{ "repo_name": "googleinterns/calcite", "path": "piglet/src/main/java/org/apache/calcite/piglet/PigRelOpVisitor.java", "license": "apache-2.0", "size": 28613 }
[ "java.util.ArrayList", "java.util.List", "org.apache.calcite.rex.RexNode", "org.apache.calcite.tools.RelBuilder", "org.apache.pig.impl.logicalLayer.FrontendException", "org.apache.pig.newplan.logical.relational.LOCogroup" ]
import java.util.ArrayList; import java.util.List; import org.apache.calcite.rex.RexNode; import org.apache.calcite.tools.RelBuilder; import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.newplan.logical.relational.LOCogroup;
import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.tools.*; import org.apache.pig.impl.*; import org.apache.pig.newplan.logical.relational.*;
[ "java.util", "org.apache.calcite", "org.apache.pig" ]
java.util; org.apache.calcite; org.apache.pig;
2,598,711
public void setUp(int fragmentId, DrawerLayout drawerLayout) { m_FragmentContainerView = getActivity().findViewById(fragmentId); m_DrawerLayout = drawerLayout; // set a custom shadow that overlays the main content when the drawer // opens m_DrawerLayout.setDrawerShadow(com.brazedblue.pushme.R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true);
void function(int fragmentId, DrawerLayout drawerLayout) { m_FragmentContainerView = getActivity().findViewById(fragmentId); m_DrawerLayout = drawerLayout; m_DrawerLayout.setDrawerShadow(com.brazedblue.pushme.R.drawable.drawer_shadow, GravityCompat.START); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true);
/** * Users of this fragment must call this method to set up the navigation * drawer interactions. * * @param fragmentId * The android:id of this fragment in its activity's layout. * @param drawerLayout * The DrawerLayout containing this fragment's UI. */
Users of this fragment must call this method to set up the navigation drawer interactions
setUp
{ "repo_name": "stevenmeyer142/PushMeAndroid", "path": "app/src/main/java/com/brazedblue/pushme/NavigationDrawerFragment.java", "license": "apache-2.0", "size": 9449 }
[ "android.app.ActionBar", "android.support.v4.view.GravityCompat", "android.support.v4.widget.DrawerLayout" ]
import android.app.ActionBar; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout;
import android.app.*; import android.support.v4.view.*; import android.support.v4.widget.*;
[ "android.app", "android.support" ]
android.app; android.support;
2,791,468
public Observable<ServiceResponse<Void>> deleteSecretWithServiceResponseAsync(String accountName, String databaseName, String secretName) { if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.adlaCatalogDnsSuffix() == null) { throw new IllegalArgumentException("Parameter this.client.adlaCatalogDnsSuffix() is required and cannot be null."); } if (databaseName == null) { throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); } if (secretName == null) { throw new IllegalArgumentException("Parameter secretName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(String accountName, String databaseName, String secretName) { if (accountName == null) { throw new IllegalArgumentException(STR); } if (this.client.adlaCatalogDnsSuffix() == null) { throw new IllegalArgumentException(STR); } if (databaseName == null) { throw new IllegalArgumentException(STR); } if (secretName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Deletes the specified secret in the specified database. This is deprecated and will be removed in the next release. Please use DeleteCredential instead. * * @param accountName The Azure Data Lake Analytics account upon which to execute catalog operations. * @param databaseName The name of the database containing the secret. * @param secretName The name of the secret to delete * @return the {@link ServiceResponse} object if successful. */
Deletes the specified secret in the specified database. This is deprecated and will be removed in the next release. Please use DeleteCredential instead
deleteSecretWithServiceResponseAsync
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-datalake-analytics/src/main/java/com/microsoft/azure/management/datalake/analytics/implementation/CatalogsImpl.java", "license": "mit", "size": 474209 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,914,510
public static org.opennms.netmgt.config.httpdatacollection.Parameters unmarshal( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.opennms.netmgt.config.httpdatacollection.Parameters) Unmarshaller.unmarshal(org.opennms.netmgt.config.httpdatacollection.Parameters.class, reader); }
static org.opennms.netmgt.config.httpdatacollection.Parameters function( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.opennms.netmgt.config.httpdatacollection.Parameters) Unmarshaller.unmarshal(org.opennms.netmgt.config.httpdatacollection.Parameters.class, reader); }
/** * Method unmarshal. * * @param reader * @throws org.exolab.castor.xml.MarshalException if object is * null or if any SAXException is thrown during marshaling * @throws org.exolab.castor.xml.ValidationException if this * object is an invalid instance according to the schema * @return the unmarshaled * org.opennms.netmgt.config.httpdatacollection.Parameters */
Method unmarshal
unmarshal
{ "repo_name": "vishwaAbhinav/OpenNMS", "path": "opennms-config/target/generated-sources/castor/org/opennms/netmgt/config/httpdatacollection/Parameters.java", "license": "gpl-2.0", "size": 11538 }
[ "org.exolab.castor.xml.Unmarshaller" ]
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.*;
[ "org.exolab.castor" ]
org.exolab.castor;
1,582,923
protected static File[] listFiles(File dir, FilenameFilter filter) { File[] rawList = dir.listFiles(); List<File> ret = new ArrayList<>(); if (rawList != null) { for (File f : rawList) { if (f.isDirectory()) { ret.add(f); } else { if (filter.accept(dir, f.getName())) { ret.add(f); } } } } return ret.toArray(new File[0]); }
static File[] function(File dir, FilenameFilter filter) { File[] rawList = dir.listFiles(); List<File> ret = new ArrayList<>(); if (rawList != null) { for (File f : rawList) { if (f.isDirectory()) { ret.add(f); } else { if (filter.accept(dir, f.getName())) { ret.add(f); } } } } return ret.toArray(new File[0]); }
/** * Same as normal listFiles, but use the filter only for normal files * * @param dir directory to list files in * @param filter A FilenameFilter which decides which files in dir are listed * @return an array of Files */
Same as normal listFiles, but use the filter only for normal files
listFiles
{ "repo_name": "vespa-engine/vespa", "path": "configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java", "license": "apache-2.0", "size": 9144 }
[ "java.io.File", "java.io.FilenameFilter", "java.util.ArrayList", "java.util.List" ]
import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,276,339
@Test public void testEvaluateValid() throws MetaborgException { when(result.valid()).thenReturn(true); IResult execute = command.execute("test"); verify(contextService, times(1)).get(any(), any(), any()); check.apply(verify(resultFactory, times(1))); verify(result, never()).accept(visitor); execute.accept(visitor); verify(result, times(1)).accept(visitor); }
void function() throws MetaborgException { when(result.valid()).thenReturn(true); IResult execute = command.execute("test"); verify(contextService, times(1)).get(any(), any(), any()); check.apply(verify(resultFactory, times(1))); verify(result, never()).accept(visitor); execute.accept(visitor); verify(result, times(1)).accept(visitor); }
/** * Test creating a valid {@link EvaluateResult}. * * @throws MetaborgException * on unexpected Spoofax exceptions */
Test creating a valid <code>EvaluateResult</code>
testEvaluateValid
{ "repo_name": "spoofax-shell-2017/spoofax-shell", "path": "org.metaborg.spoofax.shell.core/src/test/java/org/metaborg/spoofax/shell/functions/EvaluateFunctionTest.java", "license": "apache-2.0", "size": 13550 }
[ "org.metaborg.core.MetaborgException", "org.metaborg.spoofax.shell.output.IResult", "org.mockito.Matchers", "org.mockito.Mockito" ]
import org.metaborg.core.MetaborgException; import org.metaborg.spoofax.shell.output.IResult; import org.mockito.Matchers; import org.mockito.Mockito;
import org.metaborg.core.*; import org.metaborg.spoofax.shell.output.*; import org.mockito.*;
[ "org.metaborg.core", "org.metaborg.spoofax", "org.mockito" ]
org.metaborg.core; org.metaborg.spoofax; org.mockito;
195,533
protected void rollbackTxn() throws Exception { try { _tx.rollback(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Rolled back transaction"); } } catch (Exception e) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Failed to roll back transaction: exception="+e); } throw e; } }
void function() throws Exception { try { _tx.rollback(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR); } } catch (Exception e) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+e); } throw e; } }
/** * This method rolls back the transaction. * * @throws Exception Failed to rollback */
This method rolls back the transaction
rollbackTxn
{ "repo_name": "jorgemoralespou/rtgov", "path": "modules/activity-analysis/call-trace/src/main/java/org/overlord/rtgov/call/trace/CallTraceServiceImpl.java", "license": "apache-2.0", "size": 42566 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,307,870
@Generated @CVariable() @MappedReturn(ObjCStringMapper.class) public static native String NSMetadataUbiquitousSharedItemOwnerNameComponentsKey();
@CVariable() @MappedReturn(ObjCStringMapper.class) static native String function();
/** * returns a NSPersonNameComponents, or nil if the current user. (value type NSPersonNameComponents) */
returns a NSPersonNameComponents, or nil if the current user. (value type NSPersonNameComponents)
NSMetadataUbiquitousSharedItemOwnerNameComponentsKey
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/foundation/c/Foundation.java", "license": "apache-2.0", "size": 156135 }
[ "org.moe.natj.c.ann.CVariable", "org.moe.natj.general.ann.MappedReturn", "org.moe.natj.objc.map.ObjCStringMapper" ]
import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper;
import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*;
[ "org.moe.natj" ]
org.moe.natj;
2,658,171
public EntityIdentifier[] searchForGroups(String query, int method, Class leaftype, IEntityGroup ancestor) throws GroupsException;
EntityIdentifier[] function(String query, int method, Class leaftype, IEntityGroup ancestor) throws GroupsException;
/** * Find EntityIdentifiers for groups whose name matches the query string * according to the specified method, has the provided leaf type and * descends from the specified group */
Find EntityIdentifiers for groups whose name matches the query string according to the specified method, has the provided leaf type and descends from the specified group
searchForGroups
{ "repo_name": "vbonamy/esup-uportal", "path": "uportal-war/src/main/java/org/jasig/portal/groups/IGroupService.java", "license": "apache-2.0", "size": 4961 }
[ "org.jasig.portal.EntityIdentifier" ]
import org.jasig.portal.EntityIdentifier;
import org.jasig.portal.*;
[ "org.jasig.portal" ]
org.jasig.portal;
78,091
public String getLibFolder() { return getWebAppRfsPath() + CmsSystemInfo.FOLDER_WEBINF + FOLDER_LIB; }
String function() { return getWebAppRfsPath() + CmsSystemInfo.FOLDER_WEBINF + FOLDER_LIB; }
/** * Returns the path to the /WEB-INF/lib folder.<p> * * @return the path to the /WEB-INF/lib folder */
Returns the path to the /WEB-INF/lib folder
getLibFolder
{ "repo_name": "mediaworx/opencms-core", "path": "src-setup/org/opencms/setup/CmsSetupBean.java", "license": "lgpl-2.1", "size": 115587 }
[ "org.opencms.main.CmsSystemInfo" ]
import org.opencms.main.CmsSystemInfo;
import org.opencms.main.*;
[ "org.opencms.main" ]
org.opencms.main;
1,027,412
public static int deleteImageDB(int key) { String deleteImageQuery, deleteAsociationQuery; int result = -1; try { Statement stmt = conn.createStatement(); deleteAsociationQuery = "DELETE FROM Asociated WHERE image = \"" + key + "\""; deleteImageQuery = "DELETE FROM Image WHERE id = \"" + key + "\""; stmt.executeUpdate(deleteAsociationQuery); result = stmt.executeUpdate(deleteImageQuery); stmt.close(); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); } return result; }
static int function(int key) { String deleteImageQuery, deleteAsociationQuery; int result = -1; try { Statement stmt = conn.createStatement(); deleteAsociationQuery = STRSTR\STRDELETE FROM Image WHERE id = \"STR\""; stmt.executeUpdate(deleteAsociationQuery); result = stmt.executeUpdate(deleteImageQuery); stmt.close(); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println(e.toString()); } return result; }
/** * Delete image database. * * @param key the key * * @return the int */
Delete image database
deleteImageDB
{ "repo_name": "hendyyou/FST", "path": "src/tico/imageGallery/dataBase/TIGDataBase.java", "license": "gpl-3.0", "size": 24328 }
[ "java.sql.Statement" ]
import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
370,091
public static void clearImageCacheForMediaEntity(MediaEntity entity) { List<MediaFile> mediaFiles = new ArrayList<MediaFile>(entity.getMediaFiles()); for (MediaFile mediaFile : mediaFiles) { if (mediaFile.isGraphic()) { File file = ImageCache.getCachedFile(mediaFile.getFile().getPath()); if (file.exists()) { FileUtils.deleteQuietly(file); } } } }
static void function(MediaEntity entity) { List<MediaFile> mediaFiles = new ArrayList<MediaFile>(entity.getMediaFiles()); for (MediaFile mediaFile : mediaFiles) { if (mediaFile.isGraphic()) { File file = ImageCache.getCachedFile(mediaFile.getFile().getPath()); if (file.exists()) { FileUtils.deleteQuietly(file); } } } }
/** * clear the image cache for all graphics within the given media entity * * @param entity * the media entity */
clear the image cache for all graphics within the given media entity
clearImageCacheForMediaEntity
{ "repo_name": "mlaggner/tinyMediaManager", "path": "src/org/tinymediamanager/core/ImageCache.java", "license": "apache-2.0", "size": 12990 }
[ "java.io.File", "java.util.ArrayList", "java.util.List", "org.apache.commons.io.FileUtils", "org.tinymediamanager.core.entities.MediaEntity", "org.tinymediamanager.core.entities.MediaFile" ]
import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils; import org.tinymediamanager.core.entities.MediaEntity; import org.tinymediamanager.core.entities.MediaFile;
import java.io.*; import java.util.*; import org.apache.commons.io.*; import org.tinymediamanager.core.entities.*;
[ "java.io", "java.util", "org.apache.commons", "org.tinymediamanager.core" ]
java.io; java.util; org.apache.commons; org.tinymediamanager.core;
136,151
public int getUserLimit() { return Objects.requireNonNull(getData().getUserLimit()); }
int function() { return Objects.requireNonNull(getData().getUserLimit()); }
/** * Gets the user limit of this voice channel. * * @return The user limit of this voice channel. */
Gets the user limit of this voice channel
getUserLimit
{ "repo_name": "austinv11/Discord4J", "path": "core/src/main/java/discord4j/core/object/entity/channel/VoiceChannel.java", "license": "lgpl-3.0", "size": 5105 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,468,520
private void copyFile(FileEntry source, OutputStream os, byte buffer[]) throws IOException { InputStream is = null; try { long startPtr = os.getFilePointer(); is = directory.openFile(source.file); long length = is.length(); long remainder = length; int chunk = buffer.length; while(remainder > 0) { int len = (int) Math.min(chunk, remainder); is.readBytes(buffer, 0, len); os.writeBytes(buffer, len); remainder -= len; } // Verify that remainder is 0 if (remainder != 0) throw new IOException( "Non-zero remainder length after copying: " + remainder + " (id: " + source.file + ", length: " + length + ", buffer size: " + chunk + ")"); // Verify that the output length diff is equal to original file long endPtr = os.getFilePointer(); long diff = endPtr - startPtr; if (diff != length) throw new IOException( "Difference in the output file offsets " + diff + " does not match the original file length " + length); } finally { if (is != null) is.close(); } }
void function(FileEntry source, OutputStream os, byte buffer[]) throws IOException { InputStream is = null; try { long startPtr = os.getFilePointer(); is = directory.openFile(source.file); long length = is.length(); long remainder = length; int chunk = buffer.length; while(remainder > 0) { int len = (int) Math.min(chunk, remainder); is.readBytes(buffer, 0, len); os.writeBytes(buffer, len); remainder -= len; } if (remainder != 0) throw new IOException( STR + remainder + STR + source.file + STR + length + STR + chunk + ")"); long endPtr = os.getFilePointer(); long diff = endPtr - startPtr; if (diff != length) throw new IOException( STR + diff + STR + length); } finally { if (is != null) is.close(); } }
/** Copy the contents of the file with specified extension into the * provided output stream. Use the provided buffer for moving data * to reduce memory allocation. */
Copy the contents of the file with specified extension into the provided output stream. Use the provided buffer for moving data to reduce memory allocation
copyFile
{ "repo_name": "GateNLP/gate-core", "path": "src/main/java/gate/creole/annic/apache/lucene/index/CompoundFileWriter.java", "license": "lgpl-3.0", "size": 7937 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
844,165
@SuppressWarnings("TypeMayBeWeakened") private static void writeNearConfiguration(BinaryRawWriter out, NearCacheConfiguration cfg) { assert cfg != null; out.writeInt(cfg.getNearStartSize()); writeEvictionPolicy(out, cfg.getNearEvictionPolicy()); }
@SuppressWarnings(STR) static void function(BinaryRawWriter out, NearCacheConfiguration cfg) { assert cfg != null; out.writeInt(cfg.getNearStartSize()); writeEvictionPolicy(out, cfg.getNearEvictionPolicy()); }
/** * Reads the near config. * * @param out Stream. * @param cfg NearCacheConfiguration. */
Reads the near config
writeNearConfiguration
{ "repo_name": "amirakhmedov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java", "license": "apache-2.0", "size": 75809 }
[ "org.apache.ignite.binary.BinaryRawWriter", "org.apache.ignite.configuration.NearCacheConfiguration" ]
import org.apache.ignite.binary.BinaryRawWriter; import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.binary.*; import org.apache.ignite.configuration.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,361,326
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<OperationInner>> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<OperationInner>> function(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Lists all of the available REST API operations of the Microsoft.Communication provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on * successful completion of {@link Mono}. */
Lists all of the available REST API operations of the Microsoft.Communication provider
listSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/communication/azure-resourcemanager-communication/src/main/java/com/azure/resourcemanager/communication/implementation/OperationsClientImpl.java", "license": "mit", "size": 12912 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.communication.fluent.models.OperationInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.communication.fluent.models.OperationInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.communication.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,652,757
public List<String> command() { return builder.command(); }
List<String> function() { return builder.command(); }
/** * See {@link ProcessBuilder#command()}. */
See <code>ProcessBuilder#command()</code>
command
{ "repo_name": "kastur/interdroid-smartsockets", "path": "src/ibis/smartsockets/util/RunProcess.java", "license": "bsd-3-clause", "size": 7477 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
811,065
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (defaultFailureUrl == null) { logger.debug("No failure URL set, sending 401 Unauthorized error"); response.sendError(HttpStatus.UNAUTHORIZED.value(), HttpStatus.UNAUTHORIZED.getReasonPhrase()); } else { saveException(request, exception); if (forwardToDestination) { logger.debug("Forwarding to " + defaultFailureUrl); request.getRequestDispatcher(defaultFailureUrl) .forward(request, response); } else { logger.debug("Redirecting to " + defaultFailureUrl); redirectStrategy.sendRedirect(request, response, defaultFailureUrl); } } }
void function(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (defaultFailureUrl == null) { logger.debug(STR); response.sendError(HttpStatus.UNAUTHORIZED.value(), HttpStatus.UNAUTHORIZED.getReasonPhrase()); } else { saveException(request, exception); if (forwardToDestination) { logger.debug(STR + defaultFailureUrl); request.getRequestDispatcher(defaultFailureUrl) .forward(request, response); } else { logger.debug(STR + defaultFailureUrl); redirectStrategy.sendRedirect(request, response, defaultFailureUrl); } } }
/** * Performs the redirect or forward to the {@code defaultFailureUrl} if set, otherwise * returns a 401 error code. * <p> * If redirecting or forwarding, {@code saveException} will be called to cache the * exception for use in the target view. */
Performs the redirect or forward to the defaultFailureUrl if set, otherwise returns a 401 error code. If redirecting or forwarding, saveException will be called to cache the exception for use in the target view
onAuthenticationFailure
{ "repo_name": "thomasdarimont/spring-security", "path": "web/src/main/java/org/springframework/security/web/authentication/SimpleUrlAuthenticationFailureHandler.java", "license": "apache-2.0", "size": 5541 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.springframework.http.HttpStatus", "org.springframework.security.core.AuthenticationException" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.security.core.AuthenticationException;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.springframework.http.*; import org.springframework.security.core.*;
[ "java.io", "javax.servlet", "org.springframework.http", "org.springframework.security" ]
java.io; javax.servlet; org.springframework.http; org.springframework.security;
2,190,773
// Initialize variables Table table = getDefaultTable(); byte[] rowKey = dataHelper.randomData("testrow-"); int numValues = 3; byte[][] quals = dataHelper.randomData("qual-", numValues); byte[][] values = dataHelper.randomData("value-", numValues); // Insert some columns Put put = new Put(rowKey); for (int i = 0; i < numValues; ++i) { put.addColumn(SharedTestEnvRule.COLUMN_FAMILY, quals[i], values[i]); } table.put(put); // Get without a qualifer, and confirm all results are returned. Get get = new Get(rowKey); get.addFamily(SharedTestEnvRule.COLUMN_FAMILY); Result result = table.get(get); Assert.assertEquals(numValues, result.size()); for (int i = 0; i < numValues; ++i) { Assert.assertTrue(result.containsColumn(SharedTestEnvRule.COLUMN_FAMILY, quals[i])); Assert.assertArrayEquals( values[i], CellUtil.cloneValue( result.getColumnLatestCell(SharedTestEnvRule.COLUMN_FAMILY, quals[i]))); } // Cleanup Delete delete = new Delete(rowKey); table.delete(delete); table.close(); }
Table table = getDefaultTable(); byte[] rowKey = dataHelper.randomData(STR); int numValues = 3; byte[][] quals = dataHelper.randomData("qual-", numValues); byte[][] values = dataHelper.randomData(STR, numValues); Put put = new Put(rowKey); for (int i = 0; i < numValues; ++i) { put.addColumn(SharedTestEnvRule.COLUMN_FAMILY, quals[i], values[i]); } table.put(put); Get get = new Get(rowKey); get.addFamily(SharedTestEnvRule.COLUMN_FAMILY); Result result = table.get(get); Assert.assertEquals(numValues, result.size()); for (int i = 0; i < numValues; ++i) { Assert.assertTrue(result.containsColumn(SharedTestEnvRule.COLUMN_FAMILY, quals[i])); Assert.assertArrayEquals( values[i], CellUtil.cloneValue( result.getColumnLatestCell(SharedTestEnvRule.COLUMN_FAMILY, quals[i]))); } Delete delete = new Delete(rowKey); table.delete(delete); table.close(); }
/** * Requirement 3.2 - If a column family is requested, but no qualifier, all columns in that family * are returned */
Requirement 3.2 - If a column family is requested, but no qualifier, all columns in that family are returned
testNoQualifier
{ "repo_name": "sduskis/cloud-bigtable-client", "path": "bigtable-hbase-2.x-parent/bigtable-hbase-2.x-integration-tests/src/test/java/com/google/cloud/bigtable/hbase/TestGet.java", "license": "apache-2.0", "size": 21183 }
[ "com.google.cloud.bigtable.hbase.test_env.SharedTestEnvRule", "org.apache.hadoop.hbase.CellUtil", "org.apache.hadoop.hbase.client.Delete", "org.apache.hadoop.hbase.client.Get", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.client.Result", "org.apache.hadoop.hbase.client.Table", "org.junit.Assert" ]
import com.google.cloud.bigtable.hbase.test_env.SharedTestEnvRule; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.Table; import org.junit.Assert;
import com.google.cloud.bigtable.hbase.test_env.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.junit.*;
[ "com.google.cloud", "org.apache.hadoop", "org.junit" ]
com.google.cloud; org.apache.hadoop; org.junit;
2,111,039
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Void> deleteAsync( String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function( String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Deletes a private endpoint connection with a given name. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */
Deletes a private endpoint connection with a given name
deleteAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java", "license": "mit", "size": 77661 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context;
import com.azure.core.annotation.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,869,057
public Object get(String name, int index) { // If its not a property, then create default indexed property if (!isDynaProperty(name)) { set(name, defaultIndexedProperty(name)); } // Get the indexed property Object indexedProperty = get(name); // Check that the property is indexed if (!dynaClass.getDynaProperty(name).isIndexed()) { throw new IllegalArgumentException ("Non-indexed property for '" + name + "[" + index + "]' " + dynaClass.getDynaProperty(name).getName()); } // Grow indexed property to appropriate size indexedProperty = growIndexedProperty(name, indexedProperty, index); // Return the indexed value if (indexedProperty.getClass().isArray()) { return Array.get(indexedProperty, index); } else if (indexedProperty instanceof List) { return ((List)indexedProperty).get(index); } else { throw new IllegalArgumentException ("Non-indexed property for '" + name + "[" + index + "]' " + indexedProperty.getClass().getName()); } }
Object function(String name, int index) { if (!isDynaProperty(name)) { set(name, defaultIndexedProperty(name)); } Object indexedProperty = get(name); if (!dynaClass.getDynaProperty(name).isIndexed()) { throw new IllegalArgumentException (STR + name + "[" + index + STR + dynaClass.getDynaProperty(name).getName()); } indexedProperty = growIndexedProperty(name, indexedProperty, index); if (indexedProperty.getClass().isArray()) { return Array.get(indexedProperty, index); } else if (indexedProperty instanceof List) { return ((List)indexedProperty).get(index); } else { throw new IllegalArgumentException (STR + name + "[" + index + STR + indexedProperty.getClass().getName()); } }
/** * <p>Return the value of an indexed property with the specified name.</p> * * <p><strong>N.B.</strong> Returns <code>null</code> if there is no 'indexed' * property of the specified name.</p> * * @param name Name of the property whose value is to be retrieved * @param index Index of the value to be retrieved * * @exception IllegalArgumentException if the specified property * exists, but is not indexed * @exception IndexOutOfBoundsException if the specified index * is outside the range of the underlying property */
Return the value of an indexed property with the specified name. N.B. Returns <code>null</code> if there is no 'indexed' property of the specified name
get
{ "repo_name": "ProfilingLabs/Usemon2", "path": "usemon-agent-commons-java/src/main/java/com/usemon/lib/org/apache/commons/beanutils/LazyDynaBean.java", "license": "mpl-2.0", "size": 29213 }
[ "java.lang.reflect.Array", "java.util.List" ]
import java.lang.reflect.Array; import java.util.List;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,128,290
protected void setupToolbarElements(JToolBar toolbar) { int x = 0; Insets insets = new Insets(0, 4, 0, 2); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_START, x); toolbar.add(new JLabel(Constant.messages.getString(panelPrefix + ".toolbar.context.label")), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); toolbar.add(getContextSelectComboBox(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT, x); toolbar.add(new JLabel(), LayoutHelper.getGBC(x++, 0, 1, 1.0)); // Spacer if (hasOptions()) { toolbar.add(getOptionsButton(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); } this.addToolBarElements(toolbar, TOOLBAR_LOCATION_END, x); }
void function(JToolBar toolbar) { int x = 0; Insets insets = new Insets(0, 4, 0, 2); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_START, x); toolbar.add(new JLabel(Constant.messages.getString(panelPrefix + STR)), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); toolbar.add(getContextSelectComboBox(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT, x); toolbar.add(new JLabel(), LayoutHelper.getGBC(x++, 0, 1, 1.0)); if (hasOptions()) { toolbar.add(getOptionsButton(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); } this.addToolBarElements(toolbar, TOOLBAR_LOCATION_END, x); }
/** * Method used to setup the toolbar elements. Should not usually be overriden. Instead, use the * {@link #addToolBarElements(JToolBar, short, int)} method to add elements at various points. * @param toolbar the tool bar of the status panel */
Method used to setup the toolbar elements. Should not usually be overriden. Instead, use the <code>#addToolBarElements(JToolBar, short, int)</code> method to add elements at various points
setupToolbarElements
{ "repo_name": "j4nnis/bproxy", "path": "src/org/zaproxy/zap/view/panels/AbstractContextSelectToolbarStatusPanel.java", "license": "apache-2.0", "size": 9507 }
[ "java.awt.Insets", "javax.swing.JLabel", "javax.swing.JToolBar", "org.parosproxy.paros.Constant", "org.zaproxy.zap.view.LayoutHelper" ]
import java.awt.Insets; import javax.swing.JLabel; import javax.swing.JToolBar; import org.parosproxy.paros.Constant; import org.zaproxy.zap.view.LayoutHelper;
import java.awt.*; import javax.swing.*; import org.parosproxy.paros.*; import org.zaproxy.zap.view.*;
[ "java.awt", "javax.swing", "org.parosproxy.paros", "org.zaproxy.zap" ]
java.awt; javax.swing; org.parosproxy.paros; org.zaproxy.zap;
231,479
public Future<AckEvent> getFutureAck() { return futureAck; }
Future<AckEvent> function() { return futureAck; }
/** * Gets the ack future for this result, if any * * @return the ack future, if set (null otherwise) */
Gets the ack future for this result, if any
getFutureAck
{ "repo_name": "SandishKumarHN/datacollector", "path": "container/src/main/java/com/streamsets/datacollector/event/handler/remote/RemoteDataCollectorResult.java", "license": "apache-2.0", "size": 3564 }
[ "com.streamsets.datacollector.event.dto.AckEvent", "java.util.concurrent.Future" ]
import com.streamsets.datacollector.event.dto.AckEvent; import java.util.concurrent.Future;
import com.streamsets.datacollector.event.dto.*; import java.util.concurrent.*;
[ "com.streamsets.datacollector", "java.util" ]
com.streamsets.datacollector; java.util;
1,925,687
public static boolean deleteQuietly(File file) { if (file == null) { return false; } try { if (file.isDirectory()) { cleanDirectory(file); } } catch (Exception e) { } try { return file.delete(); } catch (Exception e) { return false; } }
static boolean function(File file) { if (file == null) { return false; } try { if (file.isDirectory()) { cleanDirectory(file); } } catch (Exception e) { } try { return file.delete(); } catch (Exception e) { return false; } }
/** * Deletes a file, never throwing an exception. If file is a directory, delete it and all sub-directories. * <p> * The difference between File.delete() and this method are: * <ul> * <li>A directory to be deleted does not have to be empty.</li> * <li>No exceptions are thrown when a file or directory cannot be deleted.</li> * </ul> * * @param file file or directory to delete, can be <code>null</code> * @return <code>true</code> if the file or directory was deleted, otherwise * <code>false</code> * * @since Commons IO 1.4 */
Deletes a file, never throwing an exception. If file is a directory, delete it and all sub-directories. The difference between File.delete() and this method are: A directory to be deleted does not have to be empty. No exceptions are thrown when a file or directory cannot be deleted.
deleteQuietly
{ "repo_name": "rex-xxx/mt6572_x201", "path": "packages/apps/Email/src/org/apache/commons/io/FileUtils.java", "license": "gpl-2.0", "size": 77073 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,826,754
public Translog.Durability getTranslogDurability() { return indexSettings.getTranslogDurability(); } // we can not protect with a lock since we "release" on a different thread private final AtomicBoolean flushOrRollRunning = new AtomicBoolean();
Translog.Durability function() { return indexSettings.getTranslogDurability(); } private final AtomicBoolean flushOrRollRunning = new AtomicBoolean();
/** * Returns the current translog durability mode */
Returns the current translog durability mode
getTranslogDurability
{ "repo_name": "mjason3/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/shard/IndexShard.java", "license": "apache-2.0", "size": 122035 }
[ "java.util.concurrent.atomic.AtomicBoolean", "org.elasticsearch.index.translog.Translog" ]
import java.util.concurrent.atomic.AtomicBoolean; import org.elasticsearch.index.translog.Translog;
import java.util.concurrent.atomic.*; import org.elasticsearch.index.translog.*;
[ "java.util", "org.elasticsearch.index" ]
java.util; org.elasticsearch.index;
158,040
private void handleServerVoiceChannel(JsonNode channelJson) { long serverId = channelJson.get("guild_id").asLong(); long channelId = channelJson.get("id").asLong(); api.getPossiblyUnreadyServerById(serverId) .flatMap(server -> server.getVoiceChannelById(channelId)) .ifPresent(this::dispatchServerChannelDeleteEvent); api.removeObjectListeners(ServerVoiceChannel.class, channelId); api.removeObjectListeners(ServerChannel.class, channelId); api.removeObjectListeners(VoiceChannel.class, channelId); api.removeObjectListeners(Channel.class, channelId); }
void function(JsonNode channelJson) { long serverId = channelJson.get(STR).asLong(); long channelId = channelJson.get("id").asLong(); api.getPossiblyUnreadyServerById(serverId) .flatMap(server -> server.getVoiceChannelById(channelId)) .ifPresent(this::dispatchServerChannelDeleteEvent); api.removeObjectListeners(ServerVoiceChannel.class, channelId); api.removeObjectListeners(ServerChannel.class, channelId); api.removeObjectListeners(VoiceChannel.class, channelId); api.removeObjectListeners(Channel.class, channelId); }
/** * Handles server voice channel deletion. * * @param channelJson The channel data. */
Handles server voice channel deletion
handleServerVoiceChannel
{ "repo_name": "BtoBastian/Javacord", "path": "javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelDeleteHandler.java", "license": "lgpl-3.0", "size": 9149 }
[ "com.fasterxml.jackson.databind.JsonNode", "org.javacord.api.entity.channel.Channel", "org.javacord.api.entity.channel.ServerChannel", "org.javacord.api.entity.channel.ServerVoiceChannel", "org.javacord.api.entity.channel.VoiceChannel" ]
import com.fasterxml.jackson.databind.JsonNode; import org.javacord.api.entity.channel.Channel; import org.javacord.api.entity.channel.ServerChannel; import org.javacord.api.entity.channel.ServerVoiceChannel; import org.javacord.api.entity.channel.VoiceChannel;
import com.fasterxml.jackson.databind.*; import org.javacord.api.entity.channel.*;
[ "com.fasterxml.jackson", "org.javacord.api" ]
com.fasterxml.jackson; org.javacord.api;
364,603
public static <T> T withJar(final File file, final Extractor<T> extractor) { JarFile jarFile = null; try { jarFile = new JarFile(file); return extractor.get(jarFile); } catch (final IOException e) { throw new IllegalArgumentException("File must be a jar: " + file, e); } finally { closeQuietly(jarFile); } }
static <T> T function(final File file, final Extractor<T> extractor) { JarFile jarFile = null; try { jarFile = new JarFile(file); return extractor.get(jarFile); } catch (final IOException e) { throw new IllegalArgumentException(STR + file, e); } finally { closeQuietly(jarFile); } }
/** * Extract something from a jar file. * <p> * Correctly opens and closes the Jar file. Must not lazily access the Jar as it has an open/closed state. * * @param <T> the type of the thing to extract * @param file the file that is the jar contents * @param extractor * @return the result of the extractor * @throws RuntimeException if there are problems accessing the jar contents. */
Extract something from a jar file. Correctly opens and closes the Jar file. Must not lazily access the Jar as it has an open/closed state
withJar
{ "repo_name": "mrdon/PLUG", "path": "atlassian-plugins-osgi/src/main/java/com/atlassian/plugin/osgi/factory/transform/JarUtils.java", "license": "bsd-3-clause", "size": 3779 }
[ "java.io.File", "java.io.IOException", "java.util.jar.JarFile" ]
import java.io.File; import java.io.IOException; import java.util.jar.JarFile;
import java.io.*; import java.util.jar.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,876,859
public void setAutoSwapSlotName(final String autoSwapSlotNameValue) { this.autoSwapSlotName = autoSwapSlotNameValue; } private ArrayList<WebSiteUpdateConfigurationParameters.ConnectionStringInfo> connectionStrings;
void function(final String autoSwapSlotNameValue) { this.autoSwapSlotName = autoSwapSlotNameValue; } private ArrayList<WebSiteUpdateConfigurationParameters.ConnectionStringInfo> connectionStrings;
/** * Optional. Sets the slot name to swap with after successful deployment. * @param autoSwapSlotNameValue The AutoSwapSlotName value. */
Optional. Sets the slot name to swap with after successful deployment
setAutoSwapSlotName
{ "repo_name": "oaastest/azure-sdk-for-java", "path": "management-websites/src/main/java/com/microsoft/windowsazure/management/websites/models/WebSiteUpdateConfigurationParameters.java", "license": "apache-2.0", "size": 22657 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,899,373
@Override public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry) { this.events.add(Event.reportingEntryPublished(testDescriptor, entry)); }
void function(TestDescriptor testDescriptor, ReportEntry entry) { this.events.add(Event.reportingEntryPublished(testDescriptor, entry)); }
/** * Record an {@link Event} for a published {@link ReportEntry}. */
Record an <code>Event</code> for a published <code>ReportEntry</code>
reportingEntryPublished
{ "repo_name": "junit-team/junit-lambda", "path": "junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java", "license": "epl-1.0", "size": 2836 }
[ "org.junit.platform.engine.TestDescriptor", "org.junit.platform.engine.reporting.ReportEntry" ]
import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.reporting.ReportEntry;
import org.junit.platform.engine.*; import org.junit.platform.engine.reporting.*;
[ "org.junit.platform" ]
org.junit.platform;
197,134
public synchronized boolean remove(String key) throws IOException { checkNotClosed(); validateKey(key); Entry entry = lruEntries.get(key); if (entry == null || entry.currentEditor != null) { return false; } for (int i = 0; i < valueCount; i++) { File file = entry.getCleanFile(i); if (!file.delete()) { throw new IOException("failed to delete " + file); } size -= entry.lengths[i]; entry.lengths[i] = 0; } redundantOpCount++; journalWriter.append(REMOVE + ' ' + key + '\n'); lruEntries.remove(key); if (journalRebuildRequired()) { executorService.submit(cleanupCallable); } return true; }
synchronized boolean function(String key) throws IOException { checkNotClosed(); validateKey(key); Entry entry = lruEntries.get(key); if (entry == null entry.currentEditor != null) { return false; } for (int i = 0; i < valueCount; i++) { File file = entry.getCleanFile(i); if (!file.delete()) { throw new IOException(STR + file); } size -= entry.lengths[i]; entry.lengths[i] = 0; } redundantOpCount++; journalWriter.append(REMOVE + ' ' + key + '\n'); lruEntries.remove(key); if (journalRebuildRequired()) { executorService.submit(cleanupCallable); } return true; }
/** * Drops the entry for {@code key} if it exists and can be removed. Entries * actively being edited cannot be removed. * * @return true if an entry was removed. */
Drops the entry for key if it exists and can be removed. Entries actively being edited cannot be removed
remove
{ "repo_name": "caichengan/ServerHelp", "path": "app/src/main/java/com/xht/android/serverhelp/ceche/DiskLruCache.java", "license": "apache-2.0", "size": 33299 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
280,153
public static StartElement getNextStartElement(final String name, final XMLEventReader reader) throws XMLStreamException { while (true) { StartElement startElement = getNextStartElement(reader); if (name.equals(startElement.getName().getLocalPart())) { return startElement; } } }
static StartElement function(final String name, final XMLEventReader reader) throws XMLStreamException { while (true) { StartElement startElement = getNextStartElement(reader); if (name.equals(startElement.getName().getLocalPart())) { return startElement; } } }
/** * Holt sich das naechste Start-Element aus dem uebergebenen XML-Stream. * * @param name gesuchtes Start-Element * @param reader the reader * @return the next start element * @throws XMLStreamException the XML stream exception */
Holt sich das naechste Start-Element aus dem uebergebenen XML-Stream
getNextStartElement
{ "repo_name": "oboehm/gdv.xport", "path": "lib/src/main/java/gdv/xport/util/XmlHelper.java", "license": "apache-2.0", "size": 9100 }
[ "javax.xml.stream.XMLEventReader", "javax.xml.stream.XMLStreamException", "javax.xml.stream.events.StartElement" ]
import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.StartElement;
import javax.xml.stream.*; import javax.xml.stream.events.*;
[ "javax.xml" ]
javax.xml;
1,014,186
public void testCategoryBaseFolderRepair() throws Exception { System.out.println( "Testing resource categories reparation after changing the base folder name of the category repositories."); CmsObject cms = getCmsObject(); // assert the starting situation of categories coming from #testCategoryBaseFolder List<CmsCategory> cats = CmsCategoryService.getInstance().readCategories(cms, null, true, "index.html"); assertEquals(3, cats.size()); CmsCategory catA = cats.get(0); CmsCategory catAA = cats.get(1); CmsCategory catC = cats.get(2); assertEquals(CmsCategoryService.CENTRALIZED_REPOSITORY + "a/", catA.getRootPath()); assertEquals(CmsCategoryService.CENTRALIZED_REPOSITORY + "a/aa/", catAA.getRootPath()); assertEquals( cms.getRequestContext().getSiteRoot() + CmsCategoryService.getInstance().getRepositoryBaseFolderName(cms) + "c/", catC.getRootPath()); printExceptionWarning(); CmsResource resB = cms.readResource(CmsCategoryService.REPOSITORY_BASE_FOLDER + "b"); try { CmsCategoryService.getInstance().getCategory(cms, resB); fail("Category B should be invalid"); } catch (Exception e) { // ok, continue } // assert the starting situation of resources coming from #testCategoryTreeAssign OpenCmsTestLogAppender.setBreakOnError(false); // to prevent failure because of error log output echo("next error stack trace is expected."); cats = CmsCategoryService.getInstance().readResourceCategories(cms, "index.html"); OpenCmsTestLogAppender.setBreakOnError(true); assertEquals(1, cats.size()); // catB is lost (as category, but still there as relation) assertEquals(catA, cats.get(0)); List<CmsResource> resources = CmsCategoryService.getInstance().readCategoryResources( cms, catA.getPath(), true, "index.html"); assertEquals(1, resources.size()); assertEquals(cms.readResource("index.html"), resources.get(0)); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catAA.getPath(), true, "index.html").isEmpty()); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catC.getPath(), true, "index.html").isEmpty()); // now assert the relations List<CmsRelation> relations = cms.getRelationsForResource( "index.html", CmsRelationFilter.TARGETS.filterType(CmsRelationType.CATEGORY)); assertEquals(2, relations.size()); CmsResource resource = cms.readResource("index.html"); CmsResource resCatB = cms.readResource(".categories/b/"); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), catA.getId(), catA.getRootPath(), CmsRelationType.CATEGORY))); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), resCatB.getStructureId(), resCatB.getRootPath(), CmsRelationType.CATEGORY))); // repair category associations CmsCategoryService.getInstance().repairRelations(cms, "index.html"); // assert after reparation cats = CmsCategoryService.getInstance().readResourceCategories(cms, "index.html"); assertEquals(1, cats.size()); assertEquals(catA, cats.get(0)); resources = CmsCategoryService.getInstance().readCategoryResources(cms, catA.getPath(), true, "index.html"); assertEquals(1, resources.size()); assertEquals(cms.readResource("index.html"), resources.get(0)); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catAA.getPath(), true, "index.html").isEmpty()); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catC.getPath(), true, "index.html").isEmpty()); // now assert the relations relations = cms.getRelationsForResource( "index.html", CmsRelationFilter.TARGETS.filterType(CmsRelationType.CATEGORY)); assertEquals(1, relations.size()); resource = cms.readResource("index.html"); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), catA.getId(), catA.getRootPath(), CmsRelationType.CATEGORY))); }
void function() throws Exception { System.out.println( STR); CmsObject cms = getCmsObject(); List<CmsCategory> cats = CmsCategoryService.getInstance().readCategories(cms, null, true, STR); assertEquals(3, cats.size()); CmsCategory catA = cats.get(0); CmsCategory catAA = cats.get(1); CmsCategory catC = cats.get(2); assertEquals(CmsCategoryService.CENTRALIZED_REPOSITORY + "a/", catA.getRootPath()); assertEquals(CmsCategoryService.CENTRALIZED_REPOSITORY + "a/aa/", catAA.getRootPath()); assertEquals( cms.getRequestContext().getSiteRoot() + CmsCategoryService.getInstance().getRepositoryBaseFolderName(cms) + "c/", catC.getRootPath()); printExceptionWarning(); CmsResource resB = cms.readResource(CmsCategoryService.REPOSITORY_BASE_FOLDER + "b"); try { CmsCategoryService.getInstance().getCategory(cms, resB); fail(STR); } catch (Exception e) { } OpenCmsTestLogAppender.setBreakOnError(false); echo(STR); cats = CmsCategoryService.getInstance().readResourceCategories(cms, STR); OpenCmsTestLogAppender.setBreakOnError(true); assertEquals(1, cats.size()); assertEquals(catA, cats.get(0)); List<CmsResource> resources = CmsCategoryService.getInstance().readCategoryResources( cms, catA.getPath(), true, STR); assertEquals(1, resources.size()); assertEquals(cms.readResource(STR), resources.get(0)); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catAA.getPath(), true, STR).isEmpty()); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catC.getPath(), true, STR).isEmpty()); List<CmsRelation> relations = cms.getRelationsForResource( STR, CmsRelationFilter.TARGETS.filterType(CmsRelationType.CATEGORY)); assertEquals(2, relations.size()); CmsResource resource = cms.readResource(STR); CmsResource resCatB = cms.readResource(STR); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), catA.getId(), catA.getRootPath(), CmsRelationType.CATEGORY))); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), resCatB.getStructureId(), resCatB.getRootPath(), CmsRelationType.CATEGORY))); CmsCategoryService.getInstance().repairRelations(cms, STR); cats = CmsCategoryService.getInstance().readResourceCategories(cms, STR); assertEquals(1, cats.size()); assertEquals(catA, cats.get(0)); resources = CmsCategoryService.getInstance().readCategoryResources(cms, catA.getPath(), true, STR); assertEquals(1, resources.size()); assertEquals(cms.readResource(STR), resources.get(0)); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catAA.getPath(), true, STR).isEmpty()); assertTrue( CmsCategoryService.getInstance().readCategoryResources(cms, catC.getPath(), true, STR).isEmpty()); relations = cms.getRelationsForResource( STR, CmsRelationFilter.TARGETS.filterType(CmsRelationType.CATEGORY)); assertEquals(1, relations.size()); resource = cms.readResource(STR); assertTrue( relations.contains(new CmsRelation( resource.getStructureId(), resource.getRootPath(), catA.getId(), catA.getRootPath(), CmsRelationType.CATEGORY))); }
/** * Tests resource categories reparation after changing the base folder name of the category repositories.<p> * * @throws Exception if something goes wrong */
Tests resource categories reparation after changing the base folder name of the category repositories
testCategoryBaseFolderRepair
{ "repo_name": "victos/opencms-core", "path": "test/org/opencms/relations/TestCategories.java", "license": "lgpl-2.1", "size": 48560 }
[ "java.util.List", "org.opencms.file.CmsObject", "org.opencms.file.CmsResource", "org.opencms.test.OpenCmsTestLogAppender" ]
import java.util.List; import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.test.OpenCmsTestLogAppender;
import java.util.*; import org.opencms.file.*; import org.opencms.test.*;
[ "java.util", "org.opencms.file", "org.opencms.test" ]
java.util; org.opencms.file; org.opencms.test;
2,742,060
protected void addInput__iPinStatePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CtrlUnit54_Input__iPinState_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CtrlUnit54_Input__iPinState_feature", "_UI_CtrlUnit54_type"), WTSpecPackage.Literals.CTRL_UNIT54__INPUT_IPIN_STATE, true, false, true, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), WTSpecPackage.Literals.CTRL_UNIT54__INPUT_IPIN_STATE, true, false, true, null, null, null)); }
/** * This adds a property descriptor for the Input iPin State feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Input iPin State feature.
addInput__iPinStatePropertyDescriptor
{ "repo_name": "FTSRG/mondo-collab-framework", "path": "archive/mondo-access-control/CollaborationIncQuery/WTSpec.edit/src/WTSpec/provider/CtrlUnit54ItemProvider.java", "license": "epl-1.0", "size": 8823 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,880,928
protected File getConfigBase(String hostName) { File configBase = new File(System.getProperty("catalina.base"), "conf"); if (!configBase.exists()) { return null; } if (engine != null) { configBase = new File(configBase, engine.getName()); } if (host != null) { configBase = new File(configBase, hostName); } configBase.mkdirs(); return configBase; }
File function(String hostName) { File configBase = new File(System.getProperty(STR), "conf"); if (!configBase.exists()) { return null; } if (engine != null) { configBase = new File(configBase, engine.getName()); } if (host != null) { configBase = new File(configBase, hostName); } configBase.mkdirs(); return configBase; }
/** * Get config base. */
Get config base
getConfigBase
{ "repo_name": "plumer/codana", "path": "tomcat_files/6.0.0/HostManagerServlet.java", "license": "mit", "size": 22223 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,259,307
@ApiModelProperty(value = "The last position in the result set. ") public String getEndPosition() { return endPosition; }
@ApiModelProperty(value = STR) String function() { return endPosition; }
/** * The last position in the result set. . * @return endPosition **/
The last position in the result set.
getEndPosition
{ "repo_name": "docusign/docusign-java-client", "path": "src/main/java/com/docusign/esign/model/EnvelopeTransferRuleInformation.java", "license": "mit", "size": 8433 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,934,844
@Override protected String columnDefinition(SQLColumn c, Map<String, SQLObject> colNameMap) { StringBuffer def = new StringBuffer(); // Column name String physicalName = createPhysicalName(colNameMap, c); def.append(physicalName); def.append(" "); def.append(columnType(c)); UserDefinedSQLType type = c.getUserDefinedSQLType(); String defaultValue = type.getDefaultValue(getPlatformName()); if ( defaultValue != null && !defaultValue.equals("")) { def.append(" "); def.append("DEFAULT "); def.append(defaultValue); } def.append(columnNullability(c)); List<SQLEnumeration> enumerations; SQLTypeConstraint constraintType = type.getConstraintType(getPlatformName()); if (constraintType == null) { constraintType = type.getDefaultPhysicalProperties().getConstraintType(); enumerations = type.getDefaultPhysicalProperties().getChildrenWithoutPopulating(SQLEnumeration.class); } else { enumerations = type.getEnumerations(getPlatformName()); } // Add enumeration. if (constraintType == SQLTypeConstraint.ENUM) { String columnEnumeration = columnEnumeration(c, enumerations); if (columnEnumeration != null && columnEnumeration.length() > 0) { def.append(" " + columnEnumeration); } } logger.debug("column definition "+ def.toString()); return def.toString(); }
String function(SQLColumn c, Map<String, SQLObject> colNameMap) { StringBuffer def = new StringBuffer(); String physicalName = createPhysicalName(colNameMap, c); def.append(physicalName); def.append(" "); def.append(columnType(c)); UserDefinedSQLType type = c.getUserDefinedSQLType(); String defaultValue = type.getDefaultValue(getPlatformName()); if ( defaultValue != null && !defaultValue.equals(STR STRDEFAULT STR STRcolumn definition "+ def.toString()); return def.toString(); }
/** * SQL Server does not allow multiple named check constraints on the column * level. Only one named or unnamed check constraint is allowed. Instead, we * must add them on the table level. * * @see #addTable(SQLTable) */
SQL Server does not allow multiple named check constraints on the column level. Only one named or unnamed check constraint is allowed. Instead, we must add them on the table level
columnDefinition
{ "repo_name": "ptrptr/power-architect", "path": "src/main/java/ca/sqlpower/architect/ddl/SQLServerDDLGenerator.java", "license": "gpl-3.0", "size": 30554 }
[ "ca.sqlpower.sqlobject.SQLColumn", "ca.sqlpower.sqlobject.SQLObject", "ca.sqlpower.sqlobject.UserDefinedSQLType", "java.util.Map" ]
import ca.sqlpower.sqlobject.SQLColumn; import ca.sqlpower.sqlobject.SQLObject; import ca.sqlpower.sqlobject.UserDefinedSQLType; import java.util.Map;
import ca.sqlpower.sqlobject.*; import java.util.*;
[ "ca.sqlpower.sqlobject", "java.util" ]
ca.sqlpower.sqlobject; java.util;
2,869,421
EReference getAgent_MovesOver();
EReference getAgent_MovesOver();
/** * Returns the meta object for the reference list '{@link org.eclipse.papyrus.RobotML.Agent#getMovesOver <em>Moves Over</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Moves Over</em>'. * @see org.eclipse.papyrus.RobotML.Agent#getMovesOver() * @see #getAgent() * @generated */
Returns the meta object for the reference list '<code>org.eclipse.papyrus.RobotML.Agent#getMovesOver Moves Over</code>'.
getAgent_MovesOver
{ "repo_name": "RobotML/RobotML-SDK-Juno", "path": "plugins/robotml/org.eclipse.papyrus.robotml/src/org/eclipse/papyrus/RobotML/RobotMLPackage.java", "license": "epl-1.0", "size": 231818 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
539,114
private AggregateDoubleMetricFieldType createDefaultFieldType(String fieldName) { AggregateDoubleMetricFieldType fieldType = new AggregateDoubleMetricFieldType(fieldName); for (Metric m : List.of(Metric.min, Metric.max)) { String subfieldName = subfieldName(fieldName, m); NumberFieldMapper.NumberFieldType subfield = new NumberFieldMapper.NumberFieldType( subfieldName, NumberFieldMapper.NumberType.DOUBLE ); fieldType.addMetricField(m, subfield); } fieldType.setDefaultMetric(Metric.min); return fieldType; }
AggregateDoubleMetricFieldType function(String fieldName) { AggregateDoubleMetricFieldType fieldType = new AggregateDoubleMetricFieldType(fieldName); for (Metric m : List.of(Metric.min, Metric.max)) { String subfieldName = subfieldName(fieldName, m); NumberFieldMapper.NumberFieldType subfield = new NumberFieldMapper.NumberFieldType( subfieldName, NumberFieldMapper.NumberType.DOUBLE ); fieldType.addMetricField(m, subfield); } fieldType.setDefaultMetric(Metric.min); return fieldType; }
/** * Create a default aggregate_metric_double field type containing min and a max metrics. * * @param fieldName the name of the field * @return the created field type */
Create a default aggregate_metric_double field type containing min and a max metrics
createDefaultFieldType
{ "repo_name": "GlenRSmith/elasticsearch", "path": "x-pack/plugin/mapper-aggregate-metric/src/test/java/org/elasticsearch/xpack/aggregatemetric/aggregations/metrics/AggregateMetricBackedMaxAggregatorTests.java", "license": "apache-2.0", "size": 7196 }
[ "java.util.List", "org.elasticsearch.index.mapper.NumberFieldMapper", "org.elasticsearch.xpack.aggregatemetric.mapper.AggregateDoubleMetricFieldMapper" ]
import java.util.List; import org.elasticsearch.index.mapper.NumberFieldMapper; import org.elasticsearch.xpack.aggregatemetric.mapper.AggregateDoubleMetricFieldMapper;
import java.util.*; import org.elasticsearch.index.mapper.*; import org.elasticsearch.xpack.aggregatemetric.mapper.*;
[ "java.util", "org.elasticsearch.index", "org.elasticsearch.xpack" ]
java.util; org.elasticsearch.index; org.elasticsearch.xpack;
637,256
@Override public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == FunctionsPackage.Literals.STAND_ALONE_FUNCTION__PARAMETERS || childFeature == FunctionsPackage.Literals.VALUE_STAND_ALONE_FUNCTION__FUNCTION; if (qualify) { return getString ("_UI_CreateChild_text2", new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); }
String function(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == FunctionsPackage.Literals.STAND_ALONE_FUNCTION__PARAMETERS childFeature == FunctionsPackage.Literals.VALUE_STAND_ALONE_FUNCTION__FUNCTION; if (qualify) { return getString (STR, new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); }
/** * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the label text for <code>org.eclipse.emf.edit.command.CreateChildCommand</code>.
getCreateChildText
{ "repo_name": "paetti1988/qmate", "path": "MATE/org.tud.inf.st.mbt.emf.edit/src-gen/org/tud/inf/st/mbt/functions/provider/ValueStandAloneFunctionItemProvider.java", "license": "apache-2.0", "size": 11111 }
[ "java.util.Collection", "org.tud.inf.st.mbt.functions.FunctionsPackage" ]
import java.util.Collection; import org.tud.inf.st.mbt.functions.FunctionsPackage;
import java.util.*; import org.tud.inf.st.mbt.functions.*;
[ "java.util", "org.tud.inf" ]
java.util; org.tud.inf;
1,699,234
List<JSONObject> objects = new ArrayList<>(); StringBuilder sb = new StringBuilder(); //The builder for the message TextFormat color = null; Set<TextFormat> formatting = EnumSet.noneOf(TextFormat.class); for(int i = 0; i < rawMessage.length(); i++){ char c = rawMessage.charAt(i); if(c != TextFormat.ESCAPE){ sb.append(c); continue; } if(i == rawMessage.length() - 1){ continue; } append(objects, sb, color, formatting); TextFormat code = TextFormat.getByChar(rawMessage.charAt(i++)); if(code == null){ continue; } if(code == TextFormat.RESET){ code = null; formatting.clear(); } else if (code.isFormatChar()){ formatting.add(code); } else { formatting.clear(); } } append(objects, sb, color, formatting); if(objects.isEmpty()){ JSONObject obj = new JSONObject(); obj.put("text", ""); return obj.toJSONString(); } else if (objects.size() == 1){ return objects.get(0).toJSONString(); } else { JSONObject obj = objects.get(0); if(obj.size() == 1){ obj.put("extra", objects.subList(1, objects.size())); } else { obj = new JSONObject(); obj.put("text", ""); obj.put("extra", objects); } return obj.toJSONString(); } }
List<JSONObject> objects = new ArrayList<>(); StringBuilder sb = new StringBuilder(); TextFormat color = null; Set<TextFormat> formatting = EnumSet.noneOf(TextFormat.class); for(int i = 0; i < rawMessage.length(); i++){ char c = rawMessage.charAt(i); if(c != TextFormat.ESCAPE){ sb.append(c); continue; } if(i == rawMessage.length() - 1){ continue; } append(objects, sb, color, formatting); TextFormat code = TextFormat.getByChar(rawMessage.charAt(i++)); if(code == null){ continue; } if(code == TextFormat.RESET){ code = null; formatting.clear(); } else if (code.isFormatChar()){ formatting.add(code); } else { formatting.clear(); } } append(objects, sb, color, formatting); if(objects.isEmpty()){ JSONObject obj = new JSONObject(); obj.put("text", STRextraSTRtextSTRSTRextra", objects); } return obj.toJSONString(); } }
/** * Builds the rawMessage into a JSON String. * <br> * Based on code from the Glowstone project. The original code can be found here: * https://github.com/GlowstoneMC/Glowstone/blob/master/src/main/java/net/glowstone/util/TextMessage.java * @return The Chat message, as a JSON string. */
Builds the rawMessage into a JSON String. Based on code from the Glowstone project. The original code can be found here: HREF
buildJSON
{ "repo_name": "Creeperface01/RedstoneLamp", "path": "src/redstonelamp/network/pc/Chat.java", "license": "gpl-3.0", "size": 3436 }
[ "java.util.ArrayList", "java.util.EnumSet", "java.util.List", "java.util.Set", "org.json.simple.JSONObject" ]
import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Set; import org.json.simple.JSONObject;
import java.util.*; import org.json.simple.*;
[ "java.util", "org.json.simple" ]
java.util; org.json.simple;
123,673
SecureSharedPreferences sharedPreferences; if (original instanceof SecureSharedPreferences) { sharedPreferences = (SecureSharedPreferences) original; } else { sharedPreferences = new SecureSharedPreferences(original, encryption); } if (SecureUtils.getVersion(sharedPreferences) < VERSION_1) { SecureUtils.migrateData(original, sharedPreferences, VERSION_1); } return sharedPreferences; }
SecureSharedPreferences sharedPreferences; if (original instanceof SecureSharedPreferences) { sharedPreferences = (SecureSharedPreferences) original; } else { sharedPreferences = new SecureSharedPreferences(original, encryption); } if (SecureUtils.getVersion(sharedPreferences) < VERSION_1) { SecureUtils.migrateData(original, sharedPreferences, VERSION_1); } return sharedPreferences; }
/** * Creates the {@link SecureSharedPreferences} instance with a given original and an {@link EncryptionAlgorithm}. * This function does a version check and the required migrations when the local structure is outdated or not encrypted yet. * @param original The original {@link SharedPreferences}, which can be also a {@link SecureSharedPreferences} instance. * @param encryption The {@link EncryptionAlgorithm} to use. * @return A {@link SecureSharedPreferences} instance. */
Creates the <code>SecureSharedPreferences</code> instance with a given original and an <code>EncryptionAlgorithm</code>. This function does a version check and the required migrations when the local structure is outdated or not encrypted yet
getPreferences
{ "repo_name": "tprochazka/android-secure-preferences", "path": "secure-preferences/src/main/java/com/github/kovmarci86/android/secure/preferences/SecureFactory.java", "license": "apache-2.0", "size": 4854 }
[ "com.github.kovmarci86.android.secure.preferences.util.SecureUtils" ]
import com.github.kovmarci86.android.secure.preferences.util.SecureUtils;
import com.github.kovmarci86.android.secure.preferences.util.*;
[ "com.github.kovmarci86" ]
com.github.kovmarci86;
74,695
private void updateWrittenBytesCounter(IoSession session) { long currentBytes = session.getWrittenBytes(); Long prevBytes = (Long) session.getAttribute("_written_bytes"); long delta; if (prevBytes == null) { delta = currentBytes; } else { delta = currentBytes - prevBytes; } session.setAttribute("_written_bytes", currentBytes); ServerTrafficCounter.incrementOutgoingCounter(delta); }
void function(IoSession session) { long currentBytes = session.getWrittenBytes(); Long prevBytes = (Long) session.getAttribute(STR); long delta; if (prevBytes == null) { delta = currentBytes; } else { delta = currentBytes - prevBytes; } session.setAttribute(STR, currentBytes); ServerTrafficCounter.incrementOutgoingCounter(delta); }
/** * Updates the system counter of written bytes. This information is used by the outgoing * bytes statistic. * * @param session the session that wrote more bytes to the socket. */
Updates the system counter of written bytes. This information is used by the outgoing bytes statistic
updateWrittenBytesCounter
{ "repo_name": "zhouluoyang/openfire", "path": "src/java/org/jivesoftware/openfire/nio/ConnectionHandler.java", "license": "apache-2.0", "size": 9943 }
[ "org.apache.mina.core.session.IoSession", "org.jivesoftware.openfire.net.ServerTrafficCounter" ]
import org.apache.mina.core.session.IoSession; import org.jivesoftware.openfire.net.ServerTrafficCounter;
import org.apache.mina.core.session.*; import org.jivesoftware.openfire.net.*;
[ "org.apache.mina", "org.jivesoftware.openfire" ]
org.apache.mina; org.jivesoftware.openfire;
101,290
public static MozuClient<com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection> getMessagesClient() throws Exception { return getMessagesClient( null); }
static MozuClient<com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection> function() throws Exception { return getMessagesClient( null); }
/** * Retrieves the messages associated with the current shopper's cart. * <p><pre><code> * MozuClient<com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection> mozuClient=GetMessagesClient(); * client.setBaseAddress(url); * client.executeRequest(); * CartChangeMessageCollection cartChangeMessageCollection = client.Result(); * </code></pre></p> * @return Mozu.Api.MozuClient <com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection> * @see com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection */
Retrieves the messages associated with the current shopper's cart. <code><code> MozuClient mozuClient=GetMessagesClient(); client.setBaseAddress(url); client.executeRequest(); CartChangeMessageCollection cartChangeMessageCollection = client.Result(); </code></code>
getMessagesClient
{ "repo_name": "bhewett/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/carts/ChangeMessageClient.java", "license": "mit", "size": 4205 }
[ "com.mozu.api.MozuClient" ]
import com.mozu.api.MozuClient;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
710,595
public TermVectorsRequest selectedFields(String... fields) { selectedFields = fields != null && fields.length != 0 ? Sets.newHashSet(fields) : null; return this; }
TermVectorsRequest function(String... fields) { selectedFields = fields != null && fields.length != 0 ? Sets.newHashSet(fields) : null; return this; }
/** * Return only term vectors for special selected fields. Returns the term * vectors for all fields if selectedFields == null */
Return only term vectors for special selected fields. Returns the term vectors for all fields if selectedFields == null
selectedFields
{ "repo_name": "jimczi/elasticsearch", "path": "core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java", "license": "apache-2.0", "size": 25369 }
[ "org.elasticsearch.common.util.set.Sets" ]
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.common.util.set.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,944,191
@FIXVersion(introduced="5.0") public void clearTriggeringInstruction() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced="5.0") void function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Sets the TriggeringInstruction component to null. */
Sets the TriggeringInstruction component to null
clearTriggeringInstruction
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/CrossOrderModificationRequestMsg.java", "license": "gpl-3.0", "size": 87836 }
[ "net.hades.fix.message.anno.FIXVersion" ]
import net.hades.fix.message.anno.FIXVersion;
import net.hades.fix.message.anno.*;
[ "net.hades.fix" ]
net.hades.fix;
1,869,145
public static void animateSlow(View target, AnimationTechniques animationTechniques) { YoYo.with(getActualTechniques(animationTechniques)).duration(SLOW).playOn(target); }
static void function(View target, AnimationTechniques animationTechniques) { YoYo.with(getActualTechniques(animationTechniques)).duration(SLOW).playOn(target); }
/** * Play animation on SLOW speed * * @param target view to play animation on * @param animationTechniques which techniques to use */
Play animation on SLOW speed
animateSlow
{ "repo_name": "benchakalaka/DrawingMagic", "path": "app/src/main/java/com/drawingmagic/utils/AnimationUtils.java", "license": "mit", "size": 12687 }
[ "android.view.View", "com.daimajia.androidanimations.library.YoYo" ]
import android.view.View; import com.daimajia.androidanimations.library.YoYo;
import android.view.*; import com.daimajia.androidanimations.library.*;
[ "android.view", "com.daimajia.androidanimations" ]
android.view; com.daimajia.androidanimations;
1,556,307
public void doHide_student_submission(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); Set t = (Set) state.getAttribute(STUDENT_LIST_SHOW_TABLE); ParameterParser params = data.getParameters(); String id = params.getString("studentId"); // remove the student id from the table t.remove(id); state.setAttribute(STUDENT_LIST_SHOW_TABLE, t); } // doHide_student_submission
void function(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); Set t = (Set) state.getAttribute(STUDENT_LIST_SHOW_TABLE); ParameterParser params = data.getParameters(); String id = params.getString(STR); t.remove(id); state.setAttribute(STUDENT_LIST_SHOW_TABLE, t); }
/** * Action is to hide the student submissions */
Action is to hide the student submissions
doHide_student_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 }
[ "java.util.Set", "org.sakaiproject.cheftool.JetspeedRunData", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.event.api.SessionState", "org.sakaiproject.util.ParameterParser" ]
import java.util.Set; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.util.ParameterParser;
import java.util.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*; import org.sakaiproject.util.*;
[ "java.util", "org.sakaiproject.cheftool", "org.sakaiproject.event", "org.sakaiproject.util" ]
java.util; org.sakaiproject.cheftool; org.sakaiproject.event; org.sakaiproject.util;
909,083
public OutputStream newOutputStream(int index) throws IOException { synchronized (DiskLruCache.this) { if (entry.currentEditor != this) { throw new IllegalStateException(); } return new FaultHidingOutputStream(new FileOutputStream(entry.getDirtyFile(index))); } }
OutputStream function(int index) throws IOException { synchronized (DiskLruCache.this) { if (entry.currentEditor != this) { throw new IllegalStateException(); } return new FaultHidingOutputStream(new FileOutputStream(entry.getDirtyFile(index))); } }
/** * Returns a new unbuffered output stream to write the value at * {@code index}. If the underlying output stream encounters errors * when writing to the filesystem, this edit will be aborted when * {@link #commit} is called. The returned output stream does not throw * IOExceptions. */
Returns a new unbuffered output stream to write the value at index. If the underlying output stream encounters errors when writing to the filesystem, this edit will be aborted when <code>#commit</code> is called. The returned output stream does not throw IOExceptions
newOutputStream
{ "repo_name": "pvkarthik87/HeyBeach", "path": "HeyBeach/app/src/main/java/com/karcompany/heybeach/cache/DiskLruCache.java", "license": "apache-2.0", "size": 33901 }
[ "java.io.FileOutputStream", "java.io.IOException", "java.io.OutputStream" ]
import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,794,852
public static StepExecutionResult wrapDispatcherException(final DispatcherException dispatcherResult) { final StepExecutionResultImpl result = new NodeDispatchStepExecutorExceptionResult(dispatcherResult, Reason.NodeDispatchFailure, dispatcherResult.getMessage()); return result; }
static StepExecutionResult function(final DispatcherException dispatcherResult) { final StepExecutionResultImpl result = new NodeDispatchStepExecutorExceptionResult(dispatcherResult, Reason.NodeDispatchFailure, dispatcherResult.getMessage()); return result; }
/** * Return a StepExecutionResult based on the DispatcherResult, that can later be extracted. * @param dispatcherResult exception result * @return step result */
Return a StepExecutionResult based on the DispatcherResult, that can later be extracted
wrapDispatcherException
{ "repo_name": "variacode/rundeck", "path": "core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/NodeDispatchStepExecutor.java", "license": "apache-2.0", "size": 10520 }
[ "com.dtolabs.rundeck.core.execution.dispatch.DispatcherException" ]
import com.dtolabs.rundeck.core.execution.dispatch.DispatcherException;
import com.dtolabs.rundeck.core.execution.dispatch.*;
[ "com.dtolabs.rundeck" ]
com.dtolabs.rundeck;
2,562,666
public PooledObjectFactory<T> getFactory() { return factory; } /** * Equivalent to <code>{@link #borrowObject(long) * borrowObject}({@link #getMaxWaitMillis()})</code>. * <p> * {@inheritDoc}
PooledObjectFactory<T> function() { return factory; } /** * Equivalent to <code>{@link #borrowObject(long) * borrowObject}({@link #getMaxWaitMillis()})</code>. * <p> * {@inheritDoc}
/** * Obtain a reference to the factory used to create, destroy and validate * the objects used by this pool. * * @return the factory */
Obtain a reference to the factory used to create, destroy and validate the objects used by this pool
getFactory
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/tomcat/dbcp/pool2/impl/GenericObjectPool.java", "license": "apache-2.0", "size": 45847 }
[ "org.apache.tomcat.dbcp.pool2.PooledObjectFactory" ]
import org.apache.tomcat.dbcp.pool2.PooledObjectFactory;
import org.apache.tomcat.dbcp.pool2.*;
[ "org.apache.tomcat" ]
org.apache.tomcat;
1,638,670
private int findInPageStack(@Nullable final ConversationContext cc, @NonNull final Class< ? extends UrlPage> clz, @Nullable final IPageParameters papa) throws Exception { // if(cc == null) FIXME jal 20090824 Revisit: this is questionable; why can it be null? Has code path from UIGoto-> handleGoto. // throw new IllegalStateException("The conversation cannot be empty here."); for(int ix = m_shelvedPageStack.size(); --ix >= 0;) { IShelvedEntry se = m_shelvedPageStack.get(ix); if(se instanceof ShelvedDomUIPage) { ShelvedDomUIPage sdp = (ShelvedDomUIPage) se; if(!sdp.getPage().getBody().getClass().getName().equals(clz.getName())) // Of the appropriate type? continue; // No -> not acceptable if(cc != null && cc != sdp.getPage().getConversation()) // Is in the conversation supplied? continue; // No -> not acceptable //-- Page AND context are acceptable; check parameters; if(papa == null) // AJAX request -> page acceptable return ix; if(papa.equals(sdp.getPage().getPageParameters())) // New page request -> acceptable if same parameters. return ix; } } return -1; // Nothing acceptable }
int function(@Nullable final ConversationContext cc, @NonNull final Class< ? extends UrlPage> clz, @Nullable final IPageParameters papa) throws Exception { for(int ix = m_shelvedPageStack.size(); --ix >= 0;) { IShelvedEntry se = m_shelvedPageStack.get(ix); if(se instanceof ShelvedDomUIPage) { ShelvedDomUIPage sdp = (ShelvedDomUIPage) se; if(!sdp.getPage().getBody().getClass().getName().equals(clz.getName())) continue; if(cc != null && cc != sdp.getPage().getConversation()) continue; if(papa == null) return ix; if(papa.equals(sdp.getPage().getPageParameters())) return ix; } } return -1; }
/** * Check to see if we can use a page stack entry. */
Check to see if we can use a page stack entry
findInPageStack
{ "repo_name": "fjalvingh/domui", "path": "to.etc.domui/src/main/java/to/etc/domui/state/WindowSession.java", "license": "lgpl-2.1", "size": 39917 }
[ "org.eclipse.jdt.annotation.NonNull", "org.eclipse.jdt.annotation.Nullable", "to.etc.domui.dom.html.UrlPage" ]
import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import to.etc.domui.dom.html.UrlPage;
import org.eclipse.jdt.annotation.*; import to.etc.domui.dom.html.*;
[ "org.eclipse.jdt", "to.etc.domui" ]
org.eclipse.jdt; to.etc.domui;
1,698,892
private void updateAccountAuthentication() throws AccountNotFoundException { Bundle response = new Bundle(); response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name); response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type); if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()). equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); // the next line is necessary, notifications are calling directly to the // AuthenticatorActivity to update, without AccountManager intervention mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()). equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); // the next line is necessary; by now, notifications are calling directly to the // AuthenticatorActivity to update, without AccountManager intervention mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); } else { response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString()); mAccountMgr.setPassword(mAccount, mPasswordInput.getText().toString()); } setAccountAuthenticatorResult(response); }
void function() throws AccountNotFoundException { Bundle response = new Bundle(); response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name); response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type); if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()). equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); } else if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()). equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); } else { response.putString(AccountManager.KEY_AUTHTOKEN, mPasswordInput.getText().toString()); mAccountMgr.setPassword(mAccount, mPasswordInput.getText().toString()); } setAccountAuthenticatorResult(response); }
/** * Updates the authentication token. * * Sets the proper response so that the AccountAuthenticator that started this activity * saves a new authorization token for mAccount. * * Kills the session kept by OwnCloudClientManager so that a new one will created with * the new credentials when needed. */
Updates the authentication token. Sets the proper response so that the AccountAuthenticator that started this activity saves a new authorization token for mAccount. Kills the session kept by OwnCloudClientManager so that a new one will created with the new credentials when needed
updateAccountAuthentication
{ "repo_name": "Spacefish/android", "path": "src/com/owncloud/android/authentication/AuthenticatorActivity.java", "license": "gpl-2.0", "size": 75336 }
[ "android.accounts.AccountManager", "android.os.Bundle", "com.owncloud.android.MainApp", "com.owncloud.android.lib.common.accounts.AccountTypeUtils", "com.owncloud.android.lib.common.accounts.AccountUtils" ]
import android.accounts.AccountManager; import android.os.Bundle; import com.owncloud.android.MainApp; import com.owncloud.android.lib.common.accounts.AccountTypeUtils; import com.owncloud.android.lib.common.accounts.AccountUtils;
import android.accounts.*; import android.os.*; import com.owncloud.android.*; import com.owncloud.android.lib.common.accounts.*;
[ "android.accounts", "android.os", "com.owncloud.android" ]
android.accounts; android.os; com.owncloud.android;
991,797
@Override public PlanTimelineViewer getViewer() { return (PlanTimelineViewer) super.getViewer(); }
PlanTimelineViewer function() { return (PlanTimelineViewer) super.getViewer(); }
/** * Convenience method to retrieve the casted viewer. */
Convenience method to retrieve the casted viewer
getViewer
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.arc.spife.core.plan.editor.timeline/src/gov/nasa/arc/spife/core/plan/editor/timeline/parts/PlanElementRowEditPart.java", "license": "apache-2.0", "size": 6552 }
[ "gov.nasa.arc.spife.core.plan.editor.timeline.PlanTimelineViewer" ]
import gov.nasa.arc.spife.core.plan.editor.timeline.PlanTimelineViewer;
import gov.nasa.arc.spife.core.plan.editor.timeline.*;
[ "gov.nasa.arc" ]
gov.nasa.arc;
1,525,476
private void run() throws IOException { log.info("Checking index of workspace " + handler.getContext().getWorkspace()); loadNodes(); if (nodeIds != null) { checkIndexConsistency(); checkIndexCompleteness(); } }
void function() throws IOException { log.info(STR + handler.getContext().getWorkspace()); loadNodes(); if (nodeIds != null) { checkIndexConsistency(); checkIndexCompleteness(); } }
/** * Runs the consistency check. * @throws IOException if an error occurs while running the check. */
Runs the consistency check
run
{ "repo_name": "Kast0rTr0y/jackrabbit", "path": "jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ConsistencyCheck.java", "license": "apache-2.0", "size": 28745 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
233,711
public SubFundGroup getByChartAndAccount(String chartCode, String accountNumber);
SubFundGroup function(String chartCode, String accountNumber);
/** * Retrieves the SubFundGroupCode for the Account with the given chart and account codes. * * @param chartCode * @param accountNumber * @return the sub fund group specified by a chart and and account number */
Retrieves the SubFundGroupCode for the Account with the given chart and account codes
getByChartAndAccount
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-core/src/main/java/org/kuali/kfs/coa/service/SubFundGroupService.java", "license": "agpl-3.0", "size": 3003 }
[ "org.kuali.kfs.coa.businessobject.SubFundGroup" ]
import org.kuali.kfs.coa.businessobject.SubFundGroup;
import org.kuali.kfs.coa.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,425,149
public void testEmptySchemaLocation() { testDefine(new StreamSource(FILE_PROTOCOL + USER_DIR + "/org/eclipse/persistence/testing/sdo/helper/xsdhelper/generate/Cyclic3.xsd"), new CyclicSchemaResolver()); }
void function() { testDefine(new StreamSource(FILE_PROTOCOL + USER_DIR + STR), new CyclicSchemaResolver()); }
/** * Success case - DefaultSchemaResolver subclass CyclicSchemaResolver should handle * the empty schema location and return the correct schema source based on the namespace * in the include/import statement */
Success case - DefaultSchemaResolver subclass CyclicSchemaResolver should handle the empty schema location and return the correct schema source based on the namespace in the include/import statement
testEmptySchemaLocation
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "sdo/eclipselink.sdo.test/src/org/eclipse/persistence/testing/sdo/helper/xsdhelper/define/CyclicImportsDefineTestCases.java", "license": "epl-1.0", "size": 10695 }
[ "javax.xml.transform.stream.StreamSource" ]
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.*;
[ "javax.xml" ]
javax.xml;
2,759,505
if(script == null) return Response.status(Status.BAD_REQUEST).build(); ROperationWithResult rop = new RScriptROperation(script); if(async && rSession instanceof RASyncOperationTemplate) { String id = ((RASyncOperationTemplate)rSession).executeAsync(rop); return Response.ok().entity(id).type(MediaType.TEXT_PLAIN_TYPE).build(); } else { rSession.execute(rop); if(rop.hasResult() && rop.hasRawResult()) { return Response.ok().entity(rop.getRawResult().asBytes()).build(); } log.error("R Script '{}' has result: {}, has raw result: {}", script, rop.hasResult(), rop.hasRawResult()); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }
if(script == null) return Response.status(Status.BAD_REQUEST).build(); ROperationWithResult rop = new RScriptROperation(script); if(async && rSession instanceof RASyncOperationTemplate) { String id = ((RASyncOperationTemplate)rSession).executeAsync(rop); return Response.ok().entity(id).type(MediaType.TEXT_PLAIN_TYPE).build(); } else { rSession.execute(rop); if(rop.hasResult() && rop.hasRawResult()) { return Response.ok().entity(rop.getRawResult().asBytes()).build(); } log.error(STR, script, rop.hasResult(), rop.hasRawResult()); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }
/** * Executes a R script and set the REXP result in its serialized form in the Response. * * @param script * @return */
Executes a R script and set the REXP result in its serialized form in the Response
executeScript
{ "repo_name": "apruden/opal", "path": "opal-r/src/main/java/org/obiba/opal/web/r/AbstractOpalRSessionResource.java", "license": "gpl-3.0", "size": 2160 }
[ "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.obiba.opal.r.RASyncOperationTemplate", "org.obiba.opal.r.ROperationWithResult", "org.obiba.opal.r.RScriptROperation" ]
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.obiba.opal.r.RASyncOperationTemplate; import org.obiba.opal.r.ROperationWithResult; import org.obiba.opal.r.RScriptROperation;
import javax.ws.rs.core.*; import org.obiba.opal.r.*;
[ "javax.ws", "org.obiba.opal" ]
javax.ws; org.obiba.opal;
2,675,320
public Builder addBillingProvider(@NonNull final BillingProvider provider) { providers.add(provider); return this; }
Builder function(@NonNull final BillingProvider provider) { providers.add(provider); return this; }
/** * Adds supported billing provider. * <p> * During setup process billing providers will be considered in the order they were added. * * @param provider BillingProvider object to add. * * @return this object. */
Adds supported billing provider. During setup process billing providers will be considered in the order they were added
addBillingProvider
{ "repo_name": "onepf/OPFIab", "path": "opfiab/src/main/java/org/onepf/opfiab/model/Configuration.java", "license": "apache-2.0", "size": 5114 }
[ "android.support.annotation.NonNull", "org.onepf.opfiab.billing.BillingProvider" ]
import android.support.annotation.NonNull; import org.onepf.opfiab.billing.BillingProvider;
import android.support.annotation.*; import org.onepf.opfiab.billing.*;
[ "android.support", "org.onepf.opfiab" ]
android.support; org.onepf.opfiab;
2,309,719
public static boolean regionMatches(boolean ignoreCase, Segment text, int offset, char[] match) { int length = offset + match.length; char[] textArray = text.array; if(length > text.offset + text.count) return false; for(int i = offset, j = 0; i < length; i++, j++) { char c1 = textArray[i]; char c2 = match[j]; if(ignoreCase) { c1 = Character.toUpperCase(c1); c2 = Character.toUpperCase(c2); } if(c1 != c2) return false; } return true; }
static boolean function(boolean ignoreCase, Segment text, int offset, char[] match) { int length = offset + match.length; char[] textArray = text.array; if(length > text.offset + text.count) return false; for(int i = offset, j = 0; i < length; i++, j++) { char c1 = textArray[i]; char c2 = match[j]; if(ignoreCase) { c1 = Character.toUpperCase(c1); c2 = Character.toUpperCase(c2); } if(c1 != c2) return false; } return true; }
/** * Checks if a subregion of a <code>Segment</code> is equal to a * character array. * @param ignoreCase True if case should be ignored, false otherwise * @param text The segment * @param offset The offset into the segment * @param match The character array to match */
Checks if a subregion of a <code>Segment</code> is equal to a character array
regionMatches
{ "repo_name": "makerbot/ReplicatorG", "path": "src/replicatorg/app/syntax/SyntaxUtilities.java", "license": "gpl-2.0", "size": 5203 }
[ "javax.swing.text.Segment" ]
import javax.swing.text.Segment;
import javax.swing.text.*;
[ "javax.swing" ]
javax.swing;
920,768
return AccessController.doPrivileged(GetTcclAction.INSTANCE); }
return AccessController.doPrivileged(GetTcclAction.INSTANCE); }
/** * Obtains the Thread Context ClassLoader */
Obtains the Thread Context ClassLoader
getThreadContextClassLoader
{ "repo_name": "rhusar/arquillian-core", "path": "container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/SecurityActions.java", "license": "apache-2.0", "size": 13027 }
[ "java.security.AccessController" ]
import java.security.AccessController;
import java.security.*;
[ "java.security" ]
java.security;
1,993,699
public Object readObject () throws IOException, ClassNotFoundException { try { // read the class mapping ClassMapping cmap = readClassMapping(); if (cmap == null) { if (STREAM_DEBUG) { log.info(hashCode() + ": Read null."); } return null; } if (STREAM_DEBUG) { log.info(hashCode() + ": Reading with " + cmap.streamer + "."); } // create an instance of the appropriate object Object target = cmap.streamer.createObject(this); readBareObject(target, cmap.streamer, true); return target; } catch (OutOfMemoryError oome) { throw (IOException)new IOException("Malformed object data").initCause(oome); } }
Object function () throws IOException, ClassNotFoundException { try { ClassMapping cmap = readClassMapping(); if (cmap == null) { if (STREAM_DEBUG) { log.info(hashCode() + STR); } return null; } if (STREAM_DEBUG) { log.info(hashCode() + STR + cmap.streamer + "."); } Object target = cmap.streamer.createObject(this); readBareObject(target, cmap.streamer, true); return target; } catch (OutOfMemoryError oome) { throw (IOException)new IOException(STR).initCause(oome); } }
/** * Reads a {@link Streamable} instance or one of the supported object types from the input * stream. */
Reads a <code>Streamable</code> instance or one of the supported object types from the input stream
readObject
{ "repo_name": "threerings/narya", "path": "core/src/main/java/com/threerings/io/ObjectInputStream.java", "license": "lgpl-2.1", "size": 11753 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,115,298
@ServiceMethod(returns = ReturnType.SINGLE) void start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs);
@ServiceMethod(returns = ReturnType.SINGLE) void start(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs);
/** * Starts one or more virtual machines in a VM scale set. * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the VM scale set. * @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Starts one or more virtual machines in a VM scale set
start
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachineScaleSetsClient.java", "license": "mit", "size": 129320 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceIDs" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceIDs;
import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
445,815
@Nonnull @CheckReturnValue StageInstanceAction setTopic(@Nonnull String topic); /** * Sets the {@link net.dv8tion.jda.api.entities.StageInstance.PrivacyLevel PrivacyLevel} for the stage instance. * <br>This indicates whether guild lurkers are allowed to join the stage instance or only guild members. * * @param level * The {@link net.dv8tion.jda.api.entities.StageInstance.PrivacyLevel}
StageInstanceAction setTopic(@Nonnull String topic); /** * Sets the {@link net.dv8tion.jda.api.entities.StageInstance.PrivacyLevel PrivacyLevel} for the stage instance. * <br>This indicates whether guild lurkers are allowed to join the stage instance or only guild members. * * @param level * The {@link net.dv8tion.jda.api.entities.StageInstance.PrivacyLevel}
/** * Sets the topic for the stage instance. * <br>This shows up in stage discovery and in the stage view. * * @param topic * The topic, must be 1-120 characters long * * @throws IllegalArgumentException * If the topic is null, empty, or longer than 120 characters * * @return The StageInstanceAction for chaining */
Sets the topic for the stage instance. This shows up in stage discovery and in the stage view
setTopic
{ "repo_name": "DV8FromTheWorld/JDA", "path": "src/main/java/net/dv8tion/jda/api/requests/restaction/StageInstanceAction.java", "license": "apache-2.0", "size": 2831 }
[ "javax.annotation.Nonnull", "net.dv8tion.jda.api.entities.StageInstance" ]
import javax.annotation.Nonnull; import net.dv8tion.jda.api.entities.StageInstance;
import javax.annotation.*; import net.dv8tion.jda.api.entities.*;
[ "javax.annotation", "net.dv8tion.jda" ]
javax.annotation; net.dv8tion.jda;
2,706,448
private void beginRecordingAudio() throws IOException { if (m_recorder != null) m_recorder.release(); //set up the media recorder to record mp4s m_recorder = new MediaRecorder(); m_recorder.setAudioSource(MediaRecorder.AudioSource.MIC); m_recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); m_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); //If the date is 12/14/17 and the time is 2:14 pm, the fileName will read: /20171214_141422.mp4 String fileName = "/" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(Calendar.getInstance().getTime()) + ".mp4"; m_audioRecordingFiles.add(getFilesDir()+fileName); m_recorder.setOutputFile(m_audioRecordingFiles.get(m_audioRecordingFiles.size() - 1)); m_recorder.prepare(); // Recording is now started m_recorder.start(); }
void function() throws IOException { if (m_recorder != null) m_recorder.release(); m_recorder = new MediaRecorder(); m_recorder.setAudioSource(MediaRecorder.AudioSource.MIC); m_recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); m_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); String fileName = "/" + new SimpleDateFormat(STR).format(Calendar.getInstance().getTime()) + ".mp4"; m_audioRecordingFiles.add(getFilesDir()+fileName); m_recorder.setOutputFile(m_audioRecordingFiles.get(m_audioRecordingFiles.size() - 1)); m_recorder.prepare(); m_recorder.start(); }
/** * Begins recording a .mp4 audio file and saves it to internal storage on the device. * @throws IOException if the media recorder isn't set up properly. */
Begins recording a .mp4 audio file and saves it to internal storage on the device
beginRecordingAudio
{ "repo_name": "mattdelfante/ClassHub", "path": "ClassHub/app/src/main/java/com/delware/classhub/Activities/RecordAudioActivity.java", "license": "mit", "size": 16672 }
[ "android.media.MediaRecorder", "java.io.IOException", "java.text.SimpleDateFormat", "java.util.Calendar" ]
import android.media.MediaRecorder; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar;
import android.media.*; import java.io.*; import java.text.*; import java.util.*;
[ "android.media", "java.io", "java.text", "java.util" ]
android.media; java.io; java.text; java.util;
770,376
static void setCladeAbove(PhyloTreeTri tree, Node node) { Vector<Node> sons = tree.getSons(node); Vector<Node> aboveNode = tree.getCladeNodeAbove(node); for (Node nodeSon : sons) { Iterator<Node> nodeIt2 = sons.iterator(); Vector<Node> tempAboveSon = new Vector<>(); while (nodeIt2.hasNext()) { Node nodeSon2 = nodeIt2.next(); if (nodeSon2 != nodeSon) { tempAboveSon.addAll(tree.getCladeNode(nodeSon2)); } } tempAboveSon.addAll(aboveNode); tree.setCladeNodeAbove(nodeSon, tempAboveSon); setCladeAbove(tree, nodeSon); } }
static void setCladeAbove(PhyloTreeTri tree, Node node) { Vector<Node> sons = tree.getSons(node); Vector<Node> aboveNode = tree.getCladeNodeAbove(node); for (Node nodeSon : sons) { Iterator<Node> nodeIt2 = sons.iterator(); Vector<Node> tempAboveSon = new Vector<>(); while (nodeIt2.hasNext()) { Node nodeSon2 = nodeIt2.next(); if (nodeSon2 != nodeSon) { tempAboveSon.addAll(tree.getCladeNode(nodeSon2)); } } tempAboveSon.addAll(aboveNode); tree.setCladeNodeAbove(nodeSon, tempAboveSon); setCladeAbove(tree, nodeSon); } }
/** * this function associates to the node v the "clade" above (it updates nodesToCladeAbove) */
this function associates to the node v the "clade" above (it updates nodesToCladeAbove)
setCladeAbove
{ "repo_name": "danielhuson/dendroscope3", "path": "src/dendroscope/tripletMethods/TripletUtils.java", "license": "gpl-3.0", "size": 6595 }
[ "java.util.Iterator", "java.util.Vector" ]
import java.util.Iterator; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,284,806
protected void stop(PrintWriter writer, String path) { if (debug >= 1) log("stop: Stopping web application at '" + path + "'"); if ((path == null) || (!path.startsWith("/") && path.equals(""))) { writer.println(sm.getString("managerServlet.invalidPath", RequestUtil.filter(path))); return; } String displayPath = path; if( path.equals("/") ) path = ""; try { Context context = (Context) host.findChild(path); if (context == null) { writer.println(sm.getString("managerServlet.noContext", RequestUtil.filter(displayPath))); return; } // It isn't possible for the manager to stop itself if (context.getPath().equals(this.context.getPath())) { writer.println(sm.getString("managerServlet.noSelf")); return; } ((Lifecycle) context).stop(); writer.println(sm.getString("managerServlet.stopped", displayPath)); } catch (Throwable t) { log("ManagerServlet.stop[" + displayPath + "]", t); writer.println(sm.getString("managerServlet.exception", t.toString())); } }
void function(PrintWriter writer, String path) { if (debug >= 1) log(STR + path + "'"); if ((path == null) (!path.startsWith("/") && path.equals(STRmanagerServlet.invalidPathSTR/STRSTRmanagerServlet.noContextSTRmanagerServlet.noSelfSTRmanagerServlet.stoppedSTRManagerServlet.stop[STR]STRmanagerServlet.exception", t.toString())); } }
/** * Stop the web application at the specified context path. * * @param writer Writer to render to * @param path Context path of the application to be stopped */
Stop the web application at the specified context path
stop
{ "repo_name": "yuyupapa/OpenSource", "path": "apache-tomcat-6.0.48/java/org/apache/catalina/manager/ManagerServlet.java", "license": "apache-2.0", "size": 61689 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,744,568
public View getInternalMainCardLayout() { return mInternalMainCardLayout; }
View function() { return mInternalMainCardLayout; }
/** * Retrieves the InternalMainCardGlobalLayout. * Background style is applied here. * * @return */
Retrieves the InternalMainCardGlobalLayout. Background style is applied here
getInternalMainCardLayout
{ "repo_name": "tajchert/CEEHack", "path": "cardslib/library/src/main/src/it/gmariotti/cardslib/library/view/CardView.java", "license": "apache-2.0", "size": 31590 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,757,699
private void tokenize(InputSource is) throws SAXException, IOException, MalformedURLException { if (is == null) { throw new IllegalArgumentException("Null input."); } if (is.getByteStream() == null && is.getCharacterStream() == null) { String systemId = is.getSystemId(); if (systemId == null) { throw new IllegalArgumentException( "No byte stream, no character stream nor URI."); } if (entityResolver != null) { is = entityResolver.resolveEntity(is.getPublicId(), systemId); } if (is.getByteStream() == null || is.getCharacterStream() == null) { is = new InputSource(); is.setSystemId(systemId); is.setByteStream(new URL(systemId).openStream()); } } if (driver == null) lazyInit(); driver.tokenize(is); }
void function(InputSource is) throws SAXException, IOException, MalformedURLException { if (is == null) { throw new IllegalArgumentException(STR); } if (is.getByteStream() == null && is.getCharacterStream() == null) { String systemId = is.getSystemId(); if (systemId == null) { throw new IllegalArgumentException( STR); } if (entityResolver != null) { is = entityResolver.resolveEntity(is.getPublicId(), systemId); } if (is.getByteStream() == null is.getCharacterStream() == null) { is = new InputSource(); is.setSystemId(systemId); is.setByteStream(new URL(systemId).openStream()); } } if (driver == null) lazyInit(); driver.tokenize(is); }
/** * Tokenizes the input source. * * @param is the source * @throws SAXException if stuff goes wrong * @throws IOException if IO goes wrong * @throws MalformedURLException if the system ID is malformed and the entity resolver is <code>null</code> */
Tokenizes the input source
tokenize
{ "repo_name": "anarcheuz/Funny-school-projects", "path": "WebSemantic/src/htmlparser-1.4/src/nu/validator/htmlparser/dom/HtmlDocumentBuilder.java", "license": "mit", "size": 24436 }
[ "java.io.IOException", "java.net.MalformedURLException", "org.xml.sax.InputSource", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.net.MalformedURLException; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
import java.io.*; import java.net.*; import org.xml.sax.*;
[ "java.io", "java.net", "org.xml.sax" ]
java.io; java.net; org.xml.sax;
1,653,800
if (unit == null) { throw new NullPointerException("Null 'unit' argument."); } this.tickUnits.add(unit); Collections.sort(this.tickUnits); }
if (unit == null) { throw new NullPointerException(STR); } this.tickUnits.add(unit); Collections.sort(this.tickUnits); }
/** * Adds a tick unit to the collection. The tick units are maintained in * ascending order. * * @param unit the tick unit to add (<code>null</code> not permitted). */
Adds a tick unit to the collection. The tick units are maintained in ascending order
add
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/chart/axis/TickUnits.java", "license": "gpl-2.0", "size": 6697 }
[ "java.util.Collections" ]
import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
262,793
ConfigurationContextBuilder removePropertySources(Predicate<PropertySource> selector);
ConfigurationContextBuilder removePropertySources(Predicate<PropertySource> selector);
/** * Remove the property sources selected by the given selector predicate. * * @param selector the selector query, not null. * @return this builder, for chaining, never null. */
Remove the property sources selected by the given selector predicate
removePropertySources
{ "repo_name": "syzer/incubator-tamaya", "path": "java8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java", "license": "apache-2.0", "size": 8313 }
[ "java.util.function.Predicate" ]
import java.util.function.Predicate;
import java.util.function.*;
[ "java.util" ]
java.util;
2,260,537
public MockMvcRequestSpecBuilder addHeaders(Map<String, String> headers) { spec.headers(headers); return this; }
MockMvcRequestSpecBuilder function(Map<String, String> headers) { spec.headers(headers); return this; }
/** * Add headers to be sent with the request as Map. * * @param headers The Map containing the header names and their values to send with the request. * @return The request specification builder */
Add headers to be sent with the request as Map
addHeaders
{ "repo_name": "camunda-third-party/rest-assured", "path": "modules/spring-mock-mvc/src/main/java/com/jayway/restassured/module/mockmvc/specification/MockMvcRequestSpecBuilder.java", "license": "apache-2.0", "size": 24742 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,785,954
public synchronized void connect(BluetoothDevice device) { if (D) Log.d(TAG, "connect to: " + device); // Cancel any thread attempting to make a connection if (mState == STATE_CONNECTING) { if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;} } // Cancel any thread currently running a connection if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;} // Start the thread to connect with the given device mConnectThread = new ConnectThread(device); mConnectThread.start(); setState(STATE_CONNECTING);//正在连接 } private class ConnectThread extends Thread { private final BluetoothSocket mmSocket; private final BluetoothDevice mmDevice; public ConnectThread(BluetoothDevice device) { mmDevice = device; BluetoothSocket tmp = null; // Get a BluetoothSocket for a connection with the // given BluetoothDevice try { tmp = device.createRfcommSocketToServiceRecord(MY_UUID); } catch (IOException e) { Log.e(TAG, "create() failed", e); } mmSocket = tmp; }
synchronized void function(BluetoothDevice device) { if (D) Log.d(TAG, STR + device); if (mState == STATE_CONNECTING) { if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;} } if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;} mConnectThread = new ConnectThread(device); mConnectThread.start(); setState(STATE_CONNECTING); } private class ConnectThread extends Thread { private final BluetoothSocket mmSocket; private final BluetoothDevice mmDevice; public ConnectThread(BluetoothDevice device) { mmDevice = device; BluetoothSocket tmp = null; try { tmp = device.createRfcommSocketToServiceRecord(MY_UUID); } catch (IOException e) { Log.e(TAG, STR, e); } mmSocket = tmp; }
/** * Start the ConnectThread to initiate a connection to a remote device. * @param device The BluetoothDevice to connect */
Start the ConnectThread to initiate a connection to a remote device
connect
{ "repo_name": "lyc-changeworld/SignInAssistant", "path": "app/src/main/java/com/example/achuan/bombtest/ui/bluetooth/BluetoothChatService.java", "license": "apache-2.0", "size": 20042 }
[ "android.bluetooth.BluetoothDevice", "android.bluetooth.BluetoothSocket", "android.util.Log", "java.io.IOException" ]
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.util.Log; import java.io.IOException;
import android.bluetooth.*; import android.util.*; import java.io.*;
[ "android.bluetooth", "android.util", "java.io" ]
android.bluetooth; android.util; java.io;
1,094,148
public Digest getDigest() { return digest; }
Digest function() { return digest; }
/** * Gets the underlying object that performs digest computation. * * @return Digest instance. */
Gets the underlying object that performs digest computation
getDigest
{ "repo_name": "vdemeester/vt-crypt-tests", "path": "src/main/java/edu/vt/middleware/crypt/digest/DigestAlgorithm.java", "license": "apache-2.0", "size": 6765 }
[ "org.bouncycastle.crypto.Digest" ]
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.*;
[ "org.bouncycastle.crypto" ]
org.bouncycastle.crypto;
309,510
public static MacVlan getMappedHost(VirtualNodePath vpath) { MacVlan mv = null; if (vpath != null) { BridgeMapInfo bmi = vpath.getAugmentation(BridgeMapInfo.class); if (bmi != null) { Long host = bmi.getMacMappedHost(); if (host != null) { mv = new MacVlan(host.longValue()); } } } return mv; } public MacMapHostIdentifier(VnodeName tname, VnodeName bname, MacVlan mvlan) { super(tname, bname); mappedHost = mvlan; } public MacMapHostIdentifier(MacMapIdentifier mapId, MacVlan mvlan) { super(mapId.getTenantName(), mapId.getBridgeName()); mappedHost = mvlan; } MacMapHostIdentifier(String[] comps) { super(comps[0], comps[1]); mappedHost = new MacVlan(Long.parseLong(comps[2])); }
static MacVlan function(VirtualNodePath vpath) { MacVlan mv = null; if (vpath != null) { BridgeMapInfo bmi = vpath.getAugmentation(BridgeMapInfo.class); if (bmi != null) { Long host = bmi.getMacMappedHost(); if (host != null) { mv = new MacVlan(host.longValue()); } } } return mv; } public MacMapHostIdentifier(VnodeName tname, VnodeName bname, MacVlan mvlan) { super(tname, bname); mappedHost = mvlan; } public MacMapHostIdentifier(MacMapIdentifier mapId, MacVlan mvlan) { super(mapId.getTenantName(), mapId.getBridgeName()); mappedHost = mvlan; } MacMapHostIdentifier(String[] comps) { super(comps[0], comps[1]); mappedHost = new MacVlan(Long.parseLong(comps[2])); }
/** * Return the L2 host mapped by the MAC mapping configured in the * specified virtual-node-path. * * @param vpath A {@link VirtualNodePath} instance that specifies the * virtual node. * @return A {@link MacVlan} instance if {@code vpath} specifies the * host mapped by MAC mapping. {@code null} otherwise}. */
Return the L2 host mapped by the MAC mapping configured in the specified virtual-node-path
getMappedHost
{ "repo_name": "opendaylight/vtn", "path": "manager/implementation/src/main/java/org/opendaylight/vtn/manager/internal/util/vnode/MacMapHostIdentifier.java", "license": "epl-1.0", "size": 6724 }
[ "org.opendaylight.vtn.manager.internal.util.inventory.MacVlan", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.rev150410.virtual.route.info.VirtualNodePath", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.flow.rev150313.BridgeMapInfo", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName" ]
import org.opendaylight.vtn.manager.internal.util.inventory.MacVlan; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.rev150410.virtual.route.info.VirtualNodePath; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.flow.rev150313.BridgeMapInfo; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName;
import org.opendaylight.vtn.manager.internal.util.inventory.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.flow.rev150410.virtual.route.info.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.flow.rev150313.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.*;
[ "org.opendaylight.vtn", "org.opendaylight.yang" ]
org.opendaylight.vtn; org.opendaylight.yang;
2,805,323
private static void addWhitespaceTests(List<TestData> data) { final String pad = " "; final String line0 = "var a = 3"; final String line1 = pad + line0 + pad; final String line2 = pad + "var b = 4;" + pad;
static void function(List<TestData> data) { final String pad = " "; final String line0 = STR; final String line1 = pad + line0 + pad; final String line2 = pad + STR + pad;
/** * Whitespace characters before and after two variable declarations, testing the exact column * offset */
Whitespace characters before and after two variable declarations, testing the exact column offset
addWhitespaceTests
{ "repo_name": "HtmlUnit/htmlunit-rhino-fork", "path": "testsrc/org/mozilla/javascript/tests/Bug789277Test.java", "license": "mpl-2.0", "size": 26571 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,845,948
RegistryCredentials getCredentials();
RegistryCredentials getCredentials();
/** * Credentials for login into registry for docker service. * @return */
Credentials for login into registry for docker service
getCredentials
{ "repo_name": "codeabovelab/haven-platform", "path": "cluster-manager/src/main/java/com/codeabovelab/dm/cluman/cluster/registry/RegistryService.java", "license": "apache-2.0", "size": 3241 }
[ "com.codeabovelab.dm.cluman.cluster.registry.model.RegistryCredentials" ]
import com.codeabovelab.dm.cluman.cluster.registry.model.RegistryCredentials;
import com.codeabovelab.dm.cluman.cluster.registry.model.*;
[ "com.codeabovelab.dm" ]
com.codeabovelab.dm;
1,536,369
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<SharesSetPropertiesResponse> setPropertiesWithResponseAsync( String shareName, Integer timeout, Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, Context context) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; return service.setProperties( this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<SharesSetPropertiesResponse> function( String shareName, Integer timeout, Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, Context context) { final String restype = "share"; final String comp = STR; final String accept = STR; return service.setProperties( this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, accept, context); }
/** * Sets properties for the specified share. * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN"&gt;Setting * Timeouts for File Service Operations.&lt;/a&gt;. * @param quota Specifies the maximum size of the share, in gigabytes. * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Sets properties for the specified share
setPropertiesWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java", "license": "mit", "size": 51155 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.storage.file.share.implementation.models.SharesSetPropertiesResponse", "com.azure.storage.file.share.models.ShareAccessTier", "com.azure.storage.file.share.models.ShareRootSquash" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.storage.file.share.implementation.models.SharesSetPropertiesResponse; import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareRootSquash;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.storage.file.share.implementation.models.*; import com.azure.storage.file.share.models.*;
[ "com.azure.core", "com.azure.storage" ]
com.azure.core; com.azure.storage;
2,445,502
@Override @Test @BMRules(rules = { @BMRule(name = "test logAll EVENT", targetClass = "org.jboss.logging.Logger", targetMethod = "logv", targetLocation = "ENTRY", action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) public void testLogAll() throws Exception { //initial plugin ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_ALL_EVENTS); activeMQServer.start(); try { sendAndReceive(true, true, "log ALL Message_1", 0); sendAndReceive(true, true, "log ALL Message_2", 0); Thread.sleep(500); for (String logline : unexpectedLogs) { log.debug(" others events logged >>>>" + logline); } assertEquals("created connections", 2, createdConnectionLogs.size()); assertEquals("destroyed connections", 2, destroyedConnectionLogs.size()); //assertEquals("created sessions", 0, createdSessionLogs.size()); //assertEquals("closed sessions", 0, createdSessionLogs.size()); assertEquals("created consumer", 2, createdConsumerLogs.size()); assertEquals("closed consumer", 2, closedConsumerLogs.size()); assertEquals("delivered message", 2, deliveredLogs.size()); assertEquals("acked message", 2, ackedLogs.size()); assertEquals("sending message", 2, sentLogs.size()); assertEquals("routing message", 2, routedLogs.size()); assertEquals("queue created", 1, createdQueueLogs.size()); assertEquals("queue destroyed", 0, destroyedQueueLogs.size()); assertEquals("expired message", 0, messageExpiredLogs.size()); } finally { activeMQServer.stop(); //reset the logs lists clearLogLists(); } }
@BMRules(rules = { @BMRule(name = STR, targetClass = STR, targetMethod = "logv", targetLocation = "ENTRY", action = STR)}) void function() throws Exception { ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_ALL_EVENTS); activeMQServer.start(); try { sendAndReceive(true, true, STR, 0); sendAndReceive(true, true, STR, 0); Thread.sleep(500); for (String logline : unexpectedLogs) { log.debug(STR + logline); } assertEquals(STR, 2, createdConnectionLogs.size()); assertEquals(STR, 2, destroyedConnectionLogs.size()); assertEquals(STR, 2, createdConsumerLogs.size()); assertEquals(STR, 2, closedConsumerLogs.size()); assertEquals(STR, 2, deliveredLogs.size()); assertEquals(STR, 2, ackedLogs.size()); assertEquals(STR, 2, sentLogs.size()); assertEquals(STR, 2, routedLogs.size()); assertEquals(STR, 1, createdQueueLogs.size()); assertEquals(STR, 0, destroyedQueueLogs.size()); assertEquals(STR, 0, messageExpiredLogs.size()); } finally { activeMQServer.stop(); clearLogLists(); } }
/** * Aim: test all events are logged when plugin configured with * LOG_ALL_EVENTS * * Overridden as behaviour slightly different for queue create/destroy with Openwire * * @throws Exception */
Aim: test all events are logged when plugin configured with LOG_ALL_EVENTS Overridden as behaviour slightly different for queue create/destroy with Openwire
testLogAll
{ "repo_name": "tabish121/activemq-artemis", "path": "tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LoggingActiveMQServerPluginOpenWireTest.java", "license": "apache-2.0", "size": 7656 }
[ "org.apache.activemq.artemis.core.server.ActiveMQServer", "org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin", "org.jboss.byteman.contrib.bmunit.BMRule", "org.jboss.byteman.contrib.bmunit.BMRules" ]
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.apache.activemq.artemis.core.server.*; import org.apache.activemq.artemis.core.server.plugin.impl.*; import org.jboss.byteman.contrib.bmunit.*;
[ "org.apache.activemq", "org.jboss.byteman" ]
org.apache.activemq; org.jboss.byteman;
54,922
private static NodeKeyResolver<ImmutableNode> createResolver(boolean replay) { NodeKeyResolver<ImmutableNode> resolver = NodeStructureHelper.createResolverMock(); NodeStructureHelper.expectResolveKeyForQueries(resolver); if (replay) { EasyMock.replay(resolver); } return resolver; }
static NodeKeyResolver<ImmutableNode> function(boolean replay) { NodeKeyResolver<ImmutableNode> resolver = NodeStructureHelper.createResolverMock(); NodeStructureHelper.expectResolveKeyForQueries(resolver); if (replay) { EasyMock.replay(resolver); } return resolver; }
/** * Creates a default resolver which supports arbitrary queries on a target * node and allows specifying the replay flag. If the boolean parameter is * false, the mock is not replayed; so additional behaviors can be defined. * * @param replay the replay flag * @return the resolver mock */
Creates a default resolver which supports arbitrary queries on a target node and allows specifying the replay flag. If the boolean parameter is false, the mock is not replayed; so additional behaviors can be defined
createResolver
{ "repo_name": "mohanaraosv/commons-configuration", "path": "src/test/java/org/apache/commons/configuration2/tree/TestInMemoryNodeModelTrackedNodes.java", "license": "apache-2.0", "size": 36379 }
[ "org.easymock.EasyMock" ]
import org.easymock.EasyMock;
import org.easymock.*;
[ "org.easymock" ]
org.easymock;
1,439,230
@Deprecated public InstanceProperties setRingBufferSizeInHalfOpenState( Integer ringBufferSizeInHalfOpenState) { Objects.requireNonNull(ringBufferSizeInHalfOpenState); if (ringBufferSizeInHalfOpenState < 1) { throw new IllegalArgumentException( "ringBufferSizeInHalfOpenState must be greater than or equal to 1."); } this.ringBufferSizeInHalfOpenState = ringBufferSizeInHalfOpenState; return this; }
InstanceProperties function( Integer ringBufferSizeInHalfOpenState) { Objects.requireNonNull(ringBufferSizeInHalfOpenState); if (ringBufferSizeInHalfOpenState < 1) { throw new IllegalArgumentException( STR); } this.ringBufferSizeInHalfOpenState = ringBufferSizeInHalfOpenState; return this; }
/** * Sets the ring buffer size for the circuit breaker while in half open state. * * @param ringBufferSizeInHalfOpenState the ring buffer size * @deprecated Use {@link #setPermittedNumberOfCallsInHalfOpenState(Integer)} instead. */
Sets the ring buffer size for the circuit breaker while in half open state
setRingBufferSizeInHalfOpenState
{ "repo_name": "javaslang/javaslang-circuitbreaker", "path": "resilience4j-framework-common/src/main/java/io/github/resilience4j/common/circuitbreaker/configuration/CircuitBreakerConfigurationProperties.java", "license": "apache-2.0", "size": 28775 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
105,065
private void checkOpen() { if (closed) throw new ClosedWatchServiceException(); }
void function() { if (closed) throw new ClosedWatchServiceException(); }
/** * Throws ClosedWatchServiceException if watch service is closed */
Throws ClosedWatchServiceException if watch service is closed
checkOpen
{ "repo_name": "ReactiveX/RxJavaFileUtils", "path": "src/main/java/com/barbarysoftware/watchservice/AbstractWatchService.java", "license": "apache-2.0", "size": 4917 }
[ "java.nio.file.ClosedWatchServiceException" ]
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
1,159,008
@VisibleForTesting void shutdown() { logger.info("Shutting down the container"); if (this.flowRunner != null) { final int execId = this.flowRunner.getExecutionId(); while (!this.flowFuture.isDone()) { // This should not happen immediately as submitFlowRunner is a blocking call. try { Thread.sleep(100); } catch (final InterruptedException e) { logger.error(String.format("The sleep while waiting for execution : %d to finish was interrupted", execId)); } } } else { logger.warn("Flowrunner is null, the flow execution never started!"); } boolean result = false; try { this.executorService.shutdown(); // Wait upto 10 seconds for clean shutdown, otherwise, System.exit() will wipe out // everything logger.info("Awaiting Shutdown of executing flow"); result = this.executorService.awaitTermination( SHUTDOWN_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); } catch (final InterruptedException e) { logger.error(e.getMessage()); } if (!result) { logger.warn("ExecutorService did not shut down cleanly yet. Ignoring it."); } try { this.jettyServer.stop(); this.jettyServer.destroy(); } catch (final Exception e) { // Eat up the exception logger.error("Error shutting down JettyServer while winding down the FlowContainer", e); } logger.info("Sayonara!"); if (this.flowRunner != null) { // If the flowRunner is not created, the execId would be invalid. uploadLogFile(this.flowRunner.getExecutionId()); } System.exit(0); }
void shutdown() { logger.info(STR); if (this.flowRunner != null) { final int execId = this.flowRunner.getExecutionId(); while (!this.flowFuture.isDone()) { try { Thread.sleep(100); } catch (final InterruptedException e) { logger.error(String.format(STR, execId)); } } } else { logger.warn(STR); } boolean result = false; try { this.executorService.shutdown(); logger.info(STR); result = this.executorService.awaitTermination( SHUTDOWN_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS); } catch (final InterruptedException e) { logger.error(e.getMessage()); } if (!result) { logger.warn(STR); } try { this.jettyServer.stop(); this.jettyServer.destroy(); } catch (final Exception e) { logger.error(STR, e); } logger.info(STR); if (this.flowRunner != null) { uploadLogFile(this.flowRunner.getExecutionId()); } System.exit(0); }
/** * Shutdown the Container. This shuts down the ExecutorService which runs the flow execution as * well as JettyServer. */
Shutdown the Container. This shuts down the ExecutorService which runs the flow execution as well as JettyServer
shutdown
{ "repo_name": "azkaban/azkaban", "path": "azkaban-exec-server/src/main/java/azkaban/container/FlowContainer.java", "license": "apache-2.0", "size": 32970 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
873,053
public @CheckForNull Plugin getPlugin(String artifactId, @CheckForNull VersionNumber minVersion) { if (minVersion == null) { return getPlugin(artifactId); } for (UpdateSite s : sites) { Plugin p = s.getPlugin(artifactId); if (checkMinVersion(p, minVersion)) { return p; } } return null; }
@CheckForNull Plugin function(String artifactId, @CheckForNull VersionNumber minVersion) { if (minVersion == null) { return getPlugin(artifactId); } for (UpdateSite s : sites) { Plugin p = s.getPlugin(artifactId); if (checkMinVersion(p, minVersion)) { return p; } } return null; }
/** * Gets the plugin with the given name from the first {@link UpdateSite} to contain it. * @return Discovered {@link Plugin}. {@code null} if it cannot be found */
Gets the plugin with the given name from the first <code>UpdateSite</code> to contain it
getPlugin
{ "repo_name": "damianszczepanik/jenkins", "path": "core/src/main/java/hudson/model/UpdateCenter.java", "license": "mit", "size": 97521 }
[ "edu.umd.cs.findbugs.annotations.CheckForNull", "hudson.model.UpdateSite", "hudson.util.VersionNumber" ]
import edu.umd.cs.findbugs.annotations.CheckForNull; import hudson.model.UpdateSite; import hudson.util.VersionNumber;
import edu.umd.cs.findbugs.annotations.*; import hudson.model.*; import hudson.util.*;
[ "edu.umd.cs", "hudson.model", "hudson.util" ]
edu.umd.cs; hudson.model; hudson.util;
1,112,613
@Test public void testIsNonStdLicIdMapEmpty() throws IOException, InvalidSPDXAnalysisException { @SuppressWarnings("unused") SpdxDocument doc1 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH); SpdxLicenseMapper mapper = new SpdxLicenseMapper(); assertTrue(mapper.isNonStdLicIdMapEmpty()); }
void function() throws IOException, InvalidSPDXAnalysisException { @SuppressWarnings(STR) SpdxDocument doc1 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH); SpdxLicenseMapper mapper = new SpdxLicenseMapper(); assertTrue(mapper.isNonStdLicIdMapEmpty()); }
/** * Test method for {@link org.spdx.merge.SpdxLicenseMapper#isNonStdLicIdMapEmpty()}. * @throws InvalidSPDXAnalysisException * @throws IOException */
Test method for <code>org.spdx.merge.SpdxLicenseMapper#isNonStdLicIdMapEmpty()</code>
testIsNonStdLicIdMapEmpty
{ "repo_name": "rtgdk/tools", "path": "Test/org/spdx/merge/SpdxLicenseMapperTest.java", "license": "apache-2.0", "size": 12285 }
[ "java.io.IOException", "org.junit.Assert", "org.spdx.rdfparser.InvalidSPDXAnalysisException", "org.spdx.rdfparser.SPDXDocumentFactory", "org.spdx.rdfparser.model.SpdxDocument" ]
import java.io.IOException; import org.junit.Assert; import org.spdx.rdfparser.InvalidSPDXAnalysisException; import org.spdx.rdfparser.SPDXDocumentFactory; import org.spdx.rdfparser.model.SpdxDocument;
import java.io.*; import org.junit.*; import org.spdx.rdfparser.*; import org.spdx.rdfparser.model.*;
[ "java.io", "org.junit", "org.spdx.rdfparser" ]
java.io; org.junit; org.spdx.rdfparser;
853,846
public String getValue() { return ConfigurationUtils.getResourceProperty(this.key); }
String function() { return ConfigurationUtils.getResourceProperty(this.key); }
/** * Gets the resource value. * * @return the resource value */
Gets the resource value
getValue
{ "repo_name": "ribeirux/jalphanode", "path": "core/src/main/java/org/jalphanode/config/ResourceKeys.java", "license": "apache-2.0", "size": 1366 }
[ "org.jalphanode.util.ConfigurationUtils" ]
import org.jalphanode.util.ConfigurationUtils;
import org.jalphanode.util.*;
[ "org.jalphanode.util" ]
org.jalphanode.util;
1,139,479
public static BigDecimal subtract(BigDecimal left, BigDecimal right, MathContext mathContext) { if (left == null || right == null) { return null; } return left.subtract(right, mathContext); }
static BigDecimal function(BigDecimal left, BigDecimal right, MathContext mathContext) { if (left == null right == null) { return null; } return left.subtract(right, mathContext); }
/** * Calculates the difference of {@code left} and {@code right}. * @param left The minuend. * @param right The subtrahend. * @param mathContext The {@link MathContext} for the operation. * @return The result of {@code left - right}. */
Calculates the difference of left and right
subtract
{ "repo_name": "gmulders/abacus", "path": "abacus-core/src/main/java/org/gertje/abacus/runtime/expression/ArithmeticOperation.java", "license": "apache-2.0", "size": 10892 }
[ "java.math.BigDecimal", "java.math.MathContext" ]
import java.math.BigDecimal; import java.math.MathContext;
import java.math.*;
[ "java.math" ]
java.math;
2,703,796
@Test public void testAddExplanationSuccessfullThreeChunks() { explanation = new Explanation("owner 1", "srb", "RS", null); instance = getInstance(explanation, getFactory()); //Add three chunks instance.addExplanationChunk(ExplanationChunkBuilderFactory.TEXT, tcontext, tgroup, trule, ttags, tcontent); instance.addExplanationChunk(ExplanationChunkBuilderFactory.IMAGE, icontext, igroup, irule, itags, icontent); instance.addExplanationChunk(ExplanationChunkBuilderFactory.DATA, dcontext, dgroup, drule, dtags, dcontent); ArrayList<ExplanationChunk> chunks = explanation.getChunks(); //Assert that three chunks were added and that they are the //appropriate type assertEquals(3, chunks.size()); assertTrue(chunks.get(0) instanceof TextExplanationChunk); assertTrue(chunks.get(1) instanceof ImageExplanationChunk); assertTrue(chunks.get(2) instanceof DataExplanationChunk); //Check first (Text) chunk TextExplanationChunk tc = (TextExplanationChunk) (chunks.get(0)); //Assert that the chunk holds correct data assertEquals(tcontext, tc.getContext()); assertEquals(tgroup, tc.getGroup()); assertEquals(trule, tc.getRule()); assertTrue(tc.getTags().length == 2); assertEquals(ttags[0], tc.getTags()[0]); assertEquals(ttags[1], tc.getTags()[1]); //Assert that the translation is correct assertEquals("donet je zakljucak 3 u poslednjem trenutku", ((String) tc.getContent())); //Check second (Image) chunk ImageExplanationChunk ic = (ImageExplanationChunk) (chunks.get(1)); //Assert that the chunk holds correct data assertEquals(icontext, ic.getContext()); assertEquals(igroup, ic.getGroup()); assertEquals(irule, ic.getRule()); assertTrue(ic.getTags().length == 2); assertEquals(itags[0], ic.getTags()[0]); assertEquals(itags[1], ic.getTags()[1]); assertTrue(ic.getContent() instanceof ImageData); //Assert that the caption has been translated //and that URL remains unchanged assertEquals("Fotografija kita",((ImageData)(ic.getContent())).getCaption()); assertEquals("URL1",((ImageData)(ic.getContent())).getURL()); //Check third (Data) chunk DataExplanationChunk dc = (DataExplanationChunk) (chunks.get(2)); //Assert that the chunk holds correct data assertEquals(dcontext, dc.getContext()); assertEquals(dgroup, dc.getGroup()); assertEquals(drule, dc.getRule()); assertTrue(dc.getTags().length == 1); assertEquals(dtags[0], dc.getTags()[0]); assertTrue(dc.getContent() instanceof SingleData); //Assert that the dimension name and unit translations are //correct assertEquals("novac", ((SingleData) dc.getContent()).getDimension().getName()); assertEquals("RSD", ((SingleData) dc.getContent()).getDimension().getUnit()); }
void function() { explanation = new Explanation(STR, "srb", "RS", null); instance = getInstance(explanation, getFactory()); instance.addExplanationChunk(ExplanationChunkBuilderFactory.TEXT, tcontext, tgroup, trule, ttags, tcontent); instance.addExplanationChunk(ExplanationChunkBuilderFactory.IMAGE, icontext, igroup, irule, itags, icontent); instance.addExplanationChunk(ExplanationChunkBuilderFactory.DATA, dcontext, dgroup, drule, dtags, dcontent); ArrayList<ExplanationChunk> chunks = explanation.getChunks(); assertEquals(3, chunks.size()); assertTrue(chunks.get(0) instanceof TextExplanationChunk); assertTrue(chunks.get(1) instanceof ImageExplanationChunk); assertTrue(chunks.get(2) instanceof DataExplanationChunk); TextExplanationChunk tc = (TextExplanationChunk) (chunks.get(0)); assertEquals(tcontext, tc.getContext()); assertEquals(tgroup, tc.getGroup()); assertEquals(trule, tc.getRule()); assertTrue(tc.getTags().length == 2); assertEquals(ttags[0], tc.getTags()[0]); assertEquals(ttags[1], tc.getTags()[1]); assertEquals(STR, ((String) tc.getContent())); ImageExplanationChunk ic = (ImageExplanationChunk) (chunks.get(1)); assertEquals(icontext, ic.getContext()); assertEquals(igroup, ic.getGroup()); assertEquals(irule, ic.getRule()); assertTrue(ic.getTags().length == 2); assertEquals(itags[0], ic.getTags()[0]); assertEquals(itags[1], ic.getTags()[1]); assertTrue(ic.getContent() instanceof ImageData); assertEquals(STR,((ImageData)(ic.getContent())).getCaption()); assertEquals("URL1",((ImageData)(ic.getContent())).getURL()); DataExplanationChunk dc = (DataExplanationChunk) (chunks.get(2)); assertEquals(dcontext, dc.getContext()); assertEquals(dgroup, dc.getGroup()); assertEquals(drule, dc.getRule()); assertTrue(dc.getTags().length == 1); assertEquals(dtags[0], dc.getTags()[0]); assertTrue(dc.getContent() instanceof SingleData); assertEquals("novac", ((SingleData) dc.getContent()).getDimension().getName()); assertEquals("RSD", ((SingleData) dc.getContent()).getDimension().getUnit()); }
/** * Test of addExplanationChunk method, of class DefaultExplanationBuilder. * Test case: succesfull execution - three chunks added */
Test of addExplanationChunk method, of class DefaultExplanationBuilder. Test case: succesfull execution - three chunks added
testAddExplanationSuccessfullThreeChunks
{ "repo_name": "bojantomic/jeff", "path": "src/test/java/org/goodoldai/jeff/explanation/builder/DefaultExplanationBuilderTest.java", "license": "lgpl-3.0", "size": 16300 }
[ "java.util.ArrayList", "org.goodoldai.jeff.explanation.DataExplanationChunk", "org.goodoldai.jeff.explanation.Explanation", "org.goodoldai.jeff.explanation.ExplanationChunk", "org.goodoldai.jeff.explanation.ImageData", "org.goodoldai.jeff.explanation.ImageExplanationChunk", "org.goodoldai.jeff.explanation.TextExplanationChunk", "org.goodoldai.jeff.explanation.data.SingleData", "org.junit.Assert" ]
import java.util.ArrayList; import org.goodoldai.jeff.explanation.DataExplanationChunk; import org.goodoldai.jeff.explanation.Explanation; import org.goodoldai.jeff.explanation.ExplanationChunk; import org.goodoldai.jeff.explanation.ImageData; import org.goodoldai.jeff.explanation.ImageExplanationChunk; import org.goodoldai.jeff.explanation.TextExplanationChunk; import org.goodoldai.jeff.explanation.data.SingleData; import org.junit.Assert;
import java.util.*; import org.goodoldai.jeff.explanation.*; import org.goodoldai.jeff.explanation.data.*; import org.junit.*;
[ "java.util", "org.goodoldai.jeff", "org.junit" ]
java.util; org.goodoldai.jeff; org.junit;
1,634,700
public static QueryResults doQuery(Context c, QueryArgs args, Collection coll) throws IOException { String querystring = args.getQuery(); querystring = checkEmptyQuery(querystring); String location = "l" + (coll.getID()); String newquery = "+(" + querystring + ") +location:\"" + location + "\""; args.setQuery(newquery); return doQuery(c, args); }
static QueryResults function(Context c, QueryArgs args, Collection coll) throws IOException { String querystring = args.getQuery(); querystring = checkEmptyQuery(querystring); String location = "l" + (coll.getID()); String newquery = "+(" + querystring + STRSTR\""; args.setQuery(newquery); return doQuery(c, args); }
/** * Do a query, restricted to a collection * * @param c * context * @param args * query args * @param coll * collection to restrict to * * @return QueryResults same results as doQuery, restricted to a collection */
Do a query, restricted to a collection
doQuery
{ "repo_name": "jamie-dryad/dryad-repo", "path": "dspace-api/src/main/java/org/dspace/search/DSQuery.java", "license": "bsd-3-clause", "size": 15987 }
[ "java.io.IOException", "org.dspace.content.Collection", "org.dspace.core.Context" ]
import java.io.IOException; import org.dspace.content.Collection; import org.dspace.core.Context;
import java.io.*; import org.dspace.content.*; import org.dspace.core.*;
[ "java.io", "org.dspace.content", "org.dspace.core" ]
java.io; org.dspace.content; org.dspace.core;
804,193
@Test public void testEquals() throws Exception { assertThat(unknownFruit).isEqualTo(unknownFruit); assertThat(apple1).isEqualTo(apple2); assertThat(apple2).isEqualTo(apple1); assertThat(unknownFruit).isNotEqualTo(apple1); assertThat(apple1).isNotEqualTo(orange); assertThat(apple1).isNotEqualTo(null); assertThat(apple1).isEqualTo(apple1.clone()); assertThat(fruitBag).isEqualTo(fruitBag.clone()); assertThat(apple1).isNotEqualTo(orange.clone()); // test with maps ConfigurationParameterSettings cps1 = getResourceSpecifierFactory() .createConfigurationParameterSettings(); cps1.getSettingsForGroups().put("k1", new NameValuePair[] { new NameValuePair_impl("s1", "o1") }); cps1.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "o2") }); ConfigurationParameterSettings cps2 = getResourceSpecifierFactory() .createConfigurationParameterSettings(); cps2.getSettingsForGroups().put("k1", new NameValuePair[] { new NameValuePair_impl("s1", "o1") }); cps2.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "o2") }); assertThat(cps1).isEqualTo(cps2); assertThat(cps1).isEqualTo(cps2.clone()); cps2.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "ox2") }); assertThat(cps1).isNotEqualTo(cps2); }
void function() throws Exception { assertThat(unknownFruit).isEqualTo(unknownFruit); assertThat(apple1).isEqualTo(apple2); assertThat(apple2).isEqualTo(apple1); assertThat(unknownFruit).isNotEqualTo(apple1); assertThat(apple1).isNotEqualTo(orange); assertThat(apple1).isNotEqualTo(null); assertThat(apple1).isEqualTo(apple1.clone()); assertThat(fruitBag).isEqualTo(fruitBag.clone()); assertThat(apple1).isNotEqualTo(orange.clone()); ConfigurationParameterSettings cps1 = getResourceSpecifierFactory() .createConfigurationParameterSettings(); cps1.getSettingsForGroups().put("k1", new NameValuePair[] { new NameValuePair_impl("s1", "o1") }); cps1.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "o2") }); ConfigurationParameterSettings cps2 = getResourceSpecifierFactory() .createConfigurationParameterSettings(); cps2.getSettingsForGroups().put("k1", new NameValuePair[] { new NameValuePair_impl("s1", "o1") }); cps2.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "o2") }); assertThat(cps1).isEqualTo(cps2); assertThat(cps1).isEqualTo(cps2.clone()); cps2.getSettingsForGroups().put("k2", new NameValuePair[] { new NameValuePair_impl("s2", "ox2") }); assertThat(cps1).isNotEqualTo(cps2); }
/** * Tests the {@link MetaDataObject#equals(Object)} method. */
Tests the <code>MetaDataObject#equals(Object)</code> method
testEquals
{ "repo_name": "apache/uima-uimaj", "path": "uimaj-core/src/test/java/org/apache/uima/resource/metadata/impl/MetaDataObject_implTest.java", "license": "apache-2.0", "size": 11456 }
[ "org.apache.uima.UIMAFramework", "org.apache.uima.resource.metadata.ConfigurationParameterSettings", "org.apache.uima.resource.metadata.NameValuePair", "org.assertj.core.api.Assertions" ]
import org.apache.uima.UIMAFramework; import org.apache.uima.resource.metadata.ConfigurationParameterSettings; import org.apache.uima.resource.metadata.NameValuePair; import org.assertj.core.api.Assertions;
import org.apache.uima.*; import org.apache.uima.resource.metadata.*; import org.assertj.core.api.*;
[ "org.apache.uima", "org.assertj.core" ]
org.apache.uima; org.assertj.core;
200,703