code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@Override
public IRenderingElement generate(IReaction reaction, RendererModel model) {
if (!model.getParameter(ShowReactionBoxes.class).getValue()) return null;
double separation = model.getParameter(BondLength.class).getValue()
/ model.getParameter(Scale.class).getValue();
Rectangle2D totalBounds = BoundsCalculator.calculateBounds(reaction);
if (totalBounds == null) return null;
ElementGroup diagram = new ElementGroup();
Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue();
diagram.add(new RectangleElement(totalBounds.getMinX() - separation, totalBounds.getMinY() - separation,
totalBounds.getMaxX() + separation, totalBounds.getMaxY() + separation, foregroundColor));
if (reaction.getID() != null) {
diagram.add(new TextElement((totalBounds.getMinX() + totalBounds.getMaxX()) / 2, totalBounds.getMinY()
- separation, reaction.getID(), foregroundColor));
}
return diagram;
} } | public class class_name {
@Override
public IRenderingElement generate(IReaction reaction, RendererModel model) {
if (!model.getParameter(ShowReactionBoxes.class).getValue()) return null;
double separation = model.getParameter(BondLength.class).getValue()
/ model.getParameter(Scale.class).getValue();
Rectangle2D totalBounds = BoundsCalculator.calculateBounds(reaction);
if (totalBounds == null) return null;
ElementGroup diagram = new ElementGroup();
Color foregroundColor = model.getParameter(BasicSceneGenerator.ForegroundColor.class).getValue();
diagram.add(new RectangleElement(totalBounds.getMinX() - separation, totalBounds.getMinY() - separation,
totalBounds.getMaxX() + separation, totalBounds.getMaxY() + separation, foregroundColor));
if (reaction.getID() != null) {
diagram.add(new TextElement((totalBounds.getMinX() + totalBounds.getMaxX()) / 2, totalBounds.getMinY()
- separation, reaction.getID(), foregroundColor)); // depends on control dependency: [if], data = [none]
}
return diagram;
} } |
public class class_name {
public void marshall(Server server, ProtocolMarshaller protocolMarshaller) {
if (server == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(server.getAssociatePublicIpAddress(), ASSOCIATEPUBLICIPADDRESS_BINDING);
protocolMarshaller.marshall(server.getBackupRetentionCount(), BACKUPRETENTIONCOUNT_BINDING);
protocolMarshaller.marshall(server.getServerName(), SERVERNAME_BINDING);
protocolMarshaller.marshall(server.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(server.getCloudFormationStackArn(), CLOUDFORMATIONSTACKARN_BINDING);
protocolMarshaller.marshall(server.getDisableAutomatedBackup(), DISABLEAUTOMATEDBACKUP_BINDING);
protocolMarshaller.marshall(server.getEndpoint(), ENDPOINT_BINDING);
protocolMarshaller.marshall(server.getEngine(), ENGINE_BINDING);
protocolMarshaller.marshall(server.getEngineModel(), ENGINEMODEL_BINDING);
protocolMarshaller.marshall(server.getEngineAttributes(), ENGINEATTRIBUTES_BINDING);
protocolMarshaller.marshall(server.getEngineVersion(), ENGINEVERSION_BINDING);
protocolMarshaller.marshall(server.getInstanceProfileArn(), INSTANCEPROFILEARN_BINDING);
protocolMarshaller.marshall(server.getInstanceType(), INSTANCETYPE_BINDING);
protocolMarshaller.marshall(server.getKeyPair(), KEYPAIR_BINDING);
protocolMarshaller.marshall(server.getMaintenanceStatus(), MAINTENANCESTATUS_BINDING);
protocolMarshaller.marshall(server.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING);
protocolMarshaller.marshall(server.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_BINDING);
protocolMarshaller.marshall(server.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);
protocolMarshaller.marshall(server.getServiceRoleArn(), SERVICEROLEARN_BINDING);
protocolMarshaller.marshall(server.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(server.getStatusReason(), STATUSREASON_BINDING);
protocolMarshaller.marshall(server.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(server.getServerArn(), SERVERARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Server server, ProtocolMarshaller protocolMarshaller) {
if (server == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(server.getAssociatePublicIpAddress(), ASSOCIATEPUBLICIPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getBackupRetentionCount(), BACKUPRETENTIONCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getServerName(), SERVERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getCloudFormationStackArn(), CLOUDFORMATIONSTACKARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getDisableAutomatedBackup(), DISABLEAUTOMATEDBACKUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getEndpoint(), ENDPOINT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getEngine(), ENGINE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getEngineModel(), ENGINEMODEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getEngineAttributes(), ENGINEATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getEngineVersion(), ENGINEVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getInstanceProfileArn(), INSTANCEPROFILEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getKeyPair(), KEYPAIR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getMaintenanceStatus(), MAINTENANCESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getPreferredMaintenanceWindow(), PREFERREDMAINTENANCEWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getPreferredBackupWindow(), PREFERREDBACKUPWINDOW_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getServiceRoleArn(), SERVICEROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getStatusReason(), STATUSREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getSubnetIds(), SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(server.getServerArn(), SERVERARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <C> ProgramTargetDescriptor of(C clusterId, JobID jobId, String webInterfaceUrl) {
String clusterIdString;
try {
// check if cluster id has a toString method
clusterId.getClass().getDeclaredMethod("toString");
clusterIdString = clusterId.toString();
} catch (NoSuchMethodException e) {
clusterIdString = clusterId.getClass().getSimpleName();
}
return new ProgramTargetDescriptor(clusterIdString, jobId.toString(), webInterfaceUrl);
} } | public class class_name {
public static <C> ProgramTargetDescriptor of(C clusterId, JobID jobId, String webInterfaceUrl) {
String clusterIdString;
try {
// check if cluster id has a toString method
clusterId.getClass().getDeclaredMethod("toString"); // depends on control dependency: [try], data = [none]
clusterIdString = clusterId.toString(); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
clusterIdString = clusterId.getClass().getSimpleName();
} // depends on control dependency: [catch], data = [none]
return new ProgramTargetDescriptor(clusterIdString, jobId.toString(), webInterfaceUrl);
} } |
public class class_name {
public static void flushQuietly(Flushable flushable) {
try {
flush(flushable, true);
} catch (IOException e) {
logger.log(Level.SEVERE, "IOException should not have been thrown.", e);
}
} } | public class class_name {
public static void flushQuietly(Flushable flushable) {
try {
flush(flushable, true); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.log(Level.SEVERE, "IOException should not have been thrown.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(JobSummary jobSummary, ProtocolMarshaller protocolMarshaller) {
if (jobSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobSummary.getJobArn(), JOBARN_BINDING);
protocolMarshaller.marshall(jobSummary.getJobId(), JOBID_BINDING);
protocolMarshaller.marshall(jobSummary.getThingGroupId(), THINGGROUPID_BINDING);
protocolMarshaller.marshall(jobSummary.getTargetSelection(), TARGETSELECTION_BINDING);
protocolMarshaller.marshall(jobSummary.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(jobSummary.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(jobSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING);
protocolMarshaller.marshall(jobSummary.getCompletedAt(), COMPLETEDAT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(JobSummary jobSummary, ProtocolMarshaller protocolMarshaller) {
if (jobSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobSummary.getJobArn(), JOBARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getThingGroupId(), THINGGROUPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getTargetSelection(), TARGETSELECTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobSummary.getCompletedAt(), COMPLETEDAT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
formatName(fmt, indent);
fmt.append("[");
if (fields != null) {
fmt.append("\n");
for (int i = 0; i < fields.length; i++) {
if (i > 0)
fmt.append(",\n");
fields[i].format(fmt, done, todo, indent + 2);
}
fmt.append("\n");
indent(fmt, indent);
}
fmt.append("]");
} } | public class class_name {
public void format(StringBuffer fmt, Set done, Set todo, int indent) {
formatName(fmt, indent);
fmt.append("[");
if (fields != null) {
fmt.append("\n"); // depends on control dependency: [if], data = [none]
for (int i = 0; i < fields.length; i++) {
if (i > 0)
fmt.append(",\n");
fields[i].format(fmt, done, todo, indent + 2); // depends on control dependency: [for], data = [i]
}
fmt.append("\n"); // depends on control dependency: [if], data = [none]
indent(fmt, indent); // depends on control dependency: [if], data = [none]
}
fmt.append("]");
} } |
public class class_name {
public void marshall(InstanceSummary instanceSummary, ProtocolMarshaller protocolMarshaller) {
if (instanceSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceSummary.getDeploymentId(), DEPLOYMENTID_BINDING);
protocolMarshaller.marshall(instanceSummary.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(instanceSummary.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(instanceSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING);
protocolMarshaller.marshall(instanceSummary.getLifecycleEvents(), LIFECYCLEEVENTS_BINDING);
protocolMarshaller.marshall(instanceSummary.getInstanceType(), INSTANCETYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InstanceSummary instanceSummary, ProtocolMarshaller protocolMarshaller) {
if (instanceSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceSummary.getDeploymentId(), DEPLOYMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSummary.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSummary.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSummary.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSummary.getLifecycleEvents(), LIFECYCLEEVENTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSummary.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static void read_value(GeneratorAdapter mg,
String className,
Set<String> classConstantFieldNames,
Method method,
Class<?> valueClass,
Type valueType,
int rmicCompatible)
throws EJBConfigurationException
{
if (valueClass.isPrimitive())
{
if (valueClass == Boolean.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_boolean", "()Z");
}
else if (valueClass == Character.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_wchar", "()C");
}
else if (valueClass == Byte.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_octet", "()B");
}
else if (valueClass == Short.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_short", "()S");
}
else if (valueClass == Integer.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_long", "()I");
}
else if (valueClass == Long.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_longlong", "()J");
}
else if (valueClass == Float.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_float", "()F");
}
else if (valueClass == Double.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_double", "()D");
}
}
else if (valueClass == Object.class)
{
mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "readAny",
"(Lorg/omg/CORBA/portable/InputStream;)Ljava/lang/Object;");
}
else
{
if (valueClass.isInterface())
{
if (valueClass == Serializable.class ||
valueClass == Externalizable.class)
{
mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "readAny",
"(Lorg/omg/CORBA/portable/InputStream;)Ljava/lang/Object;");
}
else if (isCORBAObject(valueClass, rmicCompatible) || // PM46698
(Remote.class).isAssignableFrom(valueClass))
{
if (valueClass == org.omg.CORBA.Object.class) // RTC111522
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_Object", "()Lorg/omg/CORBA/Object;");
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_Object", "(Ljava/lang/Class;)Lorg/omg/CORBA/Object;");
}
}
else if (isAbstractInterface(valueClass, rmicCompatible)) // PM46698
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_abstract_interface", "(Ljava/lang/Class;)Ljava/lang/Object;");
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_value", "(Ljava/lang/Class;)Ljava/io/Serializable;");
}
}
else if ((Remote.class).isAssignableFrom(valueClass))
{
// Not a valid RMI/IIOP type - log message and throw exception. d450525
Tr.error(tc, "JIT_INVALID_ARG_RETURN_TYPE_CNTR5100E",
new Object[] { valueClass.getName(),
method.getName(),
method.getDeclaringClass().getName() });
throw new EJBConfigurationException("Argument or return type " + valueClass.getName() + " of method " +
method.getName() + " on class " + method.getDeclaringClass().getName() +
" is not a valid type for RMI/IIOP.");
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_value", "(Ljava/lang/Class;)Ljava/io/Serializable;");
}
JITUtils.checkCast(mg, valueType.getInternalName());
}
} } | public class class_name {
static void read_value(GeneratorAdapter mg,
String className,
Set<String> classConstantFieldNames,
Method method,
Class<?> valueClass,
Type valueType,
int rmicCompatible)
throws EJBConfigurationException
{
if (valueClass.isPrimitive())
{
if (valueClass == Boolean.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_boolean", "()Z");
}
else if (valueClass == Character.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_wchar", "()C");
}
else if (valueClass == Byte.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_octet", "()B");
}
else if (valueClass == Short.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_short", "()S");
}
else if (valueClass == Integer.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_long", "()I");
}
else if (valueClass == Long.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_longlong", "()J");
}
else if (valueClass == Float.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_float", "()F");
}
else if (valueClass == Double.TYPE)
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_double", "()D");
}
}
else if (valueClass == Object.class)
{
mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "readAny",
"(Lorg/omg/CORBA/portable/InputStream;)Ljava/lang/Object;");
}
else
{
if (valueClass.isInterface())
{
if (valueClass == Serializable.class ||
valueClass == Externalizable.class)
{
mg.visitMethodInsn(INVOKESTATIC, "javax/rmi/CORBA/Util", "readAny",
"(Lorg/omg/CORBA/portable/InputStream;)Ljava/lang/Object;"); // depends on control dependency: [if], data = [none]
}
else if (isCORBAObject(valueClass, rmicCompatible) || // PM46698
(Remote.class).isAssignableFrom(valueClass))
{
if (valueClass == org.omg.CORBA.Object.class) // RTC111522
{
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_Object", "()Lorg/omg/CORBA/Object;"); // depends on control dependency: [if], data = [none]
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522 // depends on control dependency: [if], data = [none]
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA/portable/InputStream",
"read_Object", "(Ljava/lang/Class;)Lorg/omg/CORBA/Object;"); // depends on control dependency: [if], data = [none]
}
}
else if (isAbstractInterface(valueClass, rmicCompatible)) // PM46698
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522 // depends on control dependency: [if], data = [none]
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_abstract_interface", "(Ljava/lang/Class;)Ljava/lang/Object;"); // depends on control dependency: [if], data = [none]
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522 // depends on control dependency: [if], data = [none]
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_value", "(Ljava/lang/Class;)Ljava/io/Serializable;"); // depends on control dependency: [if], data = [none]
}
}
else if ((Remote.class).isAssignableFrom(valueClass))
{
// Not a valid RMI/IIOP type - log message and throw exception. d450525
Tr.error(tc, "JIT_INVALID_ARG_RETURN_TYPE_CNTR5100E",
new Object[] { valueClass.getName(),
method.getName(),
method.getDeclaringClass().getName() }); // depends on control dependency: [if], data = [none]
throw new EJBConfigurationException("Argument or return type " + valueClass.getName() + " of method " +
method.getName() + " on class " + method.getDeclaringClass().getName() +
" is not a valid type for RMI/IIOP.");
}
else
{
JITUtils.loadClassConstant(mg, className, classConstantFieldNames, valueClass); // RTC111522 // depends on control dependency: [if], data = [none]
mg.visitMethodInsn(INVOKEVIRTUAL, "org/omg/CORBA_2_3/portable/InputStream",
"read_value", "(Ljava/lang/Class;)Ljava/io/Serializable;"); // depends on control dependency: [if], data = [none]
}
JITUtils.checkCast(mg, valueType.getInternalName());
}
} } |
public class class_name {
public void publish(Boolean dontStop) {
// null is as good as false according to Boolean.valueOf() so if null, interpret as false
if (dontStop == null || !dontStop) {
IConnection conn = Red5.getConnectionLocal();
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
Number streamId = conn.getStreamId();
IClientStream stream = streamConn.getStreamById(streamId);
if (stream instanceof IBroadcastStream) {
IBroadcastStream bs = (IBroadcastStream) stream;
if (bs.getPublishedName() != null) {
IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
if (bsScope != null) {
bsScope.unsubscribe(bs.getProvider());
if (conn instanceof BaseConnection) {
((BaseConnection) conn).unregisterBasicScope(bsScope);
}
}
bs.close();
streamConn.deleteStreamById(streamId);
}
}
}
}
} } | public class class_name {
public void publish(Boolean dontStop) {
// null is as good as false according to Boolean.valueOf() so if null, interpret as false
if (dontStop == null || !dontStop) {
IConnection conn = Red5.getConnectionLocal();
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
Number streamId = conn.getStreamId();
IClientStream stream = streamConn.getStreamById(streamId);
if (stream instanceof IBroadcastStream) {
IBroadcastStream bs = (IBroadcastStream) stream;
if (bs.getPublishedName() != null) {
IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName());
if (bsScope != null) {
bsScope.unsubscribe(bs.getProvider());
// depends on control dependency: [if], data = [none]
if (conn instanceof BaseConnection) {
((BaseConnection) conn).unregisterBasicScope(bsScope);
// depends on control dependency: [if], data = [none]
}
}
bs.close();
// depends on control dependency: [if], data = [none]
streamConn.deleteStreamById(streamId);
// depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public Matrix<E> set(E element, int x, int y) {
if (this.columns.size() < x) {
columns.set(x, new ArrayList<>());
}
this.columns.get(x).set(y, element);
return this;
} } | public class class_name {
public Matrix<E> set(E element, int x, int y) {
if (this.columns.size() < x) {
columns.set(x, new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
this.columns.get(x).set(y, element);
return this;
} } |
public class class_name {
public static KV<String, Forest> remove(String key) {
KV<String, Forest> kv = AMBIGUITY.get(key);
if (kv != null && kv.getV() != null) {
kv.getV().clear();
}
MyStaticValue.ENV.remove(key);
return AMBIGUITY.remove(key);
} } | public class class_name {
public static KV<String, Forest> remove(String key) {
KV<String, Forest> kv = AMBIGUITY.get(key);
if (kv != null && kv.getV() != null) {
kv.getV().clear(); // depends on control dependency: [if], data = [none]
}
MyStaticValue.ENV.remove(key);
return AMBIGUITY.remove(key);
} } |
public class class_name {
public ServletHolder addServlet(String name,
String pathSpec,
String servletClass,
String forcedPath)
{
ServletHolder holder = getServletHolder(name);
if (holder==null)
holder = newServletHolder(name,servletClass,forcedPath);
mapPathToServlet(pathSpec,name);
if (isStarted() && !holder.isStarted())
{
try{holder.start();}
catch(Exception e){log.warn(LogSupport.EXCEPTION,e);}
}
return holder;
} } | public class class_name {
public ServletHolder addServlet(String name,
String pathSpec,
String servletClass,
String forcedPath)
{
ServletHolder holder = getServletHolder(name);
if (holder==null)
holder = newServletHolder(name,servletClass,forcedPath);
mapPathToServlet(pathSpec,name);
if (isStarted() && !holder.isStarted())
{
try{holder.start();} // depends on control dependency: [try], data = [none]
catch(Exception e){log.warn(LogSupport.EXCEPTION,e);} // depends on control dependency: [catch], data = [none]
}
return holder;
} } |
public class class_name {
@Override
public final AbstractGauge init(final int WIDTH, final int HEIGHT) {
final int GAUGE_WIDTH = isFrameVisible() ? WIDTH : getGaugeBounds().width;
final int GAUGE_HEIGHT = isFrameVisible() ? HEIGHT : getGaugeBounds().height;
if (GAUGE_WIDTH <= 1 || GAUGE_HEIGHT <= 1) {
return this;
}
if (!isFrameVisible()) {
setFramelessOffset(-getGaugeBounds().width * 0.0841121495, -getGaugeBounds().width * 0.0841121495);
} else {
setFramelessOffset(getGaugeBounds().x, getGaugeBounds().y);
}
// Create Background Image
if (bImage != null) {
bImage.flush();
}
bImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);
// Create Foreground Image
if (fImage != null) {
fImage.flush();
}
fImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);
if (isFrameVisible()) {
create_FRAME_Image(GAUGE_WIDTH, bImage);
}
if (isBackgroundVisible()) {
create_BACKGROUND_Image(GAUGE_WIDTH, bImage);
}
if (isGlowVisible()) {
if (glowImageOff != null) {
glowImageOff.flush();
}
glowImageOff = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), false);
if (glowImageOn != null) {
glowImageOn.flush();
}
glowImageOn = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), true);
} else {
setGlowPulsating(false);
}
final double TRACK_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
TRACK_ORIENTATION_OFFSET = Math.PI / 2;
TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
break;
case SOUTH_EAST:
TRACK_ORIENTATION_OFFSET = Math.PI;
TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
break;
case SOUTH_WEST:
TRACK_ORIENTATION_OFFSET = 1.5 * Math.PI;
TRACK_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
break;
case NORTH_WEST:
default:
TRACK_ORIENTATION_OFFSET = 0;
TRACK_OFFSET.setLocation(0, 0);
break;
}
if (isTrackVisible()) {
create_TRACK_Image(GAUGE_WIDTH, getModel().getFreeAreaAngle(), TICKMARK_ROTATION_OFFSET + TRACK_ORIENTATION_OFFSET, getMinValue(), getMaxValue(), getAngleStep(), getTrackStart(), getTrackSection(), getTrackStop(), getTrackStartColor(), getTrackSectionColor(), getTrackStopColor(), 0.68f, new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037), getTickmarkDirection(), TRACK_OFFSET, bImage);
}
if (!getAreas().isEmpty()){
createAreas(bImage);
}
if (!getSections().isEmpty()) {
createSections(bImage);
}
//final double TICKMARKS_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
//TICKMARKS_ORIENTATION_OFFSET = Math.PI / 2;
TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
//tickLabelRotationOffset = 0;
break;
case SOUTH_EAST:
//TICKMARKS_ORIENTATION_OFFSET = Math.PI;
TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
//tickLabelRotationOffset = Math.PI;
break;
case SOUTH_WEST:
//TICKMARKS_ORIENTATION_OFFSET = 1.5 * Math.PI;
TICKMARKS_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
//tickLabelRotationOffset = Math.PI;
break;
case NORTH_WEST:
default:
//TICKMARKS_ORIENTATION_OFFSET = 0;
TICKMARKS_OFFSET.setLocation(0, 0);
//tickLabelRotationOffset = 0;
break;
}
TICKMARK_FACTORY.create_RADIAL_TICKMARKS_Image(GAUGE_WIDTH,
getModel().getNiceMinValue(),
getModel().getNiceMaxValue(),
getModel().getMaxNoOfMinorTicks(),
getModel().getMaxNoOfMajorTicks(),
getModel().getMinorTickSpacing(),
getModel().getMajorTickSpacing(),
getGaugeType(),
getCustomGaugeType(),
getMinorTickmarkType(),
getMajorTickmarkType(),
isTickmarksVisible(),
isTicklabelsVisible(),
getModel().isMinorTickmarksVisible(),
getModel().isMajorTickmarksVisible(),
getLabelNumberFormat(),
isTickmarkSectionsVisible(),
getBackgroundColor(),
getTickmarkColor(),
isTickmarkColorFromThemeEnabled(),
getTickmarkSections(),
isSectionTickmarksOnly(),
getSections(),
0.68f,
0.09f,
new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037),
new Point2D.Double(0, 0),
Orientation.NORTH_WEST,
getModel().getTicklabelOrientation(),
getModel().isNiceScale(),
getModel().isLogScale(),
bImage);
if (pointerImage != null) {
pointerImage.flush();
}
pointerImage = create_POINTER_Image(GAUGE_WIDTH, getPointerType());
if (pointerShadowImage != null) {
pointerShadowImage.flush();
}
if (getModel().isPointerShadowVisible()) {
pointerShadowImage = create_POINTER_SHADOW_Image(GAUGE_WIDTH, getPointerType());
} else {
pointerShadowImage = null;
}
create_POSTS_Image(GAUGE_WIDTH, fImage);
if (isForegroundVisible()) {
create_FOREGROUND_Image(GAUGE_WIDTH, fImage);
}
final double THRESHOLD_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
THRESHOLD_OFFSET.setLocation(bImage.getWidth() * 0.775, bImage.getHeight() * 0.81);
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep();
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep();
}
break;
case SOUTH_EAST:
THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.79), (bImage.getHeight() * 0.16));
if (!isLogScale()) {
thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep();
} else {
thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep();
}
break;
case SOUTH_WEST:
THRESHOLD_ORIENTATION_OFFSET = -Math.PI / 2;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.19), (bImage.getHeight() * 0.16));
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep();
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep();
}
break;
case NORTH_WEST:
default:
THRESHOLD_ORIENTATION_OFFSET = 0;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.805), (bImage.getHeight() * 0.19));
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep();
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep();
}
break;
}
if (thresholdImage != null) {
thresholdImage.flush();
}
thresholdImage = create_THRESHOLD_Image(GAUGE_WIDTH, THRESHOLD_ORIENTATION_OFFSET);
final double MIN_MEASURED_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
measuredRotationOffset = ROTATION_OFFSET;
MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
break;
case SOUTH_EAST:
MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
break;
case SOUTH_WEST:
MIN_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
measuredRotationOffset = ROTATION_OFFSET;
break;
case NORTH_WEST:
default:
MIN_MEASURED_ORIENTATION_OFFSET = 0;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
measuredRotationOffset = ROTATION_OFFSET;
break;
}
if (minMeasuredImage != null) {
minMeasuredImage.flush();
}
minMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(0, 23, 252, 255), MIN_MEASURED_ORIENTATION_OFFSET);
final double MAX_MEASURED_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
measuredRotationOffset = ROTATION_OFFSET;
MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
break;
case SOUTH_EAST:
MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
break;
case SOUTH_WEST:
MAX_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
measuredRotationOffset = ROTATION_OFFSET;
break;
case NORTH_WEST:
default:
MAX_MEASURED_ORIENTATION_OFFSET = 0;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
measuredRotationOffset = ROTATION_OFFSET;
break;
}
if (maxMeasuredImage != null) {
maxMeasuredImage.flush();
}
maxMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(252, 29, 0, 255), MAX_MEASURED_ORIENTATION_OFFSET);
if (disabledImage != null) {
disabledImage.flush();
}
disabledImage = create_DISABLED_Image(GAUGE_WIDTH);
// Adjust the rotation center of the pointer
switch (getOrientation()) {
case NORTH_EAST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.6f;
unitOffsetYFactor = 0.67f;
break;
case SOUTH_EAST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.3f;
unitOffsetYFactor = 0.37f;
break;
case SOUTH_WEST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.3f;
unitOffsetYFactor = 0.37f;
break;
case NORTH_WEST:
default:
ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.6f;
unitOffsetYFactor = 0.67f;
break;
}
setCurrentLedImage(getLedImageOff());
return this;
} } | public class class_name {
@Override
public final AbstractGauge init(final int WIDTH, final int HEIGHT) {
final int GAUGE_WIDTH = isFrameVisible() ? WIDTH : getGaugeBounds().width;
final int GAUGE_HEIGHT = isFrameVisible() ? HEIGHT : getGaugeBounds().height;
if (GAUGE_WIDTH <= 1 || GAUGE_HEIGHT <= 1) {
return this; // depends on control dependency: [if], data = [none]
}
if (!isFrameVisible()) {
setFramelessOffset(-getGaugeBounds().width * 0.0841121495, -getGaugeBounds().width * 0.0841121495); // depends on control dependency: [if], data = [none]
} else {
setFramelessOffset(getGaugeBounds().x, getGaugeBounds().y); // depends on control dependency: [if], data = [none]
}
// Create Background Image
if (bImage != null) {
bImage.flush(); // depends on control dependency: [if], data = [none]
}
bImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);
// Create Foreground Image
if (fImage != null) {
fImage.flush(); // depends on control dependency: [if], data = [none]
}
fImage = UTIL.createImage(GAUGE_WIDTH, GAUGE_WIDTH, Transparency.TRANSLUCENT);
if (isFrameVisible()) {
create_FRAME_Image(GAUGE_WIDTH, bImage); // depends on control dependency: [if], data = [none]
}
if (isBackgroundVisible()) {
create_BACKGROUND_Image(GAUGE_WIDTH, bImage); // depends on control dependency: [if], data = [none]
}
if (isGlowVisible()) {
if (glowImageOff != null) {
glowImageOff.flush(); // depends on control dependency: [if], data = [none]
}
glowImageOff = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), false); // depends on control dependency: [if], data = [none]
if (glowImageOn != null) {
glowImageOn.flush(); // depends on control dependency: [if], data = [none]
}
glowImageOn = create_GLOW_Image(GAUGE_WIDTH, getGlowColor(), true); // depends on control dependency: [if], data = [none]
} else {
setGlowPulsating(false); // depends on control dependency: [if], data = [none]
}
final double TRACK_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
TRACK_ORIENTATION_OFFSET = Math.PI / 2;
TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
break;
case SOUTH_EAST:
TRACK_ORIENTATION_OFFSET = Math.PI;
TRACK_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
break;
case SOUTH_WEST:
TRACK_ORIENTATION_OFFSET = 1.5 * Math.PI;
TRACK_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
break;
case NORTH_WEST:
default:
TRACK_ORIENTATION_OFFSET = 0;
TRACK_OFFSET.setLocation(0, 0);
break;
}
if (isTrackVisible()) {
create_TRACK_Image(GAUGE_WIDTH, getModel().getFreeAreaAngle(), TICKMARK_ROTATION_OFFSET + TRACK_ORIENTATION_OFFSET, getMinValue(), getMaxValue(), getAngleStep(), getTrackStart(), getTrackSection(), getTrackStop(), getTrackStartColor(), getTrackSectionColor(), getTrackStopColor(), 0.68f, new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037), getTickmarkDirection(), TRACK_OFFSET, bImage);
}
if (!getAreas().isEmpty()){
createAreas(bImage);
}
if (!getSections().isEmpty()) {
createSections(bImage);
}
//final double TICKMARKS_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
//TICKMARKS_ORIENTATION_OFFSET = Math.PI / 2;
TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), 0);
//tickLabelRotationOffset = 0;
break;
case SOUTH_EAST:
//TICKMARKS_ORIENTATION_OFFSET = Math.PI;
TICKMARKS_OFFSET.setLocation(-(GAUGE_WIDTH / 1.55), -(GAUGE_WIDTH / 1.55));
//tickLabelRotationOffset = Math.PI;
break;
case SOUTH_WEST:
//TICKMARKS_ORIENTATION_OFFSET = 1.5 * Math.PI;
TICKMARKS_OFFSET.setLocation(0, -(GAUGE_WIDTH / 1.55));
//tickLabelRotationOffset = Math.PI;
break;
case NORTH_WEST:
default:
//TICKMARKS_ORIENTATION_OFFSET = 0;
TICKMARKS_OFFSET.setLocation(0, 0);
//tickLabelRotationOffset = 0;
break;
}
TICKMARK_FACTORY.create_RADIAL_TICKMARKS_Image(GAUGE_WIDTH,
getModel().getNiceMinValue(),
getModel().getNiceMaxValue(),
getModel().getMaxNoOfMinorTicks(),
getModel().getMaxNoOfMajorTicks(),
getModel().getMinorTickSpacing(),
getModel().getMajorTickSpacing(),
getGaugeType(),
getCustomGaugeType(),
getMinorTickmarkType(),
getMajorTickmarkType(),
isTickmarksVisible(),
isTicklabelsVisible(),
getModel().isMinorTickmarksVisible(),
getModel().isMajorTickmarksVisible(),
getLabelNumberFormat(),
isTickmarkSectionsVisible(),
getBackgroundColor(),
getTickmarkColor(),
isTickmarkColorFromThemeEnabled(),
getTickmarkSections(),
isSectionTickmarksOnly(),
getSections(),
0.68f,
0.09f,
new Point2D.Double(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037),
new Point2D.Double(0, 0),
Orientation.NORTH_WEST,
getModel().getTicklabelOrientation(),
getModel().isNiceScale(),
getModel().isLogScale(),
bImage);
if (pointerImage != null) {
pointerImage.flush();
}
pointerImage = create_POINTER_Image(GAUGE_WIDTH, getPointerType());
if (pointerShadowImage != null) {
pointerShadowImage.flush();
}
if (getModel().isPointerShadowVisible()) {
pointerShadowImage = create_POINTER_SHADOW_Image(GAUGE_WIDTH, getPointerType());
} else {
pointerShadowImage = null;
}
create_POSTS_Image(GAUGE_WIDTH, fImage);
if (isForegroundVisible()) {
create_FOREGROUND_Image(GAUGE_WIDTH, fImage);
}
final double THRESHOLD_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
THRESHOLD_OFFSET.setLocation(bImage.getWidth() * 0.775, bImage.getHeight() * 0.81);
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep(); // depends on control dependency: [if], data = [none]
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep(); // depends on control dependency: [if], data = [none]
}
break;
case SOUTH_EAST:
THRESHOLD_ORIENTATION_OFFSET = Math.PI / 2;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.79), (bImage.getHeight() * 0.16));
if (!isLogScale()) {
thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + (getMaxValue() - getThreshold() - getMinValue()) * getAngleStep(); // depends on control dependency: [if], data = [none]
} else {
thresholdRotationOffset = Math.PI / 2 + ROTATION_OFFSET + UTIL.logOfBase(BASE, getMaxValue() - getThreshold() - getMinValue()) * getLogAngleStep(); // depends on control dependency: [if], data = [none]
}
break;
case SOUTH_WEST:
THRESHOLD_ORIENTATION_OFFSET = -Math.PI / 2;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.19), (bImage.getHeight() * 0.16));
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep(); // depends on control dependency: [if], data = [none]
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep(); // depends on control dependency: [if], data = [none]
}
break;
case NORTH_WEST:
default:
THRESHOLD_ORIENTATION_OFFSET = 0;
THRESHOLD_OFFSET.setLocation((bImage.getWidth() * 0.805), (bImage.getHeight() * 0.19));
if (!isLogScale()) {
thresholdRotationOffset = ROTATION_OFFSET + (getThreshold() - getMinValue()) * getAngleStep(); // depends on control dependency: [if], data = [none]
} else {
thresholdRotationOffset = ROTATION_OFFSET + UTIL.logOfBase(BASE, getThreshold() - getMinValue()) * getLogAngleStep(); // depends on control dependency: [if], data = [none]
}
break;
}
if (thresholdImage != null) {
thresholdImage.flush();
}
thresholdImage = create_THRESHOLD_Image(GAUGE_WIDTH, THRESHOLD_ORIENTATION_OFFSET);
final double MIN_MEASURED_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
measuredRotationOffset = ROTATION_OFFSET;
MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
break;
case SOUTH_EAST:
MIN_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
break;
case SOUTH_WEST:
MIN_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
measuredRotationOffset = ROTATION_OFFSET;
break;
case NORTH_WEST:
default:
MIN_MEASURED_ORIENTATION_OFFSET = 0;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
measuredRotationOffset = ROTATION_OFFSET;
break;
}
if (minMeasuredImage != null) {
minMeasuredImage.flush();
}
minMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(0, 23, 252, 255), MIN_MEASURED_ORIENTATION_OFFSET);
final double MAX_MEASURED_ORIENTATION_OFFSET;
switch (getOrientation()) {
case NORTH_EAST:
MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
measuredRotationOffset = ROTATION_OFFSET;
MEASURED_OFFSET.setLocation(bImage.getWidth() * 0.87, bImage.getHeight() * 0.815);
break;
case SOUTH_EAST:
MAX_MEASURED_ORIENTATION_OFFSET = Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.87), (bImage.getHeight() * 0.15));
measuredRotationOffset = Math.PI / 2 + ROTATION_OFFSET;
break;
case SOUTH_WEST:
MAX_MEASURED_ORIENTATION_OFFSET = -Math.PI / 2;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.10), (bImage.getHeight() * 0.16));
measuredRotationOffset = ROTATION_OFFSET;
break;
case NORTH_WEST:
default:
MAX_MEASURED_ORIENTATION_OFFSET = 0;
MEASURED_OFFSET.setLocation((bImage.getWidth() * 0.811), (bImage.getHeight() * 0.11));
measuredRotationOffset = ROTATION_OFFSET;
break;
}
if (maxMeasuredImage != null) {
maxMeasuredImage.flush();
}
maxMeasuredImage = create_MEASURED_VALUE_Image(GAUGE_WIDTH, new Color(252, 29, 0, 255), MAX_MEASURED_ORIENTATION_OFFSET);
if (disabledImage != null) {
disabledImage.flush();
}
disabledImage = create_DISABLED_Image(GAUGE_WIDTH);
// Adjust the rotation center of the pointer
switch (getOrientation()) {
case NORTH_EAST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.6f;
unitOffsetYFactor = 0.67f;
break;
case SOUTH_EAST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.3f;
unitOffsetYFactor = 0.37f;
break;
case SOUTH_WEST:
ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH - GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.3f;
unitOffsetYFactor = 0.37f;
break;
case NORTH_WEST:
default:
ROTATION_CENTER.setLocation(GAUGE_WIDTH * 0.8271028037, GAUGE_WIDTH * 0.8271028037);
titleOffsetYFactor = 0.6f;
unitOffsetYFactor = 0.67f;
break;
}
setCurrentLedImage(getLedImageOff());
return this;
} } |
public class class_name {
private boolean compareAndSet(final State current, final State next) {
if (state.compareAndSet(current, next)) {
return true;
}
parkNanos(1); // back-off
return false;
} } | public class class_name {
private boolean compareAndSet(final State current, final State next) {
if (state.compareAndSet(current, next)) {
return true; // depends on control dependency: [if], data = [none]
}
parkNanos(1); // back-off
return false;
} } |
public class class_name {
void processAlterTableDropColumn(Table table, String colName,
boolean cascade) {
int colindex = table.getColumnIndex(colName);
if (table.getColumnCount() == 1) {
throw Error.error(ErrorCode.X_42591);
}
session.commit(false);
TableWorks tableWorks = new TableWorks(session, table);
tableWorks.dropColumn(colindex, cascade);
//VoltDB extension to support Time to live
if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) {
table.dropTTL();
}
} } | public class class_name {
void processAlterTableDropColumn(Table table, String colName,
boolean cascade) {
int colindex = table.getColumnIndex(colName);
if (table.getColumnCount() == 1) {
throw Error.error(ErrorCode.X_42591);
}
session.commit(false);
TableWorks tableWorks = new TableWorks(session, table);
tableWorks.dropColumn(colindex, cascade);
//VoltDB extension to support Time to live
if (table.getTTL() != null && colName.equalsIgnoreCase(table.getTTL().ttlColumn.getName().name)) {
table.dropTTL(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void solve(int method) throws NullPointerException {
// solution exists
if(solved) {
return;
}
// bring in reduced row echelon form
if(!reducedRowEchelonForm) {
reducedRowEchelonForm(method);
}
if(!isSolvable(method)) {
if(LOG.isDebugging()) {
LOG.debugFine("Equation system is not solvable!");
}
return;
}
// compute one special solution
final int cols = coeff[0].length;
int numbound = 0, numfree = 0;
int[] boundIndices = new int[cols], freeIndices = new int[cols];
x_0 = new double[cols];
outer: for(int i = 0; i < coeff.length; i++) {
for(int j = i; j < coeff[row[i]].length; j++) {
if(coeff[row[i]][col[j]] == 1) {
x_0[col[i]] = rhs[row[i]];
boundIndices[numbound++] = col[i];
continue outer;
}
}
freeIndices[numfree++] = i;
}
StringBuilder msg = new StringBuilder();
if(LOG.isDebugging()) {
msg.append("\nSpecial solution x_0 = [").append(FormatUtil.format(x_0, ",", FormatUtil.NF4)).append(']') //
.append("\nbound Indices ").append(FormatUtil.format(boundIndices, ",")) //
.append("\nfree Indices ").append(FormatUtil.format(freeIndices, ","));
}
// compute solution space of homogeneous linear equation system
Arrays.sort(boundIndices, 0, numbound);
int freeIndex = 0;
int boundIndex = 0;
u = new double[cols][numfree];
for(int j = 0; j < u[0].length; j++) {
for(int i = 0; i < u.length; i++) {
if(freeIndex < numfree && i == freeIndices[freeIndex]) {
u[i][j] = 1;
}
else if(boundIndex < numbound && i == boundIndices[boundIndex]) {
u[i][j] = -coeff[row[boundIndex]][freeIndices[freeIndex]];
boundIndex++;
}
}
freeIndex++;
boundIndex = 0; // Restart
}
if(LOG.isDebugging()) {
msg.append("\nU");
for(double[] anU : u) {
msg.append('\n').append(FormatUtil.format(anU, ",", FormatUtil.NF4));
}
LOG.debugFine(msg.toString());
}
solved = true;
} } | public class class_name {
private void solve(int method) throws NullPointerException {
// solution exists
if(solved) {
return;
}
// bring in reduced row echelon form
if(!reducedRowEchelonForm) {
reducedRowEchelonForm(method);
}
if(!isSolvable(method)) {
if(LOG.isDebugging()) {
LOG.debugFine("Equation system is not solvable!"); // depends on control dependency: [if], data = [none]
}
return;
}
// compute one special solution
final int cols = coeff[0].length;
int numbound = 0, numfree = 0;
int[] boundIndices = new int[cols], freeIndices = new int[cols];
x_0 = new double[cols];
outer: for(int i = 0; i < coeff.length; i++) {
for(int j = i; j < coeff[row[i]].length; j++) {
if(coeff[row[i]][col[j]] == 1) {
x_0[col[i]] = rhs[row[i]];
boundIndices[numbound++] = col[i];
continue outer;
}
}
freeIndices[numfree++] = i;
}
StringBuilder msg = new StringBuilder();
if(LOG.isDebugging()) {
msg.append("\nSpecial solution x_0 = [").append(FormatUtil.format(x_0, ",", FormatUtil.NF4)).append(']') //
.append("\nbound Indices ").append(FormatUtil.format(boundIndices, ",")) //
.append("\nfree Indices ").append(FormatUtil.format(freeIndices, ","));
}
// compute solution space of homogeneous linear equation system
Arrays.sort(boundIndices, 0, numbound);
int freeIndex = 0;
int boundIndex = 0;
u = new double[cols][numfree];
for(int j = 0; j < u[0].length; j++) {
for(int i = 0; i < u.length; i++) {
if(freeIndex < numfree && i == freeIndices[freeIndex]) {
u[i][j] = 1;
}
else if(boundIndex < numbound && i == boundIndices[boundIndex]) {
u[i][j] = -coeff[row[boundIndex]][freeIndices[freeIndex]];
boundIndex++;
}
}
freeIndex++;
boundIndex = 0; // Restart
}
if(LOG.isDebugging()) {
msg.append("\nU");
for(double[] anU : u) {
msg.append('\n').append(FormatUtil.format(anU, ",", FormatUtil.NF4));
}
LOG.debugFine(msg.toString());
}
solved = true;
} } |
public class class_name {
public void watchStartup(int startingTimeout, int startupTimeout)
throws Exception {
// use this for timeout checks later
long startTime = System.currentTimeMillis();
ServerStatusMessage[] messages = getAllMessages();
ServerStatusMessage lastMessage = messages[messages.length - 1];
boolean starting = false;
boolean started = false;
while (!started) {
showStartup(messages);
// update started and starting flags, and
// throw a startup exception if startup failed
// is encountered
for (ServerStatusMessage element : messages) {
ServerState state = element.getState();
if (state == ServerState.STARTING) {
starting = true;
} else if (state == ServerState.STARTED) {
started = true;
} else if (state == ServerState.STARTUP_FAILED) {
throw new Exception("Fedora startup failed (see above)");
}
}
if (!started) {
// wait half a second
try {
Thread.sleep(500);
} catch (Throwable th) {
}
// throw an exception if either timeout has been
// exceeded
long now = System.currentTimeMillis();
if (!starting) {
if ((now - startTime) / 1000 > startingTimeout) {
throw new Exception("Server startup did not begin within "
+ startingTimeout + " seconds");
}
}
if ((now - startTime) / 1000 > startupTimeout) {
throw new Exception("Server startup did not complete within "
+ startupTimeout + " seconds");
}
// get next batch of messages
messages = _statusFile.getMessages(lastMessage);
if (messages.length > 0) {
lastMessage = messages[messages.length - 1];
}
}
}
} } | public class class_name {
public void watchStartup(int startingTimeout, int startupTimeout)
throws Exception {
// use this for timeout checks later
long startTime = System.currentTimeMillis();
ServerStatusMessage[] messages = getAllMessages();
ServerStatusMessage lastMessage = messages[messages.length - 1];
boolean starting = false;
boolean started = false;
while (!started) {
showStartup(messages);
// update started and starting flags, and
// throw a startup exception if startup failed
// is encountered
for (ServerStatusMessage element : messages) {
ServerState state = element.getState();
if (state == ServerState.STARTING) {
starting = true; // depends on control dependency: [if], data = [none]
} else if (state == ServerState.STARTED) {
started = true; // depends on control dependency: [if], data = [none]
} else if (state == ServerState.STARTUP_FAILED) {
throw new Exception("Fedora startup failed (see above)");
}
}
if (!started) {
// wait half a second
try {
Thread.sleep(500); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
} // depends on control dependency: [catch], data = [none]
// throw an exception if either timeout has been
// exceeded
long now = System.currentTimeMillis();
if (!starting) {
if ((now - startTime) / 1000 > startingTimeout) {
throw new Exception("Server startup did not begin within "
+ startingTimeout + " seconds");
}
}
if ((now - startTime) / 1000 > startupTimeout) {
throw new Exception("Server startup did not complete within "
+ startupTimeout + " seconds");
}
// get next batch of messages
messages = _statusFile.getMessages(lastMessage); // depends on control dependency: [if], data = [none]
if (messages.length > 0) {
lastMessage = messages[messages.length - 1]; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private List<Long> searchBigFile(File srcFile, byte[] searchBytes, int numOfThreads, boolean useOptimization, long startPosition) {
progressCache = null;
if (useOptimization) {
optimize(srcFile.length());
}
_profile_lastStartTime = System.currentTimeMillis();
if (numOfThreads == 0) {
numOfThreads = 1;
}
final long sizeOfSrcBytes = srcFile.length();
final int sizeOfSearchBytes = searchBytes.length;
final long bytesToReadBlockSize = (sizeOfSrcBytes - (long) sizeOfSearchBytes) / (long) numOfThreads;
final int threadPoolSize;
if (maxNumOfThreads == THREADS_NO_LIMIT) {
threadPoolSize = numOfThreads;
} else {
threadPoolSize = maxNumOfThreads;
}
final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
final List<Future<List<Long>>> futureList = new ArrayList<Future<List<Long>>>();
for (int i = 0; i < numOfThreads; i++) {
final long offset = bytesToReadBlockSize * (long) i + startPosition;
final long readLeng;
if (i == numOfThreads - 1) {
// if it's the last element.
readLeng = sizeOfSrcBytes - offset;
} else {
// else , add the overlapping part size to blockSize
readLeng = bytesToReadBlockSize + sizeOfSearchBytes;
}
final BinFileProgressListenerEx progressListener;
if (onProgressListener == null && onRealtimeResultListener == null) {
progressListener = null;
} else {
progressListener = new BinFileProgressListenerEx() {
@Override
public void onProgress(int workerNumber, int workerSize, List<Long> pointerList, float progress) {
BigFileSearcher.this.onProgress(workerNumber, workerSize, pointerList, progress);
}
};
}
final int workerSize = numOfThreads;
final int workerNumber = i;
final Future<List<Long>> future = executorService.submit(new BigFileSearchTask(srcFile, searchBytes, offset, readLeng, workerNumber, workerSize, progressListener));
futureList.add(future);
}
executorService.shutdown();
// Remove duplicate indexes
final List<Long> resultIndexList = new CopyOnWriteArrayList<Long>();
for (Future<List<Long>> future : futureList) {
try {
List<Long> rawIndexList = future.get();
for (int i = 0; i < rawIndexList.size(); i++) {
Long longVal = rawIndexList.get(i);
if (resultIndexList.contains(longVal)) {
// if already exists , skip
} else {
resultIndexList.add(longVal);
}
}
} catch (InterruptedException e) {
} catch (ExecutionException e) {
}
}
// Sort in ascending order
binFileSearcher.sort(resultIndexList);
_profile_lastEndTime = System.currentTimeMillis();
return resultIndexList;
} } | public class class_name {
private List<Long> searchBigFile(File srcFile, byte[] searchBytes, int numOfThreads, boolean useOptimization, long startPosition) {
progressCache = null;
if (useOptimization) {
optimize(srcFile.length()); // depends on control dependency: [if], data = [none]
}
_profile_lastStartTime = System.currentTimeMillis();
if (numOfThreads == 0) {
numOfThreads = 1; // depends on control dependency: [if], data = [none]
}
final long sizeOfSrcBytes = srcFile.length();
final int sizeOfSearchBytes = searchBytes.length;
final long bytesToReadBlockSize = (sizeOfSrcBytes - (long) sizeOfSearchBytes) / (long) numOfThreads;
final int threadPoolSize;
if (maxNumOfThreads == THREADS_NO_LIMIT) {
threadPoolSize = numOfThreads; // depends on control dependency: [if], data = [none]
} else {
threadPoolSize = maxNumOfThreads; // depends on control dependency: [if], data = [none]
}
final ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
final List<Future<List<Long>>> futureList = new ArrayList<Future<List<Long>>>();
for (int i = 0; i < numOfThreads; i++) {
final long offset = bytesToReadBlockSize * (long) i + startPosition;
final long readLeng;
if (i == numOfThreads - 1) {
// if it's the last element.
readLeng = sizeOfSrcBytes - offset; // depends on control dependency: [if], data = [none]
} else {
// else , add the overlapping part size to blockSize
readLeng = bytesToReadBlockSize + sizeOfSearchBytes; // depends on control dependency: [if], data = [none]
}
final BinFileProgressListenerEx progressListener;
if (onProgressListener == null && onRealtimeResultListener == null) {
progressListener = null; // depends on control dependency: [if], data = [none]
} else {
progressListener = new BinFileProgressListenerEx() {
@Override
public void onProgress(int workerNumber, int workerSize, List<Long> pointerList, float progress) {
BigFileSearcher.this.onProgress(workerNumber, workerSize, pointerList, progress);
}
}; // depends on control dependency: [if], data = [none]
}
final int workerSize = numOfThreads;
final int workerNumber = i;
final Future<List<Long>> future = executorService.submit(new BigFileSearchTask(srcFile, searchBytes, offset, readLeng, workerNumber, workerSize, progressListener));
futureList.add(future); // depends on control dependency: [for], data = [none]
}
executorService.shutdown();
// Remove duplicate indexes
final List<Long> resultIndexList = new CopyOnWriteArrayList<Long>();
for (Future<List<Long>> future : futureList) {
try {
List<Long> rawIndexList = future.get();
for (int i = 0; i < rawIndexList.size(); i++) {
Long longVal = rawIndexList.get(i);
if (resultIndexList.contains(longVal)) {
// if already exists , skip
} else {
resultIndexList.add(longVal); // depends on control dependency: [if], data = [none]
}
}
} catch (InterruptedException e) {
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
// Sort in ascending order
binFileSearcher.sort(resultIndexList);
_profile_lastEndTime = System.currentTimeMillis();
return resultIndexList;
} } |
public class class_name {
private static String resolveFieldNumbers(
Optional<Descriptor> optDescriptor, String fmt, Iterable<Integer> fieldNumbers) {
if (optDescriptor.isPresent()) {
Descriptor descriptor = optDescriptor.get();
List<String> strings = Lists.newArrayList();
for (int fieldNumber : fieldNumbers) {
FieldDescriptor field = descriptor.findFieldByNumber(fieldNumber);
strings.add(field != null ? field.toString() : String.format("%d (?)", fieldNumber));
}
return String.format(fmt, join(strings));
} else {
return String.format(fmt, join(fieldNumbers));
}
} } | public class class_name {
private static String resolveFieldNumbers(
Optional<Descriptor> optDescriptor, String fmt, Iterable<Integer> fieldNumbers) {
if (optDescriptor.isPresent()) {
Descriptor descriptor = optDescriptor.get();
List<String> strings = Lists.newArrayList();
for (int fieldNumber : fieldNumbers) {
FieldDescriptor field = descriptor.findFieldByNumber(fieldNumber);
strings.add(field != null ? field.toString() : String.format("%d (?)", fieldNumber)); // depends on control dependency: [for], data = [fieldNumber]
}
return String.format(fmt, join(strings)); // depends on control dependency: [if], data = [none]
} else {
return String.format(fmt, join(fieldNumbers)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unused")
private List<CmsResource> getLinkSources(CmsObject cms, CmsResource resource, HashSet<CmsUUID> deleteIds)
throws CmsException {
List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.SOURCES);
List<CmsResource> result = new ArrayList<CmsResource>();
for (CmsRelation relation : relations) {
// only add related resources that are not going to be deleted
if (!deleteIds.contains(relation.getSourceId())) {
CmsResource source = relation.getSource(cms, CmsResourceFilter.ALL);
if (!source.getState().isDeleted()) {
result.add(source);
}
}
}
return result;
} } | public class class_name {
@SuppressWarnings("unused")
private List<CmsResource> getLinkSources(CmsObject cms, CmsResource resource, HashSet<CmsUUID> deleteIds)
throws CmsException {
List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.SOURCES);
List<CmsResource> result = new ArrayList<CmsResource>();
for (CmsRelation relation : relations) {
// only add related resources that are not going to be deleted
if (!deleteIds.contains(relation.getSourceId())) {
CmsResource source = relation.getSource(cms, CmsResourceFilter.ALL);
if (!source.getState().isDeleted()) {
result.add(source); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public java.lang.String getNobuildFilesRegex() {
java.lang.Object ref = nobuildFilesRegex_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
nobuildFilesRegex_ = s;
return s;
}
} } | public class class_name {
public java.lang.String getNobuildFilesRegex() {
java.lang.Object ref = nobuildFilesRegex_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
nobuildFilesRegex_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void pauseAutoCycle(){
if(mCycling){
mCycleTimer.cancel();
mCycleTask.cancel();
mCycling = false;
}else{
if(mResumingTimer != null && mResumingTask != null){
recoverCycle();
}
}
} } | public class class_name {
private void pauseAutoCycle(){
if(mCycling){
mCycleTimer.cancel(); // depends on control dependency: [if], data = [none]
mCycleTask.cancel(); // depends on control dependency: [if], data = [none]
mCycling = false; // depends on control dependency: [if], data = [none]
}else{
if(mResumingTimer != null && mResumingTask != null){
recoverCycle(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
HttpConnection asRequest() {
DatabaseURIHelper builder = getViewURIBuilder();
for (Map.Entry<String, Object> queryParameter : processParameters(Parameter.Type
.QUERY_PARAMETER).entrySet()) {
builder.query(queryParameter.getKey(), queryParameter.getValue());
}
Map<String, Object> parameters = processParameters(Parameter.Type.BODY_PARAMETER);
// if there are no parameters in the body, we do a GET, otherwise we do a POST
if (parameters == null || parameters.isEmpty()) {
return Http.GET(builder.build());
}
JsonElement body = gson.toJsonTree(parameters);
HttpConnection conn = Http.POST(builder.build(), "application/json");
conn.setRequestBody(body.toString());
return conn;
} } | public class class_name {
HttpConnection asRequest() {
DatabaseURIHelper builder = getViewURIBuilder();
for (Map.Entry<String, Object> queryParameter : processParameters(Parameter.Type
.QUERY_PARAMETER).entrySet()) {
builder.query(queryParameter.getKey(), queryParameter.getValue()); // depends on control dependency: [for], data = [queryParameter]
}
Map<String, Object> parameters = processParameters(Parameter.Type.BODY_PARAMETER);
// if there are no parameters in the body, we do a GET, otherwise we do a POST
if (parameters == null || parameters.isEmpty()) {
return Http.GET(builder.build()); // depends on control dependency: [if], data = [none]
}
JsonElement body = gson.toJsonTree(parameters);
HttpConnection conn = Http.POST(builder.build(), "application/json");
conn.setRequestBody(body.toString());
return conn;
} } |
public class class_name {
@Override
public MethodVisitor visitMethod(
int access, String base, String desc, String signature, String[] exceptions) {
MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions);
if (mv != null) {
// We need to compute stackmaps (see
// AllocationInstrumenter#instrument). This can't really be
// done for old bytecode that contains JSR and RET instructions.
// So, we remove JSRs and RETs.
JSRInlinerAdapter jsria =
new JSRInlinerAdapter(mv, access, base, desc, signature, exceptions);
AllocationMethodAdapter aimv =
new AllocationMethodAdapter(jsria, recorderClass, recorderMethod);
LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, aimv);
aimv.lvs = lvs;
mv = lvs;
}
return mv;
} } | public class class_name {
@Override
public MethodVisitor visitMethod(
int access, String base, String desc, String signature, String[] exceptions) {
MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions);
if (mv != null) {
// We need to compute stackmaps (see
// AllocationInstrumenter#instrument). This can't really be
// done for old bytecode that contains JSR and RET instructions.
// So, we remove JSRs and RETs.
JSRInlinerAdapter jsria =
new JSRInlinerAdapter(mv, access, base, desc, signature, exceptions);
AllocationMethodAdapter aimv =
new AllocationMethodAdapter(jsria, recorderClass, recorderMethod);
LocalVariablesSorter lvs = new LocalVariablesSorter(access, desc, aimv);
aimv.lvs = lvs; // depends on control dependency: [if], data = [none]
mv = lvs; // depends on control dependency: [if], data = [none]
}
return mv;
} } |
public class class_name {
protected DoubleLinkedElement<T> removeElem(final T key) {
DoubleLinkedElement<T> found = (DoubleLinkedElement<T>) (super
.removeElem(key));
if (found == null) {
return null;
}
// update linked list
if (found.after != null) {
found.after.before = found.before;
}
if (found.before != null) {
found.before.after = found.after;
}
if (head == found) {
head = head.after;
}
if (tail == found) {
tail = tail.before;
}
return found;
} } | public class class_name {
protected DoubleLinkedElement<T> removeElem(final T key) {
DoubleLinkedElement<T> found = (DoubleLinkedElement<T>) (super
.removeElem(key));
if (found == null) {
return null; // depends on control dependency: [if], data = [none]
}
// update linked list
if (found.after != null) {
found.after.before = found.before; // depends on control dependency: [if], data = [none]
}
if (found.before != null) {
found.before.after = found.after; // depends on control dependency: [if], data = [none]
}
if (head == found) {
head = head.after; // depends on control dependency: [if], data = [none]
}
if (tail == found) {
tail = tail.before; // depends on control dependency: [if], data = [none]
}
return found;
} } |
public class class_name {
public String getReferenceSignature(ExecutableElement element) {
StringBuilder sb = new StringBuilder("(");
// If the method is an inner class constructor, prepend the outer class type.
if (ElementUtil.isConstructor(element)) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
if (ElementUtil.hasOuterContext(declaringClass)) {
TypeElement outerClass = ElementUtil.getDeclaringClass(declaringClass);
sb.append(getSignatureName(outerClass.asType()));
}
}
for (VariableElement param : element.getParameters()) {
sb.append(getSignatureName(param.asType()));
}
sb.append(')');
TypeMirror returnType = element.getReturnType();
if (returnType != null) {
sb.append(getSignatureName(returnType));
}
return sb.toString();
} } | public class class_name {
public String getReferenceSignature(ExecutableElement element) {
StringBuilder sb = new StringBuilder("(");
// If the method is an inner class constructor, prepend the outer class type.
if (ElementUtil.isConstructor(element)) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
if (ElementUtil.hasOuterContext(declaringClass)) {
TypeElement outerClass = ElementUtil.getDeclaringClass(declaringClass);
sb.append(getSignatureName(outerClass.asType())); // depends on control dependency: [if], data = [none]
}
}
for (VariableElement param : element.getParameters()) {
sb.append(getSignatureName(param.asType())); // depends on control dependency: [for], data = [param]
}
sb.append(')');
TypeMirror returnType = element.getReturnType();
if (returnType != null) {
sb.append(getSignatureName(returnType)); // depends on control dependency: [if], data = [(returnType]
}
return sb.toString();
} } |
public class class_name {
public java.util.List<String> getRegionOrder() {
if (regionOrder == null) {
regionOrder = new com.amazonaws.internal.SdkInternalList<String>();
}
return regionOrder;
} } | public class class_name {
public java.util.List<String> getRegionOrder() {
if (regionOrder == null) {
regionOrder = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return regionOrder;
} } |
public class class_name {
static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++;
}
return index;
} } | public class class_name {
static public int skipWhiteSpace(byte[] data, int start) {
int index = start + 1;
while (index < data.length && BNFHeaders.SPACE == data[index]) {
index++; // depends on control dependency: [while], data = [none]
}
return index;
} } |
public class class_name {
private Result getSummaryStatus(){
StatsStorage ss = knownSessionIDs.get(currentSessionID);
if(ss == null){
log.debug("getOptimizationConfig(): Session ID is unknown: {}", currentSessionID);
return ok();
}
Persistable p = ss.getStaticInfo(currentSessionID, ARBITER_UI_TYPE_ID, GlobalConfigPersistable.GLOBAL_WORKER_ID);
if(p == null){
log.info("No static info");
return ok();
}
GlobalConfigPersistable gcp = (GlobalConfigPersistable)p;
OptimizationConfiguration oc = gcp.getOptimizationConfiguration();
long execStartTime = oc.getExecutionStartTime();
//Charts:
//Best model score vs. time
//All candidate scores (scatter plot vs. time)
//How to get this? query all model infos...
List<Persistable> allModelInfoTemp = new ArrayList<>(ss.getLatestUpdateAllWorkers(currentSessionID, ARBITER_UI_TYPE_ID));
List<ModelInfoPersistable> allModelInfo = new ArrayList<>();
for(Persistable per : allModelInfoTemp){
ModelInfoPersistable mip = (ModelInfoPersistable)per;
if(mip.getStatus() == CandidateStatus.Complete && mip.getScore() != null && Double.isFinite(mip.getScore())){
allModelInfo.add(mip);
}
}
allModelInfo.sort(Comparator.comparingLong(Persistable::getTimeStamp));
Pair<List<Component>, ModelInfoPersistable> chartsAndBest = getSummaryChartsAndBest(allModelInfo, oc.getScoreFunction().minimize(), execStartTime );
//First: table - number completed, queued, running, failed, total
//Best model index, score, and time
//Total runtime
//Termination conditions
List<Component> components = new ArrayList<>();
List<TerminationCondition> tcs = oc.getTerminationConditions();
//TODO: I18N
//TODO don't use currentTimeMillis due to stored data??
long bestTime;
Double bestScore = null;
String bestModelString = null;
if(chartsAndBest.getSecond() != null){
bestTime = chartsAndBest.getSecond().getTimeStamp();
bestScore = chartsAndBest.getSecond().getScore();
String sinceBest = UIUtils.formatDuration(System.currentTimeMillis() - bestTime);
bestModelString = "Model " + chartsAndBest.getSecond().getModelIdx() + ", Found at " +
TIME_FORMATTER.print(bestTime) + " (" + sinceBest + " ago)";
}
String execStartTimeStr = "";
String execTotalRuntimeStr = "";
if(execStartTime > 0){
execStartTimeStr = TIME_FORMATTER.print(execStartTime);
execTotalRuntimeStr = UIUtils.formatDuration(System.currentTimeMillis() - execStartTime);
}
String[][] table = new String[][]{
{"Models Completed", String.valueOf(gcp.getCandidatesCompleted())},
{"Models Queued/Running", String.valueOf(gcp.getCandidatesQueued())},
{"Models Failed", String.valueOf(gcp.getCandidatesFailed())},
{"Models Total", String.valueOf(gcp.getCandidatesTotal())},
{"Best Score", (bestScore != null ? String.valueOf(bestScore) : "")},
{"Best Scoring Model", bestModelString != null ? bestModelString : ""},
{"Optimization Runner", gcp.getOptimizationRunner()},
{"Execution Start Time", execStartTimeStr},
{"Total Runtime", execTotalRuntimeStr}
};
ComponentTable ct = new ComponentTable.Builder(STYLE_TABLE)
.content(table)
.header("Status", "")
.build();
components.add(ct);
String[][] tcTable = new String[tcs.size()][2];
for( int i=0; i<tcs.size(); i++ ){
tcTable[i][0] = "Termination Condition " + i;
tcTable[i][1] = tcs.get(i).toString();
}
components.add(DIV_SPACER_20PX);
ComponentTable ct2 = new ComponentTable.Builder(STYLE_TABLE)
.content(tcTable)
.header("Termination Condition", "")
.build();
components.add(ct2);
components.addAll(chartsAndBest.getFirst());
ComponentDiv cd = new ComponentDiv(STYLE_DIV_WIDTH_100_PC, components);
return ok(asJson(cd)).as(JSON);
} } | public class class_name {
private Result getSummaryStatus(){
StatsStorage ss = knownSessionIDs.get(currentSessionID);
if(ss == null){
log.debug("getOptimizationConfig(): Session ID is unknown: {}", currentSessionID); // depends on control dependency: [if], data = [none]
return ok(); // depends on control dependency: [if], data = [none]
}
Persistable p = ss.getStaticInfo(currentSessionID, ARBITER_UI_TYPE_ID, GlobalConfigPersistable.GLOBAL_WORKER_ID);
if(p == null){
log.info("No static info"); // depends on control dependency: [if], data = [none]
return ok(); // depends on control dependency: [if], data = [none]
}
GlobalConfigPersistable gcp = (GlobalConfigPersistable)p;
OptimizationConfiguration oc = gcp.getOptimizationConfiguration();
long execStartTime = oc.getExecutionStartTime();
//Charts:
//Best model score vs. time
//All candidate scores (scatter plot vs. time)
//How to get this? query all model infos...
List<Persistable> allModelInfoTemp = new ArrayList<>(ss.getLatestUpdateAllWorkers(currentSessionID, ARBITER_UI_TYPE_ID));
List<ModelInfoPersistable> allModelInfo = new ArrayList<>();
for(Persistable per : allModelInfoTemp){
ModelInfoPersistable mip = (ModelInfoPersistable)per;
if(mip.getStatus() == CandidateStatus.Complete && mip.getScore() != null && Double.isFinite(mip.getScore())){
allModelInfo.add(mip); // depends on control dependency: [if], data = [none]
}
}
allModelInfo.sort(Comparator.comparingLong(Persistable::getTimeStamp));
Pair<List<Component>, ModelInfoPersistable> chartsAndBest = getSummaryChartsAndBest(allModelInfo, oc.getScoreFunction().minimize(), execStartTime );
//First: table - number completed, queued, running, failed, total
//Best model index, score, and time
//Total runtime
//Termination conditions
List<Component> components = new ArrayList<>();
List<TerminationCondition> tcs = oc.getTerminationConditions();
//TODO: I18N
//TODO don't use currentTimeMillis due to stored data??
long bestTime;
Double bestScore = null;
String bestModelString = null;
if(chartsAndBest.getSecond() != null){
bestTime = chartsAndBest.getSecond().getTimeStamp(); // depends on control dependency: [if], data = [none]
bestScore = chartsAndBest.getSecond().getScore(); // depends on control dependency: [if], data = [none]
String sinceBest = UIUtils.formatDuration(System.currentTimeMillis() - bestTime);
bestModelString = "Model " + chartsAndBest.getSecond().getModelIdx() + ", Found at " +
TIME_FORMATTER.print(bestTime) + " (" + sinceBest + " ago)"; // depends on control dependency: [if], data = [none]
}
String execStartTimeStr = "";
String execTotalRuntimeStr = "";
if(execStartTime > 0){
execStartTimeStr = TIME_FORMATTER.print(execStartTime); // depends on control dependency: [if], data = [(execStartTime]
execTotalRuntimeStr = UIUtils.formatDuration(System.currentTimeMillis() - execStartTime); // depends on control dependency: [if], data = [none]
}
String[][] table = new String[][]{
{"Models Completed", String.valueOf(gcp.getCandidatesCompleted())},
{"Models Queued/Running", String.valueOf(gcp.getCandidatesQueued())},
{"Models Failed", String.valueOf(gcp.getCandidatesFailed())},
{"Models Total", String.valueOf(gcp.getCandidatesTotal())},
{"Best Score", (bestScore != null ? String.valueOf(bestScore) : "")},
{"Best Scoring Model", bestModelString != null ? bestModelString : ""},
{"Optimization Runner", gcp.getOptimizationRunner()},
{"Execution Start Time", execStartTimeStr},
{"Total Runtime", execTotalRuntimeStr}
};
ComponentTable ct = new ComponentTable.Builder(STYLE_TABLE)
.content(table)
.header("Status", "")
.build();
components.add(ct);
String[][] tcTable = new String[tcs.size()][2];
for( int i=0; i<tcs.size(); i++ ){
tcTable[i][0] = "Termination Condition " + i; // depends on control dependency: [for], data = [i]
tcTable[i][1] = tcs.get(i).toString(); // depends on control dependency: [for], data = [i]
}
components.add(DIV_SPACER_20PX);
ComponentTable ct2 = new ComponentTable.Builder(STYLE_TABLE)
.content(tcTable)
.header("Termination Condition", "")
.build();
components.add(ct2);
components.addAll(chartsAndBest.getFirst());
ComponentDiv cd = new ComponentDiv(STYLE_DIV_WIDTH_100_PC, components);
return ok(asJson(cd)).as(JSON);
} } |
public class class_name {
public static void applyHouseholder(DMatrixSparseCSC V , int colV, double beta ,
double []x) {
int idx0 = V.col_idx[colV];
int idx1 = V.col_idx[colV+1];
// Compute tau = v'*x
double tau = 0;
for (int p = idx0; p < idx1; p++) {
tau += V.nz_values[p]*x[V.nz_rows[p]];
}
tau *= beta;
// x = x - v*tau
for (int p = idx0; p < idx1; p++) {
x[V.nz_rows[p]] -= V.nz_values[p]*tau;
}
} } | public class class_name {
public static void applyHouseholder(DMatrixSparseCSC V , int colV, double beta ,
double []x) {
int idx0 = V.col_idx[colV];
int idx1 = V.col_idx[colV+1];
// Compute tau = v'*x
double tau = 0;
for (int p = idx0; p < idx1; p++) {
tau += V.nz_values[p]*x[V.nz_rows[p]]; // depends on control dependency: [for], data = [p]
}
tau *= beta;
// x = x - v*tau
for (int p = idx0; p < idx1; p++) {
x[V.nz_rows[p]] -= V.nz_values[p]*tau; // depends on control dependency: [for], data = [p]
}
} } |
public class class_name {
public double score(int[] featureVector, int currentTag)
{
double score = 0;
for (int index : featureVector)
{
if (index == -1)
{
continue;
}
else if (index < -1 || index >= featureMap.size())
{
throw new IllegalArgumentException("在打分时传入了非法的下标");
}
else
{
index = index * featureMap.tagSet.size() + currentTag;
score += parameter[index]; // 其实就是特征权重的累加
}
}
return score;
} } | public class class_name {
public double score(int[] featureVector, int currentTag)
{
double score = 0;
for (int index : featureVector)
{
if (index == -1)
{
continue;
}
else if (index < -1 || index >= featureMap.size())
{
throw new IllegalArgumentException("在打分时传入了非法的下标");
}
else
{
index = index * featureMap.tagSet.size() + currentTag; // depends on control dependency: [if], data = [none]
score += parameter[index]; // 其实就是特征权重的累加 // depends on control dependency: [if], data = [none]
}
}
return score;
} } |
public class class_name {
private static <T> T[] newEnumMap(Class<?> elementType,
Function<SessionProtocol, T> factory,
SessionProtocol... allowedProtocols) {
@SuppressWarnings("unchecked")
final T[] maps = (T[]) Array.newInstance(elementType, SessionProtocol.values().length);
// Attempting to access the array with an unallowed protocol will trigger NPE,
// which will help us find a bug.
for (SessionProtocol p : allowedProtocols) {
maps[p.ordinal()] = factory.apply(p);
}
return maps;
} } | public class class_name {
private static <T> T[] newEnumMap(Class<?> elementType,
Function<SessionProtocol, T> factory,
SessionProtocol... allowedProtocols) {
@SuppressWarnings("unchecked")
final T[] maps = (T[]) Array.newInstance(elementType, SessionProtocol.values().length);
// Attempting to access the array with an unallowed protocol will trigger NPE,
// which will help us find a bug.
for (SessionProtocol p : allowedProtocols) {
maps[p.ordinal()] = factory.apply(p); // depends on control dependency: [for], data = [p]
}
return maps;
} } |
public class class_name {
@Override
public Object addingBundle(Bundle bundle, BundleEvent event) {
// Packages become available on resolution, so take that as the state we care about
//ignore gateway bundles
if (!isGateway(bundle)) {
/*
* Make sure privatePackages isn't null.
* If new bundles arrive while we're still populating our package list, we'll go through all bundles twice,
* but at least we'll be correct.
*/
BundlePackages bp = populatePackageLists();
harvestPackageList(bp, bundle);
}
return null;
} } | public class class_name {
@Override
public Object addingBundle(Bundle bundle, BundleEvent event) {
// Packages become available on resolution, so take that as the state we care about
//ignore gateway bundles
if (!isGateway(bundle)) {
/*
* Make sure privatePackages isn't null.
* If new bundles arrive while we're still populating our package list, we'll go through all bundles twice,
* but at least we'll be correct.
*/
BundlePackages bp = populatePackageLists();
harvestPackageList(bp, bundle); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Element toElement(final SalesforceDatastore datastore) {
final Element ds = getDocument().createElement("salesforce-datastore");
ds.setAttribute("name", datastore.getName());
if (!Strings.isNullOrEmpty(datastore.getDescription())) {
ds.setAttribute("description", datastore.getDescription());
}
appendElement(ds, "username", datastore.getUsername());
appendElement(ds, "password", encodePassword(datastore.getPassword()));
appendElement(ds, "security-token", datastore.getSecurityToken());
final String endpointUrl = datastore.getEndpointUrl();
if (!Strings.isNullOrEmpty(endpointUrl)) {
appendElement(ds, "endpoint-url", endpointUrl);
}
return ds;
} } | public class class_name {
public Element toElement(final SalesforceDatastore datastore) {
final Element ds = getDocument().createElement("salesforce-datastore");
ds.setAttribute("name", datastore.getName());
if (!Strings.isNullOrEmpty(datastore.getDescription())) {
ds.setAttribute("description", datastore.getDescription()); // depends on control dependency: [if], data = [none]
}
appendElement(ds, "username", datastore.getUsername());
appendElement(ds, "password", encodePassword(datastore.getPassword()));
appendElement(ds, "security-token", datastore.getSecurityToken());
final String endpointUrl = datastore.getEndpointUrl();
if (!Strings.isNullOrEmpty(endpointUrl)) {
appendElement(ds, "endpoint-url", endpointUrl); // depends on control dependency: [if], data = [none]
}
return ds;
} } |
public class class_name {
public void marshall(ListApplicationRevisionsRequest listApplicationRevisionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listApplicationRevisionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listApplicationRevisionsRequest.getApplicationName(), APPLICATIONNAME_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getSortBy(), SORTBY_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getSortOrder(), SORTORDER_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getS3Bucket(), S3BUCKET_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getS3KeyPrefix(), S3KEYPREFIX_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getDeployed(), DEPLOYED_BINDING);
protocolMarshaller.marshall(listApplicationRevisionsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListApplicationRevisionsRequest listApplicationRevisionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listApplicationRevisionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listApplicationRevisionsRequest.getApplicationName(), APPLICATIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getSortBy(), SORTBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getSortOrder(), SORTORDER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getS3Bucket(), S3BUCKET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getS3KeyPrefix(), S3KEYPREFIX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getDeployed(), DEPLOYED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listApplicationRevisionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void connectionClosed(final SibRaConnection connection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "connectionClosed", connection);
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(connection);
for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {
final ConnectionEventListener listener = (ConnectionEventListener) iterator
.next();
listener.connectionClosed(event);
}
_connections.remove(connection);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "connectionClosed");
}
} } | public class class_name {
void connectionClosed(final SibRaConnection connection) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "connectionClosed", connection); // depends on control dependency: [if], data = [none]
}
final ConnectionEvent event = new ConnectionEvent(this,
ConnectionEvent.CONNECTION_CLOSED);
event.setConnectionHandle(connection);
for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {
final ConnectionEventListener listener = (ConnectionEventListener) iterator
.next();
listener.connectionClosed(event); // depends on control dependency: [for], data = [none]
}
_connections.remove(connection);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "connectionClosed"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected SQLException executeExceptionEpilogue(SQLException sqle) {
//if has a failover, closing the statement
if (sqle.getSQLState() != null && sqle.getSQLState().startsWith("08")) {
try {
close();
} catch (SQLException sqlee) {
//eat exception
}
}
if (isTimedout) {
return new SQLTimeoutException("(conn:" + getServerThreadId() + ") Query timed out", "JZ0002",
1317, sqle);
}
SQLException sqlException = ExceptionMapper
.getException(sqle, connection, this, queryTimeout != 0);
logger.error("error executing query", sqlException);
return sqlException;
} } | public class class_name {
protected SQLException executeExceptionEpilogue(SQLException sqle) {
//if has a failover, closing the statement
if (sqle.getSQLState() != null && sqle.getSQLState().startsWith("08")) {
try {
close(); // depends on control dependency: [try], data = [none]
} catch (SQLException sqlee) {
//eat exception
} // depends on control dependency: [catch], data = [none]
}
if (isTimedout) {
return new SQLTimeoutException("(conn:" + getServerThreadId() + ") Query timed out", "JZ0002",
1317, sqle);
}
SQLException sqlException = ExceptionMapper
.getException(sqle, connection, this, queryTimeout != 0);
logger.error("error executing query", sqlException);
return sqlException;
} } |
public class class_name {
@Override
public void initSprite(int width, int height, int x, int y, boolean rotated)
{
if (width == 0 || height == 0)
{
//assume block atlas
width = BLOCK_TEXTURE_WIDTH;
height = BLOCK_TEXTURE_HEIGHT;
}
this.sheetWidth = width;
this.sheetHeight = height;
super.initSprite(width, height, x, y, rotated);
for (TextureAtlasSprite dep : dependants)
{
if (dep instanceof Icon)
((Icon) dep).initIcon(this, width, height, x, y, rotated);
else
dep.copyFrom(this);
}
} } | public class class_name {
@Override
public void initSprite(int width, int height, int x, int y, boolean rotated)
{
if (width == 0 || height == 0)
{
//assume block atlas
width = BLOCK_TEXTURE_WIDTH; // depends on control dependency: [if], data = [none]
height = BLOCK_TEXTURE_HEIGHT; // depends on control dependency: [if], data = [none]
}
this.sheetWidth = width;
this.sheetHeight = height;
super.initSprite(width, height, x, y, rotated);
for (TextureAtlasSprite dep : dependants)
{
if (dep instanceof Icon)
((Icon) dep).initIcon(this, width, height, x, y, rotated);
else
dep.copyFrom(this);
}
} } |
public class class_name {
@Override
public Control[] getControls() {
Control[] controls = line.getControls();
for (int i = 0; i < controls.length; i++) {
Control control = controls[i];
if (control.getType().toString().equals(BooleanControl.Type.MUTE.toString())) {
controls[i] = new FakeMuteControl();
}
}
return controls;
} } | public class class_name {
@Override
public Control[] getControls() {
Control[] controls = line.getControls();
for (int i = 0; i < controls.length; i++) {
Control control = controls[i];
if (control.getType().toString().equals(BooleanControl.Type.MUTE.toString())) {
controls[i] = new FakeMuteControl(); // depends on control dependency: [if], data = [none]
}
}
return controls;
} } |
public class class_name {
public static void resolve(Map<String, String> env) {
for (Map.Entry<String,String> entry: env.entrySet()) {
entry.setValue(Util.replaceMacro(entry.getValue(), env));
}
} } | public class class_name {
public static void resolve(Map<String, String> env) {
for (Map.Entry<String,String> entry: env.entrySet()) {
entry.setValue(Util.replaceMacro(entry.getValue(), env)); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public void startLink(final VertexContext startVertex) {
if (startVertex == null) {
return;
}
final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout();
final int x = (int) graphLayout.getX(startVertex.getVertex());
final int y = (int) graphLayout.getY(startVertex.getVertex());
logger.debug("startLink({})", startVertex);
_startVertex = startVertex;
_startPoint = new Point(x, y);
transformEdgeShape(_startPoint, _startPoint);
_graphContext.getVisualizationViewer().addPostRenderPaintable(_edgePaintable);
transformArrowShape(_startPoint, _startPoint);
_graphContext.getVisualizationViewer().addPostRenderPaintable(_arrowPaintable);
} } | public class class_name {
public void startLink(final VertexContext startVertex) {
if (startVertex == null) {
return; // depends on control dependency: [if], data = [none]
}
final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout();
final int x = (int) graphLayout.getX(startVertex.getVertex());
final int y = (int) graphLayout.getY(startVertex.getVertex());
logger.debug("startLink({})", startVertex);
_startVertex = startVertex;
_startPoint = new Point(x, y);
transformEdgeShape(_startPoint, _startPoint);
_graphContext.getVisualizationViewer().addPostRenderPaintable(_edgePaintable);
transformArrowShape(_startPoint, _startPoint);
_graphContext.getVisualizationViewer().addPostRenderPaintable(_arrowPaintable);
} } |
public class class_name {
private final void checkMagic(final DataInputStream dis)
throws LockFile.FileSecurityException,
LockFile.UnexpectedEndOfFileException,
LockFile.UnexpectedFileIOException, LockFile.WrongMagicException {
boolean success = true;
final byte[] magic = new byte[MAGIC.length];
try {
for (int i = 0; i < MAGIC.length; i++) {
magic[i] = dis.readByte();
if (MAGIC[i] != magic[i]) {
success = false;
}
}
} catch (SecurityException ex) {
throw new FileSecurityException(this, "checkMagic", ex);
} catch (EOFException ex) {
throw new UnexpectedEndOfFileException(this, "checkMagic", ex);
} catch (IOException ex) {
throw new UnexpectedFileIOException(this, "checkMagic", ex);
}
if (!success) {
throw new WrongMagicException(this, "checkMagic", magic);
}
} } | public class class_name {
private final void checkMagic(final DataInputStream dis)
throws LockFile.FileSecurityException,
LockFile.UnexpectedEndOfFileException,
LockFile.UnexpectedFileIOException, LockFile.WrongMagicException {
boolean success = true;
final byte[] magic = new byte[MAGIC.length];
try {
for (int i = 0; i < MAGIC.length; i++) {
magic[i] = dis.readByte(); // depends on control dependency: [for], data = [i]
if (MAGIC[i] != magic[i]) {
success = false; // depends on control dependency: [if], data = [none]
}
}
} catch (SecurityException ex) {
throw new FileSecurityException(this, "checkMagic", ex);
} catch (EOFException ex) {
throw new UnexpectedEndOfFileException(this, "checkMagic", ex);
} catch (IOException ex) {
throw new UnexpectedFileIOException(this, "checkMagic", ex);
}
if (!success) {
throw new WrongMagicException(this, "checkMagic", magic);
}
} } |
public class class_name {
public GetMembersResult withMembers(Member... members) {
if (this.members == null) {
setMembers(new java.util.ArrayList<Member>(members.length));
}
for (Member ele : members) {
this.members.add(ele);
}
return this;
} } | public class class_name {
public GetMembersResult withMembers(Member... members) {
if (this.members == null) {
setMembers(new java.util.ArrayList<Member>(members.length)); // depends on control dependency: [if], data = [none]
}
for (Member ele : members) {
this.members.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public double[] getMonthlyMean () {
// ---------------------------------------------
// Provides a mean for days in each month/year pair. (12 months x N years of data)
// e.g. (12 x N years) of means returned- one for all days in January in 1990,
// one for all dats in Feb in 1990, ... one for all days in January 1991, etc.
//
// Sum the daily data until the month/year changes then
// store the mean.
List<Double> monthlyMean = new ArrayList<Double>();
int totalCount = 0;
int previousYear = -1;
int previousMonth = -1;
boolean currentValid = false;
for (int i=0; i<this.getNumData(); i++) {
int month = -1;
int year = -1;
double currentSum = 0;
double currentCount = 0;
Date date = this.getDate(i);
double data = this.getData(i);
if (i > this.getNumDates()) {throw new IllegalArgumentException("No matching date info for data #" + i);}
// Get month data out of date.
month = date.getMonth(); // kmolson TODO- use calendar instead?
year = date.getYear();
if (month > 11) {throw new IllegalArgumentException("Month number data out of range: " + month);}
// Check if month or year advances.
// This assumes data is in Chronological order. If not, we need to save and
// scan back for matching month/year pairs already written.
// Could add min and max year to data fields of DatedData class and allocate based on that.
// I was just worried about access efficiency... if data is in Chronological order,
// we don't need to worry about it, not keeping track is faster.
boolean sameMonthYear = (month == previousMonth) && (year==previousYear);
if (sameMonthYear) {
// Same month/year pair, so update current entry.
currentSum += data;
currentCount++;
currentValid = true;
}
boolean isLastData = i==(this.getNumData()-1);
if (currentValid && (!sameMonthYear || isLastData)) {
// If moving to new month or year, or it is the last data, add the mean to the result array.
if (currentValid) {
double currentMean = currentSum/currentCount;
monthlyMean.add(currentMean);
}
// Set current to new data and a count of 1
currentCount = 1;
currentSum = data;
}
previousMonth = month;
previousYear = year;
// Add to appropriate sum
totalCount++;
}
if (totalCount == 0) {throw new IllegalArgumentException("No data used in Mean Monthly calculation.");}
// Assign MonthlyMean data to output array.
double[] arr = new double[monthlyMean.size()];
for (int i=0; i < monthlyMean.size(); i++) {
arr[i] = monthlyMean.get(i);
}
return arr;
} } | public class class_name {
public double[] getMonthlyMean () {
// ---------------------------------------------
// Provides a mean for days in each month/year pair. (12 months x N years of data)
// e.g. (12 x N years) of means returned- one for all days in January in 1990,
// one for all dats in Feb in 1990, ... one for all days in January 1991, etc.
//
// Sum the daily data until the month/year changes then
// store the mean.
List<Double> monthlyMean = new ArrayList<Double>();
int totalCount = 0;
int previousYear = -1;
int previousMonth = -1;
boolean currentValid = false;
for (int i=0; i<this.getNumData(); i++) {
int month = -1;
int year = -1;
double currentSum = 0;
double currentCount = 0;
Date date = this.getDate(i);
double data = this.getData(i);
if (i > this.getNumDates()) {throw new IllegalArgumentException("No matching date info for data #" + i);}
// Get month data out of date.
month = date.getMonth(); // kmolson TODO- use calendar instead? // depends on control dependency: [for], data = [none]
year = date.getYear(); // depends on control dependency: [for], data = [none]
if (month > 11) {throw new IllegalArgumentException("Month number data out of range: " + month);}
// Check if month or year advances.
// This assumes data is in Chronological order. If not, we need to save and
// scan back for matching month/year pairs already written.
// Could add min and max year to data fields of DatedData class and allocate based on that.
// I was just worried about access efficiency... if data is in Chronological order,
// we don't need to worry about it, not keeping track is faster.
boolean sameMonthYear = (month == previousMonth) && (year==previousYear);
if (sameMonthYear) {
// Same month/year pair, so update current entry.
currentSum += data; // depends on control dependency: [if], data = [none]
currentCount++; // depends on control dependency: [if], data = [none]
currentValid = true; // depends on control dependency: [if], data = [none]
}
boolean isLastData = i==(this.getNumData()-1);
if (currentValid && (!sameMonthYear || isLastData)) {
// If moving to new month or year, or it is the last data, add the mean to the result array.
if (currentValid) {
double currentMean = currentSum/currentCount;
monthlyMean.add(currentMean); // depends on control dependency: [if], data = [none]
}
// Set current to new data and a count of 1
currentCount = 1; // depends on control dependency: [if], data = [none]
currentSum = data; // depends on control dependency: [if], data = [none]
}
previousMonth = month; // depends on control dependency: [for], data = [none]
previousYear = year; // depends on control dependency: [for], data = [none]
// Add to appropriate sum
totalCount++; // depends on control dependency: [for], data = [none]
}
if (totalCount == 0) {throw new IllegalArgumentException("No data used in Mean Monthly calculation.");}
// Assign MonthlyMean data to output array.
double[] arr = new double[monthlyMean.size()];
for (int i=0; i < monthlyMean.size(); i++) {
arr[i] = monthlyMean.get(i); // depends on control dependency: [for], data = [i]
}
return arr;
} } |
public class class_name {
public boolean setCurrentTheme(int theme){
if (Looper.getMainLooper().getThread() != Thread.currentThread())
return false;
if(mCurrentTheme != theme){
mCurrentTheme = theme;
SharedPreferences pref = getSharedPreferences(mContext);
if(pref != null)
pref.edit().putInt(KEY_THEME, mCurrentTheme).apply();
dispatchThemeChanged(mCurrentTheme);
return true;
}
return false;
} } | public class class_name {
public boolean setCurrentTheme(int theme){
if (Looper.getMainLooper().getThread() != Thread.currentThread())
return false;
if(mCurrentTheme != theme){
mCurrentTheme = theme; // depends on control dependency: [if], data = [none]
SharedPreferences pref = getSharedPreferences(mContext);
if(pref != null)
pref.edit().putInt(KEY_THEME, mCurrentTheme).apply();
dispatchThemeChanged(mCurrentTheme); // depends on control dependency: [if], data = [(mCurrentTheme]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public EClass getIfcAxis2Placement() {
if (ifcAxis2PlacementEClass == null) {
ifcAxis2PlacementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(938);
}
return ifcAxis2PlacementEClass;
} } | public class class_name {
public EClass getIfcAxis2Placement() {
if (ifcAxis2PlacementEClass == null) {
ifcAxis2PlacementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(938);
// depends on control dependency: [if], data = [none]
}
return ifcAxis2PlacementEClass;
} } |
public class class_name {
public void marshall(InventoryResultItem inventoryResultItem, ProtocolMarshaller protocolMarshaller) {
if (inventoryResultItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inventoryResultItem.getTypeName(), TYPENAME_BINDING);
protocolMarshaller.marshall(inventoryResultItem.getSchemaVersion(), SCHEMAVERSION_BINDING);
protocolMarshaller.marshall(inventoryResultItem.getCaptureTime(), CAPTURETIME_BINDING);
protocolMarshaller.marshall(inventoryResultItem.getContentHash(), CONTENTHASH_BINDING);
protocolMarshaller.marshall(inventoryResultItem.getContent(), CONTENT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InventoryResultItem inventoryResultItem, ProtocolMarshaller protocolMarshaller) {
if (inventoryResultItem == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inventoryResultItem.getTypeName(), TYPENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryResultItem.getSchemaVersion(), SCHEMAVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryResultItem.getCaptureTime(), CAPTURETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryResultItem.getContentHash(), CONTENTHASH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryResultItem.getContent(), CONTENT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private HostFailoverPolicy getFailoverPolicy(String failoverOption)
{
if (failoverOption != null)
{
if (Constants.FAIL_FAST.equals(failoverOption))
{
return HostFailoverPolicy.FAIL_FAST;
}
else if (Constants.ON_FAIL_TRY_ALL_AVAILABLE.equals(failoverOption))
{
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE;
}
else if (Constants.ON_FAIL_TRY_ONE_NEXT_AVAILABLE.equals(failoverOption))
{
return HostFailoverPolicy.ON_FAIL_TRY_ONE_NEXT_AVAILABLE;
}
else
{
logger.warn("Invalid failover policy {}, using default {} ", failoverOption,
HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE.name());
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE;
}
}
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE;
} } | public class class_name {
private HostFailoverPolicy getFailoverPolicy(String failoverOption)
{
if (failoverOption != null)
{
if (Constants.FAIL_FAST.equals(failoverOption))
{
return HostFailoverPolicy.FAIL_FAST; // depends on control dependency: [if], data = [none]
}
else if (Constants.ON_FAIL_TRY_ALL_AVAILABLE.equals(failoverOption))
{
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE; // depends on control dependency: [if], data = [none]
}
else if (Constants.ON_FAIL_TRY_ONE_NEXT_AVAILABLE.equals(failoverOption))
{
return HostFailoverPolicy.ON_FAIL_TRY_ONE_NEXT_AVAILABLE; // depends on control dependency: [if], data = [none]
}
else
{
logger.warn("Invalid failover policy {}, using default {} ", failoverOption,
HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE.name()); // depends on control dependency: [if], data = [none]
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE; // depends on control dependency: [if], data = [none]
}
}
return HostFailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE;
} } |
public class class_name {
public DoubleProperty lengthProperty() {
if (this.length == null) {
this.length = new ReadOnlyDoubleWrapper();
this.length.bind(Bindings.createDoubleBinding(() -> Path2afp.calculatesPathLength(getPathIterator()),
innerTypesProperty(), innerCoordinatesProperty()));
}
return this.length;
} } | public class class_name {
public DoubleProperty lengthProperty() {
if (this.length == null) {
this.length = new ReadOnlyDoubleWrapper(); // depends on control dependency: [if], data = [none]
this.length.bind(Bindings.createDoubleBinding(() -> Path2afp.calculatesPathLength(getPathIterator()),
innerTypesProperty(), innerCoordinatesProperty())); // depends on control dependency: [if], data = [none]
}
return this.length;
} } |
public class class_name {
public Observable<ServiceResponse<Page<EventInner>>> listEventsNextWithServiceResponseAsync(final String nextPageLink) {
return listEventsNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<EventInner>>> listEventsNextWithServiceResponseAsync(final String nextPageLink) {
return listEventsNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
protected void replaceWithChildren(Element element)
{
Element parent = (Element) element.getParentNode();
while (element.getFirstChild() != null) {
parent.insertBefore(element.removeChild(element.getFirstChild()), element);
}
parent.removeChild(element);
} } | public class class_name {
protected void replaceWithChildren(Element element)
{
Element parent = (Element) element.getParentNode();
while (element.getFirstChild() != null) {
parent.insertBefore(element.removeChild(element.getFirstChild()), element); // depends on control dependency: [while], data = [(element.getFirstChild()]
}
parent.removeChild(element);
} } |
public class class_name {
@Override
public double getWeight(double distance, double max, double stddev) {
if(stddev <= 0) {
return 1;
}
double scaleddistance = distance / stddev;
return stddev * FastMath.exp(-.5 * scaleddistance);
} } | public class class_name {
@Override
public double getWeight(double distance, double max, double stddev) {
if(stddev <= 0) {
return 1; // depends on control dependency: [if], data = [none]
}
double scaleddistance = distance / stddev;
return stddev * FastMath.exp(-.5 * scaleddistance);
} } |
public class class_name {
public JSONObject faceAudit(List<String> imgPaths, EImgType type,
HashMap<String, String> options) {
if (type == EImgType.FILE) {
try {
byte[][] imgData = new byte[imgPaths.size()][];
int idx = 0;
for (String path : imgPaths) {
imgData[idx] = Util.readFileByBytes(path);
++idx;
}
return faceAudit(imgData, options);
} catch (IOException e) {
e.printStackTrace();
return AipError.IMAGE_READ_ERROR.toJsonResult();
}
}
AipRequest request = new AipRequest();
request.addBody("imgUrls", Util.mkString(imgPaths.iterator(), ','));
return faceAuditHelper(request, options);
} } | public class class_name {
public JSONObject faceAudit(List<String> imgPaths, EImgType type,
HashMap<String, String> options) {
if (type == EImgType.FILE) {
try {
byte[][] imgData = new byte[imgPaths.size()][];
int idx = 0;
for (String path : imgPaths) {
imgData[idx] = Util.readFileByBytes(path); // depends on control dependency: [for], data = [path]
++idx; // depends on control dependency: [for], data = [none]
}
return faceAudit(imgData, options); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
return AipError.IMAGE_READ_ERROR.toJsonResult();
} // depends on control dependency: [catch], data = [none]
}
AipRequest request = new AipRequest();
request.addBody("imgUrls", Util.mkString(imgPaths.iterator(), ','));
return faceAuditHelper(request, options);
} } |
public class class_name {
private HttpUriRequest makeRequest(URI uri, final String requestBody)
{
HttpUriRequest request;
if (m_method == HttpMethod.GET) {
request = new HttpGet(uri + "?" + requestBody);
} else if (m_method == HttpMethod.POST) {
if (m_isHdfs) {
try {
uri = HDFSUtils.opAdder(uri, "APPEND");
} catch (IllegalArgumentException e) {
rateLimitedLogError(m_logger, "Invalid URI %s %s", uri.toString(), Throwables.getStackTraceAsString(e));
return null;
}
}
final HttpPost post = new HttpPost(uri);
post.setEntity(new StringEntity(requestBody, m_contentType));
request = post;
} else if (m_method == HttpMethod.PUT) {
final HttpPut put = new HttpPut(uri);
put.setEntity(new StringEntity(requestBody, m_contentType));
request = put;
} else {
// Should never reach here
request = null;
}
if (m_isHdfs && request != null) {
request.setHeader("Expect", "100-continue");
}
return request;
} } | public class class_name {
private HttpUriRequest makeRequest(URI uri, final String requestBody)
{
HttpUriRequest request;
if (m_method == HttpMethod.GET) {
request = new HttpGet(uri + "?" + requestBody); // depends on control dependency: [if], data = [none]
} else if (m_method == HttpMethod.POST) {
if (m_isHdfs) {
try {
uri = HDFSUtils.opAdder(uri, "APPEND"); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
rateLimitedLogError(m_logger, "Invalid URI %s %s", uri.toString(), Throwables.getStackTraceAsString(e));
return null;
} // depends on control dependency: [catch], data = [none]
}
final HttpPost post = new HttpPost(uri);
post.setEntity(new StringEntity(requestBody, m_contentType)); // depends on control dependency: [if], data = [none]
request = post; // depends on control dependency: [if], data = [none]
} else if (m_method == HttpMethod.PUT) {
final HttpPut put = new HttpPut(uri);
put.setEntity(new StringEntity(requestBody, m_contentType)); // depends on control dependency: [if], data = [none]
request = put; // depends on control dependency: [if], data = [none]
} else {
// Should never reach here
request = null; // depends on control dependency: [if], data = [none]
}
if (m_isHdfs && request != null) {
request.setHeader("Expect", "100-continue"); // depends on control dependency: [if], data = [none]
}
return request;
} } |
public class class_name {
@Override
public boolean equalsIgnoringTypeParams(final TypeSignature other) {
if (other instanceof ClassRefTypeSignature) {
if (((ClassRefTypeSignature) other).className.equals("java.lang.Object")) {
// java.lang.Object can be reconciled with any type, so it can be reconciled with
// any type variable
return true;
}
// Resolve the type variable against the containing class' type parameters
TypeParameter typeParameter;
try {
typeParameter = resolve();
} catch (final IllegalArgumentException e) {
// If the corresponding type parameter cannot be resolved:
// unknown type variables can always be reconciled with a concrete class
return true;
}
if (typeParameter.classBound == null
&& (typeParameter.interfaceBounds == null || typeParameter.interfaceBounds.isEmpty())) {
// If the type parameter has no bounds, just assume the type variable can be reconciled
// to the class by type inference
return true;
}
if (typeParameter.classBound != null) {
if (typeParameter.classBound instanceof ClassRefTypeSignature) {
if (typeParameter.classBound.equals(other)) {
// T extends X, and X == other
return true;
}
} else if (typeParameter.classBound instanceof TypeVariableSignature) {
// "X" is reconcilable with "Y extends X"
return this.equalsIgnoringTypeParams(typeParameter.classBound);
} else /* if (typeParameter.classBound instanceof ArrayTypeSignature) */ {
return false;
}
}
if (typeParameter.interfaceBounds != null) {
for (final ReferenceTypeSignature interfaceBound : typeParameter.interfaceBounds) {
if (interfaceBound instanceof ClassRefTypeSignature) {
if (interfaceBound.equals(other)) {
// T implements X, and X == other
return true;
}
} else if (interfaceBound instanceof TypeVariableSignature) {
// "X" is reconcilable with "Y implements X"
return this.equalsIgnoringTypeParams(interfaceBound);
} else /* if (interfaceBound instanceof ArrayTypeSignature) */ {
return false;
}
}
}
// Type variable has a concrete bound that is not reconcilable with 'other'
// (we don't follow the class hierarchy to compare the bound against the class reference,
// since the compiler should only use the bound during type erasure, not some other class
// in the class hierarchy)
return false;
}
// Technically I think type variables are never equal to each other, due to capturing,
// but just compare the variable name for equality here (this should never get
// triggered in general, since we only compare type-erased signatures to
// non-type-erased signatures currently).
return this.equals(other);
} } | public class class_name {
@Override
public boolean equalsIgnoringTypeParams(final TypeSignature other) {
if (other instanceof ClassRefTypeSignature) {
if (((ClassRefTypeSignature) other).className.equals("java.lang.Object")) {
// java.lang.Object can be reconciled with any type, so it can be reconciled with
// any type variable
return true;
}
// Resolve the type variable against the containing class' type parameters
TypeParameter typeParameter;
try {
typeParameter = resolve(); // depends on control dependency: [try], data = [none]
} catch (final IllegalArgumentException e) {
// If the corresponding type parameter cannot be resolved:
// unknown type variables can always be reconciled with a concrete class
return true;
} // depends on control dependency: [catch], data = [none]
if (typeParameter.classBound == null
&& (typeParameter.interfaceBounds == null || typeParameter.interfaceBounds.isEmpty())) {
// If the type parameter has no bounds, just assume the type variable can be reconciled
// to the class by type inference
return true; // depends on control dependency: [if], data = [none]
}
if (typeParameter.classBound != null) {
if (typeParameter.classBound instanceof ClassRefTypeSignature) {
if (typeParameter.classBound.equals(other)) {
// T extends X, and X == other
return true; // depends on control dependency: [if], data = [none]
}
} else if (typeParameter.classBound instanceof TypeVariableSignature) {
// "X" is reconcilable with "Y extends X"
return this.equalsIgnoringTypeParams(typeParameter.classBound); // depends on control dependency: [if], data = [none]
} else /* if (typeParameter.classBound instanceof ArrayTypeSignature) */ {
return false; // depends on control dependency: [if], data = [none]
}
}
if (typeParameter.interfaceBounds != null) {
for (final ReferenceTypeSignature interfaceBound : typeParameter.interfaceBounds) {
if (interfaceBound instanceof ClassRefTypeSignature) {
if (interfaceBound.equals(other)) {
// T implements X, and X == other
return true; // depends on control dependency: [if], data = [none]
}
} else if (interfaceBound instanceof TypeVariableSignature) {
// "X" is reconcilable with "Y implements X"
return this.equalsIgnoringTypeParams(interfaceBound); // depends on control dependency: [if], data = [none]
} else /* if (interfaceBound instanceof ArrayTypeSignature) */ {
return false; // depends on control dependency: [if], data = [none]
}
}
}
// Type variable has a concrete bound that is not reconcilable with 'other'
// (we don't follow the class hierarchy to compare the bound against the class reference,
// since the compiler should only use the bound during type erasure, not some other class
// in the class hierarchy)
return false; // depends on control dependency: [if], data = [none]
}
// Technically I think type variables are never equal to each other, due to capturing,
// but just compare the variable name for equality here (this should never get
// triggered in general, since we only compare type-erased signatures to
// non-type-erased signatures currently).
return this.equals(other);
} } |
public class class_name {
public GroupZipper replace(Group group) {
if (parent == null) {
node = group;
} else {
parent.getNode().getGroups().set(index, group);
}
return this;
} } | public class class_name {
public GroupZipper replace(Group group) {
if (parent == null) {
node = group;
// depends on control dependency: [if], data = [none]
} else {
parent.getNode().getGroups().set(index, group);
// depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private boolean applyCorsConfig(final HttpRequest req, final AbstractHttpQuery query)
throws BadRequestException {
final String domain = req.headers().get("Origin");
// catch CORS requests and add the header or refuse them if the domain
// list has been configured
if (query.method() == HttpMethod.OPTIONS ||
(cors_domains != null && domain != null && !domain.isEmpty())) {
if (cors_domains == null || domain == null || domain.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" +
query.method().getName() + "] is not permitted");
}
if (cors_domains.contains("*") ||
cors_domains.contains(domain.toUpperCase())) {
// when a domain has matched successfully, we need to add the header
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,
domain);
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS,
"GET, POST, PUT, DELETE");
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS,
cors_headers);
// if the method requested was for OPTIONS then we'll return an OK
// here and no further processing is needed.
if (query.method() == HttpMethod.OPTIONS) {
query.sendStatusOnly(HttpResponseStatus.OK);
return true;
}
} else {
// You'd think that they would want the server to return a 403 if
// the Origin wasn't in the CORS domain list, but they want a 200
// without the allow origin header. We'll return an error in the
// body though.
throw new BadRequestException(HttpResponseStatus.OK,
"CORS domain not allowed", "The domain [" + domain +
"] is not permitted access");
}
}
return false;
} } | public class class_name {
private boolean applyCorsConfig(final HttpRequest req, final AbstractHttpQuery query)
throws BadRequestException {
final String domain = req.headers().get("Origin");
// catch CORS requests and add the header or refuse them if the domain
// list has been configured
if (query.method() == HttpMethod.OPTIONS ||
(cors_domains != null && domain != null && !domain.isEmpty())) {
if (cors_domains == null || domain == null || domain.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed", "The HTTP method [" +
query.method().getName() + "] is not permitted");
}
if (cors_domains.contains("*") ||
cors_domains.contains(domain.toUpperCase())) {
// when a domain has matched successfully, we need to add the header
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN,
domain); // depends on control dependency: [if], data = [none]
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS,
"GET, POST, PUT, DELETE"); // depends on control dependency: [if], data = [none]
query.response().headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS,
cors_headers); // depends on control dependency: [if], data = [none]
// if the method requested was for OPTIONS then we'll return an OK
// here and no further processing is needed.
if (query.method() == HttpMethod.OPTIONS) {
query.sendStatusOnly(HttpResponseStatus.OK); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} else {
// You'd think that they would want the server to return a 403 if
// the Origin wasn't in the CORS domain list, but they want a 200
// without the allow origin header. We'll return an error in the
// body though.
throw new BadRequestException(HttpResponseStatus.OK,
"CORS domain not allowed", "The domain [" + domain +
"] is not permitted access");
}
}
return false;
} } |
public class class_name {
public static List<Method> getAllDeclaredMethods(Class<?> clazz) {
List<Method> result = new ArrayList<>();
while (clazz != null) {
Method[] methods = clazz.getDeclaredMethods();
Collections.addAll(result, methods);
clazz = clazz.getSuperclass();
}
return result;
} } | public class class_name {
public static List<Method> getAllDeclaredMethods(Class<?> clazz) {
List<Method> result = new ArrayList<>();
while (clazz != null) {
Method[] methods = clazz.getDeclaredMethods();
Collections.addAll(result, methods); // depends on control dependency: [while], data = [none]
clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return result;
} } |
public class class_name {
public void marshall(ClearDefaultAuthorizerRequest clearDefaultAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (clearDefaultAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ClearDefaultAuthorizerRequest clearDefaultAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (clearDefaultAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T, E extends I18nId> SLF4JLogger<T, ?, E> getLogger(Class<T> clazz, Class<?> caller) {
org.slf4j.Logger logger = LoggerFactory.getLogger(clazz);
if(logger instanceof LocationAwareLogger) {
return new SLF4JCallerLocationAwareLogger<T, E>((LocationAwareLogger)logger, caller);
} else {
return new SLF4JLogger<T, org.slf4j.Logger, E>(logger);
}
} } | public class class_name {
public static <T, E extends I18nId> SLF4JLogger<T, ?, E> getLogger(Class<T> clazz, Class<?> caller) {
org.slf4j.Logger logger = LoggerFactory.getLogger(clazz);
if(logger instanceof LocationAwareLogger) {
return new SLF4JCallerLocationAwareLogger<T, E>((LocationAwareLogger)logger, caller); // depends on control dependency: [if], data = [none]
} else {
return new SLF4JLogger<T, org.slf4j.Logger, E>(logger); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public MessageProperties toMessageProperties(AMQP.BasicProperties source, Envelope envelope, String charset) {
final MessageProperties messageProperties = super.toMessageProperties(source, envelope, charset);
final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile);
if (filterConfiguration.shouldProcessContext(AsyncProcess)) {
// Values are stored as type of LongStringHelper.ByteArrayLongString - but it's private
final Map<String, String> traceeContextMap = transformToTraceeContextMap(
(Map<String, ?>) messageProperties.getHeaders().get(TPIC_HEADER));
if (traceeContextMap != null && !traceeContextMap.isEmpty()) {
backend.putAll(filterConfiguration.filterDeniedParams(traceeContextMap, AsyncProcess));
}
}
Utilities.generateInvocationIdIfNecessary(backend);
return messageProperties;
} } | public class class_name {
@Override
public MessageProperties toMessageProperties(AMQP.BasicProperties source, Envelope envelope, String charset) {
final MessageProperties messageProperties = super.toMessageProperties(source, envelope, charset);
final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile);
if (filterConfiguration.shouldProcessContext(AsyncProcess)) {
// Values are stored as type of LongStringHelper.ByteArrayLongString - but it's private
final Map<String, String> traceeContextMap = transformToTraceeContextMap(
(Map<String, ?>) messageProperties.getHeaders().get(TPIC_HEADER));
if (traceeContextMap != null && !traceeContextMap.isEmpty()) {
backend.putAll(filterConfiguration.filterDeniedParams(traceeContextMap, AsyncProcess)); // depends on control dependency: [if], data = [(traceeContextMap]
}
}
Utilities.generateInvocationIdIfNecessary(backend);
return messageProperties;
} } |
public class class_name {
private Set<String> getKeysForUser(CmsUser user) {
Set<String> keysToRemove = new HashSet<String>();
for (Map.Entry<String, CmsUserData> entry : m_storage.entrySet()) {
String key = entry.getKey();
int separatorPos = key.lastIndexOf(KEY_SEPARATOR);
String prefix = key.substring(0, separatorPos);
if (user.getName().equals(prefix)) {
keysToRemove.add(key);
}
}
return keysToRemove;
} } | public class class_name {
private Set<String> getKeysForUser(CmsUser user) {
Set<String> keysToRemove = new HashSet<String>();
for (Map.Entry<String, CmsUserData> entry : m_storage.entrySet()) {
String key = entry.getKey();
int separatorPos = key.lastIndexOf(KEY_SEPARATOR);
String prefix = key.substring(0, separatorPos);
if (user.getName().equals(prefix)) {
keysToRemove.add(key); // depends on control dependency: [if], data = [none]
}
}
return keysToRemove;
} } |
public class class_name {
@Override
public V get(K k) throws ExecutionException {
V value = getIfPresent(k);
if (null == value) {
try {
value = cacheLoader.load(k);
if (null != value) {
put(k, value);
}
} catch (Exception e) {
LOGGER.warn("Failed to load value for the cache {}", e);
}
}
//LOGGER.debug("get {} = {}", k, value);
return value;
} } | public class class_name {
@Override
public V get(K k) throws ExecutionException {
V value = getIfPresent(k);
if (null == value) {
try {
value = cacheLoader.load(k); // depends on control dependency: [try], data = [none]
if (null != value) {
put(k, value); // depends on control dependency: [if], data = [value)]
}
} catch (Exception e) {
LOGGER.warn("Failed to load value for the cache {}", e);
} // depends on control dependency: [catch], data = [none]
}
//LOGGER.debug("get {} = {}", k, value);
return value;
} } |
public class class_name {
public static void hideUploadButtonWhenNeeded(final Page page, final Session session,
final UserManager userManager,
final Boolean lockdownUploadProjects) {
final User user = session.getUser();
if (lockdownUploadProjects && !UserUtils.hasPermissionforAction(userManager, user,
Permission.Type.UPLOADPROJECTS)) {
page.add("hideUploadProject", true);
}
} } | public class class_name {
public static void hideUploadButtonWhenNeeded(final Page page, final Session session,
final UserManager userManager,
final Boolean lockdownUploadProjects) {
final User user = session.getUser();
if (lockdownUploadProjects && !UserUtils.hasPermissionforAction(userManager, user,
Permission.Type.UPLOADPROJECTS)) {
page.add("hideUploadProject", true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void main(String[] args) {
boolean verbose = args.length == 1 && "-v".equals(args[0]);
Version version = HBaseVersion.get();
System.out.println(version.getMajorVersion());
if (verbose) {
System.out.println("versionString=" + getVersionString());
}
} } | public class class_name {
public static void main(String[] args) {
boolean verbose = args.length == 1 && "-v".equals(args[0]);
Version version = HBaseVersion.get();
System.out.println(version.getMajorVersion());
if (verbose) {
System.out.println("versionString=" + getVersionString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeEntry entry) {
try {
applyUpdateInode(entry);
context.get().append(JournalEntry.newBuilder().setUpdateInode(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} } | public class class_name {
public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeEntry entry) {
try {
applyUpdateInode(entry); // depends on control dependency: [try], data = [none]
context.get().append(JournalEntry.newBuilder().setUpdateInode(entry).build()); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean parseVariant(Cosmic cosmic) {
boolean validVariant;
String mutationCds = cosmic.getMutationCDS();
if (mutationCds.contains(">")) {
validVariant = parseSnv(mutationCds, cosmic);
if (!validVariant) {
invalidSubstitutionLines++;
}
} else if (mutationCds.contains("del")) {
validVariant = parseDeletion(mutationCds, cosmic);
if (!validVariant) {
invalidDeletionLines++;
}
} else if (mutationCds.contains("ins")) {
validVariant = parseInsertion(mutationCds, cosmic);
if (!validVariant) {
invalidInsertionLines++;
}
} else if (mutationCds.contains("dup")) {
validVariant = parseDuplication(mutationCds);
if (!validVariant) {
invalidDuplicationLines++;
}
} else {
validVariant = false;
invalidMutationCDSOtherReason++;
}
return validVariant;
} } | public class class_name {
private boolean parseVariant(Cosmic cosmic) {
boolean validVariant;
String mutationCds = cosmic.getMutationCDS();
if (mutationCds.contains(">")) {
validVariant = parseSnv(mutationCds, cosmic); // depends on control dependency: [if], data = [none]
if (!validVariant) {
invalidSubstitutionLines++; // depends on control dependency: [if], data = [none]
}
} else if (mutationCds.contains("del")) {
validVariant = parseDeletion(mutationCds, cosmic); // depends on control dependency: [if], data = [none]
if (!validVariant) {
invalidDeletionLines++; // depends on control dependency: [if], data = [none]
}
} else if (mutationCds.contains("ins")) {
validVariant = parseInsertion(mutationCds, cosmic); // depends on control dependency: [if], data = [none]
if (!validVariant) {
invalidInsertionLines++; // depends on control dependency: [if], data = [none]
}
} else if (mutationCds.contains("dup")) {
validVariant = parseDuplication(mutationCds); // depends on control dependency: [if], data = [none]
if (!validVariant) {
invalidDuplicationLines++; // depends on control dependency: [if], data = [none]
}
} else {
validVariant = false; // depends on control dependency: [if], data = [none]
invalidMutationCDSOtherReason++; // depends on control dependency: [if], data = [none]
}
return validVariant;
} } |
public class class_name {
private void checkObjectImplementsInterface(GraphQLObjectType objectType, GraphQLInterfaceType interfaceType, SchemaValidationErrorCollector validationErrorCollector) {
List<GraphQLFieldDefinition> fieldDefinitions = interfaceType.getFieldDefinitions();
for (GraphQLFieldDefinition interfaceFieldDef : fieldDefinitions) {
GraphQLFieldDefinition objectFieldDef = objectType.getFieldDefinition(interfaceFieldDef.getName());
if (objectFieldDef == null) {
validationErrorCollector.addError(
error(format("object type '%s' does not implement interface '%s' because field '%s' is missing",
objectType.getName(), interfaceType.getName(), interfaceFieldDef.getName())));
} else {
checkFieldTypeCompatibility(objectType, interfaceType, validationErrorCollector, interfaceFieldDef, objectFieldDef);
}
}
} } | public class class_name {
private void checkObjectImplementsInterface(GraphQLObjectType objectType, GraphQLInterfaceType interfaceType, SchemaValidationErrorCollector validationErrorCollector) {
List<GraphQLFieldDefinition> fieldDefinitions = interfaceType.getFieldDefinitions();
for (GraphQLFieldDefinition interfaceFieldDef : fieldDefinitions) {
GraphQLFieldDefinition objectFieldDef = objectType.getFieldDefinition(interfaceFieldDef.getName());
if (objectFieldDef == null) {
validationErrorCollector.addError(
error(format("object type '%s' does not implement interface '%s' because field '%s' is missing",
objectType.getName(), interfaceType.getName(), interfaceFieldDef.getName()))); // depends on control dependency: [if], data = [none]
} else {
checkFieldTypeCompatibility(objectType, interfaceType, validationErrorCollector, interfaceFieldDef, objectFieldDef); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static boolean deepEquals(final Object a, final Object b) {
if ((a == null) ? b == null : (b == null ? false : a.equals(b))) {
return true;
}
if ((a != null) && (b != null) && a.getClass().isArray() && a.getClass().equals(b.getClass())) {
return typeOf(a.getClass()).deepEquals(a, b);
}
return false;
} } | public class class_name {
public static boolean deepEquals(final Object a, final Object b) {
if ((a == null) ? b == null : (b == null ? false : a.equals(b))) {
return true;
// depends on control dependency: [if], data = [none]
}
if ((a != null) && (b != null) && a.getClass().isArray() && a.getClass().equals(b.getClass())) {
return typeOf(a.getClass()).deepEquals(a, b);
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
public void connect() {
try {
disconnect();
// Create topic admin
TopicAdminSettings.Builder topicBuilder = TopicAdminSettings.newBuilder();
if (credentialsProvider != null) {
topicBuilder.setCredentialsProvider(credentialsProvider);
}
if (executorProvider != null) {
topicBuilder.setExecutorProvider(executorProvider);
} else {
topicBuilder.setExecutorProvider(defaultExecutorProvider);
}
if (headerProvider != null) {
topicBuilder.setHeaderProvider(headerProvider);
}
if (transportChannelProvider != null) {
topicBuilder.setTransportChannelProvider(transportChannelProvider);
}
if (clock != null) {
topicBuilder.setClock(clock);
}
topicAdmin = TopicAdminClient.create(topicBuilder.build());
// Create subscription admin
SubscriptionAdminSettings.Builder subscriptionBuilder = SubscriptionAdminSettings.newBuilder();
if (credentialsProvider != null) {
subscriptionBuilder.setCredentialsProvider(credentialsProvider);
}
if (executorProvider != null) {
subscriptionBuilder.setExecutorProvider(executorProvider);
} else {
subscriptionBuilder.setExecutorProvider(defaultExecutorProvider);
}
if (headerProvider != null) {
subscriptionBuilder.setHeaderProvider(headerProvider);
}
if (transportChannelProvider != null) {
subscriptionBuilder.setTransportChannelProvider(transportChannelProvider);
}
if (clock != null) {
subscriptionBuilder.setClock(clock);
}
subscriptionAdmin = SubscriptionAdminClient.create(subscriptionBuilder.build());
connected();
connected.set(true);
} catch (Exception cause) {
reconnect(cause);
}
} } | public class class_name {
@Override
public void connect() {
try {
disconnect();
// depends on control dependency: [try], data = [none]
// Create topic admin
TopicAdminSettings.Builder topicBuilder = TopicAdminSettings.newBuilder();
if (credentialsProvider != null) {
topicBuilder.setCredentialsProvider(credentialsProvider);
// depends on control dependency: [if], data = [(credentialsProvider]
}
if (executorProvider != null) {
topicBuilder.setExecutorProvider(executorProvider);
// depends on control dependency: [if], data = [(executorProvider]
} else {
topicBuilder.setExecutorProvider(defaultExecutorProvider);
// depends on control dependency: [if], data = [none]
}
if (headerProvider != null) {
topicBuilder.setHeaderProvider(headerProvider);
// depends on control dependency: [if], data = [(headerProvider]
}
if (transportChannelProvider != null) {
topicBuilder.setTransportChannelProvider(transportChannelProvider);
// depends on control dependency: [if], data = [(transportChannelProvider]
}
if (clock != null) {
topicBuilder.setClock(clock);
// depends on control dependency: [if], data = [(clock]
}
topicAdmin = TopicAdminClient.create(topicBuilder.build());
// depends on control dependency: [try], data = [none]
// Create subscription admin
SubscriptionAdminSettings.Builder subscriptionBuilder = SubscriptionAdminSettings.newBuilder();
if (credentialsProvider != null) {
subscriptionBuilder.setCredentialsProvider(credentialsProvider);
// depends on control dependency: [if], data = [(credentialsProvider]
}
if (executorProvider != null) {
subscriptionBuilder.setExecutorProvider(executorProvider);
// depends on control dependency: [if], data = [(executorProvider]
} else {
subscriptionBuilder.setExecutorProvider(defaultExecutorProvider);
// depends on control dependency: [if], data = [none]
}
if (headerProvider != null) {
subscriptionBuilder.setHeaderProvider(headerProvider);
// depends on control dependency: [if], data = [(headerProvider]
}
if (transportChannelProvider != null) {
subscriptionBuilder.setTransportChannelProvider(transportChannelProvider);
// depends on control dependency: [if], data = [(transportChannelProvider]
}
if (clock != null) {
subscriptionBuilder.setClock(clock);
// depends on control dependency: [if], data = [(clock]
}
subscriptionAdmin = SubscriptionAdminClient.create(subscriptionBuilder.build());
// depends on control dependency: [try], data = [none]
connected();
// depends on control dependency: [try], data = [none]
connected.set(true);
// depends on control dependency: [try], data = [none]
} catch (Exception cause) {
reconnect(cause);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void initializing()
{
for (KernelExtension kernelExtension : kernelExtensions.keySet())
{
Collection<Plugin> plugins = kernelExtensions.get(kernelExtension);
kernelExtension.initializing(plugins);
}
} } | public class class_name {
public void initializing()
{
for (KernelExtension kernelExtension : kernelExtensions.keySet())
{
Collection<Plugin> plugins = kernelExtensions.get(kernelExtension);
kernelExtension.initializing(plugins);
// depends on control dependency: [for], data = [kernelExtension]
}
} } |
public class class_name {
private void dispose(Collection<Transformer> elements) {
if (elements != null) {
for (Transformer<?, ?> element : elements) {
if (element instanceof Disposable) {
((Disposable) element).dispose();
}
}
elements.clear();
}
} } | public class class_name {
private void dispose(Collection<Transformer> elements) {
if (elements != null) {
for (Transformer<?, ?> element : elements) {
if (element instanceof Disposable) {
((Disposable) element).dispose(); // depends on control dependency: [if], data = [none]
}
}
elements.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void initializeCitrus(ApplicationContext applicationContext) {
if (citrus != null) {
if (!citrus.getApplicationContext().equals(applicationContext)) {
log.warn("Citrus instance has already been initialized - creating new instance and shutting down current instance");
if (citrus.getApplicationContext() instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) citrus.getApplicationContext()).stop();
}
} else {
return;
}
}
citrus = Citrus.newInstance(applicationContext);
} } | public class class_name {
public static void initializeCitrus(ApplicationContext applicationContext) {
if (citrus != null) {
if (!citrus.getApplicationContext().equals(applicationContext)) {
log.warn("Citrus instance has already been initialized - creating new instance and shutting down current instance"); // depends on control dependency: [if], data = [none]
if (citrus.getApplicationContext() instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) citrus.getApplicationContext()).stop(); // depends on control dependency: [if], data = [none]
}
} else {
return; // depends on control dependency: [if], data = [none]
}
}
citrus = Citrus.newInstance(applicationContext);
} } |
public class class_name {
static Class<? extends Standalone> resolveStandaloneClass(String standaloneClassNameSystemProperty,
ForwardingServiceLoader<Standalone> standaloneServiceLoader,
String standaloneClassNameDefaultValue) {
Class<? extends Standalone> resolvedStandaloneClass = null;
// 1. System property for 'ninja.standalone.class'
if (standaloneClassNameSystemProperty != null) {
try {
resolvedStandaloneClass
= (Class<Standalone>)Class.forName(standaloneClassNameSystemProperty);
} catch (Exception e) {
throw new RuntimeException("Unable to find standalone class '" + standaloneClassNameSystemProperty + "' (class does not exist)");
}
}
// 2. Implementation on classpath that's registered as service?
if (resolvedStandaloneClass == null) {
try {
Iterator<Standalone> standaloneIterator = standaloneServiceLoader.iterator();
// first one wins
if (standaloneIterator.hasNext()) {
resolvedStandaloneClass = standaloneIterator.next().getClass();
}
// more than one triggers warning
if (standaloneIterator.hasNext()) {
log.warn("More than one implementation of {} on classpath! Using {} which was the first", Standalone.class, resolvedStandaloneClass);
}
} finally {
// always kill cache (since ServiceLoader actually instantiates an instance)
standaloneServiceLoader.reload();
}
}
// 3. Fallback to ninja default
if (resolvedStandaloneClass == null) {
try {
resolvedStandaloneClass
= (Class<Standalone>)Class.forName(standaloneClassNameDefaultValue);
} catch (Exception e) {
throw new RuntimeException("Unable to find standalone class '" + standaloneClassNameDefaultValue + "' (class does not exist)");
}
}
return resolvedStandaloneClass;
} } | public class class_name {
static Class<? extends Standalone> resolveStandaloneClass(String standaloneClassNameSystemProperty,
ForwardingServiceLoader<Standalone> standaloneServiceLoader,
String standaloneClassNameDefaultValue) {
Class<? extends Standalone> resolvedStandaloneClass = null;
// 1. System property for 'ninja.standalone.class'
if (standaloneClassNameSystemProperty != null) {
try {
resolvedStandaloneClass
= (Class<Standalone>)Class.forName(standaloneClassNameSystemProperty);
} catch (Exception e) {
throw new RuntimeException("Unable to find standalone class '" + standaloneClassNameSystemProperty + "' (class does not exist)");
}
}
// 2. Implementation on classpath that's registered as service?
if (resolvedStandaloneClass == null) {
try {
Iterator<Standalone> standaloneIterator = standaloneServiceLoader.iterator();
// first one wins
if (standaloneIterator.hasNext()) {
resolvedStandaloneClass = standaloneIterator.next().getClass(); // depends on control dependency: [if], data = [none]
}
// more than one triggers warning
if (standaloneIterator.hasNext()) {
log.warn("More than one implementation of {} on classpath! Using {} which was the first", Standalone.class, resolvedStandaloneClass); // depends on control dependency: [if], data = [none]
}
} finally {
// always kill cache (since ServiceLoader actually instantiates an instance)
standaloneServiceLoader.reload();
}
}
// 3. Fallback to ninja default
if (resolvedStandaloneClass == null) {
try {
resolvedStandaloneClass
= (Class<Standalone>)Class.forName(standaloneClassNameDefaultValue); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Unable to find standalone class '" + standaloneClassNameDefaultValue + "' (class does not exist)");
}
}
return resolvedStandaloneClass;
} } // depends on control dependency: [catch], data = [none] |
public class class_name {
public void clearDereferencedListeners() {
if (uiThreadRunner.isOnUiThread()) {
graph.clearDereferencedListeners();
} else {
uiThreadRunner.post(new Runnable() {
@Override
public void run() {
graph.clearDereferencedListeners();
}
});
}
} } | public class class_name {
public void clearDereferencedListeners() {
if (uiThreadRunner.isOnUiThread()) {
graph.clearDereferencedListeners(); // depends on control dependency: [if], data = [none]
} else {
uiThreadRunner.post(new Runnable() {
@Override
public void run() {
graph.clearDereferencedListeners();
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void install(@NonNull Context context, @NonNull String mapboxPackage, @NonNull String version) {
Context applicationContext;
if (context.getApplicationContext() == null) {
// In shared processes content providers getApplicationContext() can return null.
applicationContext = context;
} else {
applicationContext = context.getApplicationContext();
}
Thread.setDefaultUncaughtExceptionHandler(new MapboxUncaughtExceptionHanlder(applicationContext,
applicationContext.getSharedPreferences(MAPBOX_CRASH_REPORTER_PREFERENCES, Context.MODE_PRIVATE),
mapboxPackage, version, Thread.getDefaultUncaughtExceptionHandler()));
} } | public class class_name {
public static void install(@NonNull Context context, @NonNull String mapboxPackage, @NonNull String version) {
Context applicationContext;
if (context.getApplicationContext() == null) {
// In shared processes content providers getApplicationContext() can return null.
applicationContext = context; // depends on control dependency: [if], data = [none]
} else {
applicationContext = context.getApplicationContext(); // depends on control dependency: [if], data = [none]
}
Thread.setDefaultUncaughtExceptionHandler(new MapboxUncaughtExceptionHanlder(applicationContext,
applicationContext.getSharedPreferences(MAPBOX_CRASH_REPORTER_PREFERENCES, Context.MODE_PRIVATE),
mapboxPackage, version, Thread.getDefaultUncaughtExceptionHandler()));
} } |
public class class_name {
public final synchronized void stop() {
LaunchingMessageKind.IJMX0003.format();
unRegisterMBeans();
try {
if (this.jmxConnectorServer != null) {
this.jmxConnectorServer.stop();
}
} catch (IOException e1) {
// Do nothing
}
try {
UnicastRemoteObject.unexportObject(register, true);
} catch (NoSuchObjectException e) {
// Do nothing
}
} } | public class class_name {
public final synchronized void stop() {
LaunchingMessageKind.IJMX0003.format();
unRegisterMBeans();
try {
if (this.jmxConnectorServer != null) {
this.jmxConnectorServer.stop(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e1) {
// Do nothing
} // depends on control dependency: [catch], data = [none]
try {
UnicastRemoteObject.unexportObject(register, true); // depends on control dependency: [try], data = [none]
} catch (NoSuchObjectException e) {
// Do nothing
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Path update(Path applicationFile, Path updateDir, boolean removeUpdateFiles) throws IOException {
Path newApplicationJar = null;
// Extract the application name from the application file
String applicationName = applicationFile.getFileName().toString();
// Strip the extension
applicationName = applicationName.substring(0, applicationName.lastIndexOf("."));
ArrayList<Path> updateFiles = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(updateDir, applicationName + "*.{jar,JAR,war,WAR,rar,RAR,ear,EAR}")) {
for (Path entry : stream) {
updateFiles.add(entry);
}
} catch (DirectoryIteratorException ex) {
// I/O error encounted during the iteration, the cause is an IOException
throw ex.getCause();
}
if (!updateFiles.isEmpty()) {
Path updateFile = updateFiles.get(0);
newApplicationJar = Files.copy(updateFile, applicationFile, StandardCopyOption.REPLACE_EXISTING);
if (removeUpdateFiles) {
Files.delete(updateFile);
}
}
return newApplicationJar;
} } | public class class_name {
public static Path update(Path applicationFile, Path updateDir, boolean removeUpdateFiles) throws IOException {
Path newApplicationJar = null;
// Extract the application name from the application file
String applicationName = applicationFile.getFileName().toString();
// Strip the extension
applicationName = applicationName.substring(0, applicationName.lastIndexOf("."));
ArrayList<Path> updateFiles = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(updateDir, applicationName + "*.{jar,JAR,war,WAR,rar,RAR,ear,EAR}")) {
for (Path entry : stream) {
updateFiles.add(entry); // depends on control dependency: [for], data = [entry]
}
} catch (DirectoryIteratorException ex) {
// I/O error encounted during the iteration, the cause is an IOException
throw ex.getCause();
}
if (!updateFiles.isEmpty()) {
Path updateFile = updateFiles.get(0);
newApplicationJar = Files.copy(updateFile, applicationFile, StandardCopyOption.REPLACE_EXISTING);
if (removeUpdateFiles) {
Files.delete(updateFile);
}
}
return newApplicationJar;
} } |
public class class_name {
public Membership add(Address new_member) {
synchronized(members) {
if(new_member != null && !members.contains(new_member)) {
members.add(new_member);
}
}
return this;
} } | public class class_name {
public Membership add(Address new_member) {
synchronized(members) {
if(new_member != null && !members.contains(new_member)) {
members.add(new_member); // depends on control dependency: [if], data = [(new_member]
}
}
return this;
} } |
public class class_name {
protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
// if so, notify them
list.apply(new ObserverList.ObserverOp<StaleCacheObserver>() {
public boolean apply (StaleCacheObserver observer) {
observer.changedCacheData(data);
return true;
}
});
} } | public class class_name {
protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return; // depends on control dependency: [if], data = [none]
}
// if so, notify them
list.apply(new ObserverList.ObserverOp<StaleCacheObserver>() {
public boolean apply (StaleCacheObserver observer) {
observer.changedCacheData(data);
return true;
}
});
} } |
public class class_name {
@Override
public void removeByC_S(long CProductId, int status) {
for (CPDefinition cpDefinition : findByC_S(CProductId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} } | public class class_name {
@Override
public void removeByC_S(long CProductId, int status) {
for (CPDefinition cpDefinition : findByC_S(CProductId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition); // depends on control dependency: [for], data = [cpDefinition]
}
} } |
public class class_name {
void splitBranches(final Element elem, final Branch filter) {
final List<Element> ditavalRefs = getChildElements(elem, DITAVAREF_D_DITAVALREF);
if (ditavalRefs.size() > 0) {
// remove ditavalrefs
for (final Element branch: ditavalRefs) {
elem.removeChild(branch);
}
// create additional branches after current element
final List<Element> branches = new ArrayList<>(ditavalRefs.size());
branches.add(elem);
final Node next = elem.getNextSibling();
for (int i = 1; i < ditavalRefs.size(); i++) {
final Element clone = (Element) elem.cloneNode(true);
if (next != null) {
elem.getParentNode().insertBefore(clone, next);
} else {
elem.getParentNode().appendChild(clone);
}
branches.add(clone);
}
// insert ditavalrefs
for (int i = 0; i < branches.size(); i++) {
final Element branch = branches.get(i);
final Element ditavalref = ditavalRefs.get(i);
branch.insertBefore(ditavalref, branch.getFirstChild());
final Branch currentFilter = filter.merge(ditavalref);
processAttributes(branch, currentFilter);
final Branch childFilter = new Branch(currentFilter.resourcePrefix, currentFilter.resourceSuffix, Optional.empty(), Optional.empty());
// process children of all branches
for (final Element child: getChildElements(branch, MAP_TOPICREF)) {
if (DITAVAREF_D_DITAVALREF.matches(child)) {
continue;
}
splitBranches(child, childFilter);
}
}
} else {
processAttributes(elem, filter);
for (final Element child: getChildElements(elem, MAP_TOPICREF)) {
splitBranches(child, filter);
}
}
} } | public class class_name {
void splitBranches(final Element elem, final Branch filter) {
final List<Element> ditavalRefs = getChildElements(elem, DITAVAREF_D_DITAVALREF);
if (ditavalRefs.size() > 0) {
// remove ditavalrefs
for (final Element branch: ditavalRefs) {
elem.removeChild(branch); // depends on control dependency: [for], data = [branch]
}
// create additional branches after current element
final List<Element> branches = new ArrayList<>(ditavalRefs.size());
branches.add(elem); // depends on control dependency: [if], data = [none]
final Node next = elem.getNextSibling();
for (int i = 1; i < ditavalRefs.size(); i++) {
final Element clone = (Element) elem.cloneNode(true);
if (next != null) {
elem.getParentNode().insertBefore(clone, next); // depends on control dependency: [if], data = [none]
} else {
elem.getParentNode().appendChild(clone); // depends on control dependency: [if], data = [none]
}
branches.add(clone); // depends on control dependency: [for], data = [none]
}
// insert ditavalrefs
for (int i = 0; i < branches.size(); i++) {
final Element branch = branches.get(i);
final Element ditavalref = ditavalRefs.get(i);
branch.insertBefore(ditavalref, branch.getFirstChild()); // depends on control dependency: [for], data = [none]
final Branch currentFilter = filter.merge(ditavalref);
processAttributes(branch, currentFilter); // depends on control dependency: [for], data = [none]
final Branch childFilter = new Branch(currentFilter.resourcePrefix, currentFilter.resourceSuffix, Optional.empty(), Optional.empty());
// process children of all branches
for (final Element child: getChildElements(branch, MAP_TOPICREF)) {
if (DITAVAREF_D_DITAVALREF.matches(child)) {
continue;
}
splitBranches(child, childFilter); // depends on control dependency: [for], data = [child]
}
}
} else {
processAttributes(elem, filter); // depends on control dependency: [if], data = [none]
for (final Element child: getChildElements(elem, MAP_TOPICREF)) {
splitBranches(child, filter); // depends on control dependency: [for], data = [child]
}
}
} } |
public class class_name {
public static void setState(ParseState state) {
if (state == null) {
System.err.println("Null state found");
Environment.logInfo("Null state found");
}
persData.setProperty(state.filename, state.firstLine + SEPARATOR + state.offset);
} } | public class class_name {
public static void setState(ParseState state) {
if (state == null) {
System.err.println("Null state found"); // depends on control dependency: [if], data = [none]
Environment.logInfo("Null state found"); // depends on control dependency: [if], data = [none]
}
persData.setProperty(state.filename, state.firstLine + SEPARATOR + state.offset);
} } |
public class class_name {
@Override
public void actionCommit() {
List errors = new ArrayList();
try {
// if new create it first
if (m_project.getUuid() == null) {
CmsProject newProject = getCms().createProject(
m_project.getName(),
m_project.getDescription(),
getUserGroup(),
getManagerGroup(),
m_project.getType());
m_project = newProject;
} else {
getCms().writeProject(m_project);
}
// write the edited project resources
CmsProject currentProject = getCms().getRequestContext().getCurrentProject();
// change the current project
getCms().getRequestContext().setCurrentProject(m_project);
// store the current site root
String currentSite = getCms().getRequestContext().getSiteRoot();
// copy the resources to the current project
try {
// switch to the root site
getCms().getRequestContext().setSiteRoot("");
// remove deleted resources
Iterator itDel = getCms().readProjectResources(m_project).iterator();
while (itDel.hasNext()) {
String resName = itDel.next().toString();
if (!getResources().contains(resName)) {
getCms().removeResourceFromProject(resName);
}
}
// read project resources again!
List currentResNames = getCms().readProjectResources(m_project);
// copy missing resources
Iterator itAdd = getResources().iterator();
while (itAdd.hasNext()) {
String resName = itAdd.next().toString();
if (!currentResNames.contains(resName)) {
getCms().copyResourceToProject(resName);
}
}
} finally {
// switch back to current site and project
getCms().getRequestContext().setSiteRoot(currentSite);
getCms().getRequestContext().setCurrentProject(currentProject);
}
// refresh the list
Map objects = (Map)getSettings().getListObject();
if (objects != null) {
objects.remove(CmsProjectsList.class.getName());
}
} catch (Throwable t) {
errors.add(t);
}
// set the list of errors to display when saving failed
setCommitErrors(errors);
} } | public class class_name {
@Override
public void actionCommit() {
List errors = new ArrayList();
try {
// if new create it first
if (m_project.getUuid() == null) {
CmsProject newProject = getCms().createProject(
m_project.getName(),
m_project.getDescription(),
getUserGroup(),
getManagerGroup(),
m_project.getType());
m_project = newProject; // depends on control dependency: [if], data = [none]
} else {
getCms().writeProject(m_project); // depends on control dependency: [if], data = [none]
}
// write the edited project resources
CmsProject currentProject = getCms().getRequestContext().getCurrentProject();
// change the current project
getCms().getRequestContext().setCurrentProject(m_project); // depends on control dependency: [try], data = [none]
// store the current site root
String currentSite = getCms().getRequestContext().getSiteRoot();
// copy the resources to the current project
try {
// switch to the root site
getCms().getRequestContext().setSiteRoot(""); // depends on control dependency: [try], data = [none]
// remove deleted resources
Iterator itDel = getCms().readProjectResources(m_project).iterator();
while (itDel.hasNext()) {
String resName = itDel.next().toString();
if (!getResources().contains(resName)) {
getCms().removeResourceFromProject(resName); // depends on control dependency: [if], data = [none]
}
}
// read project resources again!
List currentResNames = getCms().readProjectResources(m_project);
// copy missing resources
Iterator itAdd = getResources().iterator();
while (itAdd.hasNext()) {
String resName = itAdd.next().toString();
if (!currentResNames.contains(resName)) {
getCms().copyResourceToProject(resName); // depends on control dependency: [if], data = [none]
}
}
} finally {
// switch back to current site and project
getCms().getRequestContext().setSiteRoot(currentSite);
getCms().getRequestContext().setCurrentProject(currentProject);
}
// refresh the list
Map objects = (Map)getSettings().getListObject();
if (objects != null) {
objects.remove(CmsProjectsList.class.getName()); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
errors.add(t);
} // depends on control dependency: [catch], data = [none]
// set the list of errors to display when saving failed
setCommitErrors(errors);
} } |
public class class_name {
public <T> T convert(String value, Class<T> type) {
// fast-path
if (value == null) {
return null;
}
if (type == String.class) {
return (T) value;
}
// normal-path
Convertor<T> c = (Convertor<T>) pool.get(type);
if (c != null) {
return c.convert(value);
}
if (type.isArray()) {
return (T) convertToArray(value, type.getComponentType());
}
throw new IllegalStateException("Unsupported cast class: " + type.getName());
} } | public class class_name {
public <T> T convert(String value, Class<T> type) {
// fast-path
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (type == String.class) {
return (T) value; // depends on control dependency: [if], data = [none]
}
// normal-path
Convertor<T> c = (Convertor<T>) pool.get(type);
if (c != null) {
return c.convert(value); // depends on control dependency: [if], data = [none]
}
if (type.isArray()) {
return (T) convertToArray(value, type.getComponentType()); // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException("Unsupported cast class: " + type.getName());
} } |
public class class_name {
private void indexQuery(
long index,
long timestamp,
RaftSession session,
PrimitiveOperation operation,
CompletableFuture<OperationResult> future) {
// If the query index is greater than the session's last applied index, queue the request for handling once the
// state machine is caught up.
if (index > currentIndex) {
log.trace("Registering query with index " + index + " > " + currentIndex);
session.registerIndexQuery(index, () -> applyQuery(timestamp, session, operation, future));
} else {
applyQuery(timestamp, session, operation, future);
}
} } | public class class_name {
private void indexQuery(
long index,
long timestamp,
RaftSession session,
PrimitiveOperation operation,
CompletableFuture<OperationResult> future) {
// If the query index is greater than the session's last applied index, queue the request for handling once the
// state machine is caught up.
if (index > currentIndex) {
log.trace("Registering query with index " + index + " > " + currentIndex); // depends on control dependency: [if], data = [currentIndex)]
session.registerIndexQuery(index, () -> applyQuery(timestamp, session, operation, future)); // depends on control dependency: [if], data = [(index]
} else {
applyQuery(timestamp, session, operation, future); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DayPartitionBuilder addDailyRule(ClockInterval partition) {
for (Weekday dayOfWeek : Weekday.values()) {
this.addWeekdayRule(dayOfWeek, partition);
}
return this;
} } | public class class_name {
public DayPartitionBuilder addDailyRule(ClockInterval partition) {
for (Weekday dayOfWeek : Weekday.values()) {
this.addWeekdayRule(dayOfWeek, partition); // depends on control dependency: [for], data = [dayOfWeek]
}
return this;
} } |
public class class_name {
public GenericDraweeHierarchyBuilder setPressedStateOverlay(@Nullable Drawable drawable) {
if (drawable == null) {
mPressedStateOverlay = null;
} else {
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, drawable);
mPressedStateOverlay = stateListDrawable;
}
return this;
} } | public class class_name {
public GenericDraweeHierarchyBuilder setPressedStateOverlay(@Nullable Drawable drawable) {
if (drawable == null) {
mPressedStateOverlay = null; // depends on control dependency: [if], data = [none]
} else {
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, drawable); // depends on control dependency: [if], data = [none]
mPressedStateOverlay = stateListDrawable; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public void setHierarchy(@Nullable DraweeHierarchy hierarchy) {
if (FLog.isLoggable(FLog.VERBOSE)) {
FLog.v(
TAG,
"controller %x %s: setHierarchy: %s",
System.identityHashCode(this),
mId,
hierarchy);
}
mEventTracker.recordEvent(
(hierarchy != null) ? Event.ON_SET_HIERARCHY : Event.ON_CLEAR_HIERARCHY);
// force release in case request was submitted
if (mIsRequestSubmitted) {
mDeferredReleaser.cancelDeferredRelease(this);
release();
}
// clear the existing hierarchy
if (mSettableDraweeHierarchy != null) {
mSettableDraweeHierarchy.setControllerOverlay(null);
mSettableDraweeHierarchy = null;
}
// set the new hierarchy
if (hierarchy != null) {
Preconditions.checkArgument(hierarchy instanceof SettableDraweeHierarchy);
mSettableDraweeHierarchy = (SettableDraweeHierarchy) hierarchy;
mSettableDraweeHierarchy.setControllerOverlay(mControllerOverlay);
}
} } | public class class_name {
@Override
public void setHierarchy(@Nullable DraweeHierarchy hierarchy) {
if (FLog.isLoggable(FLog.VERBOSE)) {
FLog.v(
TAG,
"controller %x %s: setHierarchy: %s",
System.identityHashCode(this),
mId,
hierarchy); // depends on control dependency: [if], data = [none]
}
mEventTracker.recordEvent(
(hierarchy != null) ? Event.ON_SET_HIERARCHY : Event.ON_CLEAR_HIERARCHY);
// force release in case request was submitted
if (mIsRequestSubmitted) {
mDeferredReleaser.cancelDeferredRelease(this); // depends on control dependency: [if], data = [none]
release(); // depends on control dependency: [if], data = [none]
}
// clear the existing hierarchy
if (mSettableDraweeHierarchy != null) {
mSettableDraweeHierarchy.setControllerOverlay(null); // depends on control dependency: [if], data = [null)]
mSettableDraweeHierarchy = null; // depends on control dependency: [if], data = [none]
}
// set the new hierarchy
if (hierarchy != null) {
Preconditions.checkArgument(hierarchy instanceof SettableDraweeHierarchy); // depends on control dependency: [if], data = [(hierarchy]
mSettableDraweeHierarchy = (SettableDraweeHierarchy) hierarchy; // depends on control dependency: [if], data = [none]
mSettableDraweeHierarchy.setControllerOverlay(mControllerOverlay); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static TransportAddress[] fromHostAndPorts(final List<HostAndPort> hostAndPorts) {
if (hostAndPorts == null) {
return new TransportAddress[0];
} else {
TransportAddress[] transportAddresses = new TransportAddress[hostAndPorts.size()];
for (int i = 0; i < hostAndPorts.size(); i++) {
transportAddresses[i] = fromHostAndPort(hostAndPorts.get(i));
}
return transportAddresses;
}
} } | public class class_name {
public static TransportAddress[] fromHostAndPorts(final List<HostAndPort> hostAndPorts) {
if (hostAndPorts == null) {
return new TransportAddress[0]; // depends on control dependency: [if], data = [none]
} else {
TransportAddress[] transportAddresses = new TransportAddress[hostAndPorts.size()];
for (int i = 0; i < hostAndPorts.size(); i++) {
transportAddresses[i] = fromHostAndPort(hostAndPorts.get(i)); // depends on control dependency: [for], data = [i]
}
return transportAddresses; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Map<X500Principal, SigningPolicy> parse(Reader reader)
throws SigningPolicyException {
Map<X500Principal, SigningPolicy> policies = new HashMap<X500Principal, SigningPolicy>();
BufferedReader bufferedReader = new BufferedReader(reader);
try {
String line;
while ((line = bufferedReader.readLine()) != null) {
line = line.trim();
// read line until some line that needs to be parsed.
if (!isValidLine(line)) {
continue;
}
logger.debug("Line to parse: " + line);
String caDN = null;
if (line.startsWith(ACCESS_ID_PREFIX)) {
logger.debug("Check if it is CA and get the DN " + line);
caDN = getCaDN(line, caDN);
boolean usefulEntry = true;
Boolean posNegRights = null;
// check for neg or pos rights with restrictions
checkRights(policies, bufferedReader, caDN, usefulEntry, posNegRights);
}
// JGLOBUS-94
}
} catch (IOException exp) {
throw new SigningPolicyException("", exp);
} finally {
cleanupReaders(reader, bufferedReader);
}
return policies;
} } | public class class_name {
public Map<X500Principal, SigningPolicy> parse(Reader reader)
throws SigningPolicyException {
Map<X500Principal, SigningPolicy> policies = new HashMap<X500Principal, SigningPolicy>();
BufferedReader bufferedReader = new BufferedReader(reader);
try {
String line;
while ((line = bufferedReader.readLine()) != null) {
line = line.trim(); // depends on control dependency: [while], data = [none]
// read line until some line that needs to be parsed.
if (!isValidLine(line)) {
continue;
}
logger.debug("Line to parse: " + line); // depends on control dependency: [while], data = [none]
String caDN = null;
if (line.startsWith(ACCESS_ID_PREFIX)) {
logger.debug("Check if it is CA and get the DN " + line); // depends on control dependency: [if], data = [none]
caDN = getCaDN(line, caDN); // depends on control dependency: [if], data = [none]
boolean usefulEntry = true;
Boolean posNegRights = null;
// check for neg or pos rights with restrictions
checkRights(policies, bufferedReader, caDN, usefulEntry, posNegRights); // depends on control dependency: [if], data = [none]
}
// JGLOBUS-94
}
} catch (IOException exp) {
throw new SigningPolicyException("", exp);
} finally {
cleanupReaders(reader, bufferedReader);
}
return policies;
} } |
public class class_name {
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
int context = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(context);
int docContext = dtm.getDocument();
if (DTM.NULL == docContext)
error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
XObject arg = m_arg0.execute(xctxt);
int argType = arg.getType();
XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
NodeSetDTM nodeSet = nodes.mutableNodeset();
if (XObject.CLASS_NODESET == argType)
{
DTMIterator ni = arg.iter();
StringVector usedrefs = null;
int pos = ni.nextNode();
while (DTM.NULL != pos)
{
DTM ndtm = ni.getDTM(pos);
String refval = ndtm.getStringValue(pos).toString();
pos = ni.nextNode();
usedrefs = getNodesByID(xctxt, docContext, refval, usedrefs, nodeSet,
DTM.NULL != pos);
}
// ni.detach();
}
else if (XObject.CLASS_NULL == argType)
{
return nodes;
}
else
{
String refval = arg.str();
getNodesByID(xctxt, docContext, refval, null, nodeSet, false);
}
return nodes;
} } | public class class_name {
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
int context = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(context);
int docContext = dtm.getDocument();
if (DTM.NULL == docContext)
error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
XObject arg = m_arg0.execute(xctxt);
int argType = arg.getType();
XNodeSet nodes = new XNodeSet(xctxt.getDTMManager());
NodeSetDTM nodeSet = nodes.mutableNodeset();
if (XObject.CLASS_NODESET == argType)
{
DTMIterator ni = arg.iter();
StringVector usedrefs = null;
int pos = ni.nextNode();
while (DTM.NULL != pos)
{
DTM ndtm = ni.getDTM(pos);
String refval = ndtm.getStringValue(pos).toString();
pos = ni.nextNode(); // depends on control dependency: [while], data = [none]
usedrefs = getNodesByID(xctxt, docContext, refval, usedrefs, nodeSet,
DTM.NULL != pos); // depends on control dependency: [while], data = [none]
}
// ni.detach();
}
else if (XObject.CLASS_NULL == argType)
{
return nodes;
}
else
{
String refval = arg.str();
getNodesByID(xctxt, docContext, refval, null, nodeSet, false);
}
return nodes;
} } |
public class class_name {
@Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
localMethodCalls.clear();
fieldMethodCalls.clear();
staticMethodCalls.clear();
branchTargets.clear();
CodeException[] codeExceptions = obj.getExceptionTable();
for (CodeException codeEx : codeExceptions) {
// adding the end pc seems silly, but it is need because javac may repeat
// part of the finally block in the try block, at times.
branchTargets.set(codeEx.getEndPC());
branchTargets.set(codeEx.getHandlerPC());
}
super.visitCode(obj);
} } | public class class_name {
@Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
localMethodCalls.clear();
fieldMethodCalls.clear();
staticMethodCalls.clear();
branchTargets.clear();
CodeException[] codeExceptions = obj.getExceptionTable();
for (CodeException codeEx : codeExceptions) {
// adding the end pc seems silly, but it is need because javac may repeat
// part of the finally block in the try block, at times.
branchTargets.set(codeEx.getEndPC()); // depends on control dependency: [for], data = [codeEx]
branchTargets.set(codeEx.getHandlerPC()); // depends on control dependency: [for], data = [codeEx]
}
super.visitCode(obj);
} } |
public class class_name {
MapWithProtoValuesFluentAssertion<M> usingConfig(FluentEqualityConfig newConfig) {
Subject.Factory<MapWithMessageValuesSubject<K, M>, Map<K, M>> factory =
mapWithProtoValues(newConfig);
MapWithMessageValuesSubject<K, M> newSubject = check().about(factory).that(actual());
if (internalCustomName() != null) {
newSubject = newSubject.named(internalCustomName());
}
return new MapWithProtoValuesFluentAssertionImpl<>(newSubject);
} } | public class class_name {
MapWithProtoValuesFluentAssertion<M> usingConfig(FluentEqualityConfig newConfig) {
Subject.Factory<MapWithMessageValuesSubject<K, M>, Map<K, M>> factory =
mapWithProtoValues(newConfig);
MapWithMessageValuesSubject<K, M> newSubject = check().about(factory).that(actual());
if (internalCustomName() != null) {
newSubject = newSubject.named(internalCustomName()); // depends on control dependency: [if], data = [(internalCustomName()]
}
return new MapWithProtoValuesFluentAssertionImpl<>(newSubject);
} } |
public class class_name {
private void primUpdate(IEntityLock lock, Date newExpiration, Integer newType, Connection conn)
throws SQLException, LockingException {
Integer typeID =
EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType());
String key = lock.getEntityKey();
int oldLockType = lock.getLockType();
int newLockType = (newType == null) ? oldLockType : newType.intValue();
java.sql.Timestamp oldTs = new java.sql.Timestamp(lock.getExpirationTime().getTime());
java.sql.Timestamp newTs = new java.sql.Timestamp(newExpiration.getTime());
String owner = lock.getLockOwner();
try {
PreparedStatement ps = conn.prepareStatement(getUpdateSql());
try {
ps.setTimestamp(1, newTs); // new expiration
ps.setInt(2, newLockType); // new lock type
ps.setInt(3, typeID.intValue()); // entity type
ps.setString(4, key); // entity key
ps.setString(5, owner); // lock owner
ps.setTimestamp(6, oldTs); // old expiration
ps.setInt(7, oldLockType); // old lock type;
if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primUpdate(): " + ps);
int rc = ps.executeUpdate();
if (rc != 1) {
String errString = "Problem updating " + lock;
log.error(errString);
throw new LockingException(errString);
}
} finally {
if (ps != null) ps.close();
}
} catch (java.sql.SQLException sqle) {
log.error(sqle, sqle);
throw sqle;
}
} } | public class class_name {
private void primUpdate(IEntityLock lock, Date newExpiration, Integer newType, Connection conn)
throws SQLException, LockingException {
Integer typeID =
EntityTypesLocator.getEntityTypes().getEntityIDFromType(lock.getEntityType());
String key = lock.getEntityKey();
int oldLockType = lock.getLockType();
int newLockType = (newType == null) ? oldLockType : newType.intValue();
java.sql.Timestamp oldTs = new java.sql.Timestamp(lock.getExpirationTime().getTime());
java.sql.Timestamp newTs = new java.sql.Timestamp(newExpiration.getTime());
String owner = lock.getLockOwner();
try {
PreparedStatement ps = conn.prepareStatement(getUpdateSql());
try {
ps.setTimestamp(1, newTs); // new expiration // depends on control dependency: [try], data = [none]
ps.setInt(2, newLockType); // new lock type // depends on control dependency: [try], data = [none]
ps.setInt(3, typeID.intValue()); // entity type // depends on control dependency: [try], data = [none]
ps.setString(4, key); // entity key // depends on control dependency: [try], data = [none]
ps.setString(5, owner); // lock owner // depends on control dependency: [try], data = [none]
ps.setTimestamp(6, oldTs); // old expiration // depends on control dependency: [try], data = [none]
ps.setInt(7, oldLockType); // old lock type; // depends on control dependency: [try], data = [none]
if (log.isDebugEnabled()) log.debug("RDBMEntityLockStore.primUpdate(): " + ps);
int rc = ps.executeUpdate();
if (rc != 1) {
String errString = "Problem updating " + lock;
log.error(errString); // depends on control dependency: [if], data = [none]
throw new LockingException(errString);
}
} finally {
if (ps != null) ps.close();
}
} catch (java.sql.SQLException sqle) {
log.error(sqle, sqle);
throw sqle;
}
} } |
public class class_name {
protected boolean intersectsZ (IRay3 ray, double z) {
IVector3 origin = ray.origin(), dir = ray.direction();
double t = (z - origin.z()) / dir.z();
if (t < 0f) {
return false;
}
double ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y();
return ix >= _minExtent.x && ix <= _maxExtent.x &&
iy >= _minExtent.y && iy <= _maxExtent.y;
} } | public class class_name {
protected boolean intersectsZ (IRay3 ray, double z) {
IVector3 origin = ray.origin(), dir = ray.direction();
double t = (z - origin.z()) / dir.z();
if (t < 0f) {
return false; // depends on control dependency: [if], data = [none]
}
double ix = origin.x() + t*dir.x(), iy = origin.y() + t*dir.y();
return ix >= _minExtent.x && ix <= _maxExtent.x &&
iy >= _minExtent.y && iy <= _maxExtent.y;
} } |
public class class_name {
public static ClassName defineCollection(TypeName listClazzName) {
try {
Class<?> clazz=null;
if (listClazzName instanceof ParameterizedTypeName) {
ParameterizedTypeName returnListName = (ParameterizedTypeName) listClazzName;
clazz = Class.forName(returnListName.rawType.toString());
} else {
clazz = Class.forName(listClazzName.toString());
}
if (clazz.isAssignableFrom(List.class)) {
clazz = ArrayList.class;
} else if (clazz.isAssignableFrom(Set.class)) {
clazz = LinkedHashSet.class;
} else if (clazz.isAssignableFrom(Collection.class)) {
clazz = ArrayList.class;
}
return ClassName.get(clazz);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public static ClassName defineCollection(TypeName listClazzName) {
try {
Class<?> clazz=null; // depends on control dependency: [try], data = [none]
if (listClazzName instanceof ParameterizedTypeName) {
ParameterizedTypeName returnListName = (ParameterizedTypeName) listClazzName;
clazz = Class.forName(returnListName.rawType.toString()); // depends on control dependency: [if], data = [none]
} else {
clazz = Class.forName(listClazzName.toString()); // depends on control dependency: [if], data = [none]
}
if (clazz.isAssignableFrom(List.class)) {
clazz = ArrayList.class; // depends on control dependency: [if], data = [none]
} else if (clazz.isAssignableFrom(Set.class)) {
clazz = LinkedHashSet.class; // depends on control dependency: [if], data = [none]
} else if (clazz.isAssignableFrom(Collection.class)) {
clazz = ArrayList.class; // depends on control dependency: [if], data = [none]
}
return ClassName.get(clazz); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
static byte[] flattenTags(final boolean use_query_tags,
final boolean include_agg_tags, final ByteMap<byte[]> tags,
final ByteSet agg_tags, final ITimeSyncedIterator sub) {
if (tags.isEmpty()) {
return HBaseClient.EMPTY_ARRAY;
}
final ByteSet query_tagks;
// NOTE: We MAY need the agg tags but I'm not sure yet
final int tag_size;
if (use_query_tags) {
int i = 0;
if (sub.getQueryTagKs() != null && !sub.getQueryTagKs().isEmpty()) {
query_tagks = sub.getQueryTagKs();
for (final Map.Entry<byte[], byte[]> pair : tags.entrySet()) {
if (query_tagks.contains(pair.getKey())) {
i++;
}
}
} else {
query_tagks = new ByteSet();
}
tag_size = i;
} else {
query_tagks = new ByteSet();
tag_size = tags.size();
}
int len = (tag_size * (TSDB.tagk_width() + TSDB.tagv_width())) +
(include_agg_tags ? (agg_tags.size() * TSDB.tagk_width()) : 0);
final byte[] tagks = new byte[len];
int i = 0;
for (final Map.Entry<byte[], byte[]> pair : tags.entrySet()) {
if (use_query_tags && !query_tagks.contains(pair.getKey())) {
continue;
}
System.arraycopy(pair.getKey(), 0, tagks, i, TSDB.tagk_width());
i += TSDB.tagk_width();
System.arraycopy(pair.getValue(), 0, tagks, i, TSDB.tagv_width());
i += TSDB.tagv_width();
}
if (include_agg_tags) {
for (final byte[] tagk : agg_tags) {
System.arraycopy(tagk, 0, tagks, i, TSDB.tagk_width());
i += TSDB.tagk_width();
}
}
return tagks;
} } | public class class_name {
static byte[] flattenTags(final boolean use_query_tags,
final boolean include_agg_tags, final ByteMap<byte[]> tags,
final ByteSet agg_tags, final ITimeSyncedIterator sub) {
if (tags.isEmpty()) {
return HBaseClient.EMPTY_ARRAY; // depends on control dependency: [if], data = [none]
}
final ByteSet query_tagks;
// NOTE: We MAY need the agg tags but I'm not sure yet
final int tag_size;
if (use_query_tags) {
int i = 0;
if (sub.getQueryTagKs() != null && !sub.getQueryTagKs().isEmpty()) {
query_tagks = sub.getQueryTagKs(); // depends on control dependency: [if], data = [none]
for (final Map.Entry<byte[], byte[]> pair : tags.entrySet()) {
if (query_tagks.contains(pair.getKey())) {
i++; // depends on control dependency: [if], data = [none]
}
}
} else {
query_tagks = new ByteSet(); // depends on control dependency: [if], data = [none]
}
tag_size = i; // depends on control dependency: [if], data = [none]
} else {
query_tagks = new ByteSet(); // depends on control dependency: [if], data = [none]
tag_size = tags.size(); // depends on control dependency: [if], data = [none]
}
int len = (tag_size * (TSDB.tagk_width() + TSDB.tagv_width())) +
(include_agg_tags ? (agg_tags.size() * TSDB.tagk_width()) : 0);
final byte[] tagks = new byte[len];
int i = 0;
for (final Map.Entry<byte[], byte[]> pair : tags.entrySet()) {
if (use_query_tags && !query_tagks.contains(pair.getKey())) {
continue;
}
System.arraycopy(pair.getKey(), 0, tagks, i, TSDB.tagk_width()); // depends on control dependency: [for], data = [pair]
i += TSDB.tagk_width(); // depends on control dependency: [for], data = [none]
System.arraycopy(pair.getValue(), 0, tagks, i, TSDB.tagv_width()); // depends on control dependency: [for], data = [pair]
i += TSDB.tagv_width(); // depends on control dependency: [for], data = [none]
}
if (include_agg_tags) {
for (final byte[] tagk : agg_tags) {
System.arraycopy(tagk, 0, tagks, i, TSDB.tagk_width()); // depends on control dependency: [for], data = [tagk]
i += TSDB.tagk_width(); // depends on control dependency: [for], data = [tagk]
}
}
return tagks;
} } |
public class class_name {
public void start() {
try {
final Terminal terminal = TerminalConsoleAppender.getTerminal();
if (terminal != null) {
readCommands(terminal);
} else {
readCommands(System.in);
}
} catch (IOException e) {
LogManager.getLogger("TerminalConsole").error("Failed to read console input", e);
}
} } | public class class_name {
public void start() {
try {
final Terminal terminal = TerminalConsoleAppender.getTerminal();
if (terminal != null) {
readCommands(terminal); // depends on control dependency: [if], data = [(terminal]
} else {
readCommands(System.in); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LogManager.getLogger("TerminalConsole").error("Failed to read console input", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<TimeUnit> getUnits()
{
if (cachedUnits == null) {
List<TimeUnit> result = new ArrayList<TimeUnit>(units.keySet());
Collections.sort(result, new TimeUnitComparator());
cachedUnits = Collections.unmodifiableList(result);
}
return cachedUnits;
} } | public class class_name {
public List<TimeUnit> getUnits()
{
if (cachedUnits == null) {
List<TimeUnit> result = new ArrayList<TimeUnit>(units.keySet());
Collections.sort(result, new TimeUnitComparator()); // depends on control dependency: [if], data = [none]
cachedUnits = Collections.unmodifiableList(result); // depends on control dependency: [if], data = [none]
}
return cachedUnits;
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.