method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static List<CompletionResult> getFactoryCompletions(String surl1, int carotPos, ProgressMonitor mon) throws Exception { CompletionContext cc = new CompletionContext(); URISplit split = URISplit.parse(surl1); if ( carotPos==0 && surl1.trim().length()>0 ) { return Collections.singletonList( new CompletionResult("No completions", "No completions", "", false)); } int qpos = surl1.lastIndexOf('?', carotPos); if ( qpos==-1 && surl1.contains(":") && ( surl1.endsWith(":") || surl1.contains("&") ) ) { qpos= surl1.indexOf(":"); } if ( qpos==-1 && surl1.contains(":") && split.file==null ) { qpos= surl1.indexOf(":"); } cc.surl = surl1; cc.surlpos = carotPos; //resourceUriCarotPos boolean hasResourceUri= split.vapScheme==null || DataSourceRegistry.getInstance().hasResourceUri(split.vapScheme); List<CompletionResult> result = new ArrayList<>(); if ( ( qpos==-1 && !hasResourceUri ) || ( qpos != -1 && qpos < carotPos) ) { // in query section int eqpos = surl1.lastIndexOf('=', carotPos - 1); int amppos = surl1.lastIndexOf('&', carotPos - 1); if (amppos == -1) { amppos = qpos; } if (eqpos > amppos) { cc.context = CompletionContext.CONTEXT_PARAMETER_VALUE; cc.completable = surl1.substring(eqpos + 1, carotPos); cc.completablepos = carotPos - (eqpos + 1); } else { cc.context = CompletionContext.CONTEXT_PARAMETER_NAME; cc.completable = surl1.substring(amppos + 1, carotPos); cc.completablepos = carotPos - (amppos + 1); if (surl1.length() > carotPos && surl1.charAt(carotPos) != '&') { // insert implicit "&" //TODO: bug 1088: where would this be appropriate??? int aftaCarotPos= surl1.indexOf("&",carotPos); if ( aftaCarotPos==-1 ) aftaCarotPos= surl1.length(); surl1 = surl1.substring(0, carotPos); if ( aftaCarotPos<surl1.length() ) surl1= '&' + surl1.substring(aftaCarotPos); split = URISplit.parse(surl1); } } } else { cc.context = CompletionContext.CONTEXT_FILE; qpos = surl1.indexOf('?', carotPos); if (qpos == -1) { cc.completable = surl1; } else { cc.completable = surl1.substring(0, qpos); } cc.completablepos = carotPos; } if (cc.context == CompletionContext.CONTEXT_PARAMETER_NAME) { DataSourceFactory factory = getDataSourceFactory(getURIValid(surl1), new NullProgressMonitor()); if (factory == null) { throw new IllegalArgumentException("unable to find data source factory"); } String suri; if ( hasResourceUri ) { suri= CompletionContext.get(CompletionContext.CONTEXT_FILE, cc); if ( suri==null ) { suri= cc.surl; } } else { suri= surl1; int i= cc.completable.indexOf(":"); if ( i>0 ) { cc.completable= cc.completable.substring(i+1); cc.completablepos= cc.completablepos-(i+1); } } URI uri = DataSetURI.getURIValid(suri); cc.resourceURI= DataSetURI.getResourceURI(uri); cc.params = split.params; List<CompletionContext> completions = factory.getCompletions(cc, mon); Map<String,String> params = URISplit.parseParams(split.params); Map<String,String> paramsArgN= URISplit.parseParams(split.params); // these do have arg_0 parameters. for (int i = 0; i < 3; i++) { params.remove("arg_" + i); } int i = 0; for (CompletionContext cc1 : completions) { boolean useArgN= false; String paramName = cc1.implicitName != null ? cc1.implicitName : cc1.completable; if (paramName.contains("=")) { paramName = paramName.substring(0, paramName.indexOf("=")); useArgN= true; } boolean dontYetHave = !params.containsKey(paramName); boolean startsWith = cc1.completable.startsWith(cc.completable); if (startsWith) { LinkedHashMap<String,String> paramsCopy; if ( useArgN ) { paramsCopy= new LinkedHashMap(paramsArgN); if ( cc.completable.length()>0 ) { // TODO: there's a nasty bug here, suppose a CDF file has a parameter named "doDep"... String rm= null; for ( Entry<String,String> e: paramsCopy.entrySet() ) { String k= e.getKey(); Object v= e.getValue(); if ( ((String)v).startsWith(cc.completable) ) { rm= (String)k; } } if ( rm!=null ) { paramsCopy.remove(rm); } else { logger.log(Level.FINE, "expected to find in completions: {0}", cc.completable); } } } else { paramsCopy= new LinkedHashMap(params); } if (cc1.implicitName != null) { paramsCopy.put(cc1.implicitName, cc1.completable); } else { paramsCopy.put(cc1.completable, null); } String ss= ( split.vapScheme==null ? "" : (split.vapScheme + ":" ) ); if ( split.file!=null && hasResourceUri ) { ss+= split.file + "?"; } ss+= URISplit.formatParams(paramsCopy); if (dontYetHave == false) { continue; // skip it } result.add(new CompletionResult(ss, cc1.label, cc1.doc, surl1.substring(0, carotPos), cc1.maybePlot)); i = i + 1; } } return result; } else if (cc.context == CompletionContext.CONTEXT_PARAMETER_VALUE) { String file= CompletionContext.get(CompletionContext.CONTEXT_FILE, cc); DataSourceFactory factory = getDataSourceFactory(getURIValid(surl1), mon); if ( file!=null ) { URI uri = DataSetURI.getURIValid(file); cc.resourceURI= DataSetURI.getResourceURI(uri); } cc.params = split.params; if (factory == null) { throw new IllegalArgumentException("unable to find data source factory"); } List<CompletionContext> completions = factory.getCompletions(cc, mon); int i = 0; for (CompletionContext cc1 : completions) { if ( cc1.completable.startsWith(cc.completable)) { String ss= CompletionContext.insert(cc, cc1); if ( split.vapScheme!=null && !ss.startsWith( split.vapScheme ) ) ss = split.vapScheme + ":" + ss; result.add(new CompletionResult(ss, cc1.label, cc1.doc, surl1.substring(0, carotPos), cc1.maybePlot)); i = i + 1; } } return result; } else { try { mon.setProgressMessage("listing directory"); mon.started(); String surl = CompletionContext.get(CompletionContext.CONTEXT_FILE, cc); if ( surl==null ) { throw new MalformedURLException("unable to process"); } int surlPos= cc.surl.indexOf(surl); if ( surlPos==-1 ) surlPos= 0; int newCarotPos= carotPos - surlPos; int i = surl.lastIndexOf("/", newCarotPos - 1); String surlDir; // name of surl, including only folders, ending with /. if (i <= 0) { surlDir = surl; } else { surlDir = surl.substring(0, i + 1); } URI url = getURIValid(surlDir); String prefix = surl.substring(i + 1, newCarotPos); FileSystem fs = FileSystem.create(getWebURL(url),new NullProgressMonitor()); String[] s = fs.listDirectory("/"); mon.finished(); for (String item : s) { if (item.startsWith(prefix)) { CompletionContext cc1 = new CompletionContext(CompletionContext.CONTEXT_FILE, surlDir + item); result.add(new CompletionResult(CompletionContext.insert(cc, cc1), cc1.label, cc1.doc, surl1.substring(0, carotPos), true)); } } } catch (MalformedURLException ex) { result = Collections.singletonList(new CompletionResult("Malformed URI", "Something in the URL prevents processing "+ surl1.substring(0, carotPos), "", false)); } catch (FileSystem.FileSystemOfflineException ex) { result = Collections.singletonList(new CompletionResult("FileSystem offline", "FileSystem is offline." + surl1.substring(0, carotPos), "", false)); } finally { mon.finished(); } return result; } }
static List<CompletionResult> function(String surl1, int carotPos, ProgressMonitor mon) throws Exception { CompletionContext cc = new CompletionContext(); URISplit split = URISplit.parse(surl1); if ( carotPos==0 && surl1.trim().length()>0 ) { return Collections.singletonList( new CompletionResult(STR, STR, STR:STR:STR&STR:STR:STR:STR&STRunable to find data source factorySTR:STRarg_STR=STR=STRexpected to find in completions: {0}STRSTR:STR?STRunable to find data source factorySTR:STRlisting directorySTRunable to processSTR/STR/STRMalformed URISTRSomething in the URL prevents processing STRSTRFileSystem offlineSTRFileSystem is offline.STR", false)); } finally { mon.finished(); } return result; } }
/** * get the completions from the plug-in factory.. * @param surl1 * @param carotPos * @param mon * @return * @throws Exception */
get the completions from the plug-in factory.
getFactoryCompletions
{ "repo_name": "autoplot/app", "path": "DataSource/src/org/autoplot/datasource/DataSetURI.java", "license": "gpl-2.0", "size": 105000 }
[ "java.util.Collections", "java.util.List", "org.das2.util.monitor.ProgressMonitor" ]
import java.util.Collections; import java.util.List; import org.das2.util.monitor.ProgressMonitor;
import java.util.*; import org.das2.util.monitor.*;
[ "java.util", "org.das2.util" ]
java.util; org.das2.util;
2,833,788
@SuppressWarnings("unused") public void deleteDocument(String documentId) throws FileNotFoundException { throw new UnsupportedOperationException("Delete not supported"); }
@SuppressWarnings(STR) void function(String documentId) throws FileNotFoundException { throw new UnsupportedOperationException(STR); }
/** * Delete the requested document. * <p> * Upon returning, any URI permission grants for the given document will be * revoked. If additional documents were deleted as a side effect of this * call (such as documents inside a directory) the implementor is * responsible for revoking those permissions using * {@link #revokeDocumentPermission(String)}. * * @param documentId the document to delete. */
Delete the requested document. Upon returning, any URI permission grants for the given document will be revoked. If additional documents were deleted as a side effect of this call (such as documents inside a directory) the implementor is responsible for revoking those permissions using <code>#revokeDocumentPermission(String)</code>
deleteDocument
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/provider/DocumentsProvider.java", "license": "gpl-3.0", "size": 34375 }
[ "java.io.FileNotFoundException" ]
import java.io.FileNotFoundException;
import java.io.*;
[ "java.io" ]
java.io;
708,086
public static ims.core.resource.place.domain.objects.OrganisationPCTLinkConfig extractOrganisationPCTLinkConfig(ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.OrganisationPCTLinkConfigVo valueObject) { return extractOrganisationPCTLinkConfig(domainFactory, valueObject, new HashMap()); }
static ims.core.resource.place.domain.objects.OrganisationPCTLinkConfig function(ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.OrganisationPCTLinkConfigVo valueObject) { return extractOrganisationPCTLinkConfig(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractOrganisationPCTLinkConfig
{ "repo_name": "IMS-MAXIMS/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/admin/vo/domain/OrganisationPCTLinkConfigVoAssembler.java", "license": "agpl-3.0", "size": 18349 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,872,698
boolean parseLocal(String localFile, String docName, boolean replace, String mimeType) throws EXistException, PermissionDeniedException, SAXException, URISyntaxException;
boolean parseLocal(String localFile, String docName, boolean replace, String mimeType) throws EXistException, PermissionDeniedException, SAXException, URISyntaxException;
/** * Parse a file previously uploaded with upload. * * The temporary file will be removed. * * @param localFile * @param docName * @param replace * @param mimeType * @return * @throws EXistException * @throws org.exist.security.PermissionDeniedException * @throws org.xml.sax.SAXException * @throws java.net.URISyntaxException */
Parse a file previously uploaded with upload. The temporary file will be removed
parseLocal
{ "repo_name": "RemiKoutcherawy/exist", "path": "exist-core/src/main/java/org/exist/xmlrpc/RpcAPI.java", "license": "lgpl-2.1", "size": 39647 }
[ "java.net.URISyntaxException", "org.exist.EXistException", "org.exist.security.PermissionDeniedException", "org.xml.sax.SAXException" ]
import java.net.URISyntaxException; import org.exist.EXistException; import org.exist.security.PermissionDeniedException; import org.xml.sax.SAXException;
import java.net.*; import org.exist.*; import org.exist.security.*; import org.xml.sax.*;
[ "java.net", "org.exist", "org.exist.security", "org.xml.sax" ]
java.net; org.exist; org.exist.security; org.xml.sax;
1,627,063
@Override public Object compile(final String script, final Map<String, String> params) { final CompilerSettings compilerSettings; if (params.isEmpty()) { // Use the default settings. compilerSettings = DEFAULT_COMPILER_SETTINGS; } else { // Use custom settings specified by params. compilerSettings = new CompilerSettings(); Map<String, String> copy = new HashMap<>(params); String value = copy.remove(CompilerSettings.NUMERIC_OVERFLOW); if (value != null) { compilerSettings.setNumericOverflow(Boolean.parseBoolean(value)); } value = copy.remove(CompilerSettings.MAX_LOOP_COUNTER); if (value != null) { compilerSettings.setMaxLoopCounter(Integer.parseInt(value)); } if (!copy.isEmpty()) { throw new IllegalArgumentException("Unrecognized compile-time parameter(s): " + copy); } } // Check we ourselves are not being called by unprivileged code. final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SpecialPermission()); }
Object function(final String script, final Map<String, String> params) { final CompilerSettings compilerSettings; if (params.isEmpty()) { compilerSettings = DEFAULT_COMPILER_SETTINGS; } else { compilerSettings = new CompilerSettings(); Map<String, String> copy = new HashMap<>(params); String value = copy.remove(CompilerSettings.NUMERIC_OVERFLOW); if (value != null) { compilerSettings.setNumericOverflow(Boolean.parseBoolean(value)); } value = copy.remove(CompilerSettings.MAX_LOOP_COUNTER); if (value != null) { compilerSettings.setMaxLoopCounter(Integer.parseInt(value)); } if (!copy.isEmpty()) { throw new IllegalArgumentException(STR + copy); } } final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SpecialPermission()); }
/** * Compiles a Plan A script with the specified parameters. * @param script The code to be compiled. * @param params The params used to modify the compiler settings on a per script basis. * @return Compiled script object represented by an {@link Executable}. */
Compiles a Plan A script with the specified parameters
compile
{ "repo_name": "davidvgalbraith/elasticsearch", "path": "plugins/lang-plan-a/src/main/java/org/elasticsearch/plan/a/PlanAScriptEngineService.java", "license": "apache-2.0", "size": 8112 }
[ "java.util.HashMap", "java.util.Map", "org.elasticsearch.SpecialPermission" ]
import java.util.HashMap; import java.util.Map; import org.elasticsearch.SpecialPermission;
import java.util.*; import org.elasticsearch.*;
[ "java.util", "org.elasticsearch" ]
java.util; org.elasticsearch;
1,843,267
@SuppressWarnings("rawtypes") public synchronized void addAffixGroupUpdateConsumer(List<Setting.AffixSetting<?>> settings, BiConsumer<String, Settings> consumer) { List<SettingUpdater> affixUpdaters = new ArrayList<>(settings.size()); for (Setting.AffixSetting<?> setting : settings) { ensureSettingIsRegistered(setting); affixUpdaters.add(setting.newAffixUpdater((a, b) -> {}, logger, (a, b) -> {})); } addSettingsUpdater(new SettingUpdater<Map<String, Settings>>() {
@SuppressWarnings(STR) synchronized void function(List<Setting.AffixSetting<?>> settings, BiConsumer<String, Settings> consumer) { List<SettingUpdater> affixUpdaters = new ArrayList<>(settings.size()); for (Setting.AffixSetting<?> setting : settings) { ensureSettingIsRegistered(setting); affixUpdaters.add(setting.newAffixUpdater((a, b) -> {}, logger, (a, b) -> {})); } addSettingsUpdater(new SettingUpdater<Map<String, Settings>>() {
/** * Adds a affix settings consumer that accepts the settings for a group of settings. The consumer is only * notified if at least one of the settings change. * <p> * Note: Only settings registered in {@link SettingsModule} can be changed dynamically. * </p> */
Adds a affix settings consumer that accepts the settings for a group of settings. The consumer is only notified if at least one of the settings change. Note: Only settings registered in <code>SettingsModule</code> can be changed dynamically.
addAffixGroupUpdateConsumer
{ "repo_name": "jmluy/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java", "license": "apache-2.0", "size": 47024 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "java.util.function.BiConsumer" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.BiConsumer;
import java.util.*; import java.util.function.*;
[ "java.util" ]
java.util;
529,509
public static BuddhistChronology getInstance(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { // First create without a lower limit. chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); // Impose lower limit and make another BuddhistChronology. DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; } } return chrono; } // Constructors and instance variables //----------------------------------------------------------------------- private BuddhistChronology(Chronology base, Object param) { super(base, param); }
static BuddhistChronology function(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; } } return chrono; } private BuddhistChronology(Chronology base, Object param) { super(base, param); }
/** * Standard instance of a Buddhist Chronology, that matches * Sun's BuddhistCalendar class. This means that it follows the * GregorianJulian calendar rules with a cutover date. * * @param zone the time zone to use, null is default */
Standard instance of a Buddhist Chronology, that matches Sun's BuddhistCalendar class. This means that it follows the GregorianJulian calendar rules with a cutover date
getInstance
{ "repo_name": "AlexeyTrusov/testing5", "path": "src/main/java/org/joda/time/chrono/BuddhistChronology.java", "license": "apache-2.0", "size": 9082 }
[ "org.joda.time.Chronology", "org.joda.time.DateTime", "org.joda.time.DateTimeZone" ]
import org.joda.time.Chronology; import org.joda.time.DateTime; import org.joda.time.DateTimeZone;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
2,370,372
@ServiceMethod(returns = ReturnType.SINGLE) ComponentLinkedStorageAccountsInner createAndUpdate( String resourceGroupName, String resourceName, StorageType storageType, ComponentLinkedStorageAccountsInner linkedStorageAccountsProperties);
@ServiceMethod(returns = ReturnType.SINGLE) ComponentLinkedStorageAccountsInner createAndUpdate( String resourceGroupName, String resourceName, StorageType storageType, ComponentLinkedStorageAccountsInner linkedStorageAccountsProperties);
/** * Replace current linked storage account for an Application Insights component. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceName The name of the Application Insights component resource. * @param storageType The type of the Application Insights component data source for the linked storage account. * @param linkedStorageAccountsProperties Properties that need to be specified to update linked storage accounts for * an Application Insights component. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Application Insights component linked storage accounts. */
Replace current linked storage account for an Application Insights component
createAndUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/ComponentLinkedStorageAccountsOperationsClient.java", "license": "mit", "size": 9881 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.applicationinsights.fluent.models.ComponentLinkedStorageAccountsInner", "com.azure.resourcemanager.applicationinsights.models.StorageType" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.applicationinsights.fluent.models.ComponentLinkedStorageAccountsInner; import com.azure.resourcemanager.applicationinsights.models.StorageType;
import com.azure.core.annotation.*; import com.azure.resourcemanager.applicationinsights.fluent.models.*; import com.azure.resourcemanager.applicationinsights.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,138,640
public void loadFrom(File f) throws IOException { IOException exception = null; FileInputStream input = null; input = new FileInputStream(f); try { loadFrom(input); } catch (IOException e) { exception = e; } finally { if (input != null) { input.close(); } } if (exception != null) { throw (exception); } }
void function(File f) throws IOException { IOException exception = null; FileInputStream input = null; input = new FileInputStream(f); try { loadFrom(input); } catch (IOException e) { exception = e; } finally { if (input != null) { input.close(); } } if (exception != null) { throw (exception); } }
/** * load prefs from given props file. * @param f * @throws java.io.IOException */
load prefs from given props file
loadFrom
{ "repo_name": "tcolar/javaontracks", "path": "src/net/jot/prefs/JOTPropertiesPreferences.java", "license": "artistic-2.0", "size": 3112 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,964,148
public static <K> K pollRandom(Collection<K> collection, Random rnd) { int size = collection.size(); if (size == 0) { return null; } int index = rnd.nextInt(size); List<K> values = new ArrayList<K>(collection); K retVal = values.get(index); // now we need to remove this element collection.remove(retVal); return retVal; }
static <K> K function(Collection<K> collection, Random rnd) { int size = collection.size(); if (size == 0) { return null; } int index = rnd.nextInt(size); List<K> values = new ArrayList<K>(collection); K retVal = values.get(index); collection.remove(retVal); return retVal; }
/** * Returns a random element from a collection. This method is pretty slow O(n), but the Java collection * framework * does not offer a better solution. This method puts the collection into a {@link List} and fetches a * random * element using {@link List#get(int)}. * * @param collection * The collection from which we want to pick a random element * @param rnd * The random object * @return A random element */
Returns a random element from a collection. This method is pretty slow O(n), but the Java collection framework does not offer a better solution. This method puts the collection into a <code>List</code> and fetches a random element using <code>List#get(int)</code>
pollRandom
{ "repo_name": "thirdy/TomP2P", "path": "core/src/main/java/net/tomp2p/utils/Utils.java", "license": "apache-2.0", "size": 34619 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.List", "java.util.Random" ]
import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
2,076,489
public static void set(Object obj, long propertyId, String val, int member, int index) { switch(getPropertyMappingKind(obj.getTypeId(),propertyId,member)) { case MappedToNull: throw new ReadOnlyException("Property member is mapped to null"); case MappedToParameter: throw new ReadOnlyException("Property member is mapped to parameter"); case MappedToMember: { int[] classMemberRef = getClassMemberReference(obj.getTypeId(), propertyId, member); if (classMemberRef == null || classMemberRef.length == 0) { throw new SoftwareViolationException("Failed to get class member reference from dots_kernel"); } ContainerBase container [] = new ContainerBase[1]; boolean parentIsChanged [] = new boolean [1]; parentIsChanged[0] = false; dereferenceClassMemberReference(obj, classMemberRef, 0, index, container, parentIsChanged); if (container[0] == null) { throw new ReadOnlyException("Unable to dereference property, some parent is null"); } else { ((StringContainer)container[0]).setVal(val); } } break; } }
static void function(Object obj, long propertyId, String val, int member, int index) { switch(getPropertyMappingKind(obj.getTypeId(),propertyId,member)) { case MappedToNull: throw new ReadOnlyException(STR); case MappedToParameter: throw new ReadOnlyException(STR); case MappedToMember: { int[] classMemberRef = getClassMemberReference(obj.getTypeId(), propertyId, member); if (classMemberRef == null classMemberRef.length == 0) { throw new SoftwareViolationException(STR); } ContainerBase container [] = new ContainerBase[1]; boolean parentIsChanged [] = new boolean [1]; parentIsChanged[0] = false; dereferenceClassMemberReference(obj, classMemberRef, 0, index, container, parentIsChanged); if (container[0] == null) { throw new ReadOnlyException(STR); } else { ((StringContainer)container[0]).setVal(val); } } break; } }
/** * Set a String property member in the object using a property. * * @param obj The object to modify. * @param propertyId TypeId of the property to use. * @param val The value to set the member to. * @param member Index of the property member to modify. * @param index Array index. * @throws ReadOnlyException If the property member is read-only. */
Set a String property member in the object using a property
set
{ "repo_name": "SafirSDK/safir-sdk-core", "path": "src/dots/dots_java.ss/src/com.saabgroup.safir.dob.typesystem/src/com/saabgroup/safir/dob/typesystem/Properties.java", "license": "gpl-3.0", "size": 83391 }
[ "com.saabgroup.safir.dob.typesystem.Object" ]
import com.saabgroup.safir.dob.typesystem.Object;
import com.saabgroup.safir.dob.typesystem.*;
[ "com.saabgroup.safir" ]
com.saabgroup.safir;
1,592,740
private void logExceptionForFailureAnalysis(String msg) { // Some error messages are formatted in multiple lines and with tabs. // We clean the messages to help parse the stack traces for failure analysis. // We keep at most 2 lines, otherwise the error message may be too long. String[] lines = msg.split("[\r\n]+"); msg = lines.length >= 2 ? lines[0] + " " + lines[1] : lines[0]; msg = msg.replaceAll("\t", " "); // Create a dummy exception just so we can print the stack trace. TestFailure e = new TestFailure(msg); StackTraceElement[] elements = e.getStackTrace(); final int callerIndex = 2; // 0=this function, 1=complain(), 2=caller if (elements.length <= callerIndex) { return; } // Only log the first complain message from each function. // The reason is that some functions splits an error message // into multiple lines and call complain() many times. // We do not want a RULE for each of those calls. // This means that we may miss some rules, but that // is better than to create far too many rules. String callerClass = elements[callerIndex].getClassName(); String callerMethod = elements[callerIndex].getMethodName(); String callerKey = callerClass + "." + callerMethod; boolean isAlreadyLogged = loggedExceptions.contains(msg) || loggedExceptions.contains(callerKey); if (!isAlreadyLogged) { PrintStream stream = findOutStream(); stream.println("The following stacktrace is for failure analysis."); e.printStackTrace(stream); } loggedExceptions.add(callerKey); loggedExceptions.add(msg); } /////////////////////////////////////////////////////////////////
void function(String msg) { String[] lines = msg.split(STR); msg = lines.length >= 2 ? lines[0] + " " + lines[1] : lines[0]; msg = msg.replaceAll("\t", " "); TestFailure e = new TestFailure(msg); StackTraceElement[] elements = e.getStackTrace(); final int callerIndex = 2; if (elements.length <= callerIndex) { return; } String callerClass = elements[callerIndex].getClassName(); String callerMethod = elements[callerIndex].getMethodName(); String callerKey = callerClass + "." + callerMethod; boolean isAlreadyLogged = loggedExceptions.contains(msg) loggedExceptions.contains(callerKey); if (!isAlreadyLogged) { PrintStream stream = findOutStream(); stream.println(STR); e.printStackTrace(stream); } loggedExceptions.add(callerKey); loggedExceptions.add(msg); }
/** * Create an Exception and print the stack trace for an error msg. * This makes it possible to detect a failure reason for this error. */
Create an Exception and print the stack trace for an error msg. This makes it possible to detect a failure reason for this error
logExceptionForFailureAnalysis
{ "repo_name": "md-5/jdk10", "path": "test/hotspot/jtreg/vmTestbase/nsk/share/Log.java", "license": "gpl-2.0", "size": 24117 }
[ "java.io.PrintStream" ]
import java.io.PrintStream;
import java.io.*;
[ "java.io" ]
java.io;
968,864
public String getString(int index) throws IOException { return inputStreamToString(getInputStream(index)); }
String function(int index) throws IOException { return inputStreamToString(getInputStream(index)); }
/** * Returns the string value for {@code index}. */
Returns the string value for index
getString
{ "repo_name": "armstrongli/XCamera", "path": "src/com/xxboy/common/DiskLruCache.java", "license": "gpl-2.0", "size": 28357 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,860,465
private ResourcesBrowseItem getResourcesBrowseItem(ContentResource resource) { ResourceProperties props = resource.getProperties(); String itemType = ((ContentResource)resource).getContentType(); String itemName = props.getProperty(ResourceProperties.PROP_DISPLAY_NAME); ResourcesBrowseItem newItem = new ResourcesBrowseItem(resource.getId(), itemName, itemType); try { Time modTime = props.getTimeProperty(ResourceProperties.PROP_MODIFIED_DATE); String modifiedTime = modTime.toStringLocalShortDate() + " " + modTime.toStringLocalShort(); newItem.setModifiedTime(modifiedTime); } catch(Exception e) { String modifiedTimeString = props.getProperty(ResourceProperties.PROP_MODIFIED_DATE); newItem.setModifiedTime(modifiedTimeString); } try { String modifiedBy = getUserProperty(props, ResourceProperties.PROP_MODIFIED_BY).getDisplayName(); newItem.setModifiedBy(modifiedBy); } catch(Exception e) { String modifiedBy = props.getProperty(ResourceProperties.PROP_MODIFIED_BY); newItem.setModifiedBy(modifiedBy); } return newItem; }
ResourcesBrowseItem function(ContentResource resource) { ResourceProperties props = resource.getProperties(); String itemType = ((ContentResource)resource).getContentType(); String itemName = props.getProperty(ResourceProperties.PROP_DISPLAY_NAME); ResourcesBrowseItem newItem = new ResourcesBrowseItem(resource.getId(), itemName, itemType); try { Time modTime = props.getTimeProperty(ResourceProperties.PROP_MODIFIED_DATE); String modifiedTime = modTime.toStringLocalShortDate() + " " + modTime.toStringLocalShort(); newItem.setModifiedTime(modifiedTime); } catch(Exception e) { String modifiedTimeString = props.getProperty(ResourceProperties.PROP_MODIFIED_DATE); newItem.setModifiedTime(modifiedTimeString); } try { String modifiedBy = getUserProperty(props, ResourceProperties.PROP_MODIFIED_BY).getDisplayName(); newItem.setModifiedBy(modifiedBy); } catch(Exception e) { String modifiedBy = props.getProperty(ResourceProperties.PROP_MODIFIED_BY); newItem.setModifiedBy(modifiedBy); } return newItem; }
/** * get an ResourcesBrowseItem object based on a given ContentResource object * @param resource * @return */
get an ResourcesBrowseItem object based on a given ContentResource object
getResourcesBrowseItem
{ "repo_name": "noondaysun/sakai", "path": "content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java", "license": "apache-2.0", "size": 337685 }
[ "org.sakaiproject.content.api.ContentResource", "org.sakaiproject.entity.api.ResourceProperties", "org.sakaiproject.time.api.Time" ]
import org.sakaiproject.content.api.ContentResource; import org.sakaiproject.entity.api.ResourceProperties; import org.sakaiproject.time.api.Time;
import org.sakaiproject.content.api.*; import org.sakaiproject.entity.api.*; import org.sakaiproject.time.api.*;
[ "org.sakaiproject.content", "org.sakaiproject.entity", "org.sakaiproject.time" ]
org.sakaiproject.content; org.sakaiproject.entity; org.sakaiproject.time;
2,312,247
public static boolean getValue(List <ControlFeature> daList, Long phaseId, String featureName){ if ((phaseId == null) || (featureName == null)){ return false; } // Loop over dependent object assignments found for this simulation for (ListIterator<ControlFeature> lc = daList .listIterator(); lc.hasNext();) { ControlFeature cf = lc.next(); if ((cf.phaseid.intValue() == 0) || (cf.phaseid.intValue() == phaseId.intValue())){ if (cf.featureName.equalsIgnoreCase(featureName)){ return cf.isShown(); } } } return false; }
static boolean function(List <ControlFeature> daList, Long phaseId, String featureName){ if ((phaseId == null) (featureName == null)){ return false; } for (ListIterator<ControlFeature> lc = daList .listIterator(); lc.hasNext();) { ControlFeature cf = lc.next(); if ((cf.phaseid.intValue() == 0) (cf.phaseid.intValue() == phaseId.intValue())){ if (cf.featureName.equalsIgnoreCase(featureName)){ return cf.isShown(); } } } return false; }
/** * Returns the value found when one passes it in a particular list (probably for a particular simulation) * and a feature name. * * @param daList * @param phaseId * @param featureName * @return */
Returns the value found when one passes it in a particular list (probably for a particular simulation) and a feature name
getValue
{ "repo_name": "skipcole/opensimplatform", "path": "WEB-INF/classes/org/usip/osp/specialfeatures/ControlFeature.java", "license": "bsd-3-clause", "size": 4478 }
[ "java.util.List", "java.util.ListIterator" ]
import java.util.List; import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
961,199
@Override public void addUserMaterial(Material m) { Preferences prefs = PREFNODE.node("userMaterials"); // Check whether material already exists if (getUserMaterials().contains(m)) { return; } // Add material using next free key (key is not used when loading) String mat = m.toStorableString(); for (int i = 0;; i++) { String key = "material" + i; if (prefs.get(key, null) == null) { prefs.put(key, mat); return; } } }
void function(Material m) { Preferences prefs = PREFNODE.node(STR); if (getUserMaterials().contains(m)) { return; } String mat = m.toStorableString(); for (int i = 0;; i++) { String key = STR + i; if (prefs.get(key, null) == null) { prefs.put(key, mat); return; } } }
/** * Add a user-defined material to the preferences. The preferences are * first checked for an existing material matching the provided one using * {@link Material#equals(Object)}. * * @param m the material to add. */
Add a user-defined material to the preferences. The preferences are first checked for an existing material matching the provided one using <code>Material#equals(Object)</code>
addUserMaterial
{ "repo_name": "joebowen/landing_zone_project", "path": "openrocket-release-15.03/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java", "license": "gpl-2.0", "size": 16552 }
[ "java.util.prefs.Preferences", "net.sf.openrocket.material.Material" ]
import java.util.prefs.Preferences; import net.sf.openrocket.material.Material;
import java.util.prefs.*; import net.sf.openrocket.material.*;
[ "java.util", "net.sf.openrocket" ]
java.util; net.sf.openrocket;
1,446,970
public ServiceFuture<List<DatabaseInner>> listByClusterAsync(String resourceGroupName, String clusterName, final ServiceCallback<List<DatabaseInner>> serviceCallback) { return ServiceFuture.fromResponse(listByClusterWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); }
ServiceFuture<List<DatabaseInner>> function(String resourceGroupName, String clusterName, final ServiceCallback<List<DatabaseInner>> serviceCallback) { return ServiceFuture.fromResponse(listByClusterWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); }
/** * Returns the list of databases of the given Kusto cluster. * * @param resourceGroupName The name of the resource group containing the Kusto cluster. * @param clusterName The name of the Kusto cluster. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Returns the list of databases of the given Kusto cluster
listByClusterAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/kusto/mgmt-v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesInner.java", "license": "mit", "size": 87420 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.List" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
2,125,998
EReference getDocumentRoot_SignalEventDefinition();
EReference getDocumentRoot_SignalEventDefinition();
/** * Returns the meta object for the containment reference '{@link org.eclipse.bpmn2.DocumentRoot#getSignalEventDefinition <em>Signal Event Definition</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Signal Event Definition</em>'. * @see org.eclipse.bpmn2.DocumentRoot#getSignalEventDefinition() * @see #getDocumentRoot() * @generated */
Returns the meta object for the containment reference '<code>org.eclipse.bpmn2.DocumentRoot#getSignalEventDefinition Signal Event Definition</code>'.
getDocumentRoot_SignalEventDefinition
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,124,049
public boolean isAccountDisabled(String username) { LockOutFlag flag = getDisabledStatus(username); if (flag == null) { return false; } Date curDate = new Date(); if (flag.getStartTime() != null && curDate.before(flag.getStartTime())) { return false; } if (flag.getEndTime() != null && curDate.after(flag.getEndTime())) { return false; } return true; }
boolean function(String username) { LockOutFlag flag = getDisabledStatus(username); if (flag == null) { return false; } Date curDate = new Date(); if (flag.getStartTime() != null && curDate.before(flag.getStartTime())) { return false; } if (flag.getEndTime() != null && curDate.after(flag.getEndTime())) { return false; } return true; }
/** * Returns true or false if an account is currently locked out. * * @param username Username of account to check on. * @return True or false if the account is currently locked out. */
Returns true or false if an account is currently locked out
isAccountDisabled
{ "repo_name": "trimnguye/JavaChatServer", "path": "src/java/org/jivesoftware/openfire/lockout/LockOutManager.java", "license": "apache-2.0", "size": 9689 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
781,499
public CountDownLatch getRatesAsync(com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, String responseFields, AsyncCallback<com.mozu.api.contracts.shippingruntime.RatesResponse> callback) throws Exception { MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> client = com.mozu.api.clients.commerce.catalog.storefront.ShippingClient.getRatesClient( rateRequest, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
CountDownLatch function(com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, String responseFields, AsyncCallback<com.mozu.api.contracts.shippingruntime.RatesResponse> callback) throws Exception { MozuClient<com.mozu.api.contracts.shippingruntime.RatesResponse> client = com.mozu.api.clients.commerce.catalog.storefront.ShippingClient.getRatesClient( rateRequest, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); }
/** * Retrieves the shipping rates applicable for the site. * <p><pre><code> * Shipping shipping = new Shipping(); * CountDownLatch latch = shipping.getRates( rateRequest, responseFields, callback ); * latch.await() * </code></pre></p> * @param responseFields Use this field to include those fields which are not included by default. * @param callback callback handler for asynchronous operations * @param rateRequest Properties required to request a shipping rate calculation. * @return com.mozu.api.contracts.shippingruntime.RatesResponse * @see com.mozu.api.contracts.shippingruntime.RatesResponse * @see com.mozu.api.contracts.shippingruntime.RateRequest */
Retrieves the shipping rates applicable for the site. <code><code> Shipping shipping = new Shipping(); CountDownLatch latch = shipping.getRates( rateRequest, responseFields, callback ); latch.await() * </code></code>
getRatesAsync
{ "repo_name": "sanjaymandadi/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/catalog/storefront/ShippingResource.java", "license": "mit", "size": 4704 }
[ "com.mozu.api.AsyncCallback", "com.mozu.api.MozuClient", "java.util.concurrent.CountDownLatch" ]
import com.mozu.api.AsyncCallback; import com.mozu.api.MozuClient; import java.util.concurrent.CountDownLatch;
import com.mozu.api.*; import java.util.concurrent.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
381,255
private void createNewLandingZones() { try { List<String> lzPaths = tenantDA.getLzPaths(); LOG.debug("TenantProcessor: Localhost is {}", getHostname()); for (String currLzPath : lzPaths) { createDirIfNotExists(currLzPath); } } catch (UnknownHostException e) { LOG.error("TenantProcessor", e); } }
void function() { try { List<String> lzPaths = tenantDA.getLzPaths(); LOG.debug(STR, getHostname()); for (String currLzPath : lzPaths) { createDirIfNotExists(currLzPath); } } catch (UnknownHostException e) { LOG.error(STR, e); } }
/** * Attempt to create new landing zones based on the tenant DB collection. */
Attempt to create new landing zones based on the tenant DB collection
createNewLandingZones
{ "repo_name": "inbloom/secure-data-service", "path": "sli/ingestion/ingestion-core/src/main/java/org/slc/sli/ingestion/processors/TenantProcessor.java", "license": "apache-2.0", "size": 9423 }
[ "java.net.UnknownHostException", "java.util.List" ]
import java.net.UnknownHostException; import java.util.List;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
1,400,370
public static interface RequestCallback<T> { public void onSuccess(EditorRequest<T> request);
static interface RequestCallback<T> { public void function(EditorRequest<T> request);
/** * The method that must be called when the request has been * processed correctly. * * @param request * the original request object */
The method that must be called when the request has been processed correctly
onSuccess
{ "repo_name": "fireflyc/vaadin", "path": "client/src/com/vaadin/client/widgets/Grid.java", "license": "apache-2.0", "size": 285073 }
[ "com.vaadin.client.widget.grid.EditorHandler" ]
import com.vaadin.client.widget.grid.EditorHandler;
import com.vaadin.client.widget.grid.*;
[ "com.vaadin.client" ]
com.vaadin.client;
2,082
public Node item(int index);
Node function(int index);
/** * This method retrieves a node specified by ordinal index. Nodes are * numbered in tree order (depth-first traversal order). * @param index The index of the node to be fetched. The index origin is * 0. * @return The <code>Node</code> at the corresponding position upon * success. A value of <code>null</code> is returned if the index is * out of range. */
This method retrieves a node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order)
item
{ "repo_name": "SaharChang/Author-Extraction", "path": "AuthorExtract/src/org/w3c/dom/html2/HTMLOptionsCollection.java", "license": "apache-2.0", "size": 3895 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,260,146
public ServiceFuture<List<RegexEntityExtractor>> listRegexEntityInfosAsync(UUID appId, String versionId, ListRegexEntityInfosOptionalParameter listRegexEntityInfosOptionalParameter, final ServiceCallback<List<RegexEntityExtractor>> serviceCallback) { return ServiceFuture.fromResponse(listRegexEntityInfosWithServiceResponseAsync(appId, versionId, listRegexEntityInfosOptionalParameter), serviceCallback); }
ServiceFuture<List<RegexEntityExtractor>> function(UUID appId, String versionId, ListRegexEntityInfosOptionalParameter listRegexEntityInfosOptionalParameter, final ServiceCallback<List<RegexEntityExtractor>> serviceCallback) { return ServiceFuture.fromResponse(listRegexEntityInfosWithServiceResponseAsync(appId, versionId, listRegexEntityInfosOptionalParameter), serviceCallback); }
/** * Gets information about the regular expression entity models in a version of the application. * * @param appId The application ID. * @param versionId The version ID. * @param listRegexEntityInfosOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Gets information about the regular expression entity models in a version of the application
listRegexEntityInfosAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cognitiveservices/ms-azure-cs-luis-authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java", "license": "mit", "size": 818917 }
[ "com.microsoft.azure.cognitiveservices.language.luis.authoring.models.ListRegexEntityInfosOptionalParameter", "com.microsoft.azure.cognitiveservices.language.luis.authoring.models.RegexEntityExtractor", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.List" ]
import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.ListRegexEntityInfosOptionalParameter; import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.RegexEntityExtractor; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List;
import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.*; import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.azure", "com.microsoft.rest", "java.util" ]
com.microsoft.azure; com.microsoft.rest; java.util;
2,213,434
private void startIntellicutPanelShowTimer(DisplayedPartConnectable dPartConnectable) { boolean enabled = GemCutter.getPreferences().getBoolean(INTELLICUT_POPUP_ENABLED_PREF_KEY, INTELLICUT_POPUP_ENABLED_DEFAULT); if (enabled) { int delay = GemCutter.getPreferences().getInt(INTELLICUT_POPUP_DELAY_PREF_KEY, INTELLICUT_POPUP_DELAY_DEFAULT) * 1000; intellicutPanelShowTimer = new Timer(delay, new IntellicutShowTimerActionListener(dPartConnectable)); intellicutPanelShowTimer.setRepeats(false); intellicutPanelShowTimer.start(); } } } private class IntellicutShowTimerActionListener implements ActionListener { private final DisplayedPartConnectable dPartConnectable; public IntellicutShowTimerActionListener(DisplayedPartConnectable dConnectablePart) { this.dPartConnectable = dConnectablePart; }
void function(DisplayedPartConnectable dPartConnectable) { boolean enabled = GemCutter.getPreferences().getBoolean(INTELLICUT_POPUP_ENABLED_PREF_KEY, INTELLICUT_POPUP_ENABLED_DEFAULT); if (enabled) { int delay = GemCutter.getPreferences().getInt(INTELLICUT_POPUP_DELAY_PREF_KEY, INTELLICUT_POPUP_DELAY_DEFAULT) * 1000; intellicutPanelShowTimer = new Timer(delay, new IntellicutShowTimerActionListener(dPartConnectable)); intellicutPanelShowTimer.setRepeats(false); intellicutPanelShowTimer.start(); } } } private class IntellicutShowTimerActionListener implements ActionListener { private final DisplayedPartConnectable dPartConnectable; public IntellicutShowTimerActionListener(DisplayedPartConnectable dConnectablePart) { this.dPartConnectable = dConnectablePart; }
/** * Start the intellicutPanelShowTimer if automatic intellicut is enabled. */
Start the intellicutPanelShowTimer if automatic intellicut is enabled
startIntellicutPanelShowTimer
{ "repo_name": "levans/Open-Quark", "path": "src/Quark_Gems/src/org/openquark/gems/client/IntellicutManager.java", "license": "bsd-3-clause", "size": 45071 }
[ "java.awt.event.ActionListener", "javax.swing.Timer", "org.openquark.gems.client.DisplayedGem" ]
import java.awt.event.ActionListener; import javax.swing.Timer; import org.openquark.gems.client.DisplayedGem;
import java.awt.event.*; import javax.swing.*; import org.openquark.gems.client.*;
[ "java.awt", "javax.swing", "org.openquark.gems" ]
java.awt; javax.swing; org.openquark.gems;
1,243,715
public DependencyCustomizer add(String module, boolean transitive) { return add(module, null, null, transitive); } /** * Add a single dependency with the specified classifier and type and, optionally, all * of its dependencies. The group ID and version of the dependency are resolved from * the module by using the customizer's {@link ArtifactCoordinatesResolver}. * @param module The module ID * @param classifier The classifier, may be {@code null} * @param type The type, may be {@code null}
DependencyCustomizer function(String module, boolean transitive) { return add(module, null, null, transitive); } /** * Add a single dependency with the specified classifier and type and, optionally, all * of its dependencies. The group ID and version of the dependency are resolved from * the module by using the customizer's {@link ArtifactCoordinatesResolver}. * @param module The module ID * @param classifier The classifier, may be {@code null} * @param type The type, may be {@code null}
/** * Add a single dependency and, optionally, all of its dependencies. The group ID and * version of the dependency are resolved from the module using the customizer's * {@link ArtifactCoordinatesResolver}. * @param module The module ID * @param transitive {@code true} if the transitive dependencies should also be added, * otherwise {@code false}. * @return this {@link DependencyCustomizer} for continued use */
Add a single dependency and, optionally, all of its dependencies. The group ID and version of the dependency are resolved from the module using the customizer's <code>ArtifactCoordinatesResolver</code>
add
{ "repo_name": "srikalyan/spring-boot", "path": "spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java", "license": "apache-2.0", "size": 9061 }
[ "org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver" ]
import org.springframework.boot.cli.compiler.dependencies.ArtifactCoordinatesResolver;
import org.springframework.boot.cli.compiler.dependencies.*;
[ "org.springframework.boot" ]
org.springframework.boot;
1,382,708
protected boolean hasExternalBusinessObjectProperty(Class boClass, Map<String,String> fieldValues ) { try { Object sampleBo = boClass.newInstance(); for ( String key : fieldValues.keySet() ) { if ( isExternalBusinessObjectProperty( sampleBo, key )) { return true; } } } catch ( Exception ex ) { LOG.debug("Unable to check " + boClass + " for EBO properties.", ex ); } return false; }
boolean function(Class boClass, Map<String,String> fieldValues ) { try { Object sampleBo = boClass.newInstance(); for ( String key : fieldValues.keySet() ) { if ( isExternalBusinessObjectProperty( sampleBo, key )) { return true; } } } catch ( Exception ex ) { LOG.debug(STR + boClass + STR, ex ); } return false; }
/** * Checks whether any of the fieldValues being passed refer to a property within an ExternalizableBusinessObject. */
Checks whether any of the fieldValues being passed refer to a property within an ExternalizableBusinessObject
hasExternalBusinessObjectProperty
{ "repo_name": "geothomasp/kualico-rice-kc", "path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/lookup/KualiLookupableHelperServiceImpl.java", "license": "apache-2.0", "size": 20067 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,261,182
@Test public void testSetObject() { KeyedObjects2D data = new KeyedObjects2D(); data.setObject("Obj1", "R1", "C1"); data.setObject("Obj2", "R2", "C2"); assertEquals("Obj1", data.getObject("R1", "C1")); assertEquals("Obj2", data.getObject("R2", "C2")); assertNull(data.getObject("R1", "C2")); assertNull(data.getObject("R2", "C1")); // confirm overwriting an existing value data.setObject("ABC", "R2", "C2"); assertEquals("ABC", data.getObject("R2", "C2")); // try null keys try { data.setObject("X", null, "C1"); fail("Should have thrown IllegalArgumentException on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'rowKey' argument.", e.getMessage()); } try { data.setObject("X", "R1", null); fail("Should have thrown IllegalArgumentException on duplicate key"); } catch (IllegalArgumentException e) { assertEquals("Null 'columnKey' argument.", e.getMessage()); } }
void function() { KeyedObjects2D data = new KeyedObjects2D(); data.setObject("Obj1", "R1", "C1"); data.setObject("Obj2", "R2", "C2"); assertEquals("Obj1", data.getObject("R1", "C1")); assertEquals("Obj2", data.getObject("R2", "C2")); assertNull(data.getObject("R1", "C2")); assertNull(data.getObject("R2", "C1")); data.setObject("ABC", "R2", "C2"); assertEquals("ABC", data.getObject("R2", "C2")); try { data.setObject("X", null, "C1"); fail(STR); } catch (IllegalArgumentException e) { assertEquals(STR, e.getMessage()); } try { data.setObject("X", "R1", null); fail(STR); } catch (IllegalArgumentException e) { assertEquals(STR, e.getMessage()); } }
/** * Some checks for the setObject(Object, Comparable, Comparable) method. */
Some checks for the setObject(Object, Comparable, Comparable) method
testSetObject
{ "repo_name": "akardapolov/ASH-Viewer", "path": "jfreechart-fse/src/test/java/org/jfree/data/KeyedObjects2DTest.java", "license": "gpl-3.0", "size": 12839 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,383,865
private static String getPictureString(ParseObject parseUser) { if (parseUser != null) { // Get "pictures" from Parse table "FacebookAccounts" // in the parseUser row String list = (String) parseUser.get("pictures"); return list; } return null; }
static String function(ParseObject parseUser) { if (parseUser != null) { String list = (String) parseUser.get(STR); return list; } return null; }
/** * getPictureString() returns the string from the pictures column of the * FacebookAccounts table of the parseUser in the NOM Parse database. * * Note: The string should be split with "," to obtain each photo ID. */
getPictureString() returns the string from the pictures column of the FacebookAccounts table of the parseUser in the NOM Parse database. Note: The string should be split with "," to obtain each photo ID
getPictureString
{ "repo_name": "wihuang/Team-Alice", "path": "ProjectNom/src/cse110/TeamNom/projectnom/AppParseAccess.java", "license": "mit", "size": 24207 }
[ "com.parse.ParseObject" ]
import com.parse.ParseObject;
import com.parse.*;
[ "com.parse" ]
com.parse;
78,571
public SyncMemberState syncState() { return this.syncState; }
SyncMemberState function() { return this.syncState; }
/** * Get sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'. * * @return the syncState value */
Get sync state of the sync member. Possible values include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', 'DisabledTombstoneCleanup', 'DisabledBackupRestore', 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', 'ReprovisionFailed', 'UnReprovisioned'
syncState
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/sql/mgmt-v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMemberInner.java", "license": "mit", "size": 7895 }
[ "com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberState" ]
import com.microsoft.azure.management.sql.v2015_05_01_preview.SyncMemberState;
import com.microsoft.azure.management.sql.v2015_05_01_preview.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,691,168
public void resizeText(int width, int height) { CharSequence text = getText(); // Do not resize if the view does not have dimensions or there is no text if (text == null || text.length() == 0 || height <= 0 || width <= 0 || mTextSize == 0) { return; } // Get the text view's paint object TextPaint textPaint = getPaint(); // Store the current text size float oldTextSize = textPaint.getTextSize(); // If there is a max text size set, use the lesser of that and the default text size float targetTextSize = mMaxTextSize > 0 ? Math.min(mTextSize, mMaxTextSize) : mTextSize; // Get the required text height int textHeight = getTextHeight(text, textPaint, width, targetTextSize); // Until we either fit within our text view or we had reached our min text size, incrementally try smaller sizes while (textHeight > height && targetTextSize > mMinTextSize) { targetTextSize = Math.max(targetTextSize - 2, mMinTextSize); textHeight = getTextHeight(text, textPaint, width, targetTextSize); } // If we had reached our minimum text size and still don't fit, append an ellipsis if (mAddEllipsis && targetTextSize == mMinTextSize && textHeight > height) { // Draw using a static layout // modified: use a copy of TextPaint for measuring TextPaint paint = new TextPaint(textPaint); // Draw using a static layout StaticLayout layout = new StaticLayout(text, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, false); // Check that we have a least one line of rendered text if (layout.getLineCount() > 0) { // Since the line at the specific vertical position would be cut off, // we must trim up to the previous line int lastLine = layout.getLineForVertical(height) - 1; // If the text would not even fit on a single line, clear it if (lastLine < 0) { setText(""); } // Otherwise, trim to the previous line and add an ellipsis else { int start = layout.getLineStart(lastLine); int end = layout.getLineEnd(lastLine); float lineWidth = layout.getLineWidth(lastLine); float ellipseWidth = textPaint.measureText(mEllipsis); // Trim characters off until we have enough room to draw the ellipsis while (width < lineWidth + ellipseWidth) { lineWidth = textPaint.measureText(text.subSequence(start, --end + 1).toString()); } setText(text.subSequence(0, end) + mEllipsis); } } } // Some devices try to auto adjust line spacing, so force default line spacing // and invalidate the layout as a side effect setTextSize(TypedValue.COMPLEX_UNIT_PX, targetTextSize); setLineSpacing(mSpacingAdd, mSpacingMult); // Notify the listener if registered if (mTextResizeListener != null) { mTextResizeListener.onTextResize(this, oldTextSize, targetTextSize); } // Reset force resize flag mNeedsResize = false; }
void function(int width, int height) { CharSequence text = getText(); if (text == null text.length() == 0 height <= 0 width <= 0 mTextSize == 0) { return; } TextPaint textPaint = getPaint(); float oldTextSize = textPaint.getTextSize(); float targetTextSize = mMaxTextSize > 0 ? Math.min(mTextSize, mMaxTextSize) : mTextSize; int textHeight = getTextHeight(text, textPaint, width, targetTextSize); while (textHeight > height && targetTextSize > mMinTextSize) { targetTextSize = Math.max(targetTextSize - 2, mMinTextSize); textHeight = getTextHeight(text, textPaint, width, targetTextSize); } if (mAddEllipsis && targetTextSize == mMinTextSize && textHeight > height) { TextPaint paint = new TextPaint(textPaint); StaticLayout layout = new StaticLayout(text, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, false); if (layout.getLineCount() > 0) { int lastLine = layout.getLineForVertical(height) - 1; if (lastLine < 0) { setText(""); } else { int start = layout.getLineStart(lastLine); int end = layout.getLineEnd(lastLine); float lineWidth = layout.getLineWidth(lastLine); float ellipseWidth = textPaint.measureText(mEllipsis); while (width < lineWidth + ellipseWidth) { lineWidth = textPaint.measureText(text.subSequence(start, --end + 1).toString()); } setText(text.subSequence(0, end) + mEllipsis); } } } setTextSize(TypedValue.COMPLEX_UNIT_PX, targetTextSize); setLineSpacing(mSpacingAdd, mSpacingMult); if (mTextResizeListener != null) { mTextResizeListener.onTextResize(this, oldTextSize, targetTextSize); } mNeedsResize = false; }
/** * Resize the text size with specified width and height * @param width * @param height */
Resize the text size with specified width and height
resizeText
{ "repo_name": "fabiophillip/sumosenseimongodb", "path": "src/cenario/AutoResizeTextView.java", "license": "epl-1.0", "size": 10759 }
[ "android.text.Layout", "android.text.StaticLayout", "android.text.TextPaint", "android.util.TypedValue" ]
import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.util.TypedValue;
import android.text.*; import android.util.*;
[ "android.text", "android.util" ]
android.text; android.util;
152,322
@Override public void exitVarType(@NotNull JavaParser.VarTypeContext ctx) { }
@Override public void exitVarType(@NotNull JavaParser.VarTypeContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterVarType
{ "repo_name": "ChShersh/university-courses", "path": "parsing-course/03/src/com/kovanikov/parser/JavaBaseListener.java", "license": "mit", "size": 10426 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,569,143
public Unit<?> getUnits() { return unit; }
Unit<?> function() { return unit; }
/** * Returns the unit information for quantitative categories in this list. May returns {@code * null} if there is no quantitative categories in this list, or if there is no unit * information. */
Returns the unit information for quantitative categories in this list. May returns null if there is no quantitative categories in this list, or if there is no unit information
getUnits
{ "repo_name": "geotools/geotools", "path": "modules/library/coverage/src/main/java/org/geotools/coverage/CategoryList.java", "license": "lgpl-2.1", "size": 32378 }
[ "javax.measure.Unit" ]
import javax.measure.Unit;
import javax.measure.*;
[ "javax.measure" ]
javax.measure;
2,600,612
static Manifest getManifest(final File file) { final Manifest result = withJar(file, ManifestExtractor.INSTANCE); return (result == null) ? new Manifest() : result; }
static Manifest getManifest(final File file) { final Manifest result = withJar(file, ManifestExtractor.INSTANCE); return (result == null) ? new Manifest() : result; }
/** * Get the {@link Manifest} from a Jar file, or create a new one if there isn't one already. * * @param file the file that is the jar contents * @return the manifest or an empty new one if one can't be found. */
Get the <code>Manifest</code> from a Jar file, or create a new one if there isn't one already
getManifest
{ "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.util.jar.Manifest" ]
import java.io.File; import java.util.jar.Manifest;
import java.io.*; import java.util.jar.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,876,857
public DataStore<Object, Persistent> getDataStore() { return dataStore; }
DataStore<Object, Persistent> function() { return dataStore; }
/** * Get DataStore */
Get DataStore
getDataStore
{ "repo_name": "jlpedrosa/camel", "path": "components/camel-gora/src/main/java/org/apache/camel/component/gora/GoraComponent.java", "license": "apache-2.0", "size": 3327 }
[ "org.apache.gora.persistency.Persistent", "org.apache.gora.store.DataStore" ]
import org.apache.gora.persistency.Persistent; import org.apache.gora.store.DataStore;
import org.apache.gora.persistency.*; import org.apache.gora.store.*;
[ "org.apache.gora" ]
org.apache.gora;
793,409
public void setRegisterValueValue(YangString registerValueValue) throws JNCException { setLeafValue(Epc.NAMESPACE, "register-value", registerValueValue, childrenNames()); }
void function(YangString registerValueValue) throws JNCException { setLeafValue(Epc.NAMESPACE, STR, registerValueValue, childrenNames()); }
/** * Sets the value for child leaf "register-value", * using instance of generated typedef class. * @param registerValueValue The value to set. * @param registerValueValue used during instantiation. */
Sets the value for child leaf "register-value", using instance of generated typedef class
setRegisterValueValue
{ "repo_name": "jnpr-shinma/yangfile", "path": "hitel/src/hctaEpc/mmeSgsn/statistics/gprsMm/RauFail.java", "license": "apache-2.0", "size": 11341 }
[ "com.tailf.jnc.YangString" ]
import com.tailf.jnc.YangString;
import com.tailf.jnc.*;
[ "com.tailf.jnc" ]
com.tailf.jnc;
2,338,398
@Override public void run(Formatter formatter, Reporter reporter, Runtime runtime) { Set<Tag> tags = tagsAndInheritedTags(); runtime.buildBackendWorlds(reporter, tags, scenario); try { formatter.startOfScenarioLifeCycle((Scenario) getGherkinModel()); } catch (Throwable ignore) { // IntelliJ has its own formatter which doesn't yet implement this. } runtime.runBeforeHooks(reporter, tags); runBackground(formatter, reporter, runtime); format(formatter); runSteps(reporter, runtime); runtime.runAfterHooks(reporter, tags); try { formatter.endOfScenarioLifeCycle((Scenario) getGherkinModel()); } catch (Throwable ignore) { // IntelliJ has its own formatter which doesn't yet implement this. } runtime.disposeBackendWorlds(); }
void function(Formatter formatter, Reporter reporter, Runtime runtime) { Set<Tag> tags = tagsAndInheritedTags(); runtime.buildBackendWorlds(reporter, tags, scenario); try { formatter.startOfScenarioLifeCycle((Scenario) getGherkinModel()); } catch (Throwable ignore) { } runtime.runBeforeHooks(reporter, tags); runBackground(formatter, reporter, runtime); format(formatter); runSteps(reporter, runtime); runtime.runAfterHooks(reporter, tags); try { formatter.endOfScenarioLifeCycle((Scenario) getGherkinModel()); } catch (Throwable ignore) { } runtime.disposeBackendWorlds(); }
/** * This method is called when Cucumber is run from the CLI, but not when run from JUnit */
This method is called when Cucumber is run from the CLI, but not when run from JUnit
run
{ "repo_name": "roman-grytsay/cucumber-rocky", "path": "src/test/java/framework/manager/cucumber/runtime/model/CucumberScenario.java", "license": "mit", "size": 2412 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,957,817
public SparseDataset parse(String name, String path) throws FileNotFoundException, IOException, ParseException { return parse(name, new File(path)); }
SparseDataset function(String name, String path) throws FileNotFoundException, IOException, ParseException { return parse(name, new File(path)); }
/** * Parse a sparse dataset from given file. * @param path the file path of data source. * @throws java.io.FileNotFoundException */
Parse a sparse dataset from given file
parse
{ "repo_name": "wavelets/smile", "path": "SmileData/src/smile/data/parser/SparseDatasetParser.java", "license": "apache-2.0", "size": 5737 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.IOException", "java.text.ParseException" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.text.ParseException;
import java.io.*; import java.text.*;
[ "java.io", "java.text" ]
java.io; java.text;
530,768
@ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller<PollResult<ApplicationSecurityGroupInner>, ApplicationSecurityGroupInner> beginUpdateTags( String resourceGroupName, String applicationSecurityGroupName, TagsObject parameters, Context context) { return beginUpdateTagsAsync(resourceGroupName, applicationSecurityGroupName, parameters, context) .getSyncPoller(); }
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<ApplicationSecurityGroupInner>, ApplicationSecurityGroupInner> function( String resourceGroupName, String applicationSecurityGroupName, TagsObject parameters, Context context) { return beginUpdateTagsAsync(resourceGroupName, applicationSecurityGroupName, parameters, context) .getSyncPoller(); }
/** * Updates an application security group's tags. * * @param resourceGroupName The name of the resource group. * @param applicationSecurityGroupName The name of the application security group. * @param parameters Parameters supplied to update application security group tags. * @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 an application security group in a resource group. */
Updates an application security group's tags
beginUpdateTags
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ApplicationSecurityGroupsClientImpl.java", "license": "mit", "size": 79677 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.ApplicationSecurityGroupInner", "com.azure.resourcemanager.network.models.TagsObject" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.ApplicationSecurityGroupInner; import com.azure.resourcemanager.network.models.TagsObject;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*; import com.azure.resourcemanager.network.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,739,930
private void handleReceivedSequence(ReceivedSequenceMsg message) { this.multiplayerFullSequence = message.getSequence(); message.getPresenter().getHandler().sendEmptyMessage(Constants.MULTIPLAYER_READY); }
void function(ReceivedSequenceMsg message) { this.multiplayerFullSequence = message.getSequence(); message.getPresenter().getHandler().sendEmptyMessage(Constants.MULTIPLAYER_READY); }
/** * 2nd player in multiplayer classic mode - Receives the sequence and communicates to the * GameViewActor "let the game begin!" * @param message */
2nd player in multiplayer classic mode - Receives the sequence and communicates to the GameViewActor "let the game begin!"
handleReceivedSequence
{ "repo_name": "simoneapp/S3-16-simone", "path": "app/src/main/java/app/simone/singleplayer/controller/CPUActor.java", "license": "mit", "size": 4730 }
[ "app.simone.shared.utils.Constants", "app.simone.singleplayer.messages.ReceivedSequenceMsg" ]
import app.simone.shared.utils.Constants; import app.simone.singleplayer.messages.ReceivedSequenceMsg;
import app.simone.shared.utils.*; import app.simone.singleplayer.messages.*;
[ "app.simone.shared", "app.simone.singleplayer" ]
app.simone.shared; app.simone.singleplayer;
1,687,685
public synchronized void close() throws IOException { if (logStream != null) { logStream.close(); } for (FileOutputStream log : streamsToFlush) { log.close(); } }
synchronized void function() throws IOException { if (logStream != null) { logStream.close(); } for (FileOutputStream log : streamsToFlush) { log.close(); } }
/** * close all the open file handles * @throws IOException */
close all the open file handles
close
{ "repo_name": "apurtell/zookeeper", "path": "src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java", "license": "apache-2.0", "size": 22283 }
[ "java.io.FileOutputStream", "java.io.IOException" ]
import java.io.FileOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,053,407
private void addSupplementaryAuthHeader(String headerName, String entity, Context context) { context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY) .ifPresent(headers -> { if (headers instanceof HttpHeaders) { HttpHeaders customHttpHeaders = (HttpHeaders) headers; customHttpHeaders.add(headerName, entity); } }); }
void function(String headerName, String entity, Context context) { context.getData(AZURE_REQUEST_HTTP_HEADERS_KEY) .ifPresent(headers -> { if (headers instanceof HttpHeaders) { HttpHeaders customHttpHeaders = (HttpHeaders) headers; customHttpHeaders.add(headerName, entity); } }); }
/** * Check that the additional headers field is present and add the additional auth header * * @param headerName name of the header to be added * @param context current request context * * @return boolean representing the outcome of adding header operation */
Check that the additional headers field is present and add the additional auth header
addSupplementaryAuthHeader
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java", "license": "mit", "size": 144140 }
[ "com.azure.core.http.HttpHeaders", "com.azure.core.util.Context" ]
import com.azure.core.http.HttpHeaders; import com.azure.core.util.Context;
import com.azure.core.http.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,726,383
@Test(expected = BadTsvLineException.class) public void testTsvParserBadTsvLineExcessiveColumns() throws BadTsvLineException { TsvParser parser = new TsvParser("HBASE_ROW_KEY,col_a", "\t"); byte[] line = Bytes.toBytes("val_a\tval_b\tval_c"); parser.parse(line, line.length); }
@Test(expected = BadTsvLineException.class) void function() throws BadTsvLineException { TsvParser parser = new TsvParser(STR, "\t"); byte[] line = Bytes.toBytes(STR); parser.parse(line, line.length); }
/** * Test cases that throw BadTsvLineException */
Test cases that throw BadTsvLineException
testTsvParserBadTsvLineExcessiveColumns
{ "repo_name": "HubSpot/hbase", "path": "hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportTsvParser.java", "license": "apache-2.0", "size": 14129 }
[ "org.apache.hadoop.hbase.mapreduce.ImportTsv", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Test" ]
import org.apache.hadoop.hbase.mapreduce.ImportTsv; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Test;
import org.apache.hadoop.hbase.mapreduce.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
2,719,330
private static void handle(ExecutionException ex) { Throwable cause = ex.getCause(); if (cause instanceof OperationCancelledException) { // Operation was cancelled, we don't necessary want to propagate // this up to the user. return; } if (cause instanceof DistributedSystemDisconnectedException) { throw new DistributedSystemDisconnectedException("While waiting for Future", ex); } // Don't just throw the cause because the stack trace can be // misleading. For instance, the cause might have occurred in a // different thread. In addition to the cause, we also want to // know which code was waiting for the Future. throw new RuntimeAdminException( LocalizedStrings.RemoteGfManagerAgent_AN_EXCEPUTIONEXCEPTION_WAS_THROWN_WHILE_WAITING_FOR_FUTURE .toLocalizedString(), ex); } // Object methodsg
static void function(ExecutionException ex) { Throwable cause = ex.getCause(); if (cause instanceof OperationCancelledException) { return; } if (cause instanceof DistributedSystemDisconnectedException) { throw new DistributedSystemDisconnectedException(STR, ex); } throw new RuntimeAdminException( LocalizedStrings.RemoteGfManagerAgent_AN_EXCEPUTIONEXCEPTION_WAS_THROWN_WHILE_WAITING_FOR_FUTURE .toLocalizedString(), ex); }
/** * Handles an <code>ExecutionException</code> by examining its cause and throwing an appropriate * runtime exception. */
Handles an <code>ExecutionException</code> by examining its cause and throwing an appropriate runtime exception
handle
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoteGfManagerAgent.java", "license": "apache-2.0", "size": 48674 }
[ "java.util.concurrent.ExecutionException", "org.apache.geode.admin.OperationCancelledException", "org.apache.geode.admin.RuntimeAdminException", "org.apache.geode.distributed.DistributedSystemDisconnectedException", "org.apache.geode.internal.i18n.LocalizedStrings" ]
import java.util.concurrent.ExecutionException; import org.apache.geode.admin.OperationCancelledException; import org.apache.geode.admin.RuntimeAdminException; import org.apache.geode.distributed.DistributedSystemDisconnectedException; import org.apache.geode.internal.i18n.LocalizedStrings;
import java.util.concurrent.*; import org.apache.geode.admin.*; import org.apache.geode.distributed.*; import org.apache.geode.internal.i18n.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,493,293
public static List<BundleInfo> generate(List<Feature> features, List<Feature> additionalFeatures, boolean forceBuild, String pluginPath, String eclipsePath, String target, String baseDir, String binFolder, String libsFolder) { //System.out.println(target + "\\LoaderLog.txt"); LoaderLog.init(target + "/LoaderLog.txt"); Generator gen = new Generator(new File(baseDir), new File(pluginPath), new File(eclipsePath), new File(binFolder), new File(libsFolder)); LoaderLog.writeLn(gen.eclipseURIPath); File targetDir; if (null != target) { targetDir = new File(target); } else { targetDir = new File("newGenerator"); } boolean failed = false; gen.checkedClasspaths = new ArrayList<String>(); //System.out.println("Generating..."); //System.out.println("ForceBuild = " + forceBuild); LoaderLog.writeLn("Generating..."); LoaderLog.writeLn("ForceBuild = " + forceBuild); LoaderLog.line(); List<BundleInfo> bundles = unnamed(gen, features, additionalFeatures, forceBuild); if (!failed) { gen.generateJarFiles(new File(targetDir, "unbundled"), true); gen.generateJarFiles(new File(targetDir, "bundled"), false); } else { System.out.println("BUILD FAILED! Please consider a forced build."); LoaderLog.writeLn("BUILD FAILED!"); } LoaderLog.close(); return bundles; } // checkstyle: resume parameter number check
static List<BundleInfo> function(List<Feature> features, List<Feature> additionalFeatures, boolean forceBuild, String pluginPath, String eclipsePath, String target, String baseDir, String binFolder, String libsFolder) { LoaderLog.init(target + STR); Generator gen = new Generator(new File(baseDir), new File(pluginPath), new File(eclipsePath), new File(binFolder), new File(libsFolder)); LoaderLog.writeLn(gen.eclipseURIPath); File targetDir; if (null != target) { targetDir = new File(target); } else { targetDir = new File(STR); } boolean failed = false; gen.checkedClasspaths = new ArrayList<String>(); LoaderLog.writeLn(STR); LoaderLog.writeLn(STR + forceBuild); LoaderLog.line(); List<BundleInfo> bundles = unnamed(gen, features, additionalFeatures, forceBuild); if (!failed) { gen.generateJarFiles(new File(targetDir, STR), true); gen.generateJarFiles(new File(targetDir, STR), false); } else { System.out.println(STR); LoaderLog.writeLn(STR); } LoaderLog.close(); return bundles; }
/** * Gathers Bundles for a list of features, depending on version restrictions. * @param features A list of features for the build. * @param forceBuild if true, ignore missing plugins and version issues. * @param additionalFeatures A list of features that could be used by the main features. * @param pluginPath the path of the plugins. Defines the bootstrap base. * @param eclipsePath the path to the eclipse plugins. * @param target the target for the generated jars. * @param baseDir The baseDir for the bootstrap. Will be used if eclipsePath and/or pluginPath do not exist. * @param binFolder Where to find the compiled classes, relative to basePath * @param libsFolder Where to find the special libs required for the build. * @return List<BundleInfo> a list containing all needed Bundles. */
Gathers Bundles for a list of features, depending on version restrictions
generate
{ "repo_name": "SSEHUB/EASyProducer", "path": "Tools/EASy-ANT/EASyLoader/src/de/uni_hildesheim/sse/easy/loader/Generator.java", "license": "apache-2.0", "size": 44963 }
[ "de.uni_hildesheim.sse.easy.loader.framework.BundleInfo", "de.uni_hildesheim.sse.easy.loader.framework.Feature", "de.uni_hildesheim.sse.easy.loader.framework.LoaderLog", "java.io.File", "java.util.ArrayList", "java.util.List" ]
import de.uni_hildesheim.sse.easy.loader.framework.BundleInfo; import de.uni_hildesheim.sse.easy.loader.framework.Feature; import de.uni_hildesheim.sse.easy.loader.framework.LoaderLog; import java.io.File; import java.util.ArrayList; import java.util.List;
import de.uni_hildesheim.sse.easy.loader.framework.*; import java.io.*; import java.util.*;
[ "de.uni_hildesheim.sse", "java.io", "java.util" ]
de.uni_hildesheim.sse; java.io; java.util;
2,548,475
default @NotNull AnnotationBuilder highlightReference(@NotNull AnnotationBuilder annotationBuilder) { return annotationBuilder; }
default @NotNull AnnotationBuilder highlightReference(@NotNull AnnotationBuilder annotationBuilder) { return annotationBuilder; }
/** * Implement this method to set various attributes of the highlight. */
Implement this method to set various attributes of the highlight
highlightReference
{ "repo_name": "jwren/intellij-community", "path": "platform/refactoring/src/com/intellij/codeInsight/highlighting/PsiHighlightedReference.java", "license": "apache-2.0", "size": 1376 }
[ "com.intellij.lang.annotation.AnnotationBuilder", "org.jetbrains.annotations.NotNull" ]
import com.intellij.lang.annotation.AnnotationBuilder; import org.jetbrains.annotations.NotNull;
import com.intellij.lang.annotation.*; import org.jetbrains.annotations.*;
[ "com.intellij.lang", "org.jetbrains.annotations" ]
com.intellij.lang; org.jetbrains.annotations;
265,235
private TableRow addPlayer() { // first, make sure that we won't exceed the max number of players if (this.tableRows.size() >= config.getMaxPlayers()) { MessageBox.popUpMessage("Sorry, adding another player would exceed the maximum allowed.", this); return null; } // add the row TableRow row = (TableRow) getLayoutInflater().inflate( R.layout.game_player_list_row, playerTable, false); // Initialize the values in the Spinner control // GamePlayerType[] selTypes = config.getSelTypes(); GamePlayerType[] availTypes = config.getAvailTypes(); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>( this, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (GamePlayerType gpt : availTypes) { adapter.add(gpt.getTypeName()); } Spinner typeSpinner = (Spinner) row .findViewById(R.id.playerTypeSpinner); typeSpinner.setAdapter(adapter); // link player name field and spinner TextView playerName = (TextView) row .findViewById(R.id.playerNameEditText); typeSpinner.setOnItemSelectedListener(new SpinnerListListener(playerName, availTypes.length-1)); typeSpinner.setSelection(0); ArrayAdapter<CharSequence> adapter2 = new ArrayAdapter<CharSequence>( this, android.R.layout.simple_spinner_item); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (int j = 0; j < availTypes.length-1; j++) { // leaves out the last item (network player) adapter2.add(availTypes[j].getTypeName()); } Spinner remoteTypeSpinner = (Spinner)findViewById(R.id.remote_player_spinner); remoteTypeSpinner.setAdapter(adapter2); // set myself up as the button listener for the button ImageButton delButton = (ImageButton) row .findViewById(R.id.delPlayerButton); delButton.setOnClickListener(this); // add the row to the right lists and layout this.tableRows.add(row); playerTable.addView(row); return row; }// addPlayer
TableRow function() { if (this.tableRows.size() >= config.getMaxPlayers()) { MessageBox.popUpMessage(STR, this); return null; } TableRow row = (TableRow) getLayoutInflater().inflate( R.layout.game_player_list_row, playerTable, false); GamePlayerType[] availTypes = config.getAvailTypes(); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>( this, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (GamePlayerType gpt : availTypes) { adapter.add(gpt.getTypeName()); } Spinner typeSpinner = (Spinner) row .findViewById(R.id.playerTypeSpinner); typeSpinner.setAdapter(adapter); TextView playerName = (TextView) row .findViewById(R.id.playerNameEditText); typeSpinner.setOnItemSelectedListener(new SpinnerListListener(playerName, availTypes.length-1)); typeSpinner.setSelection(0); ArrayAdapter<CharSequence> adapter2 = new ArrayAdapter<CharSequence>( this, android.R.layout.simple_spinner_item); adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (int j = 0; j < availTypes.length-1; j++) { adapter2.add(availTypes[j].getTypeName()); } Spinner remoteTypeSpinner = (Spinner)findViewById(R.id.remote_player_spinner); remoteTypeSpinner.setAdapter(adapter2); ImageButton delButton = (ImageButton) row .findViewById(R.id.delPlayerButton); delButton.setOnClickListener(this); this.tableRows.add(row); playerTable.addView(row); return row; }
/** * addPlayer * * adds a new, blank row to the player table and initializes instance * variables and listeners appropriately * * @return a reference to the TableRow object that was created or null on * failure */
addPlayer adds a new, blank row to the player table and initializes instance variables and listeners appropriately
addPlayer
{ "repo_name": "MaxRobinson/Phase10", "path": "Phase10Proj/src/edu/up/cs301/game/GameMainActivity.java", "license": "gpl-2.0", "size": 24770 }
[ "android.widget.ArrayAdapter", "android.widget.ImageButton", "android.widget.Spinner", "android.widget.TableRow", "android.widget.TextView", "edu.up.cs301.game.config.GamePlayerType", "edu.up.cs301.game.util.MessageBox" ]
import android.widget.ArrayAdapter; import android.widget.ImageButton; import android.widget.Spinner; import android.widget.TableRow; import android.widget.TextView; import edu.up.cs301.game.config.GamePlayerType; import edu.up.cs301.game.util.MessageBox;
import android.widget.*; import edu.up.cs301.game.config.*; import edu.up.cs301.game.util.*;
[ "android.widget", "edu.up.cs301" ]
android.widget; edu.up.cs301;
1,436,329
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<MetricAlertResourceInner>> getByResourceGroupWithResponseAsync( String resourceGroupName, String ruleName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (ruleName == null) { return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); } final String apiVersion = "2018-03-01"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, ruleName, apiVersion, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<MetricAlertResourceInner>> function( String resourceGroupName, String ruleName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (ruleName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, ruleName, apiVersion, context); }
/** * Retrieve an alert rule definition. * * @param resourceGroupName The name of the resource group. * @param ruleName The name of the rule. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the metric alert resource. */
Retrieve an alert rule definition
getByResourceGroupWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-monitor/src/main/java/com/azure/resourcemanager/monitor/implementation/MetricAlertsClientImpl.java", "license": "mit", "size": 48535 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.monitor.fluent.models.MetricAlertResourceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.monitor.fluent.models.MetricAlertResourceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.monitor.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
773,306
protected void addNbportPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Vswitch_nbport_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Vswitch_nbport_feature", "_UI_Vswitch_type"), VmwarePackage.Literals.VSWITCH__NBPORT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), VmwarePackage.Literals.VSWITCH__NBPORT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Nbport feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Nbport feature.
addNbportPropertyDescriptor
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.vmware.edit/src-gen/org/eclipse/cmf/occi/multicloud/vmware/provider/VswitchItemProvider.java", "license": "epl-1.0", "size": 7713 }
[ "org.eclipse.cmf.occi.multicloud.vmware.VmwarePackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.cmf.occi.multicloud.vmware.VmwarePackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.cmf.occi.multicloud.vmware.*; import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.cmf", "org.eclipse.emf" ]
org.eclipse.cmf; org.eclipse.emf;
456,124
private String getFieldTypeAndAssignment(Method method, String fieldName) { StringBuilder builder = new StringBuilder(); builder.append("protected "); appendType(method.getGenericReturnType(), builder); builder.append(" "); builder.append(fieldName); builder.append(";\n"); return builder.toString(); }
String function(Method method, String fieldName) { StringBuilder builder = new StringBuilder(); builder.append(STR); appendType(method.getGenericReturnType(), builder); builder.append(" "); builder.append(fieldName); builder.append(";\n"); return builder.toString(); }
/** * In most cases we simply echo the return type and field name, except for JsonArray<T>, which is special in the server impl case, * since it must be represented by a List<T> for Gson to correctly serialize/deserialize it. * * @param method * The getter method. * @return String representation of what the field type should be, as well as the assignment (initial value) to said field type, if any. */
In most cases we simply echo the return type and field name, except for JsonArray, which is special in the server impl case, since it must be represented by a List for Gson to correctly serialize/deserialize it
getFieldTypeAndAssignment
{ "repo_name": "codenvy/che-core", "path": "platform-api/che-core-api-dto/src/main/java/org/eclipse/che/dto/generator/DtoImplServerTemplate.java", "license": "epl-1.0", "size": 32204 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,327,755
@Override public Object execute(ExecutionEvent event) { final TranspositionWizard wizard = new TranspositionWizard(); final WizardDialog dialog = new WizardDialog(getActiveWorkbenchWindow().getShell(), wizard); dialog.setHelpAvailable(true);
Object function(ExecutionEvent event) { final TranspositionWizard wizard = new TranspositionWizard(); final WizardDialog dialog = new WizardDialog(getActiveWorkbenchWindow().getShell(), wizard); dialog.setHelpAvailable(true);
/** * This methods performs the action */
This methods performs the action
execute
{ "repo_name": "kevinott/crypto", "path": "org.jcryptool.crypto.classic.transposition/src/org/jcryptool/crypto/classic/transposition/algorithm/TranspositionAlgorithmHandler.java", "license": "epl-1.0", "size": 5951 }
[ "org.eclipse.core.commands.ExecutionEvent", "org.eclipse.jface.wizard.WizardDialog", "org.jcryptool.crypto.classic.transposition.ui.TranspositionWizard" ]
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.jface.wizard.WizardDialog; import org.jcryptool.crypto.classic.transposition.ui.TranspositionWizard;
import org.eclipse.core.commands.*; import org.eclipse.jface.wizard.*; import org.jcryptool.crypto.classic.transposition.ui.*;
[ "org.eclipse.core", "org.eclipse.jface", "org.jcryptool.crypto" ]
org.eclipse.core; org.eclipse.jface; org.jcryptool.crypto;
1,587,757
public ServiceFuture<VpnProfileResponseInner> generatevirtualwanvpnserverconfigurationvpnprofileAsync(String resourceGroupName, String virtualWANName, VirtualWanVpnProfileParameters vpnClientParams, final ServiceCallback<VpnProfileResponseInner> serviceCallback) { return ServiceFuture.fromResponse(generatevirtualwanvpnserverconfigurationvpnprofileWithServiceResponseAsync(resourceGroupName, virtualWANName, vpnClientParams), serviceCallback); }
ServiceFuture<VpnProfileResponseInner> function(String resourceGroupName, String virtualWANName, VirtualWanVpnProfileParameters vpnClientParams, final ServiceCallback<VpnProfileResponseInner> serviceCallback) { return ServiceFuture.fromResponse(generatevirtualwanvpnserverconfigurationvpnprofileWithServiceResponseAsync(resourceGroupName, virtualWANName, vpnClientParams), serviceCallback); }
/** * Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguration combination in the specified resource group. * * @param resourceGroupName The resource group name. * @param virtualWANName The name of the VirtualWAN whose associated VpnServerConfigurations is needed. * @param vpnClientParams Parameters supplied to the generate VirtualWan VPN profile generation operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Generates a unique VPN profile for P2S clients for VirtualWan and associated VpnServerConfiguration combination in the specified resource group
generatevirtualwanvpnserverconfigurationvpnprofileAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/NetworkManagementClientImpl.java", "license": "mit", "size": 221650 }
[ "com.microsoft.azure.management.network.v2020_03_01.VirtualWanVpnProfileParameters", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.azure.management.network.v2020_03_01.VirtualWanVpnProfileParameters; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.azure.management.network.v2020_03_01.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,480,011
private List<String> getObjectsByType(String typeName) throws SQLException { return jdbcTemplate.queryForStringList("SELECT OBJECT_NAME FROM ALL_OBJECTS WHERE OWNER = ? AND OBJECT_TYPE = ?", name, typeName); }
List<String> function(String typeName) throws SQLException { return jdbcTemplate.queryForStringList(STR, name, typeName); }
/** * Get the list of database objects of this type. * * @param typeName The type of database objects. * @return The list of such objects in the schema. * @throws SQLException when the drop statements could not be generated. */
Get the list of database objects of this type
getObjectsByType
{ "repo_name": "Muni10/flyway", "path": "flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/oracle/OracleSchema.java", "license": "apache-2.0", "size": 22712 }
[ "java.sql.SQLException", "java.util.List" ]
import java.sql.SQLException; import java.util.List;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,012,918
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = new State(info); state.seriesPath = new GeneralPath(); return state; }
XYItemRendererState function(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = new State(info); state.seriesPath = new GeneralPath(); return state; }
/** * Initialises the renderer. * <P> * This method will be called before the first item is rendered, giving the * renderer an opportunity to initialise any state information it wants to * maintain. The renderer can do nothing if it chooses. * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. * @param data the data. * @param info an optional info collection object to return data back to * the caller. * * @return The renderer state. */
Initialises the renderer. This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses
initialise
{ "repo_name": "integrated/jfreechart", "path": "source/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java", "license": "lgpl-2.1", "size": 48215 }
[ "java.awt.Graphics2D", "java.awt.geom.GeneralPath", "java.awt.geom.Rectangle2D", "org.jfree.chart.plot.PlotRenderingInfo", "org.jfree.chart.plot.XYPlot", "org.jfree.data.xy.XYDataset" ]
import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data" ]
java.awt; org.jfree.chart; org.jfree.data;
1,067,977
public void setOptionsService(OptionsService optionsService) { this.optionsService = optionsService; }
void function(OptionsService optionsService) { this.optionsService = optionsService; }
/** * use this to return the "Expenditures/Expense" financial object type code from the options table this must be done by fiscal * year, so unfortunately we have to make one call to OJB whenever one of the methods that needs this constant is called. * * @param optionsService */
use this to return the "Expenditures/Expense" financial object type code from the options table this must be done by fiscal year, so unfortunately we have to make one call to OJB whenever one of the methods that needs this constant is called
setOptionsService
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/bc/document/service/impl/BenefitsCalculationServiceImpl.java", "license": "agpl-3.0", "size": 11444 }
[ "org.kuali.kfs.sys.service.OptionsService" ]
import org.kuali.kfs.sys.service.OptionsService;
import org.kuali.kfs.sys.service.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,829,268
@Override protected void writeAuthor(final FacesContext context, final ResponseWriter w, final UIForumPost c) throws IOException { UIComponent avatar = c.getFacet(UIForumPost.FACET_AUTHAVATAR); UIComponent name = c.getFacet(UIForumPost.FACET_AUTHNAME); UIComponent meta = c.getFacet(UIForumPost.FACET_POSTMETA); // Like I said: it's weird if(avatar != null) { w.startElement("div", null); // div.user String styleClass = (String)getProperty(PROP_AUTHORCLASS); if(StringUtil.isNotEmpty(styleClass)) { w.writeAttribute("class", styleClass, null); } String style = (String)getProperty(PROP_AUTHORSTYLE); if(StringUtil.isNotEmpty(style)) { w.writeAttribute("style", style, null); } writeAuthorAvatar(context, w, c, avatar); w.endElement("div"); newLine(w); } w.startElement("div", null); // div.body String styleClass = (String)getProperty(PROP_POSTCLASS); if(StringUtil.isNotEmpty(styleClass)) { w.writeAttribute("class", styleClass, null); } String style = (String)getProperty(PROP_POSTSTYLE); if(StringUtil.isNotEmpty(style)) { w.writeAttribute("style", style, null); } if(meta != null) { writeAuthorMeta(context, w, c, meta); } if(name != null) { writeAuthorName(context, w, c, name); } }
void function(final FacesContext context, final ResponseWriter w, final UIForumPost c) throws IOException { UIComponent avatar = c.getFacet(UIForumPost.FACET_AUTHAVATAR); UIComponent name = c.getFacet(UIForumPost.FACET_AUTHNAME); UIComponent meta = c.getFacet(UIForumPost.FACET_POSTMETA); if(avatar != null) { w.startElement("div", null); String styleClass = (String)getProperty(PROP_AUTHORCLASS); if(StringUtil.isNotEmpty(styleClass)) { w.writeAttribute("class", styleClass, null); } String style = (String)getProperty(PROP_AUTHORSTYLE); if(StringUtil.isNotEmpty(style)) { w.writeAttribute("style", style, null); } writeAuthorAvatar(context, w, c, avatar); w.endElement("div"); newLine(w); } w.startElement("div", null); String styleClass = (String)getProperty(PROP_POSTCLASS); if(StringUtil.isNotEmpty(styleClass)) { w.writeAttribute("class", styleClass, null); } String style = (String)getProperty(PROP_POSTSTYLE); if(StringUtil.isNotEmpty(style)) { w.writeAttribute("style", style, null); } if(meta != null) { writeAuthorMeta(context, w, c, meta); } if(name != null) { writeAuthorName(context, w, c, name); } }
/** * Due to the nature of the theme's structure where user info is in both "user" and "body", this opens a div that is later closed by the content. It's weird. */
Due to the nature of the theme's structure where user info is in both "user" and "body", this opens a div that is later closed by the content. It's weird
writeAuthor
{ "repo_name": "jesse-gallagher/Miscellany", "path": "frostillicus.wrapbootstrap.ace_1.3/src/frostillicus/wrapbootstrap/ace1_3/renderkit/data/AceForumPostRenderer.java", "license": "apache-2.0", "size": 5776 }
[ "com.ibm.commons.util.StringUtil", "com.ibm.xsp.extlib.component.data.UIForumPost", "java.io.IOException", "javax.faces.component.UIComponent", "javax.faces.context.FacesContext", "javax.faces.context.ResponseWriter" ]
import com.ibm.commons.util.StringUtil; import com.ibm.xsp.extlib.component.data.UIForumPost; import java.io.IOException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter;
import com.ibm.commons.util.*; import com.ibm.xsp.extlib.component.data.*; import java.io.*; import javax.faces.component.*; import javax.faces.context.*;
[ "com.ibm.commons", "com.ibm.xsp", "java.io", "javax.faces" ]
com.ibm.commons; com.ibm.xsp; java.io; javax.faces;
478,820
public int insert(String table, String key, HashMap<String,ByteIterator> values) { delay(); if (verbose) { System.out.print("INSERT "+table+" "+key+" [ "); if (values!=null) { for (String k : values.keySet()) { System.out.print(k+"="+values.get(k)+" "); } } System.out.println("]"); } return 0; }
int function(String table, String key, HashMap<String,ByteIterator> values) { delay(); if (verbose) { System.out.print(STR+table+" "+key+STR); if (values!=null) { for (String k : values.keySet()) { System.out.print(k+"="+values.get(k)+" "); } } System.out.println("]"); } return 0; }
/** * Insert a record in the database. Any field/value pairs in the specified values HashMap will be written into the record with the specified * record key. * * @param table The name of the table * @param key The record key of the record to insert. * @param values A HashMap of field/value pairs to insert in the record * @return Zero on success, a non-zero error code on error */
Insert a record in the database. Any field/value pairs in the specified values HashMap will be written into the record with the specified record key
insert
{ "repo_name": "netbear/CloudAnts", "path": "yscb/src/com/yahoo/ycsb/BasicDB.java", "license": "apache-2.0", "size": 8517 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,642,669
@Override public void sendHtmlMail(String from, String subject, String message, Collection<String> toAddresses) { this.sendHtmlMail(from, subject, message, toAddresses.toArray(new String[0])); }
void function(String from, String subject, String message, Collection<String> toAddresses) { this.sendHtmlMail(from, subject, message, toAddresses.toArray(new String[0])); }
/** * Notify users by email of something. * * @param from * @param subject * @param message * @param toAddresses */
Notify users by email of something
sendHtmlMail
{ "repo_name": "culmat/gitblit", "path": "src/main/java/com/gitblit/manager/NotificationManager.java", "license": "apache-2.0", "size": 5770 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,717,652
private static List<File> resolveAndArchive(FileSystem fs, Path baseArchiveDir, Collection<File> toArchive, long start) throws IOException { // short circuit if no files to move if (toArchive.size() == 0) return Collections.emptyList(); if (LOG.isTraceEnabled()) LOG.trace("moving files to the archive directory: " + baseArchiveDir); // make sure the archive directory exists if (!fs.exists(baseArchiveDir)) { if (!fs.mkdirs(baseArchiveDir)) { throw new IOException("Failed to create the archive directory:" + baseArchiveDir + ", quitting archive attempt."); } if (LOG.isTraceEnabled()) LOG.trace("Created archive directory:" + baseArchiveDir); } List<File> failures = new ArrayList<File>(); String startTime = Long.toString(start); for (File file : toArchive) { // if its a file archive it try { if (LOG.isTraceEnabled()) LOG.trace("Archiving: " + file); if (file.isFile()) { // attempt to archive the file if (!resolveAndArchiveFile(baseArchiveDir, file, startTime)) { LOG.warn("Couldn't archive " + file + " into backup directory: " + baseArchiveDir); failures.add(file); } } else { // otherwise its a directory and we need to archive all files if (LOG.isTraceEnabled()) LOG.trace(file + " is a directory, archiving children files"); // so we add the directory name to the one base archive Path parentArchiveDir = new Path(baseArchiveDir, file.getName()); // and then get all the files from that directory and attempt to // archive those too Collection<File> children = file.getChildren(); failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start)); } } catch (IOException e) { LOG.warn("Failed to archive " + file, e); failures.add(file); } } return failures; }
static List<File> function(FileSystem fs, Path baseArchiveDir, Collection<File> toArchive, long start) throws IOException { if (toArchive.size() == 0) return Collections.emptyList(); if (LOG.isTraceEnabled()) LOG.trace(STR + baseArchiveDir); if (!fs.exists(baseArchiveDir)) { if (!fs.mkdirs(baseArchiveDir)) { throw new IOException(STR + baseArchiveDir + STR); } if (LOG.isTraceEnabled()) LOG.trace(STR + baseArchiveDir); } List<File> failures = new ArrayList<File>(); String startTime = Long.toString(start); for (File file : toArchive) { try { if (LOG.isTraceEnabled()) LOG.trace(STR + file); if (file.isFile()) { if (!resolveAndArchiveFile(baseArchiveDir, file, startTime)) { LOG.warn(STR + file + STR + baseArchiveDir); failures.add(file); } } else { if (LOG.isTraceEnabled()) LOG.trace(file + STR); Path parentArchiveDir = new Path(baseArchiveDir, file.getName()); Collection<File> children = file.getChildren(); failures.addAll(resolveAndArchive(fs, parentArchiveDir, children, start)); } } catch (IOException e) { LOG.warn(STR + file, e); failures.add(file); } } return failures; }
/** * Resolve any conflict with an existing archive file via timestamp-append * renaming of the existing file and then archive the passed in files. * @param fs {@link FileSystem} on which to archive the files * @param baseArchiveDir base archive directory to store the files. If any of * the files to archive are directories, will append the name of the * directory to the base archive directory name, creating a parallel * structure. * @param toArchive files/directories that need to be archvied * @param start time the archiving started - used for resolving archive * conflicts. * @return the list of failed to archive files. * @throws IOException if an unexpected file operation exception occured */
Resolve any conflict with an existing archive file via timestamp-append renaming of the existing file and then archive the passed in files
resolveAndArchive
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/backup/HFileArchiver.java", "license": "apache-2.0", "size": 26785 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "java.util.List", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
598,442
public static RtNetlink decode(byte[] buffer, int start, int length) throws DeserializationException { checkInput(buffer, start, length, RT_NETLINK_LENGTH); ByteBuffer bb = ByteBuffer.wrap(buffer, start, length); short addressFamily = (short) (bb.get() & MASK); int dstLength = bb.get() & MASK; int srcLength = bb.get() & MASK; short tos = (short) (bb.get() & MASK); short table = (short) (bb.get() & MASK); short protocol = (short) (bb.get() & MASK); short scope = (short) (bb.get() & MASK); short type = (short) (bb.get() & MASK); long flags = Integer.reverseBytes(bb.getInt()); List<RouteAttribute> attributes = new ArrayList<>(); RtProtocol rtProtocol = RtProtocol.get(protocol); while (bb.hasRemaining()) { RouteAttribute attribute = RouteAttribute.decode(buffer, bb.position(), bb.limit() - bb.position()); attributes.add(attribute); bb.position(bb.position() + attribute.length()); } return new RtNetlink( addressFamily, dstLength, srcLength, tos, table, rtProtocol, scope, type, flags, attributes); }
static RtNetlink function(byte[] buffer, int start, int length) throws DeserializationException { checkInput(buffer, start, length, RT_NETLINK_LENGTH); ByteBuffer bb = ByteBuffer.wrap(buffer, start, length); short addressFamily = (short) (bb.get() & MASK); int dstLength = bb.get() & MASK; int srcLength = bb.get() & MASK; short tos = (short) (bb.get() & MASK); short table = (short) (bb.get() & MASK); short protocol = (short) (bb.get() & MASK); short scope = (short) (bb.get() & MASK); short type = (short) (bb.get() & MASK); long flags = Integer.reverseBytes(bb.getInt()); List<RouteAttribute> attributes = new ArrayList<>(); RtProtocol rtProtocol = RtProtocol.get(protocol); while (bb.hasRemaining()) { RouteAttribute attribute = RouteAttribute.decode(buffer, bb.position(), bb.limit() - bb.position()); attributes.add(attribute); bb.position(bb.position() + attribute.length()); } return new RtNetlink( addressFamily, dstLength, srcLength, tos, table, rtProtocol, scope, type, flags, attributes); }
/** * Decodes an rtnetlink message from an input buffer. * * @param buffer input buffer * @param start starting position the rtnetlink message * @param length length of the message * @return rtnetlink message * @throws DeserializationException if an rtnetlink message could not be * decoded from the input buffer */
Decodes an rtnetlink message from an input buffer
decode
{ "repo_name": "osinstom/onos", "path": "apps/routing/fpm/app/src/main/java/org/onosproject/routing/fpm/protocol/RtNetlink.java", "license": "apache-2.0", "size": 7251 }
[ "java.nio.ByteBuffer", "java.util.ArrayList", "java.util.List", "org.onlab.packet.DeserializationException", "org.onlab.packet.PacketUtils" ]
import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import org.onlab.packet.DeserializationException; import org.onlab.packet.PacketUtils;
import java.nio.*; import java.util.*; import org.onlab.packet.*;
[ "java.nio", "java.util", "org.onlab.packet" ]
java.nio; java.util; org.onlab.packet;
1,925,116
protected WebElement getColumnHidingToggle(GridElement grid, String caption) { WebElement sidebar = getSidebar(grid); List<WebElement> elements = sidebar.findElements(By .className("column-hiding-toggle")); for (WebElement e : elements) { if (caption.equalsIgnoreCase(e.getText())) { return e; } } return null; }
WebElement function(GridElement grid, String caption) { WebElement sidebar = getSidebar(grid); List<WebElement> elements = sidebar.findElements(By .className(STR)); for (WebElement e : elements) { if (caption.equalsIgnoreCase(e.getText())) { return e; } } return null; }
/** * Returns the toggle inside the sidebar for hiding the column at the given * index, or null if not found. */
Returns the toggle inside the sidebar for hiding the column at the given index, or null if not found
getColumnHidingToggle
{ "repo_name": "jdahlstrom/vaadin.react", "path": "uitest/src/test/java/com/vaadin/tests/components/grid/GridInitiallyHiddenColumnsTest.java", "license": "apache-2.0", "size": 3021 }
[ "com.vaadin.testbench.elements.GridElement", "java.util.List", "org.openqa.selenium.By", "org.openqa.selenium.WebElement" ]
import com.vaadin.testbench.elements.GridElement; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.*; import java.util.*; import org.openqa.selenium.*;
[ "com.vaadin.testbench", "java.util", "org.openqa.selenium" ]
com.vaadin.testbench; java.util; org.openqa.selenium;
464,401
public static void deleteFiles(final File... files) { for (final File f : files) { if (!f.delete()) { System.err.println("Could not delete file " + f); } } }
static void function(final File... files) { for (final File f : files) { if (!f.delete()) { System.err.println(STR + f); } } }
/** * Delete a list of files, and write a warning message if one could not be deleted. * * @param files Files to be deleted. */
Delete a list of files, and write a warning message if one could not be deleted
deleteFiles
{ "repo_name": "xubo245/CloudSW", "path": "src/main/java/htsjdk/samtools/util/IOUtil.java", "license": "gpl-2.0", "size": 35992 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,869,258
public static FunctionIdentifier findInternalCoreAggregateFunction(FunctionSignature fs) { String internalName = getInternalCoreAggregateFunctionName(fs); if (internalName == null) { return null; } FunctionIdentifier fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, internalName, fs.getArity()); IFunctionInfo finfo = FunctionUtil.getFunctionInfo(fi); if (finfo == null) { return null; } FunctionIdentifier fid = finfo.getFunctionIdentifier(); return BuiltinFunctions.getAggregateFunction(fid) != null ? fid : null; }
static FunctionIdentifier function(FunctionSignature fs) { String internalName = getInternalCoreAggregateFunctionName(fs); if (internalName == null) { return null; } FunctionIdentifier fi = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, internalName, fs.getArity()); IFunctionInfo finfo = FunctionUtil.getFunctionInfo(fi); if (finfo == null) { return null; } FunctionIdentifier fid = finfo.getFunctionIdentifier(); return BuiltinFunctions.getAggregateFunction(fid) != null ? fid : null; }
/** * Returns a function identifier of an internal core aggregate function * that this SQL++ core aggregate function maps to. * Returns {@code null} if given function is not a SQL++ core aggregate function * * @param fs the function signature. */
Returns a function identifier of an internal core aggregate function that this SQL++ core aggregate function maps to. Returns null if given function is not a SQL++ core aggregate function
findInternalCoreAggregateFunction
{ "repo_name": "apache/incubator-asterixdb", "path": "asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/FunctionMapUtil.java", "license": "apache-2.0", "size": 9264 }
[ "org.apache.asterix.common.functions.FunctionConstants", "org.apache.asterix.common.functions.FunctionSignature", "org.apache.asterix.lang.common.util.FunctionUtil", "org.apache.asterix.om.functions.BuiltinFunctions", "org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier", "org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo" ]
import org.apache.asterix.common.functions.FunctionConstants; import org.apache.asterix.common.functions.FunctionSignature; import org.apache.asterix.lang.common.util.FunctionUtil; import org.apache.asterix.om.functions.BuiltinFunctions; import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier; import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
import org.apache.asterix.common.functions.*; import org.apache.asterix.lang.common.util.*; import org.apache.asterix.om.functions.*; import org.apache.hyracks.algebricks.core.algebra.functions.*;
[ "org.apache.asterix", "org.apache.hyracks" ]
org.apache.asterix; org.apache.hyracks;
1,760,617
public void stopStream() { if (streaming) { streaming = false; stopStreamRtp(); } if (!recordController.isRecording()) { onPreview = !isBackground; if (audioInitialized) microphoneManager.stop(); if (glInterface != null) { glInterface.removeMediaCodecSurface(); if (glInterface instanceof OffScreenGlThread) { glInterface.stop(); cameraManager.closeCamera(); } } else { if (isBackground) { cameraManager.closeCamera(); onPreview = false; } else { cameraManager.stopRepeatingEncoder(); } } videoEncoder.stop(); if (audioInitialized) audioEncoder.stop(); recordController.resetFormats(); } }
void function() { if (streaming) { streaming = false; stopStreamRtp(); } if (!recordController.isRecording()) { onPreview = !isBackground; if (audioInitialized) microphoneManager.stop(); if (glInterface != null) { glInterface.removeMediaCodecSurface(); if (glInterface instanceof OffScreenGlThread) { glInterface.stop(); cameraManager.closeCamera(); } } else { if (isBackground) { cameraManager.closeCamera(); onPreview = false; } else { cameraManager.stopRepeatingEncoder(); } } videoEncoder.stop(); if (audioInitialized) audioEncoder.stop(); recordController.resetFormats(); } }
/** * Stop stream started with @startStream. */
Stop stream started with @startStream
stopStream
{ "repo_name": "pedroSG94/rtmp-streamer-java", "path": "rtplibrary/src/main/java/com/pedro/rtplibrary/base/Camera2Base.java", "license": "apache-2.0", "size": 30857 }
[ "com.pedro.rtplibrary.view.OffScreenGlThread" ]
import com.pedro.rtplibrary.view.OffScreenGlThread;
import com.pedro.rtplibrary.view.*;
[ "com.pedro.rtplibrary" ]
com.pedro.rtplibrary;
2,122,975
public void addPremadeTemplate(String templateName) throws Exception { URL testDataResource = getClass().getResource(TESTDATA_DIRECTORY); // If we're running this test in IJ, then this path doesn't exist. Fall back to one that does if (testDataResource != null && testDataResource.getPath().contains(".jar")) { this.addTemplateToWorkspace(testDataResource, templateName); } else { Path templatePath = FileSystems.getDefault() .getPath( "test", "com", "facebook", "buck", "testutil", "endtoend", TESTDATA_DIRECTORY, templateName); addTemplateToWorkspace(templatePath); } postAddPlatformConfiguration(); }
void function(String templateName) throws Exception { URL testDataResource = getClass().getResource(TESTDATA_DIRECTORY); if (testDataResource != null && testDataResource.getPath().contains(".jar")) { this.addTemplateToWorkspace(testDataResource, templateName); } else { Path templatePath = FileSystems.getDefault() .getPath( "test", "com", STR, "buck", STR, STR, TESTDATA_DIRECTORY, templateName); addTemplateToWorkspace(templatePath); } postAddPlatformConfiguration(); }
/** * Copies the template directory of a premade template, contained in endtoend/testdata, stripping * the suffix from files with suffix .fixture, and not copying files with suffix .expected */
Copies the template directory of a premade template, contained in endtoend/testdata, stripping the suffix from files with suffix .fixture, and not copying files with suffix .expected
addPremadeTemplate
{ "repo_name": "clonetwin26/buck", "path": "test/com/facebook/buck/testutil/endtoend/EndToEndWorkspace.java", "license": "apache-2.0", "size": 12687 }
[ "java.nio.file.FileSystems", "java.nio.file.Path" ]
import java.nio.file.FileSystems; import java.nio.file.Path;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
1,203,269
public IVec[] intersectPlane(IVecI planeDir, IVecI planePt, int segmentResolution){ ArrayList<IVec> itxns = new ArrayList<IVec>(); if(deg()>1){ IVec prevPt = pt(u(0,0.0)); double prevDot = prevPt.dif(planePt).dot(planeDir); if(prevDot==0) itxns.add(prevPt); for(int i=0; i<epNum(); i++){ int j=0; if(i==0) j=1; for(;j<segmentResolution; j++){ IVec pt = pt(u(i,(double)j/segmentResolution)); double dot = pt.dif(planePt).dot(planeDir); if(dot==0) itxns.add(pt); else if(dot<0 && prevDot>0 || dot>0 && prevDot<0 ){ itxns.add(IVec.intersectPlaneAndLine(planeDir.get(),planePt.get(), pt.dif(prevPt),pt)); } prevPt = pt; prevDot = dot; } } } else{ // polyline double prevDot = cp(0).dif(planePt).dot(planeDir); if(prevDot==0) itxns.add(cp(0).get().dup()); for(int i=1; i<cpNum(); i++){ double dot = cp(i).dif(planePt).dot(planeDir); if(dot==0) itxns.add(cp(i).get().dup()); else if(dot<0 && prevDot>0 || dot>0 && prevDot<0 ){ itxns.add(IVec.intersectPlaneAndLine(planeDir.get(), planePt.get(), cp(i).get().dif(cp(i-1)), cp(i).get())); } prevDot = dot; } } return itxns.toArray(new IVec[itxns.size()]); }
IVec[] function(IVecI planeDir, IVecI planePt, int segmentResolution){ ArrayList<IVec> itxns = new ArrayList<IVec>(); if(deg()>1){ IVec prevPt = pt(u(0,0.0)); double prevDot = prevPt.dif(planePt).dot(planeDir); if(prevDot==0) itxns.add(prevPt); for(int i=0; i<epNum(); i++){ int j=0; if(i==0) j=1; for(;j<segmentResolution; j++){ IVec pt = pt(u(i,(double)j/segmentResolution)); double dot = pt.dif(planePt).dot(planeDir); if(dot==0) itxns.add(pt); else if(dot<0 && prevDot>0 dot>0 && prevDot<0 ){ itxns.add(IVec.intersectPlaneAndLine(planeDir.get(),planePt.get(), pt.dif(prevPt),pt)); } prevPt = pt; prevDot = dot; } } } else{ double prevDot = cp(0).dif(planePt).dot(planeDir); if(prevDot==0) itxns.add(cp(0).get().dup()); for(int i=1; i<cpNum(); i++){ double dot = cp(i).dif(planePt).dot(planeDir); if(dot==0) itxns.add(cp(i).get().dup()); else if(dot<0 && prevDot>0 dot>0 && prevDot<0 ){ itxns.add(IVec.intersectPlaneAndLine(planeDir.get(), planePt.get(), cp(i).get().dif(cp(i-1)), cp(i).get())); } prevDot = dot; } } return itxns.toArray(new IVec[itxns.size()]); }
/** intersection of curve and plane. @param segmentResolution segmentation resolution per EP count in degree &gt;= 1 curve. */
intersection of curve and plane
intersectPlane
{ "repo_name": "sghr/iGeo", "path": "ICurveGeo.java", "license": "lgpl-3.0", "size": 44873 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,856,750
public int getSubFolderCount() throws IOException, PSTException { this.initSubfoldersTable(); if (this.subfoldersTable != null) return this.subfoldersTable.getRowCount(); else return 0; }
int function() throws IOException, PSTException { this.initSubfoldersTable(); if (this.subfoldersTable != null) return this.subfoldersTable.getRowCount(); else return 0; }
/** * the number of child folders in this folder * @return number of subfolders as counted * @throws IOException * @throws PSTException */
the number of child folders in this folder
getSubFolderCount
{ "repo_name": "casimirenslip/java-libpst", "path": "com/pff/objects/PSTFolder.java", "license": "apache-2.0", "size": 13704 }
[ "com.pff.exceptions.PSTException", "java.io.IOException" ]
import com.pff.exceptions.PSTException; import java.io.IOException;
import com.pff.exceptions.*; import java.io.*;
[ "com.pff.exceptions", "java.io" ]
com.pff.exceptions; java.io;
1,061,061
public ITreeNode<IArea> getNext( ) { initParent( ); if ( parent == null ) { return null; } IArea next = getChildValue( parent.getValue( ), index + 1 ); if ( next != null ) { return new AreaTreeNode( parent, index + 1, next ); } return null; }
ITreeNode<IArea> function( ) { initParent( ); if ( parent == null ) { return null; } IArea next = getChildValue( parent.getValue( ), index + 1 ); if ( next != null ) { return new AreaTreeNode( parent, index + 1, next ); } return null; }
/** * get the next sibling of current node. * * @return */
get the next sibling of current node
getNext
{ "repo_name": "sguan-actuate/birt", "path": "engine/org.eclipse.birt.report.engine.emitter.pptx/src/org/eclipse/birt/report/engine/emitter/pptx/TableVisitor.java", "license": "epl-1.0", "size": 4024 }
[ "org.eclipse.birt.report.engine.nLayout.area.IArea" ]
import org.eclipse.birt.report.engine.nLayout.area.IArea;
import org.eclipse.birt.report.engine.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
1,222,426
public static Set<ReferenceDescriptor> mergeReferences(ClassDescriptor original, ClassDescriptor merge) throws ModelMergerException { Set<ReferenceDescriptor> newSet = new HashSet<ReferenceDescriptor>(); newSet.addAll(cloneReferenceDescriptors(original.getReferenceDescriptors())); for (ReferenceDescriptor merg : merge.getReferenceDescriptors()) { // nb: does not look for references in superclasses/superinterfaces ReferenceDescriptor orig = original.getReferenceDescriptorByName(merg.getName()); if (orig != null) { // New descriptor may add a reverse reference field name if (merg.getReverseReferenceFieldName() != null && orig.getReverseReferenceFieldName() == null) { // This is a valid change - remove original descriptor and replace with new removeFieldDescriptor(newSet, orig.getName()); newSet.add(cloneReferenceDescriptor(merg)); continue; } if (!merg.getReferencedClassName().equals(orig.getReferencedClassName())) { String fldName = original.getName() + "." + orig.getName(); throw new ModelMergerException("type mismatch between reference types: " + fldName + ":" + merg.getReferencedClassName() + " != " + fldName + ":" + orig.getReferencedClassName()); } if (!StringUtils.equals(merg.getReverseReferenceFieldName(), orig.getReverseReferenceFieldName())) { String fldName = original.getName() + "." + orig.getName(); throw new ModelMergerException("mismatch between reverse reference field name: " + fldName + "<-" + merg.getReverseReferenceFieldName() + " != " + fldName + "<-" + orig.getReverseReferenceFieldName()); } } // New descriptor of no differences, so add merg to newSet newSet.add(cloneReferenceDescriptor(merg)); } return newSet; }
static Set<ReferenceDescriptor> function(ClassDescriptor original, ClassDescriptor merge) throws ModelMergerException { Set<ReferenceDescriptor> newSet = new HashSet<ReferenceDescriptor>(); newSet.addAll(cloneReferenceDescriptors(original.getReferenceDescriptors())); for (ReferenceDescriptor merg : merge.getReferenceDescriptors()) { ReferenceDescriptor orig = original.getReferenceDescriptorByName(merg.getName()); if (orig != null) { if (merg.getReverseReferenceFieldName() != null && orig.getReverseReferenceFieldName() == null) { removeFieldDescriptor(newSet, orig.getName()); newSet.add(cloneReferenceDescriptor(merg)); continue; } if (!merg.getReferencedClassName().equals(orig.getReferencedClassName())) { String fldName = original.getName() + "." + orig.getName(); throw new ModelMergerException(STR + fldName + ":" + merg.getReferencedClassName() + STR + fldName + ":" + orig.getReferencedClassName()); } if (!StringUtils.equals(merg.getReverseReferenceFieldName(), orig.getReverseReferenceFieldName())) { String fldName = original.getName() + "." + orig.getName(); throw new ModelMergerException(STR + fldName + "<-" + merg.getReverseReferenceFieldName() + STR + fldName + "<-" + orig.getReverseReferenceFieldName()); } } newSet.add(cloneReferenceDescriptor(merg)); } return newSet; }
/** * Merge the references of a target model class descriptor <code>original</code> with * the references present in class descriptor <code>merge</code>. Returns a new set of * ReferenceDescriptors. * * @param original the target model class descriptor * @param merge the additions * @return new set of CollectionDescriptors * @throws ModelMergerException if an error occurs during model mergining */
Merge the references of a target model class descriptor <code>original</code> with the references present in class descriptor <code>merge</code>. Returns a new set of ReferenceDescriptors
mergeReferences
{ "repo_name": "elsiklab/intermine", "path": "intermine/objectstore/main/src/org/intermine/modelproduction/ModelMerger.java", "license": "lgpl-2.1", "size": 24374 }
[ "java.util.HashSet", "java.util.Set", "org.apache.commons.lang.StringUtils", "org.intermine.metadata.ClassDescriptor", "org.intermine.metadata.ReferenceDescriptor" ]
import java.util.HashSet; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.intermine.metadata.ClassDescriptor; import org.intermine.metadata.ReferenceDescriptor;
import java.util.*; import org.apache.commons.lang.*; import org.intermine.metadata.*;
[ "java.util", "org.apache.commons", "org.intermine.metadata" ]
java.util; org.apache.commons; org.intermine.metadata;
2,599,851
public @Nonnull ClassLoader getClassLoader() { return classLoader; }
@Nonnull ClassLoader function() { return classLoader; }
/** * Application class loader. * * @return Application class loader. */
Application class loader
getClassLoader
{ "repo_name": "jooby-project/jooby", "path": "jooby/src/main/java/io/jooby/Environment.java", "license": "apache-2.0", "size": 12935 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,692,092
public CacheConfiguration<K, V> setQueryEntities(Collection<QueryEntity> qryEntities) { if (this.qryEntities == null) this.qryEntities = new ArrayList<>(qryEntities); else if (indexedTypes != null) this.qryEntities.addAll(qryEntities); else throw new CacheException("Query entities can be set only once."); return this; }
CacheConfiguration<K, V> function(Collection<QueryEntity> qryEntities) { if (this.qryEntities == null) this.qryEntities = new ArrayList<>(qryEntities); else if (indexedTypes != null) this.qryEntities.addAll(qryEntities); else throw new CacheException(STR); return this; }
/** * Sets query entities configuration. * * @param qryEntities Query entities. * @return {@code this} for chaining. */
Sets query entities configuration
setQueryEntities
{ "repo_name": "apacheignite/ignite", "path": "modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java", "license": "apache-2.0", "size": 91348 }
[ "java.util.ArrayList", "java.util.Collection", "javax.cache.CacheException", "org.apache.ignite.cache.QueryEntity" ]
import java.util.ArrayList; import java.util.Collection; import javax.cache.CacheException; import org.apache.ignite.cache.QueryEntity;
import java.util.*; import javax.cache.*; import org.apache.ignite.cache.*;
[ "java.util", "javax.cache", "org.apache.ignite" ]
java.util; javax.cache; org.apache.ignite;
1,381,598
@ServiceMethod(returns = ReturnType.SINGLE) Mono<VpnConnectionInner> getAsync(String resourceGroupName, String gatewayName, String connectionName);
@ServiceMethod(returns = ReturnType.SINGLE) Mono<VpnConnectionInner> getAsync(String resourceGroupName, String gatewayName, String connectionName);
/** * Retrieves the details of a vpn connection. * * @param resourceGroupName The resource group name of the VpnGateway. * @param gatewayName The name of the gateway. * @param connectionName The name of the vpn connection. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return vpnConnection Resource on successful completion of {@link Mono}. */
Retrieves the details of a vpn connection
getAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VpnConnectionsClient.java", "license": "mit", "size": 38268 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.network.fluent.models.VpnConnectionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.VpnConnectionInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,513,492
@Override public void runOptimization(ProblemXMLData problemData, ComponentXMLData representationData, ComponentXMLData rankingData, Hashtable<String, XMLFieldEntry> properties) { // load parameters loadparameters(); // get possible maximum fitness if possible double maxfitness = Double.MAX_VALUE; try { AbstractProblem problem = problemData.getNewProblemInstance(); if (problem instanceof AbstractSingleProblem) { AbstractSingleProblem sproblem = (AbstractSingleProblem) problem; maxfitness = sproblem.getMaximumFitness(); } } catch (InstantiationException e1) { // do nothing } // register statistics // create statistics bestFitnessStats = new StatKeeper(true, "Best Fitness (" + FrevoMain.getCurrentRun() + ")", "Generations"); FrevoMain.addStatistics(bestFitnessStats, true); double bestFitnessSoFar = Double.MIN_VALUE; // obtain problem requirements int input_number = problemData.getRequiredNumberOfInputs(); int output_number = problemData.getRequiredNumberOfOutputs(); // create initial population and get their novelty vector population = new ArrayList<NoveltyItem>(POPULATIONSIZE); for (int i = 0; i < POPULATIONSIZE; i++) { try { AbstractRepresentation member = representationData .getNewRepresentationInstance(input_number, output_number, generator); population.add(new NoveltyItem(member, ((AbstractSingleProblem) (problemData .getNewProblemInstance())).getNoveltyVector( member, true), i)); } catch (Exception e) { e.printStackTrace(); } } // Create archive archive = new NoveltyArchive(INITIAL_THRESHOLD); // assign fitness scores based on novelty archive.evaluate_population(population, true); // add to archive // archive.evaluate_population(population, false); // rank them according to their novelty Collections.sort(population, Collections.reverseOrder()); int archive_size = 0; int generation = 0; // Create offspring one at a time, testing each offspring, // and replacing the worst with the new offspring if its better for (int offspring_count = 0; offspring_count < GENERATIONS * POPULATIONSIZE; offspring_count++) { // end of a generation if (offspring_count % (POPULATIONSIZE) == 0) { archive.end_of_gen_steady(population); System.out.println("Proceeding to generation " + generation++); // archive.add_randomly(pop); archive.evaluate_population(population, false); int as = archive.get_set_size(); if (as > archive_size) { archive_size = as; System.out.println("ARCHIVE SIZE: " + archive_size + " THRESHOLD: " + archive.novelty_threshold); } bestFitnessStats.add(bestFitnessSoFar); } // progress setProgress((float) offspring_count / (float) (GENERATIONS * POPULATIONSIZE)); // ------ reproduction ------- // select random parents based on roulette selection NoveltyItem offspring; // First, decide whether to mate or mutate if (generator.nextFloat() < mutate_only_probablity) { NoveltyItem[] parents = selectParents(1,false); // create exactly one offspring offspring = mutate(parents[0], offspring_count); } else { // select 2 parents NoveltyItem[] parents = selectParents(2,false); // create exactly one offspring offspring = xover(parents, offspring_count); } // re-evaluate novelty points try { offspring.noveltypoints = ((AbstractSingleProblem) (problemData .getNewProblemInstance())).getNoveltyVector( offspring.genotype, true); } catch (Exception e) { e.printStackTrace(); } // calculate novelty of new individual archive.evaluate_individual(offspring, population, true); // update fittest list archive.update_fittest(offspring); // report fittest candidate to statistics and to frevo double bestFitness = archive.fittest.get(0).genotype.getFitness(); if (bestFitness > bestFitnessSoFar) { bestFitnessSoFar = bestFitness; // save generation String fitnessstring; if (problemData.getComponentType() == ComponentType.FREVO_PROBLEM) { fitnessstring = " (" + bestFitness + ")"; } else { // multiproblem fitnessstring = ""; } DecimalFormat fm = new DecimalFormat("000"); FrevoMain.saveResult( problemData.getName() + "_g" + archive.generation + "_i" + fm.format(offspring_count) + fitnessstring, saveResults(offspring_count, archive.generation), this.seed, getRandom().getSeed()); } // check if problem has been solved if (bestFitness >= maxfitness) { System.out.println("Solution has been found in generation " + archive.generation); break; } } setProgress(1f); }
void function(ProblemXMLData problemData, ComponentXMLData representationData, ComponentXMLData rankingData, Hashtable<String, XMLFieldEntry> properties) { loadparameters(); double maxfitness = Double.MAX_VALUE; try { AbstractProblem problem = problemData.getNewProblemInstance(); if (problem instanceof AbstractSingleProblem) { AbstractSingleProblem sproblem = (AbstractSingleProblem) problem; maxfitness = sproblem.getMaximumFitness(); } } catch (InstantiationException e1) { } bestFitnessStats = new StatKeeper(true, STR + FrevoMain.getCurrentRun() + ")", STR); FrevoMain.addStatistics(bestFitnessStats, true); double bestFitnessSoFar = Double.MIN_VALUE; int input_number = problemData.getRequiredNumberOfInputs(); int output_number = problemData.getRequiredNumberOfOutputs(); population = new ArrayList<NoveltyItem>(POPULATIONSIZE); for (int i = 0; i < POPULATIONSIZE; i++) { try { AbstractRepresentation member = representationData .getNewRepresentationInstance(input_number, output_number, generator); population.add(new NoveltyItem(member, ((AbstractSingleProblem) (problemData .getNewProblemInstance())).getNoveltyVector( member, true), i)); } catch (Exception e) { e.printStackTrace(); } } archive = new NoveltyArchive(INITIAL_THRESHOLD); archive.evaluate_population(population, true); Collections.sort(population, Collections.reverseOrder()); int archive_size = 0; int generation = 0; for (int offspring_count = 0; offspring_count < GENERATIONS * POPULATIONSIZE; offspring_count++) { if (offspring_count % (POPULATIONSIZE) == 0) { archive.end_of_gen_steady(population); System.out.println(STR + generation++); archive.evaluate_population(population, false); int as = archive.get_set_size(); if (as > archive_size) { archive_size = as; System.out.println(STR + archive_size + STR + archive.novelty_threshold); } bestFitnessStats.add(bestFitnessSoFar); } setProgress((float) offspring_count / (float) (GENERATIONS * POPULATIONSIZE)); NoveltyItem offspring; if (generator.nextFloat() < mutate_only_probablity) { NoveltyItem[] parents = selectParents(1,false); offspring = mutate(parents[0], offspring_count); } else { NoveltyItem[] parents = selectParents(2,false); offspring = xover(parents, offspring_count); } try { offspring.noveltypoints = ((AbstractSingleProblem) (problemData .getNewProblemInstance())).getNoveltyVector( offspring.genotype, true); } catch (Exception e) { e.printStackTrace(); } archive.evaluate_individual(offspring, population, true); archive.update_fittest(offspring); double bestFitness = archive.fittest.get(0).genotype.getFitness(); if (bestFitness > bestFitnessSoFar) { bestFitnessSoFar = bestFitness; String fitnessstring; if (problemData.getComponentType() == ComponentType.FREVO_PROBLEM) { fitnessstring = STR + bestFitness + ")"; } else { fitnessstring = STR000STR_gSTR_iSTRSolution has been found in generation " + archive.generation); break; } } setProgress(1f); }
/** * Runs the optimization method * * @param problemData * defines the problem class and its configuration * @param representationData * defines the representation class and its configuration * @param rankingData * defines the ranking class and its configuration * @param properties * the configuration of the optimizer */
Runs the optimization method
runOptimization
{ "repo_name": "vzhikserg/FREVO", "path": "Components/Methods/NoveltySearch/fehervari/noveltysearch/NoveltySearch.java", "license": "gpl-3.0", "size": 10698 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Hashtable" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
1,635,985
public static List<EditLogFile> matchEditLogs(File logDir) throws IOException { return matchEditLogs(FileUtil.listFiles(logDir)); }
static List<EditLogFile> function(File logDir) throws IOException { return matchEditLogs(FileUtil.listFiles(logDir)); }
/** * returns matching edit logs via the log directory. Simple helper function * that lists the files in the logDir and calls matchEditLogs(File[]) * * @param logDir * directory to match edit logs in * @return matched edit logs * @throws IOException * IOException thrown for invalid logDir */
returns matching edit logs via the log directory. Simple helper function that lists the files in the logDir and calls matchEditLogs(File[])
matchEditLogs
{ "repo_name": "plusplusjiajia/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java", "license": "apache-2.0", "size": 24718 }
[ "java.io.File", "java.io.IOException", "java.util.List", "org.apache.hadoop.fs.FileUtil" ]
import java.io.File; import java.io.IOException; import java.util.List; import org.apache.hadoop.fs.FileUtil;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,571,901
public static Builder dataWriteError() { return dataWriteError(null); } /** * Wraps the passed exception inside a data write error. * <p>The cause message will be used unless {@link Builder#message(String, Object...)} is called. * <p>If the wrapped exception is, or wraps, a user exception it will be returned by {@link Builder#build(Logger)}
static Builder function() { return dataWriteError(null); } /** * Wraps the passed exception inside a data write error. * <p>The cause message will be used unless {@link Builder#message(String, Object...)} is called. * <p>If the wrapped exception is, or wraps, a user exception it will be returned by {@link Builder#build(Logger)}
/** * Creates a new user exception builder . * * @see org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType#DATA_WRITE * @return user exception builder */
Creates a new user exception builder
dataWriteError
{ "repo_name": "superbstreak/drill", "path": "common/src/main/java/org/apache/drill/common/exceptions/UserException.java", "license": "apache-2.0", "size": 29694 }
[ "org.slf4j.Logger" ]
import org.slf4j.Logger;
import org.slf4j.*;
[ "org.slf4j" ]
org.slf4j;
2,855,317
private synchronized void removeConnection(Connection c) { connections.remove(c); } private class Connection implements Runnable { private final Socket socket; public Connection(Socket socket) { this.socket = socket; } /** * Adds a connection and sends the request's {@link Socket}
synchronized void function(Connection c) { connections.remove(c); } private class Connection implements Runnable { private final Socket socket; public Connection(Socket socket) { this.socket = socket; } /** * Adds a connection and sends the request's {@link Socket}
/** * Removed a {@link Connection} from our {@link Set}. * * @param c the connection. */
Removed a <code>Connection</code> from our <code>Set</code>
removeConnection
{ "repo_name": "argyakrivos/eos-http-server", "path": "src/main/java/com/akrivos/eos/http/SocketConnector.java", "license": "mit", "size": 6558 }
[ "java.net.Socket" ]
import java.net.Socket;
import java.net.*;
[ "java.net" ]
java.net;
1,256,552
public SearchSourceBuilder postFilter(Map postFilter) { try { XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE); builder.map(postFilter); return postFilter(builder); } catch (IOException e) { throw new ElasticsearchGenerationException("Failed to generate [" + postFilter + "]", e); } }
SearchSourceBuilder function(Map postFilter) { try { XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE); builder.map(postFilter); return postFilter(builder); } catch (IOException e) { throw new ElasticsearchGenerationException(STR + postFilter + "]", e); } }
/** * Constructs a new search source builder with a query from a map. */
Constructs a new search source builder with a query from a map
postFilter
{ "repo_name": "vrkansagara/elasticsearch", "path": "src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java", "license": "apache-2.0", "size": 29545 }
[ "java.io.IOException", "java.util.Map", "org.elasticsearch.ElasticsearchGenerationException", "org.elasticsearch.client.Requests", "org.elasticsearch.common.xcontent.XContentBuilder", "org.elasticsearch.common.xcontent.XContentFactory" ]
import java.io.IOException; import java.util.Map; import org.elasticsearch.ElasticsearchGenerationException; import org.elasticsearch.client.Requests; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory;
import java.io.*; import java.util.*; import org.elasticsearch.*; import org.elasticsearch.client.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "java.util", "org.elasticsearch", "org.elasticsearch.client", "org.elasticsearch.common" ]
java.io; java.util; org.elasticsearch; org.elasticsearch.client; org.elasticsearch.common;
1,823,529
protected synchronized void complete(final Try<V> result) { if (!noCompletionPromises) { completeAsyncPromise = Promise.createInternal(); completeUiPromise = Promise.createInternal(); } if (result instanceof Try.Success) { Try.Success<V> success = (Try.Success<V>) result; value = success.getValue(); } else if (result instanceof Try.Failure) { Try.Failure<V> failure = (Try.Failure<V>) result; error = failure.getError(); } else { throw new IllegalStateException("should never happen"); } done = true; Promise.this.notifyAll(); if (Looper.getMainLooper().getThread() != Thread.currentThread()) { completeAsync(result);
synchronized void function(final Try<V> result) { if (!noCompletionPromises) { completeAsyncPromise = Promise.createInternal(); completeUiPromise = Promise.createInternal(); } if (result instanceof Try.Success) { Try.Success<V> success = (Try.Success<V>) result; value = success.getValue(); } else if (result instanceof Try.Failure) { Try.Failure<V> failure = (Try.Failure<V>) result; error = failure.getError(); } else { throw new IllegalStateException(STR); } done = true; Promise.this.notifyAll(); if (Looper.getMainLooper().getThread() != Thread.currentThread()) { completeAsync(result);
/** * Sends the result to the UI thread callbacks, if any. */
Sends the result to the UI thread callbacks, if any
complete
{ "repo_name": "pfn/android-futures", "path": "src/main/java/com/hanhuy/android/concurrent/Promise.java", "license": "apache-2.0", "size": 11709 }
[ "android.os.Looper" ]
import android.os.Looper;
import android.os.*;
[ "android.os" ]
android.os;
1,000,911
private File getDataFile(int i) { String dataFile = (packageNames[i].indexOf('.') != -1) ? packageNames[i] : packageNames[i] + ".xml"; File file = new File(dataFile); return file; }
File function(int i) { String dataFile = (packageNames[i].indexOf('.') != -1) ? packageNames[i] : packageNames[i] + ".xml"; File file = new File(dataFile); return file; }
/** * Get the xml import file * * @return the package file */
Get the xml import file
getDataFile
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/tools/Import.java", "license": "lgpl-3.0", "size": 18692 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,802,656
private synchronized void fillRequirementArrays() { int numChildren = target.getComponentCount(); if (horRequirements == null || horRequirements.length != numChildren) { horRequirements = new SizeRequirements[numChildren]; vertRequirements = new SizeRequirements[numChildren]; for (int iChild = 0; iChild < numChildren; iChild++) { horRequirements[iChild] = new SizeRequirements(); vertRequirements[iChild] = new SizeRequirements(); } } for (int iChild = 0; iChild < numChildren; iChild++) { Component component = target.getComponent(iChild); if (component.isVisible()) { Dimension minSize = component.getMinimumSize(); Dimension prefSize = component.getPreferredSize(); Dimension maxSize = component.getMaximumSize(); horRequirements[iChild].set(minSize.width, prefSize.width, maxSize.width, component.getAlignmentX()); vertRequirements[iChild].set(minSize.height, prefSize.height, maxSize.height, component.getAlignmentY()); } else { horRequirements[iChild].reset(); vertRequirements[iChild].reset(); } } }
synchronized void function() { int numChildren = target.getComponentCount(); if (horRequirements == null horRequirements.length != numChildren) { horRequirements = new SizeRequirements[numChildren]; vertRequirements = new SizeRequirements[numChildren]; for (int iChild = 0; iChild < numChildren; iChild++) { horRequirements[iChild] = new SizeRequirements(); vertRequirements[iChild] = new SizeRequirements(); } } for (int iChild = 0; iChild < numChildren; iChild++) { Component component = target.getComponent(iChild); if (component.isVisible()) { Dimension minSize = component.getMinimumSize(); Dimension prefSize = component.getPreferredSize(); Dimension maxSize = component.getMaximumSize(); horRequirements[iChild].set(minSize.width, prefSize.width, maxSize.width, component.getAlignmentX()); vertRequirements[iChild].set(minSize.height, prefSize.height, maxSize.height, component.getAlignmentY()); } else { horRequirements[iChild].reset(); vertRequirements[iChild].reset(); } } }
/** * fills arrays with target's subcomponents data * required in futher calculations */
fills arrays with target's subcomponents data required in futher calculations
fillRequirementArrays
{ "repo_name": "freeVM/freeVM", "path": "enhanced/java/classlib/modules/swing/src/main/java/common/javax/swing/LayoutParameters.java", "license": "apache-2.0", "size": 8826 }
[ "java.awt.Component", "java.awt.Dimension" ]
import java.awt.Component; import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,469,830
public static String checkPath(String path) { if (!path.endsWith(FileUtils.SEPARATOR_STRING)) { path += FileUtils.SEPARATOR_STRING; // local modification } return path; }
static String function(String path) { if (!path.endsWith(FileUtils.SEPARATOR_STRING)) { path += FileUtils.SEPARATOR_STRING; } return path; }
/** * Checks the given path. * * @param path the path to be checked * @return a modified path if required */
Checks the given path
checkPath
{ "repo_name": "SSEHUB/EASyProducer", "path": "Plugins/EASy-Producer/de.uni_hildesheim.sse.EASy-Producer.persistence/src/net/ssehub/easy/producer/core/persistence/Configuration.java", "license": "apache-2.0", "size": 13364 }
[ "net.ssehub.easy.producer.core.persistence.internal.util.FileUtils" ]
import net.ssehub.easy.producer.core.persistence.internal.util.FileUtils;
import net.ssehub.easy.producer.core.persistence.internal.util.*;
[ "net.ssehub.easy" ]
net.ssehub.easy;
1,384,425
public void failOnInsert( Map<TableRow, List<TableDataInsertAllResponse.InsertErrors>> insertErrors) { synchronized (tables) { for (Map.Entry<TableRow, List<TableDataInsertAllResponse.InsertErrors>> entry : insertErrors.entrySet()) { List<String> errorStrings = Lists.newArrayList(); for (TableDataInsertAllResponse.InsertErrors errors : entry.getValue()) { errorStrings.add(BigQueryHelpers.toJsonString(errors)); } this.insertErrors.put(BigQueryHelpers.toJsonString(entry.getKey()), errorStrings); } } }
void function( Map<TableRow, List<TableDataInsertAllResponse.InsertErrors>> insertErrors) { synchronized (tables) { for (Map.Entry<TableRow, List<TableDataInsertAllResponse.InsertErrors>> entry : insertErrors.entrySet()) { List<String> errorStrings = Lists.newArrayList(); for (TableDataInsertAllResponse.InsertErrors errors : entry.getValue()) { errorStrings.add(BigQueryHelpers.toJsonString(errors)); } this.insertErrors.put(BigQueryHelpers.toJsonString(entry.getKey()), errorStrings); } } }
/** * Cause a given {@link TableRow} object to fail when it's inserted. The errors link the list will * be returned on subsequent retries, and the insert will succeed when the errors run out. */
Cause a given <code>TableRow</code> object to fail when it's inserted. The errors link the list will be returned on subsequent retries, and the insert will succeed when the errors run out
failOnInsert
{ "repo_name": "RyanSkraba/beam", "path": "sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/testing/FakeDatasetService.java", "license": "apache-2.0", "size": 13007 }
[ "com.google.api.services.bigquery.model.TableDataInsertAllResponse", "com.google.api.services.bigquery.model.TableRow", "java.util.List", "java.util.Map", "org.apache.beam.sdk.io.gcp.bigquery.BigQueryHelpers", "org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists" ]
import com.google.api.services.bigquery.model.TableDataInsertAllResponse; import com.google.api.services.bigquery.model.TableRow; import java.util.List; import java.util.Map; import org.apache.beam.sdk.io.gcp.bigquery.BigQueryHelpers; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Lists;
import com.google.api.services.bigquery.model.*; import java.util.*; import org.apache.beam.sdk.io.gcp.bigquery.*; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.*;
[ "com.google.api", "java.util", "org.apache.beam" ]
com.google.api; java.util; org.apache.beam;
1,496,549
public Executable getInstance(String keyName, ParameterStack parameters) throws IllegalAccessException, InvocationTargetException, InstantiationException { return (Executable) map.get(keyName).newInstance(parameters); }
Executable function(String keyName, ParameterStack parameters) throws IllegalAccessException, InvocationTargetException, InstantiationException { return (Executable) map.get(keyName).newInstance(parameters); }
/** * Get an instance of a keyword given the name of the keyword and the parameters * @param keyName the name of the keyword * @param parameters the parameters to supply to the keyword * @return an instance of a keyword */
Get an instance of a keyword given the name of the keyword and the parameters
getInstance
{ "repo_name": "chrisco210/CryspScript", "path": "src/cf/rachlinski/cryspscript/prerun/parsing/accessors/CommandList.java", "license": "mit", "size": 3486 }
[ "cf.rachlinski.cryspscript.runtime.dataStructs.stack.ParameterStack", "cf.rachlinski.cryspscript.runtime.exec.Executable", "java.lang.reflect.InvocationTargetException" ]
import cf.rachlinski.cryspscript.runtime.dataStructs.stack.ParameterStack; import cf.rachlinski.cryspscript.runtime.exec.Executable; import java.lang.reflect.InvocationTargetException;
import cf.rachlinski.cryspscript.runtime.*; import cf.rachlinski.cryspscript.runtime.exec.*; import java.lang.reflect.*;
[ "cf.rachlinski.cryspscript", "java.lang" ]
cf.rachlinski.cryspscript; java.lang;
1,528,530
public void writeTo(final ZipArchiveOutputStream target) throws IOException { backingStore.closeForWriting(); try (final InputStream data = backingStore.getInputStream()) { for (final CompressedEntry compressedEntry : items) { try (final BoundedInputStream rawStream = new BoundedInputStream(data, compressedEntry.compressedSize)) { target.addRawArchiveEntry(compressedEntry.transferToArchiveEntry(), rawStream); } } } } public static class ZipEntryWriter implements Closeable { private final Iterator<CompressedEntry> itemsIterator; private final InputStream itemsIteratorData; public ZipEntryWriter(final ScatterZipOutputStream scatter) throws IOException { scatter.backingStore.closeForWriting(); itemsIterator = scatter.items.iterator(); itemsIteratorData = scatter.backingStore.getInputStream(); }
void function(final ZipArchiveOutputStream target) throws IOException { backingStore.closeForWriting(); try (final InputStream data = backingStore.getInputStream()) { for (final CompressedEntry compressedEntry : items) { try (final BoundedInputStream rawStream = new BoundedInputStream(data, compressedEntry.compressedSize)) { target.addRawArchiveEntry(compressedEntry.transferToArchiveEntry(), rawStream); } } } } public static class ZipEntryWriter implements Closeable { private final Iterator<CompressedEntry> itemsIterator; private final InputStream itemsIteratorData; public ZipEntryWriter(final ScatterZipOutputStream scatter) throws IOException { scatter.backingStore.closeForWriting(); itemsIterator = scatter.items.iterator(); itemsIteratorData = scatter.backingStore.getInputStream(); }
/** * Write the contents of this scatter stream to a target archive. * * @param target The archive to receive the contents of this {@link ScatterZipOutputStream}. * @throws IOException If writing fails * @see #zipEntryWriter() */
Write the contents of this scatter stream to a target archive
writeTo
{ "repo_name": "apache/commons-compress", "path": "src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java", "license": "apache-2.0", "size": 9673 }
[ "java.io.Closeable", "java.io.IOException", "java.io.InputStream", "java.util.Iterator", "org.apache.commons.compress.utils.BoundedInputStream" ]
import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import org.apache.commons.compress.utils.BoundedInputStream;
import java.io.*; import java.util.*; import org.apache.commons.compress.utils.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
2,554,043
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (localName.equals(KEY_TAG)) { this.itemHandler.setKey(getCurrentText()); this.rootHandler.popSubHandler(); this.rootHandler.pushSubHandler( new ValueHandler(this.rootHandler, this.itemHandler) ); } else { throw new SAXException("Expecting </Key> but found " + localName); } }
void function(String namespaceURI, String localName, String qName) throws SAXException { if (localName.equals(KEY_TAG)) { this.itemHandler.setKey(getCurrentText()); this.rootHandler.popSubHandler(); this.rootHandler.pushSubHandler( new ValueHandler(this.rootHandler, this.itemHandler) ); } else { throw new SAXException(STR + localName); } }
/** * The end of an element. * * @param namespaceURI the namespace. * @param localName the element name. * @param qName the element name. * * @throws SAXException for errors. */
The end of an element
endElement
{ "repo_name": "djun100/afreechart", "path": "src/org/afree/data/xml/KeyHandler.java", "license": "lgpl-3.0", "size": 5121 }
[ "org.xml.sax.SAXException" ]
import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
2,618,408
public Element resolve(ElementMetadata<?, ?> metadata, ValidationContext vc) { // Return immediately if the metadata is null, no resolve necessary. if (metadata == null) { return this; } Element narrowed = narrow(metadata, vc); narrowed.validate(metadata, vc); // Resolve all child elements. Iterator<Element> childIterator = narrowed.getElementIterator(); if (childIterator.hasNext()) { List<Pair<Element, Element>> replacements = Lists.newArrayList(); while (childIterator.hasNext()) { Element child = childIterator.next(); ElementMetadata<?, ?> childMeta = metadata.bindElement( child.getElementKey()); Element resolved = child.resolve(childMeta, vc); if (resolved != child) { replacements.add(Pair.of(child, resolved)); } } // Replace any resolved child elements with their replacement. for (Pair<Element, Element> pair : replacements) { narrowed.replaceElement(pair.getFirst(), pair.getSecond()); } } return narrowed; }
Element function(ElementMetadata<?, ?> metadata, ValidationContext vc) { if (metadata == null) { return this; } Element narrowed = narrow(metadata, vc); narrowed.validate(metadata, vc); Iterator<Element> childIterator = narrowed.getElementIterator(); if (childIterator.hasNext()) { List<Pair<Element, Element>> replacements = Lists.newArrayList(); while (childIterator.hasNext()) { Element child = childIterator.next(); ElementMetadata<?, ?> childMeta = metadata.bindElement( child.getElementKey()); Element resolved = child.resolve(childMeta, vc); if (resolved != child) { replacements.add(Pair.of(child, resolved)); } } for (Pair<Element, Element> pair : replacements) { narrowed.replaceElement(pair.getFirst(), pair.getSecond()); } } return narrowed; }
/** * Resolve this element's state against the metadata. Accumulates * errors in caller's validation context. * * @param vc validation context * @return the narrowed element if narrowing took place. */
Resolve this element's state against the metadata. Accumulates errors in caller's validation context
resolve
{ "repo_name": "simonrrr/gdata-java-client", "path": "java/src/com/google/gdata/model/Element.java", "license": "apache-2.0", "size": 47721 }
[ "com.google.common.collect.Lists", "com.google.gdata.util.common.base.Pair", "java.util.Iterator", "java.util.List" ]
import com.google.common.collect.Lists; import com.google.gdata.util.common.base.Pair; import java.util.Iterator; import java.util.List;
import com.google.common.collect.*; import com.google.gdata.util.common.base.*; import java.util.*;
[ "com.google.common", "com.google.gdata", "java.util" ]
com.google.common; com.google.gdata; java.util;
2,179,661
@SuppressWarnings("unchecked") @Test public void testNestedAsyncConcat() throws Throwable { Observer<String> observer = mock(Observer.class); final TestObservable<String> o1 = new TestObservable<String>("one", "two", "three"); final TestObservable<String> o2 = new TestObservable<String>("four", "five", "six"); final TestObservable<String> o3 = new TestObservable<String>("seven", "eight", "nine"); final CountDownLatch allowThird = new CountDownLatch(1); final AtomicReference<Thread> parent = new AtomicReference<Thread>(); final CountDownLatch parentHasStarted = new CountDownLatch(1); Observable<Observable<String>> observableOfObservables = Observable.create(new Observable.OnSubscribe<Observable<String>>() {
@SuppressWarnings(STR) void function() throws Throwable { Observer<String> observer = mock(Observer.class); final TestObservable<String> o1 = new TestObservable<String>("one", "two", "three"); final TestObservable<String> o2 = new TestObservable<String>("four", "five", "six"); final TestObservable<String> o3 = new TestObservable<String>("seven", "eight", "nine"); final CountDownLatch allowThird = new CountDownLatch(1); final AtomicReference<Thread> parent = new AtomicReference<Thread>(); final CountDownLatch parentHasStarted = new CountDownLatch(1); Observable<Observable<String>> observableOfObservables = Observable.create(new Observable.OnSubscribe<Observable<String>>() {
/** * Test an async Observable that emits more async Observables */
Test an async Observable that emits more async Observables
testNestedAsyncConcat
{ "repo_name": "jtulach/RxJava", "path": "src/test/java/rx/internal/operators/OperatorConcatTest.java", "license": "apache-2.0", "size": 27700 }
[ "java.util.concurrent.CountDownLatch", "java.util.concurrent.atomic.AtomicReference", "org.mockito.Mockito" ]
import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; import org.mockito.Mockito;
import java.util.concurrent.*; import java.util.concurrent.atomic.*; import org.mockito.*;
[ "java.util", "org.mockito" ]
java.util; org.mockito;
2,298,547
public synchronized void close() throws IOException { if (journalWriter == null) { return; // already closed } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; }
synchronized void function() throws IOException { if (journalWriter == null) { return; } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; }
/** * Closes this cache. Stored values will remain on the filesystem. */
Closes this cache. Stored values will remain on the filesystem
close
{ "repo_name": "msdgwzhy6/AndroidDemo", "path": "app/src/main/java/com/socks/androiddemo/utils/cache/DiskLruCache.java", "license": "apache-2.0", "size": 33905 }
[ "java.io.IOException", "java.util.ArrayList" ]
import java.io.IOException; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
555,474
public CreateBucketResult createRedundantBucket(int bucketId, boolean isRebalance, InternalDistributedMember moveSource) { // recurse down to create each tier of children after creating leader bucket return grabBucket(bucketId, moveSource, true, false, isRebalance, null, false); }
CreateBucketResult function(int bucketId, boolean isRebalance, InternalDistributedMember moveSource) { return grabBucket(bucketId, moveSource, true, false, isRebalance, null, false); }
/** * Create a new backup of the bucket, allowing redundancy to be exceeded. All colocated child * buckets will also be created. * * @param bucketId the bucket to create * @param isRebalance true if bucket creation is directed by rebalancing * @return true if the bucket and its colocated chain of children are created */
Create a new backup of the bucket, allowing redundancy to be exceeded. All colocated child buckets will also be created
createRedundantBucket
{ "repo_name": "jdeppe-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java", "license": "apache-2.0", "size": 123871 }
[ "org.apache.geode.distributed.internal.membership.InternalDistributedMember" ]
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.*;
[ "org.apache.geode" ]
org.apache.geode;
548,276
public void testIsLocallyRenderableWithOnlyServersideRenderers() throws QuickFixException { T baseComponentDef = define(baseTag, "", "Body: Has just text. Text component has a java renderer."); assertEquals("Rendering detection logic is not on.", RenderType.AUTO, baseComponentDef.getRender()); assertTrue("When a component has only server renderers, the component should be serverside renderable.", baseComponentDef.isLocallyRenderable()); }
void function() throws QuickFixException { T baseComponentDef = define(baseTag, STRBody: Has just text. Text component has a java renderer.STRRendering detection logic is not on.STRWhen a component has only server renderers, the component should be serverside renderable.", baseComponentDef.isLocallyRenderable()); }
/** * isLocallyRenderable is true when component includes an interface as facet, the interface has a Javascript * provider. Test method for {@link BaseComponentDef#isLocallyRenderable()}. */
isLocallyRenderable is true when component includes an interface as facet, the interface has a Javascript provider. Test method for <code>BaseComponentDef#isLocallyRenderable()</code>
testIsLocallyRenderableWithOnlyServersideRenderers
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-impl/src/test/java/org/auraframework/impl/root/component/BaseComponentDefTest.java", "license": "apache-2.0", "size": 99025 }
[ "org.auraframework.throwable.quickfix.QuickFixException" ]
import org.auraframework.throwable.quickfix.QuickFixException;
import org.auraframework.throwable.quickfix.*;
[ "org.auraframework.throwable" ]
org.auraframework.throwable;
1,618,620
private TableViewer createAttachmentsViewer( Composite parent ) { TableViewer viewer = new TableViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER ); viewer.setContentProvider( ArrayContentProvider.getInstance()); viewer.setLabelProvider( new FilesLabelProvider()); TableLayout layout = new TableLayout(); layout.addColumnData( new ColumnWeightData( 50, 75, true )); layout.addColumnData( new ColumnWeightData( 50, 75, true )); viewer.getTable().setLayout( layout ); viewer.getTable().setLayoutData( new GridData( GridData.FILL_BOTH )); return viewer; }
TableViewer function( Composite parent ) { TableViewer viewer = new TableViewer( parent, SWT.MULTI SWT.H_SCROLL SWT.V_SCROLL SWT.FULL_SELECTION SWT.BORDER ); viewer.setContentProvider( ArrayContentProvider.getInstance()); viewer.setLabelProvider( new FilesLabelProvider()); TableLayout layout = new TableLayout(); layout.addColumnData( new ColumnWeightData( 50, 75, true )); layout.addColumnData( new ColumnWeightData( 50, 75, true )); viewer.getTable().setLayout( layout ); viewer.getTable().setLayoutData( new GridData( GridData.FILL_BOTH )); return viewer; }
/** * Creates a viewer for message attachments. * @param parent the parent * @return a table viewer with the right columns */
Creates a viewer for message attachments
createAttachmentsViewer
{ "repo_name": "vincent-zurczak/petals-service-client", "path": "src/main/java/org/ow2/petals/client/swt/tabs/MessageComposite.java", "license": "lgpl-2.1", "size": 15560 }
[ "org.eclipse.jface.viewers.ArrayContentProvider", "org.eclipse.jface.viewers.ColumnWeightData", "org.eclipse.jface.viewers.TableLayout", "org.eclipse.jface.viewers.TableViewer", "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Composite", "org.ow2.petals.client.swt.viewers.FilesLabelProvider" ]
import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.ow2.petals.client.swt.viewers.FilesLabelProvider;
import org.eclipse.jface.viewers.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.ow2.petals.client.swt.viewers.*;
[ "org.eclipse.jface", "org.eclipse.swt", "org.ow2.petals" ]
org.eclipse.jface; org.eclipse.swt; org.ow2.petals;
2,005,976
public static String resourceOriginalPath(CmsObject cms, String resourceName) { CmsProject proj = cms.getRequestContext().getCurrentProject(); try { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); String result = cms.getSitePath(resource); cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); result = cms.getSitePath(cms.readResource(resource.getStructureId())); // remove '/' if needed if (result.charAt(result.length() - 1) == '/') { if (resourceName.charAt(resourceName.length() - 1) != '/') { result = result.substring(0, result.length() - 1); } } return result; } catch (CmsException e) { return null; } finally { cms.getRequestContext().setCurrentProject(proj); } }
static String function(CmsObject cms, String resourceName) { CmsProject proj = cms.getRequestContext().getCurrentProject(); try { CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL); String result = cms.getSitePath(resource); cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); result = cms.getSitePath(cms.readResource(resource.getStructureId())); if (result.charAt(result.length() - 1) == '/') { if (resourceName.charAt(resourceName.length() - 1) != '/') { result = result.substring(0, result.length() - 1); } } return result; } catch (CmsException e) { return null; } finally { cms.getRequestContext().setCurrentProject(proj); } }
/** * Returns the original path of given resource, that is the online path for the resource. * If it differs from the offline path, the resource has been moved.<p> * * @param cms the cms context * @param resourceName a site relative resource name * * @return the online path, or <code>null</code> if resource has not been published */
Returns the original path of given resource, that is the online path for the resource. If it differs from the offline path, the resource has been moved
resourceOriginalPath
{ "repo_name": "ggiudetti/opencms-core", "path": "src-modules/org/opencms/workplace/commons/CmsUndoChanges.java", "license": "lgpl-2.1", "size": 19929 }
[ "org.opencms.file.CmsObject", "org.opencms.file.CmsProject", "org.opencms.file.CmsResource", "org.opencms.file.CmsResourceFilter", "org.opencms.main.CmsException" ]
import org.opencms.file.CmsObject; import org.opencms.file.CmsProject; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.main.CmsException;
import org.opencms.file.*; import org.opencms.main.*;
[ "org.opencms.file", "org.opencms.main" ]
org.opencms.file; org.opencms.main;
2,850,836
public boolean isAuthorized(SecurityContext context, Request request);
boolean function(SecurityContext context, Request request);
/** * Checks if user is assigned a role that may perform the request. * * @param context security context, usually container-provided * @param request SQL Resource request * @return true if user is authorized (or authorization is disabled), false otherwise */
Checks if user is assigned a role that may perform the request
isAuthorized
{ "repo_name": "Connexity/restsql", "path": "src/org/restsql/security/Authorizer.java", "license": "mit", "size": 1316 }
[ "org.restsql.core.Request" ]
import org.restsql.core.Request;
import org.restsql.core.*;
[ "org.restsql.core" ]
org.restsql.core;
1,747,235
public Builder setHttpHandlers(HttpHandler... handlers) { return setHttpHandlers(Arrays.asList(handlers)); }
Builder function(HttpHandler... handlers) { return setHttpHandlers(Arrays.asList(handlers)); }
/** * Add HttpHandlers that service the request. * * @param handlers a list of {@link HttpHandler}s to add * @return instance of {@code Builder}. */
Add HttpHandlers that service the request
setHttpHandlers
{ "repo_name": "cdapio/netty-http", "path": "src/main/java/io/cdap/http/NettyHttpService.java", "license": "apache-2.0", "size": 29175 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
360,154
public static void join(@Nullable Thread t) throws IgniteInterruptedCheckedException { if (t == null) return; try { t.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IgniteInterruptedCheckedException(e); } }
static void function(@Nullable Thread t) throws IgniteInterruptedCheckedException { if (t == null) return; try { t.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IgniteInterruptedCheckedException(e); } }
/** * Joins thread. * * @param t Thread. * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException Wrapped {@link InterruptedException}. */
Joins thread
join
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 385578 }
[ "org.apache.ignite.internal.IgniteInterruptedCheckedException", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.internal.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
2,273,661
public static Map<String, Module> getLoadedModulesMap() { if (loadedModules == null) { loadedModules = new WeakHashMap<String, Module>(); } return loadedModules; }
static Map<String, Module> function() { if (loadedModules == null) { loadedModules = new WeakHashMap<String, Module>(); } return loadedModules; }
/** * Returns all modules found/loaded into the system (started and not started) in the form of a * map<ModuleId, Module> * * @return map<ModuleId, Module> */
Returns all modules found/loaded into the system (started and not started) in the form of a map
getLoadedModulesMap
{ "repo_name": "naraink/openmrs-core", "path": "api/src/main/java/org/openmrs/module/ModuleFactory.java", "license": "mpl-2.0", "size": 56127 }
[ "java.util.Map", "java.util.WeakHashMap" ]
import java.util.Map; import java.util.WeakHashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,322,082
public static void sendRanges(Enumeration<ByteRange> byteRanges, File outFile) throws IOException { int BUFFER_SIZE = 16384; byte[] buffer = new byte[BUFFER_SIZE]; RandomAccessFile randAccess = null; try { randAccess = new RandomAccessFile(outFile, "rw"); while (byteRanges.hasMoreElements()) { ByteRange byteRange = byteRanges.nextElement(); Range range = byteRange.getRange(); InputStream data = byteRange.getDataQueue(); sendBytes(data, range, buffer, randAccess); } } finally { Util.close(randAccess); } }
static void function(Enumeration<ByteRange> byteRanges, File outFile) throws IOException { int BUFFER_SIZE = 16384; byte[] buffer = new byte[BUFFER_SIZE]; RandomAccessFile randAccess = null; try { randAccess = new RandomAccessFile(outFile, "rw"); while (byteRanges.hasMoreElements()) { ByteRange byteRange = byteRanges.nextElement(); Range range = byteRange.getRange(); InputStream data = byteRange.getDataQueue(); sendBytes(data, range, buffer, randAccess); } } finally { Util.close(randAccess); } }
/** * Inserts the data from each DataRange into the output File, at the appropriate offset * * @param byteRanges The Enumeration of Range/InputStream pairs parsed from the Upload's dataStream * @param outFile The output File being assembled * @throws IOException */
Inserts the data from each DataRange into the output File, at the appropriate offset
sendRanges
{ "repo_name": "FullMetal210/milton2", "path": "milton-client/src/main/java/io/milton/zsync/UploadReader.java", "license": "agpl-3.0", "size": 15433 }
[ "io.milton.http.Range", "java.io.File", "java.io.IOException", "java.io.InputStream", "java.io.RandomAccessFile", "java.util.Enumeration" ]
import io.milton.http.Range; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import java.util.Enumeration;
import io.milton.http.*; import java.io.*; import java.util.*;
[ "io.milton.http", "java.io", "java.util" ]
io.milton.http; java.io; java.util;
2,142,996
ServiceCall<Basic> getNotProvidedAsync(final ServiceCallback<Basic> serviceCallback) throws IllegalArgumentException;
ServiceCall<Basic> getNotProvidedAsync(final ServiceCallback<Basic> serviceCallback) throws IllegalArgumentException;
/** * Get a basic complex type while the server doesn't provide a response payload. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */
Get a basic complex type while the server doesn't provide a response payload
getNotProvidedAsync
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodycomplex/Basics.java", "license": "mit", "size": 5824 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,564,494
public void flush(TableName tableName) throws IOException { getMiniHBaseCluster().flushcache(tableName); }
void function(TableName tableName) throws IOException { getMiniHBaseCluster().flushcache(tableName); }
/** * Flushes all caches in the mini hbase cluster * @throws IOException */
Flushes all caches in the mini hbase cluster
flush
{ "repo_name": "StackVista/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 142672 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,238,559
public void removeCorruptionMarker() throws IOException { ensureOpen(); final Directory directory = directory(); IOException firstException = null; final String[] files = directory.listAll(); for (String file : files) { if (file.startsWith(CORRUPTED_MARKER_NAME_PREFIX)) { try { directory.deleteFile(file); } catch (IOException ex) { if (firstException == null) { firstException = ex; } else { firstException.addSuppressed(ex); } } } } if (firstException != null) { throw firstException; } }
void function() throws IOException { ensureOpen(); final Directory directory = directory(); IOException firstException = null; final String[] files = directory.listAll(); for (String file : files) { if (file.startsWith(CORRUPTED_MARKER_NAME_PREFIX)) { try { directory.deleteFile(file); } catch (IOException ex) { if (firstException == null) { firstException = ex; } else { firstException.addSuppressed(ex); } } } } if (firstException != null) { throw firstException; } }
/** * Deletes all corruption markers from this store. */
Deletes all corruption markers from this store
removeCorruptionMarker
{ "repo_name": "EvilMcJerkface/crate", "path": "server/src/main/java/org/elasticsearch/index/store/Store.java", "license": "apache-2.0", "size": 78110 }
[ "java.io.IOException", "org.apache.lucene.store.Directory" ]
import java.io.IOException; import org.apache.lucene.store.Directory;
import java.io.*; import org.apache.lucene.store.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
2,831,924