method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
EAttribute getLockFeatureResponseType_LockId();
|
EAttribute getLockFeatureResponseType_LockId();
|
/**
* Returns the meta object for the attribute '{@link net.opengis.wfs20.LockFeatureResponseType#getLockId <em>Lock Id</em>}'.
* <!-- begin-user-doc
* --> <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Lock Id</em>'.
* @see net.opengis.wfs20.LockFeatureResponseType#getLockId()
* @see #getLockFeatureResponseType()
* @generated
*/
|
Returns the meta object for the attribute '<code>net.opengis.wfs20.LockFeatureResponseType#getLockId Lock Id</code>'.
|
getLockFeatureResponseType_LockId
|
{
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wfs/src/net/opengis/wfs20/Wfs20Package.java",
"license": "lgpl-2.1",
"size": 404067
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,181,529
|
@Override
public DragMode getDragMode()
{
return getAttributes().getDragMode();
}
|
DragMode function() { return getAttributes().getDragMode(); }
|
/**
* Gets the {@link DragMode} for this node.
*
* @return DragMode
*/
|
Gets the <code>DragMode</code> for this node
|
getDragMode
|
{
"repo_name": "qmx/lienzo-core",
"path": "src/main/java/com/ait/lienzo/client/core/shape/CompositeProxy.java",
"license": "apache-2.0",
"size": 18128
}
|
[
"com.ait.lienzo.shared.core.types.DragMode"
] |
import com.ait.lienzo.shared.core.types.DragMode;
|
import com.ait.lienzo.shared.core.types.*;
|
[
"com.ait.lienzo"
] |
com.ait.lienzo;
| 2,560,468
|
@Test
public void testOf() {
final ImmutableGeneric<Object> generic = Generic.of(2, 3, "test");
final MutableGeneric<Comparable<?>> genericMutable = Generic.ofMutable(2, 3, "test");
assertEquals("test", generic.get(2));
assertEquals(2, genericMutable.set(0, 1));
assertEquals(1, genericMutable.get(0));
assertNull(Generic.ofMutable((Object) null).get(0));
}
|
void function() { final ImmutableGeneric<Object> generic = Generic.of(2, 3, "test"); final MutableGeneric<Comparable<?>> genericMutable = Generic.ofMutable(2, 3, "test"); assertEquals("test", generic.get(2)); assertEquals(2, genericMutable.set(0, 1)); assertEquals(1, genericMutable.get(0)); assertNull(Generic.ofMutable((Object) null).get(0)); }
|
/**
* Test method for {@link Generic#of(T[])}.
*/
|
Test method for <code>Generic#of(T[])</code>
|
testOf
|
{
"repo_name": "Gilandel/utils-commons",
"path": "src/test/java/fr/landel/utils/commons/tuple/GenericTest.java",
"license": "apache-2.0",
"size": 7065
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 678,142
|
public List<String> getEnvelopeAddress() {
return getEnvelopeAddress(getAddressData());
}
|
List<String> function() { return getEnvelopeAddress(getAddressData()); }
|
/**
* Gets the formatted address.
* <p>
* This method does not validate addresses. Also, it will "normalize" the result strings by
* removing redundant spaces and empty lines.
*
* @return the formatted address
*/
|
Gets the formatted address. This method does not validate addresses. Also, it will "normalize" the result strings by removing redundant spaces and empty lines
|
getEnvelopeAddress
|
{
"repo_name": "dlyongemallo/libaddressinput",
"path": "android/src/main/java/com/android/i18n/addressinput/AddressWidget.java",
"license": "apache-2.0",
"size": 31448
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 155,457
|
defaultRolesProperties=string: The name of the properties resource containing
the username to roles mappings that will be used as the defaults
Properties passed to the usersProperties Properties. This defaults to
defaultRoles.properties.
*/
public void initialize(Subject subject, CallbackHandler callbackHandler,
Map<String,?> sharedState, Map<String,?> options)
{
addValidOptions(ALL_VALID_OPTIONS);
super.initialize(subject, callbackHandler, sharedState, options);
try
{
// Check for usersProperties & rolesProperties
String option = (String) options.get(USER_PROPERTIES);
if (option != null)
usersRsrcName = StringPropertyReplacer.replaceProperties(option);
option = (String) options.get(DEFAULT_USER_PROPERTIES);
if (option != null)
defaultUsersRsrcName = StringPropertyReplacer.replaceProperties(option);
option = (String) options.get(ROLES_PROPERTIES);
if (option != null)
rolesRsrcName = StringPropertyReplacer.replaceProperties(option);
option = (String) options.get(DEFAULT_ROLES_PROPERTIES);
if (option != null)
defaultRolesRsrcName = StringPropertyReplacer.replaceProperties(option);
option = (String) options.get(ROLE_GROUP_SEPERATOR);
if( option != null )
roleGroupSeperator = option.charAt(0);
// Load the properties file that contains the list of users and passwords
users = createUsers(options);
roles = createRoles(options);
}
catch (Exception e)
{
PicketBoxLogger.LOGGER.errorLoadingUserRolesPropertiesFiles(e);
}
}
|
defaultRolesProperties=string: The name of the properties resource containing the username to roles mappings that will be used as the defaults Properties passed to the usersProperties Properties. This defaults to defaultRoles.properties. */ void function(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options) { addValidOptions(ALL_VALID_OPTIONS); super.initialize(subject, callbackHandler, sharedState, options); try { String option = (String) options.get(USER_PROPERTIES); if (option != null) usersRsrcName = StringPropertyReplacer.replaceProperties(option); option = (String) options.get(DEFAULT_USER_PROPERTIES); if (option != null) defaultUsersRsrcName = StringPropertyReplacer.replaceProperties(option); option = (String) options.get(ROLES_PROPERTIES); if (option != null) rolesRsrcName = StringPropertyReplacer.replaceProperties(option); option = (String) options.get(DEFAULT_ROLES_PROPERTIES); if (option != null) defaultRolesRsrcName = StringPropertyReplacer.replaceProperties(option); option = (String) options.get(ROLE_GROUP_SEPERATOR); if( option != null ) roleGroupSeperator = option.charAt(0); users = createUsers(options); roles = createRoles(options); } catch (Exception e) { PicketBoxLogger.LOGGER.errorLoadingUserRolesPropertiesFiles(e); } }
|
/** Initialize this LoginModule.
*@param options - the login module option map. Supported options include:
usersProperties: The name of the properties resource containing
user/passwords. The default is "users.properties"
rolesProperties: The name of the properties resource containing user/roles
The default is "roles.properties".
roleGroupSeperator: The character used to seperate the role group name from
the username e.g., '.' in jduke.CallerPrincipal=... . The default = '.'.
defaultUsersProperties=string: The name of the properties resource containing
the username to password mappings that will be used as the defaults
Properties passed to the usersProperties Properties. This defaults to
defaultUsers.properties.
defaultRolesProperties=string: The name of the properties resource containing
the username to roles mappings that will be used as the defaults
Properties passed to the usersProperties Properties. This defaults to
defaultRoles.properties.
*/
|
Initialize this LoginModule
|
initialize
|
{
"repo_name": "picketbox/picketbox",
"path": "security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/UsersRolesLoginModule.java",
"license": "lgpl-2.1",
"size": 10627
}
|
[
"java.util.Map",
"java.util.Properties",
"javax.security.auth.Subject",
"javax.security.auth.callback.CallbackHandler",
"org.jboss.security.PicketBoxLogger",
"org.jboss.security.util.StringPropertyReplacer"
] |
import java.util.Map; import java.util.Properties; import javax.security.auth.Subject; import javax.security.auth.callback.CallbackHandler; import org.jboss.security.PicketBoxLogger; import org.jboss.security.util.StringPropertyReplacer;
|
import java.util.*; import javax.security.auth.*; import javax.security.auth.callback.*; import org.jboss.security.*; import org.jboss.security.util.*;
|
[
"java.util",
"javax.security",
"org.jboss.security"
] |
java.util; javax.security; org.jboss.security;
| 1,558,317
|
synchronized TaskReport generateSingleReport() {
ArrayList<String> diagnostics = new ArrayList<String>();
for (List<String> l : taskDiagnosticData.values()) {
diagnostics.addAll(l);
}
TIPStatus currentStatus = null;
if (isRunning() && !isComplete()) {
currentStatus = TIPStatus.RUNNING;
} else if (isComplete()) {
currentStatus = TIPStatus.COMPLETE;
} else if (wasKilled()) {
currentStatus = TIPStatus.KILLED;
} else if (isFailed()) {
currentStatus = TIPStatus.FAILED;
} else if (!(isComplete() || isRunning() || wasKilled())) {
currentStatus = TIPStatus.PENDING;
}
TaskReport report = new TaskReport
(getTIPId(), (float)progress, state,
diagnostics.toArray(new String[diagnostics.size()]),
currentStatus, execStartTime, execFinishTime, counters);
if (currentStatus == TIPStatus.RUNNING) {
report.setRunningTaskAttempts(activeTasks.keySet());
} else if (currentStatus == TIPStatus.COMPLETE) {
report.setSuccessfulAttempt(getSuccessfulTaskid());
}
return report;
}
|
synchronized TaskReport generateSingleReport() { ArrayList<String> diagnostics = new ArrayList<String>(); for (List<String> l : taskDiagnosticData.values()) { diagnostics.addAll(l); } TIPStatus currentStatus = null; if (isRunning() && !isComplete()) { currentStatus = TIPStatus.RUNNING; } else if (isComplete()) { currentStatus = TIPStatus.COMPLETE; } else if (wasKilled()) { currentStatus = TIPStatus.KILLED; } else if (isFailed()) { currentStatus = TIPStatus.FAILED; } else if (!(isComplete() isRunning() wasKilled())) { currentStatus = TIPStatus.PENDING; } TaskReport report = new TaskReport (getTIPId(), (float)progress, state, diagnostics.toArray(new String[diagnostics.size()]), currentStatus, execStartTime, execFinishTime, counters); if (currentStatus == TIPStatus.RUNNING) { report.setRunningTaskAttempts(activeTasks.keySet()); } else if (currentStatus == TIPStatus.COMPLETE) { report.setSuccessfulAttempt(getSuccessfulTaskid()); } return report; }
|
/**
* Creates a "status report" for this task. Includes the
* task ID and overall status, plus reports for all the
* component task-threads that have ever been started.
*/
|
Creates a "status report" for this task. Includes the task ID and overall status, plus reports for all the component task-threads that have ever been started
|
generateSingleReport
|
{
"repo_name": "iVCE/RDFS",
"path": "src/mapred/org/apache/hadoop/mapred/TaskInProgress.java",
"license": "apache-2.0",
"size": 52586
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,720,737
|
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
int b0 = 9;
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0);
}
if (!this.worldObj.isRemote)
{
this.setDead();
this.entityDropItem(new ItemStack(secretAgentMod.throwingKnife), 1.0F);
}
}
|
void function(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { int b0 = 9; par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0); } if (!this.worldObj.isRemote) { this.setDead(); this.entityDropItem(new ItemStack(secretAgentMod.throwingKnife), 1.0F); } }
|
/**
* Called when this EntityThrowable hits a block or entity.
*/
|
Called when this EntityThrowable hits a block or entity
|
onImpact
|
{
"repo_name": "DrSideburns/Secret-Agent-Craft-Minecraft-1.6.4",
"path": "src/Dr_Sideburns/SecretAgentMod/EntityThrowingKnife.java",
"license": "apache-2.0",
"size": 1373
}
|
[
"net.minecraft.item.ItemStack",
"net.minecraft.util.DamageSource",
"net.minecraft.util.MovingObjectPosition"
] |
import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.item.*; import net.minecraft.util.*;
|
[
"net.minecraft.item",
"net.minecraft.util"
] |
net.minecraft.item; net.minecraft.util;
| 2,808,324
|
@Override
public void refreshDefaultQueue(Configuration conf, String userName) throws IOException {
//no op
}
|
void function(Configuration conf, String userName) throws IOException { }
|
/**
* Load the fair scheduler queue for given user if available.
*/
|
Load the fair scheduler queue for given user if available
|
refreshDefaultQueue
|
{
"repo_name": "jcamachor/hive",
"path": "shims/0.23/src/main/java/org/apache/hadoop/hive/shims/Hadoop23Shims.java",
"license": "apache-2.0",
"size": 63841
}
|
[
"java.io.IOException",
"org.apache.hadoop.conf.Configuration"
] |
import java.io.IOException; import org.apache.hadoop.conf.Configuration;
|
import java.io.*; import org.apache.hadoop.conf.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 1,162,848
|
boolean isEmpty(PropertyInfo propertyInfo) throws UnsupportedPropertyException;
|
boolean isEmpty(PropertyInfo propertyInfo) throws UnsupportedPropertyException;
|
/**
* Determines whether the properties for given property info is empty.
*
* @param propertyInfo type of supported property
* @return True if there is no property for given supported property type
* @throws UnsupportedPropertyException if the property is not supported
*/
|
Determines whether the properties for given property info is empty
|
isEmpty
|
{
"repo_name": "PerfCake/pc4ide",
"path": "pc4ide-core/src/main/java/org/perfcake/ide/core/model/Model.java",
"license": "apache-2.0",
"size": 7460
}
|
[
"org.perfcake.ide.core.exception.UnsupportedPropertyException"
] |
import org.perfcake.ide.core.exception.UnsupportedPropertyException;
|
import org.perfcake.ide.core.exception.*;
|
[
"org.perfcake.ide"
] |
org.perfcake.ide;
| 2,439,321
|
@Override
public void setEscapeProcessing(boolean enable) throws SQLException {
try {
checkClosed();
} catch (Exception e) {
throw Logger.logAndConvert(log, e);
}
}
|
void function(boolean enable) throws SQLException { try { checkClosed(); } catch (Exception e) { throw Logger.logAndConvert(log, e); } }
|
/**
* Enables or disables processing or JDBC escape syntax. See also
* Connection.nativeSQL.
*
* @param enable
* - true (default) or false (no conversion is attempted)
* @throws java.sql.SQLException
* if this object is closed
*/
|
Enables or disables processing or JDBC escape syntax. See also Connection.nativeSQL
|
setEscapeProcessing
|
{
"repo_name": "fengshao0907/wasp",
"path": "src/main/java/com/alibaba/wasp/jdbc/JdbcStatement.java",
"license": "apache-2.0",
"size": 28665
}
|
[
"java.sql.SQLException"
] |
import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,372,382
|
public void add(DavPropertyName propertyName, int status) {
checkType(TYPE_PROPSTAT);
PropContainer propCont = getPropContainer(status, true);
propCont.addContent(propertyName);
}
|
void function(DavPropertyName propertyName, int status) { checkType(TYPE_PROPSTAT); PropContainer propCont = getPropContainer(status, true); propCont.addContent(propertyName); }
|
/**
* Adds a property name to this response
*
* @param propertyName the property name to add
* @param status the status of the response set to select
*/
|
Adds a property name to this response
|
add
|
{
"repo_name": "sdmcraft/jackrabbit",
"path": "jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/MultiStatusResponse.java",
"license": "apache-2.0",
"size": 18660
}
|
[
"org.apache.jackrabbit.webdav.property.DavPropertyName",
"org.apache.jackrabbit.webdav.property.PropContainer"
] |
import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.PropContainer;
|
import org.apache.jackrabbit.webdav.property.*;
|
[
"org.apache.jackrabbit"
] |
org.apache.jackrabbit;
| 233,577
|
FileDataResult[] agentSendFileData(FileData[] destFiles, InputStream[] streams)
throws AgentRemoteException, AgentConnectionException;
|
FileDataResult[] agentSendFileData(FileData[] destFiles, InputStream[] streams) throws AgentRemoteException, AgentConnectionException;
|
/**
* Send file data to a remote agent
* @param destFiles Info about the file data to send
*/
|
Send file data to a remote agent
|
agentSendFileData
|
{
"repo_name": "cc14514/hq6",
"path": "hq-common/src/main/java/org/hyperic/hq/agent/client/AgentCommandsClient.java",
"license": "unlicense",
"size": 4423
}
|
[
"java.io.InputStream",
"org.hyperic.hq.agent.AgentConnectionException",
"org.hyperic.hq.agent.AgentRemoteException",
"org.hyperic.hq.agent.FileData",
"org.hyperic.hq.agent.FileDataResult"
] |
import java.io.InputStream; import org.hyperic.hq.agent.AgentConnectionException; import org.hyperic.hq.agent.AgentRemoteException; import org.hyperic.hq.agent.FileData; import org.hyperic.hq.agent.FileDataResult;
|
import java.io.*; import org.hyperic.hq.agent.*;
|
[
"java.io",
"org.hyperic.hq"
] |
java.io; org.hyperic.hq;
| 175,922
|
public static Intent getCaptureIntent(final Uri outUri) {
return getCaptureIntent(outUri, false);
}
|
static Intent function(final Uri outUri) { return getCaptureIntent(outUri, false); }
|
/**
* Return the intent of capture.
*
* @param outUri The uri of output.
* @return the intent of capture
*/
|
Return the intent of capture
|
getCaptureIntent
|
{
"repo_name": "Blankj/AndroidUtilCode",
"path": "lib/utilcode/src/main/java/com/blankj/utilcode/util/IntentUtils.java",
"license": "apache-2.0",
"size": 19141
}
|
[
"android.content.Intent",
"android.net.Uri"
] |
import android.content.Intent; import android.net.Uri;
|
import android.content.*; import android.net.*;
|
[
"android.content",
"android.net"
] |
android.content; android.net;
| 1,482,374
|
@SuppressWarnings("deprecation")
public static boolean isScreenOn(final Context context) {
final PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
return pm == null || pm.isScreenOn();
}
|
@SuppressWarnings(STR) static boolean function(final Context context) { final PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); return pm == null pm.isScreenOn(); }
|
/**
* Returns the screen status (true=on, false=off).
* @param context The Android context.
* @return boolean
*/
|
Returns the screen status (true=on, false=off)
|
isScreenOn
|
{
"repo_name": "Keidan/MediaEnhance",
"path": "app/src/main/java/fr/ralala/mediaenhance/utils/Helper.java",
"license": "gpl-3.0",
"size": 2453
}
|
[
"android.content.Context",
"android.os.PowerManager"
] |
import android.content.Context; import android.os.PowerManager;
|
import android.content.*; import android.os.*;
|
[
"android.content",
"android.os"
] |
android.content; android.os;
| 403,046
|
switch (errorCode) {
case IO_Error:
case Disk_Unavailable:
clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Error);
break;
case Partition_ReadOnly:
clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Partition_ReadOnly);
//fall through
default:
clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok);
break;
}
// Regardless of what the error code is (or there is no error), it is a node response event.
clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Node_Response);
}
/**
* Act on an event in the form of a {@link NetworkClientErrorCode} on the given {@link ReplicaId}
|
switch (errorCode) { case IO_Error: case Disk_Unavailable: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Error); break; case Partition_ReadOnly: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Partition_ReadOnly); default: clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Disk_Ok); break; } clusterMap.onReplicaEvent(replicaId, ReplicaEventType.Node_Response); } /** * Act on an event in the form of a {@link NetworkClientErrorCode} on the given {@link ReplicaId}
|
/**
* Act on an event in the form of a {@link ServerErrorCode} on the given {@link ReplicaId}
* @param replicaId the {@link ReplicaId} to which the request that received the error was made.
* @param errorCode the {@link ServerErrorCode} received for the request.
*/
|
Act on an event in the form of a <code>ServerErrorCode</code> on the given <code>ReplicaId</code>
|
onServerEvent
|
{
"repo_name": "nsivabalan/ambry",
"path": "ambry-commons/src/main/java/com.github.ambry.commons/ResponseHandler.java",
"license": "apache-2.0",
"size": 4482
}
|
[
"com.github.ambry.clustermap.ReplicaEventType",
"com.github.ambry.clustermap.ReplicaId",
"com.github.ambry.network.NetworkClientErrorCode"
] |
import com.github.ambry.clustermap.ReplicaEventType; import com.github.ambry.clustermap.ReplicaId; import com.github.ambry.network.NetworkClientErrorCode;
|
import com.github.ambry.clustermap.*; import com.github.ambry.network.*;
|
[
"com.github.ambry"
] |
com.github.ambry;
| 2,901,768
|
protected void encode(byte[][] src, int[] srcOff, byte[][] repair,
int[] repairOff, int[] index, int packetLength) {
if (packetLength % 2 != 0) {
throw new IllegalArgumentException("For 16 bit codes, buffers "+
"must be 16 bit aligned.");
}
char[][] srcChars = new char[src.length][];
int[] srcCharsOff = new int[src.length];
int numChars = packetLength/2;
char[] repairChars = new char[numChars];
for (int i=0;i<srcChars.length;i++) {
srcChars[i] = new char[numChars];
Util.arraycopy(src[i], srcOff[i], srcChars[i], 0, packetLength);
srcCharsOff[i] = 0;
}
for (int i=0;i<repair.length;i++) {
if (index[i] < k) { // < k, systematic so direct copy.
System.arraycopy(src[index[i]],srcOff[index[i]],repair[i],
repairOff[i], packetLength);
} else {
encode(srcChars,srcCharsOff,repairChars,0,index[i],numChars);
Util.arraycopy(repairChars,0,repair[i],repairOff[i],
packetLength);
}
}
}
|
void function(byte[][] src, int[] srcOff, byte[][] repair, int[] repairOff, int[] index, int packetLength) { if (packetLength % 2 != 0) { throw new IllegalArgumentException(STR+ STR); } char[][] srcChars = new char[src.length][]; int[] srcCharsOff = new int[src.length]; int numChars = packetLength/2; char[] repairChars = new char[numChars]; for (int i=0;i<srcChars.length;i++) { srcChars[i] = new char[numChars]; Util.arraycopy(src[i], srcOff[i], srcChars[i], 0, packetLength); srcCharsOff[i] = 0; } for (int i=0;i<repair.length;i++) { if (index[i] < k) { System.arraycopy(src[index[i]],srcOff[index[i]],repair[i], repairOff[i], packetLength); } else { encode(srcChars,srcCharsOff,repairChars,0,index[i],numChars); Util.arraycopy(repairChars,0,repair[i],repairOff[i], packetLength); } } }
|
/**
* encode accepts as input pointers to n data packets of size sz,
* and produces as output a packet pointed to by fec, computed
* with index "index".
*/
|
encode accepts as input pointers to n data packets of size sz, and produces as output a packet pointed to by fec, computed with index "index"
|
encode
|
{
"repo_name": "jimdowling/gvod",
"path": "ls-system/src/main/java/com/onionnetworks/fec/Pure16Code.java",
"license": "gpl-3.0",
"size": 4958
}
|
[
"com.onionnetworks.util.Util"
] |
import com.onionnetworks.util.Util;
|
import com.onionnetworks.util.*;
|
[
"com.onionnetworks.util"
] |
com.onionnetworks.util;
| 116,898
|
private static boolean sort2Args(final IASTMutable ast, final boolean setFlag) {
IExpr temp;
if (ast.arg1().compareTo(ast.arg2()) > 0) {
// swap arguments
temp = ast.arg2();
ast.set(2, ast.arg1());
ast.set(1, temp);
if (setFlag) {
ast.addEvalFlags(IAST.IS_SORTED);
}
if (LOGGER.isDebugEnabled()) {
checkCachedHashcode(ast);
}
return true;
}
if (setFlag) {
ast.addEvalFlags(IAST.IS_SORTED);
}
return false;
}
|
static boolean function(final IASTMutable ast, final boolean setFlag) { IExpr temp; if (ast.arg1().compareTo(ast.arg2()) > 0) { temp = ast.arg2(); ast.set(2, ast.arg1()); ast.set(1, temp); if (setFlag) { ast.addEvalFlags(IAST.IS_SORTED); } if (LOGGER.isDebugEnabled()) { checkCachedHashcode(ast); } return true; } if (setFlag) { ast.addEvalFlags(IAST.IS_SORTED); } return false; }
|
/**
* Sort an AST with 2 arguments using function <code>Order</code>.
*
* @param ast an ast with 2 arguments
* @return
*/
|
Sort an AST with 2 arguments using function <code>Order</code>
|
sort2Args
|
{
"repo_name": "axkr/symja_android_library",
"path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/EvalAttributes.java",
"license": "gpl-3.0",
"size": 20440
}
|
[
"org.matheclipse.core.interfaces.IASTMutable",
"org.matheclipse.core.interfaces.IExpr"
] |
import org.matheclipse.core.interfaces.IASTMutable; import org.matheclipse.core.interfaces.IExpr;
|
import org.matheclipse.core.interfaces.*;
|
[
"org.matheclipse.core"
] |
org.matheclipse.core;
| 2,189,746
|
public boolean sendLineToRobot(String line) {
if (getConnection() == null || !isPortConfirmed()) return false;
if (line.trim().equals("")) return false;
String reportedline = line;
// does it have a checksum? hide it in the log
if (reportedline.contains(";")) {
String[] lines = line.split(";");
reportedline = lines[0];
}
if(reportedline.trim().isEmpty()) return false;
// catch pen up/down status here
if (line.equals(settings.getPenUpString())) {
penIsUp=true;
}
if (line.equals(settings.getPenDownString())) {
penIsUp=false;
}
if( line.equals("M17") ) {
// engage motors
myPanel.motorsHaveBeenEngaged();
}
if( line.equals("M18")) {
// disengage motors
myPanel.motorsHaveBeenDisengaged();
}
Log.write("white", line );
line += "\n";
// send unmodified line
try {
getConnection().sendMessage(line);
} catch (Exception e) {
Log.error( e.getMessage() );
return false;
}
return true;
}
|
boolean function(String line) { if (getConnection() == null !isPortConfirmed()) return false; if (line.trim().equals(STR;STR;STRM17STRM18STRwhiteSTR\n"; try { getConnection().sendMessage(line); } catch (Exception e) { Log.error( e.getMessage() ); return false; } return true; }
|
/**
* Sends a single command the robot. Could be anything.
*
* @param line command to send.
* @return <code>true</code> if command was sent to the robot; <code>false</code> otherwise.
*/
|
Sends a single command the robot. Could be anything
|
sendLineToRobot
|
{
"repo_name": "paulhurleyuk/Makelangelo",
"path": "java/src/main/java/com/marginallyclever/makelangeloRobot/MakelangeloRobot.java",
"license": "gpl-2.0",
"size": 19943
}
|
[
"com.marginallyclever.makelangelo.Log"
] |
import com.marginallyclever.makelangelo.Log;
|
import com.marginallyclever.makelangelo.*;
|
[
"com.marginallyclever.makelangelo"
] |
com.marginallyclever.makelangelo;
| 1,924,167
|
@Test
public void getUserRegistry_multipleRefId() throws Exception {
dict.put(UserRegistryServiceImpl.CFG_KEY_REFID, new String[] { "basic1", "basic2" });
service.setUserRegistry(ur2Ref);
service.activate(componentContext, dict);
UserRegistry reg = service.getUserRegistry();
assertNotNull("Should see a valid instance returned", reg);
assertTrue("Instance should be a UserRegistryProxy", reg instanceof UserRegistryProxy);
}
|
void function() throws Exception { dict.put(UserRegistryServiceImpl.CFG_KEY_REFID, new String[] { STR, STR }); service.setUserRegistry(ur2Ref); service.activate(componentContext, dict); UserRegistry reg = service.getUserRegistry(); assertNotNull(STR, reg); assertTrue(STR, reg instanceof UserRegistryProxy); }
|
/**
* If multiple configured refId are available, a UserRegistry instance
* shall be returned which is an instance of the UserRegistryProxy.
*/
|
If multiple configured refId are available, a UserRegistry instance shall be returned which is an instance of the UserRegistryProxy
|
getUserRegistry_multipleRefId
|
{
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.registry/test/com/ibm/ws/security/registry/internal/UserRegistryServiceImplWithExplicitConfigurationTest.java",
"license": "epl-1.0",
"size": 20869
}
|
[
"com.ibm.ws.security.registry.UserRegistry",
"org.junit.Assert"
] |
import com.ibm.ws.security.registry.UserRegistry; import org.junit.Assert;
|
import com.ibm.ws.security.registry.*; import org.junit.*;
|
[
"com.ibm.ws",
"org.junit"
] |
com.ibm.ws; org.junit;
| 2,132,851
|
public CGraphWindow getLastWindow() {
return m_graphs.isEmpty() ? null : m_graphs.get(m_graphs.size() - 1);
}
|
CGraphWindow function() { return m_graphs.isEmpty() ? null : m_graphs.get(m_graphs.size() - 1); }
|
/**
* Returns the last opened graph window.
*
* @return The last opened graph window or null if no graph window is open.
*/
|
Returns the last opened graph window
|
getLastWindow
|
{
"repo_name": "mayl8822/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Gui/WindowManager/CWindowManager.java",
"license": "apache-2.0",
"size": 6420
}
|
[
"com.google.security.zynamics.binnavi.Gui"
] |
import com.google.security.zynamics.binnavi.Gui;
|
import com.google.security.zynamics.binnavi.*;
|
[
"com.google.security"
] |
com.google.security;
| 1,494,042
|
public ResourceRefType<T> description(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("description").text(name);
}
}
return this;
}
|
ResourceRefType<T> function(String ... values) { if (values != null) { for(String name: values) { childNode.createChild(STR).text(name); } } return this; }
|
/**
* Creates for all String objects representing <code>description</code> elements,
* a new <code>description</code> element
* @param values list of <code>description</code> objects
* @return the current instance of <code>ResourceRefType<T></code>
*/
|
Creates for all String objects representing <code>description</code> elements, a new <code>description</code> element
|
description
|
{
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaee7/ResourceRefTypeImpl.java",
"license": "epl-1.0",
"size": 15687
}
|
[
"org.jboss.shrinkwrap.descriptor.api.javaee7.ResourceRefType"
] |
import org.jboss.shrinkwrap.descriptor.api.javaee7.ResourceRefType;
|
import org.jboss.shrinkwrap.descriptor.api.javaee7.*;
|
[
"org.jboss.shrinkwrap"
] |
org.jboss.shrinkwrap;
| 2,228,204
|
@Override
public void onWizardContextChange(WizardContextChangeEvent e)
{
StudyDesignChangeEvent changeEvent = (StudyDesignChangeEvent) e;
switch (changeEvent.getType())
{
case CONFIDENCE_INTERVAL:
if (e.getSource() != this) loadFromContext();
break;
}
}
|
void function(WizardContextChangeEvent e) { StudyDesignChangeEvent changeEvent = (StudyDesignChangeEvent) e; switch (changeEvent.getType()) { case CONFIDENCE_INTERVAL: if (e.getSource() != this) loadFromContext(); break; } }
|
/**
* Resize the beta matrix when the design matrix dimensions change
*/
|
Resize the beta matrix when the design matrix dimensions change
|
onWizardContextChange
|
{
"repo_name": "SampleSizeShop/GlimmpseWeb",
"path": "src/edu/ucdenver/bios/glimmpseweb/client/shared/OptionsConfidenceIntervalsPanel.java",
"license": "gpl-2.0",
"size": 19931
}
|
[
"edu.ucdenver.bios.glimmpseweb.client.wizard.WizardContextChangeEvent",
"edu.ucdenver.bios.glimmpseweb.context.StudyDesignChangeEvent"
] |
import edu.ucdenver.bios.glimmpseweb.client.wizard.WizardContextChangeEvent; import edu.ucdenver.bios.glimmpseweb.context.StudyDesignChangeEvent;
|
import edu.ucdenver.bios.glimmpseweb.client.wizard.*; import edu.ucdenver.bios.glimmpseweb.context.*;
|
[
"edu.ucdenver.bios"
] |
edu.ucdenver.bios;
| 783,893
|
private byte[] readFirstRecord(final InputStream input, final String name)
throws OrekitException, IOException {
// read first part of record, up to the ephemeris type
final byte[] firstPart = new byte[HEADER_RECORD_SIZE_OFFSET + 4];
if (!readInRecord(input, firstPart, 0)) {
throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name);
}
// detect the endian format
detectEndianess(firstPart);
// get the ephemerides type
final int deNum = extractInt(firstPart, HEADER_EPHEMERIS_TYPE_OFFSET);
// the record size for this file
int recordSize = 0;
if (deNum == INPOP_DE_NUMBER) {
// INPOP files have an extended DE format, which includes also the record size
recordSize = extractInt(firstPart, HEADER_RECORD_SIZE_OFFSET) << 3;
} else {
// compute the record size for original JPL files
recordSize = computeRecordSize(firstPart, name);
}
if (recordSize <= 0) {
throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name);
}
// build a record with the proper size and finish read of the first complete record
final int start = firstPart.length;
final byte[] record = new byte[recordSize];
System.arraycopy(firstPart, 0, record, 0, firstPart.length);
if (!readInRecord(input, record, start)) {
throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name);
}
return record;
}
|
byte[] function(final InputStream input, final String name) throws OrekitException, IOException { final byte[] firstPart = new byte[HEADER_RECORD_SIZE_OFFSET + 4]; if (!readInRecord(input, firstPart, 0)) { throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name); } detectEndianess(firstPart); final int deNum = extractInt(firstPart, HEADER_EPHEMERIS_TYPE_OFFSET); int recordSize = 0; if (deNum == INPOP_DE_NUMBER) { recordSize = extractInt(firstPart, HEADER_RECORD_SIZE_OFFSET) << 3; } else { recordSize = computeRecordSize(firstPart, name); } if (recordSize <= 0) { throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name); } final int start = firstPart.length; final byte[] record = new byte[recordSize]; System.arraycopy(firstPart, 0, record, 0, firstPart.length); if (!readInRecord(input, record, start)) { throw new OrekitException(OrekitMessages.UNABLE_TO_READ_JPL_HEADER, name); } return record; }
|
/** Read first header record.
* @param input input stream
* @param name name of the file (or zip entry)
* @return record record where to put bytes
* @exception OrekitException if the stream does not contain a JPL ephemeris
* @exception IOException if a read error occurs
*/
|
Read first header record
|
readFirstRecord
|
{
"repo_name": "wardev/orekit",
"path": "src/main/java/org/orekit/bodies/JPLEphemeridesLoader.java",
"license": "apache-2.0",
"size": 42065
}
|
[
"java.io.IOException",
"java.io.InputStream",
"org.orekit.errors.OrekitException",
"org.orekit.errors.OrekitMessages"
] |
import java.io.IOException; import java.io.InputStream; import org.orekit.errors.OrekitException; import org.orekit.errors.OrekitMessages;
|
import java.io.*; import org.orekit.errors.*;
|
[
"java.io",
"org.orekit.errors"
] |
java.io; org.orekit.errors;
| 2,205,830
|
private void readExtension(InputStream in) throws IOException, GIFException
{
int functionCode = in.read();
byte[] data = readData(in);
switch( functionCode )
{
case EXTENSION_COMMENT: // comment block
comment = new String(data, "8859_1");
break;
case EXTENSION_GCONTROL: // Graphics control extension
undraw = (data[0] & 0x1C) >> 2;
// allegedly there can be bad values of this.
if( undraw < 1 && undraw > 3 ) undraw = 1;
hasTransparency = ((data[0] & 0x01) == 1);
transparentIndex = (data[3] & 0xFF);
duration = ((data[2] & 0xFF) << 8) | (data[1] & 0xFF);
break;
// Application extension. We only parse the Netscape animation
// extension here. Which is the only one most use anyway.
case EXTENSION_APPLICATION:
boolean isNS = true;
for(int i = 0; i < nsBlock.length; i++ )
if( nsBlock[i] != data[i] )
isNS = false;
if( isNS )
{
isLooped = true;
loops = ((data[12] & 0xFF) << 8) | (data[13] & 0xFF);
}
break;
default:
break;
}
}
|
void function(InputStream in) throws IOException, GIFException { int functionCode = in.read(); byte[] data = readData(in); switch( functionCode ) { case EXTENSION_COMMENT: comment = new String(data, STR); break; case EXTENSION_GCONTROL: undraw = (data[0] & 0x1C) >> 2; if( undraw < 1 && undraw > 3 ) undraw = 1; hasTransparency = ((data[0] & 0x01) == 1); transparentIndex = (data[3] & 0xFF); duration = ((data[2] & 0xFF) << 8) (data[1] & 0xFF); break; case EXTENSION_APPLICATION: boolean isNS = true; for(int i = 0; i < nsBlock.length; i++ ) if( nsBlock[i] != data[i] ) isNS = false; if( isNS ) { isLooped = true; loops = ((data[12] & 0xFF) << 8) (data[13] & 0xFF); } break; default: break; } }
|
/**
* Handles extension blocks.
*/
|
Handles extension blocks
|
readExtension
|
{
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/javax/imageio/gif/GIFFile.java",
"license": "bsd-3-clause",
"size": 17622
}
|
[
"java.io.IOException",
"java.io.InputStream"
] |
import java.io.IOException; import java.io.InputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,156,901
|
public void setCompleteFeed(Feed... feeds) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
db.beginTransactionNonExclusive();
} else {
db.beginTransaction();
}
for (Feed feed : feeds) {
setFeed(feed);
if (feed.getItems() != null) {
for (FeedItem item : feed.getItems()) {
setFeedItem(item, false);
}
}
if (feed.getPreferences() != null) {
setFeedPreferences(feed.getPreferences());
}
}
db.setTransactionSuccessful();
} catch (SQLException e) {
Log.e(TAG, Log.getStackTraceString(e));
} finally {
db.endTransaction();
}
}
|
void function(Feed... feeds) { try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { db.beginTransactionNonExclusive(); } else { db.beginTransaction(); } for (Feed feed : feeds) { setFeed(feed); if (feed.getItems() != null) { for (FeedItem item : feed.getItems()) { setFeedItem(item, false); } } if (feed.getPreferences() != null) { setFeedPreferences(feed.getPreferences()); } } db.setTransactionSuccessful(); } catch (SQLException e) { Log.e(TAG, Log.getStackTraceString(e)); } finally { db.endTransaction(); } }
|
/**
* Insert all FeedItems of a feed and the feed object itself in a single
* transaction
*/
|
Insert all FeedItems of a feed and the feed object itself in a single transaction
|
setCompleteFeed
|
{
"repo_name": "domingos86/AntennaPod",
"path": "core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java",
"license": "mit",
"size": 89050
}
|
[
"android.database.SQLException",
"android.os.Build",
"android.util.Log",
"de.danoeh.antennapod.core.feed.Feed",
"de.danoeh.antennapod.core.feed.FeedItem"
] |
import android.database.SQLException; import android.os.Build; import android.util.Log; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem;
|
import android.database.*; import android.os.*; import android.util.*; import de.danoeh.antennapod.core.feed.*;
|
[
"android.database",
"android.os",
"android.util",
"de.danoeh.antennapod"
] |
android.database; android.os; android.util; de.danoeh.antennapod;
| 623,633
|
public String executeIDRequest(String issuer, String assertionId) {
String id = "_" + UUID.randomUUID().toString();
DateTime issueInstant = new DateTime();
Issuer issuerElement = new IssuerBuilder().buildObject();
issuerElement.setValue(issuer);
issuerElement.setFormat(NameIDType.ENTITY);
AssertionIDRef assertionIDRef = new AssertionIDRefBuilder().buildObject();
assertionIDRef.setAssertionID(assertionId);
AssertionIDRequest idRequest = new AssertionIDRequestBuilder().buildObject();
idRequest.setVersion(SAMLVersion.VERSION_20);
idRequest.setID(id);
idRequest.setIssueInstant(issueInstant);
idRequest.setIssuer(issuerElement);
idRequest.getAssertionIDRefs().add(assertionIDRef);
return executeClient(idRequest);
}
|
String function(String issuer, String assertionId) { String id = "_" + UUID.randomUUID().toString(); DateTime issueInstant = new DateTime(); Issuer issuerElement = new IssuerBuilder().buildObject(); issuerElement.setValue(issuer); issuerElement.setFormat(NameIDType.ENTITY); AssertionIDRef assertionIDRef = new AssertionIDRefBuilder().buildObject(); assertionIDRef.setAssertionID(assertionId); AssertionIDRequest idRequest = new AssertionIDRequestBuilder().buildObject(); idRequest.setVersion(SAMLVersion.VERSION_20); idRequest.setID(id); idRequest.setIssueInstant(issueInstant); idRequest.setIssuer(issuerElement); idRequest.getAssertionIDRefs().add(assertionIDRef); return executeClient(idRequest); }
|
/**
* This method is used to create AssertionIDRequest message
* @param issuer Issuer of the request message
* @param assertionId Requested Assertion id
* @return Response response message from SAMLQuery service
*/
|
This method is used to create AssertionIDRequest message
|
executeIDRequest
|
{
"repo_name": "milindaperera/product-is",
"path": "modules/integration/tests-common/admin-clients/src/main/java/org/wso2/identity/integration/common/clients/sso/saml/query/SAMLQueryClient.java",
"license": "apache-2.0",
"size": 8050
}
|
[
"java.util.UUID",
"org.joda.time.DateTime",
"org.opensaml.saml.common.SAMLVersion",
"org.opensaml.saml.saml2.core.AssertionIDRef",
"org.opensaml.saml.saml2.core.AssertionIDRequest",
"org.opensaml.saml.saml2.core.Issuer",
"org.opensaml.saml.saml2.core.NameIDType",
"org.opensaml.saml.saml2.core.impl.AssertionIDRefBuilder",
"org.opensaml.saml.saml2.core.impl.AssertionIDRequestBuilder",
"org.opensaml.saml.saml2.core.impl.IssuerBuilder"
] |
import java.util.UUID; import org.joda.time.DateTime; import org.opensaml.saml.common.SAMLVersion; import org.opensaml.saml.saml2.core.AssertionIDRef; import org.opensaml.saml.saml2.core.AssertionIDRequest; import org.opensaml.saml.saml2.core.Issuer; import org.opensaml.saml.saml2.core.NameIDType; import org.opensaml.saml.saml2.core.impl.AssertionIDRefBuilder; import org.opensaml.saml.saml2.core.impl.AssertionIDRequestBuilder; import org.opensaml.saml.saml2.core.impl.IssuerBuilder;
|
import java.util.*; import org.joda.time.*; import org.opensaml.saml.common.*; import org.opensaml.saml.saml2.core.*; import org.opensaml.saml.saml2.core.impl.*;
|
[
"java.util",
"org.joda.time",
"org.opensaml.saml"
] |
java.util; org.joda.time; org.opensaml.saml;
| 2,177,332
|
String routeLevel = context.getNodeInstance().getName();
Document document = getDocument(context);
List<Map<String, String>> qualifiers = new ArrayList<Map<String, String>>();
String customDocTypeName = null;
if ( document instanceof IdentityManagementGroupDocument ) {
customDocTypeName = handleGroupDocument(qualifiers, (IdentityManagementGroupDocument)document, routeLevel);
} else if ( document instanceof IdentityManagementRoleDocument ) {
customDocTypeName = handleRoleDocument(qualifiers, (IdentityManagementRoleDocument)document, routeLevel);
} else if ( document instanceof IdentityManagementPersonDocument ) {
customDocTypeName = handlePersonDocument(qualifiers, (IdentityManagementPersonDocument)document, routeLevel);
}
// add standard components
decorateWithCommonQualifiers(qualifiers, context, customDocTypeName);
// return the resulting list of Map<String, String>s
return qualifiers;
}
|
String routeLevel = context.getNodeInstance().getName(); Document document = getDocument(context); List<Map<String, String>> qualifiers = new ArrayList<Map<String, String>>(); String customDocTypeName = null; if ( document instanceof IdentityManagementGroupDocument ) { customDocTypeName = handleGroupDocument(qualifiers, (IdentityManagementGroupDocument)document, routeLevel); } else if ( document instanceof IdentityManagementRoleDocument ) { customDocTypeName = handleRoleDocument(qualifiers, (IdentityManagementRoleDocument)document, routeLevel); } else if ( document instanceof IdentityManagementPersonDocument ) { customDocTypeName = handlePersonDocument(qualifiers, (IdentityManagementPersonDocument)document, routeLevel); } decorateWithCommonQualifiers(qualifiers, context, customDocTypeName); return qualifiers; }
|
/**
* This overridden method ...
*
* @see org.kuali.rice.kew.role.QualifierResolver#resolve(org.kuali.rice.kew.engine.RouteContext)
*/
|
This overridden method ..
|
resolve
|
{
"repo_name": "mztaylor/rice-git",
"path": "rice-middleware/impl/src/main/java/org/kuali/rice/kim/impl/type/KimTypeQualifierResolver.java",
"license": "apache-2.0",
"size": 12985
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.kuali.rice.kim.document.IdentityManagementGroupDocument",
"org.kuali.rice.kim.document.IdentityManagementPersonDocument",
"org.kuali.rice.kim.document.IdentityManagementRoleDocument",
"org.kuali.rice.krad.document.Document"
] |
import java.util.ArrayList; import java.util.List; import java.util.Map; import org.kuali.rice.kim.document.IdentityManagementGroupDocument; import org.kuali.rice.kim.document.IdentityManagementPersonDocument; import org.kuali.rice.kim.document.IdentityManagementRoleDocument; import org.kuali.rice.krad.document.Document;
|
import java.util.*; import org.kuali.rice.kim.document.*; import org.kuali.rice.krad.document.*;
|
[
"java.util",
"org.kuali.rice"
] |
java.util; org.kuali.rice;
| 491,219
|
@Test
public void testGetTempDirectory() throws Exception {
File tmp = Settings.getTempDirectory();
Assert.assertTrue(tmp.exists());
}
|
void function() throws Exception { File tmp = Settings.getTempDirectory(); Assert.assertTrue(tmp.exists()); }
|
/**
* Test of getTempDirectory.
*/
|
Test of getTempDirectory
|
testGetTempDirectory
|
{
"repo_name": "colezlaw/DependencyCheck",
"path": "dependency-check-utils/src/test/java/org/owasp/dependencycheck/utils/SettingsTest.java",
"license": "apache-2.0",
"size": 10737
}
|
[
"java.io.File",
"org.junit.Assert"
] |
import java.io.File; import org.junit.Assert;
|
import java.io.*; import org.junit.*;
|
[
"java.io",
"org.junit"
] |
java.io; org.junit;
| 1,627,896
|
public AccessibleEditableText getAccessibleEditableText()
{
return this;
}
|
AccessibleEditableText function() { return this; }
|
/**
* Retrieve an AccessibleEditableText object that controls this
* text component.
*
* @return this
*/
|
Retrieve an AccessibleEditableText object that controls this text component
|
getAccessibleEditableText
|
{
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/text/JTextComponent.java",
"license": "bsd-3-clause",
"size": 50252
}
|
[
"javax.accessibility.AccessibleEditableText"
] |
import javax.accessibility.AccessibleEditableText;
|
import javax.accessibility.*;
|
[
"javax.accessibility"
] |
javax.accessibility;
| 1,693,204
|
public static Field getUnsignedShortField(byte[] bytes) {
Utils.checkState(bytes.length == 2, "2 bytes required to parse an unsigned short");
final short shortVal = Shorts.fromByteArray(bytes);
int intVal = shortVal >= 0 ? shortVal : 0x10000 + shortVal;
return Field.create(intVal);
}
|
static Field function(byte[] bytes) { Utils.checkState(bytes.length == 2, STR); final short shortVal = Shorts.fromByteArray(bytes); int intVal = shortVal >= 0 ? shortVal : 0x10000 + shortVal; return Field.create(intVal); }
|
/**
* Adapted from https://stackoverflow.com/a/7932774/375670
* @param bytes the raw bytes to interpret as an unsigned short
* @return an INTEGER field with the unsigned short value
*/
|
Adapted from HREF
|
getUnsignedShortField
|
{
"repo_name": "rockmkd/datacollector",
"path": "net-commonlib/src/main/java/com/streamsets/pipeline/lib/parser/net/netflow/v9/NetflowV9Decoder.java",
"license": "apache-2.0",
"size": 28999
}
|
[
"com.google.common.primitives.Shorts",
"com.streamsets.pipeline.api.Field",
"com.streamsets.pipeline.api.impl.Utils"
] |
import com.google.common.primitives.Shorts; import com.streamsets.pipeline.api.Field; import com.streamsets.pipeline.api.impl.Utils;
|
import com.google.common.primitives.*; import com.streamsets.pipeline.api.*; import com.streamsets.pipeline.api.impl.*;
|
[
"com.google.common",
"com.streamsets.pipeline"
] |
com.google.common; com.streamsets.pipeline;
| 955,125
|
@Test
public void testNonExistingFileIsFailure() throws Exception {
// initialize file
File file = new File(this.testDirectory, randomFileName);
// test
ExecutionResult result = asserterHelper.assertFileExist(file, messageProvider, "key", executionResult);
assertTrue(result.getState() == ExecutionState.FAILURE);
}
|
void function() throws Exception { File file = new File(this.testDirectory, randomFileName); ExecutionResult result = asserterHelper.assertFileExist(file, messageProvider, "key", executionResult); assertTrue(result.getState() == ExecutionState.FAILURE); }
|
/**
* Test that non existing file is a negative match
*
* @throws Exception
* if test fails.
*/
|
Test that non existing file is a negative match
|
testNonExistingFileIsFailure
|
{
"repo_name": "athrane/pineapple",
"path": "support/pineapple-hamcrest-support/src/test/java/com/alpha/pineapple/test/AssertionHelperImplIntegrationTest.java",
"license": "gpl-3.0",
"size": 7755
}
|
[
"com.alpha.pineapple.execution.ExecutionResult",
"java.io.File",
"org.junit.Assert"
] |
import com.alpha.pineapple.execution.ExecutionResult; import java.io.File; import org.junit.Assert;
|
import com.alpha.pineapple.execution.*; import java.io.*; import org.junit.*;
|
[
"com.alpha.pineapple",
"java.io",
"org.junit"
] |
com.alpha.pineapple; java.io; org.junit;
| 809,731
|
@Override
public Object draw(Graphics2D g2, Rectangle2D area, Object params) {
draw(g2, area);
return null;
}
|
Object function(Graphics2D g2, Rectangle2D area, Object params) { draw(g2, area); return null; }
|
/**
* Draws the block within the specified area.
*
* @param g2 the graphics device.
* @param area the area.
* @param params ignored ({@code null} permitted).
*
* @return Always {@code null}.
*/
|
Draws the block within the specified area
|
draw
|
{
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/block/ColorBlock.java",
"license": "lgpl-2.1",
"size": 5627
}
|
[
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D"
] |
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D;
|
import java.awt.*; import java.awt.geom.*;
|
[
"java.awt"
] |
java.awt;
| 1,604,313
|
@Test
public void testDirectLookupManagedScheduledExecutorServiceAsWorkManager(HttpServletRequest request, HttpServletResponse response) throws Exception {
WorkManager wm = InitialContext.doLookup("wm/scheduledExecutor");
assertNotNull(wm);
assertTrue(wm.toString(), wm instanceof ScheduledExecutorService);
assertTrue(wm.toString(), wm instanceof ManagedScheduledExecutorService);
// Verify that work runs with the submitting application's context when scheduled
CompletableFuture<WorkManager> result = new CompletableFuture<WorkManager>();
wm.schedule(() -> {
try {
// Requires JEE metadata context of the application:
result.complete(InitialContext.doLookup("java:app/env/wm/scheduledExecutorServiceRef"));
} catch (NamingException x) {
throw new CompletionException(x);
}
});
assertNotNull(result.get(TIMEOUT_NS, TimeUnit.NANOSECONDS));
}
|
void function(HttpServletRequest request, HttpServletResponse response) throws Exception { WorkManager wm = InitialContext.doLookup(STR); assertNotNull(wm); assertTrue(wm.toString(), wm instanceof ScheduledExecutorService); assertTrue(wm.toString(), wm instanceof ManagedScheduledExecutorService); CompletableFuture<WorkManager> result = new CompletableFuture<WorkManager>(); wm.schedule(() -> { try { result.complete(InitialContext.doLookup(STR)); } catch (NamingException x) { throw new CompletionException(x); } }); assertNotNull(result.get(TIMEOUT_NS, TimeUnit.NANOSECONDS)); }
|
/**
* Direct lookup of a configured managedScheduledExecutorService as a WorkManager.
*/
|
Direct lookup of a configured managedScheduledExecutorService as a WorkManager
|
testDirectLookupManagedScheduledExecutorServiceAsWorkManager
|
{
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.concurrent_fat_work/test-applications/WorkTestApp/src/test/concurrent/work/app/WorkTestServlet.java",
"license": "epl-1.0",
"size": 29745
}
|
[
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.CompletionException",
"java.util.concurrent.ScheduledExecutorService",
"java.util.concurrent.TimeUnit",
"javax.enterprise.concurrent.ManagedScheduledExecutorService",
"javax.naming.InitialContext",
"javax.naming.NamingException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.junit.Assert"
] |
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.enterprise.concurrent.ManagedScheduledExecutorService; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Assert;
|
import java.util.concurrent.*; import javax.enterprise.concurrent.*; import javax.naming.*; import javax.servlet.http.*; import org.junit.*;
|
[
"java.util",
"javax.enterprise",
"javax.naming",
"javax.servlet",
"org.junit"
] |
java.util; javax.enterprise; javax.naming; javax.servlet; org.junit;
| 22,269
|
void initService(CmrRepositoryDefinition cmrRepositoryDefinition);
|
void initService(CmrRepositoryDefinition cmrRepositoryDefinition);
|
/**
* Initializes the service.
*
* @param cmrRepositoryDefinition
* {@link CmrRepositoryDefinition}.
*/
|
Initializes the service
|
initService
|
{
"repo_name": "kugelr/inspectIT",
"path": "inspectIT/src/info/novatec/inspectit/rcp/repository/service/cmr/ICmrService.java",
"license": "agpl-3.0",
"size": 766
}
|
[
"info.novatec.inspectit.rcp.repository.CmrRepositoryDefinition"
] |
import info.novatec.inspectit.rcp.repository.CmrRepositoryDefinition;
|
import info.novatec.inspectit.rcp.repository.*;
|
[
"info.novatec.inspectit"
] |
info.novatec.inspectit;
| 565,741
|
public void testAccessPublicData() throws IOException {
try {
getOtherAppUid();
} catch (FileNotFoundException e) {
fail("Was not able to access another app's public file: " + e);
} catch (SecurityException e) {
fail("Was not able to access another app's public file: " + e);
}
}
|
void function() throws IOException { try { getOtherAppUid(); } catch (FileNotFoundException e) { fail(STR + e); } catch (SecurityException e) { fail(STR + e); } }
|
/**
* Tests that another app's public file can be accessed
* @throws IOException
*/
|
Tests that another app's public file can be accessed
|
testAccessPublicData
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "cts/hostsidetests/appsecurity/test-apps/AppAccessData/src/com/android/cts/appaccessdata/AccessPrivateDataTest.java",
"license": "gpl-3.0",
"size": 4803
}
|
[
"java.io.FileNotFoundException",
"java.io.IOException"
] |
import java.io.FileNotFoundException; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 887,157
|
public HDInsightStreamingActivity setDefines(Map<String, Object> defines) {
this.defines = defines;
return this;
}
|
HDInsightStreamingActivity function(Map<String, Object> defines) { this.defines = defines; return this; }
|
/**
* Set the defines property: Allows user to specify defines for streaming job request.
*
* @param defines the defines value to set.
* @return the HDInsightStreamingActivity object itself.
*/
|
Set the defines property: Allows user to specify defines for streaming job request
|
setDefines
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-analytics-synapse-artifacts/src/main/java/com/azure/analytics/synapse/artifacts/models/HDInsightStreamingActivity.java",
"license": "mit",
"size": 10357
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 700,195
|
public static Response<PaymentInitiationPaymentCreateResponse> createPayment(
PlaidApi client
)
throws Exception {
Response<PaymentInitiationRecipientCreateResponse> createRecipientResponse = RecipientCreateTest.createRecipientWithIban(
client
);
String recipientId = createRecipientResponse.body().getRecipientId();
assertNotNull(recipientId);
PaymentAmount amount = new PaymentAmount()
.currency(PaymentAmountCurrency.GBP)
.value(999.99);
PaymentInitiationPaymentCreateRequest paymentCreateRequest = new PaymentInitiationPaymentCreateRequest()
.recipientId(recipientId)
.reference("reference")
.amount(amount);
Response<PaymentInitiationPaymentCreateResponse> response = client
.paymentInitiationPaymentCreate(paymentCreateRequest)
.execute();
return response;
}
|
static Response<PaymentInitiationPaymentCreateResponse> function( PlaidApi client ) throws Exception { Response<PaymentInitiationRecipientCreateResponse> createRecipientResponse = RecipientCreateTest.createRecipientWithIban( client ); String recipientId = createRecipientResponse.body().getRecipientId(); assertNotNull(recipientId); PaymentAmount amount = new PaymentAmount() .currency(PaymentAmountCurrency.GBP) .value(999.99); PaymentInitiationPaymentCreateRequest paymentCreateRequest = new PaymentInitiationPaymentCreateRequest() .recipientId(recipientId) .reference(STR) .amount(amount); Response<PaymentInitiationPaymentCreateResponse> response = client .paymentInitiationPaymentCreate(paymentCreateRequest) .execute(); return response; }
|
/**
* Utility method that creates a paymentinitiation.
* Used by other integration tests to set up.
*/
|
Utility method that creates a paymentinitiation. Used by other integration tests to set up
|
createPayment
|
{
"repo_name": "plaid/plaid-java",
"path": "src/test/java/com/plaid/client/integration/PaymentCreateTest.java",
"license": "mit",
"size": 1970
}
|
[
"com.plaid.client.integration.RecipientCreateTest",
"com.plaid.client.model.PaymentAmount",
"com.plaid.client.model.PaymentAmountCurrency",
"com.plaid.client.model.PaymentInitiationPaymentCreateRequest",
"com.plaid.client.model.PaymentInitiationPaymentCreateResponse",
"com.plaid.client.model.PaymentInitiationRecipientCreateResponse",
"com.plaid.client.request.PlaidApi",
"org.junit.Assert"
] |
import com.plaid.client.integration.RecipientCreateTest; import com.plaid.client.model.PaymentAmount; import com.plaid.client.model.PaymentAmountCurrency; import com.plaid.client.model.PaymentInitiationPaymentCreateRequest; import com.plaid.client.model.PaymentInitiationPaymentCreateResponse; import com.plaid.client.model.PaymentInitiationRecipientCreateResponse; import com.plaid.client.request.PlaidApi; import org.junit.Assert;
|
import com.plaid.client.integration.*; import com.plaid.client.model.*; import com.plaid.client.request.*; import org.junit.*;
|
[
"com.plaid.client",
"org.junit"
] |
com.plaid.client; org.junit;
| 451,408
|
public static <K, T, ComparatorT extends Comparator<? super T> & Serializable>
Combine.PerKey<K, T, T> perKey(ComparatorT comparator) {
return Combine.perKey(Min.of(comparator));
}
/////////////////////////////////////////////////////////////////////////////
private static class MinFn<T> extends BinaryCombineFn<T> {
@Nullable private final T identity;
private final Comparator<? super T> comparator;
private <ComparatorT extends Comparator<? super T> & Serializable> MinFn(
@Nullable T identity, ComparatorT comparator) {
this.identity = identity;
this.comparator = comparator;
}
|
static <K, T, ComparatorT extends Comparator<? super T> & Serializable> Combine.PerKey<K, T, T> function(ComparatorT comparator) { return Combine.perKey(Min.of(comparator)); } private static class MinFn<T> extends BinaryCombineFn<T> { @Nullable private final T identity; private final Comparator<? super T> comparator; private <ComparatorT extends Comparator<? super T> & Serializable> MinFn( @Nullable T identity, ComparatorT comparator) { this.identity = identity; this.comparator = comparator; }
|
/**
* Returns a {@code PTransform} that takes an input {@code PCollection<KV<K, T>>} and returns a
* {@code PCollection<KV<K, T>>} that contains one output element per key mapping each to the
* minimum of the values associated with that key in the input {@code PCollection}.
*
* <p>See {@link Combine.PerKey} for how this affects timestamps and windowing.
*/
|
Returns a PTransform that takes an input PCollection> and returns a PCollection> that contains one output element per key mapping each to the minimum of the values associated with that key in the input PCollection. See <code>Combine.PerKey</code> for how this affects timestamps and windowing
|
perKey
|
{
"repo_name": "rangadi/beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Min.java",
"license": "apache-2.0",
"size": 10624
}
|
[
"java.io.Serializable",
"java.util.Comparator",
"javax.annotation.Nullable",
"org.apache.beam.sdk.transforms.Combine"
] |
import java.io.Serializable; import java.util.Comparator; import javax.annotation.Nullable; import org.apache.beam.sdk.transforms.Combine;
|
import java.io.*; import java.util.*; import javax.annotation.*; import org.apache.beam.sdk.transforms.*;
|
[
"java.io",
"java.util",
"javax.annotation",
"org.apache.beam"
] |
java.io; java.util; javax.annotation; org.apache.beam;
| 1,798,129
|
public List<CmsResource> getImages() throws CmsException {
if (m_images == null) {
List<CmsResource> images = new ArrayList<CmsResource>();
final CmsObject cms = getCmsObject();
try {
images = getRawImages();
} catch (final CmsException ex) {
CmsMediaAlbumBean.LOG.error(ex.getLocalizedMessage(), ex);
}
final CmsXmlContent xmlContent = getXmlContent();
final String defThumbPath = CmsXmlUtils.concatXpath(
XmlNode.CONFIGURATION.getName(),
XmlNode.THUMBNAILS.getName());
final Locale locale = cms.getRequestContext().getLocale();
final String defConfiguration = xmlContent.getValue(defThumbPath, locale).getStringValue(cms);
m_images = new ArrayList<CmsResource>(images.size());
m_thumbnailInfo = new HashMap<CmsResource, CmsMediaAlbumThumbnail>(images.size());
final List<I_CmsXmlContentValue> broken = new ArrayList<I_CmsXmlContentValue>();
final List<I_CmsXmlContentValue> files = xmlContent.getValues(XmlNode.FILES.getName(), locale);
for (final I_CmsXmlContentValue file : files) {
try {
final String imagePath = getXmlValue(CmsXmlUtils.concatXpath(file.getPath(), XmlNode.FILE.getName()));
final CmsResource image = cms.readResource(imagePath);
if (!images.contains(image)) {
broken.add(file);
continue;
}
images.remove(image);
final String xpath = CmsXmlUtils.concatXpath(file.getPath(), XmlNode.THUMBNAIL.getName());
final I_CmsXmlContentValue thumbnail = xmlContent.getValue(xpath, locale);
m_thumbnailInfo.put(
image,
new CmsMediaAlbumThumbnail(cms, image, thumbnail, defConfiguration, this));
m_images.add(image);
} catch (final Throwable t) {
CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t);
broken.add(file);
}
}
for (final I_CmsXmlContentValue brokenFile : broken) {
// remove broken entries
xmlContent.removeValue(brokenFile.getPath(), locale, brokenFile.getIndex());
}
int i = xmlContent.getIndexCount(XmlNode.FILES.getName(), locale);
for (final CmsResource image : images) {
try {
// fill the xml with the missing information
final I_CmsXmlContentValue file = xmlContent.addValue(cms, XmlNode.FILES.getName(), locale, i);
xmlContent.getValue(CmsXmlUtils.concatXpath(file.getPath(), XmlNode.FILE.getName()), locale).setStringValue(
cms,
cms.getSitePath(image));
// create thumb info
final CmsMediaAlbumThumbnail thumbInfo = new CmsMediaAlbumThumbnail(
cms,
image,
null,
defConfiguration,
this);
m_thumbnailInfo.put(image, thumbInfo);
// increase index
i++;
} catch (final Throwable t) {
CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t);
}
}
if (!images.isEmpty() || !broken.isEmpty()) {
// save changes
try {
saveChanges();
} catch (final Throwable t) {
CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t);
}
}
m_images.addAll(images);
}
return m_images;
}
|
List<CmsResource> function() throws CmsException { if (m_images == null) { List<CmsResource> images = new ArrayList<CmsResource>(); final CmsObject cms = getCmsObject(); try { images = getRawImages(); } catch (final CmsException ex) { CmsMediaAlbumBean.LOG.error(ex.getLocalizedMessage(), ex); } final CmsXmlContent xmlContent = getXmlContent(); final String defThumbPath = CmsXmlUtils.concatXpath( XmlNode.CONFIGURATION.getName(), XmlNode.THUMBNAILS.getName()); final Locale locale = cms.getRequestContext().getLocale(); final String defConfiguration = xmlContent.getValue(defThumbPath, locale).getStringValue(cms); m_images = new ArrayList<CmsResource>(images.size()); m_thumbnailInfo = new HashMap<CmsResource, CmsMediaAlbumThumbnail>(images.size()); final List<I_CmsXmlContentValue> broken = new ArrayList<I_CmsXmlContentValue>(); final List<I_CmsXmlContentValue> files = xmlContent.getValues(XmlNode.FILES.getName(), locale); for (final I_CmsXmlContentValue file : files) { try { final String imagePath = getXmlValue(CmsXmlUtils.concatXpath(file.getPath(), XmlNode.FILE.getName())); final CmsResource image = cms.readResource(imagePath); if (!images.contains(image)) { broken.add(file); continue; } images.remove(image); final String xpath = CmsXmlUtils.concatXpath(file.getPath(), XmlNode.THUMBNAIL.getName()); final I_CmsXmlContentValue thumbnail = xmlContent.getValue(xpath, locale); m_thumbnailInfo.put( image, new CmsMediaAlbumThumbnail(cms, image, thumbnail, defConfiguration, this)); m_images.add(image); } catch (final Throwable t) { CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t); broken.add(file); } } for (final I_CmsXmlContentValue brokenFile : broken) { xmlContent.removeValue(brokenFile.getPath(), locale, brokenFile.getIndex()); } int i = xmlContent.getIndexCount(XmlNode.FILES.getName(), locale); for (final CmsResource image : images) { try { final I_CmsXmlContentValue file = xmlContent.addValue(cms, XmlNode.FILES.getName(), locale, i); xmlContent.getValue(CmsXmlUtils.concatXpath(file.getPath(), XmlNode.FILE.getName()), locale).setStringValue( cms, cms.getSitePath(image)); final CmsMediaAlbumThumbnail thumbInfo = new CmsMediaAlbumThumbnail( cms, image, null, defConfiguration, this); m_thumbnailInfo.put(image, thumbInfo); i++; } catch (final Throwable t) { CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t); } } if (!images.isEmpty() !broken.isEmpty()) { try { saveChanges(); } catch (final Throwable t) { CmsMediaAlbumBean.LOG.error(t.getLocalizedMessage(), t); } } m_images.addAll(images); } return m_images; }
|
/**
* Returns the list of resources in this album.<p>
*
* @return the list of resources in this album
*
* @throws CmsException if something goes wrong
*/
|
Returns the list of resources in this album
|
getImages
|
{
"repo_name": "cernio/ocamg",
"path": "com.alkacon.opencms.mediaalbum/src/com/alkacon/opencms/mediaalbum/CmsMediaAlbumBean.java",
"license": "gpl-3.0",
"size": 31319
}
|
[
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Locale",
"org.opencms.file.CmsObject",
"org.opencms.file.CmsResource",
"org.opencms.main.CmsException",
"org.opencms.xml.CmsXmlUtils",
"org.opencms.xml.content.CmsXmlContent"
] |
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.main.CmsException; import org.opencms.xml.CmsXmlUtils; import org.opencms.xml.content.CmsXmlContent;
|
import java.util.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.xml.*; import org.opencms.xml.content.*;
|
[
"java.util",
"org.opencms.file",
"org.opencms.main",
"org.opencms.xml"
] |
java.util; org.opencms.file; org.opencms.main; org.opencms.xml;
| 2,071,588
|
public static List<ListViewColumn> createDefaultInitialColumnList() {
// OK, set up default list of columns:
// create all instances
ArrayList<ListViewColumn> r = new ArrayList<ListViewColumn>();
for (Descriptor<ListViewColumn> d : ListViewColumn.all())
try {
if (d instanceof ListViewColumnDescriptor) {
ListViewColumnDescriptor ld = (ListViewColumnDescriptor) d;
if (!ld.shownByDefault()) continue; // skip this
}
ListViewColumn lvc = d.newInstance(null, null);
if (!lvc.shownByDefault()) continue; // skip this
r.add(lvc);
} catch (FormException e) {
LOGGER.log(Level.WARNING, "Failed to instantiate "+d.clazz,e);
}
return r;
}
private static final Logger LOGGER = Logger.getLogger(ListViewColumn.class.getName());
public static final double DEFAULT_COLUMNS_ORDINAL_ICON_START = 60;
public static final double DEFAULT_COLUMNS_ORDINAL_ICON_END = 50;
public static final double DEFAULT_COLUMNS_ORDINAL_PROPERTIES_START = 40;
public static final double DEFAULT_COLUMNS_ORDINAL_PROPERTIES_END = 30;
public static final double DEFAULT_COLUMNS_ORDINAL_ACTIONS_START = 20;
public static final double DEFAULT_COLUMNS_ORDINAL_ACTIONS_END = 10;
|
static List<ListViewColumn> function() { ArrayList<ListViewColumn> r = new ArrayList<ListViewColumn>(); for (Descriptor<ListViewColumn> d : ListViewColumn.all()) try { if (d instanceof ListViewColumnDescriptor) { ListViewColumnDescriptor ld = (ListViewColumnDescriptor) d; if (!ld.shownByDefault()) continue; } ListViewColumn lvc = d.newInstance(null, null); if (!lvc.shownByDefault()) continue; r.add(lvc); } catch (FormException e) { LOGGER.log(Level.WARNING, STR+d.clazz,e); } return r; } private static final Logger LOGGER = Logger.getLogger(ListViewColumn.class.getName()); public static final double DEFAULT_COLUMNS_ORDINAL_ICON_START = 60; public static final double DEFAULT_COLUMNS_ORDINAL_ICON_END = 50; public static final double DEFAULT_COLUMNS_ORDINAL_PROPERTIES_START = 40; public static final double DEFAULT_COLUMNS_ORDINAL_PROPERTIES_END = 30; public static final double DEFAULT_COLUMNS_ORDINAL_ACTIONS_START = 20; public static final double DEFAULT_COLUMNS_ORDINAL_ACTIONS_END = 10;
|
/**
* Creates the list of {@link ListViewColumn}s to be used for newly created {@link ListView}s and their likes.
* @since 1.391
*/
|
Creates the list of <code>ListViewColumn</code>s to be used for newly created <code>ListView</code>s and their likes
|
createDefaultInitialColumnList
|
{
"repo_name": "keyurpatankar/hudson",
"path": "core/src/main/java/hudson/views/ListViewColumn.java",
"license": "mit",
"size": 6336
}
|
[
"hudson.model.Descriptor",
"java.util.ArrayList",
"java.util.List",
"java.util.logging.Level",
"java.util.logging.Logger"
] |
import hudson.model.Descriptor; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
|
import hudson.model.*; import java.util.*; import java.util.logging.*;
|
[
"hudson.model",
"java.util"
] |
hudson.model; java.util;
| 1,244,463
|
SourcePath getSourcePath() {
return sourcePath;
}
|
SourcePath getSourcePath() { return sourcePath; }
|
/**
* Exposing sourcePath directly may lead to misuses. Only the internals of the ModernBuildRule
* framework should access this.
*/
|
Exposing sourcePath directly may lead to misuses. Only the internals of the ModernBuildRule framework should access this
|
getSourcePath
|
{
"repo_name": "shybovycha/buck",
"path": "src/com/facebook/buck/rules/modern/InputPath.java",
"license": "apache-2.0",
"size": 2744
}
|
[
"com.facebook.buck.rules.SourcePath"
] |
import com.facebook.buck.rules.SourcePath;
|
import com.facebook.buck.rules.*;
|
[
"com.facebook.buck"
] |
com.facebook.buck;
| 1,727,109
|
@Test
public void testReadPropertiesFromConfiguration_defaultApplicationName() {
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod());
PropertiesConfiguration config = new PropertiesConfiguration();
config.setProperty("api.dfp.applicationName", "INSERT_APPLICATION_NAME_HERE");
try {
new DfpSession.Builder().from(config).withOAuth2Credential(credential).build();
fail("Validation exception expected.");
} catch (ValidationException e) {
assertEquals("applicationName", e.getTrigger());
}
}
|
void function() { Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()); PropertiesConfiguration config = new PropertiesConfiguration(); config.setProperty(STR, STR); try { new DfpSession.Builder().from(config).withOAuth2Credential(credential).build(); fail(STR); } catch (ValidationException e) { assertEquals(STR, e.getTrigger()); } }
|
/**
* Tests that the builder correctly reads properties from a configuration.
*/
|
Tests that the builder correctly reads properties from a configuration
|
testReadPropertiesFromConfiguration_defaultApplicationName
|
{
"repo_name": "nafae/developer",
"path": "modules/ads_lib/src/test/java/com/google/api/ads/dfp/lib/client/DfpSessionTest.java",
"license": "apache-2.0",
"size": 14335
}
|
[
"com.google.api.ads.common.lib.exception.ValidationException",
"com.google.api.client.auth.oauth2.BearerToken",
"com.google.api.client.auth.oauth2.Credential",
"org.apache.commons.configuration.PropertiesConfiguration",
"org.junit.Assert"
] |
import com.google.api.ads.common.lib.exception.ValidationException; import com.google.api.client.auth.oauth2.BearerToken; import com.google.api.client.auth.oauth2.Credential; import org.apache.commons.configuration.PropertiesConfiguration; import org.junit.Assert;
|
import com.google.api.ads.common.lib.exception.*; import com.google.api.client.auth.oauth2.*; import org.apache.commons.configuration.*; import org.junit.*;
|
[
"com.google.api",
"org.apache.commons",
"org.junit"
] |
com.google.api; org.apache.commons; org.junit;
| 291,741
|
public static List<VirtualMachineDescriptor> list(){
List<VirtualMachineDescriptor> list = new ArrayList<VirtualMachineDescriptor>();
try {
pushCl();
List<?> vmdDelegates = (List<?>)invoke(null, VirtualMachineBootstrap.VM_CLASS, "list");
for(Object del: vmdDelegates) {
list.add(VirtualMachineDescriptor.getInstance(del));
}
return list;
} finally {
popCl();
}
}
|
static List<VirtualMachineDescriptor> function(){ List<VirtualMachineDescriptor> list = new ArrayList<VirtualMachineDescriptor>(); try { pushCl(); List<?> vmdDelegates = (List<?>)invoke(null, VirtualMachineBootstrap.VM_CLASS, "list"); for(Object del: vmdDelegates) { list.add(VirtualMachineDescriptor.getInstance(del)); } return list; } finally { popCl(); } }
|
/**
* Return a list of Java virtual machines.
* @return The list of virtual machine descriptors.
*/
|
Return a list of Java virtual machines
|
list
|
{
"repo_name": "nickman/shorthand",
"path": "attach/src/main/java/com/heliosapm/shorthand/attach/vm/VirtualMachine.java",
"license": "apache-2.0",
"size": 12424
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 179,580
|
interface WithZones {
WithCreate withZones(List<String> zones);
}
interface WithCreate extends Creatable<PublicIPPrefix>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithCustomIPPrefix, DefinitionStages.WithIpTags, DefinitionStages.WithPrefixLength, DefinitionStages.WithPublicIPAddressVersion, DefinitionStages.WithSku, DefinitionStages.WithZones {
}
}
interface Update extends Appliable<PublicIPPrefix>, Resource.UpdateWithTags<Update>, UpdateStages.WithCustomIPPrefix, UpdateStages.WithIpTags, UpdateStages.WithPrefixLength, UpdateStages.WithPublicIPAddressVersion, UpdateStages.WithSku, UpdateStages.WithZones {
}
|
interface WithZones { WithCreate withZones(List<String> zones); } interface WithCreate extends Creatable<PublicIPPrefix>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithCustomIPPrefix, DefinitionStages.WithIpTags, DefinitionStages.WithPrefixLength, DefinitionStages.WithPublicIPAddressVersion, DefinitionStages.WithSku, DefinitionStages.WithZones { } } interface Update extends Appliable<PublicIPPrefix>, Resource.UpdateWithTags<Update>, UpdateStages.WithCustomIPPrefix, UpdateStages.WithIpTags, UpdateStages.WithPrefixLength, UpdateStages.WithPublicIPAddressVersion, UpdateStages.WithSku, UpdateStages.WithZones { }
|
/**
* Specifies zones.
* @param zones A list of availability zones denoting the IP allocated for the resource needs to come from
* @return the next definition stage
*/
|
Specifies zones
|
withZones
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/PublicIPPrefix.java",
"license": "mit",
"size": 9267
}
|
[
"com.microsoft.azure.arm.model.Appliable",
"com.microsoft.azure.arm.model.Creatable",
"com.microsoft.azure.arm.resources.models.Resource",
"java.util.List"
] |
import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.Resource; import java.util.List;
|
import com.microsoft.azure.arm.model.*; import com.microsoft.azure.arm.resources.models.*; import java.util.*;
|
[
"com.microsoft.azure",
"java.util"
] |
com.microsoft.azure; java.util;
| 1,079,195
|
private int diff_cleanupSemanticScore(String one, String two) {
if (one.length() == 0 || two.length() == 0) {
// Edges are the best.
return 5;
}
// Each port of this function behaves slightly differently due to
// subtle differences in each language's definition of things like
// 'whitespace'. Since this function's purpose is largely cosmetic,
// the choice has been made to use each language's native features
// rather than force total conformity.
int score = 0;
// One point for non-alphanumeric.
if (!Character.isLetterOrDigit(one.charAt(one.length() - 1)) || !Character.isLetterOrDigit(two.charAt(0))) {
score++;
// Two points for whitespace.
if (Character.isWhitespace(one.charAt(one.length() - 1)) || Character.isWhitespace(two.charAt(0))) {
score++;
// Three points for line breaks.
if (Character.getType(one.charAt(one.length() - 1)) == Character.CONTROL
|| Character.getType(two.charAt(0)) == Character.CONTROL) {
score++;
// Four points for blank lines.
if (BLANKLINEEND.matcher(one).find() || BLANKLINESTART.matcher(two).find()) {
score++;
}
}
}
}
return score;
}
private Pattern BLANKLINEEND = Pattern.compile("\\n\\r?\\n\\Z", Pattern.DOTALL);
private Pattern BLANKLINESTART = Pattern.compile("\\A\\r?\\n\\r?\\n", Pattern.DOTALL);
|
int function(String one, String two) { if (one.length() == 0 two.length() == 0) { return 5; } int score = 0; if (!Character.isLetterOrDigit(one.charAt(one.length() - 1)) !Character.isLetterOrDigit(two.charAt(0))) { score++; if (Character.isWhitespace(one.charAt(one.length() - 1)) Character.isWhitespace(two.charAt(0))) { score++; if (Character.getType(one.charAt(one.length() - 1)) == Character.CONTROL Character.getType(two.charAt(0)) == Character.CONTROL) { score++; if (BLANKLINEEND.matcher(one).find() BLANKLINESTART.matcher(two).find()) { score++; } } } } return score; } private Pattern BLANKLINEEND = Pattern.compile(STR, Pattern.DOTALL); private Pattern BLANKLINESTART = Pattern.compile(STR, Pattern.DOTALL);
|
/**
* Given two strings, compute a score representing whether the internal boundary falls on logical boundaries. Scores
* range from 5 (best) to 0 (worst).
*
* @param one First string.
* @param two Second string.
* @return The score.
*/
|
Given two strings, compute a score representing whether the internal boundary falls on logical boundaries. Scores range from 5 (best) to 0 (worst)
|
diff_cleanupSemanticScore
|
{
"repo_name": "vstabile/chinese-flashcards-android",
"path": "src/com/hichinaschool/flashcards/utils/DiffEngine.java",
"license": "gpl-3.0",
"size": 49777
}
|
[
"java.util.regex.Pattern"
] |
import java.util.regex.Pattern;
|
import java.util.regex.*;
|
[
"java.util"
] |
java.util;
| 1,970,863
|
@NonNull
public static SerialNumberBean copy(@NonNull SerialNumberModel from) {
SerialNumberBean res = new SerialNumberBean();
res.mId = from.getId();
res.mPart0 = from.getPart0();
res.mPart1 = from.getPart1();
return res;
}
public static class Builder {
private SerialNumberBean mRes = new SerialNumberBean();
|
static SerialNumberBean function(@NonNull SerialNumberModel from) { SerialNumberBean res = new SerialNumberBean(); res.mId = from.getId(); res.mPart0 = from.getPart0(); res.mPart1 = from.getPart1(); return res; } public static class Builder { private SerialNumberBean mRes = new SerialNumberBean();
|
/**
* Instantiate a new SerialNumberBean with all the values copied from the given model.
*/
|
Instantiate a new SerialNumberBean with all the values copied from the given model
|
copy
|
{
"repo_name": "BoD/android-contentprovider-generator",
"path": "etc/sample-generated-code/org/jraf/androidcontentprovidergenerator/sample/provider/serialnumber/SerialNumberBean.java",
"license": "gpl-3.0",
"size": 5083
}
|
[
"android.support.annotation.NonNull"
] |
import android.support.annotation.NonNull;
|
import android.support.annotation.*;
|
[
"android.support"
] |
android.support;
| 1,851,117
|
protected void fireExpandEvent(T item, boolean userOriginated) {
fireEvent(new ExpandEvent<>(this, item, userOriginated));
}
|
void function(T item, boolean userOriginated) { fireEvent(new ExpandEvent<>(this, item, userOriginated)); }
|
/**
* Fires an expand event with given item.
*
* @param item
* the expanded item
* @param userOriginated
* whether the expand was triggered by a user interaction or the
* server
*/
|
Fires an expand event with given item
|
fireExpandEvent
|
{
"repo_name": "Darsstar/framework",
"path": "server/src/main/java/com/vaadin/ui/Tree.java",
"license": "apache-2.0",
"size": 36871
}
|
[
"com.vaadin.event.ExpandEvent"
] |
import com.vaadin.event.ExpandEvent;
|
import com.vaadin.event.*;
|
[
"com.vaadin.event"
] |
com.vaadin.event;
| 1,052,610
|
public static void moveDown(JList list) {
if (canMoveDown(list))
moveItems(list, 1, MOVE_DOWN);
}
|
static void function(JList list) { if (canMoveDown(list)) moveItems(list, 1, MOVE_DOWN); }
|
/**
* moves the selected item down by 1
*
* @param list the JList to work on
*/
|
moves the selected item down by 1
|
moveDown
|
{
"repo_name": "williamClanton/singularity",
"path": "weka/src/main/java/weka/gui/JListHelper.java",
"license": "mit",
"size": 5064
}
|
[
"javax.swing.JList"
] |
import javax.swing.JList;
|
import javax.swing.*;
|
[
"javax.swing"
] |
javax.swing;
| 1,533,067
|
public static String generate(int length) {
return new BigInteger(length, new SecureRandom()).toString(RADIX);
}
|
static String function(int length) { return new BigInteger(length, new SecureRandom()).toString(RADIX); }
|
/**
* Use to generate passwords of given length.
*
* @param length of the password in bits
* @return generated password
*/
|
Use to generate passwords of given length
|
generate
|
{
"repo_name": "ITsvetkoFF/Kv-014",
"path": "service/src/main/java/edu/softserve/zoo/service/security/PasswordGenerator.java",
"license": "mit",
"size": 567
}
|
[
"java.math.BigInteger",
"java.security.SecureRandom"
] |
import java.math.BigInteger; import java.security.SecureRandom;
|
import java.math.*; import java.security.*;
|
[
"java.math",
"java.security"
] |
java.math; java.security;
| 543,914
|
public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
ConsumerControl info = (ConsumerControl)o;
int rc = super.tightMarshal1(wireFormat, o, bs);
bs.writeBoolean(info.isClose());
rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
bs.writeBoolean(info.isFlush());
bs.writeBoolean(info.isStart());
bs.writeBoolean(info.isStop());
return rc + 4;
}
|
int function(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConsumerControl info = (ConsumerControl)o; int rc = super.tightMarshal1(wireFormat, o, bs); bs.writeBoolean(info.isClose()); rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs); bs.writeBoolean(info.isFlush()); bs.writeBoolean(info.isStart()); bs.writeBoolean(info.isStop()); return rc + 4; }
|
/**
* Write the booleans that this object uses to a BooleanStream
*/
|
Write the booleans that this object uses to a BooleanStream
|
tightMarshal1
|
{
"repo_name": "Mark-Booth/daq-eclipse",
"path": "uk.ac.diamond.org.apache.activemq/org/apache/activemq/openwire/v2/ConsumerControlMarshaller.java",
"license": "epl-1.0",
"size": 5415
}
|
[
"java.io.IOException",
"org.apache.activemq.command.ConsumerControl",
"org.apache.activemq.command.DataStructure",
"org.apache.activemq.openwire.BooleanStream",
"org.apache.activemq.openwire.OpenWireFormat"
] |
import java.io.IOException; import org.apache.activemq.command.ConsumerControl; import org.apache.activemq.command.DataStructure; import org.apache.activemq.openwire.BooleanStream; import org.apache.activemq.openwire.OpenWireFormat;
|
import java.io.*; import org.apache.activemq.command.*; import org.apache.activemq.openwire.*;
|
[
"java.io",
"org.apache.activemq"
] |
java.io; org.apache.activemq;
| 765,170
|
// Configurable Properties (as per Mail server).
// SMTP_HOST ex: smtp.gmail.com
final String SMTP_HOST = "smtp.gmail.com";
// SMTP_PORT ex: 465 (gmail with SSL authentication), 587 (gmail with StartTLS authentication).
final String SMTP_PORT = "465";
// IS_AUTHENTICATION_REQUIRED for most of the mail server authentication is required.
final String IS_AUTHENTICATION_REQUIRED = "true";
// IS_STARTTLS_ENABLE ex: gmail & outlook mail can be send via startTLS authentication.
// all servers don't use startTLS authentication like yahoo mail server don't have this authentication.
final String IS_STARTTLS_ENABLE = "false";
// IS_SSL_ENABLE ex: gmail mail can be send either by SSL or by startTLS.
// For yahoo mail server it is compulsory to use SSL authentication for sending mail.
final String IS_SSL_ENABLE = "true";
final String IS_DEBUG = "false";
Properties props = new Properties();
props.put("mail.smtp.host", SMTP_HOST);
props.put("mail.smtp.auth", IS_AUTHENTICATION_REQUIRED);
props.put("mail.debug", IS_DEBUG);
props.put("mail.smtp.ssl.enable", IS_SSL_ENABLE);
props.put("mail.smtp.starttls.enable", IS_STARTTLS_ENABLE);
props.put("mail.smtp.port", SMTP_PORT);
if (IS_STARTTLS_ENABLE.equals("false") && IS_SSL_ENABLE.equals("true")) {
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
}
|
final String SMTP_HOST = STR; final String SMTP_PORT = "465"; final String IS_AUTHENTICATION_REQUIRED = "true"; final String IS_STARTTLS_ENABLE = "false"; final String IS_SSL_ENABLE = "true"; final String IS_DEBUG = "false"; Properties props = new Properties(); props.put(STR, SMTP_HOST); props.put(STR, IS_AUTHENTICATION_REQUIRED); props.put(STR, IS_DEBUG); props.put(STR, IS_SSL_ENABLE); props.put(STR, IS_STARTTLS_ENABLE); props.put(STR, SMTP_PORT); if (IS_STARTTLS_ENABLE.equals("false") && IS_SSL_ENABLE.equals("true")) { props.put(STR, STR); }
|
/**
* Creates SMTP Session required for sending mail.
*
* @return Session.
*/
|
Creates SMTP Session required for sending mail
|
getSendMailSession
|
{
"repo_name": "SanjayMadnani/sanjay.communication.mail",
"path": "communication/src/main/java/com/sanjay/communication/helper/CommunicationHelper.java",
"license": "gpl-2.0",
"size": 6048
}
|
[
"java.util.Properties"
] |
import java.util.Properties;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 159,464
|
private void rebalance() {
int activeNodes = (int) clusterService.getNodes()
.stream()
.filter(node -> clusterService.getState(node.id()).isActive())
.count();
int myShare = (int) Math.ceil((double) NUM_PARTITIONS / activeNodes);
// First make sure this node is a candidate for all partitions.
IntStream.range(0, NUM_PARTITIONS)
.mapToObj(this::getPartitionPath)
.map(leadershipService::getLeadership)
.filter(leadership -> !leadership.candidates().contains(localNodeId))
.map(Leadership::topic)
.forEach(leadershipService::runForLeadership);
List<String> myPartitions = IntStream.range(0, NUM_PARTITIONS)
.mapToObj(this::getPartitionPath)
.map(leadershipService::getLeadership)
.filter(Objects::nonNull)
.filter(leadership -> localNodeId.equals(leadership.leaderNodeId()))
.map(Leadership::topic)
.collect(Collectors.toList());
int relinquish = myPartitions.size() - myShare;
for (int i = 0; i < relinquish; i++) {
String topic = myPartitions.get(i);
// Wait till all active nodes are in contention for partition ownership.
// This avoids too many relinquish/reclaim cycles.
if (leadershipService.getCandidates(topic).size() == activeNodes) {
leadershipService.withdraw(topic);
executor.schedule(() -> recontest(topic), BACKOFF_TIME, TimeUnit.SECONDS);
}
}
}
|
void function() { int activeNodes = (int) clusterService.getNodes() .stream() .filter(node -> clusterService.getState(node.id()).isActive()) .count(); int myShare = (int) Math.ceil((double) NUM_PARTITIONS / activeNodes); IntStream.range(0, NUM_PARTITIONS) .mapToObj(this::getPartitionPath) .map(leadershipService::getLeadership) .filter(leadership -> !leadership.candidates().contains(localNodeId)) .map(Leadership::topic) .forEach(leadershipService::runForLeadership); List<String> myPartitions = IntStream.range(0, NUM_PARTITIONS) .mapToObj(this::getPartitionPath) .map(leadershipService::getLeadership) .filter(Objects::nonNull) .filter(leadership -> localNodeId.equals(leadership.leaderNodeId())) .map(Leadership::topic) .collect(Collectors.toList()); int relinquish = myPartitions.size() - myShare; for (int i = 0; i < relinquish; i++) { String topic = myPartitions.get(i); if (leadershipService.getCandidates(topic).size() == activeNodes) { leadershipService.withdraw(topic); executor.schedule(() -> recontest(topic), BACKOFF_TIME, TimeUnit.SECONDS); } } }
|
/**
* Determine whether we have more than our fair share of partitions, and if
* so, relinquish leadership of some of them for a little while to let
* other instances take over.
*/
|
Determine whether we have more than our fair share of partitions, and if so, relinquish leadership of some of them for a little while to let other instances take over
|
rebalance
|
{
"repo_name": "donNewtonAlpha/onos",
"path": "core/store/dist/src/main/java/org/onosproject/store/intent/impl/WorkPartitionManager.java",
"license": "apache-2.0",
"size": 8990
}
|
[
"java.util.List",
"java.util.Objects",
"java.util.concurrent.TimeUnit",
"java.util.stream.Collectors",
"java.util.stream.IntStream",
"org.onosproject.cluster.Leadership"
] |
import java.util.List; import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.onosproject.cluster.Leadership;
|
import java.util.*; import java.util.concurrent.*; import java.util.stream.*; import org.onosproject.cluster.*;
|
[
"java.util",
"org.onosproject.cluster"
] |
java.util; org.onosproject.cluster;
| 358,669
|
public List<Convert<Embedded<T>>> getAllConvert();
|
List<Convert<Embedded<T>>> function();
|
/**
* Returns all <code>convert</code> elements
* @return list of <code>convert</code>
*/
|
Returns all <code>convert</code> elements
|
getAllConvert
|
{
"repo_name": "forge/javaee-descriptors",
"path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/orm21/Embedded.java",
"license": "epl-1.0",
"size": 6872
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,667,999
|
public int body(String messageId) throws IOException {
return sendCommand(NNTPCommand.BODY, messageId);
}
|
int function(String messageId) throws IOException { return sendCommand(NNTPCommand.BODY, messageId); }
|
/***
* A convenience method to send the NNTP BODY command to the server, receive
* the initial reply, and return the reply code.
* <p>
*
* @param messageId
* The message identifier of the requested article, including the
* encapsulating < and > characters.
* @return The reply code received from the server.
* @exception NNTPConnectionClosedException
* If the NNTP server prematurely closes the connection as a
* result of the client being idle or some other reason
* causing the server to send NNTP reply code 400. This
* exception may be caught either as an IOException or
* independently as itself.
* @exception IOException
* If an I/O error occurs while either sending the command or
* receiving the server reply.
***/
|
A convenience method to send the NNTP BODY command to the server, receive the initial reply, and return the reply code.
|
body
|
{
"repo_name": "jreadstone/zsyproject",
"path": "src/org/g4studio/core/net/nntp/NNTP.java",
"license": "gpl-2.0",
"size": 42276
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,355,282
|
public static int getDaysOfTheYear(Connection pConexao, int pAno, boolean pUtil){
return getDaysOfTheYear(pConexao, pAno, pUtil, -1);
}
|
static int function(Connection pConexao, int pAno, boolean pUtil){ return getDaysOfTheYear(pConexao, pAno, pUtil, -1); }
|
/**
* Chama o metodo getDiasDoAno(), considerando cidade_id = -1
* @param pConexao Conexão com banco de dados
* @param pAno Ano
* @param pUtil indicativo se é dia útil(True) ou não(False)
* @return Quantidade de dias do ano informado
*/
|
Chama o metodo getDiasDoAno(), considerando cidade_id = -1
|
getDaysOfTheYear
|
{
"repo_name": "dbsoftcombr/dbssdk",
"path": "src/main/java/br/com/dbsoft/util/DBSDate.java",
"license": "mit",
"size": 65869
}
|
[
"java.sql.Connection"
] |
import java.sql.Connection;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,605,962
|
public void moveFile(String file) {
if (!file.startsWith("/")) {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
file = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + file;
} else {
file = "/data/data/" + handler.cordova.getActivity().getPackageName() + "/cache/" + file;
}
}
int size = this.tempFiles.size();
LOG.d(LOG_TAG, "size = " + size);
// only one file so just copy it
if (size == 1) {
String logMsg = "renaming " + this.tempFile + " to " + file;
LOG.d(LOG_TAG, logMsg);
File f = new File(this.tempFile);
if (!f.renameTo(new File(file))) LOG.e(LOG_TAG, "FAILED " + logMsg);
}
// more than one file so the user must have pause recording. We'll need to concat files.
else {
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(new File(file));
FileInputStream inputStream = null;
File inputFile = null;
for (int i = 0; i < size; i++) {
try {
inputFile = new File(this.tempFiles.get(i));
inputStream = new FileInputStream(inputFile);
copy(inputStream, outputStream, (i>0));
} catch(Exception e) {
LOG.e(LOG_TAG, e.getLocalizedMessage(), e);
} finally {
if (inputStream != null) try {
inputStream.close();
inputFile.delete();
inputFile = null;
} catch (Exception e) {
LOG.e(LOG_TAG, e.getLocalizedMessage(), e);
}
}
}
} catch(Exception e) {
e.printStackTrace();
} finally {
if (outputStream != null) try {
outputStream.close();
} catch (Exception e) {
LOG.e(LOG_TAG, e.getLocalizedMessage(), e);
}
}
}
}
|
void function(String file) { if (!file.startsWith("/")) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { file = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + file; } else { file = STR + handler.cordova.getActivity().getPackageName() + STR + file; } } int size = this.tempFiles.size(); LOG.d(LOG_TAG, STR + size); if (size == 1) { String logMsg = STR + this.tempFile + STR + file; LOG.d(LOG_TAG, logMsg); File f = new File(this.tempFile); if (!f.renameTo(new File(file))) LOG.e(LOG_TAG, STR + logMsg); } else { FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(new File(file)); FileInputStream inputStream = null; File inputFile = null; for (int i = 0; i < size; i++) { try { inputFile = new File(this.tempFiles.get(i)); inputStream = new FileInputStream(inputFile); copy(inputStream, outputStream, (i>0)); } catch(Exception e) { LOG.e(LOG_TAG, e.getLocalizedMessage(), e); } finally { if (inputStream != null) try { inputStream.close(); inputFile.delete(); inputFile = null; } catch (Exception e) { LOG.e(LOG_TAG, e.getLocalizedMessage(), e); } } } } catch(Exception e) { e.printStackTrace(); } finally { if (outputStream != null) try { outputStream.close(); } catch (Exception e) { LOG.e(LOG_TAG, e.getLocalizedMessage(), e); } } } }
|
/**
* Save temporary recorded file to specified name
*
* @param file
*/
|
Save temporary recorded file to specified name
|
moveFile
|
{
"repo_name": "leopatras/cordova-plugin-media",
"path": "src/android/AudioPlayer.java",
"license": "apache-2.0",
"size": 25453
}
|
[
"android.os.Environment",
"java.io.File",
"java.io.FileInputStream",
"java.io.FileOutputStream",
"org.apache.cordova.LOG"
] |
import android.os.Environment; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.cordova.LOG;
|
import android.os.*; import java.io.*; import org.apache.cordova.*;
|
[
"android.os",
"java.io",
"org.apache.cordova"
] |
android.os; java.io; org.apache.cordova;
| 346,957
|
public Collection<Class<? extends IApplication>> getApplications() {
Set<Class<? extends IApplication>> appsCopy = new HashSet<Class<? extends IApplication>>();
appsCopy.addAll(getServices().keySet());
return appsCopy;
}
|
Collection<Class<? extends IApplication>> function() { Set<Class<? extends IApplication>> appsCopy = new HashSet<Class<? extends IApplication>>(); appsCopy.addAll(getServices().keySet()); return appsCopy; }
|
/**
* Returns all application interfaces implemented by the represented application
*
*/
|
Returns all application interfaces implemented by the represented application
|
getApplications
|
{
"repo_name": "logoff/mqnaas",
"path": "core/src/main/java/org/mqnaas/core/impl/ApplicationInstance.java",
"license": "lgpl-3.0",
"size": 16777
}
|
[
"java.util.Collection",
"java.util.HashSet",
"java.util.Set",
"org.mqnaas.core.api.IApplication"
] |
import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.mqnaas.core.api.IApplication;
|
import java.util.*; import org.mqnaas.core.api.*;
|
[
"java.util",
"org.mqnaas.core"
] |
java.util; org.mqnaas.core;
| 1,532,082
|
public int countRawCountQuery(SQLiteDatabase db, String countSql, String... whereArgs) {
SQLiteStatement prog = rawCountSqlToStatementsMap.get(countSql);
if (prog == null) {
prog = db.compileStatement(countSql);
rawCountSqlToStatementsMap.put(countSql, prog);
}
if (whereArgs != null) {
for (int i=0; i<whereArgs.length; i++) {
prog.bindString(i+1, whereArgs[i]);
}
}
try {
int count = (int) prog.simpleQueryForLong();
prog.clearBindings();
return count;
} catch (SQLiteDoneException e) {
return -1;
}
}
|
int function(SQLiteDatabase db, String countSql, String... whereArgs) { SQLiteStatement prog = rawCountSqlToStatementsMap.get(countSql); if (prog == null) { prog = db.compileStatement(countSql); rawCountSqlToStatementsMap.put(countSql, prog); } if (whereArgs != null) { for (int i=0; i<whereArgs.length; i++) { prog.bindString(i+1, whereArgs[i]); } } try { int count = (int) prog.simpleQueryForLong(); prog.clearBindings(); return count; } catch (SQLiteDoneException e) { return -1; } }
|
/**
* Does a count for a raw count query
* @param db
* @param sql
* @param whereArgs
* @return
*/
|
Does a count for a raw count query
|
countRawCountQuery
|
{
"repo_name": "iFernandoSousa/cordova-salesforcesdk",
"path": "src/android/com/salesforce/androidsdk/smartstore/store/DBHelper.java",
"license": "unlicense",
"size": 14894
}
|
[
"net.sqlcipher.database.SQLiteDatabase",
"net.sqlcipher.database.SQLiteDoneException",
"net.sqlcipher.database.SQLiteStatement"
] |
import net.sqlcipher.database.SQLiteDatabase; import net.sqlcipher.database.SQLiteDoneException; import net.sqlcipher.database.SQLiteStatement;
|
import net.sqlcipher.database.*;
|
[
"net.sqlcipher.database"
] |
net.sqlcipher.database;
| 1,132,933
|
public void getSessionEntityType(
com.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest request,
io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2beta1.SessionEntityType>
responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetSessionEntityTypeMethodHelper(), getCallOptions()),
request,
responseObserver);
}
|
void function( com.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest request, io.grpc.stub.StreamObserver<com.google.cloud.dialogflow.v2beta1.SessionEntityType> responseObserver) { asyncUnaryCall( getChannel().newCall(getGetSessionEntityTypeMethodHelper(), getCallOptions()), request, responseObserver); }
|
/**
*
*
* <pre>
* Retrieves the specified session entity type.
* </pre>
*/
|
<code> Retrieves the specified session entity type. </code>
|
getSessionEntityType
|
{
"repo_name": "vam-google/google-cloud-java",
"path": "google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/SessionEntityTypesGrpc.java",
"license": "apache-2.0",
"size": 40159
}
|
[
"io.grpc.stub.ClientCalls",
"io.grpc.stub.ServerCalls"
] |
import io.grpc.stub.ClientCalls; import io.grpc.stub.ServerCalls;
|
import io.grpc.stub.*;
|
[
"io.grpc.stub"
] |
io.grpc.stub;
| 1,094,065
|
public MLocation getValue()
{
return m_location;
} // getValue
|
MLocation function() { return m_location; }
|
/**
* Get edited Value (MLocation)
* @return location
*/
|
Get edited Value (MLocation)
|
getValue
|
{
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempierelbr/client/src/org/compiere/grid/ed/VLocationDialog.java",
"license": "gpl-2.0",
"size": 22168
}
|
[
"org.compiere.model.MLocation"
] |
import org.compiere.model.MLocation;
|
import org.compiere.model.*;
|
[
"org.compiere.model"
] |
org.compiere.model;
| 61,968
|
public float predictNearestApproachTime(GameEntity gameEntity) {
Vector3f agentVelocity = velocity;
Vector3f otherVelocity = gameEntity.getVelocity();
if (agentVelocity == null) {
agentVelocity = new Vector3f();
}
if (otherVelocity == null) {
otherVelocity = new Vector3f();
}
Vector3f relVel = otherVelocity.subtract(agentVelocity);
float relSpeed = relVel.length();
// "Take the unit tangent along the other vehicle's path"
Vector3f relTangent = relVel.divide(relSpeed);
Vector3f offset = gameEntity.offset(this);
float projection = relTangent.dot(offset);
return projection / relSpeed;
}
|
float function(GameEntity gameEntity) { Vector3f agentVelocity = velocity; Vector3f otherVelocity = gameEntity.getVelocity(); if (agentVelocity == null) { agentVelocity = new Vector3f(); } if (otherVelocity == null) { otherVelocity = new Vector3f(); } Vector3f relVel = otherVelocity.subtract(agentVelocity); float relSpeed = relVel.length(); Vector3f relTangent = relVel.divide(relSpeed); Vector3f offset = gameEntity.offset(this); float projection = relTangent.dot(offset); return projection / relSpeed; }
|
/**
* Given two vehicles, based on their current positions and velocities,
* determine the time until nearest approach.
*
* @param gameEntity Other gameEntity
* @return The time until nearest approach
*/
|
Given two vehicles, based on their current positions and velocities, determine the time until nearest approach
|
predictNearestApproachTime
|
{
"repo_name": "QuietOne/MonkeyBrains",
"path": "src/com/jme3/ai/agents/Agent.java",
"license": "bsd-3-clause",
"size": 11837
}
|
[
"com.jme3.ai.agents.util.GameEntity",
"com.jme3.math.Vector3f"
] |
import com.jme3.ai.agents.util.GameEntity; import com.jme3.math.Vector3f;
|
import com.jme3.ai.agents.util.*; import com.jme3.math.*;
|
[
"com.jme3.ai",
"com.jme3.math"
] |
com.jme3.ai; com.jme3.math;
| 2,141,963
|
protected void addEntry(final String entry, final Vector args) {
}
|
void function(final String entry, final Vector args) { }
|
/**
* Add alternative entry point.
* @param entry String entry point
* @param args Vector command line arguments
*/
|
Add alternative entry point
|
addEntry
|
{
"repo_name": "cniweb/ant-contrib",
"path": "cpptasks/src/main/java/net/sf/antcontrib/cpptasks/openwatcom/OpenWatcomLibrarian.java",
"license": "apache-2.0",
"size": 7381
}
|
[
"java.util.Vector"
] |
import java.util.Vector;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,894,683
|
@Override
protected void writeNext(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
try {
// startCaching(true);
if (length == 0)
return;
if (_cacheStream != null) {
_cacheStream.write(buf, offset, length);
}
if (_stream != null)
_stream.write(buf, offset, length);
else
getOutputStream().write(buf, offset, length);
} catch (IOException e) {
throw e;
}
}
|
void function(byte []buf, int offset, int length, boolean isEnd) throws IOException { try { if (length == 0) return; if (_cacheStream != null) { _cacheStream.write(buf, offset, length); } if (_stream != null) _stream.write(buf, offset, length); else getOutputStream().write(buf, offset, length); } catch (IOException e) { throw e; } }
|
/**
* Writes the next chunk of data to the response stream.
*
* @param buf the buffer containing the data
* @param offset start offset into the buffer
* @param length length of the data in the buffer
*/
|
Writes the next chunk of data to the response stream
|
writeNext
|
{
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/server/webapp/IncludeResponseStream2.java",
"license": "gpl-2.0",
"size": 10383
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 351,043
|
public List<SystemOverview> getSystemOverviews() {
return systemOverviews;
}
|
List<SystemOverview> function() { return systemOverviews; }
|
/**
* Gets the system overviews.
* @return the system overviews
*/
|
Gets the system overviews
|
getSystemOverviews
|
{
"repo_name": "hustodemon/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/events/SsmPowerManagementEvent.java",
"license": "gpl-2.0",
"size": 2658
}
|
[
"com.redhat.rhn.frontend.dto.SystemOverview",
"java.util.List"
] |
import com.redhat.rhn.frontend.dto.SystemOverview; import java.util.List;
|
import com.redhat.rhn.frontend.dto.*; import java.util.*;
|
[
"com.redhat.rhn",
"java.util"
] |
com.redhat.rhn; java.util;
| 2,424,743
|
public KualiDecimal getTargetPrincipalTotal();
|
KualiDecimal function();
|
/**
* Sums up the amounts of all of the target transaction lines for principal.
*/
|
Sums up the amounts of all of the target transaction lines for principal
|
getTargetPrincipalTotal
|
{
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/document/EndowmentTransactionLinesDocument.java",
"license": "apache-2.0",
"size": 7081
}
|
[
"org.kuali.rice.core.api.util.type.KualiDecimal"
] |
import org.kuali.rice.core.api.util.type.KualiDecimal;
|
import org.kuali.rice.core.api.util.type.*;
|
[
"org.kuali.rice"
] |
org.kuali.rice;
| 2,423,563
|
@Override
public int hashCode() {
return Objects.hashCode(first, second);
}
|
int function() { return Objects.hashCode(first, second); }
|
/**
* Returns a hash code value for this object.
* @return hash code value of this object.
*/
|
Returns a hash code value for this object
|
hashCode
|
{
"repo_name": "anthcp/cdap",
"path": "cdap-common/src/main/java/co/cask/cdap/common/utils/ImmutablePair.java",
"license": "apache-2.0",
"size": 3239
}
|
[
"com.google.common.base.Objects"
] |
import com.google.common.base.Objects;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 321,326
|
public RequestHandler<FutureResponse> sendInternal(final PeerAddress remotePeer,
final SendDirectBuilderI sendDirectBuilder) {
final Message message = createRequestMessage(remotePeer, RPC.Commands.DIRECT_DATA.getNr(),
sendDirectBuilder.isRaw() ? Type.REQUEST_1 : Type.REQUEST_2);
final FutureResponse futureResponse = new FutureResponse(message,
sendDirectBuilder.progressListener());
if (sendDirectBuilder.isSign()) {
message.publicKeyAndSign(sendDirectBuilder.keyPair());
}
message.streaming(sendDirectBuilder.isStreaming());
if (sendDirectBuilder.isRaw()) {
message.buffer(sendDirectBuilder.buffer());
} else {
try {
byte[] me = Utils.encodeJavaObject(sendDirectBuilder.object());
message.buffer(new Buffer(Unpooled.wrappedBuffer(me)));
} catch (IOException e) {
futureResponse.failed("Cannot encode object.", e);
}
}
return new RequestHandler<FutureResponse>(futureResponse, peerBean(), connectionBean(),
sendDirectBuilder);
}
|
RequestHandler<FutureResponse> function(final PeerAddress remotePeer, final SendDirectBuilderI sendDirectBuilder) { final Message message = createRequestMessage(remotePeer, RPC.Commands.DIRECT_DATA.getNr(), sendDirectBuilder.isRaw() ? Type.REQUEST_1 : Type.REQUEST_2); final FutureResponse futureResponse = new FutureResponse(message, sendDirectBuilder.progressListener()); if (sendDirectBuilder.isSign()) { message.publicKeyAndSign(sendDirectBuilder.keyPair()); } message.streaming(sendDirectBuilder.isStreaming()); if (sendDirectBuilder.isRaw()) { message.buffer(sendDirectBuilder.buffer()); } else { try { byte[] me = Utils.encodeJavaObject(sendDirectBuilder.object()); message.buffer(new Buffer(Unpooled.wrappedBuffer(me))); } catch (IOException e) { futureResponse.failed(STR, e); } } return new RequestHandler<FutureResponse>(futureResponse, peerBean(), connectionBean(), sendDirectBuilder); }
|
/**
* Sends data directly to a peer. Make sure you have set up a reply handler. This is an RPC.
*
* @param remotePeer
* The remote peer to store the data
*/
|
Sends data directly to a peer. Make sure you have set up a reply handler. This is an RPC
|
sendInternal
|
{
"repo_name": "Biocodr/TomP2P",
"path": "core/src/main/java/net/tomp2p/rpc/DirectDataRPC.java",
"license": "apache-2.0",
"size": 6540
}
|
[
"io.netty.buffer.Unpooled",
"java.io.IOException",
"net.tomp2p.connection.RequestHandler",
"net.tomp2p.futures.FutureResponse",
"net.tomp2p.message.Buffer",
"net.tomp2p.message.Message",
"net.tomp2p.peers.PeerAddress",
"net.tomp2p.utils.Utils"
] |
import io.netty.buffer.Unpooled; import java.io.IOException; import net.tomp2p.connection.RequestHandler; import net.tomp2p.futures.FutureResponse; import net.tomp2p.message.Buffer; import net.tomp2p.message.Message; import net.tomp2p.peers.PeerAddress; import net.tomp2p.utils.Utils;
|
import io.netty.buffer.*; import java.io.*; import net.tomp2p.connection.*; import net.tomp2p.futures.*; import net.tomp2p.message.*; import net.tomp2p.peers.*; import net.tomp2p.utils.*;
|
[
"io.netty.buffer",
"java.io",
"net.tomp2p.connection",
"net.tomp2p.futures",
"net.tomp2p.message",
"net.tomp2p.peers",
"net.tomp2p.utils"
] |
io.netty.buffer; java.io; net.tomp2p.connection; net.tomp2p.futures; net.tomp2p.message; net.tomp2p.peers; net.tomp2p.utils;
| 659,554
|
protected Object readOutputArgumentValues(Action<LocalService> action, Object instance) throws Exception {
Object[] results = new Object[action.getOutputArguments().length];
log.fine("Attempting to retrieve output argument values using accessor: " + results.length);
int i = 0;
for (ActionArgument outputArgument : action.getOutputArguments()) {
log.finer("Calling acccessor method for: " + outputArgument);
StateVariableAccessor accessor = getOutputArgumentAccessors().get(outputArgument);
if (accessor != null) {
log.fine("Calling accessor to read output argument value: " + accessor);
results[i++] = accessor.read(instance);
} else {
throw new IllegalStateException("No accessor bound for: " + outputArgument);
}
}
if (results.length == 1) {
return results[0];
}
return results.length > 0 ? results : null;
}
|
Object function(Action<LocalService> action, Object instance) throws Exception { Object[] results = new Object[action.getOutputArguments().length]; log.fine(STR + results.length); int i = 0; for (ActionArgument outputArgument : action.getOutputArguments()) { log.finer(STR + outputArgument); StateVariableAccessor accessor = getOutputArgumentAccessors().get(outputArgument); if (accessor != null) { log.fine(STR + accessor); results[i++] = accessor.read(instance); } else { throw new IllegalStateException(STR + outputArgument); } } if (results.length == 1) { return results[0]; } return results.length > 0 ? results : null; }
|
/**
* Reads the output arguments after an action execution using accessors.
*
* @param action The action of which the output arguments are read.
* @param instance The instance on which the accessors will be invoked.
* @return <code>null</code> if the action has no output arguments, a single instance if it has one, an
* <code>Object[]</code> otherwise.
* @throws Exception
*/
|
Reads the output arguments after an action execution using accessors
|
readOutputArgumentValues
|
{
"repo_name": "offbye/DroidDLNA",
"path": "app/src/main/java/org/fourthline/cling/model/action/AbstractActionExecutor.java",
"license": "gpl-3.0",
"size": 7728
}
|
[
"org.fourthline.cling.model.meta.Action",
"org.fourthline.cling.model.meta.ActionArgument",
"org.fourthline.cling.model.meta.LocalService",
"org.fourthline.cling.model.state.StateVariableAccessor"
] |
import org.fourthline.cling.model.meta.Action; import org.fourthline.cling.model.meta.ActionArgument; import org.fourthline.cling.model.meta.LocalService; import org.fourthline.cling.model.state.StateVariableAccessor;
|
import org.fourthline.cling.model.meta.*; import org.fourthline.cling.model.state.*;
|
[
"org.fourthline.cling"
] |
org.fourthline.cling;
| 1,372,014
|
private void compaction(final String tableName, final int flushes,
final CompactionState expectedState, boolean singleFamily)
throws IOException, InterruptedException {
// Create a table with regions
byte [] table = Bytes.toBytes(tableName);
byte [] family = Bytes.toBytes("family");
byte [][] families =
{family, Bytes.add(family, Bytes.toBytes("2")), Bytes.add(family, Bytes.toBytes("3"))};
HTable ht = null;
try {
ht = TEST_UTIL.createTable(table, families);
loadData(ht, families, 3000, flushes);
HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0);
List<HRegion> regions = rs.getOnlineRegions(table);
int countBefore = countStoreFilesInFamilies(regions, families);
int countBeforeSingleFamily = countStoreFilesInFamily(regions, family);
assertTrue(countBefore > 0); // there should be some data files
HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
if (expectedState == CompactionState.MINOR) {
if (singleFamily) {
admin.compact(table, family);
} else {
admin.compact(table);
}
} else {
if (singleFamily) {
admin.majorCompact(table, family);
} else {
admin.majorCompact(table);
}
}
long curt = System.currentTimeMillis();
long waitTime = 5000;
long endt = curt + waitTime;
CompactionState state = admin.getCompactionState(table);
while (state == CompactionState.NONE && curt < endt) {
Thread.sleep(10);
state = admin.getCompactionState(table);
curt = System.currentTimeMillis();
}
// Now, should have the right compaction state,
// otherwise, the compaction should have already been done
if (expectedState != state) {
for (HRegion region: regions) {
state = CompactionRequest.getCompactionState(region.getRegionId());
assertEquals(CompactionState.NONE, state);
}
} else {
curt = System.currentTimeMillis();
waitTime = 20000;
endt = curt + waitTime;
state = admin.getCompactionState(table);
while (state != CompactionState.NONE && curt < endt) {
Thread.sleep(10);
state = admin.getCompactionState(table);
curt = System.currentTimeMillis();
}
// Now, compaction should be done.
assertEquals(CompactionState.NONE, state);
}
int countAfter = countStoreFilesInFamilies(regions, families);
int countAfterSingleFamily = countStoreFilesInFamily(regions, family);
assertTrue(countAfter < countBefore);
if (!singleFamily) {
if (expectedState == CompactionState.MAJOR) assertTrue(families.length == countAfter);
else assertTrue(families.length < countAfter);
} else {
int singleFamDiff = countBeforeSingleFamily - countAfterSingleFamily;
// assert only change was to single column family
assertTrue(singleFamDiff == (countBefore - countAfter));
if (expectedState == CompactionState.MAJOR) {
assertTrue(1 == countAfterSingleFamily);
} else {
assertTrue(1 < countAfterSingleFamily);
}
}
} finally {
if (ht != null) {
TEST_UTIL.deleteTable(table);
}
}
}
|
void function(final String tableName, final int flushes, final CompactionState expectedState, boolean singleFamily) throws IOException, InterruptedException { byte [] table = Bytes.toBytes(tableName); byte [] family = Bytes.toBytes(STR); byte [][] families = {family, Bytes.add(family, Bytes.toBytes("2")), Bytes.add(family, Bytes.toBytes("3"))}; HTable ht = null; try { ht = TEST_UTIL.createTable(table, families); loadData(ht, families, 3000, flushes); HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0); List<HRegion> regions = rs.getOnlineRegions(table); int countBefore = countStoreFilesInFamilies(regions, families); int countBeforeSingleFamily = countStoreFilesInFamily(regions, family); assertTrue(countBefore > 0); HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration()); if (expectedState == CompactionState.MINOR) { if (singleFamily) { admin.compact(table, family); } else { admin.compact(table); } } else { if (singleFamily) { admin.majorCompact(table, family); } else { admin.majorCompact(table); } } long curt = System.currentTimeMillis(); long waitTime = 5000; long endt = curt + waitTime; CompactionState state = admin.getCompactionState(table); while (state == CompactionState.NONE && curt < endt) { Thread.sleep(10); state = admin.getCompactionState(table); curt = System.currentTimeMillis(); } if (expectedState != state) { for (HRegion region: regions) { state = CompactionRequest.getCompactionState(region.getRegionId()); assertEquals(CompactionState.NONE, state); } } else { curt = System.currentTimeMillis(); waitTime = 20000; endt = curt + waitTime; state = admin.getCompactionState(table); while (state != CompactionState.NONE && curt < endt) { Thread.sleep(10); state = admin.getCompactionState(table); curt = System.currentTimeMillis(); } assertEquals(CompactionState.NONE, state); } int countAfter = countStoreFilesInFamilies(regions, families); int countAfterSingleFamily = countStoreFilesInFamily(regions, family); assertTrue(countAfter < countBefore); if (!singleFamily) { if (expectedState == CompactionState.MAJOR) assertTrue(families.length == countAfter); else assertTrue(families.length < countAfter); } else { int singleFamDiff = countBeforeSingleFamily - countAfterSingleFamily; assertTrue(singleFamDiff == (countBefore - countAfter)); if (expectedState == CompactionState.MAJOR) { assertTrue(1 == countAfterSingleFamily); } else { assertTrue(1 < countAfterSingleFamily); } } } finally { if (ht != null) { TEST_UTIL.deleteTable(table); } } }
|
/**
* Load data to a table, flush it to disk, trigger compaction,
* confirm the compaction state is right and wait till it is done.
*
* @param tableName
* @param flushes
* @param expectedState
* @param singleFamily otherwise, run compaction on all cfs
* @throws IOException
* @throws InterruptedException
*/
|
Load data to a table, flush it to disk, trigger compaction, confirm the compaction state is right and wait till it is done
|
compaction
|
{
"repo_name": "zqxjjj/NobidaBase",
"path": "target/hbase-0.94.9/hbase-0.94.9/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionState.java",
"license": "apache-2.0",
"size": 8811
}
|
[
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.client.HBaseAdmin",
"org.apache.hadoop.hbase.client.HTable",
"org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest",
"org.apache.hadoop.hbase.util.Bytes",
"org.junit.Assert"
] |
import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
|
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.regionserver.compactions.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] |
java.io; java.util; org.apache.hadoop; org.junit;
| 708,455
|
@Override
public void performPaint(Graphics g, PaintMoment moment) {
int i;
XYSequence data;
// paint all points
synchronized(getActualContainerManager()) {
for (i = 0; i < getActualContainerManager().count(); i++) {
if (!getActualContainerManager().isVisible(i))
continue;
data = getActualContainerManager().get(i).getData();
if (data.size() == 0)
continue;
synchronized(data) {
drawCustomData(g, moment, data, getColor(i));
}
}
}
}
|
void function(Graphics g, PaintMoment moment) { int i; XYSequence data; synchronized(getActualContainerManager()) { for (i = 0; i < getActualContainerManager().count(); i++) { if (!getActualContainerManager().isVisible(i)) continue; data = getActualContainerManager().get(i).getData(); if (data.size() == 0) continue; synchronized(data) { drawCustomData(g, moment, data, getColor(i)); } } } }
|
/**
* The paint routine of the paintlet.
*
* @param g the graphics context to use for painting
* @param moment what {@link PaintMoment} is currently being painted
*/
|
The paint routine of the paintlet
|
performPaint
|
{
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/gui/visualization/sequence/StdDevOverlayPaintlet.java",
"license": "gpl-3.0",
"size": 6545
}
|
[
"java.awt.Graphics"
] |
import java.awt.Graphics;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 1,379,024
|
Port updatePort(PortDTO portDTO);
|
Port updatePort(PortDTO portDTO);
|
/**
* Updates the specified port in the specified group.
*
* @param portDTO The port DTO
* @return The port
*/
|
Updates the specified port in the specified group
|
updatePort
|
{
"repo_name": "WilliamNouet/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/PortDAO.java",
"license": "apache-2.0",
"size": 2331
}
|
[
"org.apache.nifi.connectable.Port",
"org.apache.nifi.web.api.dto.PortDTO"
] |
import org.apache.nifi.connectable.Port; import org.apache.nifi.web.api.dto.PortDTO;
|
import org.apache.nifi.connectable.*; import org.apache.nifi.web.api.dto.*;
|
[
"org.apache.nifi"
] |
org.apache.nifi;
| 2,782,488
|
EClass getLogAction();
|
EClass getLogAction();
|
/**
* Returns the meta object for class '{@link org.bimserver.models.log.LogAction <em>Action</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Action</em>'.
* @see org.bimserver.models.log.LogAction
* @generated
*/
|
Returns the meta object for class '<code>org.bimserver.models.log.LogAction Action</code>'.
|
getLogAction
|
{
"repo_name": "opensourceBIM/BIMserver",
"path": "PluginBase/generated/org/bimserver/models/log/LogPackage.java",
"license": "agpl-3.0",
"size": 96176
}
|
[
"org.eclipse.emf.ecore.EClass"
] |
import org.eclipse.emf.ecore.EClass;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,976,074
|
protected void updateUploadTarget(String uploadTarget) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(uploadTarget)) {
m_uploadTarget = m_configuration.getUploadFolder();
} else {
m_uploadTarget = uploadTarget;
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_uploadTarget)) {
// disable the upload button as no target folder is available
m_uploadButton.disable(org.opencms.ade.upload.client.Messages.get().key(
org.opencms.ade.upload.client.Messages.GUI_UPLOAD_BUTTON_NO_TARGET_0));
} else {
// make sure the upload button is available
m_uploadButton.enable();
((CmsDialogUploadButtonHandler)m_uploadButton.getButtonHandler()).setTargetFolder(m_uploadTarget);
m_uploadButton.setTitle(Messages.get().key(Messages.GUI_GALLERY_UPLOAD_TITLE_1, m_uploadTarget));
}
}
|
void function(String uploadTarget) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(uploadTarget)) { m_uploadTarget = m_configuration.getUploadFolder(); } else { m_uploadTarget = uploadTarget; } if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_uploadTarget)) { m_uploadButton.disable(org.opencms.ade.upload.client.Messages.get().key( org.opencms.ade.upload.client.Messages.GUI_UPLOAD_BUTTON_NO_TARGET_0)); } else { m_uploadButton.enable(); ((CmsDialogUploadButtonHandler)m_uploadButton.getButtonHandler()).setTargetFolder(m_uploadTarget); m_uploadButton.setTitle(Messages.get().key(Messages.GUI_GALLERY_UPLOAD_TITLE_1, m_uploadTarget)); } }
|
/**
* Updates the upload target folder path.<p>
*
* @param uploadTarget the upload target folder
*/
|
Updates the upload target folder path
|
updateUploadTarget
|
{
"repo_name": "it-tavis/opencms-core",
"path": "src-gwt/org/opencms/ade/galleries/client/ui/CmsGalleryField.java",
"license": "lgpl-2.1",
"size": 30446
}
|
[
"org.opencms.ade.galleries.client.Messages",
"org.opencms.ade.upload.client.ui.CmsDialogUploadButtonHandler",
"org.opencms.util.CmsStringUtil"
] |
import org.opencms.ade.galleries.client.Messages; import org.opencms.ade.upload.client.ui.CmsDialogUploadButtonHandler; import org.opencms.util.CmsStringUtil;
|
import org.opencms.ade.galleries.client.*; import org.opencms.ade.upload.client.ui.*; import org.opencms.util.*;
|
[
"org.opencms.ade",
"org.opencms.util"
] |
org.opencms.ade; org.opencms.util;
| 2,046,604
|
private void insertInDb(Address a) throws SQLException {
try (PreparedStatement st = conn.prepareStatement(
"insert into \"addr\".ADDRESS (_key, _val, id, street) values(?, ?, ?, ?)")) {
st.setObject(1, a.id);
st.setObject(2, a);
st.setObject(3, a.id);
st.setObject(4, a.street);
st.executeUpdate();
}
}
|
void function(Address a) throws SQLException { try (PreparedStatement st = conn.prepareStatement( STRaddr\STR)) { st.setObject(1, a.id); st.setObject(2, a); st.setObject(3, a.id); st.setObject(4, a.street); st.executeUpdate(); } }
|
/**
* Insert {@link Address} at h2 database.
*
* @param a Address.
* @throws SQLException If exception.
*/
|
Insert <code>Address</code> at h2 database
|
insertInDb
|
{
"repo_name": "ascherbakoff/ignite",
"path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java",
"license": "apache-2.0",
"size": 36746
}
|
[
"java.sql.PreparedStatement",
"java.sql.SQLException"
] |
import java.sql.PreparedStatement; import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,728,128
|
private void append(final byte[] key, final int koffset, final int klength,
final byte[] value, final int voffset, final int vlength)
throws IOException {
boolean dupKey = checkKey(key, koffset, klength);
checkValue(value, voffset, vlength);
if (!dupKey) {
checkBlockBoundary();
}
// Write length of key and value and then actual key and value bytes.
this.out.writeInt(klength);
totalKeyLength += klength;
this.out.writeInt(vlength);
totalValueLength += vlength;
this.out.write(key, koffset, klength);
this.out.write(value, voffset, vlength);
// Are we the first key in this block?
if (this.firstKeyInBlock == null) {
// Copy the key.
this.firstKeyInBlock = new byte[klength];
System.arraycopy(key, koffset, this.firstKeyInBlock, 0, klength);
}
this.lastKeyBuffer = key;
this.lastKeyOffset = koffset;
this.lastKeyLength = klength;
this.entryCount++;
// If we are pre-caching blocks on write, fill byte array stream
if (cacheConf.shouldCacheDataOnWrite()) {
this.baosDos.writeInt(klength);
this.baosDos.writeInt(vlength);
this.baosDos.write(key, koffset, klength);
this.baosDos.write(value, voffset, vlength);
}
}
|
void function(final byte[] key, final int koffset, final int klength, final byte[] value, final int voffset, final int vlength) throws IOException { boolean dupKey = checkKey(key, koffset, klength); checkValue(value, voffset, vlength); if (!dupKey) { checkBlockBoundary(); } this.out.writeInt(klength); totalKeyLength += klength; this.out.writeInt(vlength); totalValueLength += vlength; this.out.write(key, koffset, klength); this.out.write(value, voffset, vlength); if (this.firstKeyInBlock == null) { this.firstKeyInBlock = new byte[klength]; System.arraycopy(key, koffset, this.firstKeyInBlock, 0, klength); } this.lastKeyBuffer = key; this.lastKeyOffset = koffset; this.lastKeyLength = klength; this.entryCount++; if (cacheConf.shouldCacheDataOnWrite()) { this.baosDos.writeInt(klength); this.baosDos.writeInt(vlength); this.baosDos.write(key, koffset, klength); this.baosDos.write(value, voffset, vlength); } }
|
/**
* Add key/value to file. Keys must be added in an order that agrees with the
* Comparator passed on construction.
*
* @param key
* @param koffset
* @param klength
* @param value
* @param voffset
* @param vlength
* @throws IOException
*/
|
Add key/value to file. Keys must be added in an order that agrees with the Comparator passed on construction
|
append
|
{
"repo_name": "ay65535/hbase-0.94.0",
"path": "src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV1.java",
"license": "apache-2.0",
"size": 15702
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 105,192
|
private Object[][] getVisibleCellsNoCache(int firstIndex, int rows,
boolean replaceListeners) {
if (getLogger().isLoggable(Level.FINEST)) {
getLogger().log(Level.FINEST,
"Render visible cells for rows {0}-{1}",
new Object[] { firstIndex, (firstIndex + rows - 1) });
}
final Object[] colids = getVisibleColumns();
final int cols = colids.length;
HashSet<Property<?>> oldListenedProperties = listenedProperties;
HashSet<Component> oldVisibleComponents = visibleComponents;
if (replaceListeners) {
// initialize the listener collections, this should only be done if
// the entire cache is refreshed (through refreshRenderedCells)
listenedProperties = new HashSet<Property<?>>();
visibleComponents = new HashSet<Component>();
}
Object[][] cells = new Object[cols + CELL_FIRSTCOL][rows];
if (rows == 0) {
unregisterPropertiesAndComponents(oldListenedProperties,
oldVisibleComponents);
return cells;
}
final RowHeaderMode headmode = getRowHeaderMode();
final boolean[] iscomponent = new boolean[cols];
for (int i = 0; i < cols; i++) {
iscomponent[i] = columnGenerators.containsKey(colids[i])
|| Component.class.isAssignableFrom(getType(colids[i]));
}
int firstIndexNotInCache;
if (pageBuffer != null && pageBuffer[CELL_ITEMID].length > 0) {
firstIndexNotInCache = pageBufferFirstIndex
+ pageBuffer[CELL_ITEMID].length;
} else {
firstIndexNotInCache = -1;
}
// Creates the page contents
int filledRows = 0;
if (items instanceof Container.Indexed) {
// more efficient implementation for containers supporting access by
// index
List<?> itemIds = getItemIds(firstIndex, rows);
for (int i = 0; i < rows && i < itemIds.size(); i++) {
Object id = itemIds.get(i);
// Start by parsing the values, id should already be set
parseItemIdToCells(cells, id, i, firstIndex, headmode, cols,
colids, firstIndexNotInCache, iscomponent,
oldListenedProperties);
filledRows++;
}
} else {
// slow back-up implementation for cases where the container does
// not support access by index
// Gets the first item id
Object id = firstItemId();
for (int i = 0; i < firstIndex; i++) {
id = nextItemId(id);
}
for (int i = 0; i < rows && id != null; i++) {
// Start by parsing the values, id should already be set
parseItemIdToCells(cells, id, i, firstIndex, headmode, cols,
colids, firstIndexNotInCache, iscomponent,
oldListenedProperties);
// Gets the next item id for non indexed container
id = nextItemId(id);
filledRows++;
}
}
// Assures that all the rows of the cell-buffer are valid
if (filledRows != cells[0].length) {
final Object[][] temp = new Object[cells.length][filledRows];
for (int i = 0; i < cells.length; i++) {
for (int j = 0; j < filledRows; j++) {
temp[i][j] = cells[i][j];
}
}
cells = temp;
}
unregisterPropertiesAndComponents(oldListenedProperties,
oldVisibleComponents);
return cells;
}
|
Object[][] function(int firstIndex, int rows, boolean replaceListeners) { if (getLogger().isLoggable(Level.FINEST)) { getLogger().log(Level.FINEST, STR, new Object[] { firstIndex, (firstIndex + rows - 1) }); } final Object[] colids = getVisibleColumns(); final int cols = colids.length; HashSet<Property<?>> oldListenedProperties = listenedProperties; HashSet<Component> oldVisibleComponents = visibleComponents; if (replaceListeners) { listenedProperties = new HashSet<Property<?>>(); visibleComponents = new HashSet<Component>(); } Object[][] cells = new Object[cols + CELL_FIRSTCOL][rows]; if (rows == 0) { unregisterPropertiesAndComponents(oldListenedProperties, oldVisibleComponents); return cells; } final RowHeaderMode headmode = getRowHeaderMode(); final boolean[] iscomponent = new boolean[cols]; for (int i = 0; i < cols; i++) { iscomponent[i] = columnGenerators.containsKey(colids[i]) Component.class.isAssignableFrom(getType(colids[i])); } int firstIndexNotInCache; if (pageBuffer != null && pageBuffer[CELL_ITEMID].length > 0) { firstIndexNotInCache = pageBufferFirstIndex + pageBuffer[CELL_ITEMID].length; } else { firstIndexNotInCache = -1; } int filledRows = 0; if (items instanceof Container.Indexed) { List<?> itemIds = getItemIds(firstIndex, rows); for (int i = 0; i < rows && i < itemIds.size(); i++) { Object id = itemIds.get(i); parseItemIdToCells(cells, id, i, firstIndex, headmode, cols, colids, firstIndexNotInCache, iscomponent, oldListenedProperties); filledRows++; } } else { Object id = firstItemId(); for (int i = 0; i < firstIndex; i++) { id = nextItemId(id); } for (int i = 0; i < rows && id != null; i++) { parseItemIdToCells(cells, id, i, firstIndex, headmode, cols, colids, firstIndexNotInCache, iscomponent, oldListenedProperties); id = nextItemId(id); filledRows++; } } if (filledRows != cells[0].length) { final Object[][] temp = new Object[cells.length][filledRows]; for (int i = 0; i < cells.length; i++) { for (int j = 0; j < filledRows; j++) { temp[i][j] = cells[i][j]; } } cells = temp; } unregisterPropertiesAndComponents(oldListenedProperties, oldVisibleComponents); return cells; }
|
/**
* Render rows with index "firstIndex" to "firstIndex+rows-1" to a new
* buffer.
*
* Reuses values from the current page buffer if the rows are found there.
*
* @param firstIndex
* @param rows
* @param replaceListeners
* @return
*/
|
Render rows with index "firstIndex" to "firstIndex+rows-1" to a new buffer. Reuses values from the current page buffer if the rows are found there
|
getVisibleCellsNoCache
|
{
"repo_name": "udayinfy/vaadin",
"path": "server/src/com/vaadin/ui/Table.java",
"license": "apache-2.0",
"size": 220826
}
|
[
"com.vaadin.data.Container",
"com.vaadin.data.Property",
"java.util.HashSet",
"java.util.List",
"java.util.logging.Level"
] |
import com.vaadin.data.Container; import com.vaadin.data.Property; import java.util.HashSet; import java.util.List; import java.util.logging.Level;
|
import com.vaadin.data.*; import java.util.*; import java.util.logging.*;
|
[
"com.vaadin.data",
"java.util"
] |
com.vaadin.data; java.util;
| 683,029
|
public static SystemSecurityToken createElevated(Authentication originalAuthentication) {
return new SystemSecurityToken(originalAuthentication);
}
|
static SystemSecurityToken function(Authentication originalAuthentication) { return new SystemSecurityToken(originalAuthentication); }
|
/**
* Factory method to elevate an existing authentication to SYSTEM, a.k.a. "run as system".
*
* @param originalAuthentication the (non-system) authentication to elevate
* @throws IllegalStateException if the authentication is already a SystemSecurityToken
* @return a SystemSecurityToken with an original authentication
*/
|
Factory method to elevate an existing authentication to SYSTEM, a.k.a. "run as system"
|
createElevated
|
{
"repo_name": "sidohaakma/molgenis",
"path": "molgenis-security-core/src/main/java/org/molgenis/security/core/runas/SystemSecurityToken.java",
"license": "lgpl-3.0",
"size": 3540
}
|
[
"org.springframework.security.core.Authentication"
] |
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.*;
|
[
"org.springframework.security"
] |
org.springframework.security;
| 1,570,649
|
void setLabelObjectType(ILabelObjectType labelObjectType);
|
void setLabelObjectType(ILabelObjectType labelObjectType);
|
/**
* Sets the object type to be associated with the next label attribute to be created.
* @param labelObjectType the object type.
*/
|
Sets the object type to be associated with the next label attribute to be created
|
setLabelObjectType
|
{
"repo_name": "stumoodie/VisualLanguageToolkit",
"path": "src/org/pathwayeditor/businessobjects/drawingprimitives/ILabelAttributeFactory.java",
"license": "apache-2.0",
"size": 2232
}
|
[
"org.pathwayeditor.businessobjects.typedefn.ILabelObjectType"
] |
import org.pathwayeditor.businessobjects.typedefn.ILabelObjectType;
|
import org.pathwayeditor.businessobjects.typedefn.*;
|
[
"org.pathwayeditor.businessobjects"
] |
org.pathwayeditor.businessobjects;
| 739,163
|
@Override
public void onCameraReady() {
// Ready to send requests in, so set them up
try {
CaptureRequest.Builder previewBuilder =
mCameraOps.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
previewBuilder.addTarget(mProcessingNormalSurface);
previewBuilder.setTag(mAutoExposureTag);
mPreviewRequest = previewBuilder.build();
mHdrBuilder =
mCameraOps.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
mHdrBuilder.set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_OFF);
mHdrBuilder.addTarget(mProcessingHdrSurface);
switchRenderMode(0);
} catch (CameraAccessException e) {
String errorMessage = getErrorString(e);
showErrorDialog(errorMessage);
}
}
|
void function() { try { CaptureRequest.Builder previewBuilder = mCameraOps.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); previewBuilder.addTarget(mProcessingNormalSurface); previewBuilder.setTag(mAutoExposureTag); mPreviewRequest = previewBuilder.build(); mHdrBuilder = mCameraOps.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW); mHdrBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF); mHdrBuilder.addTarget(mProcessingHdrSurface); switchRenderMode(0); } catch (CameraAccessException e) { String errorMessage = getErrorString(e); showErrorDialog(errorMessage); } }
|
/**
* Callbacks for CameraOps
*/
|
Callbacks for CameraOps
|
onCameraReady
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "developers/samples/android/media/HdrViewfinder/Application/src/main/java/com/example/android/hdrviewfinder/HdrViewfinderActivity.java",
"license": "gpl-3.0",
"size": 19688
}
|
[
"android.hardware.camera2.CameraAccessException",
"android.hardware.camera2.CameraDevice",
"android.hardware.camera2.CaptureRequest"
] |
import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraDevice; import android.hardware.camera2.CaptureRequest;
|
import android.hardware.camera2.*;
|
[
"android.hardware"
] |
android.hardware;
| 2,616,145
|
WithAttach<ParentT> withProtectedSettings(HashMap<String, Object> settings);
}
|
WithAttach<ParentT> withProtectedSettings(HashMap<String, Object> settings); }
|
/**
* Specifies private settings.
*
* @param settings the private settings
* @return the next stage of the definition
*/
|
Specifies private settings
|
withProtectedSettings
|
{
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/VirtualMachineExtension.java",
"license": "mit",
"size": 19939
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 536,368
|
public void update(UpdateRequest update);
|
void function(UpdateRequest update);
|
/** Execute a SPARQL Update.
*
* @param update
*/
|
Execute a SPARQL Update
|
update
|
{
"repo_name": "apache/jena",
"path": "jena-rdfconnection/src/main/java/org/apache/jena/rdflink/LinkSparqlUpdate.java",
"license": "apache-2.0",
"size": 1907
}
|
[
"org.apache.jena.update.UpdateRequest"
] |
import org.apache.jena.update.UpdateRequest;
|
import org.apache.jena.update.*;
|
[
"org.apache.jena"
] |
org.apache.jena;
| 730,195
|
private static String appendToPath(final String pathWithParameters, final String segmentToAppend) {
final ParsedParameters parsed = new ParsedParameters(pathWithParameters);
if (parsed.getParametersString() == null) {
return String.format("%s/%s", parsed.getRawPath(), segmentToAppend);
} else {
return String.format("%s/%s%s", parsed.getRawPath(), segmentToAppend, parsed.getParametersString());
}
}
|
static String function(final String pathWithParameters, final String segmentToAppend) { final ParsedParameters parsed = new ParsedParameters(pathWithParameters); if (parsed.getParametersString() == null) { return String.format("%s/%s", parsed.getRawPath(), segmentToAppend); } else { return String.format(STR, parsed.getRawPath(), segmentToAppend, parsed.getParametersString()); } }
|
/**
* Methods concatenates two paths. If the first path contains parameters separated semicolon, they are
* moved at the end of the result.
*
* @param pathWithParameters
* @param segmentToAppend
* @return
*/
|
Methods concatenates two paths. If the first path contains parameters separated semicolon, they are moved at the end of the result
|
appendToPath
|
{
"repo_name": "gutsy/sling",
"path": "bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java",
"license": "apache-2.0",
"size": 49789
}
|
[
"org.apache.sling.resourceresolver.impl.tree.params.ParsedParameters"
] |
import org.apache.sling.resourceresolver.impl.tree.params.ParsedParameters;
|
import org.apache.sling.resourceresolver.impl.tree.params.*;
|
[
"org.apache.sling"
] |
org.apache.sling;
| 1,361,585
|
public SqlResourcesClient getSqlResources() {
return this.sqlResources;
}
private final MongoDBResourcesClient mongoDBResources;
|
SqlResourcesClient function() { return this.sqlResources; } private final MongoDBResourcesClient mongoDBResources;
|
/**
* Gets the SqlResourcesClient object to access its operations.
*
* @return the SqlResourcesClient object.
*/
|
Gets the SqlResourcesClient object to access its operations
|
getSqlResources
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/CosmosDBManagementClientImpl.java",
"license": "mit",
"size": 14754
}
|
[
"com.azure.resourcemanager.cosmos.fluent.MongoDBResourcesClient",
"com.azure.resourcemanager.cosmos.fluent.SqlResourcesClient"
] |
import com.azure.resourcemanager.cosmos.fluent.MongoDBResourcesClient; import com.azure.resourcemanager.cosmos.fluent.SqlResourcesClient;
|
import com.azure.resourcemanager.cosmos.fluent.*;
|
[
"com.azure.resourcemanager"
] |
com.azure.resourcemanager;
| 1,962,950
|
public Typeface getFontFamily() {
return this.fontFamily;
}
|
Typeface function() { return this.fontFamily; }
|
/**
* This method is getter for font-family.
*
* @return
*/
|
This method is getter for font-family
|
getFontFamily
|
{
"repo_name": "Alexendoo/Slide",
"path": "app/src/main/java/me/ccrama/redditslide/Views/CanvasView.java",
"license": "gpl-3.0",
"size": 23453
}
|
[
"android.graphics.Typeface"
] |
import android.graphics.Typeface;
|
import android.graphics.*;
|
[
"android.graphics"
] |
android.graphics;
| 2,128,485
|
public static Setting<ByteSizeValue> memorySizeSetting(String key, String defaultPercentage, Property... properties) {
return new Setting<>(key, (s) -> defaultPercentage, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), properties);
}
|
static Setting<ByteSizeValue> function(String key, String defaultPercentage, Property... properties) { return new Setting<>(key, (s) -> defaultPercentage, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), properties); }
|
/**
* Creates a setting which specifies a memory size. This can either be
* specified as an absolute bytes value or as a percentage of the heap
* memory.
*
* @param key the key for the setting
* @param defaultPercentage the default value of this setting as a percentage of the heap memory
* @param properties properties properties for this setting like scope, filtering...
* @return the setting object
*/
|
Creates a setting which specifies a memory size. This can either be specified as an absolute bytes value or as a percentage of the heap memory
|
memorySizeSetting
|
{
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/common/settings/Setting.java",
"license": "apache-2.0",
"size": 85939
}
|
[
"org.elasticsearch.common.unit.ByteSizeValue",
"org.elasticsearch.common.unit.MemorySizeValue"
] |
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.MemorySizeValue;
|
import org.elasticsearch.common.unit.*;
|
[
"org.elasticsearch.common"
] |
org.elasticsearch.common;
| 2,009,137
|
@Override
public final ClientHttpResponse execute() throws IOException {
this.executed = true;
return executeInternal();
}
|
final ClientHttpResponse function() throws IOException { this.executed = true; return executeInternal(); }
|
/**
* Set the {@link #isExecuted() executed} flag to {@code true} and return the
* configured {@link #setResponse(ClientHttpResponse) response}.
* @see #executeInternal()
*/
|
Set the <code>#isExecuted() executed</code> flag to true and return the configured <code>#setResponse(ClientHttpResponse) response</code>
|
execute
|
{
"repo_name": "spring-projects/spring-framework",
"path": "spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpRequest.java",
"license": "apache-2.0",
"size": 3466
}
|
[
"java.io.IOException",
"org.springframework.http.client.ClientHttpResponse"
] |
import java.io.IOException; import org.springframework.http.client.ClientHttpResponse;
|
import java.io.*; import org.springframework.http.client.*;
|
[
"java.io",
"org.springframework.http"
] |
java.io; org.springframework.http;
| 2,887,740
|
public final void setApplicationStatement(EngineStatement s) {
this.applicationStatement = s;
}
private EmbedResultSet[] dynamicResults;
private int currentDynamicResultSet;
|
final void function(EngineStatement s) { this.applicationStatement = s; } private EmbedResultSet[] dynamicResults; private int currentDynamicResultSet;
|
/**
* Set the application statement for this Statement.
*/
|
Set the application statement for this Statement
|
setApplicationStatement
|
{
"repo_name": "splicemachine/spliceengine",
"path": "db-engine/src/main/java/com/splicemachine/db/impl/jdbc/EmbedStatement.java",
"license": "agpl-3.0",
"size": 67943
}
|
[
"com.splicemachine.db.iapi.jdbc.EngineStatement"
] |
import com.splicemachine.db.iapi.jdbc.EngineStatement;
|
import com.splicemachine.db.iapi.jdbc.*;
|
[
"com.splicemachine.db"
] |
com.splicemachine.db;
| 594,687
|
public void testTemplateQueryCodeGenerationWithConstraintInIds() {
Model testmodel = Model.getInstanceByName("testmodel");
PathQuery pq = new PathQuery(testmodel);
pq.addViews("Employee.name", "Employee.age");
String code = pq.addConstraint(Constraints.inIds("Employee", Arrays.asList(1, 2, 3, 4, 5)));
TemplateQuery tq = new TemplateQuery("TEMP_NAME", "TEMP_TITLE", "TEMP_DESC", pq);
tq.setEditable(tq.getConstraintForCode(code), true);
doTemplateComparison(tq, "inids-template");
}
|
void function() { Model testmodel = Model.getInstanceByName(STR); PathQuery pq = new PathQuery(testmodel); pq.addViews(STR, STR); String code = pq.addConstraint(Constraints.inIds(STR, Arrays.asList(1, 2, 3, 4, 5))); TemplateQuery tq = new TemplateQuery(STR, STR, STR, pq); tq.setEditable(tq.getConstraintForCode(code), true); doTemplateComparison(tq, STR); }
|
/**
* This method tests when a template query has one constraint - PathConstraintIds
* ConstraintOp.IN
*
* Can not be tested
*/
|
This method tests when a template query has one constraint - PathConstraintIds ConstraintOp.IN Can not be tested
|
testTemplateQueryCodeGenerationWithConstraintInIds
|
{
"repo_name": "JoeCarlson/intermine",
"path": "intermine/api/test/src/org/intermine/api/query/codegen/WebserviceJavaCodeGeneratorTest.java",
"license": "lgpl-2.1",
"size": 43759
}
|
[
"java.util.Arrays",
"org.intermine.metadata.Model",
"org.intermine.pathquery.Constraints",
"org.intermine.pathquery.PathQuery",
"org.intermine.template.TemplateQuery"
] |
import java.util.Arrays; import org.intermine.metadata.Model; import org.intermine.pathquery.Constraints; import org.intermine.pathquery.PathQuery; import org.intermine.template.TemplateQuery;
|
import java.util.*; import org.intermine.metadata.*; import org.intermine.pathquery.*; import org.intermine.template.*;
|
[
"java.util",
"org.intermine.metadata",
"org.intermine.pathquery",
"org.intermine.template"
] |
java.util; org.intermine.metadata; org.intermine.pathquery; org.intermine.template;
| 2,861,893
|
public void onConfiguration(Activity activity,
boolean firstTimeIn) {
super.onConfiguration(activity,
firstTimeIn);
if (firstTimeIn) {
// Initialize all the ContactsCommand objects.
initializeCommands();
} else
// Rerun the query to display anything relevant that's in
// the ContentsProvider.
queryContacts();
}
|
void function(Activity activity, boolean firstTimeIn) { super.onConfiguration(activity, firstTimeIn); if (firstTimeIn) { initializeCommands(); } else queryContacts(); }
|
/**
* Hook method dispatched by the GenericActivity framework to
* initialize the ContactsOps object after it's been created.
*
* @param activity The currently active Activity.
* @param firstTimeIn Set to "true" if this is the first time the
* Ops class is initialized, else set to
* "false" if called after a runtime
* configuration change.
*/
|
Hook method dispatched by the GenericActivity framework to initialize the ContactsOps object after it's been created
|
onConfiguration
|
{
"repo_name": "aldeguerp/mobilecloud-15",
"path": "ex/ContactsContentProvider/src/vandy/mooc/operations/ContactsOpsImplLoaderManager/ContactsOpsImplLoaderManager.java",
"license": "apache-2.0",
"size": 4197
}
|
[
"android.app.Activity"
] |
import android.app.Activity;
|
import android.app.*;
|
[
"android.app"
] |
android.app;
| 1,997,130
|
public List<StartTag> getAllStartTags() {
if (allStartTags==null) {
final List<Tag> allTags=getAllTags();
allStartTags=new ArrayList<StartTag>(allTags.size());
for (Tag tag : allTags) if (tag instanceof StartTag) allStartTags.add((StartTag)tag);
}
return allStartTags;
}
|
List<StartTag> function() { if (allStartTags==null) { final List<Tag> allTags=getAllTags(); allStartTags=new ArrayList<StartTag>(allTags.size()); for (Tag tag : allTags) if (tag instanceof StartTag) allStartTags.add((StartTag)tag); } return allStartTags; }
|
/**
* Returns a list of all {@linkplain StartTag start tags} in this source document.
* <p>
* Calling this method on the <code>Source</code> object performs a {@linkplain #fullSequentialParse() full sequential parse} automatically.
* <p>
* See the {@link Tag} class documentation for more details about the behaviour of this method.
*
* @return a list of all {@linkplain StartTag start tags} in this source document.
*/
|
Returns a list of all StartTag start tags in this source document. Calling this method on the <code>Source</code> object performs a #fullSequentialParse() full sequential parse automatically. See the <code>Tag</code> class documentation for more details about the behaviour of this method
|
getAllStartTags
|
{
"repo_name": "ashish-sadh/squeezeMyBook",
"path": "SOURCE/netbeans_project/src/net/htmlparser/jericho/Source.java",
"license": "gpl-3.0",
"size": 100000
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,299,600
|
public ServiceCall post204Async(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
|
ServiceCall function(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); }
|
/**
* Post true Boolean value in request returns 204 (no content).
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
|
Post true Boolean value in request returns 204 (no content)
|
post204Async
|
{
"repo_name": "John-Hart/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/implementation/HttpSuccessImpl.java",
"license": "mit",
"size": 67911
}
|
[
"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,640,263
|
@Test
public void testSimpleHttpPostsHTTP10() throws Exception {
final int reqNo = 20;
final Random rnd = new Random();
// Prepare some random data
final List<byte[]> testData = new ArrayList<byte[]>(reqNo);
for (int i = 0; i < reqNo; i++) {
final int size = rnd.nextInt(5000);
final byte[] data = new byte[size];
rnd.nextBytes(data);
testData.add(data);
}
// Initialize the server-side request handler
this.server.registerHandler("*", new HttpRequestHandler() {
|
void function() throws Exception { final int reqNo = 20; final Random rnd = new Random(); final List<byte[]> testData = new ArrayList<byte[]>(reqNo); for (int i = 0; i < reqNo; i++) { final int size = rnd.nextInt(5000); final byte[] data = new byte[size]; rnd.nextBytes(data); testData.add(data); } this.server.registerHandler("*", new HttpRequestHandler() {
|
/**
* This test case executes a series of simple HTTP/1.0 POST requests.
*/
|
This test case executes a series of simple HTTP/1.0 POST requests
|
testSimpleHttpPostsHTTP10
|
{
"repo_name": "cictourgune/MDP-Airbnb",
"path": "httpcomponents-core-4.4/httpcore/src/test/java/org/apache/http/integration/TestSyncHttp.java",
"license": "apache-2.0",
"size": 37329
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.Random",
"org.apache.http.protocol.HttpRequestHandler"
] |
import java.util.ArrayList; import java.util.List; import java.util.Random; import org.apache.http.protocol.HttpRequestHandler;
|
import java.util.*; import org.apache.http.protocol.*;
|
[
"java.util",
"org.apache.http"
] |
java.util; org.apache.http;
| 1,785,596
|
if (variablesOfSubreportsRemoved.size()>0) {
//recorrer el xml viendo el name de la variable
Iterator it = jasperReport.getChildren().iterator();
while (it.hasNext()) {
Element child = (Element)it.next();
String nameChild = child.getName();
if (nameChild.equals(ConstantsReport.group)) {
Element groupHeader = child.getChild(ConstantsReport.groupHeader, nameSpace);
if (groupHeader!=null) {
preProcessBand(groupHeader.getChild(ConstantsReport.band, nameSpace));
}
Element groupFooter = child.getChild(ConstantsReport.groupFooter, nameSpace);
if (groupFooter!=null) {
preProcessBand(groupFooter.getChild(ConstantsReport.band, nameSpace));
}
} else if (nameChild.equals(ConstantsReport.background) ||
nameChild.equals(ConstantsReport.title) ||
nameChild.equals(ConstantsReport.pageHeader) ||
nameChild.equals(ConstantsReport.columnHeader) ||
nameChild.equals(ConstantsReport.detail) ||
nameChild.equals(ConstantsReport.columnFooter) ||
nameChild.equals(ConstantsReport.pageFooter) ||
nameChild.equals(ConstantsReport.summary)) {
preProcessBand(child.getChild(ConstantsReport.band, nameSpace));
}
}
}
}
|
if (variablesOfSubreportsRemoved.size()>0) { Iterator it = jasperReport.getChildren().iterator(); while (it.hasNext()) { Element child = (Element)it.next(); String nameChild = child.getName(); if (nameChild.equals(ConstantsReport.group)) { Element groupHeader = child.getChild(ConstantsReport.groupHeader, nameSpace); if (groupHeader!=null) { preProcessBand(groupHeader.getChild(ConstantsReport.band, nameSpace)); } Element groupFooter = child.getChild(ConstantsReport.groupFooter, nameSpace); if (groupFooter!=null) { preProcessBand(groupFooter.getChild(ConstantsReport.band, nameSpace)); } } else if (nameChild.equals(ConstantsReport.background) nameChild.equals(ConstantsReport.title) nameChild.equals(ConstantsReport.pageHeader) nameChild.equals(ConstantsReport.columnHeader) nameChild.equals(ConstantsReport.detail) nameChild.equals(ConstantsReport.columnFooter) nameChild.equals(ConstantsReport.pageFooter) nameChild.equals(ConstantsReport.summary)) { preProcessBand(child.getChild(ConstantsReport.band, nameSpace)); } } } }
|
/**Preprocesado para obtener los nombres de las variables en el subreport principal
* que se corresponden con las variables que se han eliminado en el subreport.*/
|
Preprocesado para obtener los nombres de las variables en el subreport principal
|
preProcess
|
{
"repo_name": "semantic-web-software/dynagent",
"path": "Server/src/dynagent/server/reports/clasificator/ReportAnalizer.java",
"license": "agpl-3.0",
"size": 48178
}
|
[
"java.util.Iterator",
"org.jdom.Element"
] |
import java.util.Iterator; import org.jdom.Element;
|
import java.util.*; import org.jdom.*;
|
[
"java.util",
"org.jdom"
] |
java.util; org.jdom;
| 2,827,033
|
public int compare(Object o1, Object o2) {
if (o1 == null) {
if (o2 == null) {
return 0;
}
return -1;
}
if (o2 == null) {
return 1;
}
if (o1.equals(o2)) {
return 0;
}
if (o1 instanceof String) {
if (o2 instanceof String) {
return collator.compare((String) o1, (String) o2);
} else if (Model.getFacade().isAUMLElement(o2)) {
// All strings collate before all UML elements
return -1;
}
}
if (o2 instanceof String && Model.getFacade().isAUMLElement(o1)) {
// All strings collate before all UML elements
return 1;
}
// Elements are collated first by name hoping for a quick solution
String name1, name2;
try {
name1 = Model.getFacade().getName(o1);
name2 = Model.getFacade().getName(o2);
} catch (IllegalArgumentException e) {
throw new ClassCastException(
"Model element or String required"
+ "\n - o1 = " + ((o1 == null) ? "(null)" : o1.toString())
+ "\n - o2 = " + ((o2 == null) ? "(null)" : o2.toString()));
}
if (name1 != null && name2 != null) {
int comparison = collator.compare(name1, name2);
if (comparison != 0) {
return comparison;
}
}
// and then by their enclosing path to fully distinguish them
return comparePaths(o1, o2);
}
|
int function(Object o1, Object o2) { if (o1 == null) { if (o2 == null) { return 0; } return -1; } if (o2 == null) { return 1; } if (o1.equals(o2)) { return 0; } if (o1 instanceof String) { if (o2 instanceof String) { return collator.compare((String) o1, (String) o2); } else if (Model.getFacade().isAUMLElement(o2)) { return -1; } } if (o2 instanceof String && Model.getFacade().isAUMLElement(o1)) { return 1; } String name1, name2; try { name1 = Model.getFacade().getName(o1); name2 = Model.getFacade().getName(o2); } catch (IllegalArgumentException e) { throw new ClassCastException( STR + STR + ((o1 == null) ? STR : o1.toString()) + STR + ((o2 == null) ? STR : o2.toString())); } if (name1 != null && name2 != null) { int comparison = collator.compare(name1, name2); if (comparison != 0) { return comparison; } } return comparePaths(o1, o2); }
|
/**
* Compare two UML elements names, ignoring case, using names from the path
* as tie breakers. As a convenience, we also compare simple strings using
* the same primary strength collator.
*
* @param o1 first model element
* @param o2 second model element
* @return -1, 0, 1
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
|
Compare two UML elements names, ignoring case, using names from the path as tie breakers. As a convenience, we also compare simple strings using the same primary strength collator
|
compare
|
{
"repo_name": "ckaestne/LEADT",
"path": "workspace/argouml_critics/argouml-app/src/org/argouml/uml/util/PathComparator.java",
"license": "gpl-3.0",
"size": 7348
}
|
[
"org.argouml.model.Model"
] |
import org.argouml.model.Model;
|
import org.argouml.model.*;
|
[
"org.argouml.model"
] |
org.argouml.model;
| 862,655
|
public void addRequest(Vector<Object> d, int time) throws SoSimException {
// Add Request b to its queue
backup();
DiskBlockRequest b = new DiskBlockRequest((Integer) d.get(0), (Integer) d.get(1), (Color) d.get(2));
if (getByBID(b.getBid()) != null) throw new SoSimException("dk_04"); // Block requests already exist
if (b.getInit() < time) throw new SoSimException("dk_02");
if (b.getInit() == time) requests.add(b);
if (b.getInit() > time) requestsArriving.add(b);
selectedRequest = b;
}
|
void function(Vector<Object> d, int time) throws SoSimException { backup(); DiskBlockRequest b = new DiskBlockRequest((Integer) d.get(0), (Integer) d.get(1), (Color) d.get(2)); if (getByBID(b.getBid()) != null) throw new SoSimException("dk_04"); if (b.getInit() < time) throw new SoSimException("dk_02"); if (b.getInit() == time) requests.add(b); if (b.getInit() > time) requestsArriving.add(b); selectedRequest = b; }
|
/**
* Adds a new request that will be proceeded at a concrete time
*
* @param d request data: block number, time, color
* @param time simulation current time
* @throws SoSimException requested block already exists or request time is previous to current time
*/
|
Adds a new request that will be proceeded at a concrete time
|
addRequest
|
{
"repo_name": "kromatum/OsSim",
"path": "edu/upc/fib/ossim/disk/model/ContextDisk.java",
"license": "gpl-2.0",
"size": 15372
}
|
[
"edu.upc.fib.ossim.utils.SoSimException",
"java.awt.Color",
"java.util.Vector"
] |
import edu.upc.fib.ossim.utils.SoSimException; import java.awt.Color; import java.util.Vector;
|
import edu.upc.fib.ossim.utils.*; import java.awt.*; import java.util.*;
|
[
"edu.upc.fib",
"java.awt",
"java.util"
] |
edu.upc.fib; java.awt; java.util;
| 2,149,603
|
private static DiskStoreConfiguration loadRawFSSpecific(Configuration cfg,
RawFSConfiguration dcfg) {
String value = cfg.get(RawFSConfiguration.IO_THREADS);
if(value != null){
dcfg.setTotalIOThreads(Integer.parseInt(value));
} else{
dcfg.setTotalIOThreads(dcfg.getDbDataStoreRoots().length);
}
value = cfg.get(RawFSConfiguration.WORKER_THREADS);
if(value != null){
dcfg.setTotalWorkerThreads(Integer.parseInt(value));
} else{
dcfg.setTotalIOThreads(Runtime.getRuntime().availableProcessors());
}
dcfg.setRWBufferSize(cfg.getInt(RawFSConfiguration.RW_BUFFER_SIZE, 4*1024*1024));
return dcfg;
}
|
static DiskStoreConfiguration function(Configuration cfg, RawFSConfiguration dcfg) { String value = cfg.get(RawFSConfiguration.IO_THREADS); if(value != null){ dcfg.setTotalIOThreads(Integer.parseInt(value)); } else{ dcfg.setTotalIOThreads(dcfg.getDbDataStoreRoots().length); } value = cfg.get(RawFSConfiguration.WORKER_THREADS); if(value != null){ dcfg.setTotalWorkerThreads(Integer.parseInt(value)); } else{ dcfg.setTotalIOThreads(Runtime.getRuntime().availableProcessors()); } dcfg.setRWBufferSize(cfg.getInt(RawFSConfiguration.RW_BUFFER_SIZE, 4*1024*1024)); return dcfg; }
|
/**
* Load raw fs specific.
*
* @param cfg the cfg
* @param dcfg the dcfg
* @return the disk store configuration
*/
|
Load raw fs specific
|
loadRawFSSpecific
|
{
"repo_name": "VladRodionov/bigbase",
"path": "row-cache/src/main/java/com/inclouds/hbase/utils/ConfigHelper.java",
"license": "agpl-3.0",
"size": 9237
}
|
[
"com.koda.config.DiskStoreConfiguration",
"com.koda.persistence.rawfs.RawFSConfiguration",
"org.apache.hadoop.conf.Configuration"
] |
import com.koda.config.DiskStoreConfiguration; import com.koda.persistence.rawfs.RawFSConfiguration; import org.apache.hadoop.conf.Configuration;
|
import com.koda.config.*; import com.koda.persistence.rawfs.*; import org.apache.hadoop.conf.*;
|
[
"com.koda.config",
"com.koda.persistence",
"org.apache.hadoop"
] |
com.koda.config; com.koda.persistence; org.apache.hadoop;
| 972,093
|
@Test
public void testObservedExecutionTimeoutWithFallback() {
TestHystrixCommand<?> command = getCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.ExecutionResult.SUCCESS, 200, AbstractTestHystrixCommand.FallbackResult.SUCCESS, 50);
try {
assertEquals(FlexibleTestHystrixCommand.FALLBACK_VALUE, command.observe().toBlocking().single());
} catch (Exception e) {
e.printStackTrace();
fail("We should have received a response from the fallback.");
}
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE));
assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_MISSING));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED));
assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE));
assertEquals(100, command.getBuilder().metrics.getHealthCounts().getErrorPercentage());
assertEquals(0, command.getBuilder().metrics.getCurrentConcurrentExecutionCount());
assertSaneHystrixRequestLog(1);
}
|
void function() { TestHystrixCommand<?> command = getCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.ExecutionResult.SUCCESS, 200, AbstractTestHystrixCommand.FallbackResult.SUCCESS, 50); try { assertEquals(FlexibleTestHystrixCommand.FALLBACK_VALUE, command.observe().toBlocking().single()); } catch (Exception e) { e.printStackTrace(); fail(STR); } assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE)); assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_MISSING)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED)); assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE)); assertEquals(100, command.getBuilder().metrics.getHealthCounts().getErrorPercentage()); assertEquals(0, command.getBuilder().metrics.getCurrentConcurrentExecutionCount()); assertSaneHystrixRequestLog(1); }
|
/**
* Test a queued command execution timeout where the command implemented getFallback.
* <p>
* We specifically want to protect against developers queuing commands and using queue().get() without a timeout (such as queue().get(3000, TimeUnit.Milliseconds)) and ending up blocking
* indefinitely by skipping the timeout protection of the execute() command.
*/
|
Test a queued command execution timeout where the command implemented getFallback. We specifically want to protect against developers queuing commands and using queue().get() without a timeout (such as queue().get(3000, TimeUnit.Milliseconds)) and ending up blocking indefinitely by skipping the timeout protection of the execute() command
|
testObservedExecutionTimeoutWithFallback
|
{
"repo_name": "davidkarlsen/Hystrix",
"path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java",
"license": "apache-2.0",
"size": 282697
}
|
[
"com.netflix.hystrix.HystrixCommandProperties",
"com.netflix.hystrix.util.HystrixRollingNumberEvent",
"org.junit.Assert"
] |
import com.netflix.hystrix.HystrixCommandProperties; import com.netflix.hystrix.util.HystrixRollingNumberEvent; import org.junit.Assert;
|
import com.netflix.hystrix.*; import com.netflix.hystrix.util.*; import org.junit.*;
|
[
"com.netflix.hystrix",
"org.junit"
] |
com.netflix.hystrix; org.junit;
| 2,046,043
|
public static TestPropertyValues of(Stream<String> pairs) {
if (pairs == null) {
return empty();
}
return empty().and(pairs.map(Pair::parse));
}
|
static TestPropertyValues function(Stream<String> pairs) { if (pairs == null) { return empty(); } return empty().and(pairs.map(Pair::parse)); }
|
/**
* Return a new {@link TestPropertyValues} with the underlying map populated with the
* given property pairs. Name-value pairs can be specified with colon (":") or equals
* ("=") separators.
* @param pairs the name-value pairs for properties that need to be added to the
* environment
* @return the new instance
*/
|
Return a new <code>TestPropertyValues</code> with the underlying map populated with the given property pairs. Name-value pairs can be specified with colon (":") or equals ("=") separators
|
of
|
{
"repo_name": "vakninr/spring-boot",
"path": "spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java",
"license": "apache-2.0",
"size": 9769
}
|
[
"java.util.stream.Stream"
] |
import java.util.stream.Stream;
|
import java.util.stream.*;
|
[
"java.util"
] |
java.util;
| 1,001,299
|
public ArrayList<Bateria_model> rankingJulgamentoBateria( ArrayList<Bateria_model> listaBateria ){
try {
for( Bateria_model bateriaModelAux : listaBateria ){
|
ArrayList<Bateria_model> function( ArrayList<Bateria_model> listaBateria ){ try { for( Bateria_model bateriaModelAux : listaBateria ){
|
/**
* Funcao que para montar um ranking da bateria apartir das notas lancadas
* @param Julgamento_model julgamentoModel
* @return ArrayList<Julgamento_model>
* */
|
Funcao que para montar um ranking da bateria apartir das notas lancadas
|
rankingJulgamentoBateria
|
{
"repo_name": "rtancman/bbsys",
"path": "src/br/com/bbsys/control/campeonato/Julgamento/JulgamentoController.java",
"license": "apache-2.0",
"size": 11913
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,692,742
|
public void addDateHeader(String name, long value) {
if (isCommitted())
return;
if (included)
return; // Ignore any call from an included servlet
addHeader(name, format.format(new Date(value)));
}
|
void function(String name, long value) { if (isCommitted()) return; if (included) return; addHeader(name, format.format(new Date(value))); }
|
/**
* Add the specified date header to the specified value.
*
* @param name Name of the header to set
* @param value Date value to be set
*/
|
Add the specified date header to the specified value
|
addDateHeader
|
{
"repo_name": "eclipsky/HowTomcatWorks",
"path": "src/org/apache/catalina/connector/HttpResponseBase.java",
"license": "apache-2.0",
"size": 34102
}
|
[
"java.util.Date"
] |
import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,882,077
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.