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
private boolean isValidRememberMeSession(SessionContextCacheKey key, SessionContextCacheEntry cacheEntry) { String contextId = key.getContextId(); if (cacheEntry == null) { return false; } if (!cacheEntry.getContext().isRememberMe()) { return false; } String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); long rememberMeSessionTimeOut = TimeUnit.SECONDS.toMillis(IdPManagementUtil.getRememberMeTimeout(tenantDomain)); long currentTime = System.currentTimeMillis(); Long createdTime = cacheEntry.getAccessedTime(); if (cacheEntry.getContext() != null) { Object createdTimestampObj = cacheEntry.getContext().getProperty(FrameworkConstants.CREATED_TIMESTAMP); if (createdTimestampObj != null) { createdTime = (Long) createdTimestampObj; } } if (log.isDebugEnabled()) { log.debug("Context ID : " + contextId + " :: rememberMeSessionTimeOut : " + rememberMeSessionTimeOut + ", currentTime : " + currentTime + ", created time : " + createdTime); } if (currentTime - createdTime > rememberMeSessionTimeOut) { if (log.isDebugEnabled()) { log.debug("Context ID : " + contextId + " :: Remember me session expiry"); } return false; } return true; }
boolean function(SessionContextCacheKey key, SessionContextCacheEntry cacheEntry) { String contextId = key.getContextId(); if (cacheEntry == null) { return false; } if (!cacheEntry.getContext().isRememberMe()) { return false; } String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); long rememberMeSessionTimeOut = TimeUnit.SECONDS.toMillis(IdPManagementUtil.getRememberMeTimeout(tenantDomain)); long currentTime = System.currentTimeMillis(); Long createdTime = cacheEntry.getAccessedTime(); if (cacheEntry.getContext() != null) { Object createdTimestampObj = cacheEntry.getContext().getProperty(FrameworkConstants.CREATED_TIMESTAMP); if (createdTimestampObj != null) { createdTime = (Long) createdTimestampObj; } } if (log.isDebugEnabled()) { log.debug(STR + contextId + STR + rememberMeSessionTimeOut + STR + currentTime + STR + createdTime); } if (currentTime - createdTime > rememberMeSessionTimeOut) { if (log.isDebugEnabled()) { log.debug(STR + contextId + STR); } return false; } return true; }
/** * Check whether the given session context is valid according to remember me session timeout restrictions. * * @param key SessionContextCacheKey * @param cacheEntry SessionContextCacheEntry * @return true if the session context is valid as per remember me session configs; false otherwise */
Check whether the given session context is valid according to remember me session timeout restrictions
isValidRememberMeSession
{ "repo_name": "nuwandi-is/identity-framework", "path": "components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/cache/SessionContextCache.java", "license": "apache-2.0", "size": 8132 }
[ "java.util.concurrent.TimeUnit", "org.wso2.carbon.context.CarbonContext", "org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants", "org.wso2.carbon.idp.mgt.util.IdPManagementUtil" ]
import java.util.concurrent.TimeUnit; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants; import org.wso2.carbon.idp.mgt.util.IdPManagementUtil;
import java.util.concurrent.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.application.authentication.framework.util.*; import org.wso2.carbon.idp.mgt.util.*;
[ "java.util", "org.wso2.carbon" ]
java.util; org.wso2.carbon;
2,070,253
Injector getInjector();
Injector getInjector();
/** * Return Guice Injector behind this InjectorWithContext. */
Return Guice Injector behind this InjectorWithContext
getInjector
{ "repo_name": "Sivaramvt/Slice", "path": "slice-core-api/src/main/java/com/cognifide/slice/api/injector/InjectorWithContext.java", "license": "apache-2.0", "size": 2192 }
[ "com.google.inject.Injector" ]
import com.google.inject.Injector;
import com.google.inject.*;
[ "com.google.inject" ]
com.google.inject;
1,529,984
public static synchronized void updateToken(Token token) { IPartitioner p = StorageService.getPartitioner(); ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF); cf.addColumn(new Column(SystemTable.TOKEN, p.getTokenFactory().toByteArray(token), System.currentTimeMillis())); RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY); rm.add(cf); try { rm.apply(); } catch (IOException e) { throw new IOError(e); } forceBlockingFlush(STATUS_CF); }
static synchronized void function(Token token) { IPartitioner p = StorageService.getPartitioner(); ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_TABLE, STATUS_CF); cf.addColumn(new Column(SystemTable.TOKEN, p.getTokenFactory().toByteArray(token), System.currentTimeMillis())); RowMutation rm = new RowMutation(Table.SYSTEM_TABLE, LOCATION_KEY); rm.add(cf); try { rm.apply(); } catch (IOException e) { throw new IOError(e); } forceBlockingFlush(STATUS_CF); }
/** * This method is used to update the System Table with the new token for this node */
This method is used to update the System Table with the new token for this node
updateToken
{ "repo_name": "mklew/mmp", "path": "src/java/org/apache/cassandra/db/SystemTable.java", "license": "apache-2.0", "size": 19732 }
[ "java.io.IOError", "java.io.IOException", "org.apache.cassandra.dht.IPartitioner", "org.apache.cassandra.dht.Token", "org.apache.cassandra.service.StorageService" ]
import java.io.IOError; import java.io.IOException; import org.apache.cassandra.dht.IPartitioner; import org.apache.cassandra.dht.Token; import org.apache.cassandra.service.StorageService;
import java.io.*; import org.apache.cassandra.dht.*; import org.apache.cassandra.service.*;
[ "java.io", "org.apache.cassandra" ]
java.io; org.apache.cassandra;
728,185
private LinkedList<Diff> diff_compute(String text1, String text2, boolean checklines, long deadline) { LinkedList<Diff> diffs = new LinkedList<Diff>(); if (text1.length() == 0) { // Just add some text (speedup). diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } if (text2.length() == 0) { // Just delete some text (speedup). diffs.add(new Diff(Operation.DELETE, text1)); return diffs; } String longtext = text1.length() > text2.length() ? text1 : text2; String shorttext = text1.length() > text2.length() ? text2 : text1; int i = longtext.indexOf(shorttext); if (i != -1) { // Shorter text is inside the longer text (speedup). Operation op = (text1.length() > text2.length()) ? Operation.DELETE : Operation.INSERT; diffs.add(new Diff(op, longtext.substring(0, i))); diffs.add(new Diff(Operation.EQUAL, shorttext)); diffs.add(new Diff(op, longtext.substring(i + shorttext.length()))); return diffs; } if (shorttext.length() == 1) { // Single character string. // After the previous speedup, the character can't be an equality. diffs.add(new Diff(Operation.DELETE, text1)); diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } // Check to see if the problem can be split in two. String[] hm = diff_halfMatch(text1, text2); if (hm != null) { // A half-match was found, sort out the return data. String text1_a = hm[0]; String text1_b = hm[1]; String text2_a = hm[2]; String text2_b = hm[3]; String mid_common = hm[4]; // Send both pairs off for separate processing. LinkedList<Diff> diffs_a = diff_main(text1_a, text2_a, checklines, deadline); LinkedList<Diff> diffs_b = diff_main(text1_b, text2_b, checklines, deadline); // Merge the results. diffs = diffs_a; diffs.add(new Diff(Operation.EQUAL, mid_common)); diffs.addAll(diffs_b); return diffs; } if (checklines && text1.length() > 100 && text2.length() > 100) { return diff_lineMode(text1, text2, deadline); } return diff_bisect(text1, text2, deadline); }
LinkedList<Diff> function(String text1, String text2, boolean checklines, long deadline) { LinkedList<Diff> diffs = new LinkedList<Diff>(); if (text1.length() == 0) { diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } if (text2.length() == 0) { diffs.add(new Diff(Operation.DELETE, text1)); return diffs; } String longtext = text1.length() > text2.length() ? text1 : text2; String shorttext = text1.length() > text2.length() ? text2 : text1; int i = longtext.indexOf(shorttext); if (i != -1) { Operation op = (text1.length() > text2.length()) ? Operation.DELETE : Operation.INSERT; diffs.add(new Diff(op, longtext.substring(0, i))); diffs.add(new Diff(Operation.EQUAL, shorttext)); diffs.add(new Diff(op, longtext.substring(i + shorttext.length()))); return diffs; } if (shorttext.length() == 1) { diffs.add(new Diff(Operation.DELETE, text1)); diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } String[] hm = diff_halfMatch(text1, text2); if (hm != null) { String text1_a = hm[0]; String text1_b = hm[1]; String text2_a = hm[2]; String text2_b = hm[3]; String mid_common = hm[4]; LinkedList<Diff> diffs_a = diff_main(text1_a, text2_a, checklines, deadline); LinkedList<Diff> diffs_b = diff_main(text1_b, text2_b, checklines, deadline); diffs = diffs_a; diffs.add(new Diff(Operation.EQUAL, mid_common)); diffs.addAll(diffs_b); return diffs; } if (checklines && text1.length() > 100 && text2.length() > 100) { return diff_lineMode(text1, text2, deadline); } return diff_bisect(text1, text2, deadline); }
/** * Find the differences between two texts. Assumes that the texts do not * have any common prefix or suffix. * @param text1 Old string to be diffed. * @param text2 New string to be diffed. * @param checklines Speedup flag. If false, then don't run a * line-level diff first to identify the changed areas. * If true, then run a faster slightly less optimal diff. * @param deadline Time when the diff should be complete by. * @return Linked List of Diff objects. */
Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix
diff_compute
{ "repo_name": "sireum/v3-logika-runtime", "path": "library/jvm/src/main/java/org/sireum/DiffMatchPatch.java", "license": "bsd-2-clause", "size": 104219 }
[ "java.lang.String", "java.util.LinkedList" ]
import java.lang.String; import java.util.LinkedList;
import java.lang.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,628,218
public IDataNode getImportantData(Plugin plugin) { IDataNode dataNode = _importantNodeCache.get(plugin); if (dataNode != null) return dataNode; dataNode = DataStorage.get(plugin, new DataPath("nucleus.important-messages")); dataNode.load(); _importantNodeCache.put(plugin, dataNode); return dataNode; }
IDataNode function(Plugin plugin) { IDataNode dataNode = _importantNodeCache.get(plugin); if (dataNode != null) return dataNode; dataNode = DataStorage.get(plugin, new DataPath(STR)); dataNode.load(); _importantNodeCache.put(plugin, dataNode); return dataNode; }
/** * Get the data node where important messages are stored * for the specified plugin. */
Get the data node where important messages are stored for the specified plugin
getImportantData
{ "repo_name": "JCThePants/NucleusFramework", "path": "src/com/jcwhatever/nucleus/internal/managed/messenger/InternalMessengerFactory.java", "license": "mit", "size": 7655 }
[ "com.jcwhatever.nucleus.providers.storage.DataStorage", "com.jcwhatever.nucleus.storage.DataPath", "com.jcwhatever.nucleus.storage.IDataNode", "org.bukkit.plugin.Plugin" ]
import com.jcwhatever.nucleus.providers.storage.DataStorage; import com.jcwhatever.nucleus.storage.DataPath; import com.jcwhatever.nucleus.storage.IDataNode; import org.bukkit.plugin.Plugin;
import com.jcwhatever.nucleus.providers.storage.*; import com.jcwhatever.nucleus.storage.*; import org.bukkit.plugin.*;
[ "com.jcwhatever.nucleus", "org.bukkit.plugin" ]
com.jcwhatever.nucleus; org.bukkit.plugin;
1,703,422
public boolean containsAll(Collection<?> coll) { for (Object e : coll) { if (!contains(e)) // Invokes safe contains() above return false; } return true; }
boolean function(Collection<?> coll) { for (Object e : coll) { if (!contains(e)) return false; } return true; }
/** * The next two methods are overridden to protect against an * unscrupulous List whose contains(Object o) method senses when o * is a Map.Entry, and calls o.setValue. */
The next two methods are overridden to protect against an unscrupulous List whose contains(Object o) method senses when o is a Map.Entry, and calls o.setValue
containsAll
{ "repo_name": "haocheng/10-eclipse-tips", "path": "src/main/java/tw/idv/haocheng/Tip8.java", "license": "apache-2.0", "size": 192091 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,845,391
public void testQueryByActivityIdAndBusinessKeyWithChildren() { ExecutionQuery query = runtimeService.createExecutionQuery().activityId("receivePayment") .processInstanceBusinessKey("BUSINESS-KEY-1", true); assertEquals(1, query.list().size()); assertEquals(1, query.count()); Execution execution = query.singleResult(); assertNotNull(execution); assertEquals("receivePayment", execution.getActivityId()); }
void function() { ExecutionQuery query = runtimeService.createExecutionQuery().activityId(STR) .processInstanceBusinessKey(STR, true); assertEquals(1, query.list().size()); assertEquals(1, query.count()); Execution execution = query.singleResult(); assertNotNull(execution); assertEquals(STR, execution.getActivityId()); }
/** * Validate fix for ACT-1896 */
Validate fix for ACT-1896
testQueryByActivityIdAndBusinessKeyWithChildren
{ "repo_name": "zwets/flowable-engine", "path": "modules/flowable5-test/src/test/java/org/activiti/engine/test/api/runtime/ExecutionQueryTest.java", "license": "apache-2.0", "size": 83669 }
[ "org.flowable.engine.runtime.Execution", "org.flowable.engine.runtime.ExecutionQuery" ]
import org.flowable.engine.runtime.Execution; import org.flowable.engine.runtime.ExecutionQuery;
import org.flowable.engine.runtime.*;
[ "org.flowable.engine" ]
org.flowable.engine;
748,357
public ComputeNodeType addComputeNode(String name, List<ProcessorType> processors, List<AdaptorType> adaptors, float memorySize, float diskSize, String osName) throws InvalidElementException { ComputeNodeType cn = new ComputeNodeType(); cn.setName(name); if (processors != null) { for (ProcessorType p : processors) { cn.getProcessorOrAdaptorsOrMemory().add(p); } } AdaptorsListType adaptorsList = new AdaptorsListType(); if (adaptors != null) { for (AdaptorType a : adaptors) { adaptorsList.getAdaptor().add(a); } } cn.getProcessorOrAdaptorsOrMemory().add(adaptorsList); // Optional parameters if (memorySize > 0) { MemoryType memory = createMemory(memorySize, null); cn.getProcessorOrAdaptorsOrMemory().add(memory); } if (diskSize > 0) { StorageType storage = createStorage(diskSize, null, -1); cn.getProcessorOrAdaptorsOrMemory().add(storage); } if (osName != null) { if (!osName.isEmpty()) { OSType os = createOperatingSystem(osName, null, null); cn.getProcessorOrAdaptorsOrMemory().add(os); } } return this.addComputeNode(cn); }
ComputeNodeType function(String name, List<ProcessorType> processors, List<AdaptorType> adaptors, float memorySize, float diskSize, String osName) throws InvalidElementException { ComputeNodeType cn = new ComputeNodeType(); cn.setName(name); if (processors != null) { for (ProcessorType p : processors) { cn.getProcessorOrAdaptorsOrMemory().add(p); } } AdaptorsListType adaptorsList = new AdaptorsListType(); if (adaptors != null) { for (AdaptorType a : adaptors) { adaptorsList.getAdaptor().add(a); } } cn.getProcessorOrAdaptorsOrMemory().add(adaptorsList); if (memorySize > 0) { MemoryType memory = createMemory(memorySize, null); cn.getProcessorOrAdaptorsOrMemory().add(memory); } if (diskSize > 0) { StorageType storage = createStorage(diskSize, null, -1); cn.getProcessorOrAdaptorsOrMemory().add(storage); } if (osName != null) { if (!osName.isEmpty()) { OSType os = createOperatingSystem(osName, null, null); cn.getProcessorOrAdaptorsOrMemory().add(os); } } return this.addComputeNode(cn); }
/** * Adds a new ComputeNode with the given information and returns the instance of the new ComputeNode. * * @param name Compute node name * @param processors List of processors * @param adaptors List of adaptors * @param memorySize Memory size * @param diskSize Disk size * @param osName OS name * @return Added Computed node * @throws InvalidElementException Error invalid data */
Adds a new ComputeNode with the given information and returns the instance of the new ComputeNode
addComputeNode
{ "repo_name": "mF2C/COMPSs", "path": "compss/runtime/config/xml/resources/src/main/java/es/bsc/compss/types/resources/ResourcesFile.java", "license": "apache-2.0", "size": 130588 }
[ "es.bsc.compss.types.resources.exceptions.InvalidElementException", "es.bsc.compss.types.resources.jaxb.AdaptorType", "es.bsc.compss.types.resources.jaxb.AdaptorsListType", "es.bsc.compss.types.resources.jaxb.ComputeNodeType", "es.bsc.compss.types.resources.jaxb.MemoryType", "es.bsc.compss.types.resources.jaxb.OSType", "es.bsc.compss.types.resources.jaxb.ProcessorType", "es.bsc.compss.types.resources.jaxb.StorageType", "java.util.List" ]
import es.bsc.compss.types.resources.exceptions.InvalidElementException; import es.bsc.compss.types.resources.jaxb.AdaptorType; import es.bsc.compss.types.resources.jaxb.AdaptorsListType; import es.bsc.compss.types.resources.jaxb.ComputeNodeType; import es.bsc.compss.types.resources.jaxb.MemoryType; import es.bsc.compss.types.resources.jaxb.OSType; import es.bsc.compss.types.resources.jaxb.ProcessorType; import es.bsc.compss.types.resources.jaxb.StorageType; import java.util.List;
import es.bsc.compss.types.resources.exceptions.*; import es.bsc.compss.types.resources.jaxb.*; import java.util.*;
[ "es.bsc.compss", "java.util" ]
es.bsc.compss; java.util;
56,461
private void analyze(AutoIngestDataSource dataSource) throws AnalysisStartupException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException { Manifest manifest = currentJob.getManifest(); Path manifestPath = manifest.getFilePath(); sysLogger.log(Level.INFO, "Starting ingest modules analysis for {0} ", manifestPath); currentJob.setProcessingStage(AutoIngestJob.Stage.ANALYZING_DATA_SOURCE, Date.from(Instant.now())); Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath); IngestJobEventListener ingestJobEventListener = new IngestJobEventListener(); IngestManager.getInstance().addIngestJobEventListener(ingestJobEventListener); try { synchronized (ingestLock) { IngestJobSettings ingestJobSettings = new IngestJobSettings(AutoIngestUserPreferences.getAutoModeIngestModuleContextString()); List<String> settingsWarnings = ingestJobSettings.getWarnings(); if (settingsWarnings.isEmpty()) { IngestJobStartResult ingestJobStartResult = IngestManager.getInstance().beginIngestJob(dataSource.getContent(), ingestJobSettings); IngestJob ingestJob = ingestJobStartResult.getJob(); if (null != ingestJob) { currentJob.setIngestJob(ingestJob); ingestLock.wait(); sysLogger.log(Level.INFO, "Finished ingest modules analysis for {0} ", manifestPath); IngestJob.ProgressSnapshot jobSnapshot = ingestJob.getSnapshot(); for (IngestJob.ProgressSnapshot.DataSourceProcessingSnapshot snapshot : jobSnapshot.getDataSourceSnapshots()) { if (!snapshot.isCancelled()) { List<String> cancelledModules = snapshot.getCancelledDataSourceIngestModules(); if (!cancelledModules.isEmpty()) { sysLogger.log(Level.WARNING, String.format("Ingest module(s) cancelled for %s", manifestPath)); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); for (String module : snapshot.getCancelledDataSourceIngestModules()) { sysLogger.log(Level.WARNING, String.format("%s ingest module cancelled for %s", module, manifestPath)); jobLogger.logIngestModuleCancelled(module); } } jobLogger.logAnalysisCompleted(); } else { currentJob.setProcessingStage(AutoIngestJob.Stage.CANCELLING, Date.from(Instant.now())); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logAnalysisCancelled(); CancellationReason cancellationReason = snapshot.getCancellationReason(); if (CancellationReason.NOT_CANCELLED != cancellationReason && CancellationReason.USER_CANCELLED != cancellationReason) { throw new AnalysisStartupException(String.format("Analysis cancelled due to %s for %s", cancellationReason.getDisplayName(), manifestPath)); } } } } else if (!ingestJobStartResult.getModuleErrors().isEmpty()) { for (IngestModuleError error : ingestJobStartResult.getModuleErrors()) { sysLogger.log(Level.SEVERE, String.format("%s ingest module startup error for %s", error.getModuleDisplayName(), manifestPath), error.getThrowable()); } currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logIngestModuleStartupErrors(); throw new AnalysisStartupException(String.format("Error(s) during ingest module startup for %s", manifestPath)); } else { sysLogger.log(Level.SEVERE, String.format("Ingest manager ingest job start error for %s", manifestPath), ingestJobStartResult.getStartupException()); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logAnalysisStartupError(); throw new AnalysisStartupException("Ingest manager error starting job", ingestJobStartResult.getStartupException()); } } else { for (String warning : settingsWarnings) { sysLogger.log(Level.SEVERE, "Ingest job settings error for {0}: {1}", new Object[]{manifestPath, warning}); } currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logIngestJobSettingsErrors(); throw new AnalysisStartupException("Error(s) in ingest job settings"); } } } finally { IngestManager.getInstance().removeIngestJobEventListener(ingestJobEventListener); currentJob.setIngestJob(null); } }
void function(AutoIngestDataSource dataSource) throws AnalysisStartupException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException { Manifest manifest = currentJob.getManifest(); Path manifestPath = manifest.getFilePath(); sysLogger.log(Level.INFO, STR, manifestPath); currentJob.setProcessingStage(AutoIngestJob.Stage.ANALYZING_DATA_SOURCE, Date.from(Instant.now())); Path caseDirectoryPath = currentJob.getCaseDirectoryPath(); AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath); IngestJobEventListener ingestJobEventListener = new IngestJobEventListener(); IngestManager.getInstance().addIngestJobEventListener(ingestJobEventListener); try { synchronized (ingestLock) { IngestJobSettings ingestJobSettings = new IngestJobSettings(AutoIngestUserPreferences.getAutoModeIngestModuleContextString()); List<String> settingsWarnings = ingestJobSettings.getWarnings(); if (settingsWarnings.isEmpty()) { IngestJobStartResult ingestJobStartResult = IngestManager.getInstance().beginIngestJob(dataSource.getContent(), ingestJobSettings); IngestJob ingestJob = ingestJobStartResult.getJob(); if (null != ingestJob) { currentJob.setIngestJob(ingestJob); ingestLock.wait(); sysLogger.log(Level.INFO, STR, manifestPath); IngestJob.ProgressSnapshot jobSnapshot = ingestJob.getSnapshot(); for (IngestJob.ProgressSnapshot.DataSourceProcessingSnapshot snapshot : jobSnapshot.getDataSourceSnapshots()) { if (!snapshot.isCancelled()) { List<String> cancelledModules = snapshot.getCancelledDataSourceIngestModules(); if (!cancelledModules.isEmpty()) { sysLogger.log(Level.WARNING, String.format(STR, manifestPath)); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); for (String module : snapshot.getCancelledDataSourceIngestModules()) { sysLogger.log(Level.WARNING, String.format(STR, module, manifestPath)); jobLogger.logIngestModuleCancelled(module); } } jobLogger.logAnalysisCompleted(); } else { currentJob.setProcessingStage(AutoIngestJob.Stage.CANCELLING, Date.from(Instant.now())); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logAnalysisCancelled(); CancellationReason cancellationReason = snapshot.getCancellationReason(); if (CancellationReason.NOT_CANCELLED != cancellationReason && CancellationReason.USER_CANCELLED != cancellationReason) { throw new AnalysisStartupException(String.format(STR, cancellationReason.getDisplayName(), manifestPath)); } } } } else if (!ingestJobStartResult.getModuleErrors().isEmpty()) { for (IngestModuleError error : ingestJobStartResult.getModuleErrors()) { sysLogger.log(Level.SEVERE, String.format(STR, error.getModuleDisplayName(), manifestPath), error.getThrowable()); } currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logIngestModuleStartupErrors(); throw new AnalysisStartupException(String.format(STR, manifestPath)); } else { sysLogger.log(Level.SEVERE, String.format(STR, manifestPath), ingestJobStartResult.getStartupException()); currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logAnalysisStartupError(); throw new AnalysisStartupException(STR, ingestJobStartResult.getStartupException()); } } else { for (String warning : settingsWarnings) { sysLogger.log(Level.SEVERE, STR, new Object[]{manifestPath, warning}); } currentJob.setErrorsOccurred(true); setCaseNodeDataErrorsOccurred(caseDirectoryPath); jobLogger.logIngestJobSettingsErrors(); throw new AnalysisStartupException(STR); } } } finally { IngestManager.getInstance().removeIngestJobEventListener(ingestJobEventListener); currentJob.setIngestJob(null); } }
/** * Analyzes the data source content returned by the data source * processor using the configured set of data source level and file * level analysis modules. * * @param dataSource The data source to analyze. * * @throws AnalysisStartupException if there is an error analyzing * the data source. * @throws AutoIngestJobLoggerException if there is an error writing to * the auto ingest log for the * case. * @throws InterruptedException if the thread running the job * processing task is interrupted * while blocked, i.e., if auto * ingest is shutting down. */
Analyzes the data source content returned by the data source processor using the configured set of data source level and file level analysis modules
analyze
{ "repo_name": "APriestman/autopsy", "path": "Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java", "license": "apache-2.0", "size": 162441 }
[ "java.nio.file.Path", "java.time.Instant", "java.util.Date", "java.util.List", "java.util.logging.Level", "org.sleuthkit.autopsy.coordinationservice.CaseNodeData", "org.sleuthkit.autopsy.coordinationservice.CoordinationService", "org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobLogger", "org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences", "org.sleuthkit.autopsy.ingest.IngestJob", "org.sleuthkit.autopsy.ingest.IngestJobSettings", "org.sleuthkit.autopsy.ingest.IngestJobStartResult", "org.sleuthkit.autopsy.ingest.IngestManager", "org.sleuthkit.autopsy.ingest.IngestModuleError" ]
import java.nio.file.Path; import java.time.Instant; import java.util.Date; import java.util.List; import java.util.logging.Level; import org.sleuthkit.autopsy.coordinationservice.CaseNodeData; import org.sleuthkit.autopsy.coordinationservice.CoordinationService; import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobLogger; import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences; import org.sleuthkit.autopsy.ingest.IngestJob; import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobStartResult; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestModuleError;
import java.nio.file.*; import java.time.*; import java.util.*; import java.util.logging.*; import org.sleuthkit.autopsy.coordinationservice.*; import org.sleuthkit.autopsy.experimental.autoingest.*; import org.sleuthkit.autopsy.experimental.configuration.*; import org.sleuthkit.autopsy.ingest.*;
[ "java.nio", "java.time", "java.util", "org.sleuthkit.autopsy" ]
java.nio; java.time; java.util; org.sleuthkit.autopsy;
2,639,051
@Nullable @VisibleForTesting static String getOriginFromTag(@Nullable String tag) { // If the user touched the settings cog on a flipped notification originating from this // class, there will be a notification tag extra in a specific format. From the tag we can // read the origin of the notification. if (tag == null || !tag.startsWith(PLATFORM_TAG_PREFIX)) return null; String[] parts = tag.split(NotificationConstants.NOTIFICATION_TAG_SEPARATOR); assert parts.length >= 3; try { URI uri = new URI(parts[1]); if (uri.getHost() != null) return parts[1]; } catch (URISyntaxException e) { Log.e(TAG, "Expected to find a valid url in the notification tag extra.", e); return null; } return null; }
static String getOriginFromTag(@Nullable String tag) { if (tag == null !tag.startsWith(PLATFORM_TAG_PREFIX)) return null; String[] parts = tag.split(NotificationConstants.NOTIFICATION_TAG_SEPARATOR); assert parts.length >= 3; try { URI uri = new URI(parts[1]); if (uri.getHost() != null) return parts[1]; } catch (URISyntaxException e) { Log.e(TAG, STR, e); return null; } return null; }
/** * Attempts to extract an origin from the tag extra in the given intent. * * See {@link #makePlatformTag} for details about the format of the tag. * * @param tag The tag from the intent extra. May be null. * @return The origin string. Returns null if there was no tag extra in the given intent, or if * the tag value did not match the expected format. */
Attempts to extract an origin from the tag extra in the given intent. See <code>#makePlatformTag</code> for details about the format of the tag
getOriginFromTag
{ "repo_name": "guorendong/iridium-browser-ubuntu", "path": "chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java", "license": "bsd-3-clause", "size": 23889 }
[ "android.util.Log", "java.net.URISyntaxException", "javax.annotation.Nullable" ]
import android.util.Log; import java.net.URISyntaxException; import javax.annotation.Nullable;
import android.util.*; import java.net.*; import javax.annotation.*;
[ "android.util", "java.net", "javax.annotation" ]
android.util; java.net; javax.annotation;
2,168,868
@Override public void mousePressed(MouseEvent e) { }
void function(MouseEvent e) { }
/** * Mouse pressed event * * @param e event */
Mouse pressed event
mousePressed
{ "repo_name": "acenode/jpexs-decompiler", "path": "src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java", "license": "gpl-3.0", "size": 27577 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
45,122
public Point getSelectionRectangleAnchor() { return selectionRectangleAnchor; }
Point function() { return selectionRectangleAnchor; }
/** * DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
getSelectionRectangleAnchor
{ "repo_name": "cismet/jGrid", "path": "src/main/java/com/guigarage/jgrid/JGrid.java", "license": "apache-2.0", "size": 29546 }
[ "java.awt.Point" ]
import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,722,518
public String getServerAddr() { if (_connection instanceof Socket) return ((Socket)_connection).getLocalAddress().getHostAddress(); return _listener.getHost(); }
String function() { if (_connection instanceof Socket) return ((Socket)_connection).getLocalAddress().getHostAddress(); return _listener.getHost(); }
/** Get the listeners HttpServer. * @return HttpServer. */
Get the listeners HttpServer
getServerAddr
{ "repo_name": "dineshkummarc/Gitak_r982", "path": "server/selenium-remote-control-1.0.3/selenium-server/org/openqa/jetty/http/HttpConnection.java", "license": "apache-2.0", "size": 42218 }
[ "java.net.Socket" ]
import java.net.Socket;
import java.net.*;
[ "java.net" ]
java.net;
2,260,837
EAttribute getActivityPhase_Phase();
EAttribute getActivityPhase_Phase();
/** * Returns the meta object for the attribute '{@link lqn.ActivityPhase#getPhase <em>Phase</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Phase</em>'. * @see lqn.ActivityPhase#getPhase() * @see #getActivityPhase() * @generated */
Returns the meta object for the attribute '<code>lqn.ActivityPhase#getPhase Phase</code>'.
getActivityPhase_Phase
{ "repo_name": "aciancone/klapersuite", "path": "klapersuite.metamodel.lqn/src/lqn/LqnPackage.java", "license": "epl-1.0", "size": 116938 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,131,657
static void writeHBaseByteArray(final ChannelBuffer buf, final byte[] b) { buf.writeByte(11); // Code for byte[].class in HbaseObjectWritable writeByteArray(buf, b); }
static void writeHBaseByteArray(final ChannelBuffer buf, final byte[] b) { buf.writeByte(11); writeByteArray(buf, b); }
/** * Writes a byte array as an HBase RPC parameter. * @param buf The buffer to serialize the string to. * @param b The byte array to serialize. */
Writes a byte array as an HBase RPC parameter
writeHBaseByteArray
{ "repo_name": "SteamShon/asynchbase", "path": "src/HBaseRpc.java", "license": "bsd-3-clause", "size": 52440 }
[ "org.jboss.netty.buffer.ChannelBuffer" ]
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.*;
[ "org.jboss.netty" ]
org.jboss.netty;
1,595,970
public List<FunctionInput> getFunctionInputs(); /** * Returns the {@link ExpressionEvaluator} for the constant with name constantName if such a * constant exists, or {@code null}. * * @param constantName the name of the constant * @return the {@ExpressionEvaluator} for constantName or {@code null}
List<FunctionInput> function(); /** * Returns the {@link ExpressionEvaluator} for the constant with name constantName if such a * constant exists, or {@code null}. * * @param constantName the name of the constant * @return the {@ExpressionEvaluator} for constantName or {@code null}
/** * Returns the {@link FunctionInput}s associated to all attributes, variables and macros known * by the context. * * @return all known function inputs */
Returns the <code>FunctionInput</code>s associated to all attributes, variables and macros known by the context
getFunctionInputs
{ "repo_name": "cm-is-dog/rapidminer-studio-core", "path": "src/main/java/com/rapidminer/tools/expression/ExpressionContext.java", "license": "agpl-3.0", "size": 3932 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,885,510
public Map<Skill, Integer> getStatBonuses();
Map<Skill, Integer> function();
/** * Gets a map containing any stat bonuses this feat grants * * @return a map of skills to the amount this feat boosts that skill */
Gets a map containing any stat bonuses this feat grants
getStatBonuses
{ "repo_name": "Gildorym/GildorymAPI", "path": "src/com/gildorymrp/api/plugin/core/PassiveFeat.java", "license": "agpl-3.0", "size": 367 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,311,199
@Test public void testCopyMemberToVersion() { DiskStoreID id0 = new DiskStoreID(0, 0); DiskStoreID id1 = new DiskStoreID(0, 1); DiskStoreID id2 = new DiskStoreID(1, 0); DiskRegionVersionVector rvv0 = new DiskRegionVersionVector(id0); rvv0.getNextVersion(); rvv0.getNextVersion(); rvv0.getNextVersion(); rvv0.recordVersion(id1, 1); rvv0.recordVersion(id1, 3); DiskRegionVersionVector rvv1 = new DiskRegionVersionVector(id1); rvv1.recordVersions(rvv0); assertEquals(3, rvv1.getCurrentVersion()); assertFalse(rvv1.contains(id1, 2)); assertTrue(rvv1.contains(id1, 1)); assertTrue(rvv1.contains(id1, 3)); assertTrue(rvv1.contains(id0, 3)); assertTrue(rvv0.sameAs(rvv1)); rvv1.recordVersion(id1, 2); assertTrue(rvv1.isNewerThanOrCanFillExceptionsFor(rvv0)); assertFalse(rvv0.isNewerThanOrCanFillExceptionsFor(rvv1)); assertTrue(rvv1.dominates(rvv0)); assertFalse(rvv0.dominates(rvv1)); }
void function() { DiskStoreID id0 = new DiskStoreID(0, 0); DiskStoreID id1 = new DiskStoreID(0, 1); DiskStoreID id2 = new DiskStoreID(1, 0); DiskRegionVersionVector rvv0 = new DiskRegionVersionVector(id0); rvv0.getNextVersion(); rvv0.getNextVersion(); rvv0.getNextVersion(); rvv0.recordVersion(id1, 1); rvv0.recordVersion(id1, 3); DiskRegionVersionVector rvv1 = new DiskRegionVersionVector(id1); rvv1.recordVersions(rvv0); assertEquals(3, rvv1.getCurrentVersion()); assertFalse(rvv1.contains(id1, 2)); assertTrue(rvv1.contains(id1, 1)); assertTrue(rvv1.contains(id1, 3)); assertTrue(rvv1.contains(id0, 3)); assertTrue(rvv0.sameAs(rvv1)); rvv1.recordVersion(id1, 2); assertTrue(rvv1.isNewerThanOrCanFillExceptionsFor(rvv0)); assertFalse(rvv0.isNewerThanOrCanFillExceptionsFor(rvv1)); assertTrue(rvv1.dominates(rvv0)); assertFalse(rvv0.dominates(rvv1)); }
/** * Test that we can copy the member to version map correctly. */
Test that we can copy the member to version map correctly
testCopyMemberToVersion
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/test/java/org/apache/geode/internal/cache/versions/RegionVersionVectorTest.java", "license": "apache-2.0", "size": 44075 }
[ "org.apache.geode.internal.cache.persistence.DiskStoreID", "org.junit.Assert" ]
import org.apache.geode.internal.cache.persistence.DiskStoreID; import org.junit.Assert;
import org.apache.geode.internal.cache.persistence.*; import org.junit.*;
[ "org.apache.geode", "org.junit" ]
org.apache.geode; org.junit;
1,600,137
public static void main(String[] args) { PutransFactory factory = new PutransFactory(); Iterator iter = factory.getIterator(); try { } catch (Exception exc) { factory.log.error(exc.getMessage(), exc); } // try } // main
static void function(String[] args) { PutransFactory factory = new PutransFactory(); Iterator iter = factory.getIterator(); try { } catch (Exception exc) { factory.log.error(exc.getMessage(), exc); } }
/** Main program * @param args commandline arguments (none) */
Main program
main
{ "repo_name": "gfis/putrans", "path": "src/main/java/org/teherba/putrans/PutransFactory.java", "license": "apache-2.0", "size": 4169 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
471,510
List<Alert> findAlertsByStatus(boolean enabled);
List<Alert> findAlertsByStatus(boolean enabled);
/** * Returns a list of alerts by status (enabled alerts or disabled alerts). * * @param enabled Alert status (true for enabled alerts and false for disabled alerts) * * @return The list of alerts for the given status. Will never be null but may be empty. */
Returns a list of alerts by status (enabled alerts or disabled alerts)
findAlertsByStatus
{ "repo_name": "jbhatt-salesforce/Warden-Service", "path": "ArgusCore/src/main/java/com/salesforce/dva/argus/service/AlertService.java", "license": "bsd-3-clause", "size": 11946 }
[ "com.salesforce.dva.argus.entity.Alert", "java.util.List" ]
import com.salesforce.dva.argus.entity.Alert; import java.util.List;
import com.salesforce.dva.argus.entity.*; import java.util.*;
[ "com.salesforce.dva", "java.util" ]
com.salesforce.dva; java.util;
1,999,861
private Application.ActivityLifecycleCallbacks createLifecycleCallback() { return new Application.ActivityLifecycleCallbacks() {
Application.ActivityLifecycleCallbacks function() { return new Application.ActivityLifecycleCallbacks() {
/** * Creates {@link Application.ActivityLifecycleCallbacks} listener that will respond to onResume and onPause of any Activity in the application * obtaining information if the Application is in the background or foreground. * * @return Application lifecycle callbacks to be registered on the system by the SDK. */
Creates <code>Application.ActivityLifecycleCallbacks</code> listener that will respond to onResume and onPause of any Activity in the application obtaining information if the Application is in the background or foreground
createLifecycleCallback
{ "repo_name": "comapi/comapi-sdk-android", "path": "COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java", "license": "mit", "size": 6480 }
[ "android.app.Application" ]
import android.app.Application;
import android.app.*;
[ "android.app" ]
android.app;
1,592,279
public boolean isApplicationExist(String appName, String username, String groupId) throws APIManagementException { if (username == null) { return false; } Subscriber subscriber = getSubscriber(username); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; int appId = 0; String sqlQuery = SQLConstants.GET_APPLICATION_ID_PREFIX; String whereClauseWithGroupId = " AND (APP.GROUP_ID = ? OR (APP.GROUP_ID = '' AND SUB.USER_ID = ?))"; String whereClauseWithGroupIdCaseInsensitive = " AND (APP.GROUP_ID = ? OR (APP.GROUP_ID = '' " + "AND LOWER" + "(SUB.USER_ID) = LOWER(?)))"; String whereClause = " AND SUB.USER_ID = ? "; String whereClauseCaseInsensitive = " AND LOWER(SUB.USER_ID) = LOWER(?) "; try { connection = APIMgtDBUtil.getConnection(); if (!StringUtils.isEmpty(groupId)) { if (forceCaseInsensitiveComparisons) { sqlQuery += whereClauseWithGroupIdCaseInsensitive; } else { sqlQuery += whereClauseWithGroupId; } } else { if (forceCaseInsensitiveComparisons) { sqlQuery += whereClauseCaseInsensitive; } else { sqlQuery += whereClause; } } preparedStatement = connection.prepareStatement(sqlQuery); preparedStatement.setString(1, appName); if (!StringUtils.isEmpty(groupId)) { preparedStatement.setString(2, groupId); preparedStatement.setString(3, subscriber.getName()); } else { preparedStatement.setString(2, subscriber.getName()); } resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { appId = resultSet.getInt("APPLICATION_ID"); } if (appId > 0) { return true; } } catch (SQLException e) { handleException("Error while getting the id of " + appName + " from the persistence store.", e); } finally { APIMgtDBUtil.closeAllConnections(preparedStatement, connection, resultSet); } return false; }
boolean function(String appName, String username, String groupId) throws APIManagementException { if (username == null) { return false; } Subscriber subscriber = getSubscriber(username); Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; int appId = 0; String sqlQuery = SQLConstants.GET_APPLICATION_ID_PREFIX; String whereClauseWithGroupId = STR; String whereClauseWithGroupIdCaseInsensitive = STR + STR + STR; String whereClause = STR; String whereClauseCaseInsensitive = STR; try { connection = APIMgtDBUtil.getConnection(); if (!StringUtils.isEmpty(groupId)) { if (forceCaseInsensitiveComparisons) { sqlQuery += whereClauseWithGroupIdCaseInsensitive; } else { sqlQuery += whereClauseWithGroupId; } } else { if (forceCaseInsensitiveComparisons) { sqlQuery += whereClauseCaseInsensitive; } else { sqlQuery += whereClause; } } preparedStatement = connection.prepareStatement(sqlQuery); preparedStatement.setString(1, appName); if (!StringUtils.isEmpty(groupId)) { preparedStatement.setString(2, groupId); preparedStatement.setString(3, subscriber.getName()); } else { preparedStatement.setString(2, subscriber.getName()); } resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { appId = resultSet.getInt(STR); } if (appId > 0) { return true; } } catch (SQLException e) { handleException(STR + appName + STR, e); } finally { APIMgtDBUtil.closeAllConnections(preparedStatement, connection, resultSet); } return false; }
/** * Check whether given application name is available under current subscriber or group * * @param appName application name * @param username subscriber * @param groupId group of the subscriber * @return true if application is available for the subscriber * @throws APIManagementException if failed to get applications for given subscriber */
Check whether given application name is available under current subscriber or group
isApplicationExist
{ "repo_name": "dhanuka84/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 461690 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "org.apache.commons.lang.StringUtils", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.Subscriber", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.commons.lang.StringUtils; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Subscriber; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import org.apache.commons.lang.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "org.apache.commons", "org.wso2.carbon" ]
java.sql; org.apache.commons; org.wso2.carbon;
2,822,677
public boolean isStandby(OpenWebIfConfig config) throws IOException { String url = new UrlBuilder(config, POWERSTATE).build(); PowerState result = executeRequest(config, url, PowerState.class); return result.isStandby(); }
boolean function(OpenWebIfConfig config) throws IOException { String url = new UrlBuilder(config, POWERSTATE).build(); PowerState result = executeRequest(config, url, PowerState.class); return result.isStandby(); }
/** * Returns true, if the sat reveiver is in standby. */
Returns true, if the sat reveiver is in standby
isStandby
{ "repo_name": "paolodenti/openhab", "path": "bundles/action/org.openhab.action.openwebif/src/main/java/org/openhab/action/openwebif/internal/impl/OpenWebIfCommunicator.java", "license": "epl-1.0", "size": 5237 }
[ "java.io.IOException", "org.openhab.action.openwebif.internal.impl.config.OpenWebIfConfig", "org.openhab.action.openwebif.internal.impl.model.PowerState" ]
import java.io.IOException; import org.openhab.action.openwebif.internal.impl.config.OpenWebIfConfig; import org.openhab.action.openwebif.internal.impl.model.PowerState;
import java.io.*; import org.openhab.action.openwebif.internal.impl.config.*; import org.openhab.action.openwebif.internal.impl.model.*;
[ "java.io", "org.openhab.action" ]
java.io; org.openhab.action;
455,897
public boolean onActivityResult(int requestCode, int resultCode, final Intent data) { boolean result = false; if (requestCode == REQUEST_CODE_IMAGE && resultCode == Activity.RESULT_OK) { result = true; Toast.makeText(mContext, "Loading attachment", Toast.LENGTH_LONG).show(); new ImageLoaderTask(mContext, data.getData()).execute(); } else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) { result = true; Toast.makeText(mContext, "Loading attachment", Toast.LENGTH_LONG).show(); new ImageLoaderFromCameraTask().execute((Void[]) null); } return result; }
boolean function(int requestCode, int resultCode, final Intent data) { boolean result = false; if (requestCode == REQUEST_CODE_IMAGE && resultCode == Activity.RESULT_OK) { result = true; Toast.makeText(mContext, STR, Toast.LENGTH_LONG).show(); new ImageLoaderTask(mContext, data.getData()).execute(); } else if (requestCode == REQUEST_CODE_CAMERA && resultCode == Activity.RESULT_OK) { result = true; Toast.makeText(mContext, STR, Toast.LENGTH_LONG).show(); new ImageLoaderFromCameraTask().execute((Void[]) null); } return result; }
/** * Handles activity results that were started by this View. Returns true if the result was * handled by this view, false otherwise. * * @param requestCode * @param resultCode * @param data */
Handles activity results that were started by this View. Returns true if the result was handled by this view, false otherwise
onActivityResult
{ "repo_name": "mingtang1079/qksms", "path": "QKSMS/src/main/java/com/moez/QKSMS/ui/view/ComposeView.java", "license": "gpl-3.0", "size": 37303 }
[ "android.app.Activity", "android.content.Intent", "android.widget.Toast" ]
import android.app.Activity; import android.content.Intent; import android.widget.Toast;
import android.app.*; import android.content.*; import android.widget.*;
[ "android.app", "android.content", "android.widget" ]
android.app; android.content; android.widget;
1,984,792
public File getCmdlineInterpreterDirectory() { return new File(System.getProperty("user.home") + "/.mscript"); }
File function() { return new File(System.getProperty(STR) + STR); }
/** * Returns the location of the cmdline interpreter folder. * * @return */
Returns the location of the cmdline interpreter folder
getCmdlineInterpreterDirectory
{ "repo_name": "sk89q/CommandHelper", "path": "src/main/java/com/laytonsmith/core/MethodScriptFileLocations.java", "license": "mit", "size": 6589 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,147,250
private String getInLdapFilter(String property, List values) { List<String> filters = new ArrayList<String>(); for(Object value : values) { filters.add("(" + property + "=" + value.toString() + ")"); } return StringUtils.join(filters, "|"); }
String function(String property, List values) { List<String> filters = new ArrayList<String>(); for(Object value : values) { filters.add("(" + property + "=" + value.toString() + ")"); } return StringUtils.join(filters, " "); }
/** * Builds a filter for property in (values) search type. * This is done by creating a list of property=value combined by or (|). * * @param property * @param values * @return */
Builds a filter for property in (values) search type. This is done by creating a list of property=value combined by or (|)
getInLdapFilter
{ "repo_name": "geosolutions-it/geostore", "path": "src/core/persistence/src/main/java/it/geosolutions/geostore/core/dao/ldap/impl/LdapBaseDAOImpl.java", "license": "gpl-3.0", "size": 10600 }
[ "java.util.ArrayList", "java.util.List", "org.apache.commons.lang.StringUtils" ]
import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils;
import java.util.*; import org.apache.commons.lang.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,525,389
protected TrustManagerFactory buildTrustManagerFactory() throws SSLException { try (InputStream tsf = Files.newInputStream(Paths.get(truststore))) { TrustManagerFactory tmf = TrustManagerFactory.getInstance( algorithm == null ? TrustManagerFactory.getDefaultAlgorithm() : algorithm); KeyStore ts = KeyStore.getInstance(store_type); ts.load(tsf, truststore_password.toCharArray()); tmf.init(ts); return tmf; } catch (Exception e) { throw new SSLException("failed to build trust manager store for secure connections", e); } } private static class HotReloadableFile { private final File file; private volatile long lastModTime; HotReloadableFile(String path) { file = new File(path); lastModTime = file.lastModified(); }
TrustManagerFactory function() throws SSLException { try (InputStream tsf = Files.newInputStream(Paths.get(truststore))) { TrustManagerFactory tmf = TrustManagerFactory.getInstance( algorithm == null ? TrustManagerFactory.getDefaultAlgorithm() : algorithm); KeyStore ts = KeyStore.getInstance(store_type); ts.load(tsf, truststore_password.toCharArray()); tmf.init(ts); return tmf; } catch (Exception e) { throw new SSLException(STR, e); } } private static class HotReloadableFile { private final File file; private volatile long lastModTime; HotReloadableFile(String path) { file = new File(path); lastModTime = file.lastModified(); }
/** * Builds TrustManagerFactory from the file based truststore. * * @return TrustManagerFactory from the file based truststore * @throws SSLException if any issues encountered during the build process */
Builds TrustManagerFactory from the file based truststore
buildTrustManagerFactory
{ "repo_name": "jrwest/cassandra", "path": "src/java/org/apache/cassandra/security/FileBasedSslContextFactory.java", "license": "apache-2.0", "size": 7298 }
[ "java.io.InputStream", "java.nio.file.Files", "java.nio.file.Paths", "java.security.KeyStore", "javax.net.ssl.SSLException", "javax.net.ssl.TrustManagerFactory", "org.apache.cassandra.io.util.File" ]
import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import java.security.KeyStore; import javax.net.ssl.SSLException; import javax.net.ssl.TrustManagerFactory; import org.apache.cassandra.io.util.File;
import java.io.*; import java.nio.file.*; import java.security.*; import javax.net.ssl.*; import org.apache.cassandra.io.util.*;
[ "java.io", "java.nio", "java.security", "javax.net", "org.apache.cassandra" ]
java.io; java.nio; java.security; javax.net; org.apache.cassandra;
382,962
@Nonnull public static Matcher<AddressFamilyCapabilities> hasSendExtendedCommunity(boolean value) { return new HasSendExtendedCommunity(equalTo(value)); } private AddressFamilyCapabilitiesMatchers() {}
static Matcher<AddressFamilyCapabilities> function(boolean value) { return new HasSendExtendedCommunity(equalTo(value)); } private AddressFamilyCapabilitiesMatchers() {}
/** * Provides a matcher that matches if the {@link AddressFamilyCapabilities}'s * sendExtendedCommunity is equal to the given value. */
Provides a matcher that matches if the <code>AddressFamilyCapabilities</code>'s sendExtendedCommunity is equal to the given value
hasSendExtendedCommunity
{ "repo_name": "dhalperi/batfish", "path": "projects/batfish-common-protocol/src/test/java/org/batfish/datamodel/matchers/AddressFamilyCapabilitiesMatchers.java", "license": "apache-2.0", "size": 2087 }
[ "org.batfish.datamodel.bgp.AddressFamilyCapabilities", "org.batfish.datamodel.matchers.AddressFamilyCapabilitiesMatchersImpl", "org.hamcrest.Matcher" ]
import org.batfish.datamodel.bgp.AddressFamilyCapabilities; import org.batfish.datamodel.matchers.AddressFamilyCapabilitiesMatchersImpl; import org.hamcrest.Matcher;
import org.batfish.datamodel.bgp.*; import org.batfish.datamodel.matchers.*; import org.hamcrest.*;
[ "org.batfish.datamodel", "org.hamcrest" ]
org.batfish.datamodel; org.hamcrest;
482,006
private FSPaths createNewPaths(String dirName) throws HiveException { FSPaths fsp2 = new FSPaths(specPath); if (childSpecPathDynLinkedPartitions != null) { fsp2.tmpPath = new Path(fsp2.tmpPath, dirName + Path.SEPARATOR + childSpecPathDynLinkedPartitions); fsp2.taskOutputTempPath = new Path(fsp2.taskOutputTempPath, dirName + Path.SEPARATOR + childSpecPathDynLinkedPartitions); } else { fsp2.tmpPath = new Path(fsp2.tmpPath, dirName); fsp2.taskOutputTempPath = new Path(fsp2.taskOutputTempPath, dirName); } if(!conf.getDpSortState().equals(DPSortState.PARTITION_BUCKET_SORTED)) { createBucketFiles(fsp2); valToPaths.put(dirName, fsp2); } return fsp2; }
FSPaths function(String dirName) throws HiveException { FSPaths fsp2 = new FSPaths(specPath); if (childSpecPathDynLinkedPartitions != null) { fsp2.tmpPath = new Path(fsp2.tmpPath, dirName + Path.SEPARATOR + childSpecPathDynLinkedPartitions); fsp2.taskOutputTempPath = new Path(fsp2.taskOutputTempPath, dirName + Path.SEPARATOR + childSpecPathDynLinkedPartitions); } else { fsp2.tmpPath = new Path(fsp2.tmpPath, dirName); fsp2.taskOutputTempPath = new Path(fsp2.taskOutputTempPath, dirName); } if(!conf.getDpSortState().equals(DPSortState.PARTITION_BUCKET_SORTED)) { createBucketFiles(fsp2); valToPaths.put(dirName, fsp2); } return fsp2; }
/** * create new path. * * @param dirName * @return * @throws HiveException */
create new path
createNewPaths
{ "repo_name": "BUPTAnderson/apache-hive-2.1.1-src", "path": "ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java", "license": "apache-2.0", "size": 50883 }
[ "org.apache.hadoop.fs.Path", "org.apache.hadoop.hive.ql.metadata.HiveException", "org.apache.hadoop.hive.ql.plan.FileSinkDesc" ]
import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.plan.FileSinkDesc;
import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hadoop.hive.ql.plan.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
164,476
@Override public String toString() { try { StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); jsonWriter.setLenient(true); Streams.write(this, jsonWriter); return stringWriter.toString(); } catch (IOException e) { throw new AssertionError(e); } }
String function() { try { StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); jsonWriter.setLenient(true); Streams.write(this, jsonWriter); return stringWriter.toString(); } catch (IOException e) { throw new AssertionError(e); } }
/** * Returns a String representation of this element. */
Returns a String representation of this element
toString
{ "repo_name": "michal-skrabacz/gson-realm", "path": "gson-realm/src/main/java/com/google/gson/JsonElement.java", "license": "apache-2.0", "size": 12636 }
[ "com.google.gson.internal.Streams", "com.google.gson.stream.JsonWriter", "java.io.IOException", "java.io.StringWriter" ]
import com.google.gson.internal.Streams; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.io.StringWriter;
import com.google.gson.internal.*; import com.google.gson.stream.*; import java.io.*;
[ "com.google.gson", "java.io" ]
com.google.gson; java.io;
2,620,985
@Test public void shouldEditConceptComplex() throws Exception { executeDataSet("org/openmrs/api/include/ObsServiceTest-complex.xml"); ConceptService cs = Context.getConceptService(); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean("conceptForm"); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); mockRequest.setMethod("POST"); mockRequest.setParameter("action", ""); mockRequest.setParameter("conceptId", "8473"); mockRequest.setParameter("namesByLocale[en].name", "A complex concept"); mockRequest.setParameter("concept.datatype", "13"); mockRequest.setParameter("concept.class", "5"); mockRequest.setParameter("handlerKey", "TextHandler"); // switching it from an ImageHandler to a TextHandler ModelAndView mav = conceptFormController.handleRequest(mockRequest, new MockHttpServletResponse()); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); Concept concept = cs.getConcept(8473); assertEquals(ConceptComplex.class, concept.getClass()); ConceptComplex complex = (ConceptComplex) concept; assertEquals("TextHandler", complex.getHandler()); } /** * @see {@link ConceptFormController#onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)}
void function() throws Exception { executeDataSet(STR); ConceptService cs = Context.getConceptService(); ConceptFormController conceptFormController = (ConceptFormController) applicationContext.getBean(STR); MockHttpServletRequest mockRequest = new MockHttpServletRequest(); mockRequest.setMethod("POST"); mockRequest.setParameter(STR, STRconceptIdSTR8473STRnamesByLocale[en].nameSTRA complex conceptSTRconcept.datatypeSTR13STRconcept.classSTR5STRhandlerKeySTRTextHandlerSTRTextHandler", complex.getHandler()); } /** * @see {@link ConceptFormController#onSubmit(HttpServletRequest,HttpServletResponse,Object,BindException)}
/** * This test makes sure that ConceptComplex objects can be edited * * @throws Exception */
This test makes sure that ConceptComplex objects can be edited
shouldEditConceptComplex
{ "repo_name": "Bhamni/openmrs-core", "path": "web/src/test/java/org/openmrs/web/controller/ConceptFormControllerTest.java", "license": "mpl-2.0", "size": 47529 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.openmrs.api.ConceptService", "org.openmrs.api.context.Context", "org.springframework.mock.web.MockHttpServletRequest", "org.springframework.validation.BindException" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.openmrs.api.ConceptService; import org.openmrs.api.context.Context; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.validation.BindException;
import javax.servlet.http.*; import org.openmrs.api.*; import org.openmrs.api.context.*; import org.springframework.mock.web.*; import org.springframework.validation.*;
[ "javax.servlet", "org.openmrs.api", "org.springframework.mock", "org.springframework.validation" ]
javax.servlet; org.openmrs.api; org.springframework.mock; org.springframework.validation;
51,327
void writeTo(Appendable out) throws IOException;
void writeTo(Appendable out) throws IOException;
/** * Writes the tag to the output. */
Writes the tag to the output
writeTo
{ "repo_name": "fivesmallq/web-data-extractor", "path": "src/main/java/jodd/lagarto/Tag.java", "license": "apache-2.0", "size": 6253 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,281,019
public void setStatisticRepository(final StatisticRepository statisticRepository) { this.statisticRepository = statisticRepository; }
void function(final StatisticRepository statisticRepository) { this.statisticRepository = statisticRepository; }
/** * Sets the statistic repository with the specified statistic repository. * * @param statisticRepository the specified statistic repository */
Sets the statistic repository with the specified statistic repository
setStatisticRepository
{ "repo_name": "446541492/solo", "path": "src/main/java/org/b3log/solo/service/StatisticMgmtService.java", "license": "apache-2.0", "size": 14248 }
[ "org.b3log.solo.repository.StatisticRepository" ]
import org.b3log.solo.repository.StatisticRepository;
import org.b3log.solo.repository.*;
[ "org.b3log.solo" ]
org.b3log.solo;
280,344
protected final FieldSpec.Builder componentField(TypeName type, String name) { return FieldSpec.builder(type, componentFieldNames.getUniqueName(name)); }
final FieldSpec.Builder function(TypeName type, String name) { return FieldSpec.builder(type, componentFieldNames.getUniqueName(name)); }
/** * Creates a {@link FieldSpec.Builder} with a unique name based off of {@code name}. */
Creates a <code>FieldSpec.Builder</code> with a unique name based off of name
componentField
{ "repo_name": "hansonchar/dagger", "path": "java/dagger/internal/codegen/AbstractComponentWriter.java", "license": "apache-2.0", "size": 25005 }
[ "com.squareup.javapoet.FieldSpec", "com.squareup.javapoet.TypeName" ]
import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.*;
[ "com.squareup.javapoet" ]
com.squareup.javapoet;
1,900,039
private boolean loadActivitiesIfNeeded() { if (mReloadActivities && mIntent != null) { mReloadActivities = false; mActivities.clear(); List<ResolveInfo> resolveInfos = mContext.getPackageManager() .queryIntentActivities(mIntent, 0); final int resolveInfoCount = resolveInfos.size(); for (int i = 0; i < resolveInfoCount; i++) { ResolveInfo resolveInfo = resolveInfos.get(i); mActivities.add(new ActivityResolveInfo(resolveInfo)); } return true; } return false; }
boolean function() { if (mReloadActivities && mIntent != null) { mReloadActivities = false; mActivities.clear(); List<ResolveInfo> resolveInfos = mContext.getPackageManager() .queryIntentActivities(mIntent, 0); final int resolveInfoCount = resolveInfos.size(); for (int i = 0; i < resolveInfoCount; i++) { ResolveInfo resolveInfo = resolveInfos.get(i); mActivities.add(new ActivityResolveInfo(resolveInfo)); } return true; } return false; }
/** * Loads the activities for the current intent if needed which is * if they are not already loaded for the current intent. * * @return Whether loading was performed. */
Loads the activities for the current intent if needed which is if they are not already loaded for the current intent
loadActivitiesIfNeeded
{ "repo_name": "Trellmor/BerryMotesGallery", "path": "berryMotesGallery/src/main/java/com/trellmor/widget/ActivityChooserModel.java", "license": "gpl-3.0", "size": 38337 }
[ "android.content.pm.ResolveInfo", "java.util.List" ]
import android.content.pm.ResolveInfo; import java.util.List;
import android.content.pm.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
107,709
public static boolean isAwaited(Object future) { // If the object is not reified, it cannot be a future if ((MOP.isReifiedObject(future)) == false) { return false; } else { org.objectweb.proactive.core.mop.Proxy theProxy = ((StubObject) future).getProxy(); // If it is reified but its proxy is not of type future, we cannot wait if (!(theProxy instanceof Future)) { return false; } else { if (((Future) theProxy).isAwaited()) { return true; } else { return isAwaited(((Future) theProxy).getResult()); } } } }
static boolean function(Object future) { if ((MOP.isReifiedObject(future)) == false) { return false; } else { org.objectweb.proactive.core.mop.Proxy theProxy = ((StubObject) future).getProxy(); if (!(theProxy instanceof Future)) { return false; } else { if (((Future) theProxy).isAwaited()) { return true; } else { return isAwaited(((Future) theProxy).getResult()); } } } }
/** * Return false if the object <code>future</code> is available. This method is recursive, i.e. * if result of future is a future too, <CODE>isAwaited</CODE> is called again on this result, * and so on. */
Return false if the object <code>future</code> is available. This method is recursive, i.e. if result of future is a future too, <code>isAwaited</code> is called again on this result, and so on
isAwaited
{ "repo_name": "paraita/programming", "path": "programming-core/src/main/java/org/objectweb/proactive/api/PAFuture.java", "license": "agpl-3.0", "size": 16969 }
[ "org.objectweb.proactive.core.body.future.Future", "org.objectweb.proactive.core.mop.MOP", "org.objectweb.proactive.core.mop.StubObject" ]
import org.objectweb.proactive.core.body.future.Future; import org.objectweb.proactive.core.mop.MOP; import org.objectweb.proactive.core.mop.StubObject;
import org.objectweb.proactive.core.body.future.*; import org.objectweb.proactive.core.mop.*;
[ "org.objectweb.proactive" ]
org.objectweb.proactive;
1,798,947
public void assertContains(AssertionInfo info, char[] actual, char[] values) { arrays.assertContains(info, failures, actual, values); }
void function(AssertionInfo info, char[] actual, char[] values) { arrays.assertContains(info, failures, actual, values); }
/** * Asserts that the given array contains the given values, in any order. * * @param info contains information about the assertion. * @param actual the given array. * @param values the values that are expected to be in the given array. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given array is {@code null}. * @throws AssertionError if the given array does not contain the given values. */
Asserts that the given array contains the given values, in any order
assertContains
{ "repo_name": "ChrisCanCompute/assertj-core", "path": "src/main/java/org/assertj/core/internal/CharArrays.java", "license": "apache-2.0", "size": 14759 }
[ "org.assertj.core.api.AssertionInfo" ]
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
127,393
public static byte[] decode(HuffmanTree tree, byte[] source){ ByteArrayInputStream bais = new ByteArrayInputStream(source); int size = bais.read() | (bais.read() << 8) | (bais.read() << 16) | (bais.read() << 24); BitInputStream bis = new BitInputStream(bais); byte[] out = new byte[size]; Node root; try { if (tree == null) { root = new HuffmanTree().build(HuffmanTree.loadTable(bais)); } else { root = tree.getRootNode(); } for (int i = 0; i < out.length; i++) { out[i] = (byte) readByte(root, bis); } } catch (Exception ex) { ExHandler.handle(ex); return null; } return out; }
static byte[] function(HuffmanTree tree, byte[] source){ ByteArrayInputStream bais = new ByteArrayInputStream(source); int size = bais.read() (bais.read() << 8) (bais.read() << 16) (bais.read() << 24); BitInputStream bis = new BitInputStream(bais); byte[] out = new byte[size]; Node root; try { if (tree == null) { root = new HuffmanTree().build(HuffmanTree.loadTable(bais)); } else { root = tree.getRootNode(); } for (int i = 0; i < out.length; i++) { out[i] = (byte) readByte(root, bis); } } catch (Exception ex) { ExHandler.handle(ex); return null; } return out; }
/** * Huffman decode the source array * * @param tree * a Huffman tree as created by new Tree() or null * @param source * A huffman compressed array as returned by encode(). If tree is null, the frequency * count is expected to be included to the source. * @return the decoded data or null on error. */
Huffman decode the source array
decode
{ "repo_name": "sazgin/elexis-3-core", "path": "ch.rgw.utility/src/ch/rgw/compress/Huff.java", "license": "epl-1.0", "size": 9145 }
[ "ch.rgw.compress.HuffmanTree", "ch.rgw.io.BitInputStream", "ch.rgw.tools.ExHandler", "java.io.ByteArrayInputStream" ]
import ch.rgw.compress.HuffmanTree; import ch.rgw.io.BitInputStream; import ch.rgw.tools.ExHandler; import java.io.ByteArrayInputStream;
import ch.rgw.compress.*; import ch.rgw.io.*; import ch.rgw.tools.*; import java.io.*;
[ "ch.rgw.compress", "ch.rgw.io", "ch.rgw.tools", "java.io" ]
ch.rgw.compress; ch.rgw.io; ch.rgw.tools; java.io;
2,537,398
protected String digestEncodedPassword(final String encodedPassword, final Map<String, Object> values) { val hashService = new DefaultHashService(); if (StringUtils.isNotBlank(properties.getStaticSalt())) { hashService.setPrivateSalt(ByteSource.Util.bytes(properties.getStaticSalt())); } hashService.setHashAlgorithmName(properties.getAlgorithmName()); if (values.containsKey(properties.getNumberOfIterationsFieldName())) { val longAsStr = values.get(properties.getNumberOfIterationsFieldName()).toString(); hashService.setHashIterations(Integer.parseInt(longAsStr)); } else { hashService.setHashIterations(properties.getNumberOfIterations()); } if (!values.containsKey(properties.getSaltFieldName())) { throw new IllegalArgumentException("Specified field name for salt does not exist in the results"); } val dynaSalt = values.get(properties.getSaltFieldName()).toString(); val request = new HashRequest.Builder() .setSalt(dynaSalt) .setSource(encodedPassword) .build(); return hashService.computeHash(request).toHex(); }
String function(final String encodedPassword, final Map<String, Object> values) { val hashService = new DefaultHashService(); if (StringUtils.isNotBlank(properties.getStaticSalt())) { hashService.setPrivateSalt(ByteSource.Util.bytes(properties.getStaticSalt())); } hashService.setHashAlgorithmName(properties.getAlgorithmName()); if (values.containsKey(properties.getNumberOfIterationsFieldName())) { val longAsStr = values.get(properties.getNumberOfIterationsFieldName()).toString(); hashService.setHashIterations(Integer.parseInt(longAsStr)); } else { hashService.setHashIterations(properties.getNumberOfIterations()); } if (!values.containsKey(properties.getSaltFieldName())) { throw new IllegalArgumentException(STR); } val dynaSalt = values.get(properties.getSaltFieldName()).toString(); val request = new HashRequest.Builder() .setSalt(dynaSalt) .setSource(encodedPassword) .build(); return hashService.computeHash(request).toHex(); }
/** * Digest encoded password. * * @param encodedPassword the encoded password * @param values the values retrieved from database * @return the digested password */
Digest encoded password
digestEncodedPassword
{ "repo_name": "apereo/cas", "path": "support/cas-server-support-jdbc-authentication/src/main/java/org/apereo/cas/adaptors/jdbc/QueryAndEncodeDatabaseAuthenticationHandler.java", "license": "apache-2.0", "size": 6648 }
[ "java.util.Map", "org.apache.commons.lang3.StringUtils", "org.apache.shiro.crypto.hash.DefaultHashService", "org.apache.shiro.crypto.hash.HashRequest", "org.apache.shiro.util.ByteSource" ]
import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.crypto.hash.DefaultHashService; import org.apache.shiro.crypto.hash.HashRequest; import org.apache.shiro.util.ByteSource;
import java.util.*; import org.apache.commons.lang3.*; import org.apache.shiro.crypto.hash.*; import org.apache.shiro.util.*;
[ "java.util", "org.apache.commons", "org.apache.shiro" ]
java.util; org.apache.commons; org.apache.shiro;
506,002
public List<OperationInner> value() { return this.value; }
List<OperationInner> function() { return this.value; }
/** * Get the value property: List of CDN operations supported by the CDN resource provider. * * @return the value value. */
Get the value property: List of CDN operations supported by the CDN resource provider
value
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/models/OperationsListResult.java", "license": "mit", "size": 2509 }
[ "com.azure.resourcemanager.cdn.fluent.models.OperationInner", "java.util.List" ]
import com.azure.resourcemanager.cdn.fluent.models.OperationInner; import java.util.List;
import com.azure.resourcemanager.cdn.fluent.models.*; import java.util.*;
[ "com.azure.resourcemanager", "java.util" ]
com.azure.resourcemanager; java.util;
338,282
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<ClusterInner> listByResourceGroup(String resourceGroupName, Context context) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ClusterInner> function(String resourceGroupName, Context context) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); }
/** * Gets Log Analytics clusters in a resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @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 log Analytics clusters in a resource group. */
Gets Log Analytics clusters in a resource group
listByResourceGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/implementation/ClustersClientImpl.java", "license": "mit", "size": 69008 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context", "com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.loganalytics.fluent.models.ClusterInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.loganalytics.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
259,112
protected boolean makeNewFolder(String path) { File newFolder = new File(path); if (!newFolder.exists()) return newFolder.mkdir(); return false; }
boolean function(String path) { File newFolder = new File(path); if (!newFolder.exists()) return newFolder.mkdir(); return false; }
/** * making new Folder with given path * * @param path * @return true if folder created newly, false if the folder already * presented */
making new Folder with given path
makeNewFolder
{ "repo_name": "debabratahazra/DS", "path": "designstudio/components/basic/ui/com.odcgroup.basic.ui/src/main/java/com/temenos/t24/tools/eclipse/basic/wizards/docgeneration/file/FileCreator.java", "license": "epl-1.0", "size": 1438 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
778,672
public static List<Class<?>> scanInstanceOf(Package root, Class<?> conditionClass, int maxCount) throws IOException, ClassNotFoundException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return scan(root, conditionClass, InstanceOfFilter.INSTANCE, maxCount, classLoader); }
static List<Class<?>> function(Package root, Class<?> conditionClass, int maxCount) throws IOException, ClassNotFoundException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); return scan(root, conditionClass, InstanceOfFilter.INSTANCE, maxCount, classLoader); }
/** * Scans classes which is instance of the condition class in the root. * The invocation of this method behaves in exactly the same way as the invocation * <code> * ClassScanner.Filter filter = InstanceOfFilter.INSTANCE; * ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); * scan(root, conditionClass, filter, maxCount, classLoader) * </code> * * @param root the root package * @param conditionClass the condition (parent) class * @param maxCount the maximum count of the result * @return the scanned class which is the instance of the condition class * @throws IOException if I/O error occurs * @throws java.lang.IllegalStateException if unsupported kind of the classpath is used */
Scans classes which is instance of the condition class in the root. The invocation of this method behaves in exactly the same way as the invocation <code> ClassScanner.Filter filter = InstanceOfFilter.INSTANCE; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); scan(root, conditionClass, filter, maxCount, classLoader) </code>
scanInstanceOf
{ "repo_name": "ihiroky/jcs", "path": "src/main/java/net/ihiroky/jcs/ClassScanner.java", "license": "mit", "size": 12865 }
[ "java.io.IOException", "java.util.List" ]
import java.io.IOException; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,674,521
public static File extractTessResources(String resourceName) { File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); URL tessResourceUrl = LoadLibs.class.getResource(resourceName.startsWith("/") ? resourceName : "/" + resourceName); if (tessResourceUrl == null) { return null; } URLConnection urlConnection = tessResourceUrl.openConnection(); if (urlConnection instanceof JarURLConnection) { copyJarResourceToPath((JarURLConnection) urlConnection, targetPath); } else { File file = new File(tessResourceUrl.getPath()); if (file.isDirectory()) { FileUtils.copyDirectory(file, targetPath); } else { FileUtils.copyFile(file, targetPath); } } } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } return targetPath; }
static File function(String resourceName) { File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); URL tessResourceUrl = LoadLibs.class.getResource(resourceName.startsWith("/") ? resourceName : "/" + resourceName); if (tessResourceUrl == null) { return null; } URLConnection urlConnection = tessResourceUrl.openConnection(); if (urlConnection instanceof JarURLConnection) { copyJarResourceToPath((JarURLConnection) urlConnection, targetPath); } else { File file = new File(tessResourceUrl.getPath()); if (file.isDirectory()) { FileUtils.copyDirectory(file, targetPath); } else { FileUtils.copyFile(file, targetPath); } } } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } return targetPath; }
/** * Extracts tesseract resources to temp folder. * * @param resourceName name of file or directory * @return target path, which could be file or directory */
Extracts tesseract resources to temp folder
extractTessResources
{ "repo_name": "WodlBodl/visionAssistant", "path": "backend/ocr/ocr/src/net/sourceforge/tess4j/util/LoadLibs.java", "license": "mit", "size": 6176 }
[ "java.io.File", "java.net.JarURLConnection", "java.net.URLConnection", "java.util.logging.Level", "org.apache.commons.io.FileUtils" ]
import java.io.File; import java.net.JarURLConnection; import java.net.URLConnection; import java.util.logging.Level; import org.apache.commons.io.FileUtils;
import java.io.*; import java.net.*; import java.util.logging.*; import org.apache.commons.io.*;
[ "java.io", "java.net", "java.util", "org.apache.commons" ]
java.io; java.net; java.util; org.apache.commons;
1,572,376
@Ignore @Test public void testInterfaceStabilityAnnotationForLimitedAPI() throws ClassNotFoundException, IOException, LinkageError { // find classes that are: // In the main jar // AND are not in a hadoop-compat module // AND are public // NOT test classes // AND NOT generated classes // AND are annotated with InterfaceAudience.LimitedPrivate // AND NOT annotated with InterfaceStability ClassFinder classFinder = new ClassFinder( new And(new MainCodeResourcePathFilter(), new TestFileNameFilter()), new Not((FileNameFilter)new TestFileNameFilter()), new And(new PublicClassFilter(), new Not(new TestClassFilter()), new Not(new GeneratedClassFilter()), new Not(new ShadedProtobufClassFilter()), new InterfaceAudienceLimitedPrivateAnnotatedNotConfigClassFilter(), new Not(new IsInterfaceStabilityClassFilter()), new Not(new InterfaceStabilityAnnotatedClassFilter())) ); Set<Class<?>> classes = classFinder.findClasses(false); if (!classes.isEmpty()) { LOG.info("These are the @InterfaceAudience.LimitedPrivate classes that DO NOT " + "have @InterfaceStability annotation:"); for (Class<?> clazz : classes) { LOG.info(clazz); } } Assert.assertEquals("All classes that are marked with @InterfaceAudience.LimitedPrivate " + "should have @InterfaceStability annotation", 0, classes.size()); }
void function() throws ClassNotFoundException, IOException, LinkageError { ClassFinder classFinder = new ClassFinder( new And(new MainCodeResourcePathFilter(), new TestFileNameFilter()), new Not((FileNameFilter)new TestFileNameFilter()), new And(new PublicClassFilter(), new Not(new TestClassFilter()), new Not(new GeneratedClassFilter()), new Not(new ShadedProtobufClassFilter()), new InterfaceAudienceLimitedPrivateAnnotatedNotConfigClassFilter(), new Not(new IsInterfaceStabilityClassFilter()), new Not(new InterfaceStabilityAnnotatedClassFilter())) ); Set<Class<?>> classes = classFinder.findClasses(false); if (!classes.isEmpty()) { LOG.info(STR + STR); for (Class<?> clazz : classes) { LOG.info(clazz); } } Assert.assertEquals(STR + STR, 0, classes.size()); }
/** * Checks whether all the classes in client and common modules that are marked * InterfaceAudience.Public do not have {@link InterfaceStability} annotations. */
Checks whether all the classes in client and common modules that are marked InterfaceAudience.Public do not have <code>InterfaceStability</code> annotations
testInterfaceStabilityAnnotationForLimitedAPI
{ "repo_name": "JingchengDu/hbase", "path": "hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java", "license": "apache-2.0", "size": 20056 }
[ "java.io.IOException", "java.util.Set", "org.apache.hadoop.hbase.ClassFinder", "org.apache.hadoop.hbase.ClassTestFinder", "org.junit.Assert" ]
import java.io.IOException; import java.util.Set; import org.apache.hadoop.hbase.ClassFinder; import org.apache.hadoop.hbase.ClassTestFinder; import org.junit.Assert;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.junit.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.junit" ]
java.io; java.util; org.apache.hadoop; org.junit;
2,396,502
public PortStatistics calcDeltaStats(DeviceId deviceId, PortStatistics prvStats, PortStatistics newStats) { // calculate time difference long deltaStatsSec, deltaStatsNano; if (newStats.durationNano() < prvStats.durationNano()) { deltaStatsNano = newStats.durationNano() - prvStats.durationNano() + TimeUnit.SECONDS.toNanos(1); deltaStatsSec = newStats.durationSec() - prvStats.durationSec() - 1L; } else { deltaStatsNano = newStats.durationNano() - prvStats.durationNano(); deltaStatsSec = newStats.durationSec() - prvStats.durationSec(); } DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); DefaultPortStatistics deltaStats = builder.setDeviceId(deviceId) .setPort(newStats.port()) .setPacketsReceived(newStats.packetsReceived() - prvStats.packetsReceived()) .setPacketsSent(newStats.packetsSent() - prvStats.packetsSent()) .setBytesReceived(newStats.bytesReceived() - prvStats.bytesReceived()) .setBytesSent(newStats.bytesSent() - prvStats.bytesSent()) .setPacketsRxDropped(newStats.packetsRxDropped() - prvStats.packetsRxDropped()) .setPacketsTxDropped(newStats.packetsTxDropped() - prvStats.packetsTxDropped()) .setPacketsRxErrors(newStats.packetsRxErrors() - prvStats.packetsRxErrors()) .setPacketsTxErrors(newStats.packetsTxErrors() - prvStats.packetsTxErrors()) .setDurationSec(deltaStatsSec) .setDurationNano(deltaStatsNano) .build(); return deltaStats; }
PortStatistics function(DeviceId deviceId, PortStatistics prvStats, PortStatistics newStats) { long deltaStatsSec, deltaStatsNano; if (newStats.durationNano() < prvStats.durationNano()) { deltaStatsNano = newStats.durationNano() - prvStats.durationNano() + TimeUnit.SECONDS.toNanos(1); deltaStatsSec = newStats.durationSec() - prvStats.durationSec() - 1L; } else { deltaStatsNano = newStats.durationNano() - prvStats.durationNano(); deltaStatsSec = newStats.durationSec() - prvStats.durationSec(); } DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); DefaultPortStatistics deltaStats = builder.setDeviceId(deviceId) .setPort(newStats.port()) .setPacketsReceived(newStats.packetsReceived() - prvStats.packetsReceived()) .setPacketsSent(newStats.packetsSent() - prvStats.packetsSent()) .setBytesReceived(newStats.bytesReceived() - prvStats.bytesReceived()) .setBytesSent(newStats.bytesSent() - prvStats.bytesSent()) .setPacketsRxDropped(newStats.packetsRxDropped() - prvStats.packetsRxDropped()) .setPacketsTxDropped(newStats.packetsTxDropped() - prvStats.packetsTxDropped()) .setPacketsRxErrors(newStats.packetsRxErrors() - prvStats.packetsRxErrors()) .setPacketsTxErrors(newStats.packetsTxErrors() - prvStats.packetsTxErrors()) .setDurationSec(deltaStatsSec) .setDurationNano(deltaStatsNano) .build(); return deltaStats; }
/** * Calculate delta statistics by subtracting previous from new statistics. * * @param deviceId device indentifier * @param prvStats previous port statistics * @param newStats new port statistics * @return PortStatistics */
Calculate delta statistics by subtracting previous from new statistics
calcDeltaStats
{ "repo_name": "mengmoya/onos", "path": "core/store/dist/src/main/java/org/onosproject/store/device/impl/ECDeviceStore.java", "license": "apache-2.0", "size": 37241 }
[ "java.util.concurrent.TimeUnit", "org.onosproject.net.DeviceId", "org.onosproject.net.device.DefaultPortStatistics", "org.onosproject.net.device.PortStatistics" ]
import java.util.concurrent.TimeUnit; import org.onosproject.net.DeviceId; import org.onosproject.net.device.DefaultPortStatistics; import org.onosproject.net.device.PortStatistics;
import java.util.concurrent.*; import org.onosproject.net.*; import org.onosproject.net.device.*;
[ "java.util", "org.onosproject.net" ]
java.util; org.onosproject.net;
2,061,934
public Durable2PCParticipant deserialize(String id, ObjectInputStream stream) throws Exception { if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "DurableTestParticipant")) { System.out.println("xts service test : attempting to deserialize WS-AT participant " + id); DurableTestParticipant participant = (DurableTestParticipant)stream.readObject(); System.out.println("xts service test : deserialized WS-AT participant " + id); return participant; } return null; }
Durable2PCParticipant function(String id, ObjectInputStream stream) throws Exception { if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + STR)) { System.out.println(STR + id); DurableTestParticipant participant = (DurableTestParticipant)stream.readObject(); System.out.println(STR + id); return participant; } return null; }
/** * called during recovery processing to allow an application to identify a participant id * belonging to one of its participants and recreate the participant by deserializing * it from the supplied object input stream. n.b. this is only appropriate in case the * participant was originally saved using serialization. * * @param id the id used when the participant was created * @param stream a stream from which the application should deserialise the participant * if it recognises that the id belongs to the module's application * @return the Durable2PCParticipant * @throws Exception if an error occurs deserializing the durable participant */
called during recovery processing to allow an application to identify a participant id belonging to one of its participants and recreate the participant by deserializing it from the supplied object input stream. n.b. this is only appropriate in case the participant was originally saved using serialization
deserialize
{ "repo_name": "nmcl/scratch", "path": "graalvm/transactions/fork/narayana/XTS/localjunit/xtstest/src/org/jboss/jbossts/xts/servicetests/service/recovery/TestATRecoveryModule.java", "license": "apache-2.0", "size": 4484 }
[ "com.arjuna.wst.Durable2PCParticipant", "java.io.ObjectInputStream", "org.jboss.jbossts.xts.servicetests.service.Constants", "org.jboss.jbossts.xts.servicetests.service.participant.DurableTestParticipant" ]
import com.arjuna.wst.Durable2PCParticipant; import java.io.ObjectInputStream; import org.jboss.jbossts.xts.servicetests.service.Constants; import org.jboss.jbossts.xts.servicetests.service.participant.DurableTestParticipant;
import com.arjuna.wst.*; import java.io.*; import org.jboss.jbossts.xts.servicetests.service.*; import org.jboss.jbossts.xts.servicetests.service.participant.*;
[ "com.arjuna.wst", "java.io", "org.jboss.jbossts" ]
com.arjuna.wst; java.io; org.jboss.jbossts;
2,353,289
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); // create a shell shell = new GroovyShell(mgr.getClassLoader()); // register the mgr with object name "bsf" shell.setVariable("bsf", new BSFFunctions(mgr, this)); int size = declaredBeans.size(); for (int i = 0; i < size; i++) { declareBean((BSFDeclaredBean) declaredBeans.elementAt(i)); } }
void function(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); shell = new GroovyShell(mgr.getClassLoader()); shell.setVariable("bsf", new BSFFunctions(mgr, this)); int size = declaredBeans.size(); for (int i = 0; i < size; i++) { declareBean((BSFDeclaredBean) declaredBeans.elementAt(i)); } }
/** * Initialize the engine. */
Initialize the engine
initialize
{ "repo_name": "Selventa/model-builder", "path": "tools/groovy/src/subprojects/groovy-bsf/src/main/java/org/codehaus/groovy/bsf/GroovyEngine.java", "license": "apache-2.0", "size": 5151 }
[ "groovy.lang.GroovyShell", "java.util.Vector", "org.apache.bsf.BSFDeclaredBean", "org.apache.bsf.BSFException", "org.apache.bsf.BSFManager", "org.apache.bsf.util.BSFFunctions" ]
import groovy.lang.GroovyShell; import java.util.Vector; import org.apache.bsf.BSFDeclaredBean; import org.apache.bsf.BSFException; import org.apache.bsf.BSFManager; import org.apache.bsf.util.BSFFunctions;
import groovy.lang.*; import java.util.*; import org.apache.bsf.*; import org.apache.bsf.util.*;
[ "groovy.lang", "java.util", "org.apache.bsf" ]
groovy.lang; java.util; org.apache.bsf;
377,425
@ApiModelProperty(value = "The last position in the result set. ") public Integer getEndPosition() { return endPosition; }
@ApiModelProperty(value = STR) Integer function() { return endPosition; }
/** * The last position in the result set. . * @return endPosition **/
The last position in the result set.
getEndPosition
{ "repo_name": "docusign/docusign-java-client", "path": "src/main/java/com/docusign/esign/model/PowerFormsResponse.java", "license": "mit", "size": 7698 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,835,698
@Test public void policyNone() throws Exception { // setup given conditions doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); doReturn(RecordableVersionPolicy.NONE.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); // when version is created recordableVersionService.createVersion(nodeRef, versionProperties); // then a normal version is created verifyNormalVersion(); }
void function() throws Exception { doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); doReturn(RecordableVersionPolicy.NONE.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); recordableVersionService.createVersion(nodeRef, versionProperties); verifyNormalVersion(); }
/** * Given that the node has a recordable version policy of NONE * When I create a version * Then the version service creates a normal version. */
Given that the node has a recordable version policy of NONE When I create a version Then the version service creates a normal version
policyNone
{ "repo_name": "dnacreative/records-management", "path": "rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java", "license": "lgpl-3.0", "size": 22998 }
[ "org.alfresco.repo.version.VersionModel", "org.alfresco.service.cmr.version.VersionType", "org.mockito.Mockito" ]
import org.alfresco.repo.version.VersionModel; import org.alfresco.service.cmr.version.VersionType; import org.mockito.Mockito;
import org.alfresco.repo.version.*; import org.alfresco.service.cmr.version.*; import org.mockito.*;
[ "org.alfresco.repo", "org.alfresco.service", "org.mockito" ]
org.alfresco.repo; org.alfresco.service; org.mockito;
910,460
public void initializePackageContents() { if (isInitialized) return; isInitialized = true; // Initialize package setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); // Obtain other dependent packages ComponentRepositoryPackage theComponentRepositoryPackage = (ComponentRepositoryPackage)EPackage.Registry.INSTANCE.getEPackage(ComponentRepositoryPackage.eNS_URI); InterfaceRepositoryPackage theInterfaceRepositoryPackage = (InterfaceRepositoryPackage)EPackage.Registry.INSTANCE.getEPackage(InterfaceRepositoryPackage.eNS_URI); // Create type parameters // Set bounds for type parameters // Add supertypes to classes busBoxEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busMasterEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busSlaveEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busCableEClass.getESuperTypes().add(theComponentRepositoryPackage.getCable()); profibusDPBoxEClass.getESuperTypes().add(this.getBusBox()); profibusDPMasterEClass.getESuperTypes().add(this.getBusMaster()); profibusDPSlaveEClass.getESuperTypes().add(this.getBusSlave()); profibusDPCableEClass.getESuperTypes().add(this.getBusCable()); etherCATBoxEClass.getESuperTypes().add(this.getBusBox()); etherCATMasterEClass.getESuperTypes().add(this.getBusMaster()); etherCATSlaveEClass.getESuperTypes().add(this.getBusSlave()); etherCATCableEClass.getESuperTypes().add(this.getBusCable()); // Initialize classes, features, and operations; add parameters initEClass(busBoxEClass, BusBox.class, "BusBox", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusBox_Signalinterfaces(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterfaces", null, 0, -1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Signalinterface_master(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterface_master", null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Signalinterface_box(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterface_box", null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Powersupply(), theComponentRepositoryPackage.getPowerSupply(), null, "powersupply", null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busMasterEClass, BusMaster.class, "BusMaster", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusMaster_Signalinterfaces(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterfaces", null, 0, -1, BusMaster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusMaster_Signalinterface_controller(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterface_controller", null, 1, 1, BusMaster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busSlaveEClass, BusSlave.class, "BusSlave", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusSlave_Signalinterface_master(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterface_master", null, 1, 1, BusSlave.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusSlave_Signalinterface_slave(), theInterfaceRepositoryPackage.getSignalInterface(), null, "signalinterface_slave", null, 1, 1, BusSlave.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busCableEClass, BusCable.class, "BusCable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusCable_SignalPlug1(), theInterfaceRepositoryPackage.getSignalInterface(), null, "SignalPlug1", null, 0, 1, BusCable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusCable_SignalPlug2(), theInterfaceRepositoryPackage.getSignalInterface(), null, "SignalPlug2", null, 0, 1, BusCable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(profibusDPBoxEClass, ProfibusDPBox.class, "ProfibusDPBox", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPMasterEClass, ProfibusDPMaster.class, "ProfibusDPMaster", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPSlaveEClass, ProfibusDPSlave.class, "ProfibusDPSlave", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPCableEClass, ProfibusDPCable.class, "ProfibusDPCable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATBoxEClass, EtherCATBox.class, "EtherCATBox", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATMasterEClass, EtherCATMaster.class, "EtherCATMaster", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATSlaveEClass, EtherCATSlave.class, "EtherCATSlave", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATCableEClass, EtherCATCable.class, "EtherCATCable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); }
void function() { if (isInitialized) return; isInitialized = true; setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); ComponentRepositoryPackage theComponentRepositoryPackage = (ComponentRepositoryPackage)EPackage.Registry.INSTANCE.getEPackage(ComponentRepositoryPackage.eNS_URI); InterfaceRepositoryPackage theInterfaceRepositoryPackage = (InterfaceRepositoryPackage)EPackage.Registry.INSTANCE.getEPackage(InterfaceRepositoryPackage.eNS_URI); busBoxEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busMasterEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busSlaveEClass.getESuperTypes().add(theComponentRepositoryPackage.getComponent()); busCableEClass.getESuperTypes().add(theComponentRepositoryPackage.getCable()); profibusDPBoxEClass.getESuperTypes().add(this.getBusBox()); profibusDPMasterEClass.getESuperTypes().add(this.getBusMaster()); profibusDPSlaveEClass.getESuperTypes().add(this.getBusSlave()); profibusDPCableEClass.getESuperTypes().add(this.getBusCable()); etherCATBoxEClass.getESuperTypes().add(this.getBusBox()); etherCATMasterEClass.getESuperTypes().add(this.getBusMaster()); etherCATSlaveEClass.getESuperTypes().add(this.getBusSlave()); etherCATCableEClass.getESuperTypes().add(this.getBusCable()); initEClass(busBoxEClass, BusBox.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusBox_Signalinterfaces(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 0, -1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Signalinterface_master(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Signalinterface_box(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusBox_Powersupply(), theComponentRepositoryPackage.getPowerSupply(), null, STR, null, 1, 1, BusBox.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busMasterEClass, BusMaster.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusMaster_Signalinterfaces(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 0, -1, BusMaster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusMaster_Signalinterface_controller(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 1, 1, BusMaster.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busSlaveEClass, BusSlave.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusSlave_Signalinterface_master(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 1, 1, BusSlave.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusSlave_Signalinterface_slave(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 1, 1, BusSlave.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(busCableEClass, BusCable.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getBusCable_SignalPlug1(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 0, 1, BusCable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getBusCable_SignalPlug2(), theInterfaceRepositoryPackage.getSignalInterface(), null, STR, null, 0, 1, BusCable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(profibusDPBoxEClass, ProfibusDPBox.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPMasterEClass, ProfibusDPMaster.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPSlaveEClass, ProfibusDPSlave.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(profibusDPCableEClass, ProfibusDPCable.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATBoxEClass, EtherCATBox.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATMasterEClass, EtherCATMaster.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATSlaveEClass, EtherCATSlave.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEClass(etherCATCableEClass, EtherCATCable.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); }
/** * Complete the initialization of the package and its meta-model. This * method is guarded to have no affect on any invocation but its first. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any invocation but its first.
initializePackageContents
{ "repo_name": "KAMP-Research/KAMP4APS", "path": "edu.kit.ipd.sdq.kamp4aps.aps/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/BusComponents/impl/BusComponentsPackageImpl.java", "license": "apache-2.0", "size": 22330 }
[ "edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents", "edu.kit.ipd.sdq.kamp4aps.model.aPS.ComponentRepository", "edu.kit.ipd.sdq.kamp4aps.model.aPS.InterfaceRepository", "org.eclipse.emf.ecore.EPackage" ]
import edu.kit.ipd.sdq.kamp4aps.model.aPS.BusComponents; import edu.kit.ipd.sdq.kamp4aps.model.aPS.ComponentRepository; import edu.kit.ipd.sdq.kamp4aps.model.aPS.InterfaceRepository; import org.eclipse.emf.ecore.EPackage;
import edu.kit.ipd.sdq.kamp4aps.model.*; import org.eclipse.emf.ecore.*;
[ "edu.kit.ipd", "org.eclipse.emf" ]
edu.kit.ipd; org.eclipse.emf;
2,702,126
public void paint(Graphics g) { g.translate(0, -visibleRow * getRowHeight()); super.paint(g); // Draw the Table border if we have focus. if (highlightBorder != null) { highlightBorder.paintBorder(this, g, 0, visibleRow * getRowHeight(), getWidth(), getRowHeight()); } else{ // Tree cell renderer get rid of the grid lines for some // reason so we draw them here but only if Look and Feel // is different from Java 6's Nimbus LaF // as it completely ignores the grid lines if (!UIManager.getLookAndFeel().getName().equals("Nimbus")){ LinesBorder linesBorder = new LinesBorder(getGridColor(), new Insets(0, 0, 1, 1)); linesBorder .paintBorder(this, g, 0, visibleRow * getRowHeight(), getWidth(), getRowHeight()); } } }
void function(Graphics g) { g.translate(0, -visibleRow * getRowHeight()); super.paint(g); if (highlightBorder != null) { highlightBorder.paintBorder(this, g, 0, visibleRow * getRowHeight(), getWidth(), getRowHeight()); } else{ if (!UIManager.getLookAndFeel().getName().equals(STR)){ LinesBorder linesBorder = new LinesBorder(getGridColor(), new Insets(0, 0, 1, 1)); linesBorder .paintBorder(this, g, 0, visibleRow * getRowHeight(), getWidth(), getRowHeight()); } } }
/** * Subclassed to translate the graphics such that the last visible row * will be drawn at 0,0. */
Subclassed to translate the graphics such that the last visible row will be drawn at 0,0
paint
{ "repo_name": "apache/incubator-taverna-workbench", "path": "taverna-ui/src/main/java/org/apache/taverna/lang/ui/treetable/JTreeTable.java", "license": "apache-2.0", "size": 20595 }
[ "java.awt.Graphics", "java.awt.Insets", "javax.swing.UIManager" ]
import java.awt.Graphics; import java.awt.Insets; import javax.swing.UIManager;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,085,758
public void testL1SoftRefL2() { Properties userProps = new Properties(); userProps.setProperty("datanucleus.cache.level1.type", "soft"); userProps.setProperty("datanucleus.cache.level2.type", "weak"); PersistenceManagerFactory cachePMF = TestHelper.getPMF(1, userProps); runL2CacheTestForPMF(cachePMF); }
void function() { Properties userProps = new Properties(); userProps.setProperty(STR, "soft"); userProps.setProperty(STR, "weak"); PersistenceManagerFactory cachePMF = TestHelper.getPMF(1, userProps); runL2CacheTestForPMF(cachePMF); }
/** * Basic test for L1 Cache using "SoftRefCache" and L2 cache. */
Basic test for L1 Cache using "SoftRefCache" and L2 cache
testL1SoftRefL2
{ "repo_name": "hopecee/texsts", "path": "jdo/general/src/test/org/datanucleus/tests/CacheTest.java", "license": "apache-2.0", "size": 56796 }
[ "java.util.Properties", "javax.jdo.PersistenceManagerFactory", "org.datanucleus.tests.TestHelper" ]
import java.util.Properties; import javax.jdo.PersistenceManagerFactory; import org.datanucleus.tests.TestHelper;
import java.util.*; import javax.jdo.*; import org.datanucleus.tests.*;
[ "java.util", "javax.jdo", "org.datanucleus.tests" ]
java.util; javax.jdo; org.datanucleus.tests;
2,321,198
public boolean isAudioOn() { if (DBG) log("isAudioOn()"); if (mService != null && isEnabled()) { try { return mService.isAudioOn(); } catch (RemoteException e) { Log.e(TAG, Log.getStackTraceString(new Throwable())); } } if (mService == null) Log.w(TAG, "Proxy not attached to service"); return false; }
boolean function() { if (DBG) log(STR); if (mService != null && isEnabled()) { try { return mService.isAudioOn(); } catch (RemoteException e) { Log.e(TAG, Log.getStackTraceString(new Throwable())); } } if (mService == null) Log.w(TAG, STR); return false; }
/** * Check if Bluetooth SCO audio is connected. * * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission. * * @return true if SCO is connected, * false otherwise or on error * @hide */
Check if Bluetooth SCO audio is connected. Requires <code>android.Manifest.permission#BLUETOOTH</code> permission
isAudioOn
{ "repo_name": "rex-xxx/mt6572_x201", "path": "mediatek/frameworks-ext/base/core/java/android/bluetooth/BluetoothHeadset.java", "license": "gpl-2.0", "size": 38530 }
[ "android.os.RemoteException", "android.util.Log" ]
import android.os.RemoteException; import android.util.Log;
import android.os.*; import android.util.*;
[ "android.os", "android.util" ]
android.os; android.util;
2,552,202
@SuppressWarnings("ThrowFromFinallyBlock") protected void writeToSocket(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException { assert sock != null; assert msg != null; assert out != null; SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + timeout); addTimeoutObject(obj); IgniteCheckedException err = null; try { U.marshal(marshaller(), msg, out); } catch (IgniteCheckedException e) { err = e; } finally { boolean cancelled = obj.cancel(); if (cancelled) removeTimeoutObject(obj); // Throw original exception. if (err != null) throw err; if (!cancelled) throw new SocketTimeoutException("Write timed out (socket was concurrently closed)."); } }
@SuppressWarnings(STR) void function(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException { assert sock != null; assert msg != null; assert out != null; SocketTimeoutObject obj = new SocketTimeoutObject(sock, U.currentTimeMillis() + timeout); addTimeoutObject(obj); IgniteCheckedException err = null; try { U.marshal(marshaller(), msg, out); } catch (IgniteCheckedException e) { err = e; } finally { boolean cancelled = obj.cancel(); if (cancelled) removeTimeoutObject(obj); if (err != null) throw err; if (!cancelled) throw new SocketTimeoutException(STR); } }
/** * Writes message to the socket. * * @param sock Socket. * @param out Stream to write to. * @param msg Message. * @param timeout Timeout. * @throws IOException If IO failed or write timed out. * @throws IgniteCheckedException If marshalling failed. */
Writes message to the socket
writeToSocket
{ "repo_name": "a1vanov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java", "license": "apache-2.0", "size": 76111 }
[ "java.io.IOException", "java.io.OutputStream", "java.net.Socket", "java.net.SocketTimeoutException", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.util.typedef.internal.U", "org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage" ]
import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import java.net.SocketTimeoutException; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
import java.io.*; import java.net.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.spi.discovery.tcp.messages.*;
[ "java.io", "java.net", "org.apache.ignite" ]
java.io; java.net; org.apache.ignite;
1,527,270
void scheduleUpdateNotification( boolean selectionCoordsChanged, boolean selectionLocationChanged, boolean contentChanged, boolean userDirectlyChangedContent) { // Internal editor throttling // We want special behaviour, here where we do not reset the delay every // time this method is called by rescheduling - so we first check if the // notification task is scheduled. notedSelectionCoordsChanged |= selectionCoordsChanged; notedSelectionLocationChanged |= selectionLocationChanged; notedContentChanged |= contentChanged; notedUserDirectlyChangedContent |= userDirectlyChangedContent; Scheduler scheduler = SchedulerInstance.get(); if (!scheduler.isScheduled(notificationTask)) { scheduler.scheduleRepeating(Priority.MEDIUM, notificationTask, INITIAL_NOTIFY_SCHEDULE_DELAY_MS, NOTIFY_SCHEDULE_DELAY_GAP_MS); } else { notifyAgain = true; } }
void scheduleUpdateNotification( boolean selectionCoordsChanged, boolean selectionLocationChanged, boolean contentChanged, boolean userDirectlyChangedContent) { notedSelectionCoordsChanged = selectionCoordsChanged; notedSelectionLocationChanged = selectionLocationChanged; notedContentChanged = contentChanged; notedUserDirectlyChangedContent = userDirectlyChangedContent; Scheduler scheduler = SchedulerInstance.get(); if (!scheduler.isScheduled(notificationTask)) { scheduler.scheduleRepeating(Priority.MEDIUM, notificationTask, INITIAL_NOTIFY_SCHEDULE_DELAY_MS, NOTIFY_SCHEDULE_DELAY_GAP_MS); } else { notifyAgain = true; } }
/** * Schedule the editor's update notification */
Schedule the editor's update notification
scheduleUpdateNotification
{ "repo_name": "wisebaldone/incubator-wave", "path": "wave/src/main/java/org/waveprotocol/wave/client/editor/EditorUpdateEventImpl.java", "license": "apache-2.0", "size": 8689 }
[ "org.waveprotocol.wave.client.scheduler.Scheduler", "org.waveprotocol.wave.client.scheduler.SchedulerInstance" ]
import org.waveprotocol.wave.client.scheduler.Scheduler; import org.waveprotocol.wave.client.scheduler.SchedulerInstance;
import org.waveprotocol.wave.client.scheduler.*;
[ "org.waveprotocol.wave" ]
org.waveprotocol.wave;
867,662
protected EntityManagerFactory findDefaultEntityManagerFactory(String requestingBeanName) throws NoSuchBeanDefinitionException { String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, EntityManagerFactory.class); if (beanNames.length == 1) { String unitName = beanNames[0]; EntityManagerFactory emf = (EntityManagerFactory) this.beanFactory.getBean(unitName); if (this.beanFactory instanceof ConfigurableBeanFactory) { ((ConfigurableBeanFactory) this.beanFactory).registerDependentBean(unitName, requestingBeanName); } return emf; } else if (beanNames.length > 1) { throw new NoUniqueBeanDefinitionException(EntityManagerFactory.class, beanNames); } else { throw new NoSuchBeanDefinitionException(EntityManagerFactory.class); } }
EntityManagerFactory function(String requestingBeanName) throws NoSuchBeanDefinitionException { String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.beanFactory, EntityManagerFactory.class); if (beanNames.length == 1) { String unitName = beanNames[0]; EntityManagerFactory emf = (EntityManagerFactory) this.beanFactory.getBean(unitName); if (this.beanFactory instanceof ConfigurableBeanFactory) { ((ConfigurableBeanFactory) this.beanFactory).registerDependentBean(unitName, requestingBeanName); } return emf; } else if (beanNames.length > 1) { throw new NoUniqueBeanDefinitionException(EntityManagerFactory.class, beanNames); } else { throw new NoSuchBeanDefinitionException(EntityManagerFactory.class); } }
/** * Find a single default EntityManagerFactory in the Spring application context. * @return the default EntityManagerFactory * @throws NoSuchBeanDefinitionException if there is no single EntityManagerFactory in the context */
Find a single default EntityManagerFactory in the Spring application context
findDefaultEntityManagerFactory
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java", "license": "apache-2.0", "size": 32401 }
[ "javax.persistence.EntityManagerFactory", "org.springframework.beans.factory.BeanFactoryUtils", "org.springframework.beans.factory.NoSuchBeanDefinitionException", "org.springframework.beans.factory.NoUniqueBeanDefinitionException", "org.springframework.beans.factory.config.ConfigurableBeanFactory" ]
import javax.persistence.EntityManagerFactory; import org.springframework.beans.factory.BeanFactoryUtils; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import javax.persistence.*; import org.springframework.beans.factory.*; import org.springframework.beans.factory.config.*;
[ "javax.persistence", "org.springframework.beans" ]
javax.persistence; org.springframework.beans;
2,725,166
protected String createTransaction() throws IOException { final HttpPost createTx = new HttpPost(serverAddress + "fcr:tx"); try (final CloseableHttpResponse response = execute(createTx)) { assertEquals(CREATED.getStatusCode(), getStatus(response)); return getLocation(response); } }
String function() throws IOException { final HttpPost createTx = new HttpPost(serverAddress + STR); try (final CloseableHttpResponse response = execute(createTx)) { assertEquals(CREATED.getStatusCode(), getStatus(response)); return getLocation(response); } }
/** * Creates a transaction, asserts that it's successful and returns the transaction location. * * @return string containing transaction location * @throws IOException exception thrown during the function */
Creates a transaction, asserts that it's successful and returns the transaction location
createTransaction
{ "repo_name": "lsitu/fcrepo4", "path": "fcrepo-http-api/src/test/java/org/fcrepo/integration/http/api/AbstractResourceIT.java", "license": "apache-2.0", "size": 25342 }
[ "java.io.IOException", "javax.ws.rs.core.Response", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpPost", "org.junit.Assert" ]
import java.io.IOException; import javax.ws.rs.core.Response; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.junit.Assert;
import java.io.*; import javax.ws.rs.core.*; import org.apache.http.client.methods.*; import org.junit.*;
[ "java.io", "javax.ws", "org.apache.http", "org.junit" ]
java.io; javax.ws; org.apache.http; org.junit;
2,062,444
private void overrideDependencyMgtsWithImported(DescriptorParseContext parseContext, PomReader pomReader) throws IOException, SAXException { Map<MavenDependencyKey, PomDependencyMgt> importedDependencyMgts = parseImportedDependencyMgts(parseContext, pomReader.parseDependencyMgt()); pomReader.addImportedDependencyMgts(importedDependencyMgts); }
void function(DescriptorParseContext parseContext, PomReader pomReader) throws IOException, SAXException { Map<MavenDependencyKey, PomDependencyMgt> importedDependencyMgts = parseImportedDependencyMgts(parseContext, pomReader.parseDependencyMgt()); pomReader.addImportedDependencyMgts(importedDependencyMgts); }
/** * Overrides existing dependency management information with imported ones if existing. * * @param parseContext Parse context * @param pomReader POM reader * @throws IOException * @throws SAXException */
Overrides existing dependency management information with imported ones if existing
overrideDependencyMgtsWithImported
{ "repo_name": "tkmnet/RCRS-ADF", "path": "gradle/gradle-2.1/src/core-impl/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/parser/GradlePomModuleDescriptorParser.java", "license": "bsd-2-clause", "size": 10177 }
[ "java.io.IOException", "java.util.Map", "org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey", "org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.util.Map; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt; import org.xml.sax.SAXException;
import java.io.*; import java.util.*; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.*; import org.xml.sax.*;
[ "java.io", "java.util", "org.gradle.api", "org.xml.sax" ]
java.io; java.util; org.gradle.api; org.xml.sax;
2,321,981
public ScruTable backfollowFrom(Heaper value) { throw new UnimplementedException(); }
ScruTable function(Heaper value) { throw new UnimplementedException(); }
/** * Return the subTable with the domain of all positions whose values are equal to * value. Defined by analogy with corresponding Waldo-level operation. */
Return the subTable with the domain of all positions whose values are equal to value. Defined by analogy with corresponding Waldo-level operation
backfollowFrom
{ "repo_name": "jonesd/udanax-gold2java", "path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/collection/tables/ScruTable.java", "license": "mit", "size": 30731 }
[ "info.dgjones.abora.gold.collection.tables.ScruTable", "info.dgjones.abora.gold.java.exception.UnimplementedException", "info.dgjones.abora.gold.xpp.basic.Heaper" ]
import info.dgjones.abora.gold.collection.tables.ScruTable; import info.dgjones.abora.gold.java.exception.UnimplementedException; import info.dgjones.abora.gold.xpp.basic.Heaper;
import info.dgjones.abora.gold.collection.tables.*; import info.dgjones.abora.gold.java.exception.*; import info.dgjones.abora.gold.xpp.basic.*;
[ "info.dgjones.abora" ]
info.dgjones.abora;
1,195,369
public static void addMessageIntoList(List<Message> messageList, Message message) { if (message != null) { messageList.add(message); } }
static void function(List<Message> messageList, Message message) { if (message != null) { messageList.add(message); } }
/** * add the given message into the given message list * * @param messageList the given message list * @param message the given message */
add the given message into the given message list
addMessageIntoList
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/sys/MessageBuilder.java", "license": "apache-2.0", "size": 5425 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,252,658
public int getSystemVCSTimeout() { return getSystemPropertyValue(SystemProperty.DEFAULT_VCS_TIMEOUT, 120); }
int function() { return getSystemPropertyValue(SystemProperty.DEFAULT_VCS_TIMEOUT, 120); }
/** * VCS command timeout. */
VCS command timeout
getSystemVCSTimeout
{ "repo_name": "simeshev/parabuild-ci", "path": "src/org/parabuild/ci/configuration/SystemConfigurationManagerImpl.java", "license": "lgpl-3.0", "size": 32865 }
[ "org.parabuild.ci.object.SystemProperty" ]
import org.parabuild.ci.object.SystemProperty;
import org.parabuild.ci.object.*;
[ "org.parabuild.ci" ]
org.parabuild.ci;
1,781,879
protected void requestLoginDetails() { LogInDialogFragment dlg = new LogInDialogFragment(); dlg.show(getSupportFragmentManager(), "login"); }
void function() { LogInDialogFragment dlg = new LogInDialogFragment(); dlg.show(getSupportFragmentManager(), "login"); }
/** * Opens the login dialog * The dialog handles sending the intent around post-login */
Opens the login dialog The dialog handles sending the intent around post-login
requestLoginDetails
{ "repo_name": "richsage/Joind.in-android-app", "path": "source/src/in/joind/activity/SettingsActivity.java", "license": "bsd-3-clause", "size": 4791 }
[ "in.joind.fragment.LogInDialogFragment" ]
import in.joind.fragment.LogInDialogFragment;
import in.joind.fragment.*;
[ "in.joind.fragment" ]
in.joind.fragment;
1,059,723
EList<IfcRelContainedInSpatialStructure> getContainedInStructure();
EList<IfcRelContainedInSpatialStructure> getContainedInStructure();
/** * Returns the value of the '<em><b>Contained In Structure</b></em>' reference list. * The list contents are of type {@link cn.dlb.bim.models.ifc2x3tc1.IfcRelContainedInSpatialStructure}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Contained In Structure</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Contained In Structure</em>' reference list. * @see #isSetContainedInStructure() * @see #unsetContainedInStructure() * @see cn.dlb.bim.models.ifc2x3tc1.Ifc2x3tc1Package#getIfcGrid_ContainedInStructure() * @model unsettable="true" upper="2" * @generated */
Returns the value of the 'Contained In Structure' reference list. The list contents are of type <code>cn.dlb.bim.models.ifc2x3tc1.IfcRelContainedInSpatialStructure</code>. If the meaning of the 'Contained In Structure' reference list isn't clear, there really should be more of a description here...
getContainedInStructure
{ "repo_name": "shenan4321/BIMplatform", "path": "generated/cn/dlb/bim/models/ifc2x3tc1/IfcGrid.java", "license": "agpl-3.0", "size": 6039 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,785,405
@VisibleForTesting static ContactDeletionInteraction startWithTestLoaderManager( Activity activity, Uri contactUri, boolean finishActivityWhenDone, TestLoaderManager testLoaderManager) { if (contactUri == null) { return null; } FragmentManager fragmentManager = activity.getFragmentManager(); ContactDeletionInteraction fragment = (ContactDeletionInteraction) fragmentManager.findFragmentByTag(FRAGMENT_TAG); if (fragment == null) { fragment = new ContactDeletionInteraction(); fragment.setTestLoaderManager(testLoaderManager); fragment.setContactUri(contactUri); fragment.setFinishActivityWhenDone(finishActivityWhenDone); fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG) .commitAllowingStateLoss(); } else { fragment.setTestLoaderManager(testLoaderManager); fragment.setContactUri(contactUri); fragment.setFinishActivityWhenDone(finishActivityWhenDone); } return fragment; }
static ContactDeletionInteraction startWithTestLoaderManager( Activity activity, Uri contactUri, boolean finishActivityWhenDone, TestLoaderManager testLoaderManager) { if (contactUri == null) { return null; } FragmentManager fragmentManager = activity.getFragmentManager(); ContactDeletionInteraction fragment = (ContactDeletionInteraction) fragmentManager.findFragmentByTag(FRAGMENT_TAG); if (fragment == null) { fragment = new ContactDeletionInteraction(); fragment.setTestLoaderManager(testLoaderManager); fragment.setContactUri(contactUri); fragment.setFinishActivityWhenDone(finishActivityWhenDone); fragmentManager.beginTransaction().add(fragment, FRAGMENT_TAG) .commitAllowingStateLoss(); } else { fragment.setTestLoaderManager(testLoaderManager); fragment.setContactUri(contactUri); fragment.setFinishActivityWhenDone(finishActivityWhenDone); } return fragment; }
/** * Starts the interaction and optionally set up a {@link TestLoaderManager}. * * @param activity the activity within which to start the interaction * @param contactUri the URI of the contact to delete * @param finishActivityWhenDone whether to finish the activity upon completion of the * interaction * @param testLoaderManager the {@link TestLoaderManager} to use to load the data, may be null * in which case the default {@link LoaderManager} is used * @return the newly created interaction */
Starts the interaction and optionally set up a <code>TestLoaderManager</code>
startWithTestLoaderManager
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/Contacts/src/com/android/contacts/interactions/ContactDeletionInteraction.java", "license": "gpl-3.0", "size": 12063 }
[ "android.app.Activity", "android.app.FragmentManager", "android.net.Uri" ]
import android.app.Activity; import android.app.FragmentManager; import android.net.Uri;
import android.app.*; import android.net.*;
[ "android.app", "android.net" ]
android.app; android.net;
2,478,011
public JoinFragment createOuterJoinFragment() { return new OracleJoinFragment(); } /** * {@inheritDoc}
JoinFragment function() { return new OracleJoinFragment(); } /** * {@inheritDoc}
/** * Support for the oracle proprietary join syntax... * * @return The orqacle join fragment */
Support for the oracle proprietary join syntax..
createOuterJoinFragment
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/hibernate-distribution-3.6.10.Final/project/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java", "license": "unlicense", "size": 17656 }
[ "org.hibernate.sql.JoinFragment", "org.hibernate.sql.OracleJoinFragment" ]
import org.hibernate.sql.JoinFragment; import org.hibernate.sql.OracleJoinFragment;
import org.hibernate.sql.*;
[ "org.hibernate.sql" ]
org.hibernate.sql;
81,419
public RexLiteral makeExactLiteral(BigDecimal bd) { RelDataType relType; int scale = bd.scale(); long l = bd.unscaledValue().longValue(); assert scale >= 0; assert scale <= typeFactory.getTypeSystem().getMaxNumericScale() : scale; assert BigDecimal.valueOf(l, scale).equals(bd); if (scale == 0) { if ((l >= Integer.MIN_VALUE) && (l <= Integer.MAX_VALUE)) { relType = typeFactory.createSqlType(SqlTypeName.INTEGER); } else { relType = typeFactory.createSqlType(SqlTypeName.BIGINT); } } else { int precision = bd.unscaledValue().abs().toString().length(); relType = typeFactory.createSqlType(SqlTypeName.DECIMAL, precision, scale); } return makeExactLiteral(bd, relType); }
RexLiteral function(BigDecimal bd) { RelDataType relType; int scale = bd.scale(); long l = bd.unscaledValue().longValue(); assert scale >= 0; assert scale <= typeFactory.getTypeSystem().getMaxNumericScale() : scale; assert BigDecimal.valueOf(l, scale).equals(bd); if (scale == 0) { if ((l >= Integer.MIN_VALUE) && (l <= Integer.MAX_VALUE)) { relType = typeFactory.createSqlType(SqlTypeName.INTEGER); } else { relType = typeFactory.createSqlType(SqlTypeName.BIGINT); } } else { int precision = bd.unscaledValue().abs().toString().length(); relType = typeFactory.createSqlType(SqlTypeName.DECIMAL, precision, scale); } return makeExactLiteral(bd, relType); }
/** * Creates a numeric literal. */
Creates a numeric literal
makeExactLiteral
{ "repo_name": "YrAuYong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/rex/RexBuilder.java", "license": "apache-2.0", "size": 43815 }
[ "java.math.BigDecimal", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.sql.type.SqlTypeName" ]
import java.math.BigDecimal; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.type.SqlTypeName;
import java.math.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.type.*;
[ "java.math", "org.apache.calcite" ]
java.math; org.apache.calcite;
2,224,723
AddressQuery addressQuery(SimpleString address) throws ActiveMQException; // Transaction operations ----------------------------------------
AddressQuery addressQuery(SimpleString address) throws ActiveMQException;
/** * Queries information on a binding. * * @param address the address of the biding to query * @return an AddressQuery containing information on the binding attached to the given address * @throws ActiveMQException if an exception occurs while querying the binding */
Queries information on a binding
addressQuery
{ "repo_name": "willr3/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java", "license": "apache-2.0", "size": 41343 }
[ "org.apache.activemq.artemis.api.core.ActiveMQException", "org.apache.activemq.artemis.api.core.SimpleString" ]
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.*;
[ "org.apache.activemq" ]
org.apache.activemq;
1,943,115
Document post() throws IOException;
Document post() throws IOException;
/** * Execute the request as a POST, and parse the result. * @return parsed Document * @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed * @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored * @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored * @throws java.net.SocketTimeoutException if the connection times out * @throws IOException on error */
Execute the request as a POST, and parse the result
post
{ "repo_name": "jhy/jsoup", "path": "src/main/java/org/jsoup/Connection.java", "license": "mit", "size": 31086 }
[ "java.io.IOException", "org.jsoup.nodes.Document" ]
import java.io.IOException; import org.jsoup.nodes.Document;
import java.io.*; import org.jsoup.nodes.*;
[ "java.io", "org.jsoup.nodes" ]
java.io; org.jsoup.nodes;
2,190,491
EList<Receipt> getReceipts();
EList<Receipt> getReceipts();
/** * Returns the value of the '<em><b>Receipts</b></em>' reference list. * The list contents are of type {@link CIM.IEC61968.PaymentMetering.Receipt}. * It is bidirectional and its opposite is '{@link CIM.IEC61968.PaymentMetering.Receipt#getVendorShift <em>Vendor Shift</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Receipts</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Receipts</em>' reference list. * @see CIM.IEC61968.PaymentMetering.PaymentMeteringPackage#getVendorShift_Receipts() * @see CIM.IEC61968.PaymentMetering.Receipt#getVendorShift * @model opposite="VendorShift" * @generated */
Returns the value of the 'Receipts' reference list. The list contents are of type <code>CIM.IEC61968.PaymentMetering.Receipt</code>. It is bidirectional and its opposite is '<code>CIM.IEC61968.PaymentMetering.Receipt#getVendorShift Vendor Shift</code>'. If the meaning of the 'Receipts' reference list isn't clear, there really should be more of a description here...
getReceipts
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61968/PaymentMetering/VendorShift.java", "license": "mit", "size": 9759 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,494,869
private MediaInfo toVideo(File input, MediaInfo mediaInfo, File outputPath, int codec) { StopWatch sw = new StopWatch(); sw.start(); String ffmpeg = mediaConverter.getFfmpeg(); StringBuilder command = new StringBuilder(ffmpeg); command.append(" "); command.append("-i "); command.append(input.getAbsolutePath()); command.append(" "); command.append(CODEC[codec]); command.append(" "); // video parameters here // video rate // command.append("-vb 500k "); // set title //command.append("-title \"title here\" "); //command.append("-author \"HEDC edmedia\" "); //command.append("-copyright \"HEDC edmedia\" "); // audio parameters here //** // command.append("-acodec libmp3lame "); // options for audio // flv only supports sample rate from (44100, 22050, 11025) if (codec == FLASH_MOVIE_CODEC) { if (mediaInfo.getAudio() != null) { if (mediaInfo.getAudio().getFreq() >= 44100) command.append("-ar 44100 "); else if (mediaInfo.getAudio().getFreq() >= 22050) command.append("-ar 22050 "); else command.append("-ar 11025 "); } } audioSetup(command, mediaInfo, true); String filename = "movie"; if (input.getName().contains(filename)) filename = "video"; if (codec == H_264_CODEC) filename += ".mp4"; else if (codec == FLASH_MOVIE_CODEC) filename += ".flv"; File output = new File(outputPath, filename); command.append(output.getAbsolutePath()); CommandReturn commandReturn = CommandRunner.run(command.toString()); // check commandReturn exit status //if(commandReturn.exitStatus) log.debug("{}", commandReturn); sw.stop(); log.info("convert run time {}", sw); log.debug("Original file size: {} generated file size: {} 100:{}", new Object[]{input.length(), output.length(), (output.length() * 100 / input.length())}); if (output.exists() && (output.length() > 0)) { mediaInfo.setFilename(filename); // only run qt-faststart when using H.264 codec if (codec == H_264_CODEC) { mediaInfo = qtFaststart(mediaInfo, outputPath, filename); } } return mediaInfo; }
MediaInfo function(File input, MediaInfo mediaInfo, File outputPath, int codec) { StopWatch sw = new StopWatch(); sw.start(); String ffmpeg = mediaConverter.getFfmpeg(); StringBuilder command = new StringBuilder(ffmpeg); command.append(" "); command.append(STR); command.append(input.getAbsolutePath()); command.append(" "); command.append(CODEC[codec]); command.append(" "); if (codec == FLASH_MOVIE_CODEC) { if (mediaInfo.getAudio() != null) { if (mediaInfo.getAudio().getFreq() >= 44100) command.append(STR); else if (mediaInfo.getAudio().getFreq() >= 22050) command.append(STR); else command.append(STR); } } audioSetup(command, mediaInfo, true); String filename = "movie"; if (input.getName().contains(filename)) filename = "video"; if (codec == H_264_CODEC) filename += ".mp4"; else if (codec == FLASH_MOVIE_CODEC) filename += ".flv"; File output = new File(outputPath, filename); command.append(output.getAbsolutePath()); CommandReturn commandReturn = CommandRunner.run(command.toString()); log.debug("{}", commandReturn); sw.stop(); log.info(STR, sw); log.debug(STR, new Object[]{input.length(), output.length(), (output.length() * 100 / input.length())}); if (output.exists() && (output.length() > 0)) { mediaInfo.setFilename(filename); if (codec == H_264_CODEC) { mediaInfo = qtFaststart(mediaInfo, outputPath, filename); } } return mediaInfo; }
/** * Converts input file to Flash Video or H.264 Video. * * @param input input file * @param mediaInfo mediaInfo object * @param outputPath output path * @param codec which codec to use, Flash Movie or H.264 Movie * @return returns mediaInfo object */
Converts input file to Flash Video or H.264 Video
toVideo
{ "repo_name": "edmedia/unitube", "path": "src/main/java/nz/ac/otago/edmedia/media/converter/FFmpegConverter.java", "license": "gpl-3.0", "size": 21713 }
[ "java.io.File", "nz.ac.otago.edmedia.media.bean.MediaInfo", "nz.ac.otago.edmedia.util.CommandReturn", "nz.ac.otago.edmedia.util.CommandRunner", "org.apache.commons.lang.time.StopWatch" ]
import java.io.File; import nz.ac.otago.edmedia.media.bean.MediaInfo; import nz.ac.otago.edmedia.util.CommandReturn; import nz.ac.otago.edmedia.util.CommandRunner; import org.apache.commons.lang.time.StopWatch;
import java.io.*; import nz.ac.otago.edmedia.media.bean.*; import nz.ac.otago.edmedia.util.*; import org.apache.commons.lang.time.*;
[ "java.io", "nz.ac.otago", "org.apache.commons" ]
java.io; nz.ac.otago; org.apache.commons;
2,178,057
public Object get(String name) throws ClassifierNotFoundException { // Search in model Object mClassifier = Model.getFacade().lookupIn(mPackage, name); if (mClassifier == null) { Class classifier; // Try to find it via the classpath try { // Special case for model if (Model.getFacade().isAModel(mPackage)) { classifier = Class.forName(name); } else { String clazzName = javaName + "." + name; classifier = Class.forName(clazzName); } if (classifier.isInterface()) { mClassifier = Model.getCoreFactory() .buildInterface(name, mPackage); } else { mClassifier = Model.getCoreFactory() .buildClass(name, mPackage); } Model.getCoreHelper().setTaggedValue(mClassifier, Facade.GENERATED_TAG, "yes"); } catch (ClassNotFoundException e) { // No class or interface found // try USER classpath try { // Special case for model if (Model.getFacade().isAModel(mPackage)) { classifier = ImportClassLoader.getInstance().loadClass(name); } else { String clazzName = javaName + "." + name; classifier = ImportClassLoader.getInstance() .loadClass(clazzName); } if (classifier.isInterface()) { mClassifier = Model.getCoreFactory() .buildInterface(name, mPackage); } else { mClassifier = Model.getCoreFactory() .buildClass(name, mPackage); } Model.getCoreHelper().setTaggedValue(mClassifier, Facade.GENERATED_TAG, "yes"); } catch (Exception e1) { // Ignore } } } if (mClassifier == null) { // Continue the search through the rest of the model if (getContext() != null) { mClassifier = getContext().get(name); } else { // Check for java data types if (name.equals("int") || name.equals("long") || name.equals("short") || name.equals("byte") || name.equals("char") || name.equals("float") || name.equals("double") || name.equals("boolean") || name.equals("void") // How do I represent arrays in UML? || name.indexOf("[]") != -1) { mClassifier = Model.getCoreFactory() .buildDataType(name, mPackage); } } } if (mClassifier == null) { throw new ClassifierNotFoundException(name); } return mClassifier; }
Object function(String name) throws ClassifierNotFoundException { Object mClassifier = Model.getFacade().lookupIn(mPackage, name); if (mClassifier == null) { Class classifier; try { if (Model.getFacade().isAModel(mPackage)) { classifier = Class.forName(name); } else { String clazzName = javaName + "." + name; classifier = Class.forName(clazzName); } if (classifier.isInterface()) { mClassifier = Model.getCoreFactory() .buildInterface(name, mPackage); } else { mClassifier = Model.getCoreFactory() .buildClass(name, mPackage); } Model.getCoreHelper().setTaggedValue(mClassifier, Facade.GENERATED_TAG, "yes"); } catch (ClassNotFoundException e) { try { if (Model.getFacade().isAModel(mPackage)) { classifier = ImportClassLoader.getInstance().loadClass(name); } else { String clazzName = javaName + "." + name; classifier = ImportClassLoader.getInstance() .loadClass(clazzName); } if (classifier.isInterface()) { mClassifier = Model.getCoreFactory() .buildInterface(name, mPackage); } else { mClassifier = Model.getCoreFactory() .buildClass(name, mPackage); } Model.getCoreHelper().setTaggedValue(mClassifier, Facade.GENERATED_TAG, "yes"); } catch (Exception e1) { } } } if (mClassifier == null) { if (getContext() != null) { mClassifier = getContext().get(name); } else { if (name.equals("int") name.equals("long") name.equals("short") name.equals("byte") name.equals("char") name.equals("float") name.equals(STR) name.equals(STR) name.equals("void") name.indexOf("[]") != -1) { mClassifier = Model.getCoreFactory() .buildDataType(name, mPackage); } } } if (mClassifier == null) { throw new ClassifierNotFoundException(name); } return mClassifier; }
/** * Get a classifier from the model. If it is not in the model, try * to find it with the CLASSPATH. If found, in the classpath, the * classifier is created and added to the model. If not found at * all, a datatype is created and added to the model. * * @param name The name of the classifier to find. * @return Found classifier. */
Get a classifier from the model. If it is not in the model, try to find it with the CLASSPATH. If found, in the classpath, the classifier is created and added to the model. If not found at all, a datatype is created and added to the model
get
{ "repo_name": "carvalhomb/tsmells", "path": "sample/argouml/argouml/org/argouml/uml/reveng/java/PackageContext.java", "license": "gpl-2.0", "size": 7299 }
[ "org.argouml.model.Facade", "org.argouml.model.Model", "org.argouml.uml.reveng.ImportClassLoader" ]
import org.argouml.model.Facade; import org.argouml.model.Model; import org.argouml.uml.reveng.ImportClassLoader;
import org.argouml.model.*; import org.argouml.uml.reveng.*;
[ "org.argouml.model", "org.argouml.uml" ]
org.argouml.model; org.argouml.uml;
2,452,881
public void testDoesUserAccountExist() { List<UserAccount> users = userAccMgr.getAuthenticatedUsers(); assertNull("There should be no authenticated users", users); createTestAccount(); users = userAccMgr.getAuthenticatedUsers(); assertEquals("There should be 1 authenticated user", 1, users.size()); UserAccount userAcc = new UserAccount(ClientManagerTest.TEST_AUTH_TOKEN, ClientManagerTest.TEST_REFRESH_TOKEN, ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_IDENTITY_URL, ClientManagerTest.TEST_INSTANCE_URL, ClientManagerTest.TEST_ORG_ID, ClientManagerTest.TEST_USER_ID, ClientManagerTest.TEST_USERNAME, ClientManagerTest.TEST_ACCOUNT_NAME, ClientManagerTest.TEST_CLIENT_ID, null, null); assertTrue("User account should exist", userAccMgr.doesUserAccountExist(userAcc)); userAcc = new UserAccount(ClientManagerTest.TEST_AUTH_TOKEN, ClientManagerTest.TEST_REFRESH_TOKEN, ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_IDENTITY_URL, ClientManagerTest.TEST_INSTANCE_URL, ClientManagerTest.TEST_ORG_ID_2, ClientManagerTest.TEST_USER_ID_2, ClientManagerTest.TEST_OTHER_USERNAME, ClientManagerTest.TEST_OTHER_ACCOUNT_NAME, ClientManagerTest.TEST_CLIENT_ID, null, null); assertFalse("User account should not exist", userAccMgr.doesUserAccountExist(userAcc)); }
void function() { List<UserAccount> users = userAccMgr.getAuthenticatedUsers(); assertNull(STR, users); createTestAccount(); users = userAccMgr.getAuthenticatedUsers(); assertEquals(STR, 1, users.size()); UserAccount userAcc = new UserAccount(ClientManagerTest.TEST_AUTH_TOKEN, ClientManagerTest.TEST_REFRESH_TOKEN, ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_IDENTITY_URL, ClientManagerTest.TEST_INSTANCE_URL, ClientManagerTest.TEST_ORG_ID, ClientManagerTest.TEST_USER_ID, ClientManagerTest.TEST_USERNAME, ClientManagerTest.TEST_ACCOUNT_NAME, ClientManagerTest.TEST_CLIENT_ID, null, null); assertTrue(STR, userAccMgr.doesUserAccountExist(userAcc)); userAcc = new UserAccount(ClientManagerTest.TEST_AUTH_TOKEN, ClientManagerTest.TEST_REFRESH_TOKEN, ClientManagerTest.TEST_LOGIN_URL, ClientManagerTest.TEST_IDENTITY_URL, ClientManagerTest.TEST_INSTANCE_URL, ClientManagerTest.TEST_ORG_ID_2, ClientManagerTest.TEST_USER_ID_2, ClientManagerTest.TEST_OTHER_USERNAME, ClientManagerTest.TEST_OTHER_ACCOUNT_NAME, ClientManagerTest.TEST_CLIENT_ID, null, null); assertFalse(STR, userAccMgr.doesUserAccountExist(userAcc)); }
/** * Test to check if a user account exists. */
Test to check if a user account exists
testDoesUserAccountExist
{ "repo_name": "seethaa/force_analytics_example", "path": "native/test/SalesforceSDKTest/src/com/salesforce/androidsdk/accounts/UserAccountManagerTest.java", "license": "apache-2.0", "size": 11576 }
[ "com.salesforce.androidsdk.rest.ClientManagerTest", "java.util.List" ]
import com.salesforce.androidsdk.rest.ClientManagerTest; import java.util.List;
import com.salesforce.androidsdk.rest.*; import java.util.*;
[ "com.salesforce.androidsdk", "java.util" ]
com.salesforce.androidsdk; java.util;
970,884
@Override public void undo() { final byte mRID = DrawingActivityMulti.getMyRID(); if (D) { Log.d(tag, "---- undo --------------------" +"\n- my rID: "+mRID +"\n--- all paths in reverse order:"); synchronized (DrawingActivity.path) { for (int i = DrawingActivity.path.size() - 1; i >= 0; i--) { DrawingPath dp = DrawingActivity.path.get(i); if(D){Log.d(tag+"-loop:all", "-- Path" +"\n- path ID: "+dp.getPID() +"\n- path rID: "+(byte) ((dp.getPID() & 0xF000) >>> 12));} } } } if (D) Log.d(tag, "--- searching all saved paths..."); synchronized (DrawingActivity.path) { for (int i = DrawingActivity.path.size() - 1; i >= 0; i--) { final short pID = DrawingActivity.path.get(i).getPID(); final byte rID = (byte) ((pID & 0xF000) >>> 12); if (D) Log.d(tag+"-loop:delete", "-- compare path:" +"\n- path ID: "+pID +"\n- path rID: "+rID); if (rID == mRID) { if (D) Log.d(tag+"-loop:delete", "-- found path"); undo(i); DrawingActivityMulti.sendMessage(new MessagePacket(pID)); break; } } } }
void function() { final byte mRID = DrawingActivityMulti.getMyRID(); if (D) { Log.d(tag, STR +STR+mRID +STR); synchronized (DrawingActivity.path) { for (int i = DrawingActivity.path.size() - 1; i >= 0; i--) { DrawingPath dp = DrawingActivity.path.get(i); if(D){Log.d(tag+STR, STR +STR+dp.getPID() +STR+(byte) ((dp.getPID() & 0xF000) >>> 12));} } } } if (D) Log.d(tag, STR); synchronized (DrawingActivity.path) { for (int i = DrawingActivity.path.size() - 1; i >= 0; i--) { final short pID = DrawingActivity.path.get(i).getPID(); final byte rID = (byte) ((pID & 0xF000) >>> 12); if (D) Log.d(tag+STR, STR +STR+pID +STR+rID); if (rID == mRID) { if (D) Log.d(tag+STR, STR); undo(i); DrawingActivityMulti.sendMessage(new MessagePacket(pID)); break; } } } }
/** * Removes the latest path this user has drawn and notifies * others of its' removal. */
Removes the latest path this user has drawn and notifies others of its' removal
undo
{ "repo_name": "BoEmma/netpaint", "path": "src/com/kandidat/rityta/multi/DrawingViewMulti.java", "license": "apache-2.0", "size": 9417 }
[ "android.util.Log", "com.kandidat.rityta.DrawingActivity", "com.kandidat.rityta.DrawingPath" ]
import android.util.Log; import com.kandidat.rityta.DrawingActivity; import com.kandidat.rityta.DrawingPath;
import android.util.*; import com.kandidat.rityta.*;
[ "android.util", "com.kandidat.rityta" ]
android.util; com.kandidat.rityta;
1,715,798
public static void setSessionAttribute(HttpServletRequest request, String name, Object value) { Assert.notNull(request, "Request must not be null"); if (value != null) { request.getSession().setAttribute(name, value); } else { HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute(name); } } }
static void function(HttpServletRequest request, String name, Object value) { Assert.notNull(request, STR); if (value != null) { request.getSession().setAttribute(name, value); } else { HttpSession session = request.getSession(false); if (session != null) { session.removeAttribute(name); } } }
/** * Set the session attribute with the given name to the given value. * Removes the session attribute if value is null, if a session existed at all. * Does not create a new session if not necessary! * @param request current HTTP request * @param name the name of the session attribute * @param value the value of the session attribute */
Set the session attribute with the given name to the given value. Removes the session attribute if value is null, if a session existed at all. Does not create a new session if not necessary
setSessionAttribute
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.web/org/springframework/web/util/WebUtils.java", "license": "mit", "size": 29940 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpSession", "org.springframework.util.Assert" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.util.Assert;
import javax.servlet.http.*; import org.springframework.util.*;
[ "javax.servlet", "org.springframework.util" ]
javax.servlet; org.springframework.util;
1,489,895
public DateTimeFormatterBuilder appendMonthOfYear(int minDigits) { return appendDecimal(DateTimeFieldType.monthOfYear(), minDigits, 2); }
DateTimeFormatterBuilder function(int minDigits) { return appendDecimal(DateTimeFieldType.monthOfYear(), minDigits, 2); }
/** * Instructs the printer to emit a numeric monthOfYear field. * * @param minDigits minimum number of digits to print * @return this DateTimeFormatterBuilder, for chaining */
Instructs the printer to emit a numeric monthOfYear field
appendMonthOfYear
{ "repo_name": "maqarg/joda-time", "path": "src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java", "license": "apache-2.0", "size": 104430 }
[ "org.joda.time.DateTimeFieldType" ]
import org.joda.time.DateTimeFieldType;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,077,688
private Map<Thermostat, SortedMap<Period, ZoneStatus>> renderSchedule1() { final Map<Thermostat, SortedMap<Period, ZoneStatus>> result = new TreeMap<Thermostat, SortedMap<Period, ZoneStatus>>(); Thermostat t = new NullThermostat("thermostat"); Period pNight = new Period("night", "0:00", "9:00", "......."); ZoneStatus zsNight = new ZoneStatusImpl(25.0, 0, true, true); Period pMorning = new Period("morning", "8:00", "10:00", "......."); ZoneStatus zsMorning = new ZoneStatusImpl(24.5, 0, true, true); Period pDay = new Period("day", "9:00", "21:00", "......."); ZoneStatus zsDay = new ZoneStatusImpl(30, 0, true, true); Period pEvening = new Period("evening", "18:00", "23:59", "......."); ZoneStatus zsEvening = new ZoneStatusImpl(24.8, 0, true, true); SortedMap<Period, ZoneStatus> periods = new TreeMap<Period, ZoneStatus>(); periods.put(pNight, zsNight); periods.put(pMorning, zsMorning); periods.put(pDay, zsDay); periods.put(pEvening, zsEvening); result.put(t, periods); return result; }
Map<Thermostat, SortedMap<Period, ZoneStatus>> function() { final Map<Thermostat, SortedMap<Period, ZoneStatus>> result = new TreeMap<Thermostat, SortedMap<Period, ZoneStatus>>(); Thermostat t = new NullThermostat(STR); Period pNight = new Period("night", "0:00", "9:00", STR); ZoneStatus zsNight = new ZoneStatusImpl(25.0, 0, true, true); Period pMorning = new Period(STR, "8:00", "10:00", STR); ZoneStatus zsMorning = new ZoneStatusImpl(24.5, 0, true, true); Period pDay = new Period("day", "9:00", "21:00", STR); ZoneStatus zsDay = new ZoneStatusImpl(30, 0, true, true); Period pEvening = new Period(STR, "18:00", "23:59", STR); ZoneStatus zsEvening = new ZoneStatusImpl(24.8, 0, true, true); SortedMap<Period, ZoneStatus> periods = new TreeMap<Period, ZoneStatus>(); periods.put(pNight, zsNight); periods.put(pMorning, zsMorning); periods.put(pDay, zsDay); periods.put(pEvening, zsEvening); result.put(t, periods); return result; }
/** * Render the schedule with overlapping periods as follows: * * Night: midnight to 9:00 * Morning: 8:00 to 10:00 * Day: 9:00 to 21:00 * Evening: 18:00 to 23:59 */
Render the schedule with overlapping periods as follows: Night: midnight to 9:00 Morning: 8:00 to 10:00 Day: 9:00 to 21:00 Evening: 18:00 to 23:59
renderSchedule1
{ "repo_name": "marcass/dz-1", "path": "dz3-scheduler/src/test/java/net/sf/dz3/scheduler/SchedulerTest.java", "license": "gpl-3.0", "size": 34004 }
[ "java.util.Map", "java.util.SortedMap", "java.util.TreeMap", "net.sf.dz3.device.model.Thermostat", "net.sf.dz3.device.model.ZoneStatus", "net.sf.dz3.device.model.impl.ZoneStatusImpl" ]
import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; import net.sf.dz3.device.model.Thermostat; import net.sf.dz3.device.model.ZoneStatus; import net.sf.dz3.device.model.impl.ZoneStatusImpl;
import java.util.*; import net.sf.dz3.device.model.*; import net.sf.dz3.device.model.impl.*;
[ "java.util", "net.sf.dz3" ]
java.util; net.sf.dz3;
183,743
@Override public void flushGraphics(Rectangle region) { }
void function(Rectangle region) { }
/** * Does nothing. * * @see GraphicsSource#flushGraphics(Rectangle) */
Does nothing
flushGraphics
{ "repo_name": "archimatetool/archi", "path": "org.eclipse.draw2d/src/org/eclipse/draw2d/NativeGraphicsSource.java", "license": "mit", "size": 2338 }
[ "org.eclipse.draw2d.geometry.Rectangle" ]
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.geometry.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
1,273,325
public static ErrorMessageFactory shouldNotBeEmpty(Path actual) { return new ShouldNotBeEmpty("%nExpecting path <%s> not to be empty", actual); } private ShouldNotBeEmpty(String format, Object... arguments) { super(format, arguments); }
static ErrorMessageFactory function(Path actual) { return new ShouldNotBeEmpty(STR, actual); } private ShouldNotBeEmpty(String format, Object... arguments) { super(format, arguments); }
/** * Creates a new <code>{@link ShouldNotBeEmpty}</code>. * @param actual the actual path in the failed assertion. * @return the created {@code ErrorMessageFactory}. */
Creates a new <code><code>ShouldNotBeEmpty</code></code>
shouldNotBeEmpty
{ "repo_name": "joel-costigliola/assertj-core", "path": "src/main/java/org/assertj/core/error/ShouldNotBeEmpty.java", "license": "apache-2.0", "size": 2085 }
[ "java.nio.file.Path" ]
import java.nio.file.Path;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
2,778,909
public ArrayList<Note> heartbeat() { //account for recording never stopping if(counter == Integer.MAX_VALUE - 1) { endRecording(); return null; } //Advance counter if sequence is playing or recording if(status == MonomeUp.PLAYING || status == MonomeUp.RECORDING || status == MonomeUp.CUEDSTOP) counter ++; //Send note if isPlaying and there is an event at the current count if(status == MonomeUp.PLAYING) { //Reset counter to beginning if it reaches the length if(counter > length) { counter = 1; } if(events.containsKey(counter)) { //Keep track of which notes are playing ArrayList<Note> noteList; noteList = events.get(counter); for(int i=0;i<noteList.size();i++) { if(noteList.get(i).getVelocity() > 0) { //Add a noteOn event to heldNotes Hashtable <Integer, Note> internal = originalHeldNotesPlaying.get(index); if (internal == null) { internal = new Hashtable <Integer, Note>(); originalHeldNotesPlaying.put(index, internal); } internal.put(noteList.get(i).getPitch(), noteList.get(i)); // Mark this note as held at current transposition context markHeldNoteAtCurrentTranspositionContext(noteList.get(i)); } else { //Remove a note from heldNotes if(originalHeldNotesPlaying.containsKey(noteList.get(i).getPitch())) { originalHeldNotesPlaying.remove(noteList.get(i).getPitch()); // they are the same so pitch here should be correct heldNotesTranspositionContext.remove(noteList.get(i).getPitch()); } } } // If transposing if (context.getTranspose()) { // Transpose if necessary. If transposing then NoteList will actually be a clone of the original TranspositionContext tc = context.getTranspositionContext(index); ArrayList<Note> noteListAfterTranspose = new ArrayList<Note>(); Note newNote; for(int i=0;i<noteList.size();i++) { newNote = context.transposeWithContext(noteList.get(i), tc); if (newNote != null) { noteListAfterTranspose.add(newNote); } else { //System.out.println("Note transposed off the grid"); noteListAfterTranspose.add(new Note(noteList.get(i).getPitch(), 0, 0)); // If off grid then send a note off } } return noteListAfterTranspose; } return noteList; } else return null; } return null; }
ArrayList<Note> function() { if(counter == Integer.MAX_VALUE - 1) { endRecording(); return null; } if(status == MonomeUp.PLAYING status == MonomeUp.RECORDING status == MonomeUp.CUEDSTOP) counter ++; if(status == MonomeUp.PLAYING) { if(counter > length) { counter = 1; } if(events.containsKey(counter)) { ArrayList<Note> noteList; noteList = events.get(counter); for(int i=0;i<noteList.size();i++) { if(noteList.get(i).getVelocity() > 0) { Hashtable <Integer, Note> internal = originalHeldNotesPlaying.get(index); if (internal == null) { internal = new Hashtable <Integer, Note>(); originalHeldNotesPlaying.put(index, internal); } internal.put(noteList.get(i).getPitch(), noteList.get(i)); markHeldNoteAtCurrentTranspositionContext(noteList.get(i)); } else { if(originalHeldNotesPlaying.containsKey(noteList.get(i).getPitch())) { originalHeldNotesPlaying.remove(noteList.get(i).getPitch()); heldNotesTranspositionContext.remove(noteList.get(i).getPitch()); } } } if (context.getTranspose()) { TranspositionContext tc = context.getTranspositionContext(index); ArrayList<Note> noteListAfterTranspose = new ArrayList<Note>(); Note newNote; for(int i=0;i<noteList.size();i++) { newNote = context.transposeWithContext(noteList.get(i), tc); if (newNote != null) { noteListAfterTranspose.add(newNote); } else { noteListAfterTranspose.add(new Note(noteList.get(i).getPitch(), 0, 0)); } } return noteListAfterTranspose; } return noteList; } else return null; } return null; }
/** * Called by the intiating class in order to cycle through the sequence events and return any notes to be played * @return An ArrayList to be played at the current count. If no events, returns null. * */
Called by the intiating class in order to cycle through the sequence events and return any notes to be played
heartbeat
{ "repo_name": "adamribaudo/sevenuplive", "path": "src/mtn/sevenuplive/modes/NoteSequence.java", "license": "lgpl-3.0", "size": 18233 }
[ "java.util.ArrayList", "java.util.Hashtable" ]
import java.util.ArrayList; import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
2,492,005
public void removeGroupContent(final String inGroupID) throws VException, SQLException, IOException { final OrderObject lOrder = new OrderObjectImpl(); lOrder.setValue(GroupHome.KEY_ID, 0); final QuestionHome lHome = BOMHelper.getQuestionHome(); final QueryResult lQuestions = lHome.selectOfGroup(inGroupID, lOrder); while (lQuestions.hasMoreElements()) { deleteQuestionInIndex(lQuestions.next().get(QuestionHome.KEY_ID).toString()); } }
void function(final String inGroupID) throws VException, SQLException, IOException { final OrderObject lOrder = new OrderObjectImpl(); lOrder.setValue(GroupHome.KEY_ID, 0); final QuestionHome lHome = BOMHelper.getQuestionHome(); final QueryResult lQuestions = lHome.selectOfGroup(inGroupID, lOrder); while (lQuestions.hasMoreElements()) { deleteQuestionInIndex(lQuestions.next().get(QuestionHome.KEY_ID).toString()); } }
/** Removed the content of the specified group from the search index. * * @param inGroupID String * @throws VException * @throws SQLException * @throws IOException */
Removed the content of the specified group from the search index
removeGroupContent
{ "repo_name": "aktion-hip/vif", "path": "org.hip.vif.core/src/org/hip/vif/core/bom/search/VIFContentIndexer.java", "license": "gpl-2.0", "size": 8569 }
[ "java.io.IOException", "java.sql.SQLException", "org.hip.kernel.bom.OrderObject", "org.hip.kernel.bom.QueryResult", "org.hip.kernel.bom.impl.OrderObjectImpl", "org.hip.kernel.exc.VException", "org.hip.vif.core.bom.BOMHelper", "org.hip.vif.core.bom.GroupHome", "org.hip.vif.core.bom.QuestionHome" ]
import java.io.IOException; import java.sql.SQLException; import org.hip.kernel.bom.OrderObject; import org.hip.kernel.bom.QueryResult; import org.hip.kernel.bom.impl.OrderObjectImpl; import org.hip.kernel.exc.VException; import org.hip.vif.core.bom.BOMHelper; import org.hip.vif.core.bom.GroupHome; import org.hip.vif.core.bom.QuestionHome;
import java.io.*; import java.sql.*; import org.hip.kernel.bom.*; import org.hip.kernel.bom.impl.*; import org.hip.kernel.exc.*; import org.hip.vif.core.bom.*;
[ "java.io", "java.sql", "org.hip.kernel", "org.hip.vif" ]
java.io; java.sql; org.hip.kernel; org.hip.vif;
238,771
public final static Field getIdField(final Class<? extends AbstractModel> clazz) { AssertTools.assertNotNull(clazz); Field field = null; String modelClassName = clazz.getName(); field = ID_FIELDS.get(modelClassName); if (field == null) { try { field = BeanTools.getAnnotatedPrivateField(clazz, Id.class, EmbeddedId.class); } catch (NoSuchFieldException e) { LOG.error(e.getMessage(), e); throw new UnexpectedException(e); } ID_FIELDS.put(modelClassName, field); } return field; }
final static Field function(final Class<? extends AbstractModel> clazz) { AssertTools.assertNotNull(clazz); Field field = null; String modelClassName = clazz.getName(); field = ID_FIELDS.get(modelClassName); if (field == null) { try { field = BeanTools.getAnnotatedPrivateField(clazz, Id.class, EmbeddedId.class); } catch (NoSuchFieldException e) { LOG.error(e.getMessage(), e); throw new UnexpectedException(e); } ID_FIELDS.put(modelClassName, field); } return field; }
/** * Retrieve the @Id or @EmbeddedId field * * @param clazz the class of the model * @return @Id or @EmbeddedId field * @throws UnexpectedException If it does not exist */
Retrieve the @Id or @EmbeddedId field
getIdField
{ "repo_name": "acheype/cantharella", "path": "cantharella.data/src/main/java/nc/ird/cantharella/data/model/utils/AbstractModel.java", "license": "agpl-3.0", "size": 3856 }
[ "java.lang.reflect.Field", "javax.persistence.EmbeddedId", "javax.persistence.Id" ]
import java.lang.reflect.Field; import javax.persistence.EmbeddedId; import javax.persistence.Id;
import java.lang.reflect.*; import javax.persistence.*;
[ "java.lang", "javax.persistence" ]
java.lang; javax.persistence;
1,520,729
public static byte[] toByteArray(Reader input, Charset encoding) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output, encoding); return output.toByteArray(); }
static byte[] function(Reader input, Charset encoding) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output, encoding); return output.toByteArray(); }
/** * Get the contents of a <code>Reader</code> as a <code>byte[]</code> * using the specified character encoding. * <p> * This method buffers the input internally, so there is no need to use a * <code>BufferedReader</code>. * * @param input the <code>Reader</code> to read from * @param encoding the encoding to use, null means platform default * @return the requested byte array * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs * @since 2.3 */
Get the contents of a <code>Reader</code> as a <code>byte[]</code> using the specified character encoding. This method buffers the input internally, so there is no need to use a <code>BufferedReader</code>
toByteArray
{ "repo_name": "trivium-io/trivium-core", "path": "src/io/trivium/dep/org/apache/commons/io/IOUtils.java", "license": "apache-2.0", "size": 97969 }
[ "io.trivium.dep.org.apache.commons.io.output.ByteArrayOutputStream", "java.io.IOException", "java.io.Reader", "java.nio.charset.Charset" ]
import io.trivium.dep.org.apache.commons.io.output.ByteArrayOutputStream; import java.io.IOException; import java.io.Reader; import java.nio.charset.Charset;
import io.trivium.dep.org.apache.commons.io.output.*; import java.io.*; import java.nio.charset.*;
[ "io.trivium.dep", "java.io", "java.nio" ]
io.trivium.dep; java.io; java.nio;
2,665,177
public boolean okayToSendError(int taskId, String emailAddress) { boolean returnValue = false; Date currentTime = new Date(); Integer task = new Integer(taskId); Map<String,Date> timestampsMap = this.screenerMap.get(task); if (timestampsMap == null) { // first email for this subject - create one with current notification time timestampsMap = new HashMap<String,Date>(); timestampsMap.put(emailAddress, currentTime); this.screenerMap.put(task, timestampsMap); returnValue = true; log.debug("XX SENDING email for task (#"+taskId+") - first occurrence for this error"); } else { Date lastNotification = timestampsMap.get(emailAddress); if (lastNotification == null) { // first email for this recipient timestampsMap.put(emailAddress, currentTime); returnValue = true; } else { // check if last notification was 60 or more minutes ago if (this.getIntervalInMins(lastNotification, currentTime) >= MIN_INTERVAL_IN_MINS) { timestampsMap.put(emailAddress, currentTime); //update notification time returnValue = true; } } log.debug("XX "+((returnValue)?"SENDING":"NOT SENDING")+ " email for task (#"+taskId+") - last sent: "+ timeOnlyFormatter.format(lastNotification)); // clean up old errors (if needed) this.cleanup(currentTime); } return returnValue; }
boolean function(int taskId, String emailAddress) { boolean returnValue = false; Date currentTime = new Date(); Integer task = new Integer(taskId); Map<String,Date> timestampsMap = this.screenerMap.get(task); if (timestampsMap == null) { timestampsMap = new HashMap<String,Date>(); timestampsMap.put(emailAddress, currentTime); this.screenerMap.put(task, timestampsMap); returnValue = true; log.debug(STR+taskId+STR); } else { Date lastNotification = timestampsMap.get(emailAddress); if (lastNotification == null) { timestampsMap.put(emailAddress, currentTime); returnValue = true; } else { if (this.getIntervalInMins(lastNotification, currentTime) >= MIN_INTERVAL_IN_MINS) { timestampsMap.put(emailAddress, currentTime); returnValue = true; } } log.debug(STR+((returnValue)?STR:STR)+ STR+taskId+STR+ timeOnlyFormatter.format(lastNotification)); this.cleanup(currentTime); } return returnValue; }
/** * Returns true if it is okay to send error email to this address. * Email with same taskId cannot go to the same address more than once per hour. */
Returns true if it is okay to send error email to this address. Email with same taskId cannot go to the same address more than once per hour
okayToSendError
{ "repo_name": "wheresmybrain/syp-scheduler", "path": "src/main/java/com/wheresmybrain/syp/scheduler/events/errorhandler/TaskErrorHandler.java", "license": "lgpl-3.0", "size": 15410 }
[ "java.util.Date", "java.util.HashMap", "java.util.Map" ]
import java.util.Date; import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,795,370
public void setServletContext(ServletContext servletContext) { _servletContext = servletContext; }
void function(ServletContext servletContext) { _servletContext = servletContext; }
/** * Sets the servlet context. */
Sets the servlet context
setServletContext
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/server/dispatch/PageFilterChain.java", "license": "gpl-2.0", "size": 7903 }
[ "javax.servlet.ServletContext" ]
import javax.servlet.ServletContext;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
2,627,031
public final void reloadSchedule() { final byte scheduleType = cm.getActiveBuildConfig(activeBuildID).getScheduleType(); if (scheduleType == ActiveBuildConfig.SCHEDULE_TYPE_AUTOMATIC) { automaticSchedule = true; if (!paused) { runContinuously = true; } } else if (scheduleType == ActiveBuildConfig.SCHEDULE_TYPE_MANUAL) { automaticSchedule = false; runContinuously = false; } }
final void function() { final byte scheduleType = cm.getActiveBuildConfig(activeBuildID).getScheduleType(); if (scheduleType == ActiveBuildConfig.SCHEDULE_TYPE_AUTOMATIC) { automaticSchedule = true; if (!paused) { runContinuously = true; } } else if (scheduleType == ActiveBuildConfig.SCHEDULE_TYPE_MANUAL) { automaticSchedule = false; runContinuously = false; } }
/** * Requests this schedule to reload it's configuration. This * method is used to notify a scheduler about changes in * persistent configuration. */
Requests this schedule to reload it's configuration. This method is used to notify a scheduler about changes in persistent configuration
reloadSchedule
{ "repo_name": "simeshev/parabuild-ci", "path": "src/org/parabuild/ci/build/AutomaticScheduler.java", "license": "lgpl-3.0", "size": 21314 }
[ "org.parabuild.ci.object.ActiveBuildConfig" ]
import org.parabuild.ci.object.ActiveBuildConfig;
import org.parabuild.ci.object.*;
[ "org.parabuild.ci" ]
org.parabuild.ci;
572,427
static void validateLinkedEntity(LinkedEntity expectedLinkedEntity, LinkedEntity actualLinkedEntity) { assertEquals(expectedLinkedEntity.getName(), actualLinkedEntity.getName()); assertEquals(expectedLinkedEntity.getDataSource(), actualLinkedEntity.getDataSource()); assertEquals(expectedLinkedEntity.getLanguage(), actualLinkedEntity.getLanguage()); assertEquals(expectedLinkedEntity.getUrl(), actualLinkedEntity.getUrl()); assertEquals(expectedLinkedEntity.getId(), actualLinkedEntity.getId()); validateLinkedEntityMatches(expectedLinkedEntity.getLinkedEntityMatches(), actualLinkedEntity.getLinkedEntityMatches()); }
static void validateLinkedEntity(LinkedEntity expectedLinkedEntity, LinkedEntity actualLinkedEntity) { assertEquals(expectedLinkedEntity.getName(), actualLinkedEntity.getName()); assertEquals(expectedLinkedEntity.getDataSource(), actualLinkedEntity.getDataSource()); assertEquals(expectedLinkedEntity.getLanguage(), actualLinkedEntity.getLanguage()); assertEquals(expectedLinkedEntity.getUrl(), actualLinkedEntity.getUrl()); assertEquals(expectedLinkedEntity.getId(), actualLinkedEntity.getId()); validateLinkedEntityMatches(expectedLinkedEntity.getLinkedEntityMatches(), actualLinkedEntity.getLinkedEntityMatches()); }
/** * Helper method to validate a single named entity. * * @param expectedLinkedEntity namedEntity returned by the service. * @param actualLinkedEntity namedEntity returned by the API. */
Helper method to validate a single named entity
validateLinkedEntity
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java", "license": "mit", "size": 49541 }
[ "com.azure.ai.textanalytics.models.LinkedEntity", "org.junit.jupiter.api.Assertions" ]
import com.azure.ai.textanalytics.models.LinkedEntity; import org.junit.jupiter.api.Assertions;
import com.azure.ai.textanalytics.models.*; import org.junit.jupiter.api.*;
[ "com.azure.ai", "org.junit.jupiter" ]
com.azure.ai; org.junit.jupiter;
1,242,395
@Test public void testShouldEndWithUri() { // when builder = HttpFilters.request().uri().endsWith(".html"); // then assertRequestMatches(builder, request); assertRequestNotMatches(builder, invalidRequest); }
void function() { builder = HttpFilters.request().uri().endsWith(".html"); assertRequestMatches(builder, request); assertRequestNotMatches(builder, invalidRequest); }
/** * Tests the creating of {@link HttpFilterBuilder} that matches only request that ends with given substring. */
Tests the creating of <code>HttpFilterBuilder</code> that matches only request that ends with given substring
testShouldEndWithUri
{ "repo_name": "CSchulz/arquillian-extension-warp", "path": "impl/src/test/java/org/jboss/arquillian/warp/impl/client/filter/http/TestHttpFilters.java", "license": "apache-2.0", "size": 13377 }
[ "org.jboss.arquillian.warp.client.filter.http.HttpFilters" ]
import org.jboss.arquillian.warp.client.filter.http.HttpFilters;
import org.jboss.arquillian.warp.client.filter.http.*;
[ "org.jboss.arquillian" ]
org.jboss.arquillian;
42,033
protected void updateNetworkWeights() { // find active neuron in output layer // TODO : change idx, in general case not 1 CompetitiveNeuron winningNeuron = ((CompetitiveLayer) neuralNetwork .getLayerAt(1)).getWinner(); Connection[] inputConnections = winningNeuron .getConnectionsFromOtherLayers(); for(Connection connection : inputConnections) { double weight = connection.getWeight().getValue(); double input = connection.getInput(); double deltaWeight = this.learningRate * (input - weight); connection.getWeight().inc(deltaWeight); } }
void function() { CompetitiveNeuron winningNeuron = ((CompetitiveLayer) neuralNetwork .getLayerAt(1)).getWinner(); Connection[] inputConnections = winningNeuron .getConnectionsFromOtherLayers(); for(Connection connection : inputConnections) { double weight = connection.getWeight().getValue(); double input = connection.getInput(); double deltaWeight = this.learningRate * (input - weight); connection.getWeight().inc(deltaWeight); } }
/** * Adjusts weights for the winning neuron */
Adjusts weights for the winning neuron
updateNetworkWeights
{ "repo_name": "dwaybright/StrategicAssaultSimulator", "path": "core/src/neuroph_jars/sources/Core/src/main/java/org/neuroph/nnet/learning/CompetitiveLearning.java", "license": "gpl-2.0", "size": 2567 }
[ "org.neuroph.core.Connection", "org.neuroph.nnet.comp.layer.CompetitiveLayer", "org.neuroph.nnet.comp.neuron.CompetitiveNeuron" ]
import org.neuroph.core.Connection; import org.neuroph.nnet.comp.layer.CompetitiveLayer; import org.neuroph.nnet.comp.neuron.CompetitiveNeuron;
import org.neuroph.core.*; import org.neuroph.nnet.comp.layer.*; import org.neuroph.nnet.comp.neuron.*;
[ "org.neuroph.core", "org.neuroph.nnet" ]
org.neuroph.core; org.neuroph.nnet;
662,267
public FeatureResultSet queryFeaturesForChunk(String[] columns, double minX, double minY, double maxX, double maxY, String orderBy, int limit) { return queryFeaturesForChunk(false, columns, minX, minY, maxX, maxY, orderBy, limit); }
FeatureResultSet function(String[] columns, double minX, double minY, double maxX, double maxY, String orderBy, int limit) { return queryFeaturesForChunk(false, columns, minX, minY, maxX, maxY, orderBy, limit); }
/** * Query for features within the bounds, starting at the offset and * returning no more than the limit * * @param columns * columns * @param minX * min x * @param minY * min y * @param maxX * max x * @param maxY * max y * @param orderBy * order by * @param limit * chunk limit * @return results * @since 6.2.0 */
Query for features within the bounds, starting at the offset and returning no more than the limit
queryFeaturesForChunk
{ "repo_name": "ngageoint/geopackage-java", "path": "src/main/java/mil/nga/geopackage/extension/rtree/RTreeIndexTableDao.java", "license": "mit", "size": 349361 }
[ "mil.nga.geopackage.features.user.FeatureResultSet" ]
import mil.nga.geopackage.features.user.FeatureResultSet;
import mil.nga.geopackage.features.user.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
1,962,738
List<Member> getMembers(PerunSession sess, Vo vo, Status status) throws InternalErrorException, PrivilegeException, VoNotExistsException;
List<Member> getMembers(PerunSession sess, Vo vo, Status status) throws InternalErrorException, PrivilegeException, VoNotExistsException;
/** * Get all VO members who have the status. * * @param sess * @param vo * @param status get only members who have this status * @return all members of the VO * @throws InternalErrorException * @throws PrivilegeException * @throws VoNotExistsException */
Get all VO members who have the status
getMembers
{ "repo_name": "stavamichal/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/MembersManager.java", "license": "bsd-2-clause", "size": 57708 }
[ "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.VoNotExistsException", "java.util.List" ]
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.VoNotExistsException; import java.util.List;
import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
490,491
default void checkCanInsertIntoTable(SystemSecurityContext context, CatalogSchemaTableName table) { denyInsertTable(table.toString()); }
default void checkCanInsertIntoTable(SystemSecurityContext context, CatalogSchemaTableName table) { denyInsertTable(table.toString()); }
/** * Check if identity is allowed to insert into the specified table in a catalog. * * @throws AccessDeniedException if not allowed */
Check if identity is allowed to insert into the specified table in a catalog
checkCanInsertIntoTable
{ "repo_name": "hgschmie/presto", "path": "presto-spi/src/main/java/io/prestosql/spi/security/SystemAccessControl.java", "license": "apache-2.0", "size": 21168 }
[ "io.prestosql.spi.connector.CatalogSchemaTableName", "io.prestosql.spi.security.AccessDeniedException" ]
import io.prestosql.spi.connector.CatalogSchemaTableName; import io.prestosql.spi.security.AccessDeniedException;
import io.prestosql.spi.connector.*; import io.prestosql.spi.security.*;
[ "io.prestosql.spi" ]
io.prestosql.spi;
2,564,713
protected BeanConnection createBeanConnection(int sourcePos, int targetPos, String event, boolean hidden) throws Exception { BeanConnection result; BeanInfo compInfo; EventSetDescriptor[] esds; int i; BeanInstance instSource; BeanInstance instTarget; result = null; // was there a connection? if ((sourcePos == -1) || (targetPos == -1)) { return result; } instSource = (BeanInstance) m_BeanInstances.get(sourcePos); instTarget = (BeanInstance) m_BeanInstances.get(targetPos); compInfo = Introspector.getBeanInfo(((BeanInstance) m_BeanInstances .get(sourcePos)).getBean().getClass()); esds = compInfo.getEventSetDescriptors(); for (i = 0; i < esds.length; i++) { if (esds[i].getName().equals(event)) { result = new BeanConnection(instSource, instTarget, esds[i], m_vectorIndex); result.setHidden(hidden); break; } } return result; }
BeanConnection function(int sourcePos, int targetPos, String event, boolean hidden) throws Exception { BeanConnection result; BeanInfo compInfo; EventSetDescriptor[] esds; int i; BeanInstance instSource; BeanInstance instTarget; result = null; if ((sourcePos == -1) (targetPos == -1)) { return result; } instSource = (BeanInstance) m_BeanInstances.get(sourcePos); instTarget = (BeanInstance) m_BeanInstances.get(targetPos); compInfo = Introspector.getBeanInfo(((BeanInstance) m_BeanInstances .get(sourcePos)).getBean().getClass()); esds = compInfo.getEventSetDescriptors(); for (i = 0; i < esds.length; i++) { if (esds[i].getName().equals(event)) { result = new BeanConnection(instSource, instTarget, esds[i], m_vectorIndex); result.setHidden(hidden); break; } } return result; }
/** * generates a connection based on the given parameters * * @param sourcePos the source position in the m_BeanInstances vector * @param targetPos the target position in the m_BeanInstances vector * @param event the name of the event, i.e., the connection * @param hidden true if the connection is hidden * @return the generated BeanConnection * @throws Exception if something goes wrong */
generates a connection based on the given parameters
createBeanConnection
{ "repo_name": "mydzigear/weka.kmeanspp.silhouette_score", "path": "src/weka/gui/beans/xml/XMLBeans.java", "license": "gpl-3.0", "size": 66607 }
[ "java.beans.BeanInfo", "java.beans.EventSetDescriptor", "java.beans.Introspector" ]
import java.beans.BeanInfo; import java.beans.EventSetDescriptor; import java.beans.Introspector;
import java.beans.*;
[ "java.beans" ]
java.beans;
2,606,643
//StringTable table2 = new StringTable("Directory_Location,Email_TO,Email_CC,Subject,Body",","); //table2.insertStringColumn("O:\\Grant\\Brian,emanuelrivera2010@yahoo.com,,Grant Process Alert-Folder5,File Change one"); //table2.insertStringColumn("O:\\Grant\\Ellie,emanuelrivera2010@yahoo.com,,Grant Process Alert-Folder2,File Change one"); //table2.qsort("Subject"); //System.out.println(table2.toString()); //StringTable table1 = new StringTable("Date\tSec\tmk","\t"); //table1.insertStringColumn("1\t1\t4"); //table1.insertStringColumn("1\t1\t5"); //table1.insertStringColumn("2\t1\t1"); //System.out.println(table1.toString()); //table1=table2; //System.out.println(table1.toString()); Timing StopWatch1=new Timing(); //StringDataTable table2=new StringDataTable(table1.getArrLRows(),table1.getArrColumnHeader(),table1.getColumnNumber(),table1.getStrDelimiter()); //table2.insertStringColumn("O:\\Grant\\Brian\\Files\\ \t3"); //table2.insertStringColumn("O:\\Grant\\Brian\\Files\\ \t2"); //System.out.println(table2.toString()); //table1.IncludeFilterStringTable("Sec", "1",true); //System.out.println(table1.toString()); //System.out.println(table2.toString()); //table1.insertStringArray(new String[]{"O:\\Grant\\Brian\\Filesa,2"}); //System.out.println(table2.toString()); //table1.IncludeFilterContainTable(table2, "Directory_Location","Directory_Location", true); //StringDataTable TableDetailedLog= new StringDataTable("Date;Action;File;WorkingDir" + // "FileName;FileNameSig;FileNameFull;GrantSubFolder;GrantSubFolderFull",";"); //System.out.println(TableDetailedLog.toString()); }
Timing StopWatch1=new Timing(); }
/** * The main method. * * @param args the arguments */
The main method
main
{ "repo_name": "earasoft/TUGrantProcessor", "path": "srcTest/org/shared/performance/DataTest2.java", "license": "gpl-2.0", "size": 2087 }
[ "org.shared.performance.Timing" ]
import org.shared.performance.Timing;
import org.shared.performance.*;
[ "org.shared.performance" ]
org.shared.performance;
1,768,003
public static Period stringToPeriod(String s) throws MotuConverterException { Period period = null; StringBuilder stringBuilder = new StringBuilder(); for (PeriodFormatter periodFormatter : DateUtils.PERIOD_FORMATTERS.values()) { try { period = periodFormatter.parsePeriod(s); } catch (IllegalArgumentException e) { stringBuilder.append(e.getMessage()); stringBuilder.append("\n"); } if (period != null) { break; } } if (period == null) { throw new MotuConverterException( String.format("Cannot convert '%s' to Period. Format '%s' is not valid.%nAcceptable format are '%s'", s, stringBuilder.toString(), DateUtils.PERIOD_FORMATTERS.keySet().toString())); } return period; }
static Period function(String s) throws MotuConverterException { Period period = null; StringBuilder stringBuilder = new StringBuilder(); for (PeriodFormatter periodFormatter : DateUtils.PERIOD_FORMATTERS.values()) { try { period = periodFormatter.parsePeriod(s); } catch (IllegalArgumentException e) { stringBuilder.append(e.getMessage()); stringBuilder.append("\n"); } if (period != null) { break; } } if (period == null) { throw new MotuConverterException( String.format(STR, s, stringBuilder.toString(), DateUtils.PERIOD_FORMATTERS.keySet().toString())); } return period; }
/** * String to period. * * @param s the s * @return the period * @throws MotuConverterException the motu converter exception */
String to period
stringToPeriod
{ "repo_name": "clstoulouse/motu", "path": "motu-web/src/main/java/fr/cls/atoll/motu/web/common/utils/DateUtils.java", "license": "lgpl-3.0", "size": 28188 }
[ "fr.cls.atoll.motu.library.converter.exception.MotuConverterException", "org.joda.time.Period", "org.joda.time.format.PeriodFormatter" ]
import fr.cls.atoll.motu.library.converter.exception.MotuConverterException; import org.joda.time.Period; import org.joda.time.format.PeriodFormatter;
import fr.cls.atoll.motu.library.converter.exception.*; import org.joda.time.*; import org.joda.time.format.*;
[ "fr.cls.atoll", "org.joda.time" ]
fr.cls.atoll; org.joda.time;
3,611
@Override public Iterator<T> iterator() { if (iterator == null) { iterator = new PredicateIterator<T>(iterable.iterator(), predicate); } else { iterator.set(iterable.iterator(), predicate); } return iterator; } }
Iterator<T> function() { if (iterator == null) { iterator = new PredicateIterator<T>(iterable.iterator(), predicate); } else { iterator.set(iterable.iterator(), predicate); } return iterator; } }
/** * Returns an iterator. Note that the same iterator instance is returned each time this method is called. Use the * {@link Predicate.PredicateIterator} constructor for nested or multithreaded iteration. */
Returns an iterator. Note that the same iterator instance is returned each time this method is called. Use the <code>Predicate.PredicateIterator</code> constructor for nested or multithreaded iteration
iterator
{ "repo_name": "grum/Ashley", "path": "gdx-lib/src/main/java/com/badlogic/gdx/utils/Predicate.java", "license": "apache-2.0", "size": 4079 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,201,767
private int getPopupMenuItem(JPopupMenu menu, String text) { int index = -1; for (int i = 0; (index == -1) && (i < menu.getComponentCount()); i++) { Component comp = menu.getComponent(i); if (comp instanceof JMenuItem) { JMenuItem item = (JMenuItem) comp; if (text.equals(item.getText())) { index = i; } } } return index; }
int function(JPopupMenu menu, String text) { int index = -1; for (int i = 0; (index == -1) && (i < menu.getComponentCount()); i++) { Component comp = menu.getComponent(i); if (comp instanceof JMenuItem) { JMenuItem item = (JMenuItem) comp; if (text.equals(item.getText())) { index = i; } } } return index; }
/** * Returns the index of an item in a popup menu. * * @param menu the menu. * @param text the label. * * @return The item index. */
Returns the index of an item in a popup menu
getPopupMenuItem
{ "repo_name": "akardapolov/ASH-Viewer", "path": "jfreechart-fse/src/main/java/org/jfree/chart/PolarChartPanel.java", "license": "gpl-3.0", "size": 8628 }
[ "java.awt.Component", "javax.swing.JMenuItem", "javax.swing.JPopupMenu" ]
import java.awt.Component; import javax.swing.JMenuItem; import javax.swing.JPopupMenu;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
338,457
@NotNull protected static Compiler retrieveCompiler() throws RegexpEngineNotFoundException { return RegexpUtils.getRegexpCompiler(); }
static Compiler function() throws RegexpEngineNotFoundException { return RegexpUtils.getRegexpCompiler(); }
/** * Retrieves the regexp compiler. * @return such compiler. * @throws RegexpEngineNotFoundException if the system is not configured * properly in order to provide regexp services. */
Retrieves the regexp compiler
retrieveCompiler
{ "repo_name": "rydnr/java-commons", "path": "src/main/java/org/acmsl/commons/utils/net/URLUtils.java", "license": "gpl-2.0", "size": 22921 }
[ "org.acmsl.commons.regexpplugin.Compiler", "org.acmsl.commons.regexpplugin.RegexpEngineNotFoundException", "org.acmsl.commons.utils.regexp.RegexpUtils" ]
import org.acmsl.commons.regexpplugin.Compiler; import org.acmsl.commons.regexpplugin.RegexpEngineNotFoundException; import org.acmsl.commons.utils.regexp.RegexpUtils;
import org.acmsl.commons.regexpplugin.*; import org.acmsl.commons.utils.regexp.*;
[ "org.acmsl.commons" ]
org.acmsl.commons;
2,688,105
@Nonnull public Map<String, TaskState> getTaskStates(@Nonnull String taskType) { return _pinotHelixTaskResourceManager.getTaskStates(taskType); }
Map<String, TaskState> function(@Nonnull String taskType) { return _pinotHelixTaskResourceManager.getTaskStates(taskType); }
/** * Get all tasks' state for the given task type. * * @param taskType Task type * @return Map from task name to task state */
Get all tasks' state for the given task type
getTaskStates
{ "repo_name": "apucher/pinot", "path": "pinot-controller/src/main/java/com/linkedin/pinot/controller/helix/core/minion/ClusterInfoProvider.java", "license": "apache-2.0", "size": 4883 }
[ "java.util.Map", "javax.annotation.Nonnull", "org.apache.helix.task.TaskState" ]
import java.util.Map; import javax.annotation.Nonnull; import org.apache.helix.task.TaskState;
import java.util.*; import javax.annotation.*; import org.apache.helix.task.*;
[ "java.util", "javax.annotation", "org.apache.helix" ]
java.util; javax.annotation; org.apache.helix;
442,519
return selector; } /** * Sets the value of the selector property. * * @param value * allowed object is * {@link Selector }
return selector; } /** * Sets the value of the selector property. * * @param value * allowed object is * {@link Selector }
/** * Gets the value of the selector property. * * @return * possible object is * {@link Selector } * */
Gets the value of the selector property
getSelector
{ "repo_name": "stoksey69/googleads-java-lib", "path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201506/express/ProductServiceServiceInterfaceget.java", "license": "apache-2.0", "size": 1976 }
[ "com.google.api.ads.adwords.jaxws.v201506.cm.Selector" ]
import com.google.api.ads.adwords.jaxws.v201506.cm.Selector;
import com.google.api.ads.adwords.jaxws.v201506.cm.*;
[ "com.google.api" ]
com.google.api;
1,681,393