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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void DeleteUsername(String _Username) throws java.sql.SQLException
{
Statement lStatement = null;
lStatement = mConnect.createStatement();
lStatement.executeQuery(" DELETE FROM "+UserTable+" WHERE "+UserNameField+"="+_Username+";");
} | void function(String _Username) throws java.sql.SQLException { Statement lStatement = null; lStatement = mConnect.createStatement(); lStatement.executeQuery(STR+UserTable+STR+UserNameField+"="+_Username+";"); } | /**
* DeleteUsername
* Delete the specified user
*
* @param _Username : Username of the specified user
* @return void
*/ | DeleteUsername Delete the specified user | DeleteUsername | {
"repo_name": "hellgheast/AndroidCityResto",
"path": "Samples/CityResto/app/src/main/java/iee3/he_arc/cityresto/ClassDBHelper.java",
"license": "gpl-3.0",
"size": 7035
} | [
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,394,518 |
protected void callCustomActivityStartListeners(ActivityExecution execution) {
List<ExecutionListener> listeners = activity.getExecutionListeners(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START);
if (listeners != null) {
List<ExecutionListener> filteredExecutionListeners = new ArrayList<>(listeners.size());
// Sad that we have to do this, but it's the only way I could find (which is also safe for backwards compatibility)
for (ExecutionListener executionListener : listeners) {
if (!(executionListener instanceof ActivityInstanceStartHandler)) {
filteredExecutionListeners.add(executionListener);
}
}
CallActivityListenersOperation atomicOperation = new CallActivityListenersOperation(filteredExecutionListeners);
Context.getCommandContext().performOperation(atomicOperation, (InterpretableExecution) execution);
}
} | void function(ActivityExecution execution) { List<ExecutionListener> listeners = activity.getExecutionListeners(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START); if (listeners != null) { List<ExecutionListener> filteredExecutionListeners = new ArrayList<>(listeners.size()); for (ExecutionListener executionListener : listeners) { if (!(executionListener instanceof ActivityInstanceStartHandler)) { filteredExecutionListeners.add(executionListener); } } CallActivityListenersOperation atomicOperation = new CallActivityListenersOperation(filteredExecutionListeners); Context.getCommandContext().performOperation(atomicOperation, (InterpretableExecution) execution); } } | /**
* Since the first loop of the multi instance is not executed as a regular activity, it is needed to call the start listeners yourself.
*/ | Since the first loop of the multi instance is not executed as a regular activity, it is needed to call the start listeners yourself | callCustomActivityStartListeners | {
"repo_name": "dbmalkovsky/flowable-engine",
"path": "modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java",
"license": "apache-2.0",
"size": 16253
} | [
"java.util.ArrayList",
"java.util.List",
"org.activiti.engine.impl.context.Context",
"org.activiti.engine.impl.history.handler.ActivityInstanceStartHandler",
"org.activiti.engine.impl.pvm.delegate.ActivityExecution",
"org.activiti.engine.impl.pvm.runtime.InterpretableExecution",
"org.flowable.engine.delegate.ExecutionListener"
] | import java.util.ArrayList; import java.util.List; import org.activiti.engine.impl.context.Context; import org.activiti.engine.impl.history.handler.ActivityInstanceStartHandler; import org.activiti.engine.impl.pvm.delegate.ActivityExecution; import org.activiti.engine.impl.pvm.runtime.InterpretableExecution; import org.flowable.engine.delegate.ExecutionListener; | import java.util.*; import org.activiti.engine.impl.context.*; import org.activiti.engine.impl.history.handler.*; import org.activiti.engine.impl.pvm.delegate.*; import org.activiti.engine.impl.pvm.runtime.*; import org.flowable.engine.delegate.*; | [
"java.util",
"org.activiti.engine",
"org.flowable.engine"
] | java.util; org.activiti.engine; org.flowable.engine; | 821,342 |
public void setDateofengagement(final LocalDateTime dateofengagement) {
this.dateofengagement = dateofengagement;
} | void function(final LocalDateTime dateofengagement) { this.dateofengagement = dateofengagement; } | /**
* Set the value related to the column: dateofengagement.
* @param dateofengagement the dateofengagement value you wish to set
*/ | Set the value related to the column: dateofengagement | setDateofengagement | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "hmis-model-v2014/src/main/java/com/servinglynk/hmis/warehouse/model/v2014/Dateofengagement.java",
"license": "mpl-2.0",
"size": 7803
} | [
"java.time.LocalDateTime"
] | import java.time.LocalDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 2,061,748 |
protected String parseCassandraKeyspace(Properties tbl) throws SerDeException {
String result = tbl.getProperty(CASSANDRA_KEYSPACE_NAME);
if (result == null) {
result = tbl
.getProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME);
if (result == null) {
throw new SerDeException("CassandraKeyspace not defined" + tbl.toString());
}
if (result.indexOf(".") != -1) {
result = result.substring(0, result.indexOf("."));
}
}
return result;
} | String function(Properties tbl) throws SerDeException { String result = tbl.getProperty(CASSANDRA_KEYSPACE_NAME); if (result == null) { result = tbl .getProperty(org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_NAME); if (result == null) { throw new SerDeException(STR + tbl.toString()); } if (result.indexOf(".") != -1) { result = result.substring(0, result.indexOf(".")); } } return result; } | /**
* Parse cassandra keyspace from table properties.
*
* @param tbl table properties
* @return cassandra keyspace
* @throws org.apache.hadoop.hive.serde2.SerDeException error parsing
* keyspace
*/ | Parse cassandra keyspace from table properties | parseCassandraKeyspace | {
"repo_name": "bigdbcloud/hive-cassandra",
"path": "src/main/java/org/apache/hadoop/hive/cassandra/serde/AbstractCassandraSerDe.java",
"license": "apache-2.0",
"size": 9530
} | [
"java.util.Properties",
"org.apache.hadoop.hive.serde2.SerDeException"
] | import java.util.Properties; import org.apache.hadoop.hive.serde2.SerDeException; | import java.util.*; import org.apache.hadoop.hive.serde2.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,130,206 |
public static byte[] floatArrayToByteArray(float floatArray[]) {
byte byteArray[] = new byte[floatArray.length*4]; // 4 bytes per float
ByteBuffer byteBuf = ByteBuffer.wrap(byteArray);
FloatBuffer floatBuf = byteBuf.asFloatBuffer();
floatBuf.put(floatArray);
return byteArray;
} | static byte[] function(float floatArray[]) { byte byteArray[] = new byte[floatArray.length*4]; ByteBuffer byteBuf = ByteBuffer.wrap(byteArray); FloatBuffer floatBuf = byteBuf.asFloatBuffer(); floatBuf.put(floatArray); return byteArray; } | /**
* Convert from an array of floats to an array of bytes
*
* @param floatArray
*/ | Convert from an array of floats to an array of bytes | floatArrayToByteArray | {
"repo_name": "AngelBanuelos/hipi",
"path": "core/src/main/java/org/hipi/util/ByteUtils.java",
"license": "bsd-3-clause",
"size": 7498
} | [
"java.nio.ByteBuffer",
"java.nio.FloatBuffer"
] | import java.nio.ByteBuffer; import java.nio.FloatBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 98,411 |
@AfterEach
public void teardownTest(TestInfo testInfo) {
if (testContextManager != null && testContextManager.didTestRun()) {
afterTest();
interceptorManager.close();
}
} | void function(TestInfo testInfo) { if (testContextManager != null && testContextManager.didTestRun()) { afterTest(); interceptorManager.close(); } } | /**
* Disposes of {@link InterceptorManager} and its inheriting class' resources.
*
* @param testInfo the injected testInfo
*/ | Disposes of <code>InterceptorManager</code> and its inheriting class' resources | teardownTest | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java",
"license": "mit",
"size": 12438
} | [
"org.junit.jupiter.api.TestInfo"
] | import org.junit.jupiter.api.TestInfo; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 2,177,425 |
private void registerFabListener() {
FileActivity activity = (FileActivity) getActivity();
getFabMain().setOnClickListener(v -> new OCFileListBottomSheetDialog(activity,
this,
deviceInfo,
accountManager.getUser(),
getCurrentFile())
.show());
} | void function() { FileActivity activity = (FileActivity) getActivity(); getFabMain().setOnClickListener(v -> new OCFileListBottomSheetDialog(activity, this, deviceInfo, accountManager.getUser(), getCurrentFile()) .show()); } | /**
* register listener on FAB.
*/ | register listener on FAB | registerFabListener | {
"repo_name": "jsargent7089/android",
"path": "src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java",
"license": "gpl-2.0",
"size": 73728
} | [
"com.owncloud.android.ui.activity.FileActivity"
] | import com.owncloud.android.ui.activity.FileActivity; | import com.owncloud.android.ui.activity.*; | [
"com.owncloud.android"
] | com.owncloud.android; | 353,075 |
@JSFunction
public void sftpPut(Object aSource, String aRemoteFile, Object monitor) throws Exception {
ChannelSftp ch = (ChannelSftp) getSftpChannel();
if (monitor != null && !(monitor instanceof Undefined)) {
if (aSource instanceof String) {
ch.put((String) aSource, aRemoteFile, (SftpProgressMonitor) ((NativeJavaObject) monitor).unwrap());
} else {
if (aSource instanceof NativeJavaObject) aSource = ((NativeJavaObject) aSource).unwrap();
if (aSource instanceof InputStream) {
try ( OutputStream os = ch.put(aRemoteFile, (SftpProgressMonitor) ((NativeJavaObject) monitor).unwrap(), 0) ) {
IOUtils.copyLarge((InputStream) aSource, os);
}
} else {
throw new Exception("Expecting a string source file name or a Java Input stream as source");
}
}
} else {
if (aSource instanceof String) {
ch.put((String) aSource, aRemoteFile);
} else {
if (aSource instanceof NativeJavaObject) aSource = ((NativeJavaObject) aSource).unwrap();
if (aSource instanceof InputStream) {
try ( OutputStream os = ch.put(aRemoteFile) ) {
IOUtils.copyLarge((InputStream) aSource, os);
}
} else {
throw new Exception("Expecting a string source file name or a Java Input stream as source");
}
}
}
}
| void function(Object aSource, String aRemoteFile, Object monitor) throws Exception { ChannelSftp ch = (ChannelSftp) getSftpChannel(); if (monitor != null && !(monitor instanceof Undefined)) { if (aSource instanceof String) { ch.put((String) aSource, aRemoteFile, (SftpProgressMonitor) ((NativeJavaObject) monitor).unwrap()); } else { if (aSource instanceof NativeJavaObject) aSource = ((NativeJavaObject) aSource).unwrap(); if (aSource instanceof InputStream) { try ( OutputStream os = ch.put(aRemoteFile, (SftpProgressMonitor) ((NativeJavaObject) monitor).unwrap(), 0) ) { IOUtils.copyLarge((InputStream) aSource, os); } } else { throw new Exception(STR); } } } else { if (aSource instanceof String) { ch.put((String) aSource, aRemoteFile); } else { if (aSource instanceof NativeJavaObject) aSource = ((NativeJavaObject) aSource).unwrap(); if (aSource instanceof InputStream) { try ( OutputStream os = ch.put(aRemoteFile) ) { IOUtils.copyLarge((InputStream) aSource, os); } } else { throw new Exception(STR); } } } } | /**
* <odoc>
* <key>SSH.sftpPut(aSource, aRemoteFile, monitor)</key>
* Sends aSource file (if string) or a Java stream to a remote file path over a SFTP connection.
* Optionally you can provided a callback function called monitor (see more in ow.format.sshProgress)
* </odoc>
* @throws Exception
*/ | SSH.sftpPut(aSource, aRemoteFile, monitor) Sends aSource file (if string) or a Java stream to a remote file path over a SFTP connection. Optionally you can provided a callback function called monitor (see more in ow.format.sshProgress) | sftpPut | {
"repo_name": "OpenAF/openaf",
"path": "src/openaf/plugins/SSH.java",
"license": "apache-2.0",
"size": 32314
} | [
"com.jcraft.jsch.ChannelSftp",
"com.jcraft.jsch.SftpProgressMonitor",
"java.io.InputStream",
"java.io.OutputStream",
"java.lang.String",
"org.apache.commons.io.IOUtils",
"org.mozilla.javascript.NativeJavaObject",
"org.mozilla.javascript.Undefined"
] | import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.SftpProgressMonitor; import java.io.InputStream; import java.io.OutputStream; import java.lang.String; import org.apache.commons.io.IOUtils; import org.mozilla.javascript.NativeJavaObject; import org.mozilla.javascript.Undefined; | import com.jcraft.jsch.*; import java.io.*; import java.lang.*; import org.apache.commons.io.*; import org.mozilla.javascript.*; | [
"com.jcraft.jsch",
"java.io",
"java.lang",
"org.apache.commons",
"org.mozilla.javascript"
] | com.jcraft.jsch; java.io; java.lang; org.apache.commons; org.mozilla.javascript; | 862,484 |
protected List createOverflowCommandList(Vector commands) {
List l = new List(commands);
l.setRenderingPrototype(null);
l.setListSizeCalculationSampleCount(commands.size());
l.setUIID("CommandList");
Component c = (Component) l.getRenderer();
c.setUIID("Command");
c = l.getRenderer().getListFocusComponent(l);
c.setUIID("CommandFocus");
l.setFixedSelection(List.FIXED_NONE_CYCLIC);
l.setScrollVisible(false);
((DefaultListCellRenderer) l.getRenderer()).setShowNumbers(false);
return l;
}
| List function(Vector commands) { List l = new List(commands); l.setRenderingPrototype(null); l.setListSizeCalculationSampleCount(commands.size()); l.setUIID(STR); Component c = (Component) l.getRenderer(); c.setUIID(STR); c = l.getRenderer().getListFocusComponent(l); c.setUIID(STR); l.setFixedSelection(List.FIXED_NONE_CYCLIC); l.setScrollVisible(false); ((DefaultListCellRenderer) l.getRenderer()).setShowNumbers(false); return l; } | /**
* Creates the list component containing the commands within the given
* vector used for showing the menu dialog
*
* @param commands list of command objects
* @return List object
*/ | Creates the list component containing the commands within the given vector used for showing the menu dialog | createOverflowCommandList | {
"repo_name": "codenameone/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/Toolbar.java",
"license": "gpl-2.0",
"size": 114065
} | [
"com.codename1.ui.list.DefaultListCellRenderer",
"java.util.Vector"
] | import com.codename1.ui.list.DefaultListCellRenderer; import java.util.Vector; | import com.codename1.ui.list.*; import java.util.*; | [
"com.codename1.ui",
"java.util"
] | com.codename1.ui; java.util; | 1,465,183 |
@NonNull
@Override
public RenderMode getRenderMode() {
return getBackgroundMode() == BackgroundMode.opaque ? RenderMode.surface : RenderMode.texture;
} | RenderMode function() { return getBackgroundMode() == BackgroundMode.opaque ? RenderMode.surface : RenderMode.texture; } | /**
* {@link FlutterActivityAndFragmentDelegate.Host} method that is used by {@link
* FlutterActivityAndFragmentDelegate} to obtain the desired {@link RenderMode} that should be
* used when instantiating a {@link FlutterView}.
*/ | <code>FlutterActivityAndFragmentDelegate.Host</code> method that is used by <code>FlutterActivityAndFragmentDelegate</code> to obtain the desired <code>RenderMode</code> that should be used when instantiating a <code>FlutterView</code> | getRenderMode | {
"repo_name": "flutter/engine",
"path": "shell/platform/android/io/flutter/embedding/android/FlutterActivity.java",
"license": "bsd-3-clause",
"size": 49506
} | [
"io.flutter.embedding.android.FlutterActivityLaunchConfigs"
] | import io.flutter.embedding.android.FlutterActivityLaunchConfigs; | import io.flutter.embedding.android.*; | [
"io.flutter.embedding"
] | io.flutter.embedding; | 2,206,793 |
public static Map<String, List<String>> getZoneBasedDiscoveryUrlsFromRegion(EurekaClientConfig clientConfig, String region) {
String discoveryDnsName = null;
try {
discoveryDnsName = "txt." + region + "." + clientConfig.getEurekaServerDNSName();
logger.debug("The region url to be looked up is {} :", discoveryDnsName);
Set<String> zoneCnamesForRegion = new TreeSet<String>(DnsResolver.getCNamesFromTxtRecord(discoveryDnsName));
Map<String, List<String>> zoneCnameMapForRegion = new TreeMap<String, List<String>>();
for (String zoneCname : zoneCnamesForRegion) {
String zone = null;
if (isEC2Url(zoneCname)) {
throw new RuntimeException(
"Cannot find the right DNS entry for "
+ discoveryDnsName
+ ". "
+ "Expected mapping of the format <aws_zone>.<domain_name>");
} else {
String[] cnameTokens = zoneCname.split("\\.");
zone = cnameTokens[0];
logger.debug("The zoneName mapped to region {} is {}", region, zone);
}
List<String> zoneCnamesSet = zoneCnameMapForRegion.get(zone);
if (zoneCnamesSet == null) {
zoneCnamesSet = new ArrayList<String>();
zoneCnameMapForRegion.put(zone, zoneCnamesSet);
}
zoneCnamesSet.add(zoneCname);
}
return zoneCnameMapForRegion;
} catch (Throwable e) {
throw new RuntimeException("Cannot get cnames bound to the region:" + discoveryDnsName, e);
}
} | static Map<String, List<String>> function(EurekaClientConfig clientConfig, String region) { String discoveryDnsName = null; try { discoveryDnsName = "txt." + region + "." + clientConfig.getEurekaServerDNSName(); logger.debug(STR, discoveryDnsName); Set<String> zoneCnamesForRegion = new TreeSet<String>(DnsResolver.getCNamesFromTxtRecord(discoveryDnsName)); Map<String, List<String>> zoneCnameMapForRegion = new TreeMap<String, List<String>>(); for (String zoneCname : zoneCnamesForRegion) { String zone = null; if (isEC2Url(zoneCname)) { throw new RuntimeException( STR + discoveryDnsName + STR + STR); } else { String[] cnameTokens = zoneCname.split("\\."); zone = cnameTokens[0]; logger.debug(STR, region, zone); } List<String> zoneCnamesSet = zoneCnameMapForRegion.get(zone); if (zoneCnamesSet == null) { zoneCnamesSet = new ArrayList<String>(); zoneCnameMapForRegion.put(zone, zoneCnamesSet); } zoneCnamesSet.add(zoneCname); } return zoneCnameMapForRegion; } catch (Throwable e) { throw new RuntimeException(STR + discoveryDnsName, e); } } | /**
* Get the zone based CNAMES that are bound to a region.
*
* @param region
* - The region for which the zone names need to be retrieved
* @return - The list of CNAMES from which the zone-related information can
* be retrieved
*/ | Get the zone based CNAMES that are bound to a region | getZoneBasedDiscoveryUrlsFromRegion | {
"repo_name": "krutsko/eureka",
"path": "eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java",
"license": "apache-2.0",
"size": 16912
} | [
"com.netflix.discovery.EurekaClientConfig",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"java.util.Set",
"java.util.TreeMap",
"java.util.TreeSet"
] | import com.netflix.discovery.EurekaClientConfig; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; | import com.netflix.discovery.*; import java.util.*; | [
"com.netflix.discovery",
"java.util"
] | com.netflix.discovery; java.util; | 1,326,265 |
public static Map<Integer, Set<String>> getComponents(QueryHandler graph) {
int nextComponentId = 0;
List<Vertex> vertices = new ArrayList<>(graph.getVertices());
Map<Integer, Set<String>> mapping = new HashMap<>();
//While there are vertices that do not belong to a component
while (vertices.size() != 0) {
//init a new component
int componentId = nextComponentId++;
List<Long> nextVertices = Lists.newArrayList(vertices.remove(0).getId());
mapping.put(
componentId,
Sets.newHashSet(graph.getVertexById(nextVertices.get(0)).getVariable())
);
//While we find new connected vertices
while (nextVertices.size() != 0) {
List<Long> currentVertices = nextVertices;
nextVertices = new ArrayList<>();
for (Long vertexId : currentVertices) {
// Expand each vertex from the previouse iteration
nextVertices.addAll(
graph.getEdges()
.stream()
.filter(edge ->
edge.getSourceVertexId().equals(vertexId) ||
edge.getTargetVertexId().equals(vertexId)
)
.map(edge -> edge.getSourceVertexId().equals(vertexId) ?
edge.getTargetVertexId() : edge.getSourceVertexId()
).filter(id -> vertices.removeIf(v -> v.getId() == id))
.collect(Collectors.toList())
);
}
// Assign all newly found vertices to the component
mapping.get(componentId).addAll(
nextVertices
.stream()
.map(id -> graph.getVertexById(id).getVariable())
.collect(Collectors.toList())
);
}
}
return mapping;
} | static Map<Integer, Set<String>> function(QueryHandler graph) { int nextComponentId = 0; List<Vertex> vertices = new ArrayList<>(graph.getVertices()); Map<Integer, Set<String>> mapping = new HashMap<>(); while (vertices.size() != 0) { int componentId = nextComponentId++; List<Long> nextVertices = Lists.newArrayList(vertices.remove(0).getId()); mapping.put( componentId, Sets.newHashSet(graph.getVertexById(nextVertices.get(0)).getVariable()) ); while (nextVertices.size() != 0) { List<Long> currentVertices = nextVertices; nextVertices = new ArrayList<>(); for (Long vertexId : currentVertices) { nextVertices.addAll( graph.getEdges() .stream() .filter(edge -> edge.getSourceVertexId().equals(vertexId) edge.getTargetVertexId().equals(vertexId) ) .map(edge -> edge.getSourceVertexId().equals(vertexId) ? edge.getTargetVertexId() : edge.getSourceVertexId() ).filter(id -> vertices.removeIf(v -> v.getId() == id)) .collect(Collectors.toList()) ); } mapping.get(componentId).addAll( nextVertices .stream() .map(id -> graph.getVertexById(id).getVariable()) .collect(Collectors.toList()) ); } } return mapping; } | /**
* Computes the graphs connected components
*
* @param graph input graph
* @return connected components
*/ | Computes the graphs connected components | getComponents | {
"repo_name": "galpha/gradoop",
"path": "gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/common/query/GraphMetrics.java",
"license": "apache-2.0",
"size": 4939
} | [
"com.google.common.collect.Lists",
"com.google.common.collect.Sets",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.Set",
"java.util.stream.Collectors",
"org.gradoop.gdl.model.Vertex"
] | import com.google.common.collect.Lists; import com.google.common.collect.Sets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.gradoop.gdl.model.Vertex; | import com.google.common.collect.*; import java.util.*; import java.util.stream.*; import org.gradoop.gdl.model.*; | [
"com.google.common",
"java.util",
"org.gradoop.gdl"
] | com.google.common; java.util; org.gradoop.gdl; | 648,392 |
public void onDestroy() {
Log.d(TAG, ">>> FMRadioEMActivity.onDestroy");
mIsDestroying = true;
mHandler.removeCallbacks(null);
if (null != mHeadsetConnectionReceiver) {
Log.d(TAG, "Unregister headset broadcast receiver.");
unregisterReceiver(mHeadsetConnectionReceiver);
mHeadsetConnectionReceiver = null;
}
// Should powerdown FM.
if (mIsPlaying) {
Log.d(TAG, "FM is Playing. So stop it.");
// powerDown();
mService.powerDownAsync();
mIsPlaying = false;
}
if (null != mService) {
mService.unregisterFmRadioListener(mFmRadioListener);
}
mService = null;
mFmRadioListener = null;
Log.d(TAG, "<<< FMRadioEMActivity.onDestroy");
super.onDestroy();
} | void function() { Log.d(TAG, STR); mIsDestroying = true; mHandler.removeCallbacks(null); if (null != mHeadsetConnectionReceiver) { Log.d(TAG, STR); unregisterReceiver(mHeadsetConnectionReceiver); mHeadsetConnectionReceiver = null; } if (mIsPlaying) { Log.d(TAG, STR); mService.powerDownAsync(); mIsPlaying = false; } if (null != mService) { mService.unregisterFmRadioListener(mFmRadioListener); } mService = null; mFmRadioListener = null; Log.d(TAG, STR); super.onDestroy(); } | /**
* called when activity destroy
*/ | called when activity destroy | onDestroy | {
"repo_name": "darklord4822/android_device_smart_sprint4g",
"path": "mtk/FmRadio/src/com/mediatek/fmradio/FmRadioEmActivity.java",
"license": "gpl-2.0",
"size": 41167
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,426,776 |
public boolean saslConnect(InputStream inS, OutputStream outS)
throws IOException {
DataInputStream inStream = new DataInputStream(new BufferedInputStream(inS));
DataOutputStream outStream = new DataOutputStream(new BufferedOutputStream(
outS));
try {
byte[] saslToken = new byte[0];
if (saslClient.hasInitialResponse())
saslToken = saslClient.evaluateChallenge(saslToken);
if (saslToken != null) {
outStream.writeInt(saslToken.length);
outStream.write(saslToken, 0, saslToken.length);
outStream.flush();
if (LOG.isDebugEnabled())
LOG.debug("Have sent token of size " + saslToken.length
+ " from initSASLContext.");
}
if (!saslClient.isComplete()) {
readStatus(inStream);
int len = inStream.readInt();
if (len == SaslUtil.SWITCH_TO_SIMPLE_AUTH) {
if (!fallbackAllowed) {
throw new IOException("Server asks us to fall back to SIMPLE auth, " +
"but this client is configured to only allow secure connections.");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Server asks us to fall back to simple auth.");
}
saslClient.dispose();
return false;
}
saslToken = new byte[len];
if (LOG.isDebugEnabled())
LOG.debug("Will read input token of size " + saslToken.length
+ " for processing by initSASLContext");
inStream.readFully(saslToken);
}
while (!saslClient.isComplete()) {
saslToken = saslClient.evaluateChallenge(saslToken);
if (saslToken != null) {
if (LOG.isDebugEnabled())
LOG.debug("Will send token of size " + saslToken.length
+ " from initSASLContext.");
outStream.writeInt(saslToken.length);
outStream.write(saslToken, 0, saslToken.length);
outStream.flush();
}
if (!saslClient.isComplete()) {
readStatus(inStream);
saslToken = new byte[inStream.readInt()];
if (LOG.isDebugEnabled())
LOG.debug("Will read input token of size " + saslToken.length
+ " for processing by initSASLContext");
inStream.readFully(saslToken);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("SASL client context established. Negotiated QoP: "
+ saslClient.getNegotiatedProperty(Sasl.QOP));
}
return true;
} catch (IOException e) {
try {
saslClient.dispose();
} catch (SaslException ignored) {
// ignore further exceptions during cleanup
}
throw e;
}
} | boolean function(InputStream inS, OutputStream outS) throws IOException { DataInputStream inStream = new DataInputStream(new BufferedInputStream(inS)); DataOutputStream outStream = new DataOutputStream(new BufferedOutputStream( outS)); try { byte[] saslToken = new byte[0]; if (saslClient.hasInitialResponse()) saslToken = saslClient.evaluateChallenge(saslToken); if (saslToken != null) { outStream.writeInt(saslToken.length); outStream.write(saslToken, 0, saslToken.length); outStream.flush(); if (LOG.isDebugEnabled()) LOG.debug(STR + saslToken.length + STR); } if (!saslClient.isComplete()) { readStatus(inStream); int len = inStream.readInt(); if (len == SaslUtil.SWITCH_TO_SIMPLE_AUTH) { if (!fallbackAllowed) { throw new IOException(STR + STR); } if (LOG.isDebugEnabled()) { LOG.debug(STR); } saslClient.dispose(); return false; } saslToken = new byte[len]; if (LOG.isDebugEnabled()) LOG.debug(STR + saslToken.length + STR); inStream.readFully(saslToken); } while (!saslClient.isComplete()) { saslToken = saslClient.evaluateChallenge(saslToken); if (saslToken != null) { if (LOG.isDebugEnabled()) LOG.debug(STR + saslToken.length + STR); outStream.writeInt(saslToken.length); outStream.write(saslToken, 0, saslToken.length); outStream.flush(); } if (!saslClient.isComplete()) { readStatus(inStream); saslToken = new byte[inStream.readInt()]; if (LOG.isDebugEnabled()) LOG.debug(STR + saslToken.length + STR); inStream.readFully(saslToken); } } if (LOG.isDebugEnabled()) { LOG.debug(STR + saslClient.getNegotiatedProperty(Sasl.QOP)); } return true; } catch (IOException e) { try { saslClient.dispose(); } catch (SaslException ignored) { } throw e; } } | /**
* Do client side SASL authentication with server via the given InputStream
* and OutputStream
*
* @param inS
* InputStream to use
* @param outS
* OutputStream to use
* @return true if connection is set up, or false if needs to switch
* to simple Auth.
* @throws IOException
*/ | Do client side SASL authentication with server via the given InputStream and OutputStream | saslConnect | {
"repo_name": "throughsky/lywebank",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/security/HBaseSaslRpcClient.java",
"license": "apache-2.0",
"size": 12082
} | [
"java.io.BufferedInputStream",
"java.io.BufferedOutputStream",
"java.io.DataInputStream",
"java.io.DataOutputStream",
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream",
"javax.security.sasl.Sasl",
"javax.security.sasl.SaslException"
] | import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.security.sasl.Sasl; import javax.security.sasl.SaslException; | import java.io.*; import javax.security.sasl.*; | [
"java.io",
"javax.security"
] | java.io; javax.security; | 1,916,482 |
public float[] SFColorRGBA(String value) throws InvalidFieldFormatException {
throw new InvalidFieldFormatException(RGBA_SPT_MSG);
} | float[] function(String value) throws InvalidFieldFormatException { throw new InvalidFieldFormatException(RGBA_SPT_MSG); } | /**
* Parse a SFColorRGBA value. The color differs from the float value by being
* clamped between 0 and 1. Any more than a single colour value is ignored.
* <pre>
* SFColorRGBA ::=
* NUMBER_LITERAL NUMBER_LITERAL NUMBER_LITERAL NUMBER_LITERAL
* </pre>
*
* @param value The raw value as a string to be parsed
* @return The three color components
* @throws InvalidFieldFormatException The field does not match the
* required profile
*/ | Parse a SFColorRGBA value. The color differs from the float value by being clamped between 0 and 1. Any more than a single colour value is ignored. <code> SFColorRGBA ::= NUMBER_LITERAL NUMBER_LITERAL NUMBER_LITERAL NUMBER_LITERAL </code> | SFColorRGBA | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/parser/vrml97/VRML97FieldReader.java",
"license": "gpl-2.0",
"size": 61534
} | [
"org.web3d.vrml.lang.InvalidFieldFormatException"
] | import org.web3d.vrml.lang.InvalidFieldFormatException; | import org.web3d.vrml.lang.*; | [
"org.web3d.vrml"
] | org.web3d.vrml; | 2,840,464 |
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
TextUtils.isEmpty(signature)) {
Log.e(TAG, "Purchase verification failed: missing data.");
return false;
}
PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);
} | if (TextUtils.isEmpty(signedData) TextUtils.isEmpty(base64PublicKey) TextUtils.isEmpty(signature)) { Log.e(TAG, STR); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); } | /**
* Verifies that the data was signed with the given signature, and returns
* the verified purchase. The data is in JSON format and signed
* with a private key. The data also contains the {@link PurchaseState}
* and product ID of the purchase.
* @param base64PublicKey the base64-encoded public key to use for verifying.
* @param signedData the signed JSON string (signed, not encrypted)
* @param signature the signature for the data, signed with the private key
*/ | Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. The data also contains the <code>PurchaseState</code> and product ID of the purchase | verifyPurchase | {
"repo_name": "OpenSilk/Orpheus",
"path": "iabgplay/src/main/java/org/opensilk/iab/gplay/util/Security.java",
"license": "gpl-3.0",
"size": 4957
} | [
"android.text.TextUtils",
"android.util.Log",
"java.security.PublicKey"
] | import android.text.TextUtils; import android.util.Log; import java.security.PublicKey; | import android.text.*; import android.util.*; import java.security.*; | [
"android.text",
"android.util",
"java.security"
] | android.text; android.util; java.security; | 836,943 |
public boolean ready() throws IOException {
return false;
} // ready()
| boolean function() throws IOException { return false; } | /**
* Tell whether this stream is ready to be read.
*
* @return True if the next read() is guaranteed not to block for input,
* false otherwise. Note that returning false does not guarantee that the
* next read will block.
*
* @exception IOException If an I/O error occurs
*/ | Tell whether this stream is ready to be read | ready | {
"repo_name": "AaronZhangL/SplitCharater",
"path": "xerces-2_11_0/src/org/apache/xerces/impl/io/ASCIIReader.java",
"license": "gpl-2.0",
"size": 9204
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,286,935 |
@Test
public void testDisableSASIIndexes()
{
createTable("CREATE TABLE %s (k int PRIMARY KEY, v int)");
boolean enableSASIIndexes = DatabaseDescriptor.getSASIIndexesEnabled();
try
{
DatabaseDescriptor.setSASIIndexesEnabled(false);
createIndex("CREATE CUSTOM INDEX ON %s (v) USING 'org.apache.cassandra.index.sasi.SASIIndex'");
Assert.fail("Should not be able to create a SASI index if they are disabled");
}
catch (RuntimeException e)
{
Throwable cause = e.getCause();
Assert.assertNotNull(cause);
Assert.assertTrue(cause instanceof InvalidRequestException);
Assert.assertTrue(cause.getMessage().contains("SASI indexes are disabled"));
}
finally
{
DatabaseDescriptor.setSASIIndexesEnabled(enableSASIIndexes);
}
} | void function() { createTable(STR); boolean enableSASIIndexes = DatabaseDescriptor.getSASIIndexesEnabled(); try { DatabaseDescriptor.setSASIIndexesEnabled(false); createIndex(STR); Assert.fail(STR); } catch (RuntimeException e) { Throwable cause = e.getCause(); Assert.assertNotNull(cause); Assert.assertTrue(cause instanceof InvalidRequestException); Assert.assertTrue(cause.getMessage().contains(STR)); } finally { DatabaseDescriptor.setSASIIndexesEnabled(enableSASIIndexes); } } | /**
* Tests the configuration flag to disable SASI indexes.
*/ | Tests the configuration flag to disable SASI indexes | testDisableSASIIndexes | {
"repo_name": "instaclustr/cassandra",
"path": "test/unit/org/apache/cassandra/index/sasi/SASICQLTest.java",
"license": "apache-2.0",
"size": 15156
} | [
"org.apache.cassandra.config.DatabaseDescriptor",
"org.apache.cassandra.exceptions.InvalidRequestException",
"org.junit.Assert"
] | import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.exceptions.InvalidRequestException; import org.junit.Assert; | import org.apache.cassandra.config.*; import org.apache.cassandra.exceptions.*; import org.junit.*; | [
"org.apache.cassandra",
"org.junit"
] | org.apache.cassandra; org.junit; | 1,710,271 |
Map<Integer, List<String>> getAccessionNumbersMapForProteinSequences(Set<Integer> proteinSequenceLists, Integer databaseId); | Map<Integer, List<String>> getAccessionNumbersMapForProteinSequences(Set<Integer> proteinSequenceLists, Integer databaseId); | /**
* Look at all proteins given {@link ProteinSequenceList} ids. For each protein sequence list
* load all accession numbers associated with it and put them in a map keyed by their id.
* Only limit yourself to accession numbers from a given database.
*
* @param proteinSequenceLists Ids of protein sequence lists to load the ids for.
* @param databaseId Database to get the accession numbers from. If null, all matching accnums are returned.
* @return Map from {@link ProteinSequenceList} id to list of accession numbers for that group.
*/ | Look at all proteins given <code>ProteinSequenceList</code> ids. For each protein sequence list load all accession numbers associated with it and put them in a map keyed by their id. Only limit yourself to accession numbers from a given database | getAccessionNumbersMapForProteinSequences | {
"repo_name": "romanzenka/swift",
"path": "services/search-db/src/main/java/edu/mayo/mprc/searchdb/dao/SearchDbDao.java",
"license": "apache-2.0",
"size": 6854
} | [
"java.util.List",
"java.util.Map",
"java.util.Set"
] | import java.util.List; import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 530,444 |
@SuppressWarnings("unchecked")
public static String[] getValuesFromRequestParameterMap(HttpServletRequest req, String key) {
return getValuesFromParamMap(req.getParameterMap(), key);
} | @SuppressWarnings(STR) static String[] function(HttpServletRequest req, String key) { return getValuesFromParamMap(req.getParameterMap(), key); } | /**
* Returns all values for the key in the request's parameter map, or null if key not found.
*
* @param req An HttpServletRequest which contains the parameters map
*/ | Returns all values for the key in the request's parameter map, or null if key not found | getValuesFromRequestParameterMap | {
"repo_name": "whipermr5/teammates",
"path": "src/main/java/teammates/common/util/HttpRequestHelper.java",
"license": "gpl-2.0",
"size": 4000
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 1,006,356 |
private void buildCqlQueryable(List<String> queryables, String name, String value) {
if (value.length() != 0)
if (value.contains("%"))
queryables.add(name + " like '" + value + "'");
else
queryables.add(name + " = '" + value + "'");
} | void function(List<String> queryables, String name, String value) { if (value.length() != 0) if (value.contains("%")) queryables.add(name + STR + value + "'"); else queryables.add(name + STR + value + "'"); } | /**
* Build CQL from user entry. If parameter value
* contains '%', then the like operator is used.
*/ | Build CQL from user entry. If parameter value contains '%', then the like operator is used | buildCqlQueryable | {
"repo_name": "OpenWIS/openwis",
"path": "openwis-metadataportal/openwis-portal/src/main/java/org/openwis/metadataportal/kernel/harvest/csw/CSWHarvester.java",
"license": "gpl-3.0",
"size": 24156
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,716,087 |
public void addExperience(int skill, double exp) {
final int oldLevel = levels[skill];
exps[skill] += exp;
if (exps[skill] > MAXIMUM_EXP) {
exps[skill] = MAXIMUM_EXP;
}
final int newLevel = getLevelForExperience(skill);
final int levelDiff = newLevel - oldLevel;
if (levelDiff > 0) {
levels[skill] += levelDiff;
player.getUpdateFlags().flag(UpdateFlag.APPEARANCE);
}
player.getActionSender().sendSkill(skill);
} | void function(int skill, double exp) { final int oldLevel = levels[skill]; exps[skill] += exp; if (exps[skill] > MAXIMUM_EXP) { exps[skill] = MAXIMUM_EXP; } final int newLevel = getLevelForExperience(skill); final int levelDiff = newLevel - oldLevel; if (levelDiff > 0) { levels[skill] += levelDiff; player.getUpdateFlags().flag(UpdateFlag.APPEARANCE); } player.getActionSender().sendSkill(skill); } | /**
* Adds experience.
*
* @param skill
* The skill.
* @param exp
* The experience to add.
*/ | Adds experience | addExperience | {
"repo_name": "lightstorm/lightstorm-server",
"path": "src/org/hyperion/rs2/model/Skills.java",
"license": "mit",
"size": 7137
} | [
"org.hyperion.rs2.model.UpdateFlags"
] | import org.hyperion.rs2.model.UpdateFlags; | import org.hyperion.rs2.model.*; | [
"org.hyperion.rs2"
] | org.hyperion.rs2; | 575,893 |
try {
GoogleCredential credentials = new GoogleCredential.Builder().setTransport(TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(accountId)
.setServiceAccountScopes(scopes)
.setServiceAccountPrivateKeyFromP12File(p12File)
.build();
return credentials;
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | try { GoogleCredential credentials = new GoogleCredential.Builder().setTransport(TRANSPORT) .setJsonFactory(JSON_FACTORY) .setServiceAccountId(accountId) .setServiceAccountScopes(scopes) .setServiceAccountPrivateKeyFromP12File(p12File) .build(); return credentials; } catch (GeneralSecurityException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } | /**
* Authorizes the installed application to access user's protected data.
*/ | Authorizes the installed application to access user's protected data | authorize | {
"repo_name": "kamiru78/be-bigquery",
"path": "src/main/java/jp/gr/java_conf/bebigquery/AuthorizationLogic.java",
"license": "apache-2.0",
"size": 2639
} | [
"com.google.api.client.googleapis.auth.oauth2.GoogleCredential",
"java.io.IOException",
"java.security.GeneralSecurityException"
] | import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; import java.io.IOException; import java.security.GeneralSecurityException; | import com.google.api.client.googleapis.auth.oauth2.*; import java.io.*; import java.security.*; | [
"com.google.api",
"java.io",
"java.security"
] | com.google.api; java.io; java.security; | 525,986 |
protected void customizeConnection(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) {
}
| void function(String pathInContext, String pathParams, HttpRequest request, URLConnection connection) { } | /**
* Customize proxy URL connection. Method to allow derived handlers to customize the connection.
*/ | Customize proxy URL connection. Method to allow derived handlers to customize the connection | customizeConnection | {
"repo_name": "hugs/selenium",
"path": "remote/server/src/java/org/openqa/selenium/server/ProxyHandler.java",
"license": "apache-2.0",
"size": 38311
} | [
"java.net.URLConnection",
"org.openqa.jetty.http.HttpRequest"
] | import java.net.URLConnection; import org.openqa.jetty.http.HttpRequest; | import java.net.*; import org.openqa.jetty.http.*; | [
"java.net",
"org.openqa.jetty"
] | java.net; org.openqa.jetty; | 2,192,284 |
public void setPortfolio(final Portfolio portfolio) {
put(PORTFOLIO, portfolio);
} | void function(final Portfolio portfolio) { put(PORTFOLIO, portfolio); } | /**
* Sets the portfolio being compiled, if any.
*
* @param portfolio the portfolio object, or null if there is none for the current compilation
*/ | Sets the portfolio being compiled, if any | setPortfolio | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Engine/src/main/java/com/opengamma/engine/function/FunctionCompilationContext.java",
"license": "apache-2.0",
"size": 13824
} | [
"com.opengamma.core.position.Portfolio"
] | import com.opengamma.core.position.Portfolio; | import com.opengamma.core.position.*; | [
"com.opengamma.core"
] | com.opengamma.core; | 610,094 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<PollResult<AccountInner>, AccountInner> beginCreate(
String resourceGroupName, String accountName, AccountInner account) {
return beginCreateAsync(resourceGroupName, accountName, account).getSyncPoller();
} | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<AccountInner>, AccountInner> function( String resourceGroupName, String accountName, AccountInner account) { return beginCreateAsync(resourceGroupName, accountName, account).getSyncPoller(); } | /**
* Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for
* developer to access intelligent APIs. It's also the resource type for billing.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName The name of Cognitive Services account.
* @param account The parameters to provide for the created account.
* @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 cognitive Services account is an Azure resource representing the provisioned account, it's type, location
* and SKU.
*/ | Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent APIs. It's also the resource type for billing | beginCreate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java",
"license": "mit",
"size": 114340
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller",
"com.azure.resourcemanager.cognitiveservices.fluent.models.AccountInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.cognitiveservices.fluent.models.AccountInner; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.cognitiveservices.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 797,741 |
private boolean checkDataQuality(Optional<Object> schema)
throws Exception {
if (this.branches > 1) {
this.forkTaskState.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED,
this.taskState.getProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED));
this.forkTaskState.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXTRACTED,
this.taskState.getProp(ConfigurationKeys.EXTRACTOR_ROWS_EXTRACTED));
}
String writerRecordsWrittenKey =
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_RECORDS_WRITTEN, this.branches, this.index);
if (this.writer.isPresent()) {
this.forkTaskState.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, this.writer.get().recordsWritten());
this.taskState.setProp(writerRecordsWrittenKey, this.writer.get().recordsWritten());
} else {
this.forkTaskState.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, 0L);
this.taskState.setProp(writerRecordsWrittenKey, 0L);
}
if (schema.isPresent()) {
this.forkTaskState.setProp(ConfigurationKeys.EXTRACT_SCHEMA, schema.get().toString());
}
try {
// Do task-level quality checking
TaskLevelPolicyCheckResults taskResults =
this.taskContext.getTaskLevelPolicyChecker(this.forkTaskState, this.branches > 1 ? this.index : -1)
.executePolicies();
TaskPublisher publisher = this.taskContext.getTaskPublisher(this.forkTaskState, taskResults);
switch (publisher.canPublish()) {
case SUCCESS:
return true;
case CLEANUP_FAIL:
this.logger.error("Cleanup failed for task " + this.taskId);
break;
case POLICY_TESTS_FAIL:
this.logger.error("Not all quality checking passed for task " + this.taskId);
break;
case COMPONENTS_NOT_FINISHED:
this.logger.error("Not all components completed for task " + this.taskId);
break;
default:
break;
}
return false;
} catch (Throwable t) {
this.logger.error("Failed to check task-level data quality", t);
return false;
}
} | boolean function(Optional<Object> schema) throws Exception { if (this.branches > 1) { this.forkTaskState.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED, this.taskState.getProp(ConfigurationKeys.EXTRACTOR_ROWS_EXPECTED)); this.forkTaskState.setProp(ConfigurationKeys.EXTRACTOR_ROWS_EXTRACTED, this.taskState.getProp(ConfigurationKeys.EXTRACTOR_ROWS_EXTRACTED)); } String writerRecordsWrittenKey = ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_RECORDS_WRITTEN, this.branches, this.index); if (this.writer.isPresent()) { this.forkTaskState.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, this.writer.get().recordsWritten()); this.taskState.setProp(writerRecordsWrittenKey, this.writer.get().recordsWritten()); } else { this.forkTaskState.setProp(ConfigurationKeys.WRITER_ROWS_WRITTEN, 0L); this.taskState.setProp(writerRecordsWrittenKey, 0L); } if (schema.isPresent()) { this.forkTaskState.setProp(ConfigurationKeys.EXTRACT_SCHEMA, schema.get().toString()); } try { TaskLevelPolicyCheckResults taskResults = this.taskContext.getTaskLevelPolicyChecker(this.forkTaskState, this.branches > 1 ? this.index : -1) .executePolicies(); TaskPublisher publisher = this.taskContext.getTaskPublisher(this.forkTaskState, taskResults); switch (publisher.canPublish()) { case SUCCESS: return true; case CLEANUP_FAIL: this.logger.error(STR + this.taskId); break; case POLICY_TESTS_FAIL: this.logger.error(STR + this.taskId); break; case COMPONENTS_NOT_FINISHED: this.logger.error(STR + this.taskId); break; default: break; } return false; } catch (Throwable t) { this.logger.error(STR, t); return false; } } | /**
* Check data quality.
*
* @return whether data publishing is successful and data should be committed
*/ | Check data quality | checkDataQuality | {
"repo_name": "sahilTakiar/gobblin",
"path": "gobblin-runtime/src/main/java/gobblin/runtime/fork/Fork.java",
"license": "apache-2.0",
"size": 24991
} | [
"com.google.common.base.Optional"
] | import com.google.common.base.Optional; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,897,455 |
protected void weave(Spell... spells) {
super.setParent(spells[0]);
for (int i = 0; i < spells.length - 1; ++i) {
spells[i].setParent(spells[i + 1]);
}
} | void function(Spell... spells) { super.setParent(spells[0]); for (int i = 0; i < spells.length - 1; ++i) { spells[i].setParent(spells[i + 1]); } } | /**Weaves this spell together with the given spells,
* so that the effects of all the spells are combined.
*
* @param spells Spells to weave in.
* @return This spell (no new spell).
*/ | Weaves this spell together with the given spells, so that the effects of all the spells are combined | weave | {
"repo_name": "machisuji/Wandledi",
"path": "core/src/main/java/org/wandledi/spells/ComplexSpell.java",
"license": "mit",
"size": 2426
} | [
"org.wandledi.Spell"
] | import org.wandledi.Spell; | import org.wandledi.*; | [
"org.wandledi"
] | org.wandledi; | 468,490 |
default Web3jEndpointProducerBuilder addresses(List<String> addresses) {
doSetProperty("addresses", addresses);
return this;
} | default Web3jEndpointProducerBuilder addresses(List<String> addresses) { doSetProperty(STR, addresses); return this; } | /**
* Contract address or a list of addresses.
*
* The option is a: <code>java.util.List<java.lang.String></code>
* type.
*
* Group: common
*/ | Contract address or a list of addresses. The option is a: <code>java.util.List<java.lang.String></code> type. Group: common | addresses | {
"repo_name": "nicolaferraro/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 48011
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 289,130 |
private void initialize() {
rootFrame = new JFrame();
rootFrame.setBounds(100, 100, 450, 500);
rootFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fc = new JFileChooser();
fcSecret = new JFileChooser();
fcOutput = new JFileChooser();
fcTianGangTu = new JFileChooser();
fcSecretOutput = new JFileChooser();
rootFrame.getContentPane().setLayout(null);
JPanel head_panel = new JPanel();
head_panel.setBounds(6, 6, 438, 55);
rootFrame.getContentPane().add(head_panel);
head_panel.setLayout(null);
JLabel head_Label = new JLabel("天罡圖");
head_Label.setBounds(198, 3, 54, 36);
head_Label.setHorizontalAlignment(SwingConstants.CENTER);
head_Label.setFont(new Font("Lucida Grande", Font.PLAIN, 18));
head_panel.add(head_Label);
JPanel panel = new JPanel();
panel.setBounds(6, 379, 438, 93);
rootFrame.getContentPane().add(panel);
panel.setLayout(null);
JLabel lblNewLabel_2 = new JLabel("運行狀態");
lblNewLabel_2.setBounds(17, 17, 52, 16);
panel.add(lblNewLabel_2);
enStatus_Label = new JLabel("");
enStatus_Label.setBounds(91, 17, 320, 16);
panel.add(enStatus_Label);
| void function() { rootFrame = new JFrame(); rootFrame.setBounds(100, 100, 450, 500); rootFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fc = new JFileChooser(); fcSecret = new JFileChooser(); fcOutput = new JFileChooser(); fcTianGangTu = new JFileChooser(); fcSecretOutput = new JFileChooser(); rootFrame.getContentPane().setLayout(null); JPanel head_panel = new JPanel(); head_panel.setBounds(6, 6, 438, 55); rootFrame.getContentPane().add(head_panel); head_panel.setLayout(null); JLabel head_Label = new JLabel("天罡圖"); head_Label.setBounds(198, 3, 54, 36); head_Label.setHorizontalAlignment(SwingConstants.CENTER); head_Label.setFont(new Font(STR, Font.PLAIN, 18)); head_panel.add(head_Label); JPanel panel = new JPanel(); panel.setBounds(6, 379, 438, 93); rootFrame.getContentPane().add(panel); panel.setLayout(null); JLabel lblNewLabel_2 = new JLabel("運行狀態"); lblNewLabel_2.setBounds(17, 17, 52, 16); panel.add(lblNewLabel_2); enStatus_Label = new JLabel(""); enStatus_Label.setBounds(91, 17, 320, 16); panel.add(enStatus_Label); | /**
* Initialize the contents of the frame.
*/ | Initialize the contents of the frame | initialize | {
"repo_name": "tiangangtu/tiangangtu-gui",
"path": "src/com/tiangangtu/gui/GUI.java",
"license": "apache-2.0",
"size": 16777
} | [
"java.awt.Font",
"javax.swing.JFileChooser",
"javax.swing.JFrame",
"javax.swing.JLabel",
"javax.swing.JPanel",
"javax.swing.SwingConstants"
] | import java.awt.Font; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 992,363 |
List<Operation> parse(Reader r) throws RepoInitParsingException; | List<Operation> parse(Reader r) throws RepoInitParsingException; | /** Parse the supplied input.
* @param r Input in ACL definitions format. The reader is closed
* by this method.
* @throws AclParsingException on parsing errors
*/ | Parse the supplied input | parse | {
"repo_name": "wimsymons/sling",
"path": "bundles/extensions/repoinit/parser/src/main/java/org/apache/sling/repoinit/parser/RepoInitParser.java",
"license": "apache-2.0",
"size": 1304
} | [
"java.io.Reader",
"java.util.List",
"org.apache.sling.repoinit.parser.operations.Operation"
] | import java.io.Reader; import java.util.List; import org.apache.sling.repoinit.parser.operations.Operation; | import java.io.*; import java.util.*; import org.apache.sling.repoinit.parser.operations.*; | [
"java.io",
"java.util",
"org.apache.sling"
] | java.io; java.util; org.apache.sling; | 1,321,673 |
@Override
@WebApiDescription(title = "Get Person Information", description = "Get information for the person with id 'personId'")
@WebApiParam(name = "personId", title = "The person's username")
public Person readById(String personId, Parameters parameters)
{
Person person = people.getPerson(personId);
return person;
}
| @WebApiDescription(title = STR, description = STR) @WebApiParam(name = STR, title = STR) Person function(String personId, Parameters parameters) { Person person = people.getPerson(personId); return person; } | /**
* Get a person by userName.
*
* @see org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction.ReadById#readById(String, org.alfresco.rest.framework.resource.parameters.Parameters)
*/ | Get a person by userName | readById | {
"repo_name": "Alfresco/community-edition",
"path": "projects/remote-api/source/java/org/alfresco/rest/api/people/PeopleEntityResource.java",
"license": "lgpl-3.0",
"size": 2862
} | [
"org.alfresco.rest.api.model.Person",
"org.alfresco.rest.framework.WebApiDescription",
"org.alfresco.rest.framework.WebApiParam",
"org.alfresco.rest.framework.resource.parameters.Parameters"
] | import org.alfresco.rest.api.model.Person; import org.alfresco.rest.framework.WebApiDescription; import org.alfresco.rest.framework.WebApiParam; import org.alfresco.rest.framework.resource.parameters.Parameters; | import org.alfresco.rest.api.model.*; import org.alfresco.rest.framework.*; import org.alfresco.rest.framework.resource.parameters.*; | [
"org.alfresco.rest"
] | org.alfresco.rest; | 200,826 |
@ApiModelProperty(required = true, value = "Time that the war was declared")
public OffsetDateTime getDeclared() {
return declared;
} | @ApiModelProperty(required = true, value = STR) OffsetDateTime function() { return declared; } | /**
* Time that the war was declared
*
* @return declared
**/ | Time that the war was declared | getDeclared | {
"repo_name": "burberius/eve-esi",
"path": "src/main/java/net/troja/eve/esi/model/WarResponse.java",
"license": "apache-2.0",
"size": 10080
} | [
"io.swagger.annotations.ApiModelProperty",
"java.time.OffsetDateTime"
] | import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; | import io.swagger.annotations.*; import java.time.*; | [
"io.swagger.annotations",
"java.time"
] | io.swagger.annotations; java.time; | 10,073 |
public void addCertificate(AddCertificates addcert); | void function(AddCertificates addcert); | /**
* Add the given direct certificates.
*
* @param addcert
*/ | Add the given direct certificates | addCertificate | {
"repo_name": "AurionProject/Aurion",
"path": "Product/Production/Adapters/General/CONNECTAdminGUI/src/main/java/gov/hhs/fha/nhinc/admingui/services/DirectService.java",
"license": "bsd-3-clause",
"size": 6917
} | [
"org.nhind.config.AddCertificates"
] | import org.nhind.config.AddCertificates; | import org.nhind.config.*; | [
"org.nhind.config"
] | org.nhind.config; | 2,585,455 |
@StrutsTagAttribute(description="Deprecated. Use 'var' instead")
public void setId(String id) {
setVar(id);
} | @StrutsTagAttribute(description=STR) void function(String id) { setVar(id); } | /**
* To keep backward compatibility
* TODO remove after 2.1
*/ | To keep backward compatibility TODO remove after 2.1 | setId | {
"repo_name": "TheTypoMaster/struts-2.3.24",
"path": "src/core/src/main/java/org/apache/struts2/components/ContextBean.java",
"license": "apache-2.0",
"size": 1851
} | [
"org.apache.struts2.views.annotations.StrutsTagAttribute"
] | import org.apache.struts2.views.annotations.StrutsTagAttribute; | import org.apache.struts2.views.annotations.*; | [
"org.apache.struts2"
] | org.apache.struts2; | 1,798,003 |
public String getIdentifier() {
return ID3v24Frames.FRAME_ID_URL_COPYRIGHT;
} | String function() { return ID3v24Frames.FRAME_ID_URL_COPYRIGHT; } | /**
* The ID3v2 frame identifier
*
* @return the ID3v2 frame identifier for this frame type
*/ | The ID3v2 frame identifier | getIdentifier | {
"repo_name": "dubenju/javay",
"path": "src/java/org/jaudiotagger/tag/id3/framebody/FrameBodyWCOP.java",
"license": "apache-2.0",
"size": 2494
} | [
"org.jaudiotagger.tag.id3.ID3v24Frames"
] | import org.jaudiotagger.tag.id3.ID3v24Frames; | import org.jaudiotagger.tag.id3.*; | [
"org.jaudiotagger.tag"
] | org.jaudiotagger.tag; | 195,593 |
public String getServerErrorCodeVerbose()
{
String[] detail = ErrorCodes.getDescription(sftpErrorCode);
if (detail == null)
return "The error code " + sftpErrorCode + " is unknown.";
return detail[1];
} | String function() { String[] detail = ErrorCodes.getDescription(sftpErrorCode); if (detail == null) return STR + sftpErrorCode + STR; return detail[1]; } | /**
* Get the description of the error code as given in the SFTP specs.
*
* @return e.g., "The filename is not valid."
*/ | Get the description of the error code as given in the SFTP specs | getServerErrorCodeVerbose | {
"repo_name": "mattb243/AmazonEC2Matlab",
"path": "third-party/ganymed-ssh2-build250/src/ch/ethz/ssh2/SFTPException.java",
"license": "bsd-3-clause",
"size": 1981
} | [
"ch.ethz.ssh2.sftp.ErrorCodes"
] | import ch.ethz.ssh2.sftp.ErrorCodes; | import ch.ethz.ssh2.sftp.*; | [
"ch.ethz.ssh2"
] | ch.ethz.ssh2; | 1,336,106 |
public ManagedLedgerConfig setThrottleMarkDelete(double throttleMarkDelete) {
checkArgument(throttleMarkDelete >= 0.0);
this.throttleMarkDelete = throttleMarkDelete;
return this;
} | ManagedLedgerConfig function(double throttleMarkDelete) { checkArgument(throttleMarkDelete >= 0.0); this.throttleMarkDelete = throttleMarkDelete; return this; } | /**
* Set the rate limiter on how many mark-delete calls per second are allowed. If the value is set to 0, the rate
* limiter is disabled. Default is 0.
*
* @param throttleMarkDelete
* the max number of mark-delete calls allowed per second
*/ | Set the rate limiter on how many mark-delete calls per second are allowed. If the value is set to 0, the rate limiter is disabled. Default is 0 | setThrottleMarkDelete | {
"repo_name": "sschepens/pulsar",
"path": "managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedLedgerConfig.java",
"license": "apache-2.0",
"size": 12792
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,740,757 |
public static void insertHistory(Context context, String query, String record) {
SQLiteDatabase db = getDatabase(context);
ContentValues values = new ContentValues();
values.put("query", query);
values.put("record", record);
db.insert("history", null, values);
db.close();
} | static void function(Context context, String query, String record) { SQLiteDatabase db = getDatabase(context); ContentValues values = new ContentValues(); values.put("query", query); values.put(STR, record); db.insert(STR, null, values); db.close(); } | /**
* Insert new item into history
*
* @param context android context
* @param query query to insert
* @param record record to insert
*/ | Insert new item into history | insertHistory | {
"repo_name": "kuroidoruido/KISS",
"path": "app/src/main/java/fr/neamar/kiss/db/DBHelper.java",
"license": "mit",
"size": 5085
} | [
"android.content.ContentValues",
"android.content.Context",
"android.database.sqlite.SQLiteDatabase"
] | import android.content.ContentValues; import android.content.Context; import android.database.sqlite.SQLiteDatabase; | import android.content.*; import android.database.sqlite.*; | [
"android.content",
"android.database"
] | android.content; android.database; | 2,195,221 |
private static boolean useUntrimmedConfigs(BuildOptions options) {
return options.get(CoreOptions.class).configsMode == CoreOptions.ConfigsMode.NOTRIM;
} | static boolean function(BuildOptions options) { return options.get(CoreOptions.class).configsMode == CoreOptions.ConfigsMode.NOTRIM; } | /**
* Returns whether configurations should trim their fragments to only those needed by
* targets and their transitive dependencies.
*/ | Returns whether configurations should trim their fragments to only those needed by targets and their transitive dependencies | useUntrimmedConfigs | {
"repo_name": "davidzchen/bazel",
"path": "src/main/java/com/google/devtools/build/lib/skyframe/PrepareAnalysisPhaseFunction.java",
"license": "apache-2.0",
"size": 18819
} | [
"com.google.devtools.build.lib.analysis.config.BuildOptions",
"com.google.devtools.build.lib.analysis.config.CoreOptions"
] | import com.google.devtools.build.lib.analysis.config.BuildOptions; import com.google.devtools.build.lib.analysis.config.CoreOptions; | import com.google.devtools.build.lib.analysis.config.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,710,131 |
protected byte[] createZipFile(XWikiDocument docs[], String[] encodings, String packageXmlEncoding,
ExtensionId extension) throws Exception
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
ZipEntry zipp = new ZipEntry("package.xml");
zos.putNextEntry(zipp);
zos.write(getEncodedByteArray(getPackageXML(docs, packageXmlEncoding, extension), packageXmlEncoding));
for (int i = 0; i < docs.length; i++) {
String zipEntryName = docs[i].getSpace() + "/" + docs[i].getName();
if (docs[i].getTranslation() != 0) {
zipEntryName += "." + docs[i].getLanguage();
}
ZipEntry zipe = new ZipEntry(zipEntryName);
zos.putNextEntry(zipe);
String xmlCode = docs[i].toXML(false, false, false, false, this.oldcore.getXWikiContext());
zos.write(getEncodedByteArray(xmlCode, encodings[i]));
}
zos.finish();
zos.close();
return baos.toByteArray();
} | byte[] function(XWikiDocument docs[], String[] encodings, String packageXmlEncoding, ExtensionId extension) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream zos = new ZipOutputStream(baos); ZipEntry zipp = new ZipEntry(STR); zos.putNextEntry(zipp); zos.write(getEncodedByteArray(getPackageXML(docs, packageXmlEncoding, extension), packageXmlEncoding)); for (int i = 0; i < docs.length; i++) { String zipEntryName = docs[i].getSpace() + "/" + docs[i].getName(); if (docs[i].getTranslation() != 0) { zipEntryName += "." + docs[i].getLanguage(); } ZipEntry zipe = new ZipEntry(zipEntryName); zos.putNextEntry(zipe); String xmlCode = docs[i].toXML(false, false, false, false, this.oldcore.getXWikiContext()); zos.write(getEncodedByteArray(xmlCode, encodings[i])); } zos.finish(); zos.close(); return baos.toByteArray(); } | /**
* Create a XAR file using java.util.zip.
*
* @param docs The documents to include.
* @param encodings The charset for each document.
* @param packageXmlEncoding The encoding of package.xml
* @param extension the extension id and version or null if none should be added
* @return the XAR file as a byte array.
*/ | Create a XAR file using java.util.zip | createZipFile | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/plugin/packaging/AbstractPackageTest.java",
"license": "lgpl-2.1",
"size": 7898
} | [
"com.xpn.xwiki.doc.XWikiDocument",
"java.io.ByteArrayOutputStream",
"java.util.zip.ZipEntry",
"java.util.zip.ZipOutputStream",
"org.xwiki.extension.ExtensionId"
] | import com.xpn.xwiki.doc.XWikiDocument; import java.io.ByteArrayOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.xwiki.extension.ExtensionId; | import com.xpn.xwiki.doc.*; import java.io.*; import java.util.zip.*; import org.xwiki.extension.*; | [
"com.xpn.xwiki",
"java.io",
"java.util",
"org.xwiki.extension"
] | com.xpn.xwiki; java.io; java.util; org.xwiki.extension; | 2,057,273 |
public FeedbackSessionQuestionsBundle getFeedbackSessionQuestionsForStudent(
String feedbackSessionName, String courseId, String userEmail)
throws EntityDoesNotExistException {
FeedbackSessionAttributes fsa = fsDb.getFeedbackSession(
courseId, feedbackSessionName);
if (fsa == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_GET + courseId + "/" + feedbackSessionName);
}
StudentAttributes student = studentsLogic.getStudentForEmail(courseId, userEmail);
if (student == null) {
throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_STUDENT);
}
Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> bundle = new HashMap<>();
Map<String, Map<String, String>> recipientList = new HashMap<>();
List<FeedbackQuestionAttributes> questions = fqLogic.getFeedbackQuestionsForStudents(feedbackSessionName,
courseId);
Set<String> hiddenInstructorEmails = null;
for (FeedbackQuestionAttributes question : questions) {
if (question.getRecipientType() == FeedbackParticipantType.INSTRUCTORS) {
hiddenInstructorEmails = getHiddenInstructorEmails(courseId);
break;
}
}
for (FeedbackQuestionAttributes question : questions) {
updateBundleAndRecipientListWithResponsesForStudent(userEmail, student,
bundle, recipientList, question, hiddenInstructorEmails);
}
return new FeedbackSessionQuestionsBundle(fsa, bundle, recipientList);
} | FeedbackSessionQuestionsBundle function( String feedbackSessionName, String courseId, String userEmail) throws EntityDoesNotExistException { FeedbackSessionAttributes fsa = fsDb.getFeedbackSession( courseId, feedbackSessionName); if (fsa == null) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_GET + courseId + "/" + feedbackSessionName); } StudentAttributes student = studentsLogic.getStudentForEmail(courseId, userEmail); if (student == null) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_STUDENT); } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> bundle = new HashMap<>(); Map<String, Map<String, String>> recipientList = new HashMap<>(); List<FeedbackQuestionAttributes> questions = fqLogic.getFeedbackQuestionsForStudents(feedbackSessionName, courseId); Set<String> hiddenInstructorEmails = null; for (FeedbackQuestionAttributes question : questions) { if (question.getRecipientType() == FeedbackParticipantType.INSTRUCTORS) { hiddenInstructorEmails = getHiddenInstructorEmails(courseId); break; } } for (FeedbackQuestionAttributes question : questions) { updateBundleAndRecipientListWithResponsesForStudent(userEmail, student, bundle, recipientList, question, hiddenInstructorEmails); } return new FeedbackSessionQuestionsBundle(fsa, bundle, recipientList); } | /**
* Gets {@code FeedbackQuestions} and previously filled
* {@code FeedbackResponses} that a student can view/submit as a
* {@link FeedbackSessionQuestionsBundle}.
*/ | Gets FeedbackQuestions and previously filled FeedbackResponses that a student can view/submit as a <code>FeedbackSessionQuestionsBundle</code> | getFeedbackSessionQuestionsForStudent | {
"repo_name": "shaharyarshamshi/teammates",
"path": "src/main/java/teammates/logic/core/FeedbackSessionsLogic.java",
"license": "gpl-2.0",
"size": 109331
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.Set"
] | import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,774,743 |
public ValuesIterator getValues() {
return this.valuesIterator;
}
// --------------------------------------------------------------------------------------------
public final class ValuesIterator implements Iterator<E>, Iterable<E> {
private E next;
private boolean iteratorAvailable = true;
private final TypeSerializer<E> serializer;
private ValuesIterator(E first, TypeSerializer<E> serializer) {
this.next = first;
this.serializer = serializer;
} | ValuesIterator function() { return this.valuesIterator; } public final class ValuesIterator implements Iterator<E>, Iterable<E> { private E next; private boolean iteratorAvailable = true; private final TypeSerializer<E> serializer; private ValuesIterator(E first, TypeSerializer<E> serializer) { this.next = first; this.serializer = serializer; } | /**
* Returns an iterator over all values that belong to the current key. The iterator is initially <code>null</code>
* (before the first call to {@link #nextKey()} and after all keys are consumed. In general, this method returns
* always a non-null value, if a previous call to {@link #nextKey()} return <code>true</code>.
*
* @return Iterator over all values that belong to the current key.
*/ | Returns an iterator over all values that belong to the current key. The iterator is initially <code>null</code> (before the first call to <code>#nextKey()</code> and after all keys are consumed. In general, this method returns always a non-null value, if a previous call to <code>#nextKey()</code> return <code>true</code> | getValues | {
"repo_name": "WangTaoTheTonic/flink",
"path": "flink-core/src/main/java/org/apache/flink/api/common/operators/util/ListKeyGroupedIterator.java",
"license": "apache-2.0",
"size": 6009
} | [
"java.util.Iterator",
"org.apache.flink.api.common.typeutils.TypeSerializer"
] | import java.util.Iterator; import org.apache.flink.api.common.typeutils.TypeSerializer; | import java.util.*; import org.apache.flink.api.common.typeutils.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 1,998,265 |
public static Long toLong(Object data)
{
if (data != null) {
try {
if (data instanceof Integer) {
return Long.parseLong(Integer.toString((Integer) data));
} else if (data instanceof String) {
return Long.parseLong(data.toString());
} else if (data instanceof BigDecimal) {
return ((BigDecimal) data).longValue();
} else if (data instanceof BigInteger) {
return ((BigInteger) data).longValue();
} else if (data instanceof Number) {
return ((Number) data).longValue();
}
} catch (NumberFormatException e) {
return null;
}
}
return null;
} | static Long function(Object data) { if (data != null) { try { if (data instanceof Integer) { return Long.parseLong(Integer.toString((Integer) data)); } else if (data instanceof String) { return Long.parseLong(data.toString()); } else if (data instanceof BigDecimal) { return ((BigDecimal) data).longValue(); } else if (data instanceof BigInteger) { return ((BigInteger) data).longValue(); } else if (data instanceof Number) { return ((Number) data).longValue(); } } catch (NumberFormatException e) { return null; } } return null; } | /**
* Attempts to convert object to an Long
*
* @param data
* @return the long or null if it can't convert.
*/ | Attempts to convert object to an Long | toLong | {
"repo_name": "Jedwondle/openstorefront",
"path": "server/openstorefront/openstorefront-core/common/src/main/java/edu/usu/sdl/openstorefront/common/util/Convert.java",
"license": "apache-2.0",
"size": 4950
} | [
"java.math.BigDecimal",
"java.math.BigInteger"
] | import java.math.BigDecimal; import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 142,163 |
@Test
public void testNoTypesToString() {
String nameSampleStr = createSimpleNameSample(false).toString();
assertEquals("<START> U . S . <END> President <START> Barack Obama <END> is considering " +
"sending additional American forces to <START> Afghanistan <END> .", nameSampleStr);
} | void function() { String nameSampleStr = createSimpleNameSample(false).toString(); assertEquals(STR + STR, nameSampleStr); } | /**
* Checks if could create a NameSample without NameTypes, generate the
* string representation and validate it.
*/ | Checks if could create a NameSample without NameTypes, generate the string representation and validate it | testNoTypesToString | {
"repo_name": "Eagles2F/opennlp",
"path": "opennlp-tools/src/test/java/opennlp/tools/namefind/NameSampleTest.java",
"license": "apache-2.0",
"size": 6489
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,498,444 |
void getBrokenLinks(CmsUUID structureId, AsyncCallback<CmsDeleteResourceBean> callback); | void getBrokenLinks(CmsUUID structureId, AsyncCallback<CmsDeleteResourceBean> callback); | /**
* Returns a list of potentially broken links, if the given resource was deleted.<p>
*
* @param structureId the resource structure id
* @param callback the callback
*/ | Returns a list of potentially broken links, if the given resource was deleted | getBrokenLinks | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/gwt/shared/rpc/I_CmsVfsServiceAsync.java",
"license": "lgpl-2.1",
"size": 12380
} | [
"com.google.gwt.user.client.rpc.AsyncCallback",
"org.opencms.gwt.shared.CmsDeleteResourceBean",
"org.opencms.util.CmsUUID"
] | import com.google.gwt.user.client.rpc.AsyncCallback; import org.opencms.gwt.shared.CmsDeleteResourceBean; import org.opencms.util.CmsUUID; | import com.google.gwt.user.client.rpc.*; import org.opencms.gwt.shared.*; import org.opencms.util.*; | [
"com.google.gwt",
"org.opencms.gwt",
"org.opencms.util"
] | com.google.gwt; org.opencms.gwt; org.opencms.util; | 550,491 |
boolean validateReviewOfSystemsSectionTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context);
| boolean validateReviewOfSystemsSectionTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context); | /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* self.templateId->exists(id : datatypes::II | id.root = '1.3.6.1.4.1.19376.1.5.3.1.3.18')
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='self.templateId->exists(id : datatypes::II | id.root = \'1.3.6.1.4.1.19376.1.5.3.1.3.18\')'"
* @generated
*/ | self.templateId->exists(id : datatypes::II | id.root = '1.3.6.1.4.1.19376.1.5.3.1.3.18') | validateReviewOfSystemsSectionTemplateId | {
"repo_name": "drbgfc/mdht",
"path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.ihe/src/org/openhealthtools/mdht/uml/cda/ihe/ReviewOfSystemsSection.java",
"license": "epl-1.0",
"size": 2890
} | [
"java.util.Map",
"org.eclipse.emf.common.util.DiagnosticChain"
] | import java.util.Map; import org.eclipse.emf.common.util.DiagnosticChain; | import java.util.*; import org.eclipse.emf.common.util.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 2,728,522 |
@SuppressWarnings("unchecked")
public T addHeader(final String name, final String value) {
List<String> values = new ArrayList<String>();
values.add(value);
this.headers.put(name, values);
return (T) this;
} | @SuppressWarnings(STR) T function(final String name, final String value) { List<String> values = new ArrayList<String>(); values.add(value); this.headers.put(name, values); return (T) this; } | /**
* Adds a single header value to the Message.
*
* @param name
* The header name.
* @param value
* The header value
* @return this Message, to support chained method calls
*/ | Adds a single header value to the Message | addHeader | {
"repo_name": "hyperwallet/java-sdk",
"path": "src/main/java/com/hyperwallet/clientsdk/util/Message.java",
"license": "mit",
"size": 4191
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,242,442 |
private static GsonBuilder registerZonedDateTime(GsonBuilder builder)
{
builder.registerTypeAdapter(ZONED_DATE_TIME_TYPE, new ZonedDateTimeConverter());
return builder;
} | static GsonBuilder function(GsonBuilder builder) { builder.registerTypeAdapter(ZONED_DATE_TIME_TYPE, new ZonedDateTimeConverter()); return builder; } | /**
* Registers the {@link ZonedDateTimeConverter} converter.
* @param builder The GSON builder to register the converter with.
* @return A reference to {@code builder}.
*/ | Registers the <code>ZonedDateTimeConverter</code> converter | registerZonedDateTime | {
"repo_name": "gkopff/gson-javatime-serialisers",
"path": "src/test/java/com/fatboyindustrial/gsonjavatime/ZonedDateTimeConverterTest.java",
"license": "mit",
"size": 2998
} | [
"com.google.gson.GsonBuilder"
] | import com.google.gson.GsonBuilder; | import com.google.gson.*; | [
"com.google.gson"
] | com.google.gson; | 1,957,840 |
public String toString() {
StringBuffer str = new StringBuffer();
str.append("[Type2:0x");
str.append(Integer.toHexString(getFlags()));
str.append(",Target:");
str.append(getTarget());
str.append(",Ch:");
str.append(HexDump.hexString(getChallenge()));
if ( hasTargetInformation())
{
List targets = getTargetInformation();
str.append(",TargInf:");
for ( int i = 0; i < targets.size(); i++) {
TargetInfo target = (TargetInfo) targets.get( i);
str.append(target);
}
}
str.append("]");
return str.toString();
} | String function() { StringBuffer str = new StringBuffer(); str.append(STR); str.append(Integer.toHexString(getFlags())); str.append(STR); str.append(getTarget()); str.append(",Ch:"); str.append(HexDump.hexString(getChallenge())); if ( hasTargetInformation()) { List targets = getTargetInformation(); str.append(STR); for ( int i = 0; i < targets.size(); i++) { TargetInfo target = (TargetInfo) targets.get( i); str.append(target); } } str.append("]"); return str.toString(); } | /**
* Return the type 2 message as a string
*
* @return String
*/ | Return the type 2 message as a string | toString | {
"repo_name": "arcusys/Liferay-CIFS",
"path": "source/java/org/alfresco/jlan/server/auth/ntlm/Type2NTLMMessage.java",
"license": "gpl-3.0",
"size": 7722
} | [
"java.util.List",
"org.alfresco.jlan.util.HexDump"
] | import java.util.List; import org.alfresco.jlan.util.HexDump; | import java.util.*; import org.alfresco.jlan.util.*; | [
"java.util",
"org.alfresco.jlan"
] | java.util; org.alfresco.jlan; | 2,351,607 |
private void actionSend() {
new TaskSendMessage().execute(newMessage);
} | void function() { new TaskSendMessage().execute(newMessage); } | /**
* Action d'envoi du nouveau Message
*/ | Action d'envoi du nouveau Message | actionSend | {
"repo_name": "uSpreadIt/uSpreadIt-Android",
"path": "uSpreadIt/src/main/java/it/uspread/android/activity/message/create/MessageCreationActivity.java",
"license": "mit",
"size": 16609
} | [
"it.uspread.android.task.TaskSendMessage"
] | import it.uspread.android.task.TaskSendMessage; | import it.uspread.android.task.*; | [
"it.uspread.android"
] | it.uspread.android; | 1,857,224 |
LogicalPreparedStatement newLogicalPreparedStatement(
PreparedStatement ps,
StatementKey stmtKey,
StatementCacheInteractor cacheInteractor); | LogicalPreparedStatement newLogicalPreparedStatement( PreparedStatement ps, StatementKey stmtKey, StatementCacheInteractor cacheInteractor); | /**
* Returns a new logical prepared statement object.
*
* @param ps underlying physical prepared statement
* @param stmtKey key for the underlying physical prepared statement
* @param cacheInteractor the statement cache interactor
* @return A logical prepared statement.
*/ | Returns a new logical prepared statement object | newLogicalPreparedStatement | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.client/org/apache/derby/client/am/ClientJDBCObjectFactory.java",
"license": "apache-2.0",
"size": 17009
} | [
"java.sql.PreparedStatement",
"org.apache.derby.client.am.stmtcache.StatementKey"
] | import java.sql.PreparedStatement; import org.apache.derby.client.am.stmtcache.StatementKey; | import java.sql.*; import org.apache.derby.client.am.stmtcache.*; | [
"java.sql",
"org.apache.derby"
] | java.sql; org.apache.derby; | 410,971 |
@Override
@Deprecated
@Dependencies("getExtents")
public Extent getExtent() {
return LegacyPropertyAdapter.getSingleton(getExtents(), Extent.class, null, DefaultScope.class, "getExtent");
} | @Dependencies(STR) Extent function() { return LegacyPropertyAdapter.getSingleton(getExtents(), Extent.class, null, DefaultScope.class, STR); } | /**
* Information about the spatial, vertical and temporal extent of the data specified by the scope.
* This method fetches the value from the {@linkplain #getExtents() extents} collection.
*
* @return Information about the extent of the data, or {@code null}.
*
* @deprecated As of ISO 19115:2014, replaced by {@link #getExtents()}.
*/ | Information about the spatial, vertical and temporal extent of the data specified by the scope. This method fetches the value from the #getExtents() extents collection | getExtent | {
"repo_name": "apache/sis",
"path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScope.java",
"license": "apache-2.0",
"size": 10225
} | [
"org.apache.sis.internal.metadata.Dependencies",
"org.apache.sis.internal.metadata.legacy.LegacyPropertyAdapter",
"org.opengis.metadata.extent.Extent"
] | import org.apache.sis.internal.metadata.Dependencies; import org.apache.sis.internal.metadata.legacy.LegacyPropertyAdapter; import org.opengis.metadata.extent.Extent; | import org.apache.sis.internal.metadata.*; import org.apache.sis.internal.metadata.legacy.*; import org.opengis.metadata.extent.*; | [
"org.apache.sis",
"org.opengis.metadata"
] | org.apache.sis; org.opengis.metadata; | 2,763,481 |
@Test
public void setSplitFalse() {
final QueryModifier expected = new QueryModifier(TermModifier.NONE, false, false, false, null);
final QueryModifier actual = QueryModifier.start().setSplit(false).end();
Assert.assertEquals(expected, actual);
} | void function() { final QueryModifier expected = new QueryModifier(TermModifier.NONE, false, false, false, null); final QueryModifier actual = QueryModifier.start().setSplit(false).end(); Assert.assertEquals(expected, actual); } | /**
* Tests {@link ModifierBuilder#setSplit(boolean)} with false.
*/ | Tests <code>ModifierBuilder#setSplit(boolean)</code> with false | setSplitFalse | {
"repo_name": "cosmocode/cosmocode-lucene",
"path": "src/test/java/de/cosmocode/lucene/QueryModifierTest.java",
"license": "apache-2.0",
"size": 11555
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,028,990 |
void handleOcrContinuousDecode(OcrResultFailure obj) {
lastResult = null;
viewfinderView.removeResultText();
// Reset the text in the recognized text box.
statusViewTop.setText("");
if (CONTINUOUS_DISPLAY_METADATA) {
// Color text delimited by '-' as red.
statusViewBottom.setTextSize(14);
CharSequence cs = setSpanBetweenTokens("OCR: " + sourceLanguageReadable + " - OCR failed - Time required: "
+ obj.getTimeRequired() + " ms", "-", new ForegroundColorSpan(0xFFFF0000));
statusViewBottom.setText(cs);
}
} | void handleOcrContinuousDecode(OcrResultFailure obj) { lastResult = null; viewfinderView.removeResultText(); statusViewTop.setText(STROCR: STR - OCR failed - Time required: STR msSTR-", new ForegroundColorSpan(0xFFFF0000)); statusViewBottom.setText(cs); } } | /**
* Version of handleOcrContinuousDecode for failed OCR requests. Displays a failure message.
*
* @param obj Metadata for the failed OCR request.
*/ | Version of handleOcrContinuousDecode for failed OCR requests. Displays a failure message | handleOcrContinuousDecode | {
"repo_name": "Limorerez/JamXPlanit",
"path": "Planit/src/main/java/edu/sfsu/cs/orange/ocr/CaptureActivity.java",
"license": "apache-2.0",
"size": 51661
} | [
"android.text.style.ForegroundColorSpan"
] | import android.text.style.ForegroundColorSpan; | import android.text.style.*; | [
"android.text"
] | android.text; | 435,447 |
public static InputStream openStream(Buffer buffer, boolean owner) {
return new BufferInputStream(owner ? buffer : ignoreClose(buffer));
} | static InputStream function(Buffer buffer, boolean owner) { return new BufferInputStream(owner ? buffer : ignoreClose(buffer)); } | /**
* Creates a new {@link InputStream} backed by the given buffer. Any read taken on the stream will
* automatically increment the read position of this buffer. Closing the stream, however, does not
* affect the original buffer.
*
* @param buffer the buffer backing the new {@link InputStream}.
* @param owner if {@code true}, the returned stream will close the buffer when closed.
*/ | Creates a new <code>InputStream</code> backed by the given buffer. Any read taken on the stream will automatically increment the read position of this buffer. Closing the stream, however, does not affect the original buffer | openStream | {
"repo_name": "dongc/grpc-java",
"path": "core/src/main/java/io/grpc/transport/Buffers.java",
"license": "bsd-3-clause",
"size": 10094
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,403,197 |
private static long of(final int year, final int month) {
long millis = utcMillisAtStartOfYear(year);
millis += getTotalMillisByYearMonth(year, month);
return millis;
}
/**
* Returns the current UTC date-time with milliseconds precision.
* In Java 9+ (as opposed to Java 8) the {@code Clock} implementation uses system's best clock implementation (which could mean
* that the precision of the clock can be milliseconds, microseconds or nanoseconds), whereas in Java 8
* {@code System.currentTimeMillis()} is always used. To account for these differences, this method defines a new {@code Clock} | static long function(final int year, final int month) { long millis = utcMillisAtStartOfYear(year); millis += getTotalMillisByYearMonth(year, month); return millis; } /** * Returns the current UTC date-time with milliseconds precision. * In Java 9+ (as opposed to Java 8) the {@code Clock} implementation uses system's best clock implementation (which could mean * that the precision of the clock can be milliseconds, microseconds or nanoseconds), whereas in Java 8 * {@code System.currentTimeMillis()} is always used. To account for these differences, this method defines a new {@code Clock} | /**
* Return the first day of the month
* @param year the year to return
* @param month the month to return, ranging from 1-12
* @return the milliseconds since the epoch of the first day of the month in the year
*/ | Return the first day of the month | of | {
"repo_name": "HonzaKral/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/common/time/DateUtils.java",
"license": "apache-2.0",
"size": 18238
} | [
"java.time.Clock",
"org.elasticsearch.common.time.DateUtilsRounding"
] | import java.time.Clock; import org.elasticsearch.common.time.DateUtilsRounding; | import java.time.*; import org.elasticsearch.common.time.*; | [
"java.time",
"org.elasticsearch.common"
] | java.time; org.elasticsearch.common; | 1,292,048 |
public void writePacketData(PacketBuffer data) throws IOException
{
data.writeBlockPos(this.field_179824_a);
data.writeByte((byte)this.metadata);
data.writeNBTTagCompoundToBuffer(this.nbt);
} | void function(PacketBuffer data) throws IOException { data.writeBlockPos(this.field_179824_a); data.writeByte((byte)this.metadata); data.writeNBTTagCompoundToBuffer(this.nbt); } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/network/play/server/S35PacketUpdateTileEntity.java",
"license": "mit",
"size": 2045
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 413,616 |
protected int getDeliveryMode() {
return DeliveryMode.NON_PERSISTENT;
}
} | int function() { return DeliveryMode.NON_PERSISTENT; } } | /**
* Returns delivery mode.
*
* @return int - non-persistent delivery mode.
*/ | Returns delivery mode | getDeliveryMode | {
"repo_name": "mocc/bookkeeper-lab",
"path": "hedwig-client-jms/src/test/java/org/apache/activemq/JmsRedeliveredTest.java",
"license": "apache-2.0",
"size": 13592
} | [
"javax.jms.DeliveryMode"
] | import javax.jms.DeliveryMode; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 417,442 |
return Optional.ofNullable(name);
} | return Optional.ofNullable(name); } | /**
* Returns user provided name of the operator.
*
* @return maybe name
*/ | Returns user provided name of the operator | getName | {
"repo_name": "mxm/incubator-beam",
"path": "sdks/java/extensions/euphoria/src/main/java/org/apache/beam/sdk/extensions/euphoria/core/client/operator/base/Operator.java",
"license": "apache-2.0",
"size": 2128
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 306,033 |
ServiceCall put504Async(Boolean booleanValue, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException; | ServiceCall put504Async(Boolean booleanValue, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException; | /**
* Return 504 status code, then 200 after retry.
*
* @param booleanValue Simple boolean value true
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link ServiceCall} object
*/ | Return 504 status code, then 200 after retry | put504Async | {
"repo_name": "John-Hart/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/HttpRetrys.java",
"license": "mit",
"size": 12077
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,824,183 |
WebDriver getWebDriver(); | WebDriver getWebDriver(); | /**
* Gets the web driver.
*
* @return the web driver
*/ | Gets the web driver | getWebDriver | {
"repo_name": "openMF/mifosx-e2e-testing",
"path": "MifosTestingFramework/src/main/java/com/mifos/testing/framework/webdriver/WebDriverFactory.java",
"license": "mpl-2.0",
"size": 622
} | [
"org.openqa.selenium.WebDriver"
] | import org.openqa.selenium.WebDriver; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 1,052,534 |
public HttpUrlConnectorProvider connectionFactory(final ConnectionFactory connectionFactory) {
if (connectionFactory == null) {
throw new NullPointerException(LocalizationMessages.NULL_INPUT_PARAMETER("connectionFactory"));
}
this.connectionFactory = connectionFactory;
return this;
} | HttpUrlConnectorProvider function(final ConnectionFactory connectionFactory) { if (connectionFactory == null) { throw new NullPointerException(LocalizationMessages.NULL_INPUT_PARAMETER(STR)); } this.connectionFactory = connectionFactory; return this; } | /**
* Set a custom {@link java.net.HttpURLConnection} factory.
*
* @param connectionFactory custom HTTP URL connection factory. Must not be {@code null}.
* @return updated connector provider instance.
* @throws java.lang.NullPointerException in case the supplied connectionFactory is {@code null}.
*/ | Set a custom <code>java.net.HttpURLConnection</code> factory | connectionFactory | {
"repo_name": "agentlab/org.glassfish.jersey",
"path": "plugins/org.glassfish.jersey.client/src/main/java/org/glassfish/jersey/client/HttpUrlConnectorProvider.java",
"license": "epl-1.0",
"size": 13452
} | [
"org.glassfish.jersey.client.internal.LocalizationMessages"
] | import org.glassfish.jersey.client.internal.LocalizationMessages; | import org.glassfish.jersey.client.internal.*; | [
"org.glassfish.jersey"
] | org.glassfish.jersey; | 2,014,608 |
public void clearSeedRelays() {
for (String Key : PropertiesUtil.stringPropertyNames(this)) {
if ( Key.startsWith(JXSE_SEED_RELAY_URI)) {
this.remove(Key);
}
}
}
private static final String JXSE_SEED_RDV_URI = "JXSE_SEED_RDV_URI";
/**
* Adds RendezvousService peer seed address using item numbers. If the {@code seedURI}
| void function() { for (String Key : PropertiesUtil.stringPropertyNames(this)) { if ( Key.startsWith(JXSE_SEED_RELAY_URI)) { this.remove(Key); } } } private static final String JXSE_SEED_RDV_URI = STR; /** * Adds RendezvousService peer seed address using item numbers. If the {@code seedURI} | /**
* Clears the list of RendezVousService seeds
*/ | Clears the list of RendezVousService seeds | clearSeedRelays | {
"repo_name": "johnjianfang/jxse",
"path": "src/main/java/net/jxse/configuration/JxsePeerConfiguration.java",
"license": "apache-2.0",
"size": 38745
} | [
"net.jxta.configuration.PropertiesUtil"
] | import net.jxta.configuration.PropertiesUtil; | import net.jxta.configuration.*; | [
"net.jxta.configuration"
] | net.jxta.configuration; | 2,292,334 |
public static MappingSingleton getInstance() throws JAXBException, MissingResourceException
{
if (instance == null)
{
instance = new MappingSingleton();
}
return instance;
}
// Private constructor, pattern Singleton.
private MappingSingleton() throws JAXBException, MissingResourceException
{
// Read the settings file using JAXB.
JAXBContext context = JAXBContext.newInstance(IadMapping.class);
Unmarshaller m = context.createUnmarshaller();
String mappingPath = ConfigSingleton.getInstance().theMatrix.getPath().getMapping();
if (new File(mappingPath).exists())
{
mapping = ((IadMapping) m.unmarshal(new File(mappingPath)));
}
else
{
// TODO: launch error from the new log file
throw new MissingResourceException("MappingSingleton() - missing mapping file, ", "file", mappingPath);
}
} | static MappingSingleton function() throws JAXBException, MissingResourceException { if (instance == null) { instance = new MappingSingleton(); } return instance; } private MappingSingleton() throws JAXBException, MissingResourceException { JAXBContext context = JAXBContext.newInstance(IadMapping.class); Unmarshaller m = context.createUnmarshaller(); String mappingPath = ConfigSingleton.getInstance().theMatrix.getPath().getMapping(); if (new File(mappingPath).exists()) { mapping = ((IadMapping) m.unmarshal(new File(mappingPath))); } else { throw new MissingResourceException(STR, "file", mappingPath); } } | /**
* Gets the only instance of this class.
*
* @throws JAXBException
*/ | Gets the only instance of this class | getInstance | {
"repo_name": "hpclab/TheMatrixProject",
"path": "src/it/cnr/isti/thematrix/configuration/MappingSingleton.java",
"license": "gpl-3.0",
"size": 2175
} | [
"it.cnr.isti.thematrix.configuration.mapping.IadMapping",
"java.io.File",
"java.util.MissingResourceException",
"javax.xml.bind.JAXBContext",
"javax.xml.bind.JAXBException",
"javax.xml.bind.Unmarshaller"
] | import it.cnr.isti.thematrix.configuration.mapping.IadMapping; import java.io.File; import java.util.MissingResourceException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; | import it.cnr.isti.thematrix.configuration.mapping.*; import java.io.*; import java.util.*; import javax.xml.bind.*; | [
"it.cnr.isti",
"java.io",
"java.util",
"javax.xml"
] | it.cnr.isti; java.io; java.util; javax.xml; | 864,071 |
public ServiceResponse<List<Double>> getFloatValid() throws ErrorException, IOException {
Call<ResponseBody> call = service.getFloatValid();
return getFloatValidDelegate(call.execute());
}
| ServiceResponse<List<Double>> function() throws ErrorException, IOException { Call<ResponseBody> call = service.getFloatValid(); return getFloatValidDelegate(call.execute()); } | /**
* Get float array value [0, -0.01, 1.2e20].
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the List<Double> object wrapped in {@link ServiceResponse} if successful.
*/ | Get float array value [0, -0.01, 1.2e20] | getFloatValid | {
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java",
"license": "mit",
"size": 167174
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException",
"java.util.List"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List; | import com.microsoft.rest.*; import java.io.*; import java.util.*; | [
"com.microsoft.rest",
"java.io",
"java.util"
] | com.microsoft.rest; java.io; java.util; | 2,041,928 |
@SuppressWarnings("unchecked")
public List<Cidadao> listarPorRole(String role) {
if (trace) {
logger.trace(String.format(
"Listar cidadaos por role=%s", role));
}
List<Cidadao> list = null;
Query q = null;
try {
q = em.createQuery("from Cidadao where role like :role");
q.setParameter("role", role);
list = (List<Cidadao>) q.getResultList();
} catch (Exception e) {
if (trace) {
logger.trace("Erro ao Listar cidadaos", e);
}
}
if (trace) {
logger.trace(String.format("%d cidadaos encontrados",
(list != null) ? list.size() : 0));
}
return list;
}
| @SuppressWarnings(STR) List<Cidadao> function(String role) { if (trace) { logger.trace(String.format( STR, role)); } List<Cidadao> list = null; Query q = null; try { q = em.createQuery(STR); q.setParameter("role", role); list = (List<Cidadao>) q.getResultList(); } catch (Exception e) { if (trace) { logger.trace(STR, e); } } if (trace) { logger.trace(String.format(STR, (list != null) ? list.size() : 0)); } return list; } | /**
* Lista Cidadaos por Role.
* @param role Role dos cidadaos.
* @return Lista de Cidadaos.
*/ | Lista Cidadaos por Role | listarPorRole | {
"repo_name": "robsonsmartins/fiap-mba-java-projects",
"path": "source/tcc.fiap.jboss7/ReceitaNacionalCommon/src/receita/dao/CidadaoDAO.java",
"license": "gpl-3.0",
"size": 4614
} | [
"java.util.List",
"javax.persistence.Query"
] | import java.util.List; import javax.persistence.Query; | import java.util.*; import javax.persistence.*; | [
"java.util",
"javax.persistence"
] | java.util; javax.persistence; | 2,023,722 |
public String getFromAddress()
{
String fromAddress = null;
if (getFrom() == null || getFrom().isEmpty())
{
fromAddress = null;
}
else
{
Matcher mEmail = EMAIL_WITH_NAME.matcher(getFrom());
if (mEmail.find())
{
// get the address from the email
fromAddress = mEmail.group(2);
}
else
{
fromAddress = getFrom();
}
}
return fromAddress;
} | String function() { String fromAddress = null; if (getFrom() == null getFrom().isEmpty()) { fromAddress = null; } else { Matcher mEmail = EMAIL_WITH_NAME.matcher(getFrom()); if (mEmail.find()) { fromAddress = mEmail.group(2); } else { fromAddress = getFrom(); } } return fromAddress; } | /**
* Returns the 'Address' portion of an email address when the email contains a name. E.g. returns
* "[email protected]" if the email address is "Ryan McCullough <[email protected]>".
* If name is not present in the email address, returns null.
* @return the 'Name' portion of an email address (if present).
*/ | Returns the 'Address' portion of an email address when the email contains a name. E.g. returns "[email protected]" if the email address is "Ryan McCullough ". If name is not present in the email address, returns null | getFromAddress | {
"repo_name": "forcedotcom/scmt-server",
"path": "src/main/java/com/desk/java/apiclient/model/Interaction.java",
"license": "bsd-3-clause",
"size": 15939
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,194,251 |
public void removeSubSystem(SubSystem subSystem, boolean clear) {
if (subSystems.remove(subSystem)) {
Node n = (Node) renderSystemNode.getChild(subSystem.getClass().getName());
if (n != null && !clear) {
for (Spatial s : n.getChildren()) {
if (spatials.containsValue(s)) {
renderSystemNode.attachChild(s);
}
}
} else if (n != null) {
renderSystemNode.detachChild(n);
}
} else {
Logger.getLogger(getClass().getName()).log(Level.WARNING,
"Trying to remove a subSystem not referenced : {1} ",
new Object[]{subSystem.getClass().getName()});
}
} | void function(SubSystem subSystem, boolean clear) { if (subSystems.remove(subSystem)) { Node n = (Node) renderSystemNode.getChild(subSystem.getClass().getName()); if (n != null && !clear) { for (Spatial s : n.getChildren()) { if (spatials.containsValue(s)) { renderSystemNode.attachChild(s); } } } else if (n != null) { renderSystemNode.detachChild(n); } } else { Logger.getLogger(getClass().getName()).log(Level.WARNING, STR, new Object[]{subSystem.getClass().getName()}); } } | /**
* Remove a subSystem ratached to this system.
*
* @param subSystem the subSystem to remove.
* @param clear does all spatial belong to that subSystem have to be purge ?
*/ | Remove a subSystem ratached to this system | removeSubSystem | {
"repo_name": "meltzow/MultiverseKing_JME",
"path": "MultiverseKingCore/src/org/multiverseking/render/RenderSystem.java",
"license": "gpl-3.0",
"size": 9901
} | [
"com.jme3.scene.Node",
"com.jme3.scene.Spatial",
"java.util.logging.Level",
"java.util.logging.Logger",
"org.multiverseking.utility.system.SubSystem"
] | import com.jme3.scene.Node; import com.jme3.scene.Spatial; import java.util.logging.Level; import java.util.logging.Logger; import org.multiverseking.utility.system.SubSystem; | import com.jme3.scene.*; import java.util.logging.*; import org.multiverseking.utility.system.*; | [
"com.jme3.scene",
"java.util",
"org.multiverseking.utility"
] | com.jme3.scene; java.util; org.multiverseking.utility; | 1,800,897 |
protected static int readFully(InputStream stm,
byte[] buf, int offset, int len) throws IOException {
int n = 0;
for (;;) {
int nread = stm.read(buf, offset + n, len - n);
if (nread <= 0)
return (n == 0) ? nread : n;
n += nread;
if (n >= len)
return n;
}
} | static int function(InputStream stm, byte[] buf, int offset, int len) throws IOException { int n = 0; for (;;) { int nread = stm.read(buf, offset + n, len - n); if (nread <= 0) return (n == 0) ? nread : n; n += nread; if (n >= len) return n; } } | /**
* A utility function that tries to read up to <code>len</code> bytes from
* <code>stm</code>
*
* @param stm an input stream
* @param buf destiniation buffer
* @param offset offset at which to store data
* @param len number of bytes to read
* @return actual number of bytes read
* @throws IOException if there is any IO error
*/ | A utility function that tries to read up to <code>len</code> bytes from <code>stm</code> | readFully | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSInputChecker.java",
"license": "apache-2.0",
"size": 16370
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,735,896 |
private static void prependZero(@NonNull final StringBuilder format, final int number, final int digits) {
if( digits >= 3 && number < 100 ) {
format.append( 0 );
}
if( digits >= 2 && number < 10 ) {
format.append( 0 );
}
format.append(number);
} | static void function(@NonNull final StringBuilder format, final int number, final int digits) { if( digits >= 3 && number < 100 ) { format.append( 0 ); } if( digits >= 2 && number < 10 ) { format.append( 0 ); } format.append(number); } | /**
* Add a zero before the number if its less then 10.
*
* @param format builder
* @param number to append
*/ | Add a zero before the number if its less then 10 | prependZero | {
"repo_name": "felixWackernagel/sidekick",
"path": "sidekick/src/main/java/de/wackernagel/android/sidekick/converters/DateConverter.java",
"license": "apache-2.0",
"size": 4365
} | [
"android.support.annotation.NonNull"
] | import android.support.annotation.NonNull; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 870,938 |
public JavaClass getJavaClass()
{
return mJavaClass;
} | JavaClass function() { return mJavaClass; } | /**
* Gets the JavaClass for this definition.
* @return the JavaClass
*/ | Gets the JavaClass for this definition | getJavaClass | {
"repo_name": "checkstyle/contribution",
"path": "bcel/src/checkstyle/com/puppycrawl/tools/checkstyle/bcel/classfile/JavaClassDefinition.java",
"license": "lgpl-2.1",
"size": 6201
} | [
"org.apache.bcel.classfile.JavaClass"
] | import org.apache.bcel.classfile.JavaClass; | import org.apache.bcel.classfile.*; | [
"org.apache.bcel"
] | org.apache.bcel; | 905,753 |
public List<String> getCellCssClassAttributes() {
return cellCssClassAttributes;
}
| List<String> function() { return cellCssClassAttributes; } | /**
* List of css class HTML attribute values ordered by the order in which the cell appears
*
* @return the list of css class HTML attributes for cells
*/ | List of css class HTML attribute values ordered by the order in which the cell appears | getCellCssClassAttributes | {
"repo_name": "ricepanda/rice-git2",
"path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/uif/layout/CssGridLayoutManagerBase.java",
"license": "apache-2.0",
"size": 6697
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,050,149 |
public static boolean compareSet(Set s1, Set s2)
{
if (s1 == null)
{
return s2 == null;
}
else if (s2 == null)
{
return false;
}
if (s1.size() != s2.size())
{
return false;
}
s2 = new HashSet(s2);
Iterator i = s1.iterator();
while (i.hasNext())
{
Person obj = (Person) i.next();
boolean found = false;
Iterator j = s2.iterator();
while (j.hasNext())
{
if (obj.compareTo(j.next()))
{
j.remove();
found = true;
break;
}
}
if (!found)
{
return false;
}
}
return true;
}
| static boolean function(Set s1, Set s2) { if (s1 == null) { return s2 == null; } else if (s2 == null) { return false; } if (s1.size() != s2.size()) { return false; } s2 = new HashSet(s2); Iterator i = s1.iterator(); while (i.hasNext()) { Person obj = (Person) i.next(); boolean found = false; Iterator j = s2.iterator(); while (j.hasNext()) { if (obj.compareTo(j.next())) { j.remove(); found = true; break; } } if (!found) { return false; } } return true; } | /**
* Compares two sets of Person. Returns true if and only if the two sets
* contain the same number of objects and each element of the first set has
* a corresponding element in the second set whose fields compare equal
* according to the compareTo() method.
* @return <i>true</i> if the sets compare equal, <i>false</i> otherwise.
*/ | Compares two sets of Person. Returns true if and only if the two sets contain the same number of objects and each element of the first set has a corresponding element in the second set whose fields compare equal according to the compareTo() method | compareSet | {
"repo_name": "datanucleus/tests",
"path": "jpa/rdbms/src/java/org/datanucleus/samples/annotations/models/company/Manager.java",
"license": "apache-2.0",
"size": 4430
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.Set"
] | import java.util.HashSet; import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,860,289 |
public static void openErrorDialog(Shell shell, String title,
String description, String reason, List<String> errorList) {
LOGGER.debug("shell:" + shell + "messasge:" + reason + "errorList:"
+ errorList);
org.eclipse.jface.dialogs.ErrorDialog
.openError(shell, title, description, ErrorDialog
.createMultiStatus(IStatus.ERROR, reason, errorList));
} | static void function(Shell shell, String title, String description, String reason, List<String> errorList) { LOGGER.debug(STR + shell + STR + reason + STR + errorList); org.eclipse.jface.dialogs.ErrorDialog .openError(shell, title, description, ErrorDialog .createMultiStatus(IStatus.ERROR, reason, errorList)); } | /**
* It displays an error dialog the error icon.<br/>
* View (only if Exception is passed) and trace error message.<br/>
*
* @param shell
* Shell
* @param title
* Title
* @param description
* The top message
* @param reason
* Error message
* @param errorList
* List
*/ | It displays an error dialog the error icon. View (only if Exception is passed) and trace error message | openErrorDialog | {
"repo_name": "azkaoru/migration-tool",
"path": "src/tubame.knowhow/src/tubame/knowhow/plugin/ui/dialog/ErrorDialog.java",
"license": "apache-2.0",
"size": 6423
} | [
"java.util.List",
"org.eclipse.core.runtime.IStatus",
"org.eclipse.swt.widgets.Shell"
] | import java.util.List; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.widgets.Shell; | import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.widgets.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.swt"
] | java.util; org.eclipse.core; org.eclipse.swt; | 1,838,248 |
public static Map<String, CCModel> parseObjModels(ResourceLocation res, int vertexMode, Transformation coordSystem) {
try {
return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), vertexMode, coordSystem);
} catch (Exception e) {
throw new RuntimeException("failed to load model: " + res, e);
}
} | static Map<String, CCModel> function(ResourceLocation res, int vertexMode, Transformation coordSystem) { try { return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), vertexMode, coordSystem); } catch (Exception e) { throw new RuntimeException(STR + res, e); } } | /**
* Parses vertices, texture coords, normals and polygons from a WaveFront Obj file
*
* @param res
* The resource for the obj file
* @param vertexMode
* The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS)
* @param coordSystem
* The cooridnate system transformation to apply
* @return A map of group names to models
*/ | Parses vertices, texture coords, normals and polygons from a WaveFront Obj file | parseObjModels | {
"repo_name": "Todkommt/Mass-Effect-Ships-Mod",
"path": "lib/src/CoFHCore/src/main/java/cofh/repack/codechicken/lib/render/CCModel.java",
"license": "gpl-3.0",
"size": 31853
} | [
"java.util.Map",
"net.minecraft.client.Minecraft",
"net.minecraft.util.ResourceLocation"
] | import java.util.Map; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; | import java.util.*; import net.minecraft.client.*; import net.minecraft.util.*; | [
"java.util",
"net.minecraft.client",
"net.minecraft.util"
] | java.util; net.minecraft.client; net.minecraft.util; | 1,006,677 |
public AccountingDocument getAccountingDocumentForValidation() {
return accountingDocumentForValidation;
}
| AccountingDocument function() { return accountingDocumentForValidation; } | /**
* Gets the accountingDocumentForValdation attribute.
* @return Returns the accountingDocumentForValdation.
*/ | Gets the accountingDocumentForValdation attribute | getAccountingDocumentForValidation | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/document/validation/impl/OptionalOneSidedDocumentAccountingLinesCountValidation.java",
"license": "agpl-3.0",
"size": 3387
} | [
"org.kuali.kfs.sys.document.AccountingDocument"
] | import org.kuali.kfs.sys.document.AccountingDocument; | import org.kuali.kfs.sys.document.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,029,984 |
public int getEnchantmentId(String enchantment) {
return Item.getEnchantments().indexOf(enchantment);
} | int function(String enchantment) { return Item.getEnchantments().indexOf(enchantment); } | /**
* Gets the ID of the enchantment specified
*
* @param enchantment - The enchantment name
* @return The ID of the enchantment, or -1 if not found
*/ | Gets the ID of the enchantment specified | getEnchantmentId | {
"repo_name": "simo415/spc",
"path": "src/com/sijobe/spc/command/Enchant.java",
"license": "lgpl-3.0",
"size": 3506
} | [
"com.sijobe.spc.wrapper.Item"
] | import com.sijobe.spc.wrapper.Item; | import com.sijobe.spc.wrapper.*; | [
"com.sijobe.spc"
] | com.sijobe.spc; | 1,460,801 |
SoftwareComponentContainer getComponents(); | SoftwareComponentContainer getComponents(); | /**
* Returns the software components produced by this project.
*
* @return The components for this project.
*/ | Returns the software components produced by this project | getComponents | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/core-api/src/main/java/org/gradle/api/Project.java",
"license": "apache-2.0",
"size": 72230
} | [
"org.gradle.api.component.SoftwareComponentContainer"
] | import org.gradle.api.component.SoftwareComponentContainer; | import org.gradle.api.component.*; | [
"org.gradle.api"
] | org.gradle.api; | 2,646,092 |
public void show(Player observer, Location location);
/**
* Shows the hologram to a player at a specific location
*
* @param observer player to clear the hologram display for
* @param x x coordinate of the location to show the hologram at
* @param y y coordinate of the location to show the hologram at
* @param z z coordinate of the location to show the hologram at
* @param obeyVisibility whether to obey the assigned {@link com.dsh105.holoapi.api.visibility.Visibility} | void function(Player observer, Location location); /** * Shows the hologram to a player at a specific location * * @param observer player to clear the hologram display for * @param x x coordinate of the location to show the hologram at * @param y y coordinate of the location to show the hologram at * @param z z coordinate of the location to show the hologram at * @param obeyVisibility whether to obey the assigned {@link com.dsh105.holoapi.api.visibility.Visibility} | /**
* Shows the hologram to a player at a location
*
* @param observer player to show the hologram to
* @param location location that the hologram is visible at
*/ | Shows the hologram to a player at a location | show | {
"repo_name": "khmMinecraftProjects/HoloAPI",
"path": "src/main/java/com/dsh105/holoapi/api/Hologram.java",
"license": "gpl-3.0",
"size": 16495
} | [
"com.dsh105.holoapi.api.visibility.Visibility",
"org.bukkit.Location",
"org.bukkit.entity.Player"
] | import com.dsh105.holoapi.api.visibility.Visibility; import org.bukkit.Location; import org.bukkit.entity.Player; | import com.dsh105.holoapi.api.visibility.*; import org.bukkit.*; import org.bukkit.entity.*; | [
"com.dsh105.holoapi",
"org.bukkit",
"org.bukkit.entity"
] | com.dsh105.holoapi; org.bukkit; org.bukkit.entity; | 2,765,684 |
private void pvMoveBeforeFistRow() throws DBSIOException{
wDAO.moveBeforeFirstRow();
}
| void function() throws DBSIOException{ wDAO.moveBeforeFirstRow(); } | /**
* Move para o registro anterior ao primeiro registro.
* @throws DBSIOException
*/ | Move para o registro anterior ao primeiro registro | pvMoveBeforeFistRow | {
"repo_name": "dbsoftcombr/dbsfaces",
"path": "src/main/java/br/com/dbsoft/ui/bean/crud/DBSCrudOldBean.java",
"license": "mit",
"size": 120397
} | [
"br.com.dbsoft.error.DBSIOException"
] | import br.com.dbsoft.error.DBSIOException; | import br.com.dbsoft.error.*; | [
"br.com.dbsoft"
] | br.com.dbsoft; | 1,635,577 |
//--------//
// getPid //
//--------//
public static String getPid ()
throws IOException
{
String pid = new File("/proc/self").getCanonicalFile()
.getName();
logger.debug("pid: {}", pid);
return pid;
} | static String function () throws IOException { String pid = new File(STR).getCanonicalFile() .getName(); logger.debug(STR, pid); return pid; } | /**
* Report the pid of the current process.
*
* @return the process id, as a string
*/ | Report the pid of the current process | getPid | {
"repo_name": "jlpoolen/libreveris",
"path": "src/installer/com/audiveris/installer/unix/UnixUtilities.java",
"license": "lgpl-3.0",
"size": 3016
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,659,378 |
public void close() throws IOException {
if (mPositionReader != null) {
mPositionReader.close();
}
mPositionReader = null;
mPositionReaderUnit = null;
}
| void function() throws IOException { if (mPositionReader != null) { mPositionReader.close(); } mPositionReader = null; mPositionReaderUnit = null; } | /**
* Closes all open resources.
*/ | Closes all open resources | close | {
"repo_name": "injectnique/KnuckleHeadedMcSpazatron",
"path": "Tools/TeaTrove-Tea/teatrove-Tea-3.2.0/Tea3.2.0/Code/Java/com/go/tea/util/ConsoleErrorReporter.java",
"license": "mit",
"size": 5877
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,556,860 |
public Module fetchByUserId_First(long userId,
OrderByComparator orderByComparator) throws SystemException {
List<Module> list = findByUserId(userId, 0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} | Module function(long userId, OrderByComparator orderByComparator) throws SystemException { List<Module> list = findByUserId(userId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } | /**
* Returns the first module in the ordered set where userId = ?.
*
* @param userId the user ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching module, or <code>null</code> if a matching module could not be found
* @throws SystemException if a system exception occurred
*/ | Returns the first module in the ordered set where userId = ? | fetchByUserId_First | {
"repo_name": "TelefonicaED/liferaylms-portlet",
"path": "docroot/WEB-INF/src/com/liferay/lms/service/persistence/ModulePersistenceImpl.java",
"license": "agpl-3.0",
"size": 125928
} | [
"com.liferay.lms.model.Module",
"com.liferay.portal.kernel.exception.SystemException",
"com.liferay.portal.kernel.util.OrderByComparator",
"java.util.List"
] | import com.liferay.lms.model.Module; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.util.OrderByComparator; import java.util.List; | import com.liferay.lms.model.*; import com.liferay.portal.kernel.exception.*; import com.liferay.portal.kernel.util.*; import java.util.*; | [
"com.liferay.lms",
"com.liferay.portal",
"java.util"
] | com.liferay.lms; com.liferay.portal; java.util; | 2,212,309 |
QuerySmResult queryShortMessage(String messageId,
TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi,
String sourceAddr) throws PDUException, ResponseTimeoutException,
InvalidResponseException, NegativeResponseException, IOException; | QuerySmResult queryShortMessage(String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, String sourceAddr) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException; | /**
* Query previous submitted short message based on it's message_id and
* message_id. This method will blocks until response received or timeout
* reached. This method is simplify operations of sending QUERY_SM and
* receiving QUERY_SM_RESP.
*
* @param messageId is the message_id.
* @param sourceAddrTon is the source_addr_ton.
* @param sourceAddrNpi is the source_addr_npi.
* @param sourceAddr is the source_addr.
* @return the result of query short message.
* @throws PDUException if there is invalid PDU parameter found.
* @throws ResponseTimeoutException if timeout has been reach.
* @throws InvalidResponseException if response is invalid.
* @throws NegativeResponseException if negative response received.
* @throws IOException if there is an I/O error found.
*/ | Query previous submitted short message based on it's message_id and message_id. This method will blocks until response received or timeout reached. This method is simplify operations of sending QUERY_SM and receiving QUERY_SM_RESP | queryShortMessage | {
"repo_name": "opentelecoms-org/jsmpp",
"path": "jsmpp/src/main/java/org/jsmpp/session/ClientSession.java",
"license": "apache-2.0",
"size": 13511
} | [
"java.io.IOException",
"org.jsmpp.InvalidResponseException",
"org.jsmpp.PDUException",
"org.jsmpp.bean.NumberingPlanIndicator",
"org.jsmpp.bean.TypeOfNumber",
"org.jsmpp.extra.NegativeResponseException",
"org.jsmpp.extra.ResponseTimeoutException"
] | import java.io.IOException; import org.jsmpp.InvalidResponseException; import org.jsmpp.PDUException; import org.jsmpp.bean.NumberingPlanIndicator; import org.jsmpp.bean.TypeOfNumber; import org.jsmpp.extra.NegativeResponseException; import org.jsmpp.extra.ResponseTimeoutException; | import java.io.*; import org.jsmpp.*; import org.jsmpp.bean.*; import org.jsmpp.extra.*; | [
"java.io",
"org.jsmpp",
"org.jsmpp.bean",
"org.jsmpp.extra"
] | java.io; org.jsmpp; org.jsmpp.bean; org.jsmpp.extra; | 2,233,800 |
@NonNull
public AppComponent appComponent() {
if (appComponent == null) {
synchronized (MainApp.class) {
if (appComponent == null) {
appComponent = createAppComponent();
}
}
}
return appComponent;
} | AppComponent function() { if (appComponent == null) { synchronized (MainApp.class) { if (appComponent == null) { appComponent = createAppComponent(); } } } return appComponent; } | /**
* Creates the appComponent object if not created and returns it
* @return
*/ | Creates the appComponent object if not created and returns it | appComponent | {
"repo_name": "PiXeL16/Sea-Nec-IO",
"path": "app/src/main/java/com/greenpixels/seanecio/general_classes/MainApp.java",
"license": "mit",
"size": 2958
} | [
"com.greenpixels.seanecio.components.AppComponent"
] | import com.greenpixels.seanecio.components.AppComponent; | import com.greenpixels.seanecio.components.*; | [
"com.greenpixels.seanecio"
] | com.greenpixels.seanecio; | 976,272 |
void addAttachment(Attachment attachment); | void addAttachment(Attachment attachment); | /**
* Adds the specified attachment to our list of Attachments.
*
* @param attachment attachment to add
*/ | Adds the specified attachment to our list of Attachments | addAttachment | {
"repo_name": "Multi-Support/droolsjbpm-knowledge",
"path": "kie-internal/src/main/java/org/kie/internal/task/api/model/InternalTaskData.java",
"license": "apache-2.0",
"size": 4758
} | [
"org.kie.api.task.model.Attachment"
] | import org.kie.api.task.model.Attachment; | import org.kie.api.task.model.*; | [
"org.kie.api"
] | org.kie.api; | 1,716,930 |
@CheckReturnValue
public LocalTimeAssert assertThat(LocalTime actual) {
return proxy(LocalTimeAssert.class, LocalTime.class, actual);
} | LocalTimeAssert function(LocalTime actual) { return proxy(LocalTimeAssert.class, LocalTime.class, actual); } | /**
* Creates a new instance of <code>{@link LocalTimeAssert}</code>.
*
* @param actual the actual value.
* @return the created assertion object.
*/ | Creates a new instance of <code><code>LocalTimeAssert</code></code> | assertThat | {
"repo_name": "ChrisA89/assertj-core",
"path": "src/main/java/org/assertj/core/api/AbstractStandardSoftAssertions.java",
"license": "apache-2.0",
"size": 10569
} | [
"java.time.LocalTime"
] | import java.time.LocalTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,660,252 |
public void addRootContainerReference(EClass rootContainer) {
EReference reference = ecoreFactory.createEReference();
reference.setName("containedElements");
reference.setUpperBound(-1); // one to many relation
reference.setEType(EcorePackage.eINSTANCE.getEObject());
reference.setContainment(true);
rootContainer.getEStructuralFeatures().add(reference);
} | void function(EClass rootContainer) { EReference reference = ecoreFactory.createEReference(); reference.setName(STR); reference.setUpperBound(-1); reference.setEType(EcorePackage.eINSTANCE.getEObject()); reference.setContainment(true); rootContainer.getEStructuralFeatures().add(reference); } | /**
* Adds a root container {@link EReference} to an root container {@link EClass}. The root container
* {@link EReference} is a one-to-many reference to {@link EObject}.
* @param rootContainer is the root container {@link EClass}.
*/ | Adds a root container <code>EReference</code> to an root container <code>EClass</code>. The root container <code>EReference</code> is a one-to-many reference to <code>EObject</code> | addRootContainerReference | {
"repo_name": "tsaglam/EcoreMetamodelExtraction",
"path": "src/main/java/eme/generator/EMemberGenerator.java",
"license": "epl-1.0",
"size": 9428
} | [
"org.eclipse.emf.ecore.EClass",
"org.eclipse.emf.ecore.EReference",
"org.eclipse.emf.ecore.EcorePackage"
] | import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EcorePackage; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 159,324 |
public void setUI(TaskPaneContainerUI ui) {
super.setUI(ui);
}
/**
* Returns the name of the L&F class that renders this component.
*
* @return the string {@link #uiClassID} | void function(TaskPaneContainerUI ui) { super.setUI(ui); } /** * Returns the name of the L&F class that renders this component. * * @return the string {@link #uiClassID} | /**
* Sets the L&F object that renders this component.
*
* @param ui the <code>TaskPaneContainerUI</code> L&F object
* @see javax.swing.UIDefaults#getUI
*
* @beaninfo bound: true hidden: true description: The UI object that
* implements the taskpane's LookAndFeel.
*/ | Sets the L&F object that renders this component | setUI | {
"repo_name": "trejkaz/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXTaskPaneContainer.java",
"license": "lgpl-2.1",
"size": 5552
} | [
"org.jdesktop.swingx.plaf.TaskPaneContainerUI"
] | import org.jdesktop.swingx.plaf.TaskPaneContainerUI; | import org.jdesktop.swingx.plaf.*; | [
"org.jdesktop.swingx"
] | org.jdesktop.swingx; | 1,615,019 |
@Test
public void applyExceptionWithoutDescription() throws SQLException {
Exception exception = new UnsupportedOperationException();
PreparedStatement statement = mock(PreparedStatement.class);
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
new ExceptionToken(Collections.emptyList()).apply(createLogEntry(exception), statement, 1);
verify(statement).setString(eq(1), captor.capture());
assertThat(captor.getValue())
.startsWith(UnsupportedOperationException.class.getName())
.contains(ExceptionTokenTest.class.getName(), "applyExceptionWithoutDescription")
.hasLineCount(exception.getStackTrace().length + 1);
} | void function() throws SQLException { Exception exception = new UnsupportedOperationException(); PreparedStatement statement = mock(PreparedStatement.class); ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class); new ExceptionToken(Collections.emptyList()).apply(createLogEntry(exception), statement, 1); verify(statement).setString(eq(1), captor.capture()); assertThat(captor.getValue()) .startsWith(UnsupportedOperationException.class.getName()) .contains(ExceptionTokenTest.class.getName(), STR) .hasLineCount(exception.getStackTrace().length + 1); } | /**
* Verifies that an exception without description will be added correctly rendered to a {@link PreparedStatement}.
*
* @throws SQLException
* Failed to add value to prepared SQL statement
*/ | Verifies that an exception without description will be added correctly rendered to a <code>PreparedStatement</code> | applyExceptionWithoutDescription | {
"repo_name": "pmwmedia/tinylog",
"path": "tinylog-impl/src/test/java/org/tinylog/pattern/ExceptionTokenTest.java",
"license": "apache-2.0",
"size": 9601
} | [
"java.sql.PreparedStatement",
"java.sql.SQLException",
"java.util.Collections",
"org.assertj.core.api.Assertions",
"org.mockito.ArgumentCaptor",
"org.mockito.Mockito"
] | import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Collections; import org.assertj.core.api.Assertions; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; | import java.sql.*; import java.util.*; import org.assertj.core.api.*; import org.mockito.*; | [
"java.sql",
"java.util",
"org.assertj.core",
"org.mockito"
] | java.sql; java.util; org.assertj.core; org.mockito; | 1,585,911 |
protected Optional<String> getDeleteLimitWhereClause(@SuppressWarnings("unused") int limit) {
return Optional.empty();
};
| Optional<String> function(@SuppressWarnings(STR) int limit) { return Optional.empty(); }; | /**
* Returns the SQL that specifies the deletion limit in the WHERE clause, if any, for the dialect.
*
* @param limit The delete limit.
* @return The SQL fragment.
*/ | Returns the SQL that specifies the deletion limit in the WHERE clause, if any, for the dialect | getDeleteLimitWhereClause | {
"repo_name": "alfasoftware/morf",
"path": "morf-core/src/main/java/org/alfasoftware/morf/jdbc/SqlDialect.java",
"license": "apache-2.0",
"size": 144949
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,483,904 |
static AttributeDescriptor createAttribute(String typeSpec) throws SchemaException {
int split = typeSpec.indexOf(":");
String name;
String type;
String hint = null;
if (split == -1) {
name = typeSpec;
type = "String";
} else {
name = typeSpec.substring(0, split);
int split2 = typeSpec.indexOf(":", split + 1);
if (split2 == -1) {
type = typeSpec.substring(split + 1);
} else {
type = typeSpec.substring(split + 1, split2);
hint = typeSpec.substring(split2 + 1);
}
}
try {
boolean nillable = true;
CoordinateReferenceSystem crs = null;
if (hint != null) {
StringTokenizer st = new StringTokenizer(hint, ";");
while (st.hasMoreTokens()) {
String h = st.nextToken();
h = h.trim();
// nillable?
// JD: i am pretty sure this hint is useless since the
// default is to make attributes nillable
if (h.equals("nillable")) {
nillable = true;
}
// spatial reference identifier
if (h.startsWith("srid=")) {
String srid = h.split("=")[1];
Integer.parseInt(srid);
try {
crs = CRS.decode("EPSG:" + srid);
} catch (Exception e) {
String msg = "Error decoding srs: " + srid;
throw new SchemaException(msg, e);
}
}
}
}
Class<?> clazz = type(type);
if (Geometry.class.isAssignableFrom(clazz)) {
GeometryType at =
new GeometryTypeImpl(
new NameImpl(name),
clazz,
crs,
false,
false,
Collections.emptyList(),
null,
null);
return new GeometryDescriptorImpl(at, new NameImpl(name), 0, 1, nillable, null);
} else {
AttributeType at =
new AttributeTypeImpl(
new NameImpl(name),
clazz,
false,
false,
Collections.emptyList(),
null,
null);
return new AttributeDescriptorImpl(at, new NameImpl(name), 0, 1, nillable, null);
}
} catch (ClassNotFoundException e) {
throw new SchemaException("Could not type " + name + " as:" + type, e);
}
}
/**
* Manually count the number of features from the provided FeatureIterator. This implementation
* is intended for FeatureCollection implementors and test case verification. Client code should
* always call {@link FeatureCollection#size()} | static AttributeDescriptor createAttribute(String typeSpec) throws SchemaException { int split = typeSpec.indexOf(":"); String name; String type; String hint = null; if (split == -1) { name = typeSpec; type = STR; } else { name = typeSpec.substring(0, split); int split2 = typeSpec.indexOf(":", split + 1); if (split2 == -1) { type = typeSpec.substring(split + 1); } else { type = typeSpec.substring(split + 1, split2); hint = typeSpec.substring(split2 + 1); } } try { boolean nillable = true; CoordinateReferenceSystem crs = null; if (hint != null) { StringTokenizer st = new StringTokenizer(hint, ";"); while (st.hasMoreTokens()) { String h = st.nextToken(); h = h.trim(); if (h.equals(STR)) { nillable = true; } if (h.startsWith("srid=")) { String srid = h.split("=")[1]; Integer.parseInt(srid); try { crs = CRS.decode("EPSG:" + srid); } catch (Exception e) { String msg = STR + srid; throw new SchemaException(msg, e); } } } } Class<?> clazz = type(type); if (Geometry.class.isAssignableFrom(clazz)) { GeometryType at = new GeometryTypeImpl( new NameImpl(name), clazz, crs, false, false, Collections.emptyList(), null, null); return new GeometryDescriptorImpl(at, new NameImpl(name), 0, 1, nillable, null); } else { AttributeType at = new AttributeTypeImpl( new NameImpl(name), clazz, false, false, Collections.emptyList(), null, null); return new AttributeDescriptorImpl(at, new NameImpl(name), 0, 1, nillable, null); } } catch (ClassNotFoundException e) { throw new SchemaException(STR + name + STR + type, e); } } /** * Manually count the number of features from the provided FeatureIterator. This implementation * is intended for FeatureCollection implementors and test case verification. Client code should * always call {@link FeatureCollection#size()} | /**
* Generate AttributeDescriptor based on String type specification (based on UML).
*
* <p>Will parse a String of the form: <i>"name:Type:hint" as described in {@link
* #createType}</i>
*
* @see #createType
* @throws SchemaException If typeSpect could not be interpreted
*/ | Generate AttributeDescriptor based on String type specification (based on UML). Will parse a String of the form: "name:Type:hint" as described in <code>#createType</code> | createAttribute | {
"repo_name": "geotools/geotools",
"path": "modules/library/main/src/main/java/org/geotools/data/DataUtilities.java",
"license": "lgpl-2.1",
"size": 114940
} | [
"java.util.Collections",
"java.util.StringTokenizer",
"org.geotools.feature.FeatureCollection",
"org.geotools.feature.FeatureIterator",
"org.geotools.feature.NameImpl",
"org.geotools.feature.SchemaException",
"org.geotools.feature.type.AttributeDescriptorImpl",
"org.geotools.feature.type.AttributeTypeImpl",
"org.geotools.feature.type.GeometryDescriptorImpl",
"org.geotools.feature.type.GeometryTypeImpl",
"org.geotools.referencing.CRS",
"org.locationtech.jts.geom.Geometry",
"org.opengis.feature.type.AttributeDescriptor",
"org.opengis.feature.type.AttributeType",
"org.opengis.feature.type.GeometryType",
"org.opengis.referencing.crs.CoordinateReferenceSystem"
] | import java.util.Collections; import java.util.StringTokenizer; import org.geotools.feature.FeatureCollection; import org.geotools.feature.FeatureIterator; import org.geotools.feature.NameImpl; import org.geotools.feature.SchemaException; import org.geotools.feature.type.AttributeDescriptorImpl; import org.geotools.feature.type.AttributeTypeImpl; import org.geotools.feature.type.GeometryDescriptorImpl; import org.geotools.feature.type.GeometryTypeImpl; import org.geotools.referencing.CRS; import org.locationtech.jts.geom.Geometry; import org.opengis.feature.type.AttributeDescriptor; import org.opengis.feature.type.AttributeType; import org.opengis.feature.type.GeometryType; import org.opengis.referencing.crs.CoordinateReferenceSystem; | import java.util.*; import org.geotools.feature.*; import org.geotools.feature.type.*; import org.geotools.referencing.*; import org.locationtech.jts.geom.*; import org.opengis.feature.type.*; import org.opengis.referencing.crs.*; | [
"java.util",
"org.geotools.feature",
"org.geotools.referencing",
"org.locationtech.jts",
"org.opengis.feature",
"org.opengis.referencing"
] | java.util; org.geotools.feature; org.geotools.referencing; org.locationtech.jts; org.opengis.feature; org.opengis.referencing; | 133,404 |
public void addHeader(String header, String value) {
synchronized (mLock) {
validateNotStarted();
if (mAdditionalHeaders == null) {
mAdditionalHeaders = new HashMap<String, String>();
}
mAdditionalHeaders.put(header, value);
}
} | void function(String header, String value) { synchronized (mLock) { validateNotStarted(); if (mAdditionalHeaders == null) { mAdditionalHeaders = new HashMap<String, String>(); } mAdditionalHeaders.put(header, value); } } | /**
* Adds a request header. Must be done before request has started.
*/ | Adds a request header. Must be done before request has started | addHeader | {
"repo_name": "axinging/chromium-crosswalk",
"path": "components/cronet/android/java/src/org/chromium/net/ChromiumUrlRequest.java",
"license": "bsd-3-clause",
"size": 26226
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,524,099 |
@Test
public void testSetAllWrite() {
try {
debugPrintTestName();
//get the default options
ClientOptions clientOpts = new ClientOptions();
assertFalse("Default setting for isAllWrite should be false.", clientOpts.isAllWrite());
String clientRoot = client.getRoot();
assertNotNull("clientRoot should not be Null.", clientRoot);
server.setCurrentClient(client);
//create the files
String newFile = clientRoot + File.separator + clientDir + File.separator + "testfileCO.txt";
String newFilePath = clientRoot + File.separator + clientDir;
File file1 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true));
File file2 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true));
File file3 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true));
File file4 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true));
File file5 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true));
//now set the allwrite option to true
clientOpts.setAllWrite(true);
assertTrue("isAllWrite should be true.",clientOpts.isAllWrite());
//create the filelist
final String[] filePaths = {
file1.getAbsolutePath(),
file2.getAbsolutePath(),
file3.getAbsolutePath(),
file4.getAbsolutePath(),
file5.getAbsolutePath()
};
//add the files, submit them, reopen them
IChangelist changelistImpl = getNewChangelist(server, client,
"Changelist to submit files for " + getName());
IChangelist changelist = client.createChangelist(changelistImpl);
List<IFileSpec> fileSpecs = FileSpecBuilder.makeFileSpecList(filePaths);
assertNotNull("FileSpecs should not be Null.", fileSpecs);
List<IFileSpec> addedFileSpecs = client.addFiles(fileSpecs, false, 0, P4JTEST_FILETYPE_TEXT, false);
assertEquals("Number built & added fileSpecs should be equal.", fileSpecs.size(), addedFileSpecs.size());
//submit files. Check if added files are in the correct changelist.
List<IFileSpec> reopenedFileSpecs = client.reopenFiles(fileSpecs, changelist.getId(), P4JTEST_FILETYPE_TEXT);
List<IFileSpec> submittedFileSpecs = changelist.submit(true);
int numSubmitted = FileSpecBuilder.getValidFileSpecs(submittedFileSpecs).size();
assertEquals("numSubmitted should equal number of files created.", filePaths.length, numSubmitted);
//verify the file permission
assertTrue("File1 should be writeable.", file1.canWrite());
assertTrue("File2 should be writeable.", file2.canWrite());
assertTrue("File3 should be writeable.", file3.canWrite());
assertTrue("File4 should be writeable.", file4.canWrite());
assertTrue("File5 should be writeable.", file5.canWrite());
//reset option
clientOpts.setAllWrite(false);
assertFalse("Setting for isAllWrite should be false.",clientOpts.isAllWrite());
//Create a new changelist & open files
changelistImpl = getNewChangelist(server, client,
"Changelist to submit files for " + getName());
changelist = client.createChangelist(changelistImpl);
List<IFileSpec> editedFileSpecs = client.editFiles(fileSpecs, false, false, 0, P4JTEST_FILETYPE_TEXT);
assertEquals("Number built & edit fileSpecs should be equal.", fileSpecs.size(), editedFileSpecs.size());
reopenedFileSpecs.clear();
reopenedFileSpecs = client.reopenFiles(fileSpecs, changelist.getId(), P4JTEST_FILETYPE_TEXT);
//submit files and check if they are writable
submittedFileSpecs.clear();
submittedFileSpecs = changelist.submit(false);
numSubmitted = FileSpecBuilder.getValidFileSpecs(submittedFileSpecs).size();
assertEquals("numSubmitted should equal number of files created.", filePaths.length, numSubmitted);
//verify the file permissions
assertFalse("File1 should not be writeable.", file1.canWrite());
assertFalse("File2 should not be writeable.", file2.canWrite());
assertFalse("File3 should not be writeable.", file3.canWrite());
assertFalse("File4 should not be writeable.", file4.canWrite());
assertFalse("File5 should not be writeable.", file5.canWrite());
} catch (Exception exc){
fail("Unexpected Exception: " + exc + " - " + exc.getLocalizedMessage());
}
}
| void function() { try { debugPrintTestName(); ClientOptions clientOpts = new ClientOptions(); assertFalse(STR, clientOpts.isAllWrite()); String clientRoot = client.getRoot(); assertNotNull(STR, clientRoot); server.setCurrentClient(client); String newFile = clientRoot + File.separator + clientDir + File.separator + STR; String newFilePath = clientRoot + File.separator + clientDir; File file1 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true)); File file2 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true)); File file3 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true)); File file4 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true)); File file5 = new File(newFilePath + File.separator + prepareTestFile(sourceFile, newFile, true)); clientOpts.setAllWrite(true); assertTrue(STR,clientOpts.isAllWrite()); final String[] filePaths = { file1.getAbsolutePath(), file2.getAbsolutePath(), file3.getAbsolutePath(), file4.getAbsolutePath(), file5.getAbsolutePath() }; IChangelist changelistImpl = getNewChangelist(server, client, STR + getName()); IChangelist changelist = client.createChangelist(changelistImpl); List<IFileSpec> fileSpecs = FileSpecBuilder.makeFileSpecList(filePaths); assertNotNull(STR, fileSpecs); List<IFileSpec> addedFileSpecs = client.addFiles(fileSpecs, false, 0, P4JTEST_FILETYPE_TEXT, false); assertEquals(STR, fileSpecs.size(), addedFileSpecs.size()); List<IFileSpec> reopenedFileSpecs = client.reopenFiles(fileSpecs, changelist.getId(), P4JTEST_FILETYPE_TEXT); List<IFileSpec> submittedFileSpecs = changelist.submit(true); int numSubmitted = FileSpecBuilder.getValidFileSpecs(submittedFileSpecs).size(); assertEquals(STR, filePaths.length, numSubmitted); assertTrue(STR, file1.canWrite()); assertTrue(STR, file2.canWrite()); assertTrue(STR, file3.canWrite()); assertTrue(STR, file4.canWrite()); assertTrue(STR, file5.canWrite()); clientOpts.setAllWrite(false); assertFalse(STR,clientOpts.isAllWrite()); changelistImpl = getNewChangelist(server, client, STR + getName()); changelist = client.createChangelist(changelistImpl); List<IFileSpec> editedFileSpecs = client.editFiles(fileSpecs, false, false, 0, P4JTEST_FILETYPE_TEXT); assertEquals(STR, fileSpecs.size(), editedFileSpecs.size()); reopenedFileSpecs.clear(); reopenedFileSpecs = client.reopenFiles(fileSpecs, changelist.getId(), P4JTEST_FILETYPE_TEXT); submittedFileSpecs.clear(); submittedFileSpecs = changelist.submit(false); numSubmitted = FileSpecBuilder.getValidFileSpecs(submittedFileSpecs).size(); assertEquals(STR, filePaths.length, numSubmitted); assertFalse(STR, file1.canWrite()); assertFalse(STR, file2.canWrite()); assertFalse(STR, file3.canWrite()); assertFalse(STR, file4.canWrite()); assertFalse(STR, file5.canWrite()); } catch (Exception exc){ fail(STR + exc + STR + exc.getLocalizedMessage()); } } | /**
* allwrite noallwrite Leaves all files writable on the client;
* else only checked out files are writable. If set, files may be clobbered
* ignoring the clobber option below.
*/ | allwrite noallwrite Leaves all files writable on the client; else only checked out files are writable. If set, files may be clobbered ignoring the clobber option below | testSetAllWrite | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/src/test/java/com/perforce/p4java/tests/dev/unit/endtoend/ClientOptionsE2ETest.java",
"license": "apache-2.0",
"size": 14318
} | [
"com.perforce.p4java.core.IChangelist",
"com.perforce.p4java.core.file.FileSpecBuilder",
"com.perforce.p4java.core.file.IFileSpec",
"com.perforce.p4java.impl.generic.client.ClientOptions",
"java.io.File",
"java.util.List",
"org.junit.Assert"
] | import com.perforce.p4java.core.IChangelist; import com.perforce.p4java.core.file.FileSpecBuilder; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4java.impl.generic.client.ClientOptions; import java.io.File; import java.util.List; import org.junit.Assert; | import com.perforce.p4java.core.*; import com.perforce.p4java.core.file.*; import com.perforce.p4java.impl.generic.client.*; import java.io.*; import java.util.*; import org.junit.*; | [
"com.perforce.p4java",
"java.io",
"java.util",
"org.junit"
] | com.perforce.p4java; java.io; java.util; org.junit; | 2,751,523 |
protected String computeModuleCardName(Module module) {
if (module instanceof BeanCollectionModule) {
return Integer.toHexString(module.hashCode());
} else {
// Simple modules, bean modules can share UI
IViewDescriptor pvd = module.getProjectedViewDescriptor();
if (pvd != null) {
return Integer.toHexString(pvd.hashCode());
}
}
return Integer.toHexString(module.hashCode());
} | String function(Module module) { if (module instanceof BeanCollectionModule) { return Integer.toHexString(module.hashCode()); } else { IViewDescriptor pvd = module.getProjectedViewDescriptor(); if (pvd != null) { return Integer.toHexString(pvd.hashCode()); } } return Integer.toHexString(module.hashCode()); } | /**
* Computes a identifier that is unique per module view.
*
* @param module
* the module
* @return the string
*/ | Computes a identifier that is unique per module view | computeModuleCardName | {
"repo_name": "jspresso/jspresso-ce",
"path": "application/src/main/java/org/jspresso/framework/application/view/descriptor/basic/WorkspaceCardViewDescriptor.java",
"license": "lgpl-3.0",
"size": 3119
} | [
"org.jspresso.framework.application.model.BeanCollectionModule",
"org.jspresso.framework.application.model.Module",
"org.jspresso.framework.view.descriptor.IViewDescriptor"
] | import org.jspresso.framework.application.model.BeanCollectionModule; import org.jspresso.framework.application.model.Module; import org.jspresso.framework.view.descriptor.IViewDescriptor; | import org.jspresso.framework.application.model.*; import org.jspresso.framework.view.descriptor.*; | [
"org.jspresso.framework"
] | org.jspresso.framework; | 94,824 |
@Test
public final void test_that_the_same_Indentation_instance_is_returned_for_the_same_previous_Indentation()
{
final Indentation indentation = builder.newIndentation(mockIndentation);
assertSame(indentation, builder.newIndentation(mockIndentation));
} | final void function() { final Indentation indentation = builder.newIndentation(mockIndentation); assertSame(indentation, builder.newIndentation(mockIndentation)); } | /**
* Tests that the same {@code Indentation} instance is returned for the same previous {@code Indentation}.
*/ | Tests that the same Indentation instance is returned for the same previous Indentation | test_that_the_same_Indentation_instance_is_returned_for_the_same_previous_Indentation | {
"repo_name": "hilcode/text",
"path": "src/test/java/com/github/hilcode/text/impl/DefaultIndentationBuilderTest.java",
"license": "mpl-2.0",
"size": 2935
} | [
"com.github.hilcode.text.Indentation",
"org.junit.Assert"
] | import com.github.hilcode.text.Indentation; import org.junit.Assert; | import com.github.hilcode.text.*; import org.junit.*; | [
"com.github.hilcode",
"org.junit"
] | com.github.hilcode; org.junit; | 2,862,935 |
public interface Executable extends Runnable {
SubTask getParent(); | interface Executable extends Runnable { SubTask function(); | /**
* Task from which this executable was created.
* Never null.
*
* <p>
* Since this method went through a signature change in 1.377, the invocation may results in
* {@link AbstractMethodError}.
* Use {@link Executables#getParentOf(Executable)} that avoids this.
*/ | Task from which this executable was created. Never null. Since this method went through a signature change in 1.377, the invocation may results in <code>AbstractMethodError</code>. Use <code>Executables#getParentOf(Executable)</code> that avoids this | getParent | {
"repo_name": "jtnord/jenkins",
"path": "core/src/main/java/hudson/model/Queue.java",
"license": "mit",
"size": 59609
} | [
"hudson.model.queue.SubTask"
] | import hudson.model.queue.SubTask; | import hudson.model.queue.*; | [
"hudson.model.queue"
] | hudson.model.queue; | 2,296,359 |
public BigDecimal getMargin();
public static final String COLUMNNAME_M_PriceList_Version_ID = "M_PriceList_Version_ID"; | BigDecimal function(); public static final String COLUMNNAME_M_PriceList_Version_ID = STR; | /** Get Margin %.
* Margin for a product as a percentage
*/ | Get Margin %. Margin for a product as a percentage | getMargin | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_RV_WarehousePrice.java",
"license": "gpl-2.0",
"size": 9934
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 2,843,890 |
ResolveScheduling getResolveScheduling() throws ServiceException;
| ResolveScheduling getResolveScheduling() throws ServiceException; | /**
* Getter for the ResolveScheduling.
*
* @return the ResolveScheduling.
* @throws ServiceException
*/ | Getter for the ResolveScheduling | getResolveScheduling | {
"repo_name": "NABUCCO/org.nabucco.business.scheduling",
"path": "org.nabucco.business.scheduling.facade.component/src/main/gen/org/nabucco/business/scheduling/facade/component/SchedulingComponent.java",
"license": "epl-1.0",
"size": 2543
} | [
"org.nabucco.business.scheduling.facade.service.resolve.ResolveScheduling",
"org.nabucco.framework.base.facade.exception.service.ServiceException"
] | import org.nabucco.business.scheduling.facade.service.resolve.ResolveScheduling; import org.nabucco.framework.base.facade.exception.service.ServiceException; | import org.nabucco.business.scheduling.facade.service.resolve.*; import org.nabucco.framework.base.facade.exception.service.*; | [
"org.nabucco.business",
"org.nabucco.framework"
] | org.nabucco.business; org.nabucco.framework; | 1,921,862 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.