code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void go() {
long nextPriority = Long.MIN_VALUE;
for (Long d : handlers.getPriorities()) {
if (nextPriority > d) continue;
AnnotationVisitor visitor = new AnnotationVisitor(d);
ast.traverse(visitor);
// if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediatetly
nextPriority = visitor.getNextPriority();
nextPriority = Math.min(nextPriority, handlers.callASTVisitors(ast, d, ast.isCompleteParse()));
}
} } | public class class_name {
public void go() {
long nextPriority = Long.MIN_VALUE;
for (Long d : handlers.getPriorities()) {
if (nextPriority > d) continue;
AnnotationVisitor visitor = new AnnotationVisitor(d);
ast.traverse(visitor); // depends on control dependency: [for], data = [none]
// if no visitor interested for this AST, nextPriority would be MAX_VALUE and we bail out immediatetly
nextPriority = visitor.getNextPriority(); // depends on control dependency: [for], data = [none]
nextPriority = Math.min(nextPriority, handlers.callASTVisitors(ast, d, ast.isCompleteParse())); // depends on control dependency: [for], data = [d]
}
} } |
public class class_name {
Iterable<PutMetricDataRequest> nextUploadUnits() throws InterruptedException {
final Map<String,MetricDatum> uniqueMetrics = new HashMap<String,MetricDatum>();
long startNano = System.nanoTime();
while(true) {
final long elapsedNano = System.nanoTime() - startNano;
if (elapsedNano >= timeoutNano) {
return toPutMetricDataRequests(uniqueMetrics);
}
MetricDatum datum = queue.poll(timeoutNano - elapsedNano, TimeUnit.NANOSECONDS);
if (datum == null) {
// timed out
if (uniqueMetrics.size() > 0) {
// return whatever we have so far
return toPutMetricDataRequests(uniqueMetrics);
}
// zero AWS related metrics
if (AwsSdkMetrics.isMachineMetricExcluded()) {
// Short note: nothing to do, so just wait indefinitely.
// (Long note: There exists a pedagogical case where the
// next statement is executed followed by no subsequent AWS
// traffic whatsoever, and then the machine metric is enabled
// via JMX.
// In such case, we require the metric generation to be
// disabled and then re-enabled (eg via JMX).
// So why not always wake up periodically instead of going
// into long wait ?
// I (hchar@) think we should optimize for the most typical
// cases instead of the edge cases. Going into long wait has
// the benefit of relatively less runtime footprint.)
datum = queue.take();
startNano = System.nanoTime();
}
}
// Note at this point datum is null if and only if there is no
// pending AWS related metrics but machine metrics is enabled
if (datum != null)
summarize(datum, uniqueMetrics);
}
} } | public class class_name {
Iterable<PutMetricDataRequest> nextUploadUnits() throws InterruptedException {
final Map<String,MetricDatum> uniqueMetrics = new HashMap<String,MetricDatum>();
long startNano = System.nanoTime();
while(true) {
final long elapsedNano = System.nanoTime() - startNano;
if (elapsedNano >= timeoutNano) {
return toPutMetricDataRequests(uniqueMetrics); // depends on control dependency: [if], data = [none]
}
MetricDatum datum = queue.poll(timeoutNano - elapsedNano, TimeUnit.NANOSECONDS);
if (datum == null) {
// timed out
if (uniqueMetrics.size() > 0) {
// return whatever we have so far
return toPutMetricDataRequests(uniqueMetrics); // depends on control dependency: [if], data = [none]
}
// zero AWS related metrics
if (AwsSdkMetrics.isMachineMetricExcluded()) {
// Short note: nothing to do, so just wait indefinitely.
// (Long note: There exists a pedagogical case where the
// next statement is executed followed by no subsequent AWS
// traffic whatsoever, and then the machine metric is enabled
// via JMX.
// In such case, we require the metric generation to be
// disabled and then re-enabled (eg via JMX).
// So why not always wake up periodically instead of going
// into long wait ?
// I (hchar@) think we should optimize for the most typical
// cases instead of the edge cases. Going into long wait has
// the benefit of relatively less runtime footprint.)
datum = queue.take(); // depends on control dependency: [if], data = [none]
startNano = System.nanoTime(); // depends on control dependency: [if], data = [none]
}
}
// Note at this point datum is null if and only if there is no
// pending AWS related metrics but machine metrics is enabled
if (datum != null)
summarize(datum, uniqueMetrics);
}
} } |
public class class_name {
private static String format(String message, Object... messageArgs) {
StringBuilder sb = new StringBuilder(message.length() + 8 * messageArgs.length);
int templateStart = 0;
for (Object argument : messageArgs) {
int placeholderStart = message.indexOf("%s", templateStart);
if (placeholderStart == -1) {
break;
}
sb.append(message.substring(templateStart, placeholderStart));
sb.append(argument);
templateStart = placeholderStart + 2;
}
sb.append(message.substring(templateStart));
return sb.toString();
} } | public class class_name {
private static String format(String message, Object... messageArgs) {
StringBuilder sb = new StringBuilder(message.length() + 8 * messageArgs.length);
int templateStart = 0;
for (Object argument : messageArgs) {
int placeholderStart = message.indexOf("%s", templateStart);
if (placeholderStart == -1) {
break;
}
sb.append(message.substring(templateStart, placeholderStart)); // depends on control dependency: [for], data = [none]
sb.append(argument); // depends on control dependency: [for], data = [argument]
templateStart = placeholderStart + 2; // depends on control dependency: [for], data = [none]
}
sb.append(message.substring(templateStart));
return sb.toString();
} } |
public class class_name {
@Override
public String htmlStart(String helpUrl) {
String stylesheet = null;
if (isPopup()) {
stylesheet = "popup.css";
}
StringBuffer result = new StringBuffer(super.pageHtmlStyle(HTML_START, null, stylesheet));
if (getSettings().isViewExplorer()) {
result.append("<script type=\"text/javascript\" src=\"");
result.append(getSkinUri());
result.append("commons/explorer.js\"></script>\n");
}
result.append("<script type=\"text/javascript\">\n");
if (helpUrl != null) {
result.append("top.head.helpUrl=\"");
result.append(helpUrl + "\";\n");
}
// js to switch the dialog tabs
result.append("function openTab(tabValue) {\n");
result.append("\tdocument.forms[0]." + PARAM_TAB + ".value = tabValue;\n");
result.append("\tdocument.forms[0]." + PARAM_ACTION + ".value = \"" + DIALOG_SWITCHTAB + "\";\n");
result.append("\tdocument.forms[0].submit();\n");
result.append("}\n");
// js for the button actions, overwrites CmsDialog.dialogScriptSubmit() js method
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_SET + "\") {\n");
result.append("\t\ttheForm." + PARAM_ACTION + ".value = \"" + DIALOG_SET + "\";\n");
result.append("\t} else if (actionValue == \"" + DIALOG_CANCEL + "\") {\n");
result.append("\t\ttheForm." + PARAM_ACTION + ".value = \"" + DIALOG_CANCEL + "\";\n");
result.append("\t}\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
result.append("//-->\n</script>\n");
return result.toString();
} } | public class class_name {
@Override
public String htmlStart(String helpUrl) {
String stylesheet = null;
if (isPopup()) {
stylesheet = "popup.css"; // depends on control dependency: [if], data = [none]
}
StringBuffer result = new StringBuffer(super.pageHtmlStyle(HTML_START, null, stylesheet));
if (getSettings().isViewExplorer()) {
result.append("<script type=\"text/javascript\" src=\""); // depends on control dependency: [if], data = [none]
result.append(getSkinUri()); // depends on control dependency: [if], data = [none]
result.append("commons/explorer.js\"></script>\n"); // depends on control dependency: [if], data = [none]
}
result.append("<script type=\"text/javascript\">\n");
if (helpUrl != null) {
result.append("top.head.helpUrl=\""); // depends on control dependency: [if], data = [none]
result.append(helpUrl + "\";\n"); // depends on control dependency: [if], data = [(helpUrl]
}
// js to switch the dialog tabs
result.append("function openTab(tabValue) {\n");
result.append("\tdocument.forms[0]." + PARAM_TAB + ".value = tabValue;\n");
result.append("\tdocument.forms[0]." + PARAM_ACTION + ".value = \"" + DIALOG_SWITCHTAB + "\";\n");
result.append("\tdocument.forms[0].submit();\n");
result.append("}\n");
// js for the button actions, overwrites CmsDialog.dialogScriptSubmit() js method
result.append("function submitAction(actionValue, theForm, formName) {\n");
result.append("\tif (theForm == null) {\n");
result.append("\t\ttheForm = document.forms[formName];\n");
result.append("\t}\n");
result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
result.append("\tif (actionValue == \"" + DIALOG_SET + "\") {\n");
result.append("\t\ttheForm." + PARAM_ACTION + ".value = \"" + DIALOG_SET + "\";\n");
result.append("\t} else if (actionValue == \"" + DIALOG_CANCEL + "\") {\n");
result.append("\t\ttheForm." + PARAM_ACTION + ".value = \"" + DIALOG_CANCEL + "\";\n");
result.append("\t}\n");
result.append("\ttheForm.submit();\n");
result.append("\treturn false;\n");
result.append("}\n");
result.append("//-->\n</script>\n");
return result.toString();
} } |
public class class_name {
public void print(IncidentStream is, int maxDepth) {
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < _level; i++)
fullName.append(" ");
fullName.append(_name);
is.writeLine(fullName.toString(), _description);
if (_level < maxDepth) {
List<IntrospectionLevelMember> children = getChildren();
for (IntrospectionLevelMember ilm : children) {
ilm.print(is, maxDepth);
}
}
} } | public class class_name {
public void print(IncidentStream is, int maxDepth) {
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < _level; i++)
fullName.append(" ");
fullName.append(_name);
is.writeLine(fullName.toString(), _description);
if (_level < maxDepth) {
List<IntrospectionLevelMember> children = getChildren();
for (IntrospectionLevelMember ilm : children) {
ilm.print(is, maxDepth); // depends on control dependency: [for], data = [ilm]
}
}
} } |
public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> changeVnetNextWithServiceResponseAsync(final String nextPageLink) {
return changeVnetNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(changeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<SiteInner>>> changeVnetNextWithServiceResponseAsync(final String nextPageLink) {
return changeVnetNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(changeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
public final void increaseIdleCount(IdleStatus status, long currentTime) {
if (status == IdleStatus.BOTH_IDLE) {
idleCountForBoth.incrementAndGet();
lastIdleTimeForBoth = currentTime;
} else if (status == IdleStatus.READER_IDLE) {
idleCountForRead.incrementAndGet();
lastIdleTimeForRead = currentTime;
} else if (status == IdleStatus.WRITER_IDLE) {
idleCountForWrite.incrementAndGet();
lastIdleTimeForWrite = currentTime;
} else {
throw new IllegalArgumentException("Unknown idle status: " + status);
}
} } | public class class_name {
public final void increaseIdleCount(IdleStatus status, long currentTime) {
if (status == IdleStatus.BOTH_IDLE) {
idleCountForBoth.incrementAndGet(); // depends on control dependency: [if], data = [none]
lastIdleTimeForBoth = currentTime; // depends on control dependency: [if], data = [none]
} else if (status == IdleStatus.READER_IDLE) {
idleCountForRead.incrementAndGet(); // depends on control dependency: [if], data = [none]
lastIdleTimeForRead = currentTime; // depends on control dependency: [if], data = [none]
} else if (status == IdleStatus.WRITER_IDLE) {
idleCountForWrite.incrementAndGet(); // depends on control dependency: [if], data = [none]
lastIdleTimeForWrite = currentTime; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown idle status: " + status);
}
} } |
public class class_name {
public String rewriteRefresh(String input, String requestUrl, String baseUrl, String visibleBaseUrl) {
// Header has the following format
// Refresh: 5; url=http://www.w3.org/pub/WWW/People.html
int urlPosition = input.indexOf("url=");
if (urlPosition >= 0) {
String urlValue = input.substring(urlPosition + "url=".length());
String targetUrlValue = rewriteUrl(urlValue, requestUrl, baseUrl, visibleBaseUrl, true);
return input.substring(0, urlPosition) + "url=" + targetUrlValue;
} else {
return input;
}
} } | public class class_name {
public String rewriteRefresh(String input, String requestUrl, String baseUrl, String visibleBaseUrl) {
// Header has the following format
// Refresh: 5; url=http://www.w3.org/pub/WWW/People.html
int urlPosition = input.indexOf("url=");
if (urlPosition >= 0) {
String urlValue = input.substring(urlPosition + "url=".length());
String targetUrlValue = rewriteUrl(urlValue, requestUrl, baseUrl, visibleBaseUrl, true);
return input.substring(0, urlPosition) + "url=" + targetUrlValue; // depends on control dependency: [if], data = [none]
} else {
return input; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public org.tensorflow.framework.TensorProto getTensor() {
if (valueCase_ == 8) {
return (org.tensorflow.framework.TensorProto) value_;
}
return org.tensorflow.framework.TensorProto.getDefaultInstance();
} } | public class class_name {
public org.tensorflow.framework.TensorProto getTensor() {
if (valueCase_ == 8) {
return (org.tensorflow.framework.TensorProto) value_; // depends on control dependency: [if], data = [none]
}
return org.tensorflow.framework.TensorProto.getDefaultInstance();
} } |
public class class_name {
private static int getIndexOfChild(final Container parent, final WComponent childComponent) {
if (parent instanceof AbstractWComponent) {
return ((AbstractWComponent) parent).getIndexOfChild(childComponent);
} else {
// We have to do this the hard way...
for (int i = 0; i < parent.getChildCount(); i++) {
if (childComponent == parent.getChildAt(i)) {
return i;
}
}
}
return -1;
} } | public class class_name {
private static int getIndexOfChild(final Container parent, final WComponent childComponent) {
if (parent instanceof AbstractWComponent) {
return ((AbstractWComponent) parent).getIndexOfChild(childComponent); // depends on control dependency: [if], data = [none]
} else {
// We have to do this the hard way...
for (int i = 0; i < parent.getChildCount(); i++) {
if (childComponent == parent.getChildAt(i)) {
return i; // depends on control dependency: [if], data = [none]
}
}
}
return -1;
} } |
public class class_name {
private boolean endspc() throws IOException {
byte ych = parser.buffer.buffer[parser.cursor];
switch(ych) {
case ' ':
parser.cursor++;
while(true) {
if(parser.cursor == parser.limit) parser.read();
if(parser.buffer.buffer[parser.cursor] != ' ') return true;
parser.cursor++;
}
case '\r':
if(parser.buffer.buffer[parser.cursor+1] != '\n') {
return false;
}
parser.cursor++;
case '\n':
parser.cursor++;
return true;
default:
return false;
}
} } | public class class_name {
private boolean endspc() throws IOException {
byte ych = parser.buffer.buffer[parser.cursor];
switch(ych) {
case ' ':
parser.cursor++;
while(true) {
if(parser.cursor == parser.limit) parser.read();
if(parser.buffer.buffer[parser.cursor] != ' ') return true;
parser.cursor++; // depends on control dependency: [while], data = [none]
}
case '\r':
if(parser.buffer.buffer[parser.cursor+1] != '\n') {
return false; // depends on control dependency: [if], data = [none]
}
parser.cursor++;
case '\n':
parser.cursor++;
return true;
default:
return false;
}
} } |
public class class_name {
public <T> T giveOther(TypeTag tag, T value) {
Class<T> type = tag.getType();
if (value != null && !type.isAssignableFrom(value.getClass()) && !wraps(type, value.getClass())) {
throw new ReflectionException("TypeTag does not match value.");
}
Tuple<T> tuple = giveTuple(tag);
if (tuple.getRed() == null) {
return null;
}
if (type.isArray() && arraysAreDeeplyEqual(tuple.getRed(), value)) {
return tuple.getBlack();
}
if (!type.isArray() && tuple.getRed().equals(value)) {
return tuple.getBlack();
}
return tuple.getRed();
} } | public class class_name {
public <T> T giveOther(TypeTag tag, T value) {
Class<T> type = tag.getType();
if (value != null && !type.isAssignableFrom(value.getClass()) && !wraps(type, value.getClass())) {
throw new ReflectionException("TypeTag does not match value.");
}
Tuple<T> tuple = giveTuple(tag);
if (tuple.getRed() == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (type.isArray() && arraysAreDeeplyEqual(tuple.getRed(), value)) {
return tuple.getBlack(); // depends on control dependency: [if], data = [none]
}
if (!type.isArray() && tuple.getRed().equals(value)) {
return tuple.getBlack(); // depends on control dependency: [if], data = [none]
}
return tuple.getRed();
} } |
public class class_name {
void returnProcessedBytes(Http2Stream http2Stream, int bytes) {
try {
decoder().flowController().consumeBytes(http2Stream, bytes);
} catch (Http2Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
void returnProcessedBytes(Http2Stream http2Stream, int bytes) {
try {
decoder().flowController().consumeBytes(http2Stream, bytes); // depends on control dependency: [try], data = [none]
} catch (Http2Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getMethodDescriptor(ExecutableType method) {
StringBuilder sb = new StringBuilder("(");
for (TypeMirror t : method.getParameterTypes()) {
sb.append(getSignatureName(t));
}
sb.append(")");
sb.append(getSignatureName(method.getReturnType()));
return sb.toString();
} } | public class class_name {
public String getMethodDescriptor(ExecutableType method) {
StringBuilder sb = new StringBuilder("(");
for (TypeMirror t : method.getParameterTypes()) {
sb.append(getSignatureName(t)); // depends on control dependency: [for], data = [t]
}
sb.append(")");
sb.append(getSignatureName(method.getReturnType()));
return sb.toString();
} } |
public class class_name {
@Override
public JdbcDeepJobConfig<T> initialize(ExtractorConfig extractorConfig) {
Map<String, Serializable> values = extractorConfig.getValues();
if (values.get(CATALOG) != null) {
this.database(extractorConfig.getString(CATALOG));
}
if (values.get(TABLE) != null) {
this.table(extractorConfig.getString(TABLE));
}
super.initialize(extractorConfig);
if (values.get(FILTER_QUERY) != null) {
this.filters(extractorConfig.getFilterArray(FILTER_QUERY));
}
if (values.get(JDBC_DRIVER_CLASS) != null) {
driverClass(extractorConfig.getString(JDBC_DRIVER_CLASS));
}
if (values.get(JDBC_CONNECTION_URL) != null) {
connectionUrl(extractorConfig.getString(JDBC_CONNECTION_URL));
}
if (values.get(JDBC_QUOTE_SQL) != null) {
quoteSql(extractorConfig.getBoolean(JDBC_QUOTE_SQL));
}
if (values.get(JDBC_PARTITION_KEY) != null) {
partitionKey(extractorConfig.getString(JDBC_PARTITION_KEY));
}
if (values.get(JDBC_NUM_PARTITIONS) != null) {
numPartitions(extractorConfig.getInteger(JDBC_NUM_PARTITIONS));
}
if (values.get(JDBC_PARTITIONS_LOWER_BOUND) != null) {
lowerBound(extractorConfig.getInteger(JDBC_PARTITIONS_LOWER_BOUND));
}
if (values.get(JDBC_PARTITIONS_UPPER_BOUND) != null) {
upperBound(extractorConfig.getInteger(JDBC_PARTITIONS_UPPER_BOUND));
}
this.initialize();
return this;
} } | public class class_name {
@Override
public JdbcDeepJobConfig<T> initialize(ExtractorConfig extractorConfig) {
Map<String, Serializable> values = extractorConfig.getValues();
if (values.get(CATALOG) != null) {
this.database(extractorConfig.getString(CATALOG)); // depends on control dependency: [if], data = [none]
}
if (values.get(TABLE) != null) {
this.table(extractorConfig.getString(TABLE)); // depends on control dependency: [if], data = [none]
}
super.initialize(extractorConfig);
if (values.get(FILTER_QUERY) != null) {
this.filters(extractorConfig.getFilterArray(FILTER_QUERY)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_DRIVER_CLASS) != null) {
driverClass(extractorConfig.getString(JDBC_DRIVER_CLASS)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_CONNECTION_URL) != null) {
connectionUrl(extractorConfig.getString(JDBC_CONNECTION_URL)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_QUOTE_SQL) != null) {
quoteSql(extractorConfig.getBoolean(JDBC_QUOTE_SQL)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_PARTITION_KEY) != null) {
partitionKey(extractorConfig.getString(JDBC_PARTITION_KEY)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_NUM_PARTITIONS) != null) {
numPartitions(extractorConfig.getInteger(JDBC_NUM_PARTITIONS)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_PARTITIONS_LOWER_BOUND) != null) {
lowerBound(extractorConfig.getInteger(JDBC_PARTITIONS_LOWER_BOUND)); // depends on control dependency: [if], data = [none]
}
if (values.get(JDBC_PARTITIONS_UPPER_BOUND) != null) {
upperBound(extractorConfig.getInteger(JDBC_PARTITIONS_UPPER_BOUND)); // depends on control dependency: [if], data = [none]
}
this.initialize();
return this;
} } |
public class class_name {
public LCAInfo<S, I, O> findLCA(final ADTNode<S, I, O> s1, final ADTNode<S, I, O> s2) {
final Map<ADTNode<S, I, O>, ADTNode<S, I, O>> s1ParentsToS1 = new HashMap<>();
ADTNode<S, I, O> s1Iter = s1;
ADTNode<S, I, O> s2Iter = s2;
while (s1Iter.getParent() != null) {
s1ParentsToS1.put(s1Iter.getParent(), s1Iter);
s1Iter = s1Iter.getParent();
}
final Set<ADTNode<S, I, O>> s1Parents = s1ParentsToS1.keySet();
while (s2Iter.getParent() != null) {
if (s1Parents.contains(s2Iter.getParent())) {
if (!ADTUtil.isSymbolNode(s2Iter.getParent())) {
throw new IllegalStateException("Only Symbol Nodes should be LCAs");
}
final ADTNode<S, I, O> lca = s2Iter.getParent();
final O s1Out = ADTUtil.getOutputForSuccessor(lca, s1ParentsToS1.get(lca));
final O s2Out = ADTUtil.getOutputForSuccessor(lca, s2Iter);
return new LCAInfo<>(lca, s1Out, s2Out);
}
s2Iter = s2Iter.getParent();
}
throw new IllegalStateException("Nodes do not share a parent node");
} } | public class class_name {
public LCAInfo<S, I, O> findLCA(final ADTNode<S, I, O> s1, final ADTNode<S, I, O> s2) {
final Map<ADTNode<S, I, O>, ADTNode<S, I, O>> s1ParentsToS1 = new HashMap<>();
ADTNode<S, I, O> s1Iter = s1;
ADTNode<S, I, O> s2Iter = s2;
while (s1Iter.getParent() != null) {
s1ParentsToS1.put(s1Iter.getParent(), s1Iter); // depends on control dependency: [while], data = [(s1Iter.getParent()]
s1Iter = s1Iter.getParent(); // depends on control dependency: [while], data = [none]
}
final Set<ADTNode<S, I, O>> s1Parents = s1ParentsToS1.keySet();
while (s2Iter.getParent() != null) {
if (s1Parents.contains(s2Iter.getParent())) {
if (!ADTUtil.isSymbolNode(s2Iter.getParent())) {
throw new IllegalStateException("Only Symbol Nodes should be LCAs");
}
final ADTNode<S, I, O> lca = s2Iter.getParent();
final O s1Out = ADTUtil.getOutputForSuccessor(lca, s1ParentsToS1.get(lca));
final O s2Out = ADTUtil.getOutputForSuccessor(lca, s2Iter);
return new LCAInfo<>(lca, s1Out, s2Out); // depends on control dependency: [if], data = [none]
}
s2Iter = s2Iter.getParent(); // depends on control dependency: [while], data = [none]
}
throw new IllegalStateException("Nodes do not share a parent node");
} } |
public class class_name {
public void marshall(DescribeIdentityProviderConfigurationRequest describeIdentityProviderConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (describeIdentityProviderConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeIdentityProviderConfigurationRequest.getFleetArn(), FLEETARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeIdentityProviderConfigurationRequest describeIdentityProviderConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (describeIdentityProviderConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeIdentityProviderConfigurationRequest.getFleetArn(), FLEETARN_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 boolean addDescriptor() {
saveLocalization();
IndexedContainer oldContainer = m_container;
try {
createAndLockDescriptorFile();
unmarshalDescriptor();
updateBundleDescriptorContent();
m_hasMasterMode = true;
m_container = createContainer();
m_editorState.put(EditMode.DEFAULT, getDefaultState());
m_editorState.put(EditMode.MASTER, getMasterState());
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
if (m_descContent != null) {
m_descContent = null;
}
if (m_descFile != null) {
m_descFile = null;
}
if (m_desc != null) {
try {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));
} catch (CmsException ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
m_desc = null;
}
m_hasMasterMode = false;
m_container = oldContainer;
return false;
}
m_removeDescriptorOnCancel = true;
return true;
} } | public class class_name {
public boolean addDescriptor() {
saveLocalization();
IndexedContainer oldContainer = m_container;
try {
createAndLockDescriptorFile(); // depends on control dependency: [try], data = [none]
unmarshalDescriptor(); // depends on control dependency: [try], data = [none]
updateBundleDescriptorContent(); // depends on control dependency: [try], data = [none]
m_hasMasterMode = true; // depends on control dependency: [try], data = [none]
m_container = createContainer(); // depends on control dependency: [try], data = [none]
m_editorState.put(EditMode.DEFAULT, getDefaultState()); // depends on control dependency: [try], data = [none]
m_editorState.put(EditMode.MASTER, getMasterState()); // depends on control dependency: [try], data = [none]
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
if (m_descContent != null) {
m_descContent = null; // depends on control dependency: [if], data = [none]
}
if (m_descFile != null) {
m_descFile = null; // depends on control dependency: [if], data = [none]
}
if (m_desc != null) {
try {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1)); // depends on control dependency: [try], data = [none]
} catch (CmsException ex) {
LOG.error(ex.getLocalizedMessage(), ex);
} // depends on control dependency: [catch], data = [none]
m_desc = null; // depends on control dependency: [if], data = [none]
}
m_hasMasterMode = false;
m_container = oldContainer;
return false;
} // depends on control dependency: [catch], data = [none]
m_removeDescriptorOnCancel = true;
return true;
} } |
public class class_name {
public boolean exists() {
try {
if(!isBinary)return getJedisCommands(groupName).exists(key);
if(isCluster(groupName)){
return getBinaryJedisClusterCommands(groupName).exists(keyBytes);
}
return getBinaryJedisCommands(groupName).exists(keyBytes);
} finally {
getJedisProvider(groupName).release();
}
} } | public class class_name {
public boolean exists() {
try {
if(!isBinary)return getJedisCommands(groupName).exists(key);
if(isCluster(groupName)){
return getBinaryJedisClusterCommands(groupName).exists(keyBytes); // depends on control dependency: [if], data = [none]
}
return getBinaryJedisCommands(groupName).exists(keyBytes); // depends on control dependency: [try], data = [none]
} finally {
getJedisProvider(groupName).release();
}
} } |
public class class_name {
public long getLong(String name, long defaultVal){
if(this.configuration.containsKey(name)){
return this.configuration.getLong(name);
} else {
return defaultVal;
}
} } | public class class_name {
public long getLong(String name, long defaultVal){
if(this.configuration.containsKey(name)){
return this.configuration.getLong(name); // depends on control dependency: [if], data = [none]
} else {
return defaultVal; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double[] colMin(double[][] data) {
double[] x = new double[data[0].length];
for (int i = 0; i < x.length; i++) {
x[i] = Double.POSITIVE_INFINITY;
}
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < x.length; j++) {
if (x[j] > data[i][j]) {
x[j] = data[i][j];
}
}
}
return x;
} } | public class class_name {
public static double[] colMin(double[][] data) {
double[] x = new double[data[0].length];
for (int i = 0; i < x.length; i++) {
x[i] = Double.POSITIVE_INFINITY; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < x.length; j++) {
if (x[j] > data[i][j]) {
x[j] = data[i][j]; // depends on control dependency: [if], data = [none]
}
}
}
return x;
} } |
public class class_name {
private boolean processTrueOrFalse() {
if (token.tokenType == Tokens.TRUE) {
read();
return true;
} else if (token.tokenType == Tokens.FALSE) {
read();
return false;
} else {
throw unexpectedToken();
}
} } | public class class_name {
private boolean processTrueOrFalse() {
if (token.tokenType == Tokens.TRUE) {
read(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (token.tokenType == Tokens.FALSE) {
read(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else {
throw unexpectedToken();
}
} } |
public class class_name {
public static String getExtension(final String fileName, final boolean withPoint) {
final int lastIndexOf = fileName.lastIndexOf(".");
if (!withPoint) {
return fileName.substring(lastIndexOf + 1);
}
return fileName.substring(lastIndexOf);
} } | public class class_name {
public static String getExtension(final String fileName, final boolean withPoint) {
final int lastIndexOf = fileName.lastIndexOf(".");
if (!withPoint) {
return fileName.substring(lastIndexOf + 1);
// depends on control dependency: [if], data = [none]
}
return fileName.substring(lastIndexOf);
} } |
public class class_name {
public void binding(Map map)
{
Map<String, Object> values = map;
if(values==null) return ;
for (Entry<String,Object> entry : values.entrySet())
{
this.binding(entry.getKey(), entry.getValue());
}
} } | public class class_name {
public void binding(Map map)
{
Map<String, Object> values = map;
if(values==null) return ;
for (Entry<String,Object> entry : values.entrySet())
{
this.binding(entry.getKey(), entry.getValue());
// depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
@Override
public Entity findOneById(Object id) {
if (cacheable
&& !transactionInformation.isEntireRepositoryDirty(getEntityType())
&& !transactionInformation.isEntityDirty(EntityKey.create(getEntityType(), id))) {
return l2Cache.get(delegate(), id);
}
return delegate().findOneById(id);
} } | public class class_name {
@Override
public Entity findOneById(Object id) {
if (cacheable
&& !transactionInformation.isEntireRepositoryDirty(getEntityType())
&& !transactionInformation.isEntityDirty(EntityKey.create(getEntityType(), id))) {
return l2Cache.get(delegate(), id); // depends on control dependency: [if], data = [none]
}
return delegate().findOneById(id);
} } |
public class class_name {
void submit() {
if (isValid()) {
if (m_project == null) {
createProject();
} else {
saveProject();
}
m_table.loadProjects();
m_window.close();
}
} } | public class class_name {
void submit() {
if (isValid()) {
if (m_project == null) {
createProject(); // depends on control dependency: [if], data = [none]
} else {
saveProject(); // depends on control dependency: [if], data = [none]
}
m_table.loadProjects(); // depends on control dependency: [if], data = [none]
m_window.close(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void nodeAddition(final double[][] mat, final BiclusterCandidate cand) {
cand.updateRowAndColumnMeans(mat, true);
cand.computeMeanSquaredDeviation(mat);
while(true) {
// We need this to be final + mutable
final boolean[] added = new boolean[] { false, false };
// Step 2: add columns
cand.visitRow(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selcol);
if(cand.computeColResidue(mat, col) <= cand.residue) {
cand.selectColumn(col, true);
added[0] = true;
}
return false;
}
});
// Step 3: recompute values
if(added[0]) {
cand.updateRowAndColumnMeans(mat, true);
cand.computeMeanSquaredDeviation(mat);
}
// Step 4: try adding rows.
cand.visitColumn(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selrow);
if(cand.computeRowResidue(mat, row, false) <= cand.residue) {
cand.selectRow(row, true);
added[1] = true;
}
return false;
}
});
// Step 5: try adding inverted rows.
if(useinverted) {
cand.visitColumn(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selrow);
if(cand.computeRowResidue(mat, row, true) <= cand.residue) {
cand.selectRow(row, true);
cand.invertRow(row, true);
added[1] = true;
}
return false;
}
});
}
if(added[1]) {
cand.updateRowAndColumnMeans(mat, true);
cand.computeMeanSquaredDeviation(mat);
if(LOG.isDebuggingFine()) {
LOG.debugFine("Residue in Alg 3: " + cand.residue + " " + cand.rowcard + "x" + cand.colcard);
}
}
if(!added[0] && !added[1]) {
break;
}
}
} } | public class class_name {
private void nodeAddition(final double[][] mat, final BiclusterCandidate cand) {
cand.updateRowAndColumnMeans(mat, true);
cand.computeMeanSquaredDeviation(mat);
while(true) {
// We need this to be final + mutable
final boolean[] added = new boolean[] { false, false };
// Step 2: add columns
cand.visitRow(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selcol);
if(cand.computeColResidue(mat, col) <= cand.residue) {
cand.selectColumn(col, true); // depends on control dependency: [if], data = [none]
added[0] = true; // depends on control dependency: [if], data = [none]
}
return false;
}
}); // depends on control dependency: [while], data = [none]
// Step 3: recompute values
if(added[0]) {
cand.updateRowAndColumnMeans(mat, true); // depends on control dependency: [if], data = [none]
cand.computeMeanSquaredDeviation(mat); // depends on control dependency: [if], data = [none]
}
// Step 4: try adding rows.
cand.visitColumn(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selrow);
if(cand.computeRowResidue(mat, row, false) <= cand.residue) {
cand.selectRow(row, true); // depends on control dependency: [if], data = [none]
added[1] = true; // depends on control dependency: [if], data = [none]
}
return false;
}
}); // depends on control dependency: [while], data = [none]
// Step 5: try adding inverted rows.
if(useinverted) {
cand.visitColumn(mat, 0, CellVisitor.NOT_SELECTED, new CellVisitor() {
@Override
public boolean visit(double val, int row, int col, boolean selrow, boolean selcol) {
assert (!selrow);
if(cand.computeRowResidue(mat, row, true) <= cand.residue) {
cand.selectRow(row, true); // depends on control dependency: [if], data = [none]
cand.invertRow(row, true); // depends on control dependency: [if], data = [none]
added[1] = true; // depends on control dependency: [if], data = [none]
}
return false;
}
}); // depends on control dependency: [if], data = [none]
}
if(added[1]) {
cand.updateRowAndColumnMeans(mat, true); // depends on control dependency: [if], data = [none]
cand.computeMeanSquaredDeviation(mat); // depends on control dependency: [if], data = [none]
if(LOG.isDebuggingFine()) {
LOG.debugFine("Residue in Alg 3: " + cand.residue + " " + cand.rowcard + "x" + cand.colcard); // depends on control dependency: [if], data = [none]
}
}
if(!added[0] && !added[1]) {
break;
}
}
} } |
public class class_name {
public void logWarning(String pMessage,
Throwable pRootCause)
throws ELException {
if (isLoggingWarning()) {
if (mOut != null) {
if (pMessage == null) {
mOut.println(pRootCause);
} else if (pRootCause == null) {
mOut.println(pMessage);
} else {
mOut.println(pMessage + ": " + pRootCause);
}
}
}
} } | public class class_name {
public void logWarning(String pMessage,
Throwable pRootCause)
throws ELException {
if (isLoggingWarning()) {
if (mOut != null) {
if (pMessage == null) {
mOut.println(pRootCause); // depends on control dependency: [if], data = [none]
} else if (pRootCause == null) {
mOut.println(pMessage); // depends on control dependency: [if], data = [none]
} else {
mOut.println(pMessage + ": " + pRootCause); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public RamlParameter queryParameter(String name) {
if (queryParameters == null) {
queryParameters = new LinkedHashMap<>();
}
RamlParameter param = queryParameters.get(name);
if (param == null) {
param = new RamlParameter(name);
queryParameters.put(name, param);
}
return param;
} } | public class class_name {
public RamlParameter queryParameter(String name) {
if (queryParameters == null) {
queryParameters = new LinkedHashMap<>(); // depends on control dependency: [if], data = [none]
}
RamlParameter param = queryParameters.get(name);
if (param == null) {
param = new RamlParameter(name); // depends on control dependency: [if], data = [none]
queryParameters.put(name, param); // depends on control dependency: [if], data = [none]
}
return param;
} } |
public class class_name {
public TcpIpConfig setMembers(final List<String> members) {
isNotNull(members, "members");
this.members.clear();
for (String member : members) {
addMember(member);
}
return this;
} } | public class class_name {
public TcpIpConfig setMembers(final List<String> members) {
isNotNull(members, "members");
this.members.clear();
for (String member : members) {
addMember(member); // depends on control dependency: [for], data = [member]
}
return this;
} } |
public class class_name {
public static void addToHadoopConfiguration(Configuration conf) {
final String SERIALIZATION_KEY = "io.serializations";
String existingSerializers = conf.get(SERIALIZATION_KEY);
if (existingSerializers != null) {
conf.set(SERIALIZATION_KEY, existingSerializers + "," + WritableShimSerialization.class.getName());
} else {
conf.set(SERIALIZATION_KEY,
"org.apache.hadoop.io.serializer.WritableSerialization," + WritableShimSerialization.class.getName());
}
} } | public class class_name {
public static void addToHadoopConfiguration(Configuration conf) {
final String SERIALIZATION_KEY = "io.serializations";
String existingSerializers = conf.get(SERIALIZATION_KEY);
if (existingSerializers != null) {
conf.set(SERIALIZATION_KEY, existingSerializers + "," + WritableShimSerialization.class.getName()); // depends on control dependency: [if], data = [none]
} else {
conf.set(SERIALIZATION_KEY,
"org.apache.hadoop.io.serializer.WritableSerialization," + WritableShimSerialization.class.getName()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
Integer arraySize = null;
String[] loadedTypes = null;
try {
stack.precomputation(this);
switch (seen) {
case Const.ANEWARRAY: {
if (Values.SLASHED_JAVA_LANG_CLASS.equals(getClassConstantOperand()) && (stack.getStackDepth() >= 1)) {
OpcodeStack.Item item = stack.getStackItem(0);
arraySize = (Integer) item.getConstant();
}
}
break;
case Const.AASTORE: {
if (stack.getStackDepth() >= 3) {
OpcodeStack.Item arrayItem = stack.getStackItem(2);
String[] arrayTypes = (String[]) arrayItem.getUserValue();
if (arrayTypes != null) {
OpcodeStack.Item valueItem = stack.getStackItem(0);
String type = (String) valueItem.getConstant();
if (type != null) {
OpcodeStack.Item indexItem = stack.getStackItem(1);
Integer index = (Integer) indexItem.getConstant();
if (index != null) {
arrayTypes[index.intValue()] = type;
}
}
}
}
}
break;
case Const.PUTFIELD:
case Const.PUTSTATIC: {
String name = getNameConstantOperand();
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
String[] arrayTypes = (String[]) item.getUserValue();
if (arrayTypes != null) {
fieldClassTypes.put(name, arrayTypes);
return;
}
}
fieldClassTypes.remove(name);
}
break;
case Const.GETFIELD:
case Const.GETSTATIC: {
String name = getNameConstantOperand();
loadedTypes = fieldClassTypes.get(name);
}
break;
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
case Const.ASTORE: {
Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen));
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
String[] arrayTypes = (String[]) item.getUserValue();
if (arrayTypes != null) {
localClassTypes.put(reg, arrayTypes);
return;
}
}
localClassTypes.remove(reg);
}
break;
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3:
case Const.ALOAD: {
int reg = RegisterUtils.getAStoreReg(this, seen);
loadedTypes = localClassTypes.get(Integer.valueOf(reg));
}
break;
case Const.INVOKEVIRTUAL: {
String cls = getClassConstantOperand();
if (Values.SLASHED_JAVA_LANG_CLASS.equals(cls)) {
String method = getNameConstantOperand();
if ("getMethod".equals(method)) {
String sig = getSigConstantOperand();
if (SIG_STRING_AND_CLASS_ARRAY_TO_METHOD.equals(sig) && (stack.getStackDepth() >= 2)) {
OpcodeStack.Item clsArgs = stack.getStackItem(0);
String[] arrayTypes = (String[]) clsArgs.getUserValue();
if ((arrayTypes != null) || clsArgs.isNull()) {
OpcodeStack.Item methodItem = stack.getStackItem(1);
String methodName = (String) methodItem.getConstant();
if (methodName != null) {
String reflectionSig = sigWithoutReturn.withMethodName(methodName).withParamTypes(arrayTypes).build();
if (objectSigs.contains(reflectionSig)) {
loadedTypes = (arrayTypes == null) ? new String[0] : arrayTypes;
}
}
}
}
}
} else if ("java/lang/reflect/Method".equals(cls)) {
String method = getNameConstantOperand();
if ("invoke".equals(method) && (stack.getStackDepth() >= 3)) {
OpcodeStack.Item methodItem = stack.getStackItem(2);
String[] arrayTypes = (String[]) methodItem.getUserValue();
if (arrayTypes != null) {
bugReporter.reportBug(new BugInstance(this, BugType.ROOM_REFLECTION_ON_OBJECT_METHODS.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this));
}
}
}
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if (stack.getStackDepth() >= 1) {
if (arraySize != null) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(new String[arraySize.intValue()]);
} else if (loadedTypes != null) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(loadedTypes);
}
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
Integer arraySize = null;
String[] loadedTypes = null;
try {
stack.precomputation(this);
switch (seen) {
case Const.ANEWARRAY: {
if (Values.SLASHED_JAVA_LANG_CLASS.equals(getClassConstantOperand()) && (stack.getStackDepth() >= 1)) {
OpcodeStack.Item item = stack.getStackItem(0);
arraySize = (Integer) item.getConstant(); // depends on control dependency: [if], data = [none]
}
}
break;
case Const.AASTORE: {
if (stack.getStackDepth() >= 3) {
OpcodeStack.Item arrayItem = stack.getStackItem(2);
String[] arrayTypes = (String[]) arrayItem.getUserValue();
if (arrayTypes != null) {
OpcodeStack.Item valueItem = stack.getStackItem(0);
String type = (String) valueItem.getConstant();
if (type != null) {
OpcodeStack.Item indexItem = stack.getStackItem(1);
Integer index = (Integer) indexItem.getConstant();
if (index != null) {
arrayTypes[index.intValue()] = type; // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
case Const.PUTFIELD:
case Const.PUTSTATIC: {
String name = getNameConstantOperand();
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
String[] arrayTypes = (String[]) item.getUserValue();
if (arrayTypes != null) {
fieldClassTypes.put(name, arrayTypes); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
fieldClassTypes.remove(name);
}
break;
case Const.GETFIELD:
case Const.GETSTATIC: {
String name = getNameConstantOperand();
loadedTypes = fieldClassTypes.get(name);
}
break;
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
case Const.ASTORE: {
Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen));
if (stack.getStackDepth() >= 1) {
OpcodeStack.Item item = stack.getStackItem(0);
String[] arrayTypes = (String[]) item.getUserValue();
if (arrayTypes != null) {
localClassTypes.put(reg, arrayTypes); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
localClassTypes.remove(reg);
}
break;
case Const.ALOAD_0:
case Const.ALOAD_1:
case Const.ALOAD_2:
case Const.ALOAD_3:
case Const.ALOAD: {
int reg = RegisterUtils.getAStoreReg(this, seen);
loadedTypes = localClassTypes.get(Integer.valueOf(reg));
}
break;
case Const.INVOKEVIRTUAL: {
String cls = getClassConstantOperand();
if (Values.SLASHED_JAVA_LANG_CLASS.equals(cls)) {
String method = getNameConstantOperand();
if ("getMethod".equals(method)) {
String sig = getSigConstantOperand();
if (SIG_STRING_AND_CLASS_ARRAY_TO_METHOD.equals(sig) && (stack.getStackDepth() >= 2)) {
OpcodeStack.Item clsArgs = stack.getStackItem(0);
String[] arrayTypes = (String[]) clsArgs.getUserValue();
if ((arrayTypes != null) || clsArgs.isNull()) {
OpcodeStack.Item methodItem = stack.getStackItem(1);
String methodName = (String) methodItem.getConstant();
if (methodName != null) {
String reflectionSig = sigWithoutReturn.withMethodName(methodName).withParamTypes(arrayTypes).build();
if (objectSigs.contains(reflectionSig)) {
loadedTypes = (arrayTypes == null) ? new String[0] : arrayTypes; // depends on control dependency: [if], data = [none]
}
}
}
}
}
} else if ("java/lang/reflect/Method".equals(cls)) {
String method = getNameConstantOperand();
if ("invoke".equals(method) && (stack.getStackDepth() >= 3)) {
OpcodeStack.Item methodItem = stack.getStackItem(2);
String[] arrayTypes = (String[]) methodItem.getUserValue();
if (arrayTypes != null) {
bugReporter.reportBug(new BugInstance(this, BugType.ROOM_REFLECTION_ON_OBJECT_METHODS.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this)); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default:
break;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
if (stack.getStackDepth() >= 1) {
if (arraySize != null) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(new String[arraySize.intValue()]);
} else if (loadedTypes != null) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(loadedTypes);
}
}
}
} } |
public class class_name {
public QuickMenuItem getQuickMenuItemByAction(String action) {
List<QuickMenuItem> itemList = getQuickMenuItemList();
for (QuickMenuItem item : itemList) {
if (item.getActionName().equals(action)) {
return item;
}
}
return null;
} } | public class class_name {
public QuickMenuItem getQuickMenuItemByAction(String action) {
List<QuickMenuItem> itemList = getQuickMenuItemList();
for (QuickMenuItem item : itemList) {
if (item.getActionName().equals(action)) {
return item; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void checkAlarms(final ZonedDateTime TIME) {
alarmsToRemove.clear();
for (Alarm alarm : alarms) {
final ZonedDateTime ALARM_TIME = alarm.getTime();
switch (alarm.getRepetition()) {
case ONCE:
if (TIME.isAfter(ALARM_TIME)) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
alarm.executeCommand();
}
alarmsToRemove.add(alarm);
}
break;
case HALF_HOURLY:
if ((ALARM_TIME.getMinute() == TIME.getMinute() ||
ALARM_TIME.plusMinutes(30).getMinute() == TIME.getMinute()) &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
alarm.executeCommand();
}
}
break;
case HOURLY:
if (ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
alarm.executeCommand();
}
}
break;
case DAILY:
if (ALARM_TIME.getHour() == TIME.getHour() &&
ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
alarm.executeCommand();
}
}
break;
case WEEKLY:
if (ALARM_TIME.getDayOfWeek() == TIME.getDayOfWeek() &&
ALARM_TIME.getHour() == TIME.getHour() &&
ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
alarm.executeCommand();
}
}
break;
}
}
for (Alarm alarm : alarmsToRemove) {
removeAlarm(alarm);
}
} } | public class class_name {
private void checkAlarms(final ZonedDateTime TIME) {
alarmsToRemove.clear();
for (Alarm alarm : alarms) {
final ZonedDateTime ALARM_TIME = alarm.getTime();
switch (alarm.getRepetition()) {
case ONCE:
if (TIME.isAfter(ALARM_TIME)) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm)); // depends on control dependency: [if], data = [none]
alarm.executeCommand(); // depends on control dependency: [if], data = [none]
}
alarmsToRemove.add(alarm); // depends on control dependency: [if], data = [none]
}
break;
case HALF_HOURLY:
if ((ALARM_TIME.getMinute() == TIME.getMinute() ||
ALARM_TIME.plusMinutes(30).getMinute() == TIME.getMinute()) &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm)); // depends on control dependency: [if], data = [none]
alarm.executeCommand(); // depends on control dependency: [if], data = [none]
}
}
break;
case HOURLY:
if (ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm)); // depends on control dependency: [if], data = [none]
alarm.executeCommand(); // depends on control dependency: [if], data = [none]
}
}
break;
case DAILY:
if (ALARM_TIME.getHour() == TIME.getHour() &&
ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm)); // depends on control dependency: [if], data = [none]
alarm.executeCommand(); // depends on control dependency: [if], data = [none]
}
}
break;
case WEEKLY:
if (ALARM_TIME.getDayOfWeek() == TIME.getDayOfWeek() &&
ALARM_TIME.getHour() == TIME.getHour() &&
ALARM_TIME.getMinute() == TIME.getMinute() &&
ALARM_TIME.getSecond() == TIME.getSecond()) {
if (alarm.isArmed()) {
fireAlarmEvent(new AlarmEvent(Clock.this, alarm)); // depends on control dependency: [if], data = [none]
alarm.executeCommand(); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
for (Alarm alarm : alarmsToRemove) {
removeAlarm(alarm);
}
} } |
public class class_name {
private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
ClassLoader acl = cl;
do {
acl = acl.getParent();
if (p == acl) {
return true;
}
} while (acl != null);
return false;
} } | public class class_name {
private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
ClassLoader acl = cl;
do {
acl = acl.getParent();
if (p == acl) {
return true; // depends on control dependency: [if], data = [none]
}
} while (acl != null);
return false;
} } |
public class class_name {
public void setCallState(int callState, String incomingPhoneNumber) {
if (callState != CALL_STATE_RINGING) {
incomingPhoneNumber = null;
}
this.callState = callState;
this.incomingPhoneNumber = incomingPhoneNumber;
for (PhoneStateListener listener : getListenersForFlags(LISTEN_CALL_STATE)) {
listener.onCallStateChanged(callState, incomingPhoneNumber);
}
} } | public class class_name {
public void setCallState(int callState, String incomingPhoneNumber) {
if (callState != CALL_STATE_RINGING) {
incomingPhoneNumber = null; // depends on control dependency: [if], data = [none]
}
this.callState = callState;
this.incomingPhoneNumber = incomingPhoneNumber;
for (PhoneStateListener listener : getListenersForFlags(LISTEN_CALL_STATE)) {
listener.onCallStateChanged(callState, incomingPhoneNumber); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <A, D, M extends Map<K, D>> M grouping(Supplier<M> mapSupplier, Collector<? super V, A, D> downstream) {
Function<Entry<K, V>, K> keyMapper = Entry::getKey;
Collector<Entry<K, V>, ?, D> mapping = Collectors.mapping(Entry::getValue, downstream);
if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)
&& mapSupplier.get() instanceof ConcurrentMap) {
return (M) collect(Collectors.groupingByConcurrent(keyMapper,
(Supplier<? extends ConcurrentMap<K, D>>) mapSupplier, mapping));
}
return collect(Collectors.groupingBy(keyMapper, mapSupplier, mapping));
} } | public class class_name {
@SuppressWarnings("unchecked")
public <A, D, M extends Map<K, D>> M grouping(Supplier<M> mapSupplier, Collector<? super V, A, D> downstream) {
Function<Entry<K, V>, K> keyMapper = Entry::getKey;
Collector<Entry<K, V>, ?, D> mapping = Collectors.mapping(Entry::getValue, downstream);
if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)
&& mapSupplier.get() instanceof ConcurrentMap) {
return (M) collect(Collectors.groupingByConcurrent(keyMapper,
(Supplier<? extends ConcurrentMap<K, D>>) mapSupplier, mapping));
// depends on control dependency: [if], data = [none]
}
return collect(Collectors.groupingBy(keyMapper, mapSupplier, mapping));
} } |
public class class_name {
@Override
public EClass getIfcStyledItem() {
if (ifcStyledItemEClass == null) {
ifcStyledItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(666);
}
return ifcStyledItemEClass;
} } | public class class_name {
@Override
public EClass getIfcStyledItem() {
if (ifcStyledItemEClass == null) {
ifcStyledItemEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(666);
// depends on control dependency: [if], data = [none]
}
return ifcStyledItemEClass;
} } |
public class class_name {
public String requestPost(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.debug("Executing post on: " + this.pathUrl + "/" + id);
httpPost = new HttpPost(this.pathUrl + "/" + id);
preparePostHeader(httpPost, "application/json", "application/json");
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_CREATED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity());
}
closeResponseObject(response);
log.trace("received: " + result);
httpPost.releaseConnection();
return result;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPost != null) {
httpPost.releaseConnection();
}
throw new SDKException(
"Could not http-post or open the object properly",
e.getStackTrace(),
"Could not http-post or open the object properly because: " + e.getMessage());
} catch (SDKException e) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection();
}
return requestPost(id);
} else {
if (httpPost != null) {
httpPost.releaseConnection();
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} } | public class class_name {
public String requestPost(final String id) throws SDKException {
CloseableHttpResponse response = null;
HttpPost httpPost = null;
checkToken();
try {
log.debug("pathUrl: " + pathUrl);
log.debug("id: " + pathUrl + "/" + id);
// call the api here
log.debug("Executing post on: " + this.pathUrl + "/" + id);
httpPost = new HttpPost(this.pathUrl + "/" + id);
preparePostHeader(httpPost, "application/json", "application/json");
response = httpClient.execute(httpPost);
// check response status
RestUtils.checkStatus(response, HttpURLConnection.HTTP_CREATED);
// return the response of the request
String result = "";
if (response.getEntity() != null) {
result = EntityUtils.toString(response.getEntity()); // depends on control dependency: [if], data = [(response.getEntity()]
}
closeResponseObject(response);
log.trace("received: " + result);
httpPost.releaseConnection();
return result;
} catch (IOException e) {
// catch request exceptions here
log.error(e.getMessage(), e);
if (httpPost != null) {
httpPost.releaseConnection(); // depends on control dependency: [if], data = [none]
}
throw new SDKException(
"Could not http-post or open the object properly",
e.getStackTrace(),
"Could not http-post or open the object properly because: " + e.getMessage());
} catch (SDKException e) {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
token = null;
if (httpPost != null) {
httpPost.releaseConnection(); // depends on control dependency: [if], data = [none]
}
return requestPost(id);
} else {
if (httpPost != null) {
httpPost.releaseConnection(); // depends on control dependency: [if], data = [none]
}
try {
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
EntityUtils.toString(response.getEntity()));
} catch (IOException e1) {
e1.printStackTrace();
throw new SDKException(
"Status is " + response.getStatusLine().getStatusCode(),
new StackTraceElement[0],
"could not provide reason because: " + e.getMessage());
}
}
}
} } |
public class class_name {
public void marshall(ListDevicesRequest listDevicesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDevicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDevicesRequest.getFleetArn(), FLEETARN_BINDING);
protocolMarshaller.marshall(listDevicesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listDevicesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListDevicesRequest listDevicesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDevicesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDevicesRequest.getFleetArn(), FLEETARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDevicesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDevicesRequest.getMaxResults(), MAXRESULTS_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 {
protected void regenerateMetrics() {
if(isInstrumentationEnabled()) {
this.recordsMeter = Optional.of(this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_IN_METER));
this.passedRecordsMeter = Optional.of(
this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_PASSED_METER));
this.failedRecordsMeter = Optional.of(
this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_FAILED_METER));
this.policyTimer = Optional.<Timer>of(
this.metricContext.timer(MetricNames.RowLevelPolicyMetrics.CHECK_TIMER));
} else {
this.recordsMeter = Optional.absent();
this.passedRecordsMeter = Optional.absent();
this.failedRecordsMeter = Optional.absent();
this.policyTimer = Optional.absent();
}
} } | public class class_name {
protected void regenerateMetrics() {
if(isInstrumentationEnabled()) {
this.recordsMeter = Optional.of(this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_IN_METER)); // depends on control dependency: [if], data = [none]
this.passedRecordsMeter = Optional.of(
this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_PASSED_METER)); // depends on control dependency: [if], data = [none]
this.failedRecordsMeter = Optional.of(
this.metricContext.meter(MetricNames.RowLevelPolicyMetrics.RECORDS_FAILED_METER)); // depends on control dependency: [if], data = [none]
this.policyTimer = Optional.<Timer>of(
this.metricContext.timer(MetricNames.RowLevelPolicyMetrics.CHECK_TIMER)); // depends on control dependency: [if], data = [none]
} else {
this.recordsMeter = Optional.absent(); // depends on control dependency: [if], data = [none]
this.passedRecordsMeter = Optional.absent(); // depends on control dependency: [if], data = [none]
this.failedRecordsMeter = Optional.absent(); // depends on control dependency: [if], data = [none]
this.policyTimer = Optional.absent(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean doShutdown() {
if (state == State.NOT_RUNNING) {
LOGGER.debug("Engine already shut down.");
return true;
}
LOGGER.debug("Shutting down engine...");
final Lock lock = this.lock.writeLock();
try {
lock.lock();
state = State.STOPPING;
if (!repositories.isEmpty()) {
// Now go through all of the repositories and request they all be shutdown ...
Queue<Future<Boolean>> repoFutures = new LinkedList<Future<Boolean>>();
Queue<String> repoNames = new LinkedList<String>();
for (JcrRepository repository : repositories.values()) {
if (repository != null) {
repoNames.add(repository.getName());
repoFutures.add(repository.shutdown());
}
}
// Now block while each is shutdown ...
while (repoFutures.peek() != null) {
String repoName = repoNames.poll();
try {
// Get the results from the future (this will return only when the shutdown has completed) ...
repoFutures.poll().get();
// We've successfully shut down, so remove it from the map ...
repositories.remove(repoName);
} catch (ExecutionException | InterruptedException e) {
Logger.getLogger(getClass()).error(e, JcrI18n.failedToShutdownDeployedRepository, repoName);
}
}
}
if (repositories.isEmpty()) {
// All repositories were properly shutdown, so now stop the service for starting and shutting down the repos ...
repositoryStarterService.shutdown();
repositoryStarterService = null;
// Do not clear the set of repositories, so that restarting will work just fine ...
this.state = State.NOT_RUNNING;
} else {
// Could not shut down all repositories, so keep running ..
this.state = State.RUNNING;
}
} catch (RuntimeException e) {
this.state = State.RUNNING;
throw e;
} finally {
lock.unlock();
}
return this.state != State.RUNNING;
} } | public class class_name {
protected boolean doShutdown() {
if (state == State.NOT_RUNNING) {
LOGGER.debug("Engine already shut down."); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
LOGGER.debug("Shutting down engine...");
final Lock lock = this.lock.writeLock();
try {
lock.lock(); // depends on control dependency: [try], data = [none]
state = State.STOPPING; // depends on control dependency: [try], data = [none]
if (!repositories.isEmpty()) {
// Now go through all of the repositories and request they all be shutdown ...
Queue<Future<Boolean>> repoFutures = new LinkedList<Future<Boolean>>();
Queue<String> repoNames = new LinkedList<String>();
for (JcrRepository repository : repositories.values()) {
if (repository != null) {
repoNames.add(repository.getName()); // depends on control dependency: [if], data = [(repository]
repoFutures.add(repository.shutdown()); // depends on control dependency: [if], data = [(repository]
}
}
// Now block while each is shutdown ...
while (repoFutures.peek() != null) {
String repoName = repoNames.poll();
try {
// Get the results from the future (this will return only when the shutdown has completed) ...
repoFutures.poll().get(); // depends on control dependency: [try], data = [none]
// We've successfully shut down, so remove it from the map ...
repositories.remove(repoName); // depends on control dependency: [try], data = [none]
} catch (ExecutionException | InterruptedException e) {
Logger.getLogger(getClass()).error(e, JcrI18n.failedToShutdownDeployedRepository, repoName);
} // depends on control dependency: [catch], data = [none]
}
}
if (repositories.isEmpty()) {
// All repositories were properly shutdown, so now stop the service for starting and shutting down the repos ...
repositoryStarterService.shutdown(); // depends on control dependency: [if], data = [none]
repositoryStarterService = null; // depends on control dependency: [if], data = [none]
// Do not clear the set of repositories, so that restarting will work just fine ...
this.state = State.NOT_RUNNING; // depends on control dependency: [if], data = [none]
} else {
// Could not shut down all repositories, so keep running ..
this.state = State.RUNNING; // depends on control dependency: [if], data = [none]
}
} catch (RuntimeException e) {
this.state = State.RUNNING;
throw e;
} finally { // depends on control dependency: [catch], data = [none]
lock.unlock();
}
return this.state != State.RUNNING;
} } |
public class class_name {
@Override
public String isValidID(String id) {
Data data;
try {
data = identities.find(id, identities.reuse());
} catch (IOException e) {
return getName() + " could not lookup " + id + ": " + e.getLocalizedMessage();
}
return data==null?id + "is not an Identity in " + getName():null;
} } | public class class_name {
@Override
public String isValidID(String id) {
Data data;
try {
data = identities.find(id, identities.reuse()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return getName() + " could not lookup " + id + ": " + e.getLocalizedMessage();
} // depends on control dependency: [catch], data = [none]
return data==null?id + "is not an Identity in " + getName():null;
} } |
public class class_name {
public void marshall(StartDocumentAnalysisRequest startDocumentAnalysisRequest, ProtocolMarshaller protocolMarshaller) {
if (startDocumentAnalysisRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startDocumentAnalysisRequest.getDocumentLocation(), DOCUMENTLOCATION_BINDING);
protocolMarshaller.marshall(startDocumentAnalysisRequest.getFeatureTypes(), FEATURETYPES_BINDING);
protocolMarshaller.marshall(startDocumentAnalysisRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(startDocumentAnalysisRequest.getJobTag(), JOBTAG_BINDING);
protocolMarshaller.marshall(startDocumentAnalysisRequest.getNotificationChannel(), NOTIFICATIONCHANNEL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartDocumentAnalysisRequest startDocumentAnalysisRequest, ProtocolMarshaller protocolMarshaller) {
if (startDocumentAnalysisRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startDocumentAnalysisRequest.getDocumentLocation(), DOCUMENTLOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startDocumentAnalysisRequest.getFeatureTypes(), FEATURETYPES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startDocumentAnalysisRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startDocumentAnalysisRequest.getJobTag(), JOBTAG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(startDocumentAnalysisRequest.getNotificationChannel(), NOTIFICATIONCHANNEL_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 T loadFileOrResourceValue(final String str)
{
// Ideally we want to resolve str to a File so we can be smart about reloading it
// N.B. Even if str is a classpath reference it's possible it could still be resolved to a file on disk
// We can't be smart about reloading non-File classpath resources but we assume they will not change
final File file;
final URL resource;
{
// First consult the cache of str -> File (if present)
if (lastFile != null && StringUtils.equals(str, lastResourceOrFile))
{
file = lastFile;
resource = null;
}
else if (new File(str).exists())
{
file = new File(str);
resource = null;
}
else
{
try
{
resource = getClass().getResource(str);
if (resource == null)
throw new IllegalArgumentException("JAXB config for " + name + ": no such file or resource: " + str);
final URI uri = resource.toURI();
if (StringUtils.equalsIgnoreCase(uri.getScheme(), "file"))
{
file = new File(uri);
}
else
{
file = null;
}
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException("Error processing classpath resource " +
str +
" from property " +
name +
": URL to URI failed", e);
}
}
}
// Now resource the file or resource
if (file == null)
{
assert (resource != null);
// We reload the cached value ONLY if the resource path changes, we don't take into account the resolved URL
if (cached == null || !StringUtils.equals(str, lastResourceOrFile))
{
lastResourceOrFile = str;
return loadResourceValue(resource);
}
else
{
return cached;
}
}
else
{
lastResourceOrFile = str;
return loadFileValue(file);
}
} } | public class class_name {
private T loadFileOrResourceValue(final String str)
{
// Ideally we want to resolve str to a File so we can be smart about reloading it
// N.B. Even if str is a classpath reference it's possible it could still be resolved to a file on disk
// We can't be smart about reloading non-File classpath resources but we assume they will not change
final File file;
final URL resource;
{
// First consult the cache of str -> File (if present)
if (lastFile != null && StringUtils.equals(str, lastResourceOrFile))
{
file = lastFile; // depends on control dependency: [if], data = [none]
resource = null; // depends on control dependency: [if], data = [none]
}
else if (new File(str).exists())
{
file = new File(str); // depends on control dependency: [if], data = [none]
resource = null; // depends on control dependency: [if], data = [none]
}
else
{
try
{
resource = getClass().getResource(str); // depends on control dependency: [try], data = [none]
if (resource == null)
throw new IllegalArgumentException("JAXB config for " + name + ": no such file or resource: " + str);
final URI uri = resource.toURI();
if (StringUtils.equalsIgnoreCase(uri.getScheme(), "file"))
{
file = new File(uri); // depends on control dependency: [if], data = [none]
}
else
{
file = null; // depends on control dependency: [if], data = [none]
}
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException("Error processing classpath resource " +
str +
" from property " +
name +
": URL to URI failed", e);
} // depends on control dependency: [catch], data = [none]
}
}
// Now resource the file or resource
if (file == null)
{
assert (resource != null); // depends on control dependency: [if], data = [null)]
// We reload the cached value ONLY if the resource path changes, we don't take into account the resolved URL
if (cached == null || !StringUtils.equals(str, lastResourceOrFile))
{
lastResourceOrFile = str; // depends on control dependency: [if], data = [none]
return loadResourceValue(resource); // depends on control dependency: [if], data = [none]
}
else
{
return cached; // depends on control dependency: [if], data = [none]
}
}
else
{
lastResourceOrFile = str; // depends on control dependency: [if], data = [none]
return loadFileValue(file); // depends on control dependency: [if], data = [(file]
}
} } |
public class class_name {
private static boolean processCoords(CharIter iter, CxSmilesState state) {
if (state.atomCoords == null)
state.atomCoords = new ArrayList<>();
while (iter.hasNext()) {
// end of coordinate list
if (iter.curr() == ')') {
iter.next();
iter.nextIf(','); // optional
return true;
}
double x = readDouble(iter);
if (!iter.nextIf(','))
return false;
double y = readDouble(iter);
if (!iter.nextIf(','))
return false;
double z = readDouble(iter);
iter.nextIf(';');
state.coordFlag = state.coordFlag || z != 0;
state.atomCoords.add(new double[]{x, y, z});
}
return false;
} } | public class class_name {
private static boolean processCoords(CharIter iter, CxSmilesState state) {
if (state.atomCoords == null)
state.atomCoords = new ArrayList<>();
while (iter.hasNext()) {
// end of coordinate list
if (iter.curr() == ')') {
iter.next(); // depends on control dependency: [if], data = [none]
iter.nextIf(','); // optional // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
double x = readDouble(iter);
if (!iter.nextIf(','))
return false;
double y = readDouble(iter);
if (!iter.nextIf(','))
return false;
double z = readDouble(iter);
iter.nextIf(';'); // depends on control dependency: [while], data = [none]
state.coordFlag = state.coordFlag || z != 0; // depends on control dependency: [while], data = [none]
state.atomCoords.add(new double[]{x, y, z}); // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public final void sortCatalogs(final List<TradingCatalog> pCurrentList) {
Collections.sort(pCurrentList, this.cmprCatalogs);
for (TradingCatalog tc : pCurrentList) {
if (tc.getSubcatalogs().size() > 0) {
sortCatalogs(tc.getSubcatalogs());
}
}
} } | public class class_name {
public final void sortCatalogs(final List<TradingCatalog> pCurrentList) {
Collections.sort(pCurrentList, this.cmprCatalogs);
for (TradingCatalog tc : pCurrentList) {
if (tc.getSubcatalogs().size() > 0) {
sortCatalogs(tc.getSubcatalogs()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void unlockAll(long[] _stamps) {
OptimisticLock[] _locks = locks;
int sn = _locks.length;
for (int i = 0; i < sn; i++) {
_locks[i].unlockWrite(_stamps[i]);
}
} } | public class class_name {
private void unlockAll(long[] _stamps) {
OptimisticLock[] _locks = locks;
int sn = _locks.length;
for (int i = 0; i < sn; i++) {
_locks[i].unlockWrite(_stamps[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public ByteBuffer fromStringCQL2(String source) throws MarshalException
{
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
ByteBuffer idBytes = null;
// ffffffff-ffff-ffff-ffff-ffffffffff
if (regexPattern.matcher(source).matches())
{
UUID uuid = null;
try
{
uuid = UUID.fromString(source);
idBytes = decompose(uuid);
}
catch (IllegalArgumentException e)
{
throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
}
if (uuid.version() != 1)
throw new MarshalException("TimeUUID supports only version 1 UUIDs");
}
else
{
idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(TimestampSerializer.dateStringToTimestamp(source)));
}
return idBytes;
} } | public class class_name {
@Override
public ByteBuffer fromStringCQL2(String source) throws MarshalException
{
// Return an empty ByteBuffer for an empty string.
if (source.isEmpty())
return ByteBufferUtil.EMPTY_BYTE_BUFFER;
ByteBuffer idBytes = null;
// ffffffff-ffff-ffff-ffff-ffffffffff
if (regexPattern.matcher(source).matches())
{
UUID uuid = null;
try
{
uuid = UUID.fromString(source); // depends on control dependency: [try], data = [none]
idBytes = decompose(uuid); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException e)
{
throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
} // depends on control dependency: [catch], data = [none]
if (uuid.version() != 1)
throw new MarshalException("TimeUUID supports only version 1 UUIDs");
}
else
{
idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(TimestampSerializer.dateStringToTimestamp(source)));
}
return idBytes;
} } |
public class class_name {
public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close)
throws IOException {
@SuppressWarnings("resource")
final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
final byte[] buf = new byte[buffSize];
try {
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead);
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf);
}
} finally {
if (close) {
out.close();
in.close();
}
}
} } | public class class_name {
public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close)
throws IOException {
@SuppressWarnings("resource")
final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
final byte[] buf = new byte[buffSize];
try {
int bytesRead = in.read(buf);
while (bytesRead >= 0) {
out.write(buf, 0, bytesRead); // depends on control dependency: [while], data = [none]
if ((ps != null) && ps.checkError()) {
throw new IOException("Unable to write to output stream.");
}
bytesRead = in.read(buf); // depends on control dependency: [while], data = [none]
}
} finally {
if (close) {
out.close(); // depends on control dependency: [if], data = [none]
in.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <M extends MessageOrBuilder> M updateTimestamp(final long timestamp, final M messageOrBuilder, final TimeUnit timeUnit, final Logger logger) {
try {
return updateTimestamp(timestamp, messageOrBuilder, timeUnit);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
}
} } | public class class_name {
public static <M extends MessageOrBuilder> M updateTimestamp(final long timestamp, final M messageOrBuilder, final TimeUnit timeUnit, final Logger logger) {
try {
return updateTimestamp(timestamp, messageOrBuilder, timeUnit); // depends on control dependency: [try], data = [none]
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return messageOrBuilder;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void cancel1xxTimer() {
if (proxy1xxTimeoutTask != null && proxyBranch1xxTimerStarted) {
proxy1xxTimeoutTask.cancel();
proxy1xxTimeoutTask = null;
proxyBranch1xxTimerStarted = false;
}
} } | public class class_name {
public void cancel1xxTimer() {
if (proxy1xxTimeoutTask != null && proxyBranch1xxTimerStarted) {
proxy1xxTimeoutTask.cancel(); // depends on control dependency: [if], data = [none]
proxy1xxTimeoutTask = null; // depends on control dependency: [if], data = [none]
proxyBranch1xxTimerStarted = false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
HttpResponse response = null;
try {
log(request);
HttpClient httpclient = new DefaultHttpClient();
request.setEntity(new ByteArrayEntity(payload));
response = httpclient.execute(request);
log(response);
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
return response;
} } | public class class_name {
protected HttpResponse sendPayload(HttpEntityEnclosingRequestBase request, byte[] payload) {
HttpResponse response = null;
try {
log(request);
// depends on control dependency: [try], data = [none]
HttpClient httpclient = new DefaultHttpClient();
request.setEntity(new ByteArrayEntity(payload));
// depends on control dependency: [try], data = [none]
response = httpclient.execute(request);
// depends on control dependency: [try], data = [none]
log(response);
// depends on control dependency: [try], data = [none]
} catch(IOException ioe) {
throw new EFhirClientException("Error sending HTTP Post/Put Payload: "+ioe.getMessage(), ioe);
}
// depends on control dependency: [catch], data = [none]
return response;
} } |
public class class_name {
public static int search(long[] longArray, long value, int occurrence) {
if(occurrence <= 0 || occurrence > longArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = 0; i < longArray.length; i++) {
if(longArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} } | public class class_name {
public static int search(long[] longArray, long value, int occurrence) {
if(occurrence <= 0 || occurrence > longArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = 0; i < longArray.length; i++) {
if(longArray[i] == value) {
valuesSeen++; // depends on control dependency: [if], data = [none]
if(valuesSeen == occurrence) {
return i; // depends on control dependency: [if], data = [none]
}
}
}
return -1;
} } |
public class class_name {
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
String result = null;
for (int i = 0; result == null && i < this.basenames.length; i++) {
ResourceBundle bundle = getResourceBundle(this.basenames[i], locale);
if (bundle != null) {
result = getStringOrNull(bundle, code);
}
}
return result;
} } | public class class_name {
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
String result = null;
for (int i = 0; result == null && i < this.basenames.length; i++) {
ResourceBundle bundle = getResourceBundle(this.basenames[i], locale);
if (bundle != null) {
result = getStringOrNull(bundle, code); // depends on control dependency: [if], data = [(bundle]
}
}
return result;
} } |
public class class_name {
protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous)
{
if (!filtersSupported.get())
{
if (LOG.isWarnEnabled())
{
LOG.warn("The bloom filters are not supported therefore they cannot be reloaded");
}
return false;
}
filtersEnabled.set(false);
this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber);
this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber);
if (asynchronous)
{
new Thread(new Runnable()
{
public void run()
{
doLoadFilters(cleanOnFail);
}
}, "BloomFilter-Loader-" + dataContainer.getName()).start();
return true;
}
else
{
return doLoadFilters(cleanOnFail);
}
} } | public class class_name {
protected boolean loadFilters(final boolean cleanOnFail, boolean asynchronous)
{
if (!filtersSupported.get())
{
if (LOG.isWarnEnabled())
{
LOG.warn("The bloom filters are not supported therefore they cannot be reloaded"); // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
filtersEnabled.set(false);
this.filterPermissions = new BloomFilter<String>(bfProbability, bfElementNumber);
this.filterOwner = new BloomFilter<String>(bfProbability, bfElementNumber);
if (asynchronous)
{
new Thread(new Runnable()
{
public void run()
{
doLoadFilters(cleanOnFail);
}
}, "BloomFilter-Loader-" + dataContainer.getName()).start(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
else
{
return doLoadFilters(cleanOnFail); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DescribeClientPropertiesRequest describeClientPropertiesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeClientPropertiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeClientPropertiesRequest.getResourceIds(), RESOURCEIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeClientPropertiesRequest describeClientPropertiesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeClientPropertiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeClientPropertiesRequest.getResourceIds(), RESOURCEIDS_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 Observable<ServiceResponse<TextOperationResult>> getTextOperationResultWithServiceResponseAsync(String operationId) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (operationId == null) {
throw new IllegalArgumentException("Parameter operationId is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.getTextOperationResult(operationId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<TextOperationResult>>>() {
@Override
public Observable<ServiceResponse<TextOperationResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<TextOperationResult> clientResponse = getTextOperationResultDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<TextOperationResult>> getTextOperationResultWithServiceResponseAsync(String operationId) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (operationId == null) {
throw new IllegalArgumentException("Parameter operationId is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.getTextOperationResult(operationId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<TextOperationResult>>>() {
@Override
public Observable<ServiceResponse<TextOperationResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<TextOperationResult> clientResponse = getTextOperationResultDelegate(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 {
static int[][] cyclesOfSizeFiveOrSix(IAtomContainer container, int[][] graph) {
try {
return Cycles.all(6).find(container, graph, 6).paths();
} catch (Intractable intractable) {
return new int[0][];
}
} } | public class class_name {
static int[][] cyclesOfSizeFiveOrSix(IAtomContainer container, int[][] graph) {
try {
return Cycles.all(6).find(container, graph, 6).paths(); // depends on control dependency: [try], data = [none]
} catch (Intractable intractable) {
return new int[0][];
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public java.util.List<String> getServiceErrorIds() {
if (serviceErrorIds == null) {
serviceErrorIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return serviceErrorIds;
} } | public class class_name {
public java.util.List<String> getServiceErrorIds() {
if (serviceErrorIds == null) {
serviceErrorIds = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return serviceErrorIds;
} } |
public class class_name {
public static final String hexdump(byte[] buffer, boolean ascii)
{
int length = 0;
if (buffer != null)
{
length = buffer.length;
}
return (hexdump(buffer, 0, length, ascii));
} } | public class class_name {
public static final String hexdump(byte[] buffer, boolean ascii)
{
int length = 0;
if (buffer != null)
{
length = buffer.length; // depends on control dependency: [if], data = [none]
}
return (hexdump(buffer, 0, length, ascii));
} } |
public class class_name {
private boolean checkUpdateRequired(final ConnectionResource _con)
throws SQLException
{
final SQLSelect select = new SQLSelect();
for (final AbstractColumnWithValue<?> colValue : getColumnWithValues()) {
select.column(colValue.getColumnName());
}
select.from(getTableName());
select.addPart(SQLPart.WHERE).addColumnPart(null, "ID")
.addPart(SQLPart.EQUAL).addValuePart(getIds()[0]);
final Statement stmt = _con.createStatement();
final ResultSet rs = stmt.executeQuery(select.getSQL());
final ArrayListHandler handler = new ArrayListHandler(Context.getDbType().getRowProcessor());
final List<Object[]> rows = handler.handle(rs);
rs.close();
stmt.close();
if (rows.size() == 1) {
final Object[] values = rows.get(0);
int idx = 0;
final Iterator<AbstractColumnWithValue<?>> colIter = getColumnWithValues().iterator();
while (colIter.hasNext()) {
final AbstractColumnWithValue<?> colValue = colIter.next();
final Object dbValue = values[idx];
final Object newValue = colValue.getValue();
if (dbValue instanceof Long) {
if (newValue instanceof Long) {
if (dbValue.equals(newValue)) {
colIter.remove();
}
} else if (newValue instanceof Integer) {
if (dbValue.equals(new Long((Integer) newValue))) {
colIter.remove();
}
}
} else if (dbValue instanceof BigDecimal) {
if (newValue instanceof BigDecimal) {
if (((BigDecimal) dbValue).compareTo((BigDecimal) newValue) == 0) {
colIter.remove();
}
} else if (newValue instanceof Long) {
if (((BigDecimal) dbValue).compareTo(BigDecimal.valueOf((Long) newValue)) == 0) {
colIter.remove();
}
} else if (newValue instanceof Integer) {
if (((BigDecimal) dbValue).compareTo(BigDecimal.valueOf(new Long((Integer) newValue))) == 0) {
colIter.remove();
}
}
} else if (dbValue instanceof Timestamp) {
if (newValue instanceof Timestamp) {
if (((Timestamp) dbValue).equals((Timestamp) newValue)) {
colIter.remove();
}
}
} else if (dbValue instanceof Boolean) {
if (newValue instanceof Boolean) {
if (((Boolean) dbValue).equals(newValue)) {
colIter.remove();
}
}
} else if (dbValue instanceof String) {
if (newValue instanceof String) {
if (((String) dbValue).trim().equals(((String) newValue).trim())) {
colIter.remove();
}
}
}
idx++;
}
}
return !getColumnWithValues().isEmpty();
} } | public class class_name {
private boolean checkUpdateRequired(final ConnectionResource _con)
throws SQLException
{
final SQLSelect select = new SQLSelect();
for (final AbstractColumnWithValue<?> colValue : getColumnWithValues()) {
select.column(colValue.getColumnName());
}
select.from(getTableName());
select.addPart(SQLPart.WHERE).addColumnPart(null, "ID")
.addPart(SQLPart.EQUAL).addValuePart(getIds()[0]);
final Statement stmt = _con.createStatement();
final ResultSet rs = stmt.executeQuery(select.getSQL());
final ArrayListHandler handler = new ArrayListHandler(Context.getDbType().getRowProcessor());
final List<Object[]> rows = handler.handle(rs);
rs.close();
stmt.close();
if (rows.size() == 1) {
final Object[] values = rows.get(0);
int idx = 0;
final Iterator<AbstractColumnWithValue<?>> colIter = getColumnWithValues().iterator();
while (colIter.hasNext()) {
final AbstractColumnWithValue<?> colValue = colIter.next();
final Object dbValue = values[idx];
final Object newValue = colValue.getValue();
if (dbValue instanceof Long) {
if (newValue instanceof Long) {
if (dbValue.equals(newValue)) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
} else if (newValue instanceof Integer) {
if (dbValue.equals(new Long((Integer) newValue))) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
}
} else if (dbValue instanceof BigDecimal) {
if (newValue instanceof BigDecimal) {
if (((BigDecimal) dbValue).compareTo((BigDecimal) newValue) == 0) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
} else if (newValue instanceof Long) {
if (((BigDecimal) dbValue).compareTo(BigDecimal.valueOf((Long) newValue)) == 0) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
} else if (newValue instanceof Integer) {
if (((BigDecimal) dbValue).compareTo(BigDecimal.valueOf(new Long((Integer) newValue))) == 0) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
}
} else if (dbValue instanceof Timestamp) {
if (newValue instanceof Timestamp) {
if (((Timestamp) dbValue).equals((Timestamp) newValue)) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
}
} else if (dbValue instanceof Boolean) {
if (newValue instanceof Boolean) {
if (((Boolean) dbValue).equals(newValue)) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
}
} else if (dbValue instanceof String) {
if (newValue instanceof String) {
if (((String) dbValue).trim().equals(((String) newValue).trim())) {
colIter.remove(); // depends on control dependency: [if], data = [none]
}
}
}
idx++;
}
}
return !getColumnWithValues().isEmpty();
} } |
public class class_name {
public Map<String, Integer> getAggregateResultCountSummary() {
Map<String, Integer> summaryMap = new LinkedHashMap<String, Integer>();
for (Entry<String, LinkedHashSet<String>> entry : aggregateResultMap
.entrySet()) {
summaryMap.put(entry.getKey(), entry.getValue().size());
}
return summaryMap;
} } | public class class_name {
public Map<String, Integer> getAggregateResultCountSummary() {
Map<String, Integer> summaryMap = new LinkedHashMap<String, Integer>();
for (Entry<String, LinkedHashSet<String>> entry : aggregateResultMap
.entrySet()) {
summaryMap.put(entry.getKey(), entry.getValue().size()); // depends on control dependency: [for], data = [entry]
}
return summaryMap;
} } |
public class class_name {
public boolean isInValueSet(Value value) {
if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
boolean result = true;
if (!this.valuesKeySet.isEmpty()) {
result = this.valuesKeySet.contains(value);
} else if (this.lowerBound != null || this.upperBound != null) {
if (this.lowerBound != null
&& !ValueComparator.GREATER_THAN_OR_EQUAL_TO.compare(
value, this.lowerBound)) {
result = false;
}
if (this.upperBound != null
&& !ValueComparator.LESS_THAN_OR_EQUAL_TO.compare(
value, this.upperBound)) {
result = false;
}
}
return result;
} } | public class class_name {
public boolean isInValueSet(Value value) {
if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
boolean result = true;
if (!this.valuesKeySet.isEmpty()) {
result = this.valuesKeySet.contains(value); // depends on control dependency: [if], data = [none]
} else if (this.lowerBound != null || this.upperBound != null) {
if (this.lowerBound != null
&& !ValueComparator.GREATER_THAN_OR_EQUAL_TO.compare(
value, this.lowerBound)) {
result = false; // depends on control dependency: [if], data = [none]
}
if (this.upperBound != null
&& !ValueComparator.LESS_THAN_OR_EQUAL_TO.compare(
value, this.upperBound)) {
result = false; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static DockViewTitleBar findDockViewTitleBar(Component component) {
Assert.notNull(component, "component");
final SingleDockableContainer sdc = DockingUtilities.findSingleDockableContainerAncestor(component);
final DockViewTitleBar dockViewTitleBar;
if (sdc == null) {
dockViewTitleBar = null;
} else if (sdc instanceof DockView) {
dockViewTitleBar = ((DockView) sdc).getTitleBar();
} else if (sdc instanceof AutoHideExpandPanel) {
dockViewTitleBar = ((AutoHideExpandPanel) sdc).getTitleBar();
} else {
dockViewTitleBar = null;
}
return dockViewTitleBar;
} } | public class class_name {
public static DockViewTitleBar findDockViewTitleBar(Component component) {
Assert.notNull(component, "component");
final SingleDockableContainer sdc = DockingUtilities.findSingleDockableContainerAncestor(component);
final DockViewTitleBar dockViewTitleBar;
if (sdc == null) {
dockViewTitleBar = null; // depends on control dependency: [if], data = [none]
} else if (sdc instanceof DockView) {
dockViewTitleBar = ((DockView) sdc).getTitleBar(); // depends on control dependency: [if], data = [none]
} else if (sdc instanceof AutoHideExpandPanel) {
dockViewTitleBar = ((AutoHideExpandPanel) sdc).getTitleBar(); // depends on control dependency: [if], data = [none]
} else {
dockViewTitleBar = null; // depends on control dependency: [if], data = [none]
}
return dockViewTitleBar;
} } |
public class class_name {
@Override public Object invokeMethod(final String name, final Object arguments) {
if (GantState.dryRun) {
if (GantState.verbosity > GantState.SILENT) {
final StringBuilder sb = new StringBuilder();
int padding = 9 - name.length();
if (padding < 0) { padding = 0; }
sb.append(" ".substring(0, padding) + '[' + name + "] ");
final Object[] args = (Object[]) arguments;
if (args[0] instanceof Map<?,?>) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Eclipse and IntelliJ IDEA warn that (Map) is not a proper cast but using the
// cast (Map<?,?>) causes a type check error due to the capture algorithm.
//
// TODO : Fix this rather than use a SuppressWarnings.
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings({ "unchecked", "rawtypes" } ) final Iterator<Map.Entry<?,?>> i =((Map) args[0]).entrySet().iterator();
while (i.hasNext()) {
final Map.Entry<?,?> e = i.next();
sb.append(e.getKey() + " : '" + e.getValue() + '\'');
if (i.hasNext()) { sb.append(", "); }
}
sb.append('\n');
getProject().log(sb.toString());
if (args.length == 2) {((Closure<?>) args[1]).call(); }
}
else if (args[0] instanceof Closure) { ((Closure<?>) args[0]).call(); }
else { throw new RuntimeException("Unexpected type of parameter to method " + name); }
}
return null;
}
return super.invokeMethod(name, arguments);
} } | public class class_name {
@Override public Object invokeMethod(final String name, final Object arguments) {
if (GantState.dryRun) {
if (GantState.verbosity > GantState.SILENT) {
final StringBuilder sb = new StringBuilder();
int padding = 9 - name.length();
if (padding < 0) { padding = 0; } // depends on control dependency: [if], data = [none]
sb.append(" ".substring(0, padding) + '[' + name + "] "); // depends on control dependency: [if], data = [none]
final Object[] args = (Object[]) arguments;
if (args[0] instanceof Map<?,?>) {
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Eclipse and IntelliJ IDEA warn that (Map) is not a proper cast but using the
// cast (Map<?,?>) causes a type check error due to the capture algorithm.
//
// TODO : Fix this rather than use a SuppressWarnings.
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings({ "unchecked", "rawtypes" } ) final Iterator<Map.Entry<?,?>> i =((Map) args[0]).entrySet().iterator();
while (i.hasNext()) {
final Map.Entry<?,?> e = i.next();
sb.append(e.getKey() + " : '" + e.getValue() + '\''); // depends on control dependency: [if], data = [)]
if (i.hasNext()) { sb.append(", "); } // depends on control dependency: [if], data = [none]
}
sb.append('\n'); // depends on control dependency: [if], data = [none]
getProject().log(sb.toString()); // depends on control dependency: [if], data = [none]
if (args.length == 2) {((Closure<?>) args[1]).call(); } // depends on control dependency: [if], data = [none]
}
else if (args[0] instanceof Closure) { ((Closure<?>) args[0]).call(); } // depends on control dependency: [if], data = [none]
else { throw new RuntimeException("Unexpected type of parameter to method " + name); }
}
return null;
}
return super.invokeMethod(name, arguments);
} } |
public class class_name {
private boolean forbidUseOfSuperInFixtureMethod(MethodCallExpression expr) {
Method currMethod = resources.getCurrentMethod();
Expression target = expr.getObjectExpression();
if (currMethod instanceof FixtureMethod
&& target instanceof VariableExpression
&& ((VariableExpression)target).isSuperExpression()
&& currMethod.getName().equals(expr.getMethodAsString())) {
resources.getErrorReporter().error(expr,
"A base class fixture method should not be called explicitly " +
"because it is always invoked automatically by the framework");
return true;
}
return false;
} } | public class class_name {
private boolean forbidUseOfSuperInFixtureMethod(MethodCallExpression expr) {
Method currMethod = resources.getCurrentMethod();
Expression target = expr.getObjectExpression();
if (currMethod instanceof FixtureMethod
&& target instanceof VariableExpression
&& ((VariableExpression)target).isSuperExpression()
&& currMethod.getName().equals(expr.getMethodAsString())) {
resources.getErrorReporter().error(expr,
"A base class fixture method should not be called explicitly " +
"because it is always invoked automatically by the framework"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void writeClass(String strClassName, CodeType codeType)
{
String strFieldClass;
Record recClassInfo = this.getMainRecord();
String strFieldDataHandle = this.getProperty(FieldData.FIELD_DATA_FILE);
if (strFieldDataHandle != null)
{
FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
try {
recFieldData.setHandle(strFieldDataHandle, DBConstants.OBJECT_ID_HANDLE); // Get the record
String strRecordClass = recFieldData.getField(FieldData.FIELD_FILE_NAME).toString();
String strFieldName = recFieldData.getField(FieldData.FIELD_NAME).toString();
String strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).toString();
m_BasedFieldHelper.getBasedField(recFieldData, strRecordClass, strFieldName, strBaseFieldName); // Get the field this is based on
String strClassInfoHandle = this.getProperty(ClassInfo.CLASS_INFO_FILE);
if (strClassInfoHandle != null)
recClassInfo.setHandle(strClassInfoHandle, DBConstants.OBJECT_ID_HANDLE); // Get the record
else
{ // Had to fake a class for this field
recClassInfo.addNew();
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_NAME).getFieldName()));
recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getFieldName()));
recClassInfo.getField(ClassInfo.CLASS_PACKAGE).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PACKAGE).getFieldName()));
recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getFieldName()));
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
strFieldClass = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
this.writeHeading(strFieldClass, this.getPackage(codeType), CodeType.THICK); // Write the first few lines of the files
this.writeIncludes(CodeType.THICK);
if (m_MethodNameList.size() != 0)
m_MethodNameList.removeAllElements();
this.writeClassInterface();
this.writeClassFields(CodeType.THICK); // Write the C++ fields for this class
this.writeDefaultConstructor(strFieldClass);
this.writeFieldInit();
this.writeInit(); // Special case... zero all class fields!
this.writeInitField();
this.writeClassMethods(CodeType.THICK); // Write the remaining methods for this class
this.writeEndCode(true);
} } | public class class_name {
public void writeClass(String strClassName, CodeType codeType)
{
String strFieldClass;
Record recClassInfo = this.getMainRecord();
String strFieldDataHandle = this.getProperty(FieldData.FIELD_DATA_FILE);
if (strFieldDataHandle != null)
{
FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
try {
recFieldData.setHandle(strFieldDataHandle, DBConstants.OBJECT_ID_HANDLE); // Get the record // depends on control dependency: [try], data = [none]
String strRecordClass = recFieldData.getField(FieldData.FIELD_FILE_NAME).toString();
String strFieldName = recFieldData.getField(FieldData.FIELD_NAME).toString();
String strBaseFieldName = recFieldData.getField(FieldData.BASE_FIELD_NAME).toString();
m_BasedFieldHelper.getBasedField(recFieldData, strRecordClass, strFieldName, strBaseFieldName); // Get the field this is based on // depends on control dependency: [try], data = [none]
String strClassInfoHandle = this.getProperty(ClassInfo.CLASS_INFO_FILE);
if (strClassInfoHandle != null)
recClassInfo.setHandle(strClassInfoHandle, DBConstants.OBJECT_ID_HANDLE); // Get the record
else
{ // Had to fake a class for this field
recClassInfo.addNew(); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_NAME).getFieldName())); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).setString(this.getProperty(recClassInfo.getField(ClassInfo.BASE_CLASS_NAME).getFieldName())); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.CLASS_PACKAGE).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PACKAGE).getFieldName())); // depends on control dependency: [if], data = [none]
recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).setString(this.getProperty(recClassInfo.getField(ClassInfo.CLASS_PROJECT_ID).getFieldName())); // depends on control dependency: [if], data = [none]
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
strFieldClass = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
this.writeHeading(strFieldClass, this.getPackage(codeType), CodeType.THICK); // Write the first few lines of the files
this.writeIncludes(CodeType.THICK);
if (m_MethodNameList.size() != 0)
m_MethodNameList.removeAllElements();
this.writeClassInterface();
this.writeClassFields(CodeType.THICK); // Write the C++ fields for this class
this.writeDefaultConstructor(strFieldClass);
this.writeFieldInit();
this.writeInit(); // Special case... zero all class fields!
this.writeInitField();
this.writeClassMethods(CodeType.THICK); // Write the remaining methods for this class
this.writeEndCode(true);
} } |
public class class_name {
private static String formatParseExceptionDetails(
String errorToken, List<String> expectedTokens) {
// quotes/normalize the expected tokens before rendering, just in case after normalization some
// can be deduplicated.
ImmutableSet.Builder<String> normalizedTokensBuilder = ImmutableSet.builder();
for (String t : expectedTokens) {
normalizedTokensBuilder.add(maybeQuoteForParseError(t));
}
expectedTokens = normalizedTokensBuilder.build().asList();
StringBuilder details = new StringBuilder();
int numExpectedTokens = expectedTokens.size();
if (numExpectedTokens != 0) {
details.append(": expected ");
for (int i = 0; i < numExpectedTokens; i++) {
details.append(expectedTokens.get(i));
if (i < numExpectedTokens - 2) {
details.append(", ");
}
if (i == numExpectedTokens - 2) {
if (numExpectedTokens > 2) {
details.append(',');
}
details.append(" or ");
}
}
}
return String.format(
"parse error at '%s'%s", escapeWhitespaceForErrorPrinting(errorToken), details.toString());
} } | public class class_name {
private static String formatParseExceptionDetails(
String errorToken, List<String> expectedTokens) {
// quotes/normalize the expected tokens before rendering, just in case after normalization some
// can be deduplicated.
ImmutableSet.Builder<String> normalizedTokensBuilder = ImmutableSet.builder();
for (String t : expectedTokens) {
normalizedTokensBuilder.add(maybeQuoteForParseError(t)); // depends on control dependency: [for], data = [t]
}
expectedTokens = normalizedTokensBuilder.build().asList();
StringBuilder details = new StringBuilder();
int numExpectedTokens = expectedTokens.size();
if (numExpectedTokens != 0) {
details.append(": expected "); // depends on control dependency: [if], data = [none]
for (int i = 0; i < numExpectedTokens; i++) {
details.append(expectedTokens.get(i)); // depends on control dependency: [for], data = [i]
if (i < numExpectedTokens - 2) {
details.append(", "); // depends on control dependency: [if], data = [none]
}
if (i == numExpectedTokens - 2) {
if (numExpectedTokens > 2) {
details.append(','); // depends on control dependency: [if], data = [none]
}
details.append(" or "); // depends on control dependency: [if], data = [none]
}
}
}
return String.format(
"parse error at '%s'%s", escapeWhitespaceForErrorPrinting(errorToken), details.toString());
} } |
public class class_name {
public void marshall(RelatedResource relatedResource, ProtocolMarshaller protocolMarshaller) {
if (relatedResource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(relatedResource.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(relatedResource.getResourceIdentifier(), RESOURCEIDENTIFIER_BINDING);
protocolMarshaller.marshall(relatedResource.getAdditionalInfo(), ADDITIONALINFO_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RelatedResource relatedResource, ProtocolMarshaller protocolMarshaller) {
if (relatedResource == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(relatedResource.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(relatedResource.getResourceIdentifier(), RESOURCEIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(relatedResource.getAdditionalInfo(), ADDITIONALINFO_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int intersectCubic (float x1, float y1, float cx1, float cy1,
float cx2, float cy2, float x2, float y2,
float rx1, float ry1, float rx2, float ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < cx1 && rx2 < cx2 && rx2 < x2)
|| (rx1 > x1 && rx1 > cx1 && rx1 > cx2 && rx1 > x2)
|| (ry1 > y1 && ry1 > cy1 && ry1 > cy2 && ry1 > y2)) {
return 0;
}
// DOWN
if (ry2 < y1 && ry2 < cy1 && ry2 < cy2 && ry2 < y2 && rx1 != x1 && rx1 != x2) {
if (x1 < x2) {
return x1 < rx1 && rx1 < x2 ? 1 : 0;
}
return x2 < rx1 && rx1 < x1 ? -1 : 0;
}
// INSIDE
CubicCurveH c = new CubicCurveH(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
float px1 = rx1 - x1;
float py1 = ry1 - y1;
float px2 = rx2 - x1;
float py2 = ry2 - y1;
float[] res1 = new float[3];
float[] res2 = new float[3];
int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
// LEFT/RIGHT
if (rc1 == 0 && rc2 == 0) {
return 0;
}
float minX = px1 - DELTA;
float maxX = px2 + DELTA;
// Build bound --------------------------------------------------------
float[] bound = new float[40];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, false, 1);
// Add extremal points
rc2 = c.solveExtremeX(res2);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, true, 2);
rc2 = c.solveExtremeY(res2);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, true, 4);
// Add start and end
if (rx1 < x1 && x1 < rx2) {
bound[bc++] = 0f;
bound[bc++] = 0f;
bound[bc++] = 0f;
bound[bc++] = 6;
}
if (rx1 < x2 && x2 < rx2) {
bound[bc++] = 1f;
bound[bc++] = c.ax;
bound[bc++] = c.ay;
bound[bc++] = 7;
}
// End build bound ----------------------------------------------------
int cross = crossBound(bound, bc, py1, py2);
if (cross != UNKNOWN) {
return cross;
}
return c.cross(res1, rc1, py1, py2);
} } | public class class_name {
public static int intersectCubic (float x1, float y1, float cx1, float cy1,
float cx2, float cy2, float x2, float y2,
float rx1, float ry1, float rx2, float ry2) {
// LEFT/RIGHT/UP
if ((rx2 < x1 && rx2 < cx1 && rx2 < cx2 && rx2 < x2)
|| (rx1 > x1 && rx1 > cx1 && rx1 > cx2 && rx1 > x2)
|| (ry1 > y1 && ry1 > cy1 && ry1 > cy2 && ry1 > y2)) {
return 0; // depends on control dependency: [if], data = [none]
}
// DOWN
if (ry2 < y1 && ry2 < cy1 && ry2 < cy2 && ry2 < y2 && rx1 != x1 && rx1 != x2) {
if (x1 < x2) {
return x1 < rx1 && rx1 < x2 ? 1 : 0; // depends on control dependency: [if], data = [none]
}
return x2 < rx1 && rx1 < x1 ? -1 : 0; // depends on control dependency: [if], data = [none]
}
// INSIDE
CubicCurveH c = new CubicCurveH(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
float px1 = rx1 - x1;
float py1 = ry1 - y1;
float px2 = rx2 - x1;
float py2 = ry2 - y1;
float[] res1 = new float[3];
float[] res2 = new float[3];
int rc1 = c.solvePoint(res1, px1);
int rc2 = c.solvePoint(res2, px2);
// LEFT/RIGHT
if (rc1 == 0 && rc2 == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
float minX = px1 - DELTA;
float maxX = px2 + DELTA;
// Build bound --------------------------------------------------------
float[] bound = new float[40];
int bc = 0;
// Add roots
bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, false, 1);
// Add extremal points
rc2 = c.solveExtremeX(res2);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, true, 2);
rc2 = c.solveExtremeY(res2);
bc = c.addBound(bound, bc, res2, rc2, minX, maxX, true, 4);
// Add start and end
if (rx1 < x1 && x1 < rx2) {
bound[bc++] = 0f; // depends on control dependency: [if], data = [none]
bound[bc++] = 0f; // depends on control dependency: [if], data = [none]
bound[bc++] = 0f; // depends on control dependency: [if], data = [none]
bound[bc++] = 6; // depends on control dependency: [if], data = [none]
}
if (rx1 < x2 && x2 < rx2) {
bound[bc++] = 1f; // depends on control dependency: [if], data = [none]
bound[bc++] = c.ax; // depends on control dependency: [if], data = [none]
bound[bc++] = c.ay; // depends on control dependency: [if], data = [none]
bound[bc++] = 7; // depends on control dependency: [if], data = [none]
}
// End build bound ----------------------------------------------------
int cross = crossBound(bound, bc, py1, py2);
if (cross != UNKNOWN) {
return cross; // depends on control dependency: [if], data = [none]
}
return c.cross(res1, rc1, py1, py2);
} } |
public class class_name {
@Pure
protected ST replaceSegment(int index, ST segment) {
ST rep = null;
if (this.segmentReplacer != null) {
rep = this.segmentReplacer.replaceSegment(index, segment);
}
if (rep == null) {
rep = segment;
}
return rep;
} } | public class class_name {
@Pure
protected ST replaceSegment(int index, ST segment) {
ST rep = null;
if (this.segmentReplacer != null) {
rep = this.segmentReplacer.replaceSegment(index, segment); // depends on control dependency: [if], data = [none]
}
if (rep == null) {
rep = segment; // depends on control dependency: [if], data = [none]
}
return rep;
} } |
public class class_name {
private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
for (int i = 0; i < 3; i++) {
InputMap inputMap = component.getInputMap(i);
if (inputMap != null) {
Object key = inputMap.get(keyStroke);
if (key != null) {
return key;
}
}
}
return null;
} } | public class class_name {
private Object getKeyForActionMap(JComponent component, KeyStroke keyStroke) {
for (int i = 0; i < 3; i++) {
InputMap inputMap = component.getInputMap(i);
if (inputMap != null) {
Object key = inputMap.get(keyStroke);
if (key != null) {
return key; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public JvmAnnotationType getAnnotation()
{
if (annotation != null && annotation.eIsProxy())
{
InternalEObject oldAnnotation = (InternalEObject)annotation;
annotation = (JvmAnnotationType)eResolveProxy(oldAnnotation);
if (annotation != oldAnnotation)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.JVM_ANNOTATION_REFERENCE__ANNOTATION, oldAnnotation, annotation));
}
}
return annotation;
} } | public class class_name {
public JvmAnnotationType getAnnotation()
{
if (annotation != null && annotation.eIsProxy())
{
InternalEObject oldAnnotation = (InternalEObject)annotation;
annotation = (JvmAnnotationType)eResolveProxy(oldAnnotation); // depends on control dependency: [if], data = [none]
if (annotation != oldAnnotation)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.JVM_ANNOTATION_REFERENCE__ANNOTATION, oldAnnotation, annotation));
}
}
return annotation;
} } |
public class class_name {
private static String wordShapeDan2(String s, Collection<String> knownLCWords) {
StringBuilder sb = new StringBuilder("WT-");
char lastM = '~';
boolean nonLetters = false;
int len = s.length();
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
char m = c;
if (Character.isDigit(c)) {
m = 'd';
} else if (Character.isLowerCase(c) || c == '_') {
m = 'x';
} else if (Character.isUpperCase(c)) {
m = 'X';
}
if (m != 'x' && m != 'X') {
nonLetters = true;
}
if (m != lastM) {
sb.append(m);
}
lastM = m;
}
if (len <= 3) {
sb.append(':').append(len);
}
if (knownLCWords != null) {
if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {
sb.append('k');
}
}
// System.err.println("wordShapeDan2: " + s + " became " + sb);
return sb.toString();
} } | public class class_name {
private static String wordShapeDan2(String s, Collection<String> knownLCWords) {
StringBuilder sb = new StringBuilder("WT-");
char lastM = '~';
boolean nonLetters = false;
int len = s.length();
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
char m = c;
if (Character.isDigit(c)) {
m = 'd';
// depends on control dependency: [if], data = [none]
} else if (Character.isLowerCase(c) || c == '_') {
m = 'x';
// depends on control dependency: [if], data = [none]
} else if (Character.isUpperCase(c)) {
m = 'X';
// depends on control dependency: [if], data = [none]
}
if (m != 'x' && m != 'X') {
nonLetters = true;
// depends on control dependency: [if], data = [none]
}
if (m != lastM) {
sb.append(m);
// depends on control dependency: [if], data = [(m]
}
lastM = m;
// depends on control dependency: [for], data = [none]
}
if (len <= 3) {
sb.append(':').append(len);
// depends on control dependency: [if], data = [(len]
}
if (knownLCWords != null) {
if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {
sb.append('k');
// depends on control dependency: [if], data = [none]
}
}
// System.err.println("wordShapeDan2: " + s + " became " + sb);
return sb.toString();
} } |
public class class_name {
private static I_CmsFormatterBean getStartFormatter(
CmsObject cms,
CmsContainer cnt,
CmsADEConfigData configData,
CmsContainerElementBean element,
CmsADESessionCache cache) {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(element.getResource());
I_CmsFormatterBean formatter = cache.getRecentFormatter(type.getTypeName(), cnt, configData);
if (formatter == null) {
formatter = configData.getFormatters(cms, element.getResource()).getDefaultFormatter(
cnt.getType(),
cnt.getWidth());
}
return formatter;
} } | public class class_name {
private static I_CmsFormatterBean getStartFormatter(
CmsObject cms,
CmsContainer cnt,
CmsADEConfigData configData,
CmsContainerElementBean element,
CmsADESessionCache cache) {
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(element.getResource());
I_CmsFormatterBean formatter = cache.getRecentFormatter(type.getTypeName(), cnt, configData);
if (formatter == null) {
formatter = configData.getFormatters(cms, element.getResource()).getDefaultFormatter(
cnt.getType(),
cnt.getWidth()); // depends on control dependency: [if], data = [none]
}
return formatter;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static int compare(Comparable lhs, Comparable rhs) {
assert lhs != null;
assert rhs != null;
if (lhs.getClass() == rhs.getClass()) {
return lhs.compareTo(rhs);
}
if (lhs instanceof Number && rhs instanceof Number) {
return Numbers.compare(lhs, rhs);
}
return lhs.compareTo(rhs);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static int compare(Comparable lhs, Comparable rhs) {
assert lhs != null;
assert rhs != null;
if (lhs.getClass() == rhs.getClass()) {
return lhs.compareTo(rhs); // depends on control dependency: [if], data = [none]
}
if (lhs instanceof Number && rhs instanceof Number) {
return Numbers.compare(lhs, rhs); // depends on control dependency: [if], data = [none]
}
return lhs.compareTo(rhs);
} } |
public class class_name {
private Integer getIntegerTimeInMinutes(Date date)
{
Integer result = null;
if (date != null)
{
Calendar cal = DateHelper.popCalendar(date);
int time = cal.get(Calendar.HOUR_OF_DAY) * 60;
time += cal.get(Calendar.MINUTE);
DateHelper.pushCalendar(cal);
result = Integer.valueOf(time);
}
return (result);
} } | public class class_name {
private Integer getIntegerTimeInMinutes(Date date)
{
Integer result = null;
if (date != null)
{
Calendar cal = DateHelper.popCalendar(date);
int time = cal.get(Calendar.HOUR_OF_DAY) * 60;
time += cal.get(Calendar.MINUTE); // depends on control dependency: [if], data = [none]
DateHelper.pushCalendar(cal); // depends on control dependency: [if], data = [none]
result = Integer.valueOf(time); // depends on control dependency: [if], data = [none]
}
return (result);
} } |
public class class_name {
@Override
public synchronized Object put(Object key, Object value) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
//PM16861
StringBuffer sb = new StringBuffer("{").append(key).append("} ").append(appNameForLogging);
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[PUT], sb.toString());
}
Object replacedEntry = null;
// First see if replacing an existing entry
Object currEntry = super.get(key);
if (currEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "replacing existing entry");
}
replacedEntry = super.put(key, value);
} else {
if ((overflowAllowed) && (OverflowTabl != null)) {
synchronized (OverflowTablLock) {
currEntry = OverflowTabl.get(key);
if (currEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "replacing existing entry in overflow Hashmap");
}
replacedEntry = OverflowTabl.put(key, value);
}
}
}
}
// Handle new entries
if (currEntry == null) {
currentSize++;
// increment pmi counter
if (_iStore.getStoreCallback() != null) {
_iStore.getStoreCallback().sessionLiveCountInc(value);
}
if (currentSize <= maxSize) {
replacedEntry = super.put(key, value);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "add new entry to Hashmap");
}
} else { // overflow
currentSize--;
if (overflowAllowed) {
synchronized (OverflowTablLock) {
if (OverflowTabl == null) {
OverflowTabl = new HashMap(currentSize, 1);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "Creating Overflow Table");
}
}
replacedEntry = OverflowTabl.put(key, value);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "add new entry to overflow Hashmap");
}
}
} else
throw new TooManySessionsException(); // no overflow allowed
}
}
return replacedEntry;
} } | public class class_name {
@Override
public synchronized Object put(Object key, Object value) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINER)) {
//PM16861
StringBuffer sb = new StringBuffer("{").append(key).append("} ").append(appNameForLogging);
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[PUT], sb.toString()); // depends on control dependency: [if], data = [none]
}
Object replacedEntry = null;
// First see if replacing an existing entry
Object currEntry = super.get(key);
if (currEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "replacing existing entry");
}
replacedEntry = super.put(key, value); // depends on control dependency: [if], data = [none]
} else {
if ((overflowAllowed) && (OverflowTabl != null)) {
synchronized (OverflowTablLock) { // depends on control dependency: [if], data = [none]
currEntry = OverflowTabl.get(key);
if (currEntry != null) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "replacing existing entry in overflow Hashmap");
}
replacedEntry = OverflowTabl.put(key, value); // depends on control dependency: [if], data = [none]
}
}
}
}
// Handle new entries
if (currEntry == null) {
currentSize++; // depends on control dependency: [if], data = [none]
// increment pmi counter
if (_iStore.getStoreCallback() != null) {
_iStore.getStoreCallback().sessionLiveCountInc(value); // depends on control dependency: [if], data = [none]
}
if (currentSize <= maxSize) {
replacedEntry = super.put(key, value); // depends on control dependency: [if], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "add new entry to Hashmap"); // depends on control dependency: [if], data = [none]
}
} else { // overflow
currentSize--; // depends on control dependency: [if], data = [none]
if (overflowAllowed) {
synchronized (OverflowTablLock) { // depends on control dependency: [if], data = [none]
if (OverflowTabl == null) {
OverflowTabl = new HashMap(currentSize, 1); // depends on control dependency: [if], data = [none]
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "Creating Overflow Table"); // depends on control dependency: [if], data = [none]
}
}
replacedEntry = OverflowTabl.put(key, value);
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[PUT], "add new entry to overflow Hashmap"); // depends on control dependency: [if], data = [none]
}
}
} else
throw new TooManySessionsException(); // no overflow allowed
}
}
return replacedEntry;
} } |
public class class_name {
public void writeToStream(OutputStream os)
throws IOException
{
StreamImpl is = openReadImpl();
TempBuffer tempBuffer = TempBuffer.create();
try {
byte []buffer = tempBuffer.buffer();
int length = buffer.length;
int len;
while ((len = is.read(buffer, 0, length)) > 0) {
os.write(buffer, 0, len);
}
} finally {
TempBuffer.free(tempBuffer);
tempBuffer = null;
is.close();
}
} } | public class class_name {
public void writeToStream(OutputStream os)
throws IOException
{
StreamImpl is = openReadImpl();
TempBuffer tempBuffer = TempBuffer.create();
try {
byte []buffer = tempBuffer.buffer();
int length = buffer.length;
int len;
while ((len = is.read(buffer, 0, length)) > 0) {
os.write(buffer, 0, len); // depends on control dependency: [while], data = [none]
}
} finally {
TempBuffer.free(tempBuffer);
tempBuffer = null;
is.close();
}
} } |
public class class_name {
public Options addyAxis(final Axis yAxis) {
if (this.getyAxis() == null) {
this.setyAxis(new ArrayList<Axis>());
}
this.getyAxis().add(yAxis);
return this;
} } | public class class_name {
public Options addyAxis(final Axis yAxis) {
if (this.getyAxis() == null) {
this.setyAxis(new ArrayList<Axis>()); // depends on control dependency: [if], data = [none]
}
this.getyAxis().add(yAxis);
return this;
} } |
public class class_name {
public void setContentEmpty(boolean isEmpty) {
ensureContent();
if (mContentView == null) {
throw new IllegalStateException("Content view must be initialized before");
}
if (isEmpty) {
mEmptyView.setVisibility(View.VISIBLE);
mContentView.setVisibility(View.GONE);
} else {
mEmptyView.setVisibility(View.GONE);
mContentView.setVisibility(View.VISIBLE);
}
mIsContentEmpty = isEmpty;
} } | public class class_name {
public void setContentEmpty(boolean isEmpty) {
ensureContent();
if (mContentView == null) {
throw new IllegalStateException("Content view must be initialized before");
}
if (isEmpty) {
mEmptyView.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
mContentView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
} else {
mEmptyView.setVisibility(View.GONE); // depends on control dependency: [if], data = [none]
mContentView.setVisibility(View.VISIBLE); // depends on control dependency: [if], data = [none]
}
mIsContentEmpty = isEmpty;
} } |
public class class_name {
public void onBackPressed(@NonNull DialogPlus dialogPlus) {
if (onCancelListener != null) {
onCancelListener.onCancel(DialogPlus.this);
}
dismiss();
} } | public class class_name {
public void onBackPressed(@NonNull DialogPlus dialogPlus) {
if (onCancelListener != null) {
onCancelListener.onCancel(DialogPlus.this); // depends on control dependency: [if], data = [none]
}
dismiss();
} } |
public class class_name {
public static KeyFactory getKeyFactory(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
KeyFactory keyFactory;
try {
keyFactory = (null == provider) //
? KeyFactory.getInstance(getMainAlgorithm(algorithm)) //
: KeyFactory.getInstance(getMainAlgorithm(algorithm), provider);
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
return keyFactory;
} } | public class class_name {
public static KeyFactory getKeyFactory(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
KeyFactory keyFactory;
try {
keyFactory = (null == provider) //
? KeyFactory.getInstance(getMainAlgorithm(algorithm)) //
: KeyFactory.getInstance(getMainAlgorithm(algorithm), provider);
// depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
// depends on control dependency: [catch], data = [none]
return keyFactory;
} } |
public class class_name {
private boolean hasFileChangedUnexpectedly() {
synchronized (this) {
if (mDiskWritesInFlight > 0) {
// If we know we caused it, it's not unexpected.
if (DEBUG) System.out.println( "disk write in flight, not unexpected.");
return false;
}
}
if (!mFile.canRead()) {
return true;
}
synchronized (this) {
return mStatTimestamp != mFile.lastModified() || mStatSize != mFile.length();
}
} } | public class class_name {
private boolean hasFileChangedUnexpectedly() {
synchronized (this) {
if (mDiskWritesInFlight > 0) {
// If we know we caused it, it's not unexpected.
if (DEBUG) System.out.println( "disk write in flight, not unexpected.");
return false; // depends on control dependency: [if], data = [none]
}
}
if (!mFile.canRead()) {
return true; // depends on control dependency: [if], data = [none]
}
synchronized (this) {
return mStatTimestamp != mFile.lastModified() || mStatSize != mFile.length();
}
} } |
public class class_name {
public void setMessage(CmsMessageContainer message) {
if ((message != null) && (message.getKey() != Messages.ERR_MULTI_EXCEPTION_1)) {
m_individualMessage = true;
m_message = message;
} else {
// if message is null, reset and use default message again
m_individualMessage = false;
updateMessage();
}
} } | public class class_name {
public void setMessage(CmsMessageContainer message) {
if ((message != null) && (message.getKey() != Messages.ERR_MULTI_EXCEPTION_1)) {
m_individualMessage = true; // depends on control dependency: [if], data = [none]
m_message = message; // depends on control dependency: [if], data = [none]
} else {
// if message is null, reset and use default message again
m_individualMessage = false; // depends on control dependency: [if], data = [none]
updateMessage(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void sessionTeardown() throws PeachApiException
{
stashUnirestProxy();
if(_debug)
System.out.println(">>sessionTeardown");
try
{
HttpResponse<String> ret = null;
try {
ret = Unirest
.delete(String.format("%s/api/sessions/%s", _api, _jobid))
.header(_token_header, _api_token)
.asString();
} catch (UnirestException ex) {
Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex);
throw new PeachApiException(
String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex);
}
if(ret == null)
{
throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null);
}
if(ret.getStatus() != 200)
{
String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s",
ret.getStatus(), ret.getStatusText());
throw new PeachApiException(errorMsg, null);
}
}
finally
{
revertUnirestProxy();
}
} } | public class class_name {
public void sessionTeardown() throws PeachApiException
{
stashUnirestProxy();
if(_debug)
System.out.println(">>sessionTeardown");
try
{
HttpResponse<String> ret = null;
try {
ret = Unirest
.delete(String.format("%s/api/sessions/%s", _api, _jobid))
.header(_token_header, _api_token)
.asString();
// depends on control dependency: [try], data = [none]
} catch (UnirestException ex) {
Logger.getLogger(PeachProxy.class.getName()).log(Level.SEVERE, "Error contacting Peach API", ex);
throw new PeachApiException(
String.format("Error, exception contacting Peach API: %s", ex.getMessage()), ex);
}
// depends on control dependency: [catch], data = [none]
if(ret == null)
{
throw new PeachApiException("Error, in Proxy.sessionTearDown: ret was null", null);
}
if(ret.getStatus() != 200)
{
String errorMsg = String.format("Error, DELETE /api/sessions/{jobid} returned status code of %s: %s",
ret.getStatus(), ret.getStatusText());
throw new PeachApiException(errorMsg, null);
}
}
finally
{
revertUnirestProxy();
}
} } |
public class class_name {
void submit() {
try {
List<CmsUUID> modifiedResources = undelete();
m_context.finish(modifiedResources);
} catch (Exception e) {
m_context.error(e);
}
} } | public class class_name {
void submit() {
try {
List<CmsUUID> modifiedResources = undelete();
m_context.finish(modifiedResources); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
m_context.error(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) {
if (exteriorRing == null) {
return new Polygon(srid, precision);
}
LinearRing[] clones = null;
if (interiorRings != null) {
clones = new LinearRing[interiorRings.length];
for (int i = 0; i < interiorRings.length; i++) {
clones[i] = (LinearRing) interiorRings[i].clone();
}
}
return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones);
} } | public class class_name {
public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) {
if (exteriorRing == null) {
return new Polygon(srid, precision); // depends on control dependency: [if], data = [none]
}
LinearRing[] clones = null;
if (interiorRings != null) {
clones = new LinearRing[interiorRings.length]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < interiorRings.length; i++) {
clones[i] = (LinearRing) interiorRings[i].clone(); // depends on control dependency: [for], data = [i]
}
}
return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones);
} } |
public class class_name {
public boolean isAssetFile(File path) {
boolean isAsset = false;
try {
if(FileUtil.directoryOnlyIfNotIgnored(path.getParentFile())) {
if (FileUtil.isFileInDirectory(path, config.getAssetFolder())) {
isAsset = true;
} else if (FileUtil.isFileInDirectory(path, config.getContentFolder())
&& FileUtil.getNotContentFileFilter().accept(path)) {
isAsset = true;
}
}
} catch (IOException ioe) {
LOGGER.error("Unable to determine the path to asset file {}", path.getPath(), ioe);
}
return isAsset;
} } | public class class_name {
public boolean isAssetFile(File path) {
boolean isAsset = false;
try {
if(FileUtil.directoryOnlyIfNotIgnored(path.getParentFile())) {
if (FileUtil.isFileInDirectory(path, config.getAssetFolder())) {
isAsset = true; // depends on control dependency: [if], data = [none]
} else if (FileUtil.isFileInDirectory(path, config.getContentFolder())
&& FileUtil.getNotContentFileFilter().accept(path)) {
isAsset = true; // depends on control dependency: [if], data = [none]
}
}
} catch (IOException ioe) {
LOGGER.error("Unable to determine the path to asset file {}", path.getPath(), ioe);
} // depends on control dependency: [catch], data = [none]
return isAsset;
} } |
public class class_name {
public Chat getChat(String chatID) {
try {
MultipartBody request = Unirest.post(getBotAPIUrl() + "getChat")
.field("chat_id", chatID, "application/json; charset=utf8;");
HttpResponse<String> response = request.asString();
JSONObject jsonResponse = Utils.processResponse(response);
if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) {
JSONObject result = jsonResponse.getJSONObject("result");
return ChatImpl.createChat(result, this);
}
} catch (UnirestException e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public Chat getChat(String chatID) {
try {
MultipartBody request = Unirest.post(getBotAPIUrl() + "getChat")
.field("chat_id", chatID, "application/json; charset=utf8;"); // depends on control dependency: [try], data = [none]
HttpResponse<String> response = request.asString();
JSONObject jsonResponse = Utils.processResponse(response);
if (jsonResponse != null && Utils.checkResponseStatus(jsonResponse)) {
JSONObject result = jsonResponse.getJSONObject("result");
return ChatImpl.createChat(result, this); // depends on control dependency: [if], data = [none]
}
} catch (UnirestException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static Set<Column> getColumnsReferencedBy( Visitable visitable ) {
if (visitable == null) return Collections.emptySet();
final Set<Column> symbols = new HashSet<Column>();
// Walk the entire structure, so only supply a StrategyVisitor (that does no navigation) ...
Visitors.visitAll(visitable, new AbstractVisitor() {
protected void addColumnFor( SelectorName selectorName,
String property ) {
symbols.add(new Column(selectorName, property, property));
}
@Override
public void visit( Column column ) {
symbols.add(column);
}
@Override
public void visit( EquiJoinCondition joinCondition ) {
addColumnFor(joinCondition.selector1Name(), joinCondition.getProperty1Name());
addColumnFor(joinCondition.selector2Name(), joinCondition.getProperty2Name());
}
@Override
public void visit( PropertyExistence prop ) {
addColumnFor(prop.selectorName(), prop.getPropertyName());
}
@Override
public void visit( PropertyValue prop ) {
addColumnFor(prop.selectorName(), prop.getPropertyName());
}
@Override
public void visit( ReferenceValue ref ) {
String propertyName = ref.getPropertyName();
if (propertyName != null) {
addColumnFor(ref.selectorName(), propertyName);
}
}
});
return symbols;
} } | public class class_name {
public static Set<Column> getColumnsReferencedBy( Visitable visitable ) {
if (visitable == null) return Collections.emptySet();
final Set<Column> symbols = new HashSet<Column>();
// Walk the entire structure, so only supply a StrategyVisitor (that does no navigation) ...
Visitors.visitAll(visitable, new AbstractVisitor() {
protected void addColumnFor( SelectorName selectorName,
String property ) {
symbols.add(new Column(selectorName, property, property));
}
@Override
public void visit( Column column ) {
symbols.add(column);
}
@Override
public void visit( EquiJoinCondition joinCondition ) {
addColumnFor(joinCondition.selector1Name(), joinCondition.getProperty1Name());
addColumnFor(joinCondition.selector2Name(), joinCondition.getProperty2Name());
}
@Override
public void visit( PropertyExistence prop ) {
addColumnFor(prop.selectorName(), prop.getPropertyName());
}
@Override
public void visit( PropertyValue prop ) {
addColumnFor(prop.selectorName(), prop.getPropertyName());
}
@Override
public void visit( ReferenceValue ref ) {
String propertyName = ref.getPropertyName();
if (propertyName != null) {
addColumnFor(ref.selectorName(), propertyName); // depends on control dependency: [if], data = [none]
}
}
});
return symbols;
} } |
public class class_name {
public static void sanitizeViews(Map<Address,View> map) {
if(map == null)
return;
for(Map.Entry<Address,View> entry: map.entrySet()) {
Address key=entry.getKey();
List<Address> members=new ArrayList<>(entry.getValue().getMembers());
boolean modified=false;
for(Iterator<Address> it=members.iterator(); it.hasNext();) {
Address val=it.next();
if(val.equals(key)) // we can always talk to ourself !
continue;
View view=map.get(val);
final Collection<Address> tmp_mbrs=view != null? view.getMembers() : null;
if(tmp_mbrs != null && !tmp_mbrs.contains(key)) {
it.remove();
modified=true;
}
}
if(modified) {
View old_view=entry.getValue();
entry.setValue(new View(old_view.getViewId(), members));
}
}
} } | public class class_name {
public static void sanitizeViews(Map<Address,View> map) {
if(map == null)
return;
for(Map.Entry<Address,View> entry: map.entrySet()) {
Address key=entry.getKey();
List<Address> members=new ArrayList<>(entry.getValue().getMembers());
boolean modified=false;
for(Iterator<Address> it=members.iterator(); it.hasNext();) {
Address val=it.next();
if(val.equals(key)) // we can always talk to ourself !
continue;
View view=map.get(val);
final Collection<Address> tmp_mbrs=view != null? view.getMembers() : null;
if(tmp_mbrs != null && !tmp_mbrs.contains(key)) {
it.remove(); // depends on control dependency: [if], data = [none]
modified=true; // depends on control dependency: [if], data = [none]
}
}
if(modified) {
View old_view=entry.getValue();
entry.setValue(new View(old_view.getViewId(), members)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void inflateLayers(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)
throws XmlPullParserException, IOException {
final LayerState state = mLayerState;
final int innerDepth = parser.getDepth() + 1;
int type;
int depth;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
if (depth > innerDepth || !parser.getName().equals("item")) {
continue;
}
final ChildDrawable layer = new ChildDrawable();
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.LayerDrawableItem);
updateLayerFromTypedArray(layer, a);
a.recycle();
// If the layer doesn't have a drawable or unresolved theme
// attribute for a drawable, attempt to parse one from the child
// element.
if (layer.mDrawable == null && (layer.mThemeAttrs == null ||
layer.mThemeAttrs[R.styleable.LayerDrawableItem_android_drawable] == 0)) {
while ((type = parser.next()) == XmlPullParser.TEXT) {
}
if (type != XmlPullParser.START_TAG) {
throw new XmlPullParserException(parser.getPositionDescription()
+ ": <item> tag requires a 'drawable' attribute or "
+ "child tag defining a drawable");
}
layer.mDrawable = LollipopDrawablesCompat.createFromXmlInner(r, parser, attrs, theme);
}
if (layer.mDrawable != null) {
state.mChildrenChangingConfigurations |=
layer.mDrawable.getChangingConfigurations();
layer.mDrawable.setCallback(this);
}
addLayer(layer);
}
} } | public class class_name {
private void inflateLayers(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)
throws XmlPullParserException, IOException {
final LayerState state = mLayerState;
final int innerDepth = parser.getDepth() + 1;
int type;
int depth;
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
&& ((depth = parser.getDepth()) >= innerDepth || type != XmlPullParser.END_TAG)) {
if (type != XmlPullParser.START_TAG) {
continue;
}
if (depth > innerDepth || !parser.getName().equals("item")) {
continue;
}
final ChildDrawable layer = new ChildDrawable();
final TypedArray a = obtainAttributes(r, theme, attrs, R.styleable.LayerDrawableItem);
updateLayerFromTypedArray(layer, a);
a.recycle();
// If the layer doesn't have a drawable or unresolved theme
// attribute for a drawable, attempt to parse one from the child
// element.
if (layer.mDrawable == null && (layer.mThemeAttrs == null ||
layer.mThemeAttrs[R.styleable.LayerDrawableItem_android_drawable] == 0)) {
while ((type = parser.next()) == XmlPullParser.TEXT) {
}
if (type != XmlPullParser.START_TAG) {
throw new XmlPullParserException(parser.getPositionDescription()
+ ": <item> tag requires a 'drawable' attribute or "
+ "child tag defining a drawable");
}
layer.mDrawable = LollipopDrawablesCompat.createFromXmlInner(r, parser, attrs, theme); // depends on control dependency: [if], data = [none]
}
if (layer.mDrawable != null) {
state.mChildrenChangingConfigurations |=
layer.mDrawable.getChangingConfigurations(); // depends on control dependency: [if], data = [none]
layer.mDrawable.setCallback(this); // depends on control dependency: [if], data = [none]
}
addLayer(layer);
}
} } |
public class class_name {
public boolean hasPosTag(String posTag) {
boolean found = false;
for (AnalyzedToken reading : anTokReadings) {
if (reading.getPOSTag() != null) {
found = posTag.equals(reading.getPOSTag());
if (found) {
break;
}
}
}
return found;
} } | public class class_name {
public boolean hasPosTag(String posTag) {
boolean found = false;
for (AnalyzedToken reading : anTokReadings) {
if (reading.getPOSTag() != null) {
found = posTag.equals(reading.getPOSTag()); // depends on control dependency: [if], data = [(reading.getPOSTag()]
if (found) {
break;
}
}
}
return found;
} } |
public class class_name {
@Override
public void addReplacementSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<output.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(output, i);
UnicodeReplacer r = data.lookupReplacer(ch);
if (r == null) {
toUnionTo.add(ch);
} else {
r.addReplacementSetTo(toUnionTo);
}
}
} } | public class class_name {
@Override
public void addReplacementSetTo(UnicodeSet toUnionTo) {
int ch;
for (int i=0; i<output.length(); i+=UTF16.getCharCount(ch)) {
ch = UTF16.charAt(output, i); // depends on control dependency: [for], data = [i]
UnicodeReplacer r = data.lookupReplacer(ch);
if (r == null) {
toUnionTo.add(ch); // depends on control dependency: [if], data = [none]
} else {
r.addReplacementSetTo(toUnionTo); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private String _write_comment(S sequence) {
ArrayList<String> comments = sequence.getNotesList();
String output = _write_multi_line("COMMENT", comments.remove(0));
for (String comment : comments) {
output += _write_multi_line("", comment);
}
return output;
} } | public class class_name {
private String _write_comment(S sequence) {
ArrayList<String> comments = sequence.getNotesList();
String output = _write_multi_line("COMMENT", comments.remove(0));
for (String comment : comments) {
output += _write_multi_line("", comment); // depends on control dependency: [for], data = [comment]
}
return output;
} } |
public class class_name {
private static void populateTypeMapFromParameterizedType(ParameterizedType type, Map<Type, Type> typeVariableMap) {
if (type.getRawType() instanceof Class) {
Type[] actualTypeArguments = type.getActualTypeArguments();
TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters();
for (int i = 0; i < actualTypeArguments.length; i++) {
Type actualTypeArgument = actualTypeArguments[i];
TypeVariable variable = typeVariables[i];
if (actualTypeArgument instanceof Class) {
typeVariableMap.put(variable, actualTypeArgument);
} else if (actualTypeArgument instanceof GenericArrayType) {
typeVariableMap.put(variable, actualTypeArgument);
} else if (actualTypeArgument instanceof ParameterizedType) {
typeVariableMap.put(variable, actualTypeArgument);
} else if (actualTypeArgument instanceof TypeVariable) {
// We have a type that is parameterized at instantiation time
// the nearest match on the bridge method will be the bounded type.
TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument;
Type resolvedType = typeVariableMap.get(typeVariableArgument);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(typeVariableArgument);
}
typeVariableMap.put(variable, resolvedType);
}
}
}
} } | public class class_name {
private static void populateTypeMapFromParameterizedType(ParameterizedType type, Map<Type, Type> typeVariableMap) {
if (type.getRawType() instanceof Class) {
Type[] actualTypeArguments = type.getActualTypeArguments();
TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters();
for (int i = 0; i < actualTypeArguments.length; i++) {
Type actualTypeArgument = actualTypeArguments[i];
TypeVariable variable = typeVariables[i];
if (actualTypeArgument instanceof Class) {
typeVariableMap.put(variable, actualTypeArgument); // depends on control dependency: [if], data = [none]
} else if (actualTypeArgument instanceof GenericArrayType) {
typeVariableMap.put(variable, actualTypeArgument); // depends on control dependency: [if], data = [none]
} else if (actualTypeArgument instanceof ParameterizedType) {
typeVariableMap.put(variable, actualTypeArgument); // depends on control dependency: [if], data = [none]
} else if (actualTypeArgument instanceof TypeVariable) {
// We have a type that is parameterized at instantiation time
// the nearest match on the bridge method will be the bounded type.
TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument;
Type resolvedType = typeVariableMap.get(typeVariableArgument);
if (resolvedType == null) {
resolvedType = extractBoundForTypeVariable(typeVariableArgument); // depends on control dependency: [if], data = [none]
}
typeVariableMap.put(variable, resolvedType); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static Iterable<Item> getFavorites(@Nonnull User user) {
FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
if (fup == null) {
return ImmutableList.of();
}
Set<String> favorites = fup.getAllFavorites();
if (favorites.isEmpty()) {
return ImmutableList.of();
}
final Iterator<String> iterator = favorites.iterator();
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IllegalStateException("Jenkins not started");
}
return new Iterable<Item>() {
@Override
public Iterator<Item> iterator() {
return Iterators.filter(new Iterator<Item>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Item next() {
return jenkins.getItemByFullName(iterator.next());
}
/* Fix build. */
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}, Predicates.<Item>notNull());
}
};
} } | public class class_name {
public static Iterable<Item> getFavorites(@Nonnull User user) {
FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
if (fup == null) {
return ImmutableList.of(); // depends on control dependency: [if], data = [none]
}
Set<String> favorites = fup.getAllFavorites();
if (favorites.isEmpty()) {
return ImmutableList.of(); // depends on control dependency: [if], data = [none]
}
final Iterator<String> iterator = favorites.iterator();
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
throw new IllegalStateException("Jenkins not started");
}
return new Iterable<Item>() {
@Override
public Iterator<Item> iterator() {
return Iterators.filter(new Iterator<Item>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public Item next() {
return jenkins.getItemByFullName(iterator.next());
}
/* Fix build. */
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}, Predicates.<Item>notNull());
}
};
} } |
public class class_name {
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
TimeData t = (TimeData) getColumnInType(columnIndex, Type.SQL_TIME);
if (t == null) {
return null;
}
long millis = t.getSeconds() * 1000;
if (resultMetaData.columnTypes[--columnIndex]
.isDateTimeTypeWithZone()) {}
else {
// UTC - calZO == (UTC - sessZO) + (sessionZO - calZO)
if (cal != null) {
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
millis += session.getZoneSeconds() * 1000 - zoneOffset;
}
}
return new Time(millis);
} } | public class class_name {
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
TimeData t = (TimeData) getColumnInType(columnIndex, Type.SQL_TIME);
if (t == null) {
return null;
}
long millis = t.getSeconds() * 1000;
if (resultMetaData.columnTypes[--columnIndex]
.isDateTimeTypeWithZone()) {}
else {
// UTC - calZO == (UTC - sessZO) + (sessionZO - calZO)
if (cal != null) {
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
millis += session.getZoneSeconds() * 1000 - zoneOffset; // depends on control dependency: [if], data = [none]
}
}
return new Time(millis);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.