code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public final Object convert(final Map<String, Object> pAddParam,
final IRecordSet<RS> pFrom, final String pName) throws Exception {
Class fieldClass = (Class) pAddParam.get("fieldClass");
Class entityClass = (Class) pAddParam.get("entityClass");
@SuppressWarnings("unchecked")
List<String> foreignFieldNms = (List<String>)
pAddParam.get("foreignFieldNms");
@SuppressWarnings("unchecked")
List<Integer> currentLevel = (List<Integer>) pAddParam.get("currentLevel");
@SuppressWarnings("unchecked")
List<Integer> deepLevel = (List<Integer>) pAddParam.get("deepLevel");
currentLevel.set(0, currentLevel.get(0) + 1);
Object entity = convertOnlyId(pAddParam, pFrom, pName, fieldClass,
entityClass, currentLevel, deepLevel, foreignFieldNms);
// it's may be enter into recursion:
if (entity != null && deepLevel.get(deepLevel.size() - 1) != 1
&& currentLevel.get(currentLevel.size() - 1)
<= deepLevel.get(deepLevel.size() - 1)) {
if (currentLevel.size() > 1) {
currentLevel.set(currentLevel.size() - 1,
currentLevel.get(currentLevel.size() - 1) + 1);
}
fillerObjectsFromRs.fill(pAddParam, entity, pFrom);
// exit form recursion:
if (currentLevel.size() > 1) {
//exit from overridden sub-entity deep:
currentLevel.set(currentLevel.size() - 1,
currentLevel.get(currentLevel.size() - 1) - 1);
}
}
if (currentLevel.size() > 1
&& currentLevel.get(currentLevel.size() - 1) == 1) {
currentLevel.remove(currentLevel.size() - 1);
deepLevel.remove(deepLevel.size() - 1);
}
foreignFieldNms.remove(foreignFieldNms.size() - 1); //remove current
currentLevel.set(0, currentLevel.get(0) - 1);
return entity;
} } | public class class_name {
@Override
public final Object convert(final Map<String, Object> pAddParam,
final IRecordSet<RS> pFrom, final String pName) throws Exception {
Class fieldClass = (Class) pAddParam.get("fieldClass");
Class entityClass = (Class) pAddParam.get("entityClass");
@SuppressWarnings("unchecked")
List<String> foreignFieldNms = (List<String>)
pAddParam.get("foreignFieldNms");
@SuppressWarnings("unchecked")
List<Integer> currentLevel = (List<Integer>) pAddParam.get("currentLevel");
@SuppressWarnings("unchecked")
List<Integer> deepLevel = (List<Integer>) pAddParam.get("deepLevel");
currentLevel.set(0, currentLevel.get(0) + 1);
Object entity = convertOnlyId(pAddParam, pFrom, pName, fieldClass,
entityClass, currentLevel, deepLevel, foreignFieldNms);
// it's may be enter into recursion:
if (entity != null && deepLevel.get(deepLevel.size() - 1) != 1
&& currentLevel.get(currentLevel.size() - 1)
<= deepLevel.get(deepLevel.size() - 1)) {
if (currentLevel.size() > 1) {
currentLevel.set(currentLevel.size() - 1,
currentLevel.get(currentLevel.size() - 1) + 1); // depends on control dependency: [if], data = [(currentLevel.size()]
}
fillerObjectsFromRs.fill(pAddParam, entity, pFrom);
// exit form recursion:
if (currentLevel.size() > 1) {
//exit from overridden sub-entity deep:
currentLevel.set(currentLevel.size() - 1,
currentLevel.get(currentLevel.size() - 1) - 1); // depends on control dependency: [if], data = [(currentLevel.size()]
}
}
if (currentLevel.size() > 1
&& currentLevel.get(currentLevel.size() - 1) == 1) {
currentLevel.remove(currentLevel.size() - 1);
deepLevel.remove(deepLevel.size() - 1);
}
foreignFieldNms.remove(foreignFieldNms.size() - 1); //remove current
currentLevel.set(0, currentLevel.get(0) - 1);
return entity;
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
ImmutabilityType seenImmutable = null;
try {
stack.precomputation(this);
switch (seen) {
case Const.INVOKESTATIC: {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
if (IMMUTABLE_PRODUCING_METHODS.contains(className + '.' + methodName)) {
seenImmutable = ImmutabilityType.IMMUTABLE;
break;
}
}
//$FALL-THROUGH$
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.INVOKEVIRTUAL: {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
String signature = getSigConstantOperand();
MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature);
seenImmutable = mi.getImmutabilityType();
if (seenImmutable == ImmutabilityType.UNKNOWN) {
seenImmutable = null;
}
}
break;
case Const.ARETURN: {
processARreturn();
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((seenImmutable != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(seenImmutable);
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
ImmutabilityType seenImmutable = null;
try {
stack.precomputation(this); // depends on control dependency: [try], data = [none]
switch (seen) {
case Const.INVOKESTATIC: {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
if (IMMUTABLE_PRODUCING_METHODS.contains(className + '.' + methodName)) {
seenImmutable = ImmutabilityType.IMMUTABLE; // depends on control dependency: [if], data = [none]
break;
}
}
//$FALL-THROUGH$
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.INVOKEVIRTUAL: {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
String signature = getSigConstantOperand();
MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature);
seenImmutable = mi.getImmutabilityType();
if (seenImmutable == ImmutabilityType.UNKNOWN) {
seenImmutable = null; // depends on control dependency: [if], data = [none]
}
}
break;
case Const.ARETURN: {
processARreturn();
break;
}
default:
break;
}
} finally {
stack.sawOpcode(this, seen);
if ((seenImmutable != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(seenImmutable); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static AppDescriptor of(String appName, String packageName, Version appVersion) {
String[] packages = packageName.split(S.COMMON_SEP);
String effectPackageName = packageName;
if (packages.length > 0) {
effectPackageName = packages[0];
}
E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName),
"valid package name expected. found: " + effectPackageName);
return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)),
packageName,
appVersion);
} } | public class class_name {
public static AppDescriptor of(String appName, String packageName, Version appVersion) {
String[] packages = packageName.split(S.COMMON_SEP);
String effectPackageName = packageName;
if (packages.length > 0) {
effectPackageName = packages[0]; // depends on control dependency: [if], data = [none]
}
E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName),
"valid package name expected. found: " + effectPackageName);
return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)),
packageName,
appVersion);
} } |
public class class_name {
public EClass getImageLUTID() {
if (imageLUTIDEClass == null) {
imageLUTIDEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(390);
}
return imageLUTIDEClass;
} } | public class class_name {
public EClass getImageLUTID() {
if (imageLUTIDEClass == null) {
imageLUTIDEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(390); // depends on control dependency: [if], data = [none]
}
return imageLUTIDEClass;
} } |
public class class_name {
public void write(final ComponentDocumentationWrapper componentWrapper, final OutputStream outputStream)
throws IOException {
final Map<String, Object> data = new HashMap<>();
try {
data.put("breadcrumbs", _breadcrumbs);
data.put("component", componentWrapper);
{
final Set<ConfiguredPropertyDescriptor> configuredProperties =
componentWrapper.getComponentDescriptor().getConfiguredProperties();
final List<ConfiguredPropertyDescriptor> properties = new ArrayList<>(configuredProperties);
final List<ConfiguredPropertyDocumentationWrapper> propertyList = new ArrayList<>();
for (final ConfiguredPropertyDescriptor property : properties) {
final HiddenProperty hiddenProperty = property.getAnnotation(HiddenProperty.class);
final Deprecated deprecatedProperty = property.getAnnotation(Deprecated.class);
// we do not show hidden or deprecated properties in docs
if ((hiddenProperty == null || hiddenProperty.hiddenForLocalAccess() == false)
&& deprecatedProperty == null) {
final ConfiguredPropertyDocumentationWrapper wrapper =
new ConfiguredPropertyDocumentationWrapper(property);
propertyList.add(wrapper);
}
}
data.put("properties", propertyList);
}
/* Write data to a file */
final Writer out = new OutputStreamWriter(outputStream);
_template.process(data, out);
out.flush();
out.close();
} catch (final TemplateException e) {
throw new IllegalStateException("Unexpected templare exception", e);
}
} } | public class class_name {
public void write(final ComponentDocumentationWrapper componentWrapper, final OutputStream outputStream)
throws IOException {
final Map<String, Object> data = new HashMap<>();
try {
data.put("breadcrumbs", _breadcrumbs);
data.put("component", componentWrapper);
{
final Set<ConfiguredPropertyDescriptor> configuredProperties =
componentWrapper.getComponentDescriptor().getConfiguredProperties();
final List<ConfiguredPropertyDescriptor> properties = new ArrayList<>(configuredProperties);
final List<ConfiguredPropertyDocumentationWrapper> propertyList = new ArrayList<>();
for (final ConfiguredPropertyDescriptor property : properties) {
final HiddenProperty hiddenProperty = property.getAnnotation(HiddenProperty.class);
final Deprecated deprecatedProperty = property.getAnnotation(Deprecated.class);
// we do not show hidden or deprecated properties in docs
if ((hiddenProperty == null || hiddenProperty.hiddenForLocalAccess() == false)
&& deprecatedProperty == null) {
final ConfiguredPropertyDocumentationWrapper wrapper =
new ConfiguredPropertyDocumentationWrapper(property);
propertyList.add(wrapper); // depends on control dependency: [if], data = [none]
}
}
data.put("properties", propertyList);
}
/* Write data to a file */
final Writer out = new OutputStreamWriter(outputStream);
_template.process(data, out);
out.flush();
out.close();
} catch (final TemplateException e) {
throw new IllegalStateException("Unexpected templare exception", e);
}
} } |
public class class_name {
public void list(PrintStream out) {
out.println("-- listing properties --");
Hashtable h = new Hashtable();
enumerate(h);
for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String val = (String)h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "...";
}
out.println(key + "=" + val);
}
} } | public class class_name {
public void list(PrintStream out) {
out.println("-- listing properties --");
Hashtable h = new Hashtable();
enumerate(h);
for (Enumeration e = h.keys() ; e.hasMoreElements() ;) {
String key = (String)e.nextElement();
String val = (String)h.get(key);
if (val.length() > 40) {
val = val.substring(0, 37) + "..."; // depends on control dependency: [if], data = [none]
}
out.println(key + "=" + val); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void marshall(StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes,
ProtocolMarshaller protocolMarshaller) {
if (startChildWorkflowExecutionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getWorkflowType(), WORKFLOWTYPE_BINDING);
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING);
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getWorkflowId(), WORKFLOWID_BINDING);
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getInitiatedEventId(), INITIATEDEVENTID_BINDING);
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(),
DECISIONTASKCOMPLETEDEVENTID_BINDING);
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getControl(), CONTROL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes,
ProtocolMarshaller protocolMarshaller) {
if (startChildWorkflowExecutionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getWorkflowType(), WORKFLOWTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getWorkflowId(), WORKFLOWID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getInitiatedEventId(), INITIATEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(),
DECISIONTASKCOMPLETEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startChildWorkflowExecutionFailedEventAttributes.getControl(), CONTROL_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 void colorChooser1stTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_colorChooser1stTextActionPerformed
if (this.colorChooser1stText.isLastOkPressed() && changeNotificationAllowed) {
this.controller.changed();
}
} } | public class class_name {
private void colorChooser1stTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_colorChooser1stTextActionPerformed
if (this.colorChooser1stText.isLastOkPressed() && changeNotificationAllowed) {
this.controller.changed(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static SecretKey generateKey(String algorithm, KeySpec keySpec) {
final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm);
try {
return keyFactory.generateSecret(keySpec);
} catch (InvalidKeySpecException e) {
throw new CryptoException(e);
}
} } | public class class_name {
public static SecretKey generateKey(String algorithm, KeySpec keySpec) {
final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm);
try {
return keyFactory.generateSecret(keySpec);
// depends on control dependency: [try], data = [none]
} catch (InvalidKeySpecException e) {
throw new CryptoException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void handleNodeAttributes(Object node, Map attributes) {
// first, short circuit
if (node == null) {
return;
}
for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) {
FactoryBuilderSupport builder = this;
if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getOwner();
} else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getDelegate();
}
attrDelegate.call(builder, node, attributes);
}
if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) {
getProxyBuilder().setNodeAttributes(node, attributes);
}
} } | public class class_name {
protected void handleNodeAttributes(Object node, Map attributes) {
// first, short circuit
if (node == null) {
return; // depends on control dependency: [if], data = [none]
}
for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) {
FactoryBuilderSupport builder = this;
if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getOwner(); // depends on control dependency: [if], data = [none]
} else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) {
builder = (FactoryBuilderSupport) attrDelegate.getDelegate(); // depends on control dependency: [if], data = [none]
}
attrDelegate.call(builder, node, attributes); // depends on control dependency: [for], data = [attrDelegate]
}
if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) {
getProxyBuilder().setNodeAttributes(node, attributes); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int run(String[] args) throws Exception {
List<FileOperation> ops = new ArrayList<FileOperation>();
Path logpath = null;
boolean isIgnoreFailures = false;
try {
for (int idx = 0; idx < args.length; idx++) {
if ("-f".equals(args[idx])) {
if (++idx == args.length) {
System.out.println("urilist_uri not specified");
System.out.println(USAGE);
return -1;
}
ops.addAll(fetchList(jobconf, new Path(args[idx])));
} else if (Option.IGNORE_FAILURES.cmd.equals(args[idx])) {
isIgnoreFailures = true;
} else if ("-log".equals(args[idx])) {
if (++idx == args.length) {
System.out.println("logdir not specified");
System.out.println(USAGE);
return -1;
}
logpath = new Path(args[idx]);
} else if ('-' == args[idx].codePointAt(0)) {
System.out.println("Invalid switch " + args[idx]);
System.out.println(USAGE);
ToolRunner.printGenericCommandUsage(System.out);
return -1;
} else {
ops.add(new FileOperation(args[idx]));
}
}
// mandatory command-line parameters
if (ops.isEmpty()) {
throw new IllegalStateException("Operation is empty");
}
LOG.info("ops=" + ops);
LOG.info("isIgnoreFailures=" + isIgnoreFailures);
jobconf.setBoolean(Option.IGNORE_FAILURES.propertyname, isIgnoreFailures);
check(jobconf, ops);
try {
if (setup(ops, logpath)) {
JobClient.runJob(jobconf);
}
} finally {
try {
if (logpath == null) {
//delete log directory
final Path logdir = FileOutputFormat.getOutputPath(jobconf);
if (logdir != null) {
logdir.getFileSystem(jobconf).delete(logdir, true);
}
}
}
finally {
//delete job directory
final String jobdir = jobconf.get(JOB_DIR_LABEL);
if (jobdir != null) {
final Path jobpath = new Path(jobdir);
jobpath.getFileSystem(jobconf).delete(jobpath, true);
}
}
}
} catch(DuplicationException e) {
LOG.error("Input error:", e);
return DuplicationException.ERROR_CODE;
} catch(Exception e) {
LOG.error(NAME + " failed: ", e);
System.out.println(USAGE);
ToolRunner.printGenericCommandUsage(System.out);
return -1;
}
return 0;
} } | public class class_name {
public int run(String[] args) throws Exception {
List<FileOperation> ops = new ArrayList<FileOperation>();
Path logpath = null;
boolean isIgnoreFailures = false;
try {
for (int idx = 0; idx < args.length; idx++) {
if ("-f".equals(args[idx])) {
if (++idx == args.length) {
System.out.println("urilist_uri not specified"); // depends on control dependency: [if], data = [none]
System.out.println(USAGE); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
ops.addAll(fetchList(jobconf, new Path(args[idx]))); // depends on control dependency: [if], data = [none]
} else if (Option.IGNORE_FAILURES.cmd.equals(args[idx])) {
isIgnoreFailures = true; // depends on control dependency: [if], data = [none]
} else if ("-log".equals(args[idx])) {
if (++idx == args.length) {
System.out.println("logdir not specified"); // depends on control dependency: [if], data = [none]
System.out.println(USAGE); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
logpath = new Path(args[idx]); // depends on control dependency: [if], data = [none]
} else if ('-' == args[idx].codePointAt(0)) {
System.out.println("Invalid switch " + args[idx]); // depends on control dependency: [if], data = [none]
System.out.println(USAGE); // depends on control dependency: [if], data = [none]
ToolRunner.printGenericCommandUsage(System.out); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
} else {
ops.add(new FileOperation(args[idx])); // depends on control dependency: [if], data = [none]
}
}
// mandatory command-line parameters
if (ops.isEmpty()) {
throw new IllegalStateException("Operation is empty");
}
LOG.info("ops=" + ops);
LOG.info("isIgnoreFailures=" + isIgnoreFailures);
jobconf.setBoolean(Option.IGNORE_FAILURES.propertyname, isIgnoreFailures);
check(jobconf, ops);
try {
if (setup(ops, logpath)) {
JobClient.runJob(jobconf); // depends on control dependency: [if], data = [none]
}
} finally {
try {
if (logpath == null) {
//delete log directory
final Path logdir = FileOutputFormat.getOutputPath(jobconf);
if (logdir != null) {
logdir.getFileSystem(jobconf).delete(logdir, true); // depends on control dependency: [if], data = [(logdir]
}
}
}
finally {
//delete job directory
final String jobdir = jobconf.get(JOB_DIR_LABEL);
if (jobdir != null) {
final Path jobpath = new Path(jobdir);
jobpath.getFileSystem(jobconf).delete(jobpath, true); // depends on control dependency: [if], data = [none]
}
}
}
} catch(DuplicationException e) {
LOG.error("Input error:", e);
return DuplicationException.ERROR_CODE;
} catch(Exception e) {
LOG.error(NAME + " failed: ", e);
System.out.println(USAGE);
ToolRunner.printGenericCommandUsage(System.out);
return -1;
}
return 0;
} } |
public class class_name {
public static UnitReference initUom(UnitReference uom, VariableSimpleIF dataVar) {
// @code
String udunits = dataVar.getUnitsString();
if (udunits == null) { // Variable may not have a "units" attribute.
return null;
}
String ucum = ErddapEDUnits.udunitsToUcum(udunits);
uom.setCode(ucum);
return uom;
} } | public class class_name {
public static UnitReference initUom(UnitReference uom, VariableSimpleIF dataVar) {
// @code
String udunits = dataVar.getUnitsString();
if (udunits == null) { // Variable may not have a "units" attribute.
return null; // depends on control dependency: [if], data = [none]
}
String ucum = ErddapEDUnits.udunitsToUcum(udunits);
uom.setCode(ucum);
return uom;
} } |
public class class_name {
public void marshall(DeleteWorkerBlockRequest deleteWorkerBlockRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteWorkerBlockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteWorkerBlockRequest.getWorkerId(), WORKERID_BINDING);
protocolMarshaller.marshall(deleteWorkerBlockRequest.getReason(), REASON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteWorkerBlockRequest deleteWorkerBlockRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteWorkerBlockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteWorkerBlockRequest.getWorkerId(), WORKERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteWorkerBlockRequest.getReason(), REASON_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 addHeaders(HttpServletRequest reqSource, HttpRequestBase httpTarget)
{
Enumeration<?> headerNames = reqSource.getHeaderNames();
while (headerNames.hasMoreElements())
{
String key = headerNames.nextElement().toString();
if (CONTENT_LENGTH.equalsIgnoreCase(key))
continue; // Length will be different
Enumeration<?> headers = reqSource.getHeaders(key);
while (headers.hasMoreElements())
{
String value = (String)headers.nextElement();
if (HOST.equalsIgnoreCase(key))
{
value = proxyURLPrefix;
if (value.indexOf(":") != -1)
{
value = value.substring(value.indexOf(":") + 1);
while (value.startsWith("/"))
{
value = value.substring(1);
}
}
if (value.indexOf("/") != -1)
value = value.substring(0, value.indexOf("/"));
}
httpTarget.setHeader(new BasicHeader(key, value));
}
}
} } | public class class_name {
public void addHeaders(HttpServletRequest reqSource, HttpRequestBase httpTarget)
{
Enumeration<?> headerNames = reqSource.getHeaderNames();
while (headerNames.hasMoreElements())
{
String key = headerNames.nextElement().toString();
if (CONTENT_LENGTH.equalsIgnoreCase(key))
continue; // Length will be different
Enumeration<?> headers = reqSource.getHeaders(key);
while (headers.hasMoreElements())
{
String value = (String)headers.nextElement();
if (HOST.equalsIgnoreCase(key))
{
value = proxyURLPrefix; // depends on control dependency: [if], data = [none]
if (value.indexOf(":") != -1)
{
value = value.substring(value.indexOf(":") + 1); // depends on control dependency: [if], data = [(value.indexOf(":")]
while (value.startsWith("/"))
{
value = value.substring(1); // depends on control dependency: [while], data = [none]
}
}
if (value.indexOf("/") != -1)
value = value.substring(0, value.indexOf("/"));
}
httpTarget.setHeader(new BasicHeader(key, value)); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
private void clear(Object caller, int version) {
assert mutation_in_progress(caller, version);
_buf_limit = 0;
for (int ii=0; ii<_blocks.size(); ii++) {
_blocks.get(ii).clearBlock();
// _blocks.get(ii)._idx = -1; this is done in clearBlock()
}
bbBlock first = _blocks.get(0);
first._idx = 0; // cas: 26 dec 2008
first._offset = 0;
first._limit = 0;
_next_block_position = 1;
return;
} } | public class class_name {
private void clear(Object caller, int version) {
assert mutation_in_progress(caller, version);
_buf_limit = 0;
for (int ii=0; ii<_blocks.size(); ii++) {
_blocks.get(ii).clearBlock(); // depends on control dependency: [for], data = [ii]
// _blocks.get(ii)._idx = -1; this is done in clearBlock()
}
bbBlock first = _blocks.get(0);
first._idx = 0; // cas: 26 dec 2008
first._offset = 0;
first._limit = 0;
_next_block_position = 1;
return;
} } |
public class class_name {
public EEnum getBDDUBASE() {
if (bddubaseEEnum == null) {
bddubaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(2);
}
return bddubaseEEnum;
} } | public class class_name {
public EEnum getBDDUBASE() {
if (bddubaseEEnum == null) {
bddubaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(2); // depends on control dependency: [if], data = [none]
}
return bddubaseEEnum;
} } |
public class class_name {
@Override
public boolean timeRange(Object hour1, Object min1, Object sec1,
Object hour2, Object min2, Object sec2, Object gmt) {
boolean useGmt = GMT.equalsIgnoreCase(String.valueOf(min1))
|| GMT.equalsIgnoreCase(String.valueOf(sec1))
|| GMT.equalsIgnoreCase(String.valueOf(min2))
|| GMT.equalsIgnoreCase(String.valueOf(gmt));
Calendar cal = getCurrentTime(useGmt);
cal.set(Calendar.MILLISECOND, 0);
Date current = cal.getTime();
Date from;
Date to;
if (sec2 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
cal.set(Calendar.MINUTE, ((Number) min1).intValue());
cal.set(Calendar.SECOND, ((Number) sec1).intValue());
from = cal.getTime();
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour2).intValue());
cal.set(Calendar.MINUTE, ((Number) min2).intValue());
cal.set(Calendar.SECOND, ((Number) sec2).intValue());
to = cal.getTime();
} else if (hour2 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
cal.set(Calendar.MINUTE, ((Number) min1).intValue());
cal.set(Calendar.SECOND, 0);
from = cal.getTime();
cal.set(Calendar.HOUR_OF_DAY, ((Number) sec1).intValue());
cal.set(Calendar.MINUTE, ((Number) hour2).intValue());
cal.set(Calendar.SECOND, 59);
to = cal.getTime();
} else if (min1 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
from = cal.getTime();
cal.set(Calendar.HOUR_OF_DAY, ((Number) min1).intValue());
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
to = cal.getTime();
} else {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
from = cal.getTime();
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue());
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
to = cal.getTime();
}
if (to.before(from)) {
cal.setTime(to);
cal.add(Calendar.DATE, +1);
to = cal.getTime();
}
return current.compareTo(from) >= 0 && current.compareTo(to) <= 0;
} } | public class class_name {
@Override
public boolean timeRange(Object hour1, Object min1, Object sec1,
Object hour2, Object min2, Object sec2, Object gmt) {
boolean useGmt = GMT.equalsIgnoreCase(String.valueOf(min1))
|| GMT.equalsIgnoreCase(String.valueOf(sec1))
|| GMT.equalsIgnoreCase(String.valueOf(min2))
|| GMT.equalsIgnoreCase(String.valueOf(gmt));
Calendar cal = getCurrentTime(useGmt);
cal.set(Calendar.MILLISECOND, 0);
Date current = cal.getTime();
Date from;
Date to;
if (sec2 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, ((Number) min1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, ((Number) sec1).intValue()); // depends on control dependency: [if], data = [none]
from = cal.getTime(); // depends on control dependency: [if], data = [none]
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour2).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, ((Number) min2).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, ((Number) sec2).intValue()); // depends on control dependency: [if], data = [none]
to = cal.getTime(); // depends on control dependency: [if], data = [none]
} else if (hour2 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, ((Number) min1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
from = cal.getTime(); // depends on control dependency: [if], data = [none]
cal.set(Calendar.HOUR_OF_DAY, ((Number) sec1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, ((Number) hour2).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 59); // depends on control dependency: [if], data = [none]
to = cal.getTime(); // depends on control dependency: [if], data = [none]
} else if (min1 instanceof Number) {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
from = cal.getTime(); // depends on control dependency: [if], data = [none]
cal.set(Calendar.HOUR_OF_DAY, ((Number) min1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, 59); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 59); // depends on control dependency: [if], data = [none]
to = cal.getTime(); // depends on control dependency: [if], data = [none]
} else {
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
from = cal.getTime(); // depends on control dependency: [if], data = [none]
cal.set(Calendar.HOUR_OF_DAY, ((Number) hour1).intValue()); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, 59); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 59); // depends on control dependency: [if], data = [none]
to = cal.getTime(); // depends on control dependency: [if], data = [none]
}
if (to.before(from)) {
cal.setTime(to); // depends on control dependency: [if], data = [none]
cal.add(Calendar.DATE, +1); // depends on control dependency: [if], data = [none]
to = cal.getTime(); // depends on control dependency: [if], data = [none]
}
return current.compareTo(from) >= 0 && current.compareTo(to) <= 0;
} } |
public class class_name {
public String parameterize() {
Set<Integer> paramIds = new HashSet<>();
ParameterizationInfo.findUserParametersRecursively(m_xmlSQL, paramIds);
m_adhocUserParamsCount = paramIds.size();
m_paramzInfo = null;
if (paramIds.size() == 0) {
m_paramzInfo = ParameterizationInfo.parameterize(m_xmlSQL);
}
// skip plans with pre-existing parameters and plans that don't parameterize
// assume a user knows how to cache/optimize these
if (m_paramzInfo != null) {
// if requested output the second version of the parsed plan
m_planSelector.outputParameterizedCompiledStatement(m_paramzInfo.getParameterizedXmlSQL());
return m_paramzInfo.getParameterizedXmlSQL().toMinString();
}
// fallback when parameterization is
return m_xmlSQL.toMinString();
} } | public class class_name {
public String parameterize() {
Set<Integer> paramIds = new HashSet<>();
ParameterizationInfo.findUserParametersRecursively(m_xmlSQL, paramIds);
m_adhocUserParamsCount = paramIds.size();
m_paramzInfo = null;
if (paramIds.size() == 0) {
m_paramzInfo = ParameterizationInfo.parameterize(m_xmlSQL); // depends on control dependency: [if], data = [none]
}
// skip plans with pre-existing parameters and plans that don't parameterize
// assume a user knows how to cache/optimize these
if (m_paramzInfo != null) {
// if requested output the second version of the parsed plan
m_planSelector.outputParameterizedCompiledStatement(m_paramzInfo.getParameterizedXmlSQL()); // depends on control dependency: [if], data = [(m_paramzInfo]
return m_paramzInfo.getParameterizedXmlSQL().toMinString(); // depends on control dependency: [if], data = [none]
}
// fallback when parameterization is
return m_xmlSQL.toMinString();
} } |
public class class_name {
@RequestMapping("/web/frontend")
public String webFrontend(HttpServletRequest request){
Map<String, String> receives = new HashMap<>();
// TODO 这里还是建议直接从request中获取map参数,兼容支付宝修改或增减参数
for (AlipayField f : AlipayFields.WEB_PAY_RETURN){
receives.put(f.field(), request.getParameter(f.field()));
}
String tradeStatus = receives.get(AlipayField.TRADE_STATUS.field());
if (TradeStatus.TRADE_FINISHED.value().equals(tradeStatus)
|| TradeStatus.TRADE_SUCCESS.value().equals(tradeStatus)){
// 交易成功
// TODO business logic
}
logger.info("web frontend notify params: {}", receives);
logger.info("web frontend sign: {}", alipayService.notifyVerifyMd5(receives));
return receives.toString();
} } | public class class_name {
@RequestMapping("/web/frontend")
public String webFrontend(HttpServletRequest request){
Map<String, String> receives = new HashMap<>();
// TODO 这里还是建议直接从request中获取map参数,兼容支付宝修改或增减参数
for (AlipayField f : AlipayFields.WEB_PAY_RETURN){
receives.put(f.field(), request.getParameter(f.field())); // depends on control dependency: [for], data = [f]
}
String tradeStatus = receives.get(AlipayField.TRADE_STATUS.field());
if (TradeStatus.TRADE_FINISHED.value().equals(tradeStatus)
|| TradeStatus.TRADE_SUCCESS.value().equals(tradeStatus)){
// 交易成功
// TODO business logic
}
logger.info("web frontend notify params: {}", receives);
logger.info("web frontend sign: {}", alipayService.notifyVerifyMd5(receives));
return receives.toString();
} } |
public class class_name {
private UfsStatus[] getChildrenInUFS(AlluxioURI alluxioUri)
throws InvalidPathException, IOException {
MountTable.Resolution resolution = mMountTable.resolve(alluxioUri);
AlluxioURI ufsUri = resolution.getUri();
try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) {
UnderFileSystem ufs = ufsResource.get();
AlluxioURI curUri = ufsUri;
while (curUri != null) {
if (mListedDirectories.containsKey(curUri.toString())) {
List<UfsStatus> childrenList = new ArrayList<>();
for (UfsStatus childStatus : mListedDirectories.get(curUri.toString())) {
String childPath = PathUtils.concatPath(curUri, childStatus.getName());
String prefix = PathUtils.normalizePath(ufsUri.toString(), AlluxioURI.SEPARATOR);
if (childPath.startsWith(prefix) && childPath.length() > prefix.length()) {
UfsStatus newStatus = childStatus.copy();
newStatus.setName(childPath.substring(prefix.length()));
childrenList.add(newStatus);
}
}
return trimIndirect(childrenList.toArray(new UfsStatus[childrenList.size()]));
}
curUri = curUri.getParent();
}
UfsStatus[] children =
ufs.listStatus(ufsUri.toString(), ListOptions.defaults().setRecursive(true));
// Assumption: multiple mounted UFSs cannot have the same ufsUri
if (children == null) {
return EMPTY_CHILDREN;
}
mListedDirectories.put(ufsUri.toString(), children);
return trimIndirect(children);
}
} } | public class class_name {
private UfsStatus[] getChildrenInUFS(AlluxioURI alluxioUri)
throws InvalidPathException, IOException {
MountTable.Resolution resolution = mMountTable.resolve(alluxioUri);
AlluxioURI ufsUri = resolution.getUri();
try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) {
UnderFileSystem ufs = ufsResource.get();
AlluxioURI curUri = ufsUri;
while (curUri != null) {
if (mListedDirectories.containsKey(curUri.toString())) {
List<UfsStatus> childrenList = new ArrayList<>();
for (UfsStatus childStatus : mListedDirectories.get(curUri.toString())) {
String childPath = PathUtils.concatPath(curUri, childStatus.getName());
String prefix = PathUtils.normalizePath(ufsUri.toString(), AlluxioURI.SEPARATOR);
if (childPath.startsWith(prefix) && childPath.length() > prefix.length()) {
UfsStatus newStatus = childStatus.copy();
newStatus.setName(childPath.substring(prefix.length())); // depends on control dependency: [if], data = [prefix.length())]
childrenList.add(newStatus); // depends on control dependency: [if], data = [none]
}
}
return trimIndirect(childrenList.toArray(new UfsStatus[childrenList.size()]));
}
curUri = curUri.getParent();
}
UfsStatus[] children =
ufs.listStatus(ufsUri.toString(), ListOptions.defaults().setRecursive(true));
// Assumption: multiple mounted UFSs cannot have the same ufsUri
if (children == null) {
return EMPTY_CHILDREN;
}
mListedDirectories.put(ufsUri.toString(), children);
return trimIndirect(children);
}
} } |
public class class_name {
public void performActions() {
if (this.clientConfiguration.getActions().isEmpty()) {
this.clientConfiguration.printHelp();
return;
}
this.dumpProcessingController.setOfflineMode(this.clientConfiguration
.getOfflineMode());
if (this.clientConfiguration.getDumpDirectoryLocation() != null) {
try {
this.dumpProcessingController
.setDownloadDirectory(this.clientConfiguration
.getDumpDirectoryLocation());
} catch (IOException e) {
logger.error("Could not set download directory to "
+ this.clientConfiguration.getDumpDirectoryLocation()
+ ": " + e.getMessage());
logger.error("Aborting");
return;
}
}
dumpProcessingController.setLanguageFilter(this.clientConfiguration
.getFilterLanguages());
dumpProcessingController.setSiteLinkFilter(this.clientConfiguration
.getFilterSiteKeys());
dumpProcessingController.setPropertyFilter(this.clientConfiguration
.getFilterProperties());
MwDumpFile dumpFile = this.clientConfiguration.getLocalDumpFile();
if (dumpFile == null) {
dumpFile = dumpProcessingController
.getMostRecentDump(DumpContentType.JSON);
} else {
if (!dumpFile.isAvailable()) {
logger.error("Dump file not found or not readable: "
+ dumpFile.toString());
return;
}
}
this.clientConfiguration.setProjectName(dumpFile.getProjectName());
this.clientConfiguration.setDateStamp(dumpFile.getDateStamp());
boolean hasReadyProcessor = false;
for (DumpProcessingAction props : this.clientConfiguration.getActions()) {
if (!props.isReady()) {
continue;
}
if (props.needsSites()) {
prepareSites();
if (this.sites == null) { // sites unavailable
continue;
}
props.setSites(this.sites);
}
props.setDumpInformation(dumpFile.getProjectName(),
dumpFile.getDateStamp());
this.dumpProcessingController.registerEntityDocumentProcessor(
props, null, true);
hasReadyProcessor = true;
}
if (!hasReadyProcessor) {
return; // silent; non-ready action should report its problem
// directly
}
if (!this.clientConfiguration.isQuiet()) {
EntityTimerProcessor entityTimerProcessor = new EntityTimerProcessor(
0);
this.dumpProcessingController.registerEntityDocumentProcessor(
entityTimerProcessor, null, true);
}
openActions();
this.dumpProcessingController.processDump(dumpFile);
closeActions();
try {
writeReport();
} catch (IOException e) {
logger.error("Could not print report file: " + e.getMessage());
}
} } | public class class_name {
public void performActions() {
if (this.clientConfiguration.getActions().isEmpty()) {
this.clientConfiguration.printHelp(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dumpProcessingController.setOfflineMode(this.clientConfiguration
.getOfflineMode());
if (this.clientConfiguration.getDumpDirectoryLocation() != null) {
try {
this.dumpProcessingController
.setDownloadDirectory(this.clientConfiguration
.getDumpDirectoryLocation()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Could not set download directory to "
+ this.clientConfiguration.getDumpDirectoryLocation()
+ ": " + e.getMessage());
logger.error("Aborting");
return;
} // depends on control dependency: [catch], data = [none]
}
dumpProcessingController.setLanguageFilter(this.clientConfiguration
.getFilterLanguages());
dumpProcessingController.setSiteLinkFilter(this.clientConfiguration
.getFilterSiteKeys());
dumpProcessingController.setPropertyFilter(this.clientConfiguration
.getFilterProperties());
MwDumpFile dumpFile = this.clientConfiguration.getLocalDumpFile();
if (dumpFile == null) {
dumpFile = dumpProcessingController
.getMostRecentDump(DumpContentType.JSON); // depends on control dependency: [if], data = [none]
} else {
if (!dumpFile.isAvailable()) {
logger.error("Dump file not found or not readable: "
+ dumpFile.toString()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
this.clientConfiguration.setProjectName(dumpFile.getProjectName());
this.clientConfiguration.setDateStamp(dumpFile.getDateStamp());
boolean hasReadyProcessor = false;
for (DumpProcessingAction props : this.clientConfiguration.getActions()) {
if (!props.isReady()) {
continue;
}
if (props.needsSites()) {
prepareSites(); // depends on control dependency: [if], data = [none]
if (this.sites == null) { // sites unavailable
continue;
}
props.setSites(this.sites); // depends on control dependency: [if], data = [none]
}
props.setDumpInformation(dumpFile.getProjectName(),
dumpFile.getDateStamp()); // depends on control dependency: [for], data = [props]
this.dumpProcessingController.registerEntityDocumentProcessor(
props, null, true); // depends on control dependency: [for], data = [none]
hasReadyProcessor = true; // depends on control dependency: [for], data = [none]
}
if (!hasReadyProcessor) {
return; // silent; non-ready action should report its problem // depends on control dependency: [if], data = [none]
// directly
}
if (!this.clientConfiguration.isQuiet()) {
EntityTimerProcessor entityTimerProcessor = new EntityTimerProcessor(
0);
this.dumpProcessingController.registerEntityDocumentProcessor(
entityTimerProcessor, null, true); // depends on control dependency: [if], data = [none]
}
openActions();
this.dumpProcessingController.processDump(dumpFile);
closeActions();
try {
writeReport(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Could not print report file: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void wait(String message, long timeoutInMilliseconds, long intervalInMilliseconds) {
long start = System.currentTimeMillis();
long end = start + timeoutInMilliseconds;
while (System.currentTimeMillis() < end) {
if (until()) return;
try {
Thread.sleep(intervalInMilliseconds);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
throw new WaitTimedOutException(message);
} } | public class class_name {
public void wait(String message, long timeoutInMilliseconds, long intervalInMilliseconds) {
long start = System.currentTimeMillis();
long end = start + timeoutInMilliseconds;
while (System.currentTimeMillis() < end) {
if (until()) return;
try {
Thread.sleep(intervalInMilliseconds); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
throw new WaitTimedOutException(message);
} } |
public class class_name {
private int getNextDayOfWeek(int day, int dayOfWeek)
{
if (!contains(daysOfWeek, dayOfWeek))
{
long higher = higher(daysOfWeek, dayOfWeek);
if (higher != 0)
{
return day + (first(higher) - dayOfWeek);
}
return day + (7 - dayOfWeek) + first(daysOfWeek);
}
return day;
} } | public class class_name {
private int getNextDayOfWeek(int day, int dayOfWeek)
{
if (!contains(daysOfWeek, dayOfWeek))
{
long higher = higher(daysOfWeek, dayOfWeek);
if (higher != 0)
{
return day + (first(higher) - dayOfWeek); // depends on control dependency: [if], data = [(higher]
}
return day + (7 - dayOfWeek) + first(daysOfWeek); // depends on control dependency: [if], data = [none]
}
return day;
} } |
public class class_name {
public static String getNamespace(HasMetadata entity) {
if (entity != null) {
return getNamespace(entity.getMetadata());
} else {
return null;
}
} } | public class class_name {
public static String getNamespace(HasMetadata entity) {
if (entity != null) {
return getNamespace(entity.getMetadata()); // depends on control dependency: [if], data = [(entity]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Description matchNewClass(NewClassTree newClassTree, VisitorState state) {
if (state.getPath().getParentPath().getLeaf().getKind() != Kind.EXPRESSION_STATEMENT) {
return Description.NO_MATCH;
}
if (newClassTree.getClassBody() == null) {
return Description.NO_MATCH;
}
if (!newClassTree.getArguments().isEmpty()) {
return Description.NO_MATCH;
}
for (Tree def : newClassTree.getClassBody().getMembers()) {
switch (def.getKind()) {
case VARIABLE:
{
VariableTree variableTree = (VariableTree) def;
if (variableTree.getInitializer() != null) {
return Description.NO_MATCH;
}
break;
}
case BLOCK:
return Description.NO_MATCH;
default:
break;
}
}
if (!sideEffectFreeConstructor(((JCTree) newClassTree.getIdentifier()).type.tsym, state)) {
return Description.NO_MATCH;
}
return describeMatch(newClassTree);
} } | public class class_name {
@Override
public Description matchNewClass(NewClassTree newClassTree, VisitorState state) {
if (state.getPath().getParentPath().getLeaf().getKind() != Kind.EXPRESSION_STATEMENT) {
return Description.NO_MATCH; // depends on control dependency: [if], data = [none]
}
if (newClassTree.getClassBody() == null) {
return Description.NO_MATCH; // depends on control dependency: [if], data = [none]
}
if (!newClassTree.getArguments().isEmpty()) {
return Description.NO_MATCH; // depends on control dependency: [if], data = [none]
}
for (Tree def : newClassTree.getClassBody().getMembers()) {
switch (def.getKind()) {
case VARIABLE:
{
VariableTree variableTree = (VariableTree) def;
if (variableTree.getInitializer() != null) {
return Description.NO_MATCH; // depends on control dependency: [if], data = [none]
}
break;
}
case BLOCK:
return Description.NO_MATCH; // depends on control dependency: [for], data = [none]
default:
break;
}
}
if (!sideEffectFreeConstructor(((JCTree) newClassTree.getIdentifier()).type.tsym, state)) {
return Description.NO_MATCH;
}
return describeMatch(newClassTree);
} } |
public class class_name {
public static boolean isSequentialAlignment(AFPChain afpChain, boolean checkWithinBlocks) {
int[][][] optAln = afpChain.getOptAln();
int[] alnLen = afpChain.getOptLen();
int blocks = afpChain.getBlockNum();
if(blocks < 1) return true; //trivial case
if ( alnLen[0] < 1) return true;
// Check that blocks are sequential
if(checkWithinBlocks) {
for(int block = 0; block<blocks; block++) {
if(alnLen[block] < 1 ) continue; //skip empty blocks
int prevRes1 = optAln[block][0][0];
int prevRes2 = optAln[block][1][0];
for(int pos = 1; pos<alnLen[block]; pos++) {
int currRes1 = optAln[block][0][pos];
int currRes2 = optAln[block][1][pos];
if(currRes1 < prevRes1) {
return false;
}
if(currRes2 < prevRes2) {
return false;
}
prevRes1 = currRes1;
prevRes2 = currRes2;
}
}
}
// Check that blocks are sequential
int prevRes1 = optAln[0][0][alnLen[0]-1];
int prevRes2 = optAln[0][1][alnLen[0]-1];
for(int block = 1; block<blocks;block++) {
if(alnLen[block] < 1 ) continue; //skip empty blocks
if(optAln[block][0][0]<prevRes1) {
return false;
}
if(optAln[block][1][0]<prevRes2) {
return false;
}
prevRes1 = optAln[block][0][alnLen[block]-1];
prevRes2 = optAln[block][1][alnLen[block]-1];
}
return true;
} } | public class class_name {
public static boolean isSequentialAlignment(AFPChain afpChain, boolean checkWithinBlocks) {
int[][][] optAln = afpChain.getOptAln();
int[] alnLen = afpChain.getOptLen();
int blocks = afpChain.getBlockNum();
if(blocks < 1) return true; //trivial case
if ( alnLen[0] < 1) return true;
// Check that blocks are sequential
if(checkWithinBlocks) {
for(int block = 0; block<blocks; block++) {
if(alnLen[block] < 1 ) continue; //skip empty blocks
int prevRes1 = optAln[block][0][0];
int prevRes2 = optAln[block][1][0];
for(int pos = 1; pos<alnLen[block]; pos++) {
int currRes1 = optAln[block][0][pos];
int currRes2 = optAln[block][1][pos];
if(currRes1 < prevRes1) {
return false; // depends on control dependency: [if], data = [none]
}
if(currRes2 < prevRes2) {
return false; // depends on control dependency: [if], data = [none]
}
prevRes1 = currRes1; // depends on control dependency: [for], data = [none]
prevRes2 = currRes2; // depends on control dependency: [for], data = [none]
}
}
}
// Check that blocks are sequential
int prevRes1 = optAln[0][0][alnLen[0]-1];
int prevRes2 = optAln[0][1][alnLen[0]-1];
for(int block = 1; block<blocks;block++) {
if(alnLen[block] < 1 ) continue; //skip empty blocks
if(optAln[block][0][0]<prevRes1) {
return false; // depends on control dependency: [if], data = [none]
}
if(optAln[block][1][0]<prevRes2) {
return false; // depends on control dependency: [if], data = [none]
}
prevRes1 = optAln[block][0][alnLen[block]-1]; // depends on control dependency: [for], data = [block]
prevRes2 = optAln[block][1][alnLen[block]-1]; // depends on control dependency: [for], data = [block]
}
return true;
} } |
public class class_name {
public Observable<ServiceResponse<ConnectivityInformationInner>> beginCheckConnectivityWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (networkWatcherName == null) {
throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2018-06-01";
return service.beginCheckConnectivity(resourceGroupName, networkWatcherName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ConnectivityInformationInner>>>() {
@Override
public Observable<ServiceResponse<ConnectivityInformationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ConnectivityInformationInner> clientResponse = beginCheckConnectivityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<ConnectivityInformationInner>> beginCheckConnectivityWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (networkWatcherName == null) {
throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2018-06-01";
return service.beginCheckConnectivity(resourceGroupName, networkWatcherName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ConnectivityInformationInner>>>() {
@Override
public Observable<ServiceResponse<ConnectivityInformationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ConnectivityInformationInner> clientResponse = beginCheckConnectivityDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
synchronized HttpHandler getHandler(final Consumer<ServletContext> consumer) throws ServletException {
if (handler == null) {
LOG.debug("Creating handler on demand");
createHandler(consumer);
} else if (consumer != null) {
// Handler might be available, but the ServletContextProxy needs initialization. TODO check why
consumer.accept(manager.getDeployment().getServletContext());
}
return handler;
} } | public class class_name {
synchronized HttpHandler getHandler(final Consumer<ServletContext> consumer) throws ServletException {
if (handler == null) {
LOG.debug("Creating handler on demand"); // depends on control dependency: [if], data = [none]
createHandler(consumer); // depends on control dependency: [if], data = [none]
} else if (consumer != null) {
// Handler might be available, but the ServletContextProxy needs initialization. TODO check why
consumer.accept(manager.getDeployment().getServletContext()); // depends on control dependency: [if], data = [none]
}
return handler;
} } |
public class class_name {
public static String getOfficialDataTypeURI(Datatype datatype) {
for(Uris uris : datatype.getUris()) {
for(Uri uri : uris.getUri()) {
if(!isDeprecated(uri) && uri.getType() == UriType.URN) {
return uri.getValue();
}
}
}
return null;
} } | public class class_name {
public static String getOfficialDataTypeURI(Datatype datatype) {
for(Uris uris : datatype.getUris()) {
for(Uri uri : uris.getUri()) {
if(!isDeprecated(uri) && uri.getType() == UriType.URN) {
return uri.getValue(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
protected void extractParameterDescriptorMap()
{
for (PropertyDescriptor propertyDescriptor : this.parametersBeanDescriptor.getProperties()) {
DefaultParameterDescriptor desc = new DefaultParameterDescriptor(propertyDescriptor);
this.parameterDescriptorMap.put(desc.getId().toLowerCase(), desc);
}
} } | public class class_name {
protected void extractParameterDescriptorMap()
{
for (PropertyDescriptor propertyDescriptor : this.parametersBeanDescriptor.getProperties()) {
DefaultParameterDescriptor desc = new DefaultParameterDescriptor(propertyDescriptor);
this.parameterDescriptorMap.put(desc.getId().toLowerCase(), desc); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
protected long getNumConnections(IPeer peer) {
if (peer == null) {
return 0;
}
IStatistic stats = peer.getStatistic();
// If no statistics are available, return zero
if (!stats.isEnabled()) {
if (logger.isDebugEnabled()) {
logger.debug("Statistics for peer are disabled. Please enable statistics in client config");
}
return 0;
}
// Requests per second initiated by Local Peer + Request initiated by Remote peer
String uri = peer.getUri() == null ? "local" : peer.getUri().toString();
long requests = getRecord(IStatisticRecord.Counters.AppGenRequestPerSecond.name()+'.'+uri, stats)
+ getRecord(IStatisticRecord.Counters.NetGenRequestPerSecond.name()+'.'+uri, stats);
// There are likely more requests than responses active
long connections = Math.max(0, requests);
if (logger.isTraceEnabled()) {
logger.trace("Active connections for {}: {}", peer, connections);
}
return connections;
} } | public class class_name {
protected long getNumConnections(IPeer peer) {
if (peer == null) {
return 0; // depends on control dependency: [if], data = [none]
}
IStatistic stats = peer.getStatistic();
// If no statistics are available, return zero
if (!stats.isEnabled()) {
if (logger.isDebugEnabled()) {
logger.debug("Statistics for peer are disabled. Please enable statistics in client config"); // depends on control dependency: [if], data = [none]
}
return 0; // depends on control dependency: [if], data = [none]
}
// Requests per second initiated by Local Peer + Request initiated by Remote peer
String uri = peer.getUri() == null ? "local" : peer.getUri().toString();
long requests = getRecord(IStatisticRecord.Counters.AppGenRequestPerSecond.name()+'.'+uri, stats)
+ getRecord(IStatisticRecord.Counters.NetGenRequestPerSecond.name()+'.'+uri, stats);
// There are likely more requests than responses active
long connections = Math.max(0, requests);
if (logger.isTraceEnabled()) {
logger.trace("Active connections for {}: {}", peer, connections); // depends on control dependency: [if], data = [none]
}
return connections;
} } |
public class class_name {
public void setCustomEventLoggerImpl(String customEventLoggerImpl)
{
System.err.println("### GOT CustomEventLoggerImpl: " + customEventLoggerImpl);
this.customEventLoggerImpl = customEventLoggerImpl;
try {
System.err.println("Try to load class: " + customEventLoggerImpl);
Class c = this.getClass().getClassLoader().loadClass(customEventLoggerImpl);
Object o = c.newInstance();
System.err.println("Load an object of class: " + o.getClass().getName());
customEventLogger = (EventLogger)o;
System.err.println("Load of a custom EventLogger done");
} catch (Throwable ex) {
}
} } | public class class_name {
public void setCustomEventLoggerImpl(String customEventLoggerImpl)
{
System.err.println("### GOT CustomEventLoggerImpl: " + customEventLoggerImpl);
this.customEventLoggerImpl = customEventLoggerImpl;
try {
System.err.println("Try to load class: " + customEventLoggerImpl); // depends on control dependency: [try], data = [none]
Class c = this.getClass().getClassLoader().loadClass(customEventLoggerImpl); // depends on control dependency: [try], data = [none]
Object o = c.newInstance();
System.err.println("Load an object of class: " + o.getClass().getName()); // depends on control dependency: [try], data = [none]
customEventLogger = (EventLogger)o; // depends on control dependency: [try], data = [none]
System.err.println("Load of a custom EventLogger done"); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
final long internalEdgeDisconnect(int edgeToRemove, long edgeToUpdatePointer, int baseNode) {
long edgeToRemovePointer = toPointer(edgeToRemove);
// an edge is shared across the two nodes even if the edge is not in both directions
// so we need to know two edge-pointers pointing to the edge before edgeToRemovePointer
int nextEdgeId = getNodeA(edgeToRemovePointer) == baseNode ? getLinkA(edgeToRemovePointer) : getLinkB(edgeToRemovePointer);
if (edgeToUpdatePointer < 0) {
setEdgeRef(baseNode, nextEdgeId);
} else {
// adjNode is different for the edge we want to update with the new link
long link = getNodeA(edgeToUpdatePointer) == baseNode ? edgeToUpdatePointer + E_LINKA : edgeToUpdatePointer + E_LINKB;
edges.setInt(link, nextEdgeId);
}
return edgeToRemovePointer;
} } | public class class_name {
final long internalEdgeDisconnect(int edgeToRemove, long edgeToUpdatePointer, int baseNode) {
long edgeToRemovePointer = toPointer(edgeToRemove);
// an edge is shared across the two nodes even if the edge is not in both directions
// so we need to know two edge-pointers pointing to the edge before edgeToRemovePointer
int nextEdgeId = getNodeA(edgeToRemovePointer) == baseNode ? getLinkA(edgeToRemovePointer) : getLinkB(edgeToRemovePointer);
if (edgeToUpdatePointer < 0) {
setEdgeRef(baseNode, nextEdgeId); // depends on control dependency: [if], data = [none]
} else {
// adjNode is different for the edge we want to update with the new link
long link = getNodeA(edgeToUpdatePointer) == baseNode ? edgeToUpdatePointer + E_LINKA : edgeToUpdatePointer + E_LINKB;
edges.setInt(link, nextEdgeId); // depends on control dependency: [if], data = [none]
}
return edgeToRemovePointer;
} } |
public class class_name {
public int toByteArray( Object obj, byte result[], int resultOffset, int avaiableSize ) {
output.resetForReUse();
try {
output.writeObject(obj);
} catch (IOException e) {
FSTUtil.<RuntimeException>rethrow(e);
}
int written = output.getWritten();
if ( written > avaiableSize ) {
throw FSTBufferTooSmallException.Instance;
}
System.arraycopy(output.getBuffer(),0,result,resultOffset, written);
return written;
} } | public class class_name {
public int toByteArray( Object obj, byte result[], int resultOffset, int avaiableSize ) {
output.resetForReUse();
try {
output.writeObject(obj); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
FSTUtil.<RuntimeException>rethrow(e);
} // depends on control dependency: [catch], data = [none]
int written = output.getWritten();
if ( written > avaiableSize ) {
throw FSTBufferTooSmallException.Instance;
}
System.arraycopy(output.getBuffer(),0,result,resultOffset, written);
return written;
} } |
public class class_name {
protected String ensureCanonicalPath(String path) {
final String basePath;
String wildCards = null;
final String file = path.replace('\\', '/');
if (file.contains("*") || file.contains("?")) {
int pos = getLastFileSeparator(file);
if (pos < 0) {
return file;
}
pos += 1;
basePath = file.substring(0, pos);
wildCards = file.substring(pos);
} else {
basePath = file;
}
File f = new File(basePath);
try {
f = f.getCanonicalFile();
if (wildCards != null) {
f = new File(f, wildCards);
}
} catch (IOException ex) {
LOGGER.warn("Invalid path '{}' was provided.", path);
LOGGER.debug("Invalid path provided", ex);
}
return f.getAbsolutePath().replace('\\', '/');
} } | public class class_name {
protected String ensureCanonicalPath(String path) {
final String basePath;
String wildCards = null;
final String file = path.replace('\\', '/');
if (file.contains("*") || file.contains("?")) {
int pos = getLastFileSeparator(file);
if (pos < 0) {
return file; // depends on control dependency: [if], data = [none]
}
pos += 1; // depends on control dependency: [if], data = [none]
basePath = file.substring(0, pos); // depends on control dependency: [if], data = [none]
wildCards = file.substring(pos); // depends on control dependency: [if], data = [none]
} else {
basePath = file; // depends on control dependency: [if], data = [none]
}
File f = new File(basePath);
try {
f = f.getCanonicalFile(); // depends on control dependency: [try], data = [none]
if (wildCards != null) {
f = new File(f, wildCards); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
LOGGER.warn("Invalid path '{}' was provided.", path);
LOGGER.debug("Invalid path provided", ex);
} // depends on control dependency: [catch], data = [none]
return f.getAbsolutePath().replace('\\', '/');
} } |
public class class_name {
private static void disable2PC(String extractDirectory, String serverName) throws IOException {
String fileName = extractDirectory + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + serverName + File.separator
+ "jvm.options";
BufferedReader br = null;
BufferedWriter bw = null;
StringBuffer sb = new StringBuffer();
try {
String sCurrentLine;
File file = new File(fileName);
// if file doesnt exists, then create it
if (!file.exists()) {
boolean success = file.createNewFile();
if (!success) {
throw new IOException("Failed to create file " + fileName);
}
} else {
// read existing file content
br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8"));
while ((sCurrentLine = br.readLine()) != null) {
sb.append(sCurrentLine + "\n");
}
}
// write property to disable 2PC commit
String content = "-Dcom.ibm.tx.jta.disable2PC=true";
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"));
bw.write(sb.toString());
bw.write(content);
} finally {
if (br != null)
br.close();
if (bw != null)
bw.close();
}
} } | public class class_name {
private static void disable2PC(String extractDirectory, String serverName) throws IOException {
String fileName = extractDirectory + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + serverName + File.separator
+ "jvm.options";
BufferedReader br = null;
BufferedWriter bw = null;
StringBuffer sb = new StringBuffer();
try {
String sCurrentLine;
File file = new File(fileName);
// if file doesnt exists, then create it
if (!file.exists()) {
boolean success = file.createNewFile();
if (!success) {
throw new IOException("Failed to create file " + fileName);
}
} else {
// read existing file content
br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), "UTF-8")); // depends on control dependency: [if], data = [none]
while ((sCurrentLine = br.readLine()) != null) {
sb.append(sCurrentLine + "\n"); // depends on control dependency: [while], data = [none]
}
}
// write property to disable 2PC commit
String content = "-Dcom.ibm.tx.jta.disable2PC=true";
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file.getAbsoluteFile()), "UTF-8"));
bw.write(sb.toString());
bw.write(content);
} finally {
if (br != null)
br.close();
if (bw != null)
bw.close();
}
} } |
public class class_name {
public static String replaceAll(String str, String match, String replacement) {
String newStr = str;
int i = newStr.indexOf(match);
while (i >= 0) {
newStr = newStr.substring(0, i) + replacement
+ newStr.substring(i + match.length());
i = newStr.indexOf(match);
}
return newStr;
} } | public class class_name {
public static String replaceAll(String str, String match, String replacement) {
String newStr = str;
int i = newStr.indexOf(match);
while (i >= 0) {
newStr = newStr.substring(0, i) + replacement
+ newStr.substring(i + match.length());
// depends on control dependency: [while], data = [none]
i = newStr.indexOf(match);
// depends on control dependency: [while], data = [none]
}
return newStr;
} } |
public class class_name {
public String getMimetype(String fileName) {
int lastPeriodIndex = fileName.lastIndexOf(".");
if (lastPeriodIndex > 0 && lastPeriodIndex + 1 < fileName.length()) {
String ext = fileName.substring(lastPeriodIndex + 1).toLowerCase();
if (extensionToMimetypeMap.keySet().contains(ext)) {
String mimetype = (String) extensionToMimetypeMap.get(ext);
if (log.isDebugEnabled()) {
log.debug("Recognised extension '" + ext + "', mimetype is: '" + mimetype + "'");
}
return mimetype;
} else {
if (log.isDebugEnabled()) {
log.debug("Extension '" + ext + "' is unrecognized in mime type listing" +
", using default mime type: '" + MIMETYPE_OCTET_STREAM + "'");
}
}
} else {
if (log.isDebugEnabled()) {
log.debug("File name has no extension, mime type cannot be recognised for: " + fileName);
}
}
return MIMETYPE_OCTET_STREAM;
} } | public class class_name {
public String getMimetype(String fileName) {
int lastPeriodIndex = fileName.lastIndexOf(".");
if (lastPeriodIndex > 0 && lastPeriodIndex + 1 < fileName.length()) {
String ext = fileName.substring(lastPeriodIndex + 1).toLowerCase();
if (extensionToMimetypeMap.keySet().contains(ext)) {
String mimetype = (String) extensionToMimetypeMap.get(ext);
if (log.isDebugEnabled()) {
log.debug("Recognised extension '" + ext + "', mimetype is: '" + mimetype + "'"); // depends on control dependency: [if], data = [none]
}
return mimetype; // depends on control dependency: [if], data = [none]
} else {
if (log.isDebugEnabled()) {
log.debug("Extension '" + ext + "' is unrecognized in mime type listing" +
", using default mime type: '" + MIMETYPE_OCTET_STREAM + "'"); // depends on control dependency: [if], data = [none]
}
}
} else {
if (log.isDebugEnabled()) {
log.debug("File name has no extension, mime type cannot be recognised for: " + fileName); // depends on control dependency: [if], data = [none]
}
}
return MIMETYPE_OCTET_STREAM;
} } |
public class class_name {
public HttpSessionsSite getHttpSessionsSite(String site, boolean createIfNeeded) {
// Add a default port
if (!site.contains(":")) {
site = site + (":80");
}
synchronized (sessionLock) {
if (sessions == null) {
if (!createIfNeeded) {
return null;
}
sessions = new HashMap<>();
}
HttpSessionsSite hss = sessions.get(site);
if (hss == null) {
if (!createIfNeeded)
return null;
hss = new HttpSessionsSite(this, site);
sessions.put(site, hss);
}
return hss;
}
} } | public class class_name {
public HttpSessionsSite getHttpSessionsSite(String site, boolean createIfNeeded) {
// Add a default port
if (!site.contains(":")) {
site = site + (":80"); // depends on control dependency: [if], data = [none]
}
synchronized (sessionLock) {
if (sessions == null) {
if (!createIfNeeded) {
return null; // depends on control dependency: [if], data = [none]
}
sessions = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
HttpSessionsSite hss = sessions.get(site);
if (hss == null) {
if (!createIfNeeded)
return null;
hss = new HttpSessionsSite(this, site); // depends on control dependency: [if], data = [none]
sessions.put(site, hss); // depends on control dependency: [if], data = [none]
}
return hss;
}
} } |
public class class_name {
private void visitCall(AmbiguatedFunctionSummary callerInfo, Node invocation) {
// Handle special cases (Math, RegExp)
// TODO: This logic can probably be replaced with @nosideeffects annotations in externs.
if (invocation.isCall() && !NodeUtil.functionCallHasSideEffects(invocation, compiler)) {
return;
}
// Handle known cases now (Object, Date, RegExp, etc)
if (invocation.isNew() && !NodeUtil.constructorCallHasSideEffects(invocation)) {
return;
}
List<AmbiguatedFunctionSummary> calleeSummaries = getSummariesForCallee(invocation);
if (calleeSummaries.isEmpty()) {
callerInfo.setAllFlags();
return;
}
for (AmbiguatedFunctionSummary calleeInfo : calleeSummaries) {
SideEffectPropagation edge = SideEffectPropagation.forInvocation(invocation);
reverseCallGraph.connect(calleeInfo.graphNode, edge, callerInfo.graphNode);
}
} } | public class class_name {
private void visitCall(AmbiguatedFunctionSummary callerInfo, Node invocation) {
// Handle special cases (Math, RegExp)
// TODO: This logic can probably be replaced with @nosideeffects annotations in externs.
if (invocation.isCall() && !NodeUtil.functionCallHasSideEffects(invocation, compiler)) {
return; // depends on control dependency: [if], data = [none]
}
// Handle known cases now (Object, Date, RegExp, etc)
if (invocation.isNew() && !NodeUtil.constructorCallHasSideEffects(invocation)) {
return; // depends on control dependency: [if], data = [none]
}
List<AmbiguatedFunctionSummary> calleeSummaries = getSummariesForCallee(invocation);
if (calleeSummaries.isEmpty()) {
callerInfo.setAllFlags(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (AmbiguatedFunctionSummary calleeInfo : calleeSummaries) {
SideEffectPropagation edge = SideEffectPropagation.forInvocation(invocation);
reverseCallGraph.connect(calleeInfo.graphNode, edge, callerInfo.graphNode); // depends on control dependency: [for], data = [calleeInfo]
}
} } |
public class class_name {
@Nullable
public final EnhancedMimeType getMetaContentType() {
if ((metaContentType == null) && (metaContentTypeStr != null)) {
metaContentType = EnhancedMimeType.create(metaContentTypeStr);
}
return metaContentType;
} } | public class class_name {
@Nullable
public final EnhancedMimeType getMetaContentType() {
if ((metaContentType == null) && (metaContentTypeStr != null)) {
metaContentType = EnhancedMimeType.create(metaContentTypeStr); // depends on control dependency: [if], data = [none]
}
return metaContentType;
} } |
public class class_name {
public String getLayer()
{
String str = null;
if ((layer >= 0) && (layer < layerLabels.length))
{
str = layerLabels[layer];
}
return str;
} } | public class class_name {
public String getLayer()
{
String str = null;
if ((layer >= 0) && (layer < layerLabels.length))
{
str = layerLabels[layer]; // depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
public final void removeExpired() {
mapLock.lock();
Iterator<Entry<String, TimestampedCacheEntry<DOReader>>> entries = cacheMap.entrySet().iterator();
if (entries.hasNext()) {
long now = System.currentTimeMillis();
while (entries.hasNext()) {
Entry<String, TimestampedCacheEntry<DOReader>> entry = entries.next();
TimestampedCacheEntry<DOReader> e = entry.getValue();
long age = e.ageAt(now);
if (age > (maxSeconds * 1000)) {
entries.remove();
String pid = entry.getKey();
LOG.debug("removing entry {} after {} milliseconds",
pid, age);
}
}
}
mapLock.unlock();
} } | public class class_name {
public final void removeExpired() {
mapLock.lock();
Iterator<Entry<String, TimestampedCacheEntry<DOReader>>> entries = cacheMap.entrySet().iterator();
if (entries.hasNext()) {
long now = System.currentTimeMillis();
while (entries.hasNext()) {
Entry<String, TimestampedCacheEntry<DOReader>> entry = entries.next();
TimestampedCacheEntry<DOReader> e = entry.getValue();
long age = e.ageAt(now);
if (age > (maxSeconds * 1000)) {
entries.remove(); // depends on control dependency: [if], data = [none]
String pid = entry.getKey();
LOG.debug("removing entry {} after {} milliseconds",
pid, age); // depends on control dependency: [if], data = [none]
}
}
}
mapLock.unlock();
} } |
public class class_name {
public static synchronized Properties getProperties(String resourceName)
{
/*log.fine("public static synchronized Properties getProperties(String resourceName): called");*/
/*log.fine("resourceName = " + resourceName);*/
// Try to find an already created singleton property reader for the resource
PropertyReaderBase propertyReader = (PropertyReaderBase) propertyReaders.get(resourceName);
if (propertyReader != null)
{
/*log.fine("found property reader in the cache for resource: " + resourceName);*/
return propertyReader.getProperties();
}
/*log.fine("did not find property reader in the cache for resource: " + resourceName);*/
// There is not already a singleton for the named resource so create a new one
propertyReader = new DefaultPropertyReader(resourceName);
// Keep the newly created singleton for next time
propertyReaders.put(resourceName, propertyReader);
return propertyReader.getProperties();
} } | public class class_name {
public static synchronized Properties getProperties(String resourceName)
{
/*log.fine("public static synchronized Properties getProperties(String resourceName): called");*/
/*log.fine("resourceName = " + resourceName);*/
// Try to find an already created singleton property reader for the resource
PropertyReaderBase propertyReader = (PropertyReaderBase) propertyReaders.get(resourceName);
if (propertyReader != null)
{
/*log.fine("found property reader in the cache for resource: " + resourceName);*/
return propertyReader.getProperties(); // depends on control dependency: [if], data = [none]
}
/*log.fine("did not find property reader in the cache for resource: " + resourceName);*/
// There is not already a singleton for the named resource so create a new one
propertyReader = new DefaultPropertyReader(resourceName);
// Keep the newly created singleton for next time
propertyReaders.put(resourceName, propertyReader);
return propertyReader.getProperties();
} } |
public class class_name {
public static boolean contains(float[] array, float value, float delta) {
for (int i=0; i<array.length; i++) {
if (Primitives.equals(array[i], value, delta)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean contains(float[] array, float value, float delta) {
for (int i=0; i<array.length; i++) {
if (Primitives.equals(array[i], value, delta)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private void postProcessEmbedded(Map<String, String> embNametoUDTQuery,
Map<String, List<String>> embNametoDependentList)
{
for (Map.Entry<String, List<String>> entry : embNametoDependentList.entrySet())
{
checkRelationAndExecuteQuery(entry.getKey(), embNametoDependentList, embNametoUDTQuery);
}
} } | public class class_name {
private void postProcessEmbedded(Map<String, String> embNametoUDTQuery,
Map<String, List<String>> embNametoDependentList)
{
for (Map.Entry<String, List<String>> entry : embNametoDependentList.entrySet())
{
checkRelationAndExecuteQuery(entry.getKey(), embNametoDependentList, embNametoUDTQuery); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public void setCustomColors(final boolean CUSTOM_COLORS) {
customColors = CUSTOM_COLORS;
if (customColors) {
init(getInnerBounds().width, getInnerBounds().height);
repaint(getInnerBounds());
}
} } | public class class_name {
public void setCustomColors(final boolean CUSTOM_COLORS) {
customColors = CUSTOM_COLORS;
if (customColors) {
init(getInnerBounds().width, getInnerBounds().height); // depends on control dependency: [if], data = [none]
repaint(getInnerBounds()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void cancelAllSuperToasts() {
removeMessages(Messages.SHOW_NEXT);
removeMessages(Messages.DISPLAY_SUPERTOAST);
removeMessages(Messages.REMOVE_SUPERTOAST);
// Iterate through the Queue, polling and removing everything
for (SuperToast superToast : superToastPriorityQueue) {
if (superToast instanceof SuperActivityToast) {
if (superToast.isShowing()) {
try{
((SuperActivityToast) superToast).getViewGroup().removeView(superToast.getView());
((SuperActivityToast) superToast).getViewGroup().invalidate();
} catch (NullPointerException|IllegalStateException exception) {
Log.e(getClass().getName(), exception.toString());
}
}
} else {
final WindowManager windowManager = (WindowManager) superToast.getContext()
.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
if (superToast.isShowing()) {
try{
windowManager.removeView(superToast.getView());
} catch (NullPointerException|IllegalArgumentException exception) {
Log.e(getClass().getName(), exception.toString());
}
}
}
}
superToastPriorityQueue.clear();
} } | public class class_name {
void cancelAllSuperToasts() {
removeMessages(Messages.SHOW_NEXT);
removeMessages(Messages.DISPLAY_SUPERTOAST);
removeMessages(Messages.REMOVE_SUPERTOAST);
// Iterate through the Queue, polling and removing everything
for (SuperToast superToast : superToastPriorityQueue) {
if (superToast instanceof SuperActivityToast) {
if (superToast.isShowing()) {
try{
((SuperActivityToast) superToast).getViewGroup().removeView(superToast.getView());
// depends on control dependency: [try], data = [none]
((SuperActivityToast) superToast).getViewGroup().invalidate();
// depends on control dependency: [try], data = [none]
} catch (NullPointerException|IllegalStateException exception) {
Log.e(getClass().getName(), exception.toString());
}
// depends on control dependency: [catch], data = [none]
}
} else {
final WindowManager windowManager = (WindowManager) superToast.getContext()
.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
if (superToast.isShowing()) {
try{
windowManager.removeView(superToast.getView());
// depends on control dependency: [try], data = [none]
} catch (NullPointerException|IllegalArgumentException exception) {
Log.e(getClass().getName(), exception.toString());
}
// depends on control dependency: [catch], data = [none]
}
}
}
superToastPriorityQueue.clear();
} } |
public class class_name {
public static String joinAsString( Object[] objects, String separator )
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < objects.length; i++)
{
Object element = objects[i];
result.append( String.valueOf( element ) );
if (i < objects.length - 1) result.append( separator );
}
return result.toString();
} } | public class class_name {
public static String joinAsString( Object[] objects, String separator )
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < objects.length; i++)
{
Object element = objects[i];
result.append( String.valueOf( element ) ); // depends on control dependency: [for], data = [none]
if (i < objects.length - 1) result.append( separator );
}
return result.toString();
} } |
public class class_name {
public <T> FluentValidator onEach(Collection<T> t) {
if (CollectionUtil.isEmpty(t)) {
lastAddCount = 0;
return this;
}
MultiValidatorElement multiValidatorElement = null;
for (T element : t) {
multiValidatorElement = doOn(element);
lastAddCount += multiValidatorElement.size();
}
LOGGER.debug(
String.format("Total %d of %s will be performed", t.size(), multiValidatorElement));
return this;
} } | public class class_name {
public <T> FluentValidator onEach(Collection<T> t) {
if (CollectionUtil.isEmpty(t)) {
lastAddCount = 0; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
}
MultiValidatorElement multiValidatorElement = null;
for (T element : t) {
multiValidatorElement = doOn(element); // depends on control dependency: [for], data = [element]
lastAddCount += multiValidatorElement.size(); // depends on control dependency: [for], data = [none]
}
LOGGER.debug(
String.format("Total %d of %s will be performed", t.size(), multiValidatorElement));
return this;
} } |
public class class_name {
public static long copy(
final InputStream input,
final OutputStream output
)
throws IOException
{
_LOG_.debug( "begin copy" );
@SuppressWarnings( "resource" )
BufferedInputStream b_input = (BufferedInputStream.class.isInstance( input )
? BufferedInputStream.class.cast( input )
: new BufferedInputStream( input ));
@SuppressWarnings( "resource" )
BufferedOutputStream b_output = (BufferedOutputStream.class.isInstance( output )
? BufferedOutputStream.class.cast( output )
: new BufferedOutputStream( output ));
byte[] buffer = new byte[512];
long size = 0;
try {
while (true) {
int n = b_input.read( buffer );
//@throws IOException
if (n == -1) {
break;
}
b_output.write( buffer, 0, n );
//@throws IOException
size += n;
}
} finally {
try {
b_output.flush();
} catch (Exception ex) {
//ignorable
}
}
_LOG_.debug( "end copy: #bytes=" + size );
return size;
} } | public class class_name {
public static long copy(
final InputStream input,
final OutputStream output
)
throws IOException
{
_LOG_.debug( "begin copy" );
@SuppressWarnings( "resource" )
BufferedInputStream b_input = (BufferedInputStream.class.isInstance( input )
? BufferedInputStream.class.cast( input )
: new BufferedInputStream( input ));
@SuppressWarnings( "resource" )
BufferedOutputStream b_output = (BufferedOutputStream.class.isInstance( output )
? BufferedOutputStream.class.cast( output )
: new BufferedOutputStream( output ));
byte[] buffer = new byte[512];
long size = 0;
try {
while (true) {
int n = b_input.read( buffer );
//@throws IOException
if (n == -1) {
break;
}
b_output.write( buffer, 0, n ); // depends on control dependency: [while], data = [none]
//@throws IOException
size += n; // depends on control dependency: [while], data = [none]
}
} finally {
try {
b_output.flush(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
//ignorable
} // depends on control dependency: [catch], data = [none]
}
_LOG_.debug( "end copy: #bytes=" + size );
return size;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected static boolean sameType(Collection[] cols) {
List all = new LinkedList();
for (Collection col : cols) {
all.addAll(col);
}
if (all.isEmpty())
return true;
Object first = all.get(0);
//trying to determine the base class of the collections
//special case for Numbers
Class baseClass;
if (first instanceof Number) {
baseClass = Number.class;
} else if (first == null) {
baseClass = NullObject.class;
} else {
baseClass = first.getClass();
}
for (Collection col : cols) {
for (Object o : col) {
if (!baseClass.isInstance(o)) {
return false;
}
}
}
return true;
} } | public class class_name {
@SuppressWarnings("unchecked")
protected static boolean sameType(Collection[] cols) {
List all = new LinkedList();
for (Collection col : cols) {
all.addAll(col); // depends on control dependency: [for], data = [col]
}
if (all.isEmpty())
return true;
Object first = all.get(0);
//trying to determine the base class of the collections
//special case for Numbers
Class baseClass;
if (first instanceof Number) {
baseClass = Number.class; // depends on control dependency: [if], data = [none]
} else if (first == null) {
baseClass = NullObject.class; // depends on control dependency: [if], data = [none]
} else {
baseClass = first.getClass(); // depends on control dependency: [if], data = [none]
}
for (Collection col : cols) {
for (Object o : col) {
if (!baseClass.isInstance(o)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
protected T loginViaBasicAuth(final HttpServletRequest servletRequest) {
final String username = ServletUtil.resolveAuthUsername(servletRequest);
if (username == null) {
return null;
}
final String password = ServletUtil.resolveAuthPassword(servletRequest);
return userAuth.login(username, password);
} } | public class class_name {
protected T loginViaBasicAuth(final HttpServletRequest servletRequest) {
final String username = ServletUtil.resolveAuthUsername(servletRequest);
if (username == null) {
return null; // depends on control dependency: [if], data = [none]
}
final String password = ServletUtil.resolveAuthPassword(servletRequest);
return userAuth.login(username, password);
} } |
public class class_name {
@Override
void analyzeWords(AnalyzedText aText) {
FastList<String> list = new FastList<String>();
FastSet<String> set = new FastSet<String>();
com.chenlb.mmseg4j.Word word = null;
Reader sr = new StringReader(aText.getText());
synchronized(mmSeg){
mmSeg.reset(sr);
try{
while((word=mmSeg.next())!=null) {
String w = word.getString();
list.add(w);
set.add(w);
}
}catch(IOException e){
throw new RuntimeException("IOException occurred", e);
}
}
aText.setWords(list);
aText.setUniqueWords(set);
} } | public class class_name {
@Override
void analyzeWords(AnalyzedText aText) {
FastList<String> list = new FastList<String>();
FastSet<String> set = new FastSet<String>();
com.chenlb.mmseg4j.Word word = null;
Reader sr = new StringReader(aText.getText());
synchronized(mmSeg){
mmSeg.reset(sr);
try{
while((word=mmSeg.next())!=null) {
String w = word.getString();
list.add(w);
// depends on control dependency: [while], data = [none]
set.add(w);
// depends on control dependency: [while], data = [none]
}
}catch(IOException e){
throw new RuntimeException("IOException occurred", e);
}
// depends on control dependency: [catch], data = [none]
}
aText.setWords(list);
aText.setUniqueWords(set);
} } |
public class class_name {
private Expr parseAdditiveExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseMultiplicativeExpression(scope, terminated);
Token lookahead;
while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
Expr rhs = parseMultiplicativeExpression(scope, terminated);
switch (lookahead.kind) {
case Plus:
lhs = new Expr.IntegerAddition(Type.Void, lhs, rhs);
break;
case Minus:
lhs = new Expr.IntegerSubtraction(Type.Void, lhs, rhs);
break;
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs, start);
}
return lhs;
} } | public class class_name {
private Expr parseAdditiveExpression(EnclosingScope scope, boolean terminated) {
int start = index;
Expr lhs = parseMultiplicativeExpression(scope, terminated);
Token lookahead;
while ((lookahead = tryAndMatch(terminated, Plus, Minus)) != null) {
Expr rhs = parseMultiplicativeExpression(scope, terminated);
switch (lookahead.kind) {
case Plus:
lhs = new Expr.IntegerAddition(Type.Void, lhs, rhs);
break;
case Minus:
lhs = new Expr.IntegerSubtraction(Type.Void, lhs, rhs);
break;
default:
throw new RuntimeException("deadcode"); // dead-code
}
lhs = annotateSourceLocation(lhs, start); // depends on control dependency: [while], data = [none]
}
return lhs;
} } |
public class class_name {
public static Object parse(final String s, final BSONCallback c) {
if (s == null || (s.trim()).equals("")) {
return null;
}
JSONParser p = new JSONParser(s, c);
return p.parse();
} } | public class class_name {
public static Object parse(final String s, final BSONCallback c) {
if (s == null || (s.trim()).equals("")) {
return null; // depends on control dependency: [if], data = [none]
}
JSONParser p = new JSONParser(s, c);
return p.parse();
} } |
public class class_name {
protected void completeSarlEvents(boolean allowEventType, boolean isExtensionFilter, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
if (isSarlProposalEnabled()) {
completeSubJavaTypes(Event.class, allowEventType, context,
TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
getQualifiedNameValueConverter(),
isExtensionFilter ? createExtensionFilter(context, IJavaSearchConstants.CLASS)
: createVisibilityFilter(context, IJavaSearchConstants.CLASS), acceptor);
}
} } | public class class_name {
protected void completeSarlEvents(boolean allowEventType, boolean isExtensionFilter, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
if (isSarlProposalEnabled()) {
completeSubJavaTypes(Event.class, allowEventType, context,
TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
getQualifiedNameValueConverter(),
isExtensionFilter ? createExtensionFilter(context, IJavaSearchConstants.CLASS)
: createVisibilityFilter(context, IJavaSearchConstants.CLASS), acceptor); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void processInternalListeners() {
List<Class<?>> internalListeners = getAllInternalListeners();
for (Class<?> internalListener : internalListeners) {
processInternalListener(internalListener);
}
} } | public class class_name {
private void processInternalListeners() {
List<Class<?>> internalListeners = getAllInternalListeners();
for (Class<?> internalListener : internalListeners) {
processInternalListener(internalListener); // depends on control dependency: [for], data = [internalListener]
}
} } |
public class class_name {
private void reusePropertyNames(Set<String> reservedNames,
Collection<Property> allProps) {
for (Property prop : allProps) {
// Check if this node can reuse a name from a previous compilation - if
// it can set the newName for the property too.
String prevName = prevUsedPropertyMap.lookupNewName(prop.oldName);
if (!generatePseudoNames && prevName != null) {
// We can reuse prevName if it's not reserved.
if (reservedNames.contains(prevName)) {
continue;
}
prop.newName = prevName;
reservedNames.add(prevName);
}
}
} } | public class class_name {
private void reusePropertyNames(Set<String> reservedNames,
Collection<Property> allProps) {
for (Property prop : allProps) {
// Check if this node can reuse a name from a previous compilation - if
// it can set the newName for the property too.
String prevName = prevUsedPropertyMap.lookupNewName(prop.oldName);
if (!generatePseudoNames && prevName != null) {
// We can reuse prevName if it's not reserved.
if (reservedNames.contains(prevName)) {
continue;
}
prop.newName = prevName; // depends on control dependency: [if], data = [none]
reservedNames.add(prevName); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>> getNetworkFetchSequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence");
}
if (mNetworkFetchSequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence:init");
}
mNetworkFetchSequence =
newBitmapCacheGetToDecodeSequence(getCommonNetworkFetchToEncodedMemorySequence());
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return mNetworkFetchSequence;
} } | public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>> getNetworkFetchSequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence"); // depends on control dependency: [if], data = [none]
}
if (mNetworkFetchSequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ProducerSequenceFactory#getNetworkFetchSequence:init"); // depends on control dependency: [if], data = [none]
}
mNetworkFetchSequence =
newBitmapCacheGetToDecodeSequence(getCommonNetworkFetchToEncodedMemorySequence()); // depends on control dependency: [if], data = [none]
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
return mNetworkFetchSequence;
} } |
public class class_name {
public String getString(Map<String, Object> data, String attr) {
Object value = data.get(attr);
if (null == value) { return null; }
if (!value.getClass().isArray()) { return value.toString(); }
String[] values = (String[]) value;
if (values.length == 1) {
return values[0];
} else {
return Strings.join(values, ",");
}
} } | public class class_name {
public String getString(Map<String, Object> data, String attr) {
Object value = data.get(attr);
if (null == value) { return null; } // depends on control dependency: [if], data = [none]
if (!value.getClass().isArray()) { return value.toString(); } // depends on control dependency: [if], data = [none]
String[] values = (String[]) value;
if (values.length == 1) {
return values[0]; // depends on control dependency: [if], data = [none]
} else {
return Strings.join(values, ","); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Result executeResultUpdate(Result cmd) {
long id = cmd.getResultId();
int actionType = cmd.getActionType();
Result result = sessionData.getDataResult(id);
if (result == null) {
return Result.newErrorResult(Error.error(ErrorCode.X_24501));
}
Object[] pvals = cmd.getParameterData();
Type[] types = cmd.metaData.columnTypes;
StatementQuery statement = (StatementQuery) result.getStatement();
QueryExpression qe = statement.queryExpression;
Table baseTable = qe.getBaseTable();
int[] columnMap = qe.getBaseTableColumnMap();
sessionContext.rowUpdateStatement.setRowActionProperties(actionType,
baseTable, types, columnMap);
Result resultOut =
executeCompiledStatement(sessionContext.rowUpdateStatement, pvals);
return resultOut;
} } | public class class_name {
private Result executeResultUpdate(Result cmd) {
long id = cmd.getResultId();
int actionType = cmd.getActionType();
Result result = sessionData.getDataResult(id);
if (result == null) {
return Result.newErrorResult(Error.error(ErrorCode.X_24501)); // depends on control dependency: [if], data = [none]
}
Object[] pvals = cmd.getParameterData();
Type[] types = cmd.metaData.columnTypes;
StatementQuery statement = (StatementQuery) result.getStatement();
QueryExpression qe = statement.queryExpression;
Table baseTable = qe.getBaseTable();
int[] columnMap = qe.getBaseTableColumnMap();
sessionContext.rowUpdateStatement.setRowActionProperties(actionType,
baseTable, types, columnMap);
Result resultOut =
executeCompiledStatement(sessionContext.rowUpdateStatement, pvals);
return resultOut;
} } |
public class class_name {
public String getFromRemote(String uri){
// clear cache
fileSystem.getFilesCache().close();
String remoteContent ;
String remoteEncoding = "utf-8";
log.debug("getFromRemote: Loading remote URI=" + uri);
FileContent fileContent ;
try {
FileSystemOptions fsOptions = new FileSystemOptions();
// set userAgent
HttpFileSystemConfigBuilder.getInstance().setUserAgent(fsOptions, userAgent);
// set cookie if cookies set
if (0 < this.cookies.size()) {
HttpFileSystemConfigBuilder.getInstance().setCookies(fsOptions, getCookies(uri));
}
log.debug("getFromRemote: userAgent=" + userAgent);
log.debug("getFromRemote: cookieSize=" + cookies.size());
log.debug("getFromRemote: cookies=" + cookies.toString());
fileContent = fileSystem.resolveFile(uri, fsOptions).getContent();
// 2016-03-22 only pure http/https auto detect encoding
if ("http".equalsIgnoreCase(uri.substring(0, 4))) {
fileContent.getSize(); // pass a bug {@link https://issues.apache.org/jira/browse/VFS-427}
remoteEncoding = fileContent.getContentInfo().getContentEncoding();
}
log.debug("getFromRemote: remoteEncoding=" + remoteEncoding + "(auto detect) ");
// 2016-03-21 修正zip file getContentEncoding 為null
if (null == remoteEncoding) remoteEncoding = "utf-8";
if (!"utf".equalsIgnoreCase(remoteEncoding.substring(0, 3))) {
log.debug("getFromRemote: remote content encoding=" + remoteEncoding);
// force charset encoding if setRemoteEncoding set
if (!"utf".equalsIgnoreCase(encoding.substring(0, 3))) {
remoteEncoding = encoding;
} else {
// auto detecting encoding
remoteEncoding = detectCharset(IOUtils.toByteArray(fileContent.getInputStream()));
log.debug("getFromRemote: real encoding=" + remoteEncoding);
}
}
// 透過 Apache VFS 取回指定的遠端資料
// 2016-02-29 fixed
remoteContent = IOUtils.toString(fileContent.getInputStream(), remoteEncoding);
} catch(FileSystemException fse){
log.warn("getFromRemote: FileSystemException=" + fse.getMessage());
remoteContent =null;
}catch(IOException ioe){
// return empty
log.warn("getFromRemote: IOException=" + ioe.getMessage());
remoteContent =null;
}catch(StringIndexOutOfBoundsException stre){
log.warn("getFromRemote: StringIndexOutOfBoundsException=" + stre.getMessage());
log.warn("getFromRemote: uri=" + uri );
log.warn(stre.getMessage());
remoteContent =null;
}
clearCookies();
log.debug("getFromRemote: remoteContent=\n" + remoteContent);
// any exception will return "null"
return remoteContent;
} } | public class class_name {
public String getFromRemote(String uri){
// clear cache
fileSystem.getFilesCache().close();
String remoteContent ;
String remoteEncoding = "utf-8";
log.debug("getFromRemote: Loading remote URI=" + uri);
FileContent fileContent ;
try {
FileSystemOptions fsOptions = new FileSystemOptions();
// set userAgent
HttpFileSystemConfigBuilder.getInstance().setUserAgent(fsOptions, userAgent); // depends on control dependency: [try], data = [none]
// set cookie if cookies set
if (0 < this.cookies.size()) {
HttpFileSystemConfigBuilder.getInstance().setCookies(fsOptions, getCookies(uri)); // depends on control dependency: [if], data = [none]
}
log.debug("getFromRemote: userAgent=" + userAgent); // depends on control dependency: [try], data = [none]
log.debug("getFromRemote: cookieSize=" + cookies.size()); // depends on control dependency: [try], data = [none]
log.debug("getFromRemote: cookies=" + cookies.toString()); // depends on control dependency: [try], data = [none]
fileContent = fileSystem.resolveFile(uri, fsOptions).getContent(); // depends on control dependency: [try], data = [none]
// 2016-03-22 only pure http/https auto detect encoding
if ("http".equalsIgnoreCase(uri.substring(0, 4))) {
fileContent.getSize(); // pass a bug {@link https://issues.apache.org/jira/browse/VFS-427} // depends on control dependency: [if], data = [none]
remoteEncoding = fileContent.getContentInfo().getContentEncoding(); // depends on control dependency: [if], data = [none]
}
log.debug("getFromRemote: remoteEncoding=" + remoteEncoding + "(auto detect) ");
// 2016-03-21 修正zip file getContentEncoding 為null
if (null == remoteEncoding) remoteEncoding = "utf-8";
if (!"utf".equalsIgnoreCase(remoteEncoding.substring(0, 3))) {
log.debug("getFromRemote: remote content encoding=" + remoteEncoding); // depends on control dependency: [try], data = [none]
// force charset encoding if setRemoteEncoding set
if (!"utf".equalsIgnoreCase(encoding.substring(0, 3))) {
remoteEncoding = encoding; // depends on control dependency: [if], data = [none]
} else {
// auto detecting encoding
remoteEncoding = detectCharset(IOUtils.toByteArray(fileContent.getInputStream())); // depends on control dependency: [if], data = [none]
log.debug("getFromRemote: real encoding=" + remoteEncoding); // depends on control dependency: [if], data = [none]
}
}
// 透過 Apache VFS 取回指定的遠端資料
// 2016-02-29 fixed
remoteContent = IOUtils.toString(fileContent.getInputStream(), remoteEncoding);
} catch(FileSystemException fse){
log.warn("getFromRemote: FileSystemException=" + fse.getMessage());
remoteContent =null;
}catch(IOException ioe){ // depends on control dependency: [catch], data = [none]
// return empty
log.warn("getFromRemote: IOException=" + ioe.getMessage());
remoteContent =null;
}catch(StringIndexOutOfBoundsException stre){ // depends on control dependency: [catch], data = [none]
log.warn("getFromRemote: StringIndexOutOfBoundsException=" + stre.getMessage());
log.warn("getFromRemote: uri=" + uri );
log.warn(stre.getMessage());
remoteContent =null;
} // depends on control dependency: [catch], data = [none]
clearCookies();
log.debug("getFromRemote: remoteContent=\n" + remoteContent);
// any exception will return "null"
return remoteContent;
} } |
public class class_name {
protected void addItemView(View itemView, int childIndex) {
final ViewGroup currentParent = (ViewGroup) itemView.getParent();
if (currentParent != null) {
currentParent.removeView(itemView);
}
((ViewGroup) mMenuView).addView(itemView, childIndex);
} } | public class class_name {
protected void addItemView(View itemView, int childIndex) {
final ViewGroup currentParent = (ViewGroup) itemView.getParent();
if (currentParent != null) {
currentParent.removeView(itemView); // depends on control dependency: [if], data = [none]
}
((ViewGroup) mMenuView).addView(itemView, childIndex);
} } |
public class class_name {
public java.util.List<String> getConfigurationRecorderNames() {
if (configurationRecorderNames == null) {
configurationRecorderNames = new com.amazonaws.internal.SdkInternalList<String>();
}
return configurationRecorderNames;
} } | public class class_name {
public java.util.List<String> getConfigurationRecorderNames() {
if (configurationRecorderNames == null) {
configurationRecorderNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return configurationRecorderNames;
} } |
public class class_name {
public static MongoDS getDS(String host, int port) {
final String key = host + ":" + port;
MongoDS ds = dsMap.get(key);
if (null == ds) {
// 没有在池中加入之
ds = new MongoDS(host, port);
dsMap.put(key, ds);
}
return ds;
} } | public class class_name {
public static MongoDS getDS(String host, int port) {
final String key = host + ":" + port;
MongoDS ds = dsMap.get(key);
if (null == ds) {
// 没有在池中加入之
ds = new MongoDS(host, port);
// depends on control dependency: [if], data = [none]
dsMap.put(key, ds);
// depends on control dependency: [if], data = [ds)]
}
return ds;
} } |
public class class_name {
protected final void addUserTag(String name, URL source)
{
if (_strictJsf2FaceletsCompatibility == null)
{
MyfacesConfig config = MyfacesConfig.getCurrentInstance(
FacesContext.getCurrentInstance().getExternalContext());
_strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility();
}
if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility))
{
_factories.put(name, new LegacyUserTagFactory(source));
}
else
{
_factories.put(name, new UserTagFactory(source));
}
} } | public class class_name {
protected final void addUserTag(String name, URL source)
{
if (_strictJsf2FaceletsCompatibility == null)
{
MyfacesConfig config = MyfacesConfig.getCurrentInstance(
FacesContext.getCurrentInstance().getExternalContext());
_strictJsf2FaceletsCompatibility = config.isStrictJsf2FaceletsCompatibility(); // depends on control dependency: [if], data = [none]
}
if (Boolean.TRUE.equals(_strictJsf2FaceletsCompatibility))
{
_factories.put(name, new LegacyUserTagFactory(source)); // depends on control dependency: [if], data = [none]
}
else
{
_factories.put(name, new UserTagFactory(source)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public User getLoggedInUser() {
User user = null;
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
final Object principal = authentication.getPrincipal();
// principal can be "anonymousUser" (String)
if (principal instanceof UserDetails) {
user = userDetailsConverter.convert((UserDetails) principal);
}
}
return user;
} } | public class class_name {
public User getLoggedInUser() {
User user = null;
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
final Object principal = authentication.getPrincipal();
// principal can be "anonymousUser" (String)
if (principal instanceof UserDetails) {
user = userDetailsConverter.convert((UserDetails) principal); // depends on control dependency: [if], data = [none]
}
}
return user;
} } |
public class class_name {
public static List<AvPair> decode ( byte[] data ) throws CIFSException {
List<AvPair> pairs = new LinkedList<>();
int pos = 0;
boolean foundEnd = false;
while ( pos + 4 <= data.length ) {
int avId = SMBUtil.readInt2(data, pos);
int avLen = SMBUtil.readInt2(data, pos + 2);
pos += 4;
if ( avId == AvPair.MsvAvEOL ) {
if ( avLen != 0 ) {
throw new CIFSException("Invalid avLen for AvEOL");
}
foundEnd = true;
break;
}
byte[] raw = new byte[avLen];
System.arraycopy(data, pos, raw, 0, avLen);
pairs.add(parseAvPair(avId, raw));
pos += avLen;
}
if ( !foundEnd ) {
throw new CIFSException("Missing AvEOL");
}
return pairs;
} } | public class class_name {
public static List<AvPair> decode ( byte[] data ) throws CIFSException {
List<AvPair> pairs = new LinkedList<>();
int pos = 0;
boolean foundEnd = false;
while ( pos + 4 <= data.length ) {
int avId = SMBUtil.readInt2(data, pos);
int avLen = SMBUtil.readInt2(data, pos + 2);
pos += 4;
if ( avId == AvPair.MsvAvEOL ) {
if ( avLen != 0 ) {
throw new CIFSException("Invalid avLen for AvEOL");
}
foundEnd = true; // depends on control dependency: [if], data = [none]
break;
}
byte[] raw = new byte[avLen];
System.arraycopy(data, pos, raw, 0, avLen);
pairs.add(parseAvPair(avId, raw));
pos += avLen;
}
if ( !foundEnd ) {
throw new CIFSException("Missing AvEOL");
}
return pairs;
} } |
public class class_name {
public static List<Object> getAlignedUserCollection(String sequence) {
List<Object> aligned = new ArrayList<Object>(sequence.length());
for (char c : sequence.toCharArray()) {
aligned.add(Character.isUpperCase(c));
}
return aligned;
} } | public class class_name {
public static List<Object> getAlignedUserCollection(String sequence) {
List<Object> aligned = new ArrayList<Object>(sequence.length());
for (char c : sequence.toCharArray()) {
aligned.add(Character.isUpperCase(c)); // depends on control dependency: [for], data = [c]
}
return aligned;
} } |
public class class_name {
public CollectionResult<double[]> run(Database database, Relation<O> relation, Relation<?> lrelation) {
final DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
final int qk = k + (includeSelf ? 0 : 1);
final KNNQuery<O> knnQuery = database.getKNNQuery(distQuery, qk);
MeanVarianceMinMax[] mvs = MeanVarianceMinMax.newArray(k);
final DBIDs ids = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random);
FiniteProgress objloop = LOG.isVerbose() ? new FiniteProgress("Computing nearest neighbors", ids.size(), LOG) : null;
// sort neighbors
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
KNNList knn = knnQuery.getKNNForDBID(iter, qk);
Object label = lrelation.get(iter);
int positive = 0, i = 0;
for(DBIDIter ri = knn.iter(); i < k && ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(iter, ri)) {
// Do not increment i.
continue;
}
positive += match(label, lrelation.get(ri)) ? 1 : 0;
final double precision = positive / (double) (i + 1);
mvs[i].put(precision);
i++;
}
LOG.incrementProcessed(objloop);
}
LOG.ensureCompleted(objloop);
// Transform Histogram into a Double Vector array.
Collection<double[]> res = new ArrayList<>(k);
for(int i = 0; i < k; i++) {
final MeanVarianceMinMax mv = mvs[i];
final double std = mv.getCount() > 1. ? mv.getSampleStddev() : 0.;
res.add(new double[] { i + 1, mv.getMean(), std, mv.getMin(), mv.getMax(), mv.getCount() });
}
return new CollectionResult<>("Average Precision", "average-precision", res);
} } | public class class_name {
public CollectionResult<double[]> run(Database database, Relation<O> relation, Relation<?> lrelation) {
final DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
final int qk = k + (includeSelf ? 0 : 1);
final KNNQuery<O> knnQuery = database.getKNNQuery(distQuery, qk);
MeanVarianceMinMax[] mvs = MeanVarianceMinMax.newArray(k);
final DBIDs ids = DBIDUtil.randomSample(relation.getDBIDs(), sampling, random);
FiniteProgress objloop = LOG.isVerbose() ? new FiniteProgress("Computing nearest neighbors", ids.size(), LOG) : null;
// sort neighbors
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
KNNList knn = knnQuery.getKNNForDBID(iter, qk);
Object label = lrelation.get(iter);
int positive = 0, i = 0;
for(DBIDIter ri = knn.iter(); i < k && ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(iter, ri)) {
// Do not increment i.
continue;
}
positive += match(label, lrelation.get(ri)) ? 1 : 0; // depends on control dependency: [for], data = [ri]
final double precision = positive / (double) (i + 1);
mvs[i].put(precision); // depends on control dependency: [for], data = [none]
i++; // depends on control dependency: [for], data = [none]
}
LOG.incrementProcessed(objloop); // depends on control dependency: [for], data = [none]
}
LOG.ensureCompleted(objloop);
// Transform Histogram into a Double Vector array.
Collection<double[]> res = new ArrayList<>(k);
for(int i = 0; i < k; i++) {
final MeanVarianceMinMax mv = mvs[i];
final double std = mv.getCount() > 1. ? mv.getSampleStddev() : 0.;
res.add(new double[] { i + 1, mv.getMean(), std, mv.getMin(), mv.getMax(), mv.getCount() }); // depends on control dependency: [for], data = [i]
}
return new CollectionResult<>("Average Precision", "average-precision", res);
} } |
public class class_name {
@Override
public Set keySet() {
if (keySet != null) {
return keySet;
}
keySet = new AbstractSet() {
@Override
public Iterator iterator() {
return new KeyIterator();
} @Override
public int size() {
return size;
}
@Override
public boolean contains(final Object o) {
return containsKey(o);
}
@Override
public boolean remove(final Object o) {
final Object r = ReferenceMap.this.remove(o);
return r != null;
}
@Override
public void clear() {
ReferenceMap.this.clear();
}
};
return keySet;
} } | public class class_name {
@Override
public Set keySet() {
if (keySet != null) {
return keySet;
// depends on control dependency: [if], data = [none]
}
keySet = new AbstractSet() {
@Override
public Iterator iterator() {
return new KeyIterator();
} @Override
public int size() {
return size;
}
@Override
public boolean contains(final Object o) {
return containsKey(o);
}
@Override
public boolean remove(final Object o) {
final Object r = ReferenceMap.this.remove(o);
return r != null;
}
@Override
public void clear() {
ReferenceMap.this.clear();
}
};
return keySet;
} } |
public class class_name {
public Converter getTargetField(Record record)
{
if (record == null)
{
BaseTable currentTable = m_recMerge.getTable().getCurrentTable();
if (currentTable == null)
currentTable = m_recMerge.getTable(); // First time only
record = currentTable.getRecord();
}
Converter field = null;
if (fieldName != null)
field = record.getField(fieldName); // Get the current field
else
field = record.getField(m_iFieldSeq); // Get the current field
if ((m_iSecondaryFieldSeq != -1) || (secondaryFieldName != null))
if (field instanceof ReferenceField)
if (((ReferenceField)field).getRecord() != null)
if (((ReferenceField)field).getRecord().getTable() != null) // Make sure this isn't being called in free()
{ // Special case - field in the secondary file
Record recordSecond = ((ReferenceField)field).getReferenceRecord();
if (recordSecond != null)
{
if (secondaryFieldName != null)
field = recordSecond.getField(secondaryFieldName);
else
field = recordSecond.getField(m_iSecondaryFieldSeq);
}
}
return field;
} } | public class class_name {
public Converter getTargetField(Record record)
{
if (record == null)
{
BaseTable currentTable = m_recMerge.getTable().getCurrentTable();
if (currentTable == null)
currentTable = m_recMerge.getTable(); // First time only
record = currentTable.getRecord(); // depends on control dependency: [if], data = [none]
}
Converter field = null;
if (fieldName != null)
field = record.getField(fieldName); // Get the current field
else
field = record.getField(m_iFieldSeq); // Get the current field
if ((m_iSecondaryFieldSeq != -1) || (secondaryFieldName != null))
if (field instanceof ReferenceField)
if (((ReferenceField)field).getRecord() != null)
if (((ReferenceField)field).getRecord().getTable() != null) // Make sure this isn't being called in free()
{ // Special case - field in the secondary file
Record recordSecond = ((ReferenceField)field).getReferenceRecord();
if (recordSecond != null)
{
if (secondaryFieldName != null)
field = recordSecond.getField(secondaryFieldName);
else
field = recordSecond.getField(m_iSecondaryFieldSeq);
}
}
return field;
} } |
public class class_name {
public Result<SingleValue> readSingleValue(Series series, DateTime timestamp, DateTimeZone timezone, Direction direction) {
checkNotNull(series);
checkNotNull(timestamp);
checkNotNull(timezone);
checkNotNull(direction);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/single/", API_VERSION, urlencode(series.getKey())));
addTimestampToURI(builder, timestamp);
addTimeZoneToURI(builder, timezone);
addDirectionToURI(builder, direction);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, timestamp: %s, timezone: %s, direction: %s", series.getKey(), timestamp.toString(), timezone.toString(), direction.toString());
throw new IllegalArgumentException(message, e);
}
HttpRequest request = buildRequest(uri.toString());
Result<SingleValue> result = execute(request, SingleValue.class);
return result;
} } | public class class_name {
public Result<SingleValue> readSingleValue(Series series, DateTime timestamp, DateTimeZone timezone, Direction direction) {
checkNotNull(series);
checkNotNull(timestamp);
checkNotNull(timezone);
checkNotNull(direction);
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/single/", API_VERSION, urlencode(series.getKey())));
addTimestampToURI(builder, timestamp); // depends on control dependency: [try], data = [none]
addTimeZoneToURI(builder, timezone); // depends on control dependency: [try], data = [none]
addDirectionToURI(builder, direction); // depends on control dependency: [try], data = [none]
uri = builder.build(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with inputs: key: %s, timestamp: %s, timezone: %s, direction: %s", series.getKey(), timestamp.toString(), timezone.toString(), direction.toString());
throw new IllegalArgumentException(message, e);
} // depends on control dependency: [catch], data = [none]
HttpRequest request = buildRequest(uri.toString());
Result<SingleValue> result = execute(request, SingleValue.class);
return result;
} } |
public class class_name {
private X509TrustManager createPromptingTrustManager() {
TrustManager[] trustManagers = null;
try {
String defaultAlg = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlg);
tmf.init((KeyStore) null);
trustManagers = tmf.getTrustManagers();
} catch (KeyStoreException e) {
// Unable to initialize the default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
} catch (NoSuchAlgorithmException e) {
// Unable to get default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
}
boolean autoAccept = Boolean.valueOf(System.getProperty(SYS_PROP_AUTO_ACCEPT, "false"));
return new PromptX509TrustManager(stdin, stdout, trustManagers, autoAccept);
} } | public class class_name {
private X509TrustManager createPromptingTrustManager() {
TrustManager[] trustManagers = null;
try {
String defaultAlg = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlg);
tmf.init((KeyStore) null); // depends on control dependency: [try], data = [none]
trustManagers = tmf.getTrustManagers(); // depends on control dependency: [try], data = [none]
} catch (KeyStoreException e) {
// Unable to initialize the default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
} catch (NoSuchAlgorithmException e) { // depends on control dependency: [catch], data = [none]
// Unable to get default trust managers.
// This is not a problem as PromptX509rustManager can handle null.
} // depends on control dependency: [catch], data = [none]
boolean autoAccept = Boolean.valueOf(System.getProperty(SYS_PROP_AUTO_ACCEPT, "false"));
return new PromptX509TrustManager(stdin, stdout, trustManagers, autoAccept);
} } |
public class class_name {
public void init(String text)
{
m_iCurrentState = OFF;
if (m_iconOff == null)
{
m_iconOff = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_OFF);
m_iconOn = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_ON);
m_iconNull = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_NULL);
}
this.setIcon(m_iconOff);
this.setBorder(null);
this.setMargin(JScreenConstants.NO_INSETS);
this.setOpaque(false);
this.addActionListener(this);
} } | public class class_name {
public void init(String text)
{
m_iCurrentState = OFF;
if (m_iconOff == null)
{
m_iconOff = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_OFF); // depends on control dependency: [if], data = [none]
m_iconOn = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_ON); // depends on control dependency: [if], data = [none]
m_iconNull = BaseApplet.getSharedInstance().loadImageIcon(CHECKBOX_NULL); // depends on control dependency: [if], data = [none]
}
this.setIcon(m_iconOff);
this.setBorder(null);
this.setMargin(JScreenConstants.NO_INSETS);
this.setOpaque(false);
this.addActionListener(this);
} } |
public class class_name {
public void registerProblem(GitHubRepositoryName repo, Throwable throwable) {
if (throwable == null) {
return;
}
registerProblem(repo, throwable.getMessage());
} } | public class class_name {
public void registerProblem(GitHubRepositoryName repo, Throwable throwable) {
if (throwable == null) {
return; // depends on control dependency: [if], data = [none]
}
registerProblem(repo, throwable.getMessage());
} } |
public class class_name {
public void checkExecutorHealth() {
final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap();
for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap.entrySet()) {
final Optional<Executor> executorOption = entry.getKey();
if (!executorOption.isPresent()) {
final String finalizeReason = "Executor id of this execution doesn't exist.";
for (final ExecutableFlow flow : entry.getValue()) {
logger.warn(
String.format("Finalizing execution %s, %s", flow.getExecutionId(), finalizeReason));
ExecutionControllerUtils
.finalizeFlow(this.executorLoader, this.alerterHolder, flow, finalizeReason, null);
}
continue;
}
final Executor executor = executorOption.get();
try {
// Todo jamiesjc: add metrics to monitor the http call return time
final Map<String, Object> results = this.apiGateway
.callWithExecutionId(executor.getHost(), executor.getPort(),
ConnectorParams.PING_ACTION, null, null);
if (results == null || results.containsKey(ConnectorParams.RESPONSE_ERROR) || !results
.containsKey(ConnectorParams.STATUS_PARAM) || !results.get(ConnectorParams.STATUS_PARAM)
.equals(ConnectorParams.RESPONSE_ALIVE)) {
throw new ExecutorManagerException("Status of executor " + executor.getId() + " is "
+ "not alive.");
} else {
// Executor is alive. Clear the failure count.
if (this.executorFailureCount.containsKey(executor.getId())) {
this.executorFailureCount.put(executor.getId(), 0);
}
}
} catch (final ExecutorManagerException e) {
handleExecutorNotAliveCase(entry, executor, e);
}
}
} } | public class class_name {
public void checkExecutorHealth() {
final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap();
for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap.entrySet()) {
final Optional<Executor> executorOption = entry.getKey();
if (!executorOption.isPresent()) {
final String finalizeReason = "Executor id of this execution doesn't exist.";
for (final ExecutableFlow flow : entry.getValue()) {
logger.warn(
String.format("Finalizing execution %s, %s", flow.getExecutionId(), finalizeReason)); // depends on control dependency: [for], data = [none]
ExecutionControllerUtils
.finalizeFlow(this.executorLoader, this.alerterHolder, flow, finalizeReason, null); // depends on control dependency: [for], data = [none]
}
continue;
}
final Executor executor = executorOption.get();
try {
// Todo jamiesjc: add metrics to monitor the http call return time
final Map<String, Object> results = this.apiGateway
.callWithExecutionId(executor.getHost(), executor.getPort(),
ConnectorParams.PING_ACTION, null, null);
if (results == null || results.containsKey(ConnectorParams.RESPONSE_ERROR) || !results
.containsKey(ConnectorParams.STATUS_PARAM) || !results.get(ConnectorParams.STATUS_PARAM)
.equals(ConnectorParams.RESPONSE_ALIVE)) {
throw new ExecutorManagerException("Status of executor " + executor.getId() + " is "
+ "not alive.");
} else {
// Executor is alive. Clear the failure count.
if (this.executorFailureCount.containsKey(executor.getId())) {
this.executorFailureCount.put(executor.getId(), 0); // depends on control dependency: [if], data = [none]
}
}
} catch (final ExecutorManagerException e) {
handleExecutorNotAliveCase(entry, executor, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private Component indent(CmsResourceInfo resourceInfo) {
boolean simple = false;
if (simple) {
return resourceInfo;
} else {
HorizontalLayout hl = new HorizontalLayout();
Label label = new Label("");
label.setWidth("35px");
hl.addComponent(label);
hl.addComponent(resourceInfo);
hl.setExpandRatio(resourceInfo, 1.0f);
hl.setWidth("100%");
return hl;
}
} } | public class class_name {
private Component indent(CmsResourceInfo resourceInfo) {
boolean simple = false;
if (simple) {
return resourceInfo; // depends on control dependency: [if], data = [none]
} else {
HorizontalLayout hl = new HorizontalLayout();
Label label = new Label("");
label.setWidth("35px"); // depends on control dependency: [if], data = [none]
hl.addComponent(label); // depends on control dependency: [if], data = [none]
hl.addComponent(resourceInfo); // depends on control dependency: [if], data = [none]
hl.setExpandRatio(resourceInfo, 1.0f); // depends on control dependency: [if], data = [none]
hl.setWidth("100%"); // depends on control dependency: [if], data = [none]
return hl; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static File getDataDir() {
final File dir;
if (SystemUtils.IS_OS_WINDOWS) {
dir = new File(System.getenv("APPDATA"), "LittleShoot");
} else if (SystemUtils.IS_OS_MAC_OSX) {
// TODO: Is this correct on international machines??
dir = new File("/Library/Application\\ Support/LittleShoot");
} else {
dir = getLittleShootDir();
}
if (dir.isDirectory() || dir.mkdirs())
return dir;
LOG.error("Not a directory: {}", dir);
return new File(SystemUtils.USER_HOME, ".littleshoot");
} } | public class class_name {
public static File getDataDir() {
final File dir;
if (SystemUtils.IS_OS_WINDOWS) {
dir = new File(System.getenv("APPDATA"), "LittleShoot"); // depends on control dependency: [if], data = [none]
} else if (SystemUtils.IS_OS_MAC_OSX) {
// TODO: Is this correct on international machines??
dir = new File("/Library/Application\\ Support/LittleShoot"); // depends on control dependency: [if], data = [none]
} else {
dir = getLittleShootDir(); // depends on control dependency: [if], data = [none]
}
if (dir.isDirectory() || dir.mkdirs())
return dir;
LOG.error("Not a directory: {}", dir);
return new File(SystemUtils.USER_HOME, ".littleshoot");
} } |
public class class_name {
public static void vNormalize(float[] v) {
float d = (float) (1.0f / Math.sqrt(sqr(v[0]) + sqr(v[1]) + sqr(v[2])));
if (d != 0) {
v[0] *= d;
v[1] *= d;
v[2] *= d;
}
} } | public class class_name {
public static void vNormalize(float[] v) {
float d = (float) (1.0f / Math.sqrt(sqr(v[0]) + sqr(v[1]) + sqr(v[2])));
if (d != 0) {
v[0] *= d; // depends on control dependency: [if], data = [none]
v[1] *= d; // depends on control dependency: [if], data = [none]
v[2] *= d; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String createRemoteRequestURI(HttpServletRequest pRequest) {
StringBuilder requestURI = new StringBuilder(remotePath);
requestURI.append(pRequest.getPathInfo());
if (!StringUtil.isEmpty(pRequest.getQueryString())) {
requestURI.append("?");
requestURI.append(pRequest.getQueryString());
}
return requestURI.toString();
} } | public class class_name {
private String createRemoteRequestURI(HttpServletRequest pRequest) {
StringBuilder requestURI = new StringBuilder(remotePath);
requestURI.append(pRequest.getPathInfo());
if (!StringUtil.isEmpty(pRequest.getQueryString())) {
requestURI.append("?");
// depends on control dependency: [if], data = [none]
requestURI.append(pRequest.getQueryString());
// depends on control dependency: [if], data = [none]
}
return requestURI.toString();
} } |
public class class_name {
private ErrorObjectWithJsonError createResponseError(String jsonRpc, Object id, JsonError errorObject) {
ObjectNode response = mapper.createObjectNode();
ObjectNode error = mapper.createObjectNode();
error.put(ERROR_CODE, errorObject.code);
error.put(ERROR_MESSAGE, errorObject.message);
if (errorObject.data != null) {
error.set(DATA, mapper.valueToTree(errorObject.data));
}
response.put(JSONRPC, jsonRpc);
if (Integer.class.isInstance(id)) {
response.put(ID, Integer.class.cast(id).intValue());
} else if (Long.class.isInstance(id)) {
response.put(ID, Long.class.cast(id).longValue());
} else if (Float.class.isInstance(id)) {
response.put(ID, Float.class.cast(id).floatValue());
} else if (Double.class.isInstance(id)) {
response.put(ID, Double.class.cast(id).doubleValue());
} else if (BigDecimal.class.isInstance(id)) {
response.put(ID, BigDecimal.class.cast(id));
} else {
response.put(ID, String.class.cast(id));
}
response.set(ERROR, error);
return new ErrorObjectWithJsonError(response, errorObject);
} } | public class class_name {
private ErrorObjectWithJsonError createResponseError(String jsonRpc, Object id, JsonError errorObject) {
ObjectNode response = mapper.createObjectNode();
ObjectNode error = mapper.createObjectNode();
error.put(ERROR_CODE, errorObject.code);
error.put(ERROR_MESSAGE, errorObject.message);
if (errorObject.data != null) {
error.set(DATA, mapper.valueToTree(errorObject.data)); // depends on control dependency: [if], data = [(errorObject.data]
}
response.put(JSONRPC, jsonRpc);
if (Integer.class.isInstance(id)) {
response.put(ID, Integer.class.cast(id).intValue()); // depends on control dependency: [if], data = [none]
} else if (Long.class.isInstance(id)) {
response.put(ID, Long.class.cast(id).longValue()); // depends on control dependency: [if], data = [none]
} else if (Float.class.isInstance(id)) {
response.put(ID, Float.class.cast(id).floatValue()); // depends on control dependency: [if], data = [none]
} else if (Double.class.isInstance(id)) {
response.put(ID, Double.class.cast(id).doubleValue()); // depends on control dependency: [if], data = [none]
} else if (BigDecimal.class.isInstance(id)) {
response.put(ID, BigDecimal.class.cast(id)); // depends on control dependency: [if], data = [none]
} else {
response.put(ID, String.class.cast(id)); // depends on control dependency: [if], data = [none]
}
response.set(ERROR, error);
return new ErrorObjectWithJsonError(response, errorObject);
} } |
public class class_name {
public DescribeClustersResult withClusters(Cluster... clusters) {
if (this.clusters == null) {
setClusters(new com.amazonaws.internal.SdkInternalList<Cluster>(clusters.length));
}
for (Cluster ele : clusters) {
this.clusters.add(ele);
}
return this;
} } | public class class_name {
public DescribeClustersResult withClusters(Cluster... clusters) {
if (this.clusters == null) {
setClusters(new com.amazonaws.internal.SdkInternalList<Cluster>(clusters.length)); // depends on control dependency: [if], data = [none]
}
for (Cluster ele : clusters) {
this.clusters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private Iterator<Map.Entry<DeltaClusteringKey, Compaction>> decodeCompactionsFromCql(final Iterator<Row> iter) {
return new AbstractIterator<Map.Entry<DeltaClusteringKey, Compaction>>() {
@Override
protected Map.Entry<DeltaClusteringKey, Compaction> computeNext() {
while (iter.hasNext()) {
Row row = iter.next();
Compaction compaction = _changeEncoder.decodeCompaction(getValue(row));
if (compaction != null) {
return Maps.immutableEntry(new DeltaClusteringKey(getChangeId(row), _daoUtils.getNumDeltaBlocks(getValue(row))), compaction);
}
}
return endOfData();
}
};
} } | public class class_name {
private Iterator<Map.Entry<DeltaClusteringKey, Compaction>> decodeCompactionsFromCql(final Iterator<Row> iter) {
return new AbstractIterator<Map.Entry<DeltaClusteringKey, Compaction>>() {
@Override
protected Map.Entry<DeltaClusteringKey, Compaction> computeNext() {
while (iter.hasNext()) {
Row row = iter.next();
Compaction compaction = _changeEncoder.decodeCompaction(getValue(row));
if (compaction != null) {
return Maps.immutableEntry(new DeltaClusteringKey(getChangeId(row), _daoUtils.getNumDeltaBlocks(getValue(row))), compaction); // depends on control dependency: [if], data = [none]
}
}
return endOfData();
}
};
} } |
public class class_name {
public void marshall(ReservationPurchaseRecommendationSummary reservationPurchaseRecommendationSummary, ProtocolMarshaller protocolMarshaller) {
if (reservationPurchaseRecommendationSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getTotalEstimatedMonthlySavingsAmount(),
TOTALESTIMATEDMONTHLYSAVINGSAMOUNT_BINDING);
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getTotalEstimatedMonthlySavingsPercentage(),
TOTALESTIMATEDMONTHLYSAVINGSPERCENTAGE_BINDING);
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getCurrencyCode(), CURRENCYCODE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ReservationPurchaseRecommendationSummary reservationPurchaseRecommendationSummary, ProtocolMarshaller protocolMarshaller) {
if (reservationPurchaseRecommendationSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getTotalEstimatedMonthlySavingsAmount(),
TOTALESTIMATEDMONTHLYSAVINGSAMOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getTotalEstimatedMonthlySavingsPercentage(),
TOTALESTIMATEDMONTHLYSAVINGSPERCENTAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(reservationPurchaseRecommendationSummary.getCurrencyCode(), CURRENCYCODE_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 {
@Override
public int compareTo(Version other) {
int result = normal.compareTo(other.normal);
if (result == 0) {
result = preRelease.compareTo(other.preRelease);
}
return result;
} } | public class class_name {
@Override
public int compareTo(Version other) {
int result = normal.compareTo(other.normal);
if (result == 0) {
result = preRelease.compareTo(other.preRelease); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public String constructShortName() {
String result = shortName;
if(dir != null) {
result = dir + "/" + result;
}
if(extension != null) {
result = result + "." + extension;
}
return result;
} } | public class class_name {
public String constructShortName() {
String result = shortName;
if(dir != null) {
result = dir + "/" + result; // depends on control dependency: [if], data = [none]
}
if(extension != null) {
result = result + "." + extension; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static VINT fromValue(long value) {
BitSet bs = BitSet.valueOf(new long[] { value });
byte length = (byte) (1 + bs.length() / BIT_IN_BYTE);
if (bs.length() == length * BIT_IN_BYTE) {
length++;
}
bs.set(length * BIT_IN_BYTE - length);
long binary = bs.toLongArray()[0];
return new VINT(binary, length, value);
} } | public class class_name {
public static VINT fromValue(long value) {
BitSet bs = BitSet.valueOf(new long[] { value });
byte length = (byte) (1 + bs.length() / BIT_IN_BYTE);
if (bs.length() == length * BIT_IN_BYTE) {
length++; // depends on control dependency: [if], data = [none]
}
bs.set(length * BIT_IN_BYTE - length);
long binary = bs.toLongArray()[0];
return new VINT(binary, length, value);
} } |
public class class_name {
public static base_responses update(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount updateresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new aaakcdaccount();
updateresources[i].kcdaccount = resources[i].kcdaccount;
updateresources[i].keytab = resources[i].keytab;
updateresources[i].realmstr = resources[i].realmstr;
updateresources[i].delegateduser = resources[i].delegateduser;
updateresources[i].kcdpassword = resources[i].kcdpassword;
updateresources[i].usercert = resources[i].usercert;
updateresources[i].cacert = resources[i].cacert;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, aaakcdaccount resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaakcdaccount updateresources[] = new aaakcdaccount[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new aaakcdaccount(); // depends on control dependency: [for], data = [i]
updateresources[i].kcdaccount = resources[i].kcdaccount; // depends on control dependency: [for], data = [i]
updateresources[i].keytab = resources[i].keytab; // depends on control dependency: [for], data = [i]
updateresources[i].realmstr = resources[i].realmstr; // depends on control dependency: [for], data = [i]
updateresources[i].delegateduser = resources[i].delegateduser; // depends on control dependency: [for], data = [i]
updateresources[i].kcdpassword = resources[i].kcdpassword; // depends on control dependency: [for], data = [i]
updateresources[i].usercert = resources[i].usercert; // depends on control dependency: [for], data = [i]
updateresources[i].cacert = resources[i].cacert; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
public String getEndUserAuthorizationRequestUri(final HttpServletRequest request) {
OAuthClientRequest oauthClientRequest;
try {
oauthClientRequest = OAuthClientRequest
.authorizationLocation(authorizationLocation)
.setClientId(clientId)
.setRedirectURI(getAbsoluteUrl(request, redirectUri))
.setScope(getScope())
.setResponseType(getResponseType())
.setState(getState())
.buildQueryMessage();
logger.info("Authorization request location URI: {}", oauthClientRequest.getLocationUri());
return oauthClientRequest.getLocationUri();
} catch (OAuthSystemException ex) {
logger.error("", ex);
}
return null;
} } | public class class_name {
public String getEndUserAuthorizationRequestUri(final HttpServletRequest request) {
OAuthClientRequest oauthClientRequest;
try {
oauthClientRequest = OAuthClientRequest
.authorizationLocation(authorizationLocation)
.setClientId(clientId)
.setRedirectURI(getAbsoluteUrl(request, redirectUri))
.setScope(getScope())
.setResponseType(getResponseType())
.setState(getState())
.buildQueryMessage(); // depends on control dependency: [try], data = [none]
logger.info("Authorization request location URI: {}", oauthClientRequest.getLocationUri()); // depends on control dependency: [try], data = [none]
return oauthClientRequest.getLocationUri(); // depends on control dependency: [try], data = [none]
} catch (OAuthSystemException ex) {
logger.error("", ex);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
int readResults(byte[] b, int bPos, int bAvail) {
if (buffer != null) {
int len = Math.min(avail(), bAvail);
if (buffer != b) {
System.arraycopy(buffer, readPos, b, bPos, len);
readPos += len;
if (readPos >= pos) {
buffer = null;
}
} else {
// Re-using the original consumer's output array is only
// allowed for one round.
buffer = null;
}
return len;
}
return eof ? -1 : 0;
} } | public class class_name {
int readResults(byte[] b, int bPos, int bAvail) {
if (buffer != null) {
int len = Math.min(avail(), bAvail);
if (buffer != b) {
System.arraycopy(buffer, readPos, b, bPos, len); // depends on control dependency: [if], data = [(buffer]
readPos += len; // depends on control dependency: [if], data = [none]
if (readPos >= pos) {
buffer = null; // depends on control dependency: [if], data = [none]
}
} else {
// Re-using the original consumer's output array is only
// allowed for one round.
buffer = null; // depends on control dependency: [if], data = [none]
}
return len; // depends on control dependency: [if], data = [none]
}
return eof ? -1 : 0;
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) {
final C c = cache.getConfiguration(clazz);
if (c instanceof CompleteConfiguration) {
final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c;
return (C) new CompleteConfiguration<K, T>() {
@Override
public Iterable<CacheEntryListenerConfiguration<K, T>> getCacheEntryListenerConfigurations() {
return cc.getCacheEntryListenerConfigurations();
}
@Override
public boolean isReadThrough() {
return cc.isReadThrough();
}
@Override
public boolean isWriteThrough() {
return cc.isWriteThrough();
}
@Override
public boolean isStatisticsEnabled() {
return cc.isStatisticsEnabled();
}
@Override
public boolean isManagementEnabled() {
return cc.isManagementEnabled();
}
@Override
public Factory<CacheLoader<K, T>> getCacheLoaderFactory() {
return cc.getCacheLoaderFactory();
}
@Override
public Factory<CacheWriter<? super K, ? super T>> getCacheWriterFactory() {
return cc.getCacheWriterFactory();
}
@Override
public Factory<ExpiryPolicy> getExpiryPolicyFactory() {
return cc.getExpiryPolicyFactory();
}
@Override
public Class<K> getKeyType() {
return cc.getKeyType();
}
@Override
public Class<T> getValueType() {
return cc.getValueType();
}
@Override
public boolean isStoreByValue() {
return true;
}
};
} else if (c instanceof Configuration) {
return (C) new Configuration<K, T>() {
@Override
public Class<K> getKeyType() {
return c.getKeyType();
}
@Override
public Class<T> getValueType() {
return c.getValueType();
}
@Override
public boolean isStoreByValue() {
return true;
}
};
}
return c;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) {
final C c = cache.getConfiguration(clazz);
if (c instanceof CompleteConfiguration) {
final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c;
return (C) new CompleteConfiguration<K, T>() {
@Override
public Iterable<CacheEntryListenerConfiguration<K, T>> getCacheEntryListenerConfigurations() {
return cc.getCacheEntryListenerConfigurations();
}
@Override
public boolean isReadThrough() {
return cc.isReadThrough();
}
@Override
public boolean isWriteThrough() {
return cc.isWriteThrough();
}
@Override
public boolean isStatisticsEnabled() {
return cc.isStatisticsEnabled();
}
@Override
public boolean isManagementEnabled() {
return cc.isManagementEnabled();
}
@Override
public Factory<CacheLoader<K, T>> getCacheLoaderFactory() {
return cc.getCacheLoaderFactory();
}
@Override
public Factory<CacheWriter<? super K, ? super T>> getCacheWriterFactory() {
return cc.getCacheWriterFactory();
}
@Override
public Factory<ExpiryPolicy> getExpiryPolicyFactory() {
return cc.getExpiryPolicyFactory();
}
@Override
public Class<K> getKeyType() {
return cc.getKeyType();
}
@Override
public Class<T> getValueType() {
return cc.getValueType();
}
@Override
public boolean isStoreByValue() {
return true;
}
}; // depends on control dependency: [if], data = [none]
} else if (c instanceof Configuration) {
return (C) new Configuration<K, T>() {
@Override
public Class<K> getKeyType() {
return c.getKeyType();
}
@Override
public Class<T> getValueType() {
return c.getValueType();
}
@Override
public boolean isStoreByValue() {
return true;
}
}; // depends on control dependency: [if], data = [none]
}
return c;
} } |
public class class_name {
private void scheduleUpdate() {
if (!isVisible()) {
return;
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
container.gameLoop();
} catch (SlickException e) {
e.printStackTrace();
}
container.checkDimensions();
scheduleUpdate();
}
});
} } | public class class_name {
private void scheduleUpdate() {
if (!isVisible()) {
return;
// depends on control dependency: [if], data = [none]
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
container.gameLoop();
// depends on control dependency: [try], data = [none]
} catch (SlickException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
container.checkDimensions();
scheduleUpdate();
}
});
} } |
public class class_name {
public void setSecretList(java.util.Collection<SecretListEntry> secretList) {
if (secretList == null) {
this.secretList = null;
return;
}
this.secretList = new java.util.ArrayList<SecretListEntry>(secretList);
} } | public class class_name {
public void setSecretList(java.util.Collection<SecretListEntry> secretList) {
if (secretList == null) {
this.secretList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.secretList = new java.util.ArrayList<SecretListEntry>(secretList);
} } |
public class class_name {
private static Constructor<?> getPersistenceStoreConstructor(Class<?> theClass, Class<?>[] interfaces) throws Exception {
Constructor<?> constructor = null;
for (Class<?> interfaceClass : interfaces) {
try {
constructor = theClass.getConstructor(new Class[] { interfaceClass });
} catch (NoSuchMethodException err) {
// Ignore this error
}
if (constructor != null) {
break;
}
constructor = getPersistenceStoreConstructor(theClass, interfaceClass.getInterfaces());
if (constructor != null) {
break;
}
}
return constructor;
} } | public class class_name {
private static Constructor<?> getPersistenceStoreConstructor(Class<?> theClass, Class<?>[] interfaces) throws Exception {
Constructor<?> constructor = null;
for (Class<?> interfaceClass : interfaces) {
try {
constructor = theClass.getConstructor(new Class[] { interfaceClass });
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException err) {
// Ignore this error
}
// depends on control dependency: [catch], data = [none]
if (constructor != null) {
break;
}
constructor = getPersistenceStoreConstructor(theClass, interfaceClass.getInterfaces());
if (constructor != null) {
break;
}
}
return constructor;
} } |
public class class_name {
private UfsStatus[] trimIndirect(UfsStatus[] children) {
List<UfsStatus> childrenList = new ArrayList<>();
for (UfsStatus child : children) {
int index = child.getName().indexOf(AlluxioURI.SEPARATOR);
if (index < 0 || index == child.getName().length()) {
childrenList.add(child);
}
}
return childrenList.toArray(new UfsStatus[childrenList.size()]);
} } | public class class_name {
private UfsStatus[] trimIndirect(UfsStatus[] children) {
List<UfsStatus> childrenList = new ArrayList<>();
for (UfsStatus child : children) {
int index = child.getName().indexOf(AlluxioURI.SEPARATOR);
if (index < 0 || index == child.getName().length()) {
childrenList.add(child); // depends on control dependency: [if], data = [none]
}
}
return childrenList.toArray(new UfsStatus[childrenList.size()]);
} } |
public class class_name {
public static byte[] ascToBcd(byte[] ascii, int ascLength) {
byte[] bcd = new byte[ascLength / 2];
int j = 0;
for (int i = 0; i < (ascLength + 1) / 2; i++) {
bcd[i] = ascToBcd(ascii[j++]);
bcd[i] = (byte) (((j >= ascLength) ? 0x00 : ascToBcd(ascii[j++])) + (bcd[i] << 4));
}
return bcd;
} } | public class class_name {
public static byte[] ascToBcd(byte[] ascii, int ascLength) {
byte[] bcd = new byte[ascLength / 2];
int j = 0;
for (int i = 0; i < (ascLength + 1) / 2; i++) {
bcd[i] = ascToBcd(ascii[j++]);
// depends on control dependency: [for], data = [i]
bcd[i] = (byte) (((j >= ascLength) ? 0x00 : ascToBcd(ascii[j++])) + (bcd[i] << 4));
// depends on control dependency: [for], data = [i]
}
return bcd;
} } |
public class class_name {
private boolean isCollection(Class<?> rawType) {
// this sucks... is there really no way to work around this in GWT?
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4663
if (rawType == Collection.class) {
return true;
}
if (rawType == List.class) {
return true;
}
if (rawType == Set.class) {
return true;
}
Class<?> superType = rawType;
while (superType != null) {
if (superType == AbstractCollection.class) {
return true;
}
superType = superType.getSuperclass();
}
return false;
} } | public class class_name {
private boolean isCollection(Class<?> rawType) {
// this sucks... is there really no way to work around this in GWT?
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4663
if (rawType == Collection.class) {
return true; // depends on control dependency: [if], data = [none]
}
if (rawType == List.class) {
return true; // depends on control dependency: [if], data = [none]
}
if (rawType == Set.class) {
return true; // depends on control dependency: [if], data = [none]
}
Class<?> superType = rawType;
while (superType != null) {
if (superType == AbstractCollection.class) {
return true; // depends on control dependency: [if], data = [none]
}
superType = superType.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public void addIndexWarning(String noIndexGiven) {
if (jsonResponse==null){
jsonResponse = new JSONObject();
}
jsonResponse.put("warning:noIndexGiven", noIndexGiven);
} } | public class class_name {
public void addIndexWarning(String noIndexGiven) {
if (jsonResponse==null){
jsonResponse = new JSONObject(); // depends on control dependency: [if], data = [none]
}
jsonResponse.put("warning:noIndexGiven", noIndexGiven);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.