code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) {
IBond db = dbs.getStereoBond();
IBond[] bs = dbs.getBonds();
// don't try to set a configuration on aromatic bonds
if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return;
int u = indices.get(db.getBegin());
int v = indices.get(db.getEnd());
// is bs[0] always connected to db.atom(0)?
int x = indices.get(bs[0].getOther(db.getBegin()));
int y = indices.get(bs[1].getOther(db.getEnd()));
if (dbs.getStereo() == TOGETHER) {
gb.geometric(u, v).together(x, y);
} else {
gb.geometric(u, v).opposite(x, y);
}
} } | public class class_name {
private static void addGeometricConfiguration(IDoubleBondStereochemistry dbs, int flavour, GraphBuilder gb, Map<IAtom, Integer> indices) {
IBond db = dbs.getStereoBond();
IBond[] bs = dbs.getBonds();
// don't try to set a configuration on aromatic bonds
if (SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && db.getFlag(CDKConstants.ISAROMATIC)) return;
int u = indices.get(db.getBegin());
int v = indices.get(db.getEnd());
// is bs[0] always connected to db.atom(0)?
int x = indices.get(bs[0].getOther(db.getBegin()));
int y = indices.get(bs[1].getOther(db.getEnd()));
if (dbs.getStereo() == TOGETHER) {
gb.geometric(u, v).together(x, y); // depends on control dependency: [if], data = [none]
} else {
gb.geometric(u, v).opposite(x, y); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip)
{
if (clip.intersects(tip.getBounds())) {
tip.paint(gfx);
}
} } | public class class_name {
protected void paintIndicator (Graphics2D gfx, Rectangle clip, SceneObjectIndicator tip)
{
if (clip.intersects(tip.getBounds())) {
tip.paint(gfx); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public StackTraceElement filterFirst(Throwable target, boolean isInline) {
boolean shouldSkip = isInline;
if (GET_STACK_TRACE_ELEMENT != null) {
int i = 0;
// The assumption here is that the CLEANER filter will not filter out every single
// element. However, since we don't want to compute the full length of the stacktrace,
// we don't know the upper boundary. Therefore, simply increment the counter and go as
// far as we have to go, assuming that we get there. If, in the rare occassion, we
// don't, we fall back to the old slow path.
while (true) {
try {
StackTraceElement stackTraceElement =
(StackTraceElement)
GET_STACK_TRACE_ELEMENT.invoke(JAVA_LANG_ACCESS, target, i);
if (CLEANER.isIn(stackTraceElement)) {
if (shouldSkip) {
shouldSkip = false;
} else {
return stackTraceElement;
}
}
} catch (Exception e) {
// Fall back to slow path
break;
}
i++;
}
}
// If we can't use the fast path of retrieving stackTraceElements, use the slow path by
// iterating over the actual stacktrace
for (StackTraceElement stackTraceElement : target.getStackTrace()) {
if (CLEANER.isIn(stackTraceElement)) {
if (shouldSkip) {
shouldSkip = false;
} else {
return stackTraceElement;
}
}
}
return null;
} } | public class class_name {
public StackTraceElement filterFirst(Throwable target, boolean isInline) {
boolean shouldSkip = isInline;
if (GET_STACK_TRACE_ELEMENT != null) {
int i = 0;
// The assumption here is that the CLEANER filter will not filter out every single
// element. However, since we don't want to compute the full length of the stacktrace,
// we don't know the upper boundary. Therefore, simply increment the counter and go as
// far as we have to go, assuming that we get there. If, in the rare occassion, we
// don't, we fall back to the old slow path.
while (true) {
try {
StackTraceElement stackTraceElement =
(StackTraceElement)
GET_STACK_TRACE_ELEMENT.invoke(JAVA_LANG_ACCESS, target, i);
if (CLEANER.isIn(stackTraceElement)) {
if (shouldSkip) {
shouldSkip = false; // depends on control dependency: [if], data = [none]
} else {
return stackTraceElement; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
// Fall back to slow path
break;
} // depends on control dependency: [catch], data = [none]
i++; // depends on control dependency: [while], data = [none]
}
}
// If we can't use the fast path of retrieving stackTraceElements, use the slow path by
// iterating over the actual stacktrace
for (StackTraceElement stackTraceElement : target.getStackTrace()) {
if (CLEANER.isIn(stackTraceElement)) {
if (shouldSkip) {
shouldSkip = false; // depends on control dependency: [if], data = [none]
} else {
return stackTraceElement; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
private void updateStatistic(OIndex<?> index) {
final OProfiler profiler = Orient.instance().getProfiler();
if (profiler.isRecording()) {
Orient.instance().getProfiler()
.updateCounter(profiler.getDatabaseMetric(index.getDatabaseName(), "query.indexUsed"), "Used index in query", +1);
final int paramCount = index.getDefinition().getParamCount();
if (paramCount > 1) {
final String profiler_prefix = profiler.getDatabaseMetric(index.getDatabaseName(), "query.compositeIndexUsed");
profiler.updateCounter(profiler_prefix, "Used composite index in query", +1);
profiler
.updateCounter(profiler_prefix + "." + paramCount, "Used composite index in query with " + paramCount + " params", +1);
}
}
} } | public class class_name {
private void updateStatistic(OIndex<?> index) {
final OProfiler profiler = Orient.instance().getProfiler();
if (profiler.isRecording()) {
Orient.instance().getProfiler()
.updateCounter(profiler.getDatabaseMetric(index.getDatabaseName(), "query.indexUsed"), "Used index in query", +1); // depends on control dependency: [if], data = [none]
final int paramCount = index.getDefinition().getParamCount();
if (paramCount > 1) {
final String profiler_prefix = profiler.getDatabaseMetric(index.getDatabaseName(), "query.compositeIndexUsed");
profiler.updateCounter(profiler_prefix, "Used composite index in query", +1);
profiler
.updateCounter(profiler_prefix + "." + paramCount, "Used composite index in query with " + paramCount + " params", +1);
}
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static void after(Object request, Object response) {
HttpData data = new HttpData();
/*
* Use reflection to access the HttpServletRequest/Response as using the
* true method signature caused ClassLoader issues.
*/
Class<?> reqClass = request.getClass();
Class<?> respClass = response.getClass();
try {
/*
* Retrieve the request tracker
*/
Method getAttribute = reqClass.getMethod(GET_ATTRIBUTE, String.class);
Method setAttribute = reqClass.getMethod(SET_ATTRIBUTE, String.class, Object.class);
HttpRequestTracker tracker = (HttpRequestTracker) (getAttribute.invoke(request, TRACKER_ATTRIBUTE));
if (tracker == null) {
/*
* should never happen
*/
throw new JavametricsException("Unable to find request tracker");
}
/*
* Decrement the nesting level and return if still nested
*/
if (tracker.decrement()) {
setAttribute.invoke(request, TRACKER_ATTRIBUTE, tracker);
return;
}
/*
* Clear the tracker
*/
setAttribute.invoke(request, TRACKER_ATTRIBUTE, null);
data.setRequestTime(tracker.getRequestTime());
Method getRequestURL = reqClass.getMethod(GET_REQUEST_URL);
data.setUrl(((StringBuffer) getRequestURL.invoke(request)).toString());
Method getMethod = reqClass.getMethod(GET_METHOD);
data.setMethod((String) getMethod.invoke(request));
Method getStatus = respClass.getMethod(GET_STATUS);
data.setStatus((Integer) getStatus.invoke(response));
if (detailed) {
Method getContentType = respClass.getMethod(GET_CONTENT_TYPE);
data.setContentType((String) getContentType.invoke(response));
Method getHeaders = respClass.getMethod(GET_HEADER_NAMES);
Method getHeader = respClass.getMethod(GET_HEADER, String.class);
Collection<String> headers = (Collection<String>) getHeaders.invoke(response);
if (headers != null) {
for (String headerName : headers) {
String header = (String) getHeader.invoke(response, headerName);
if (header != null) {
data.addHeader(headerName, header);
}
}
}
Method getReqHeaders = reqClass.getMethod(GET_HEADER_NAMES);
Method getReqHeader = reqClass.getMethod(GET_HEADER, String.class);
Enumeration<String> reqHeaders = (Enumeration<String>) getReqHeaders.invoke(request);
if (reqHeaders != null) {
while (reqHeaders.hasMoreElements()) {
String headerName = reqHeaders.nextElement();
String header = (String) getReqHeader.invoke(request, headerName);
if (header != null) {
data.addRequestHeader(headerName, header);
}
}
}
}
data.setDuration(System.currentTimeMillis() - tracker.getRequestTime());
if (Agent.debug) {
System.err.println("Javametrics: Sending {\"http\":" + data.toJsonString() + "}");
}
/*
* Send the http request data to the Javametrics agent
*/
Javametrics.getInstance().sendJSON(HTTP_TOPIC, data.toJsonString());
} catch (Exception e) {
// Log any exception caused by our injected code
System.err.println("Javametrics: Servlet callback exception: " + e.toString());
e.printStackTrace();
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static void after(Object request, Object response) {
HttpData data = new HttpData();
/*
* Use reflection to access the HttpServletRequest/Response as using the
* true method signature caused ClassLoader issues.
*/
Class<?> reqClass = request.getClass();
Class<?> respClass = response.getClass();
try {
/*
* Retrieve the request tracker
*/
Method getAttribute = reqClass.getMethod(GET_ATTRIBUTE, String.class);
Method setAttribute = reqClass.getMethod(SET_ATTRIBUTE, String.class, Object.class);
HttpRequestTracker tracker = (HttpRequestTracker) (getAttribute.invoke(request, TRACKER_ATTRIBUTE));
if (tracker == null) {
/*
* should never happen
*/
throw new JavametricsException("Unable to find request tracker");
}
/*
* Decrement the nesting level and return if still nested
*/
if (tracker.decrement()) {
setAttribute.invoke(request, TRACKER_ATTRIBUTE, tracker); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
/*
* Clear the tracker
*/
setAttribute.invoke(request, TRACKER_ATTRIBUTE, null); // depends on control dependency: [try], data = [none]
data.setRequestTime(tracker.getRequestTime()); // depends on control dependency: [try], data = [none]
Method getRequestURL = reqClass.getMethod(GET_REQUEST_URL);
data.setUrl(((StringBuffer) getRequestURL.invoke(request)).toString()); // depends on control dependency: [try], data = [none]
Method getMethod = reqClass.getMethod(GET_METHOD);
data.setMethod((String) getMethod.invoke(request)); // depends on control dependency: [try], data = [none]
Method getStatus = respClass.getMethod(GET_STATUS);
data.setStatus((Integer) getStatus.invoke(response)); // depends on control dependency: [try], data = [none]
if (detailed) {
Method getContentType = respClass.getMethod(GET_CONTENT_TYPE);
data.setContentType((String) getContentType.invoke(response)); // depends on control dependency: [if], data = [none]
Method getHeaders = respClass.getMethod(GET_HEADER_NAMES);
Method getHeader = respClass.getMethod(GET_HEADER, String.class);
Collection<String> headers = (Collection<String>) getHeaders.invoke(response);
if (headers != null) {
for (String headerName : headers) {
String header = (String) getHeader.invoke(response, headerName);
if (header != null) {
data.addHeader(headerName, header); // depends on control dependency: [if], data = [(header]
}
}
}
Method getReqHeaders = reqClass.getMethod(GET_HEADER_NAMES);
Method getReqHeader = reqClass.getMethod(GET_HEADER, String.class);
Enumeration<String> reqHeaders = (Enumeration<String>) getReqHeaders.invoke(request);
if (reqHeaders != null) {
while (reqHeaders.hasMoreElements()) {
String headerName = reqHeaders.nextElement();
String header = (String) getReqHeader.invoke(request, headerName);
if (header != null) {
data.addRequestHeader(headerName, header); // depends on control dependency: [if], data = [(header]
}
}
}
}
data.setDuration(System.currentTimeMillis() - tracker.getRequestTime()); // depends on control dependency: [try], data = [none]
if (Agent.debug) {
System.err.println("Javametrics: Sending {\"http\":" + data.toJsonString() + "}"); // depends on control dependency: [if], data = [none]
}
/*
* Send the http request data to the Javametrics agent
*/
Javametrics.getInstance().sendJSON(HTTP_TOPIC, data.toJsonString()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Log any exception caused by our injected code
System.err.println("Javametrics: Servlet callback exception: " + e.toString());
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void run() {
if (logger.isDebugEnabled()){
logger.debug("run");
}
final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(key.getApplicationName());
if(sipContext != null) {
SipManager sipManager = sipContext.getSipManager();
MobicentsSipApplicationSession sipApplicationSession = sipManager.getSipApplicationSession(key, false);
if(sipApplicationSession != null) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
boolean batchStarted = false;
try {
if(logger.isDebugEnabled()) {
logger.debug("Asynchronous work for sip app session " + key + " scheduled to run once the sipappsession lock is available.");
}
sipContext.enterSipContext();
sipContext.enterSipApp(sipApplicationSession, null, false, true);
batchStarted = sipContext.enterSipAppHa(true);
if(logger.isDebugEnabled()) {
logger.debug("Starting Asynchronous work for sip app session " + key);
}
work.doAsynchronousWork(sipApplicationSession);
if(logger.isDebugEnabled()) {
logger.debug("Done with Asynchronous work for sip app session " + key);
}
} catch(Throwable t) {
logger.error("An unexpected exception happened in the SipApplicationSessionAsynchronousWork callback on sip application session " + key, t);
} finally {
if(logger.isDebugEnabled()) {
logger.debug("Exiting Asynchronous work for sip app session " + key);
}
sipContext.exitSipAppHa(null, null, batchStarted);
sipContext.exitSipApp(sipApplicationSession, null);
sipContext.exitSipContext(oldClassLoader);
}
} else {
if(logger.isDebugEnabled()) {
logger.debug("SipApplicationSession " + key + " couldn't be found, it may have been already invalidated.");
}
}
}
} } | public class class_name {
public void run() {
if (logger.isDebugEnabled()){
logger.debug("run"); // depends on control dependency: [if], data = [none]
}
final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(key.getApplicationName());
if(sipContext != null) {
SipManager sipManager = sipContext.getSipManager();
MobicentsSipApplicationSession sipApplicationSession = sipManager.getSipApplicationSession(key, false);
if(sipApplicationSession != null) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
boolean batchStarted = false;
try {
if(logger.isDebugEnabled()) {
logger.debug("Asynchronous work for sip app session " + key + " scheduled to run once the sipappsession lock is available."); // depends on control dependency: [if], data = [none]
}
sipContext.enterSipContext(); // depends on control dependency: [try], data = [none]
sipContext.enterSipApp(sipApplicationSession, null, false, true); // depends on control dependency: [try], data = [none]
batchStarted = sipContext.enterSipAppHa(true); // depends on control dependency: [try], data = [none]
if(logger.isDebugEnabled()) {
logger.debug("Starting Asynchronous work for sip app session " + key); // depends on control dependency: [if], data = [none]
}
work.doAsynchronousWork(sipApplicationSession); // depends on control dependency: [try], data = [none]
if(logger.isDebugEnabled()) {
logger.debug("Done with Asynchronous work for sip app session " + key); // depends on control dependency: [if], data = [none]
}
} catch(Throwable t) {
logger.error("An unexpected exception happened in the SipApplicationSessionAsynchronousWork callback on sip application session " + key, t);
} finally { // depends on control dependency: [catch], data = [none]
if(logger.isDebugEnabled()) {
logger.debug("Exiting Asynchronous work for sip app session " + key); // depends on control dependency: [if], data = [none]
}
sipContext.exitSipAppHa(null, null, batchStarted);
sipContext.exitSipApp(sipApplicationSession, null);
sipContext.exitSipContext(oldClassLoader);
}
} else {
if(logger.isDebugEnabled()) {
logger.debug("SipApplicationSession " + key + " couldn't be found, it may have been already invalidated."); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private void visitArray(final ObjectGraphNode node) {
if (node.getValue() instanceof Object[]) {
Object[] array = (Object[]) node.getValue();
for (int i = 0; i < array.length; i++) {
String entryType = array[i] == null ? Object.class.getName() : array[i].getClass().
getName();
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + i + "]",
entryType, array[i]);
node.add(childNode);
visit(childNode);
}
} else {
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[primitive array]", node.
getValue().getClass().getName(), node.getValue());
node.add(childNode);
}
} } | public class class_name {
private void visitArray(final ObjectGraphNode node) {
if (node.getValue() instanceof Object[]) {
Object[] array = (Object[]) node.getValue();
for (int i = 0; i < array.length; i++) {
String entryType = array[i] == null ? Object.class.getName() : array[i].getClass().
getName();
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + i + "]",
entryType, array[i]);
node.add(childNode); // depends on control dependency: [for], data = [none]
visit(childNode); // depends on control dependency: [for], data = [none]
}
} else {
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[primitive array]", node.
getValue().getClass().getName(), node.getValue());
node.add(childNode); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean setRelation(TemporalExtendedPropositionDefinition lhsDef,
TemporalExtendedPropositionDefinition rhsDef, Relation relation) {
if (lhsDef == null || rhsDef == null || relation == null) {
return false;
}
if (!defs.contains(lhsDef) || !defs.contains(rhsDef)) {
return false;
}
List<TemporalExtendedPropositionDefinition> rulePair = Arrays.asList(
lhsDef, rhsDef);
defPairsMap.put(rulePair, relation);
return true;
} } | public class class_name {
public boolean setRelation(TemporalExtendedPropositionDefinition lhsDef,
TemporalExtendedPropositionDefinition rhsDef, Relation relation) {
if (lhsDef == null || rhsDef == null || relation == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (!defs.contains(lhsDef) || !defs.contains(rhsDef)) {
return false; // depends on control dependency: [if], data = [none]
}
List<TemporalExtendedPropositionDefinition> rulePair = Arrays.asList(
lhsDef, rhsDef);
defPairsMap.put(rulePair, relation);
return true;
} } |
public class class_name {
public boolean isPotentialTypeLiteral(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes) {
if (featureCall instanceof XMemberFeatureCall) {
return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, ((XMemberFeatureCall) featureCall).isExplicitStatic());
}
return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, false);
} } | public class class_name {
public boolean isPotentialTypeLiteral(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes) {
if (featureCall instanceof XMemberFeatureCall) {
return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, ((XMemberFeatureCall) featureCall).isExplicitStatic()); // depends on control dependency: [if], data = [none]
}
return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, false);
} } |
public class class_name {
public T extract(Object target) {
if (target == null) {
return null;
}
if (!(target instanceof Map)) {
throw new IllegalArgumentException(
"Extraction target is not a Map");
}
return (T) ((Map) target).get(key);
} } | public class class_name {
public T extract(Object target) {
if (target == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (!(target instanceof Map)) {
throw new IllegalArgumentException(
"Extraction target is not a Map");
}
return (T) ((Map) target).get(key);
} } |
public class class_name {
public ResourceBundle getResourceBundle(String baseName) {
// System.out.println(this + " " + this.locale+" ("+resourceBundles.size()+")");
ResourceBundle bundle = (ResourceBundle) resourceBundles.get(baseName);
if(null == bundle) {
resourceBundles.put(baseName, bundle = findBundle(baseName));
}
return bundle;
} } | public class class_name {
public ResourceBundle getResourceBundle(String baseName) {
// System.out.println(this + " " + this.locale+" ("+resourceBundles.size()+")");
ResourceBundle bundle = (ResourceBundle) resourceBundles.get(baseName);
if(null == bundle) {
resourceBundles.put(baseName, bundle = findBundle(baseName)); // depends on control dependency: [if], data = [none]
}
return bundle;
} } |
public class class_name {
public DescribeTargetHealthRequest withTargets(TargetDescription... targets) {
if (this.targets == null) {
setTargets(new java.util.ArrayList<TargetDescription>(targets.length));
}
for (TargetDescription ele : targets) {
this.targets.add(ele);
}
return this;
} } | public class class_name {
public DescribeTargetHealthRequest withTargets(TargetDescription... targets) {
if (this.targets == null) {
setTargets(new java.util.ArrayList<TargetDescription>(targets.length)); // depends on control dependency: [if], data = [none]
}
for (TargetDescription ele : targets) {
this.targets.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void findStream(String sql, Object []args, ResultStream<Cursor> result)
{
QueryBuilderKraken builder = QueryParserKraken.parse(this, sql);
if (builder.isTableLoaded()) {
QueryKraken query = builder.build();
findStream(query, args, result);
}
else {
String tableName = builder.getTableName();
_tableService.loadTable(tableName,
result.of((x,r)->{
findStream(builder.build(), args, r);
}));
//new FindStreamResult(result, builder, args));
}
} } | public class class_name {
public void findStream(String sql, Object []args, ResultStream<Cursor> result)
{
QueryBuilderKraken builder = QueryParserKraken.parse(this, sql);
if (builder.isTableLoaded()) {
QueryKraken query = builder.build();
findStream(query, args, result); // depends on control dependency: [if], data = [none]
}
else {
String tableName = builder.getTableName();
_tableService.loadTable(tableName,
result.of((x,r)->{
findStream(builder.build(), args, r); // depends on control dependency: [if], data = [none]
}));
//new FindStreamResult(result, builder, args));
}
} } |
public class class_name {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av = super.visitAnnotation(desc, visible);
observedAnnotations.add(Type.getType(desc));
if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) {
injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass());
av = injectedTraceAnnotationVisitor;
}
return av;
} } | public class class_name {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av = super.visitAnnotation(desc, visible);
observedAnnotations.add(Type.getType(desc));
if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) {
injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass()); // depends on control dependency: [if], data = [none]
av = injectedTraceAnnotationVisitor; // depends on control dependency: [if], data = [none]
}
return av;
} } |
public class class_name {
private void setAttemptsMap(String projectId, String eventCollection, Map<String, Integer> attempts) throws IOException {
if (eventStore instanceof KeenAttemptCountingEventStore) {
KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore;
StringWriter writer = null;
try {
writer = new StringWriter();
jsonHandler.writeJson(writer, attempts);
String attemptsJSON = writer.toString();
res.setAttempts(projectId, eventCollection, attemptsJSON);
} finally {
KeenUtils.closeQuietly(writer);
}
}
} } | public class class_name {
private void setAttemptsMap(String projectId, String eventCollection, Map<String, Integer> attempts) throws IOException {
if (eventStore instanceof KeenAttemptCountingEventStore) {
KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore;
StringWriter writer = null;
try {
writer = new StringWriter(); // depends on control dependency: [try], data = [none]
jsonHandler.writeJson(writer, attempts); // depends on control dependency: [try], data = [none]
String attemptsJSON = writer.toString();
res.setAttempts(projectId, eventCollection, attemptsJSON); // depends on control dependency: [try], data = [none]
} finally {
KeenUtils.closeQuietly(writer);
}
}
} } |
public class class_name {
public Iterator<QueueUser> getUsers() {
if (users == null) {
return new HashSet<QueueUser>().iterator();
}
return Collections.unmodifiableSet(users).iterator();
} } | public class class_name {
public Iterator<QueueUser> getUsers() {
if (users == null) {
return new HashSet<QueueUser>().iterator(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(users).iterator();
} } |
public class class_name {
public static void changeWordEndianess(byte[] b, int offset,
int length) {
byte tmp;
for (int i = offset; i < offset + length; i += 4) {
tmp = b[i];
b[i] = b[i + 3];
b[i + 3] = tmp;
tmp = b[i + 1];
b[i + 1] = b[i + 2];
b[i + 2] = tmp;
}
} } | public class class_name {
public static void changeWordEndianess(byte[] b, int offset,
int length) {
byte tmp;
for (int i = offset; i < offset + length; i += 4) {
tmp = b[i]; // depends on control dependency: [for], data = [i]
b[i] = b[i + 3]; // depends on control dependency: [for], data = [i]
b[i + 3] = tmp; // depends on control dependency: [for], data = [i]
tmp = b[i + 1]; // depends on control dependency: [for], data = [i]
b[i + 1] = b[i + 2]; // depends on control dependency: [for], data = [i]
b[i + 2] = tmp; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public Nist decode(File file) {
try {
return decode(new FileInputStream(file));
} catch (FileNotFoundException e) {
throw new RuntimeException("unexpected error.", e);
}
} } | public class class_name {
public Nist decode(File file) {
try {
return decode(new FileInputStream(file)); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw new RuntimeException("unexpected error.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addPostParams(final Request request) {
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName);
}
if (defaultServiceRoleSid != null) {
request.addPostParam("DefaultServiceRoleSid", defaultServiceRoleSid);
}
if (defaultChannelRoleSid != null) {
request.addPostParam("DefaultChannelRoleSid", defaultChannelRoleSid);
}
if (defaultChannelCreatorRoleSid != null) {
request.addPostParam("DefaultChannelCreatorRoleSid", defaultChannelCreatorRoleSid);
}
if (readStatusEnabled != null) {
request.addPostParam("ReadStatusEnabled", readStatusEnabled.toString());
}
if (reachabilityEnabled != null) {
request.addPostParam("ReachabilityEnabled", reachabilityEnabled.toString());
}
if (typingIndicatorTimeout != null) {
request.addPostParam("TypingIndicatorTimeout", typingIndicatorTimeout.toString());
}
if (consumptionReportInterval != null) {
request.addPostParam("ConsumptionReportInterval", consumptionReportInterval.toString());
}
if (notificationsNewMessageEnabled != null) {
request.addPostParam("Notifications.NewMessage.Enabled", notificationsNewMessageEnabled.toString());
}
if (notificationsNewMessageTemplate != null) {
request.addPostParam("Notifications.NewMessage.Template", notificationsNewMessageTemplate);
}
if (notificationsNewMessageSound != null) {
request.addPostParam("Notifications.NewMessage.Sound", notificationsNewMessageSound);
}
if (notificationsNewMessageBadgeCountEnabled != null) {
request.addPostParam("Notifications.NewMessage.BadgeCountEnabled", notificationsNewMessageBadgeCountEnabled.toString());
}
if (notificationsAddedToChannelEnabled != null) {
request.addPostParam("Notifications.AddedToChannel.Enabled", notificationsAddedToChannelEnabled.toString());
}
if (notificationsAddedToChannelTemplate != null) {
request.addPostParam("Notifications.AddedToChannel.Template", notificationsAddedToChannelTemplate);
}
if (notificationsAddedToChannelSound != null) {
request.addPostParam("Notifications.AddedToChannel.Sound", notificationsAddedToChannelSound);
}
if (notificationsRemovedFromChannelEnabled != null) {
request.addPostParam("Notifications.RemovedFromChannel.Enabled", notificationsRemovedFromChannelEnabled.toString());
}
if (notificationsRemovedFromChannelTemplate != null) {
request.addPostParam("Notifications.RemovedFromChannel.Template", notificationsRemovedFromChannelTemplate);
}
if (notificationsRemovedFromChannelSound != null) {
request.addPostParam("Notifications.RemovedFromChannel.Sound", notificationsRemovedFromChannelSound);
}
if (notificationsInvitedToChannelEnabled != null) {
request.addPostParam("Notifications.InvitedToChannel.Enabled", notificationsInvitedToChannelEnabled.toString());
}
if (notificationsInvitedToChannelTemplate != null) {
request.addPostParam("Notifications.InvitedToChannel.Template", notificationsInvitedToChannelTemplate);
}
if (notificationsInvitedToChannelSound != null) {
request.addPostParam("Notifications.InvitedToChannel.Sound", notificationsInvitedToChannelSound);
}
if (preWebhookUrl != null) {
request.addPostParam("PreWebhookUrl", preWebhookUrl.toString());
}
if (postWebhookUrl != null) {
request.addPostParam("PostWebhookUrl", postWebhookUrl.toString());
}
if (webhookMethod != null) {
request.addPostParam("WebhookMethod", webhookMethod.toString());
}
if (webhookFilters != null) {
for (String prop : webhookFilters) {
request.addPostParam("WebhookFilters", prop);
}
}
if (limitsChannelMembers != null) {
request.addPostParam("Limits.ChannelMembers", limitsChannelMembers.toString());
}
if (limitsUserChannels != null) {
request.addPostParam("Limits.UserChannels", limitsUserChannels.toString());
}
if (mediaCompatibilityMessage != null) {
request.addPostParam("Media.CompatibilityMessage", mediaCompatibilityMessage);
}
if (preWebhookRetryCount != null) {
request.addPostParam("PreWebhookRetryCount", preWebhookRetryCount.toString());
}
if (postWebhookRetryCount != null) {
request.addPostParam("PostWebhookRetryCount", postWebhookRetryCount.toString());
}
if (notificationsLogEnabled != null) {
request.addPostParam("Notifications.LogEnabled", notificationsLogEnabled.toString());
}
} } | public class class_name {
private void addPostParams(final Request request) {
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none]
}
if (defaultServiceRoleSid != null) {
request.addPostParam("DefaultServiceRoleSid", defaultServiceRoleSid); // depends on control dependency: [if], data = [none]
}
if (defaultChannelRoleSid != null) {
request.addPostParam("DefaultChannelRoleSid", defaultChannelRoleSid); // depends on control dependency: [if], data = [none]
}
if (defaultChannelCreatorRoleSid != null) {
request.addPostParam("DefaultChannelCreatorRoleSid", defaultChannelCreatorRoleSid); // depends on control dependency: [if], data = [none]
}
if (readStatusEnabled != null) {
request.addPostParam("ReadStatusEnabled", readStatusEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (reachabilityEnabled != null) {
request.addPostParam("ReachabilityEnabled", reachabilityEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (typingIndicatorTimeout != null) {
request.addPostParam("TypingIndicatorTimeout", typingIndicatorTimeout.toString()); // depends on control dependency: [if], data = [none]
}
if (consumptionReportInterval != null) {
request.addPostParam("ConsumptionReportInterval", consumptionReportInterval.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsNewMessageEnabled != null) {
request.addPostParam("Notifications.NewMessage.Enabled", notificationsNewMessageEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsNewMessageTemplate != null) {
request.addPostParam("Notifications.NewMessage.Template", notificationsNewMessageTemplate); // depends on control dependency: [if], data = [none]
}
if (notificationsNewMessageSound != null) {
request.addPostParam("Notifications.NewMessage.Sound", notificationsNewMessageSound); // depends on control dependency: [if], data = [none]
}
if (notificationsNewMessageBadgeCountEnabled != null) {
request.addPostParam("Notifications.NewMessage.BadgeCountEnabled", notificationsNewMessageBadgeCountEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsAddedToChannelEnabled != null) {
request.addPostParam("Notifications.AddedToChannel.Enabled", notificationsAddedToChannelEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsAddedToChannelTemplate != null) {
request.addPostParam("Notifications.AddedToChannel.Template", notificationsAddedToChannelTemplate); // depends on control dependency: [if], data = [none]
}
if (notificationsAddedToChannelSound != null) {
request.addPostParam("Notifications.AddedToChannel.Sound", notificationsAddedToChannelSound); // depends on control dependency: [if], data = [none]
}
if (notificationsRemovedFromChannelEnabled != null) {
request.addPostParam("Notifications.RemovedFromChannel.Enabled", notificationsRemovedFromChannelEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsRemovedFromChannelTemplate != null) {
request.addPostParam("Notifications.RemovedFromChannel.Template", notificationsRemovedFromChannelTemplate); // depends on control dependency: [if], data = [none]
}
if (notificationsRemovedFromChannelSound != null) {
request.addPostParam("Notifications.RemovedFromChannel.Sound", notificationsRemovedFromChannelSound); // depends on control dependency: [if], data = [none]
}
if (notificationsInvitedToChannelEnabled != null) {
request.addPostParam("Notifications.InvitedToChannel.Enabled", notificationsInvitedToChannelEnabled.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsInvitedToChannelTemplate != null) {
request.addPostParam("Notifications.InvitedToChannel.Template", notificationsInvitedToChannelTemplate); // depends on control dependency: [if], data = [none]
}
if (notificationsInvitedToChannelSound != null) {
request.addPostParam("Notifications.InvitedToChannel.Sound", notificationsInvitedToChannelSound); // depends on control dependency: [if], data = [none]
}
if (preWebhookUrl != null) {
request.addPostParam("PreWebhookUrl", preWebhookUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (postWebhookUrl != null) {
request.addPostParam("PostWebhookUrl", postWebhookUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (webhookMethod != null) {
request.addPostParam("WebhookMethod", webhookMethod.toString()); // depends on control dependency: [if], data = [none]
}
if (webhookFilters != null) {
for (String prop : webhookFilters) {
request.addPostParam("WebhookFilters", prop); // depends on control dependency: [for], data = [prop]
}
}
if (limitsChannelMembers != null) {
request.addPostParam("Limits.ChannelMembers", limitsChannelMembers.toString()); // depends on control dependency: [if], data = [none]
}
if (limitsUserChannels != null) {
request.addPostParam("Limits.UserChannels", limitsUserChannels.toString()); // depends on control dependency: [if], data = [none]
}
if (mediaCompatibilityMessage != null) {
request.addPostParam("Media.CompatibilityMessage", mediaCompatibilityMessage); // depends on control dependency: [if], data = [none]
}
if (preWebhookRetryCount != null) {
request.addPostParam("PreWebhookRetryCount", preWebhookRetryCount.toString()); // depends on control dependency: [if], data = [none]
}
if (postWebhookRetryCount != null) {
request.addPostParam("PostWebhookRetryCount", postWebhookRetryCount.toString()); // depends on control dependency: [if], data = [none]
}
if (notificationsLogEnabled != null) {
request.addPostParam("Notifications.LogEnabled", notificationsLogEnabled.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public RequestTemplate target(String target) {
/* target can be empty */
if (Util.isBlank(target)) {
return this;
}
/* verify that the target contains the scheme, host and port */
if (!UriUtils.isAbsolute(target)) {
throw new IllegalArgumentException("target values must be absolute.");
}
if (target.endsWith("/")) {
target = target.substring(0, target.length() - 1);
}
try {
/* parse the target */
URI targetUri = URI.create(target);
if (Util.isNotBlank(targetUri.getRawQuery())) {
/*
* target has a query string, we need to make sure that they are recorded as queries
*/
this.extractQueryTemplates(targetUri.getRawQuery(), true);
}
/* strip the query string */
this.target = targetUri.getScheme() + "://" + targetUri.getAuthority() + targetUri.getPath();
if (targetUri.getFragment() != null) {
this.fragment = "#" + targetUri.getFragment();
}
} catch (IllegalArgumentException iae) {
/* the uri provided is not a valid one, we can't continue */
throw new IllegalArgumentException("Target is not a valid URI.", iae);
}
return this;
} } | public class class_name {
public RequestTemplate target(String target) {
/* target can be empty */
if (Util.isBlank(target)) {
return this; // depends on control dependency: [if], data = [none]
}
/* verify that the target contains the scheme, host and port */
if (!UriUtils.isAbsolute(target)) {
throw new IllegalArgumentException("target values must be absolute.");
}
if (target.endsWith("/")) {
target = target.substring(0, target.length() - 1); // depends on control dependency: [if], data = [none]
}
try {
/* parse the target */
URI targetUri = URI.create(target);
if (Util.isNotBlank(targetUri.getRawQuery())) {
/*
* target has a query string, we need to make sure that they are recorded as queries
*/
this.extractQueryTemplates(targetUri.getRawQuery(), true); // depends on control dependency: [if], data = [none]
}
/* strip the query string */
this.target = targetUri.getScheme() + "://" + targetUri.getAuthority() + targetUri.getPath();
if (targetUri.getFragment() != null) { // depends on control dependency: [try], data = [none]
this.fragment = "#" + targetUri.getFragment();
}
} catch (IllegalArgumentException iae) {
/* the uri provided is not a valid one, we can't continue */
throw new IllegalArgumentException("Target is not a valid URI.", iae);
} // depends on control dependency: [catch], data = [none]
return this;
} } |
public class class_name {
public ConfigPropertyType<AdminobjectType<T>> getOrCreateConfigProperty()
{
List<Node> nodeList = childNode.get("config-property");
if (nodeList != null && nodeList.size() > 0)
{
return new ConfigPropertyTypeImpl<AdminobjectType<T>>(this, "config-property", childNode, nodeList.get(0));
}
return createConfigProperty();
} } | public class class_name {
public ConfigPropertyType<AdminobjectType<T>> getOrCreateConfigProperty()
{
List<Node> nodeList = childNode.get("config-property");
if (nodeList != null && nodeList.size() > 0)
{
return new ConfigPropertyTypeImpl<AdminobjectType<T>>(this, "config-property", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createConfigProperty();
} } |
public class class_name {
protected final void removeMessage(Http2Stream stream, boolean release) {
FullHttpMessage msg = stream.removeProperty(messageKey);
if (release && msg != null) {
msg.release();
}
} } | public class class_name {
protected final void removeMessage(Http2Stream stream, boolean release) {
FullHttpMessage msg = stream.removeProperty(messageKey);
if (release && msg != null) {
msg.release(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getNode(String path, String title, int type, boolean folder, CmsResourceState state, boolean grey) {
StringBuffer result = new StringBuffer(64);
String parent = CmsResource.getParentFolder(path);
result.append("parent.aC(\"");
// name
result.append(title);
result.append("\",");
// type
result.append(type);
result.append(",");
// folder
if (folder) {
result.append(1);
} else {
result.append(0);
}
result.append(",");
// hashcode of path
result.append(path.hashCode());
result.append(",");
// hashcode of parent path
result.append((parent != null) ? parent.hashCode() : 0);
result.append(",");
// resource state
result.append(state);
result.append(",");
// project status
if (grey) {
result.append(1);
} else {
result.append(0);
}
result.append(");\n");
return result.toString();
} } | public class class_name {
private String getNode(String path, String title, int type, boolean folder, CmsResourceState state, boolean grey) {
StringBuffer result = new StringBuffer(64);
String parent = CmsResource.getParentFolder(path);
result.append("parent.aC(\"");
// name
result.append(title);
result.append("\",");
// type
result.append(type);
result.append(",");
// folder
if (folder) {
result.append(1); // depends on control dependency: [if], data = [none]
} else {
result.append(0); // depends on control dependency: [if], data = [none]
}
result.append(",");
// hashcode of path
result.append(path.hashCode());
result.append(",");
// hashcode of parent path
result.append((parent != null) ? parent.hashCode() : 0);
result.append(",");
// resource state
result.append(state);
result.append(",");
// project status
if (grey) {
result.append(1); // depends on control dependency: [if], data = [none]
} else {
result.append(0); // depends on control dependency: [if], data = [none]
}
result.append(");\n");
return result.toString();
} } |
public class class_name {
private Array readStandardData(Variable v2, Section section)
throws IOException {
Array array = null;
if (v2 instanceof Structure) {
List<GempakParameter> params =
gemreader.getParameters(GempakSurfaceFileReader.SFDT);
Structure pdata = (Structure) v2;
StructureMembers members = pdata.makeStructureMembers();
List<StructureMembers.Member> mbers =
members.getMembers();
int i = 0;
int numBytes = 0;
int totalNumBytes = 0;
for (StructureMembers.Member member : mbers) {
member.setDataParam(4 * i++);
numBytes = member.getDataType().getSize();
totalNumBytes += numBytes;
}
// one member is a byte
members.setStructureSize(totalNumBytes);
float[] missing = new float[mbers.size()];
int missnum = 0;
for (Variable v : pdata.getVariables()) {
Attribute att = v.findAttribute("missing_value");
missing[missnum++] = (att == null)
? GempakConstants.RMISSD
: att.getNumericValue().floatValue();
}
//int num = 0;
Range stationRange = section.getRange(0);
Range timeRange = section.getRange(1);
int size = stationRange.length() * timeRange.length();
// Create a ByteBuffer using a byte array
byte[] bytes = new byte[totalNumBytes * size];
ByteBuffer buf = ByteBuffer.wrap(bytes);
array = new ArrayStructureBB(members, new int[]{size}, buf, 0);
for (int stnIdx : stationRange) {
for (int timeIdx : timeRange) {
GempakFileReader.RData vals = gemreader.DM_RDTR(timeIdx + 1, stnIdx + 1, GempakSurfaceFileReader.SFDT);
if (vals == null) {
int k = 0;
for (StructureMembers.Member member : mbers) {
if (member.getDataType().equals(DataType.FLOAT)) {
buf.putFloat(missing[k]);
} else {
buf.put((byte) 1);
}
k++;
}
} else {
float[] reals = vals.data;
int var = 0;
for (GempakParameter param : params) {
if (members.findMember(param.getName()) != null) {
buf.putFloat(reals[var]);
}
var++;
}
// always add the missing flag
buf.put((byte) 0);
}
}
}
//Trace.call2("GEMPAKSIOSP: readStandardData");
}
return array;
} } | public class class_name {
private Array readStandardData(Variable v2, Section section)
throws IOException {
Array array = null;
if (v2 instanceof Structure) {
List<GempakParameter> params =
gemreader.getParameters(GempakSurfaceFileReader.SFDT);
Structure pdata = (Structure) v2;
StructureMembers members = pdata.makeStructureMembers();
List<StructureMembers.Member> mbers =
members.getMembers();
int i = 0;
int numBytes = 0;
int totalNumBytes = 0;
for (StructureMembers.Member member : mbers) {
member.setDataParam(4 * i++);
// depends on control dependency: [for], data = [member]
numBytes = member.getDataType().getSize();
// depends on control dependency: [for], data = [member]
totalNumBytes += numBytes;
// depends on control dependency: [for], data = [none]
}
// one member is a byte
members.setStructureSize(totalNumBytes);
float[] missing = new float[mbers.size()];
int missnum = 0;
for (Variable v : pdata.getVariables()) {
Attribute att = v.findAttribute("missing_value");
missing[missnum++] = (att == null)
? GempakConstants.RMISSD
: att.getNumericValue().floatValue();
// depends on control dependency: [for], data = [none]
}
//int num = 0;
Range stationRange = section.getRange(0);
Range timeRange = section.getRange(1);
int size = stationRange.length() * timeRange.length();
// Create a ByteBuffer using a byte array
byte[] bytes = new byte[totalNumBytes * size];
ByteBuffer buf = ByteBuffer.wrap(bytes);
array = new ArrayStructureBB(members, new int[]{size}, buf, 0);
for (int stnIdx : stationRange) {
for (int timeIdx : timeRange) {
GempakFileReader.RData vals = gemreader.DM_RDTR(timeIdx + 1, stnIdx + 1, GempakSurfaceFileReader.SFDT);
if (vals == null) {
int k = 0;
for (StructureMembers.Member member : mbers) {
if (member.getDataType().equals(DataType.FLOAT)) {
buf.putFloat(missing[k]);
// depends on control dependency: [if], data = [none]
} else {
buf.put((byte) 1);
// depends on control dependency: [if], data = [none]
}
k++;
// depends on control dependency: [for], data = [none]
}
} else {
float[] reals = vals.data;
int var = 0;
for (GempakParameter param : params) {
if (members.findMember(param.getName()) != null) {
buf.putFloat(reals[var]);
// depends on control dependency: [if], data = [none]
}
var++;
// depends on control dependency: [for], data = [none]
}
// always add the missing flag
buf.put((byte) 0);
// depends on control dependency: [if], data = [none]
}
}
}
//Trace.call2("GEMPAKSIOSP: readStandardData");
}
return array;
} } |
public class class_name {
private void saveToClipboard(@NonNull CharSequence selectedText, @Nullable Intent intent) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(selectedText);
} else {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData.Item item = new ClipData.Item(selectedText, intent, null);
android.content.ClipData clip = new ClipData(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}, item);
clipboard.setPrimaryClip(clip);
}
} } | public class class_name {
private void saveToClipboard(@NonNull CharSequence selectedText, @Nullable Intent intent) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(selectedText); // depends on control dependency: [if], data = [none]
} else {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData.Item item = new ClipData.Item(selectedText, intent, null);
android.content.ClipData clip = new ClipData(null, new String[]{ClipDescription.MIMETYPE_TEXT_PLAIN}, item);
clipboard.setPrimaryClip(clip); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String serialize(final byte[] bytes, final int offset, final int length) {
if (bytes == null) {
throw new NullPointerException("bytes");
}
final StringBuilder sb = new StringBuilder(length);
for (int i = offset; i < offset + length; i++) {
final byte b = bytes[i];
if (0x20 == b) {
sb.append((char)0x20);
} else if (0x2A == b || 0x2D == b || 0x2E == b || (0x30 <= b && b <= 0x39)
|| (0x41 <= b && b <= 0x5A) || 0x5F == b || (0x61 <= b && b <= 0x7A)) {
sb.appendCodePoint(b);
} else {
URLUtils.percentEncode(b, sb);
}
}
return sb.toString();
} } | public class class_name {
private static String serialize(final byte[] bytes, final int offset, final int length) {
if (bytes == null) {
throw new NullPointerException("bytes");
}
final StringBuilder sb = new StringBuilder(length);
for (int i = offset; i < offset + length; i++) {
final byte b = bytes[i];
if (0x20 == b) {
sb.append((char)0x20); // depends on control dependency: [if], data = [none]
} else if (0x2A == b || 0x2D == b || 0x2E == b || (0x30 <= b && b <= 0x39)
|| (0x41 <= b && b <= 0x5A) || 0x5F == b || (0x61 <= b && b <= 0x7A)) {
sb.appendCodePoint(b); // depends on control dependency: [if], data = [none]
} else {
URLUtils.percentEncode(b, sb); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public StringGrabber set(String str) {
if (str == null)
{
str = "";
}
return set(new StringBuilder(str));
} } | public class class_name {
public StringGrabber set(String str) {
if (str == null)
{
str = ""; // depends on control dependency: [if], data = [none]
}
return set(new StringBuilder(str));
} } |
public class class_name {
private SRTMProvider init() {
try {
String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
for (String str : strs) {
InputStream is = getClass().getResourceAsStream(str + "_names.txt");
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
int lat = Integer.parseInt(line.substring(1, 3));
if (line.substring(0, 1).charAt(0) == 'S')
lat = -lat;
int lon = Integer.parseInt(line.substring(4, 7));
if (line.substring(3, 4).charAt(0) == 'W')
lon = -lon;
int intKey = calcIntKey(lat, lon);
String key = areas.put(intKey, str);
if (key != null)
throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
}
}
return this;
} catch (Exception ex) {
throw new IllegalStateException("Cannot load area names from classpath", ex);
}
} } | public class class_name {
private SRTMProvider init() {
try {
String strs[] = {"Africa", "Australia", "Eurasia", "Islands", "North_America", "South_America"};
for (String str : strs) {
InputStream is = getClass().getResourceAsStream(str + "_names.txt");
for (String line : Helper.readFile(new InputStreamReader(is, Helper.UTF_CS))) {
int lat = Integer.parseInt(line.substring(1, 3));
if (line.substring(0, 1).charAt(0) == 'S')
lat = -lat;
int lon = Integer.parseInt(line.substring(4, 7));
if (line.substring(3, 4).charAt(0) == 'W')
lon = -lon;
int intKey = calcIntKey(lat, lon);
String key = areas.put(intKey, str);
if (key != null)
throw new IllegalStateException("do not overwrite existing! key " + intKey + " " + key + " vs. " + str);
}
}
return this;
} catch (Exception ex) {
throw new IllegalStateException("Cannot load area names from classpath", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public long getStoreId()
{
final long ret;
if (this.storeId == 0 && getParentType() != null) {
ret = getParentType().getStoreId();
} else {
ret = this.storeId;
}
return ret;
} } | public class class_name {
public long getStoreId()
{
final long ret;
if (this.storeId == 0 && getParentType() != null) {
ret = getParentType().getStoreId(); // depends on control dependency: [if], data = [none]
} else {
ret = this.storeId; // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
public java.util.List<Resource> getRemainingResources() {
if (remainingResources == null) {
remainingResources = new com.amazonaws.internal.SdkInternalList<Resource>();
}
return remainingResources;
} } | public class class_name {
public java.util.List<Resource> getRemainingResources() {
if (remainingResources == null) {
remainingResources = new com.amazonaws.internal.SdkInternalList<Resource>(); // depends on control dependency: [if], data = [none]
}
return remainingResources;
} } |
public class class_name {
protected boolean isMemberOnEnhancementOfEnclosingType( AbstractDynamicSymbol symbol )
{
if (!_cc().isNonStaticInnerClass()) {
return false;
}
IType enhancement = symbol.getGosuClass();
if (! ( enhancement instanceof IGosuEnhancement ) ) {
return false;
}
IType enhancedType = ((IGosuEnhancement) enhancement).getEnhancedType();
// If the symbol is on this class, or any ancestors, it's not enclosed
//noinspection SuspiciousMethodCalls
if (getGosuClass().getAllTypesInHierarchy().contains( enhancedType )) {
return false;
}
ICompilableTypeInternal enclosingClass = _cc().getEnclosingType();
while( enclosingClass != null )
{
//noinspection SuspiciousMethodCalls
if( enclosingClass.getAllTypesInHierarchy().contains( enhancedType ) )
{
return true;
}
enclosingClass = enclosingClass.getEnclosingType();
}
return false;
} } | public class class_name {
protected boolean isMemberOnEnhancementOfEnclosingType( AbstractDynamicSymbol symbol )
{
if (!_cc().isNonStaticInnerClass()) {
return false; // depends on control dependency: [if], data = [none]
}
IType enhancement = symbol.getGosuClass();
if (! ( enhancement instanceof IGosuEnhancement ) ) {
return false; // depends on control dependency: [if], data = [none]
}
IType enhancedType = ((IGosuEnhancement) enhancement).getEnhancedType();
// If the symbol is on this class, or any ancestors, it's not enclosed
//noinspection SuspiciousMethodCalls
if (getGosuClass().getAllTypesInHierarchy().contains( enhancedType )) {
return false; // depends on control dependency: [if], data = [none]
}
ICompilableTypeInternal enclosingClass = _cc().getEnclosingType();
while( enclosingClass != null )
{
//noinspection SuspiciousMethodCalls
if( enclosingClass.getAllTypesInHierarchy().contains( enhancedType ) )
{
return true; // depends on control dependency: [if], data = [none]
}
enclosingClass = enclosingClass.getEnclosingType(); // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
@Override
public FieldTextBuilder NOT() {
// NOT * => 0
// NOT 0 => *
if(isEmpty()) {
return setFieldText(MATCHNOTHING);
}
if(MATCHNOTHING.equals(this)) {
return clear();
}
not ^= true;
return this;
} } | public class class_name {
@Override
public FieldTextBuilder NOT() {
// NOT * => 0
// NOT 0 => *
if(isEmpty()) {
return setFieldText(MATCHNOTHING); // depends on control dependency: [if], data = [none]
}
if(MATCHNOTHING.equals(this)) {
return clear(); // depends on control dependency: [if], data = [none]
}
not ^= true;
return this;
} } |
public class class_name {
public void init(List<CmsAliasBean> aliases) {
for (CmsAliasBean alias : aliases) {
addAlias(alias);
}
final HorizontalPanel hp = new HorizontalPanel();
final CmsTextBox textbox = createTextBox();
textbox.setGhostMode(true);
textbox.setGhostValue(aliasMessages.enterAlias(), true);
textbox.setGhostModeClear(true);
hp.add(textbox);
final CmsSelectBox selectbox = createSelectBox();
hp.add(selectbox);
PushButton addButton = createAddButton();
hp.add(addButton);
final Runnable addAction = new Runnable() {
public void run() {
textbox.setErrorMessage(null);
validateSingle(m_structureId, getAliasPaths(), textbox.getText(), new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// shouldn't be called
}
public void onSuccess(String result) {
if (result == null) {
CmsAliasMode mode = CmsAliasMode.valueOf(selectbox.getFormValueAsString());
addAlias(new CmsAliasBean(textbox.getText(), mode));
textbox.setFormValueAsString("");
} else {
textbox.setErrorMessage(result);
}
}
});
}
};
ClickHandler clickHandler = new ClickHandler() {
public void onClick(ClickEvent e) {
addAction.run();
}
};
addButton.addClickHandler(clickHandler);
textbox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
int keycode = event.getNativeEvent().getKeyCode();
if ((keycode == 10) || (keycode == 13)) {
addAction.run();
}
}
});
m_newBox.add(hp);
} } | public class class_name {
public void init(List<CmsAliasBean> aliases) {
for (CmsAliasBean alias : aliases) {
addAlias(alias);
// depends on control dependency: [for], data = [alias]
}
final HorizontalPanel hp = new HorizontalPanel();
final CmsTextBox textbox = createTextBox();
textbox.setGhostMode(true);
textbox.setGhostValue(aliasMessages.enterAlias(), true);
textbox.setGhostModeClear(true);
hp.add(textbox);
final CmsSelectBox selectbox = createSelectBox();
hp.add(selectbox);
PushButton addButton = createAddButton();
hp.add(addButton);
final Runnable addAction = new Runnable() {
public void run() {
textbox.setErrorMessage(null);
validateSingle(m_structureId, getAliasPaths(), textbox.getText(), new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// shouldn't be called
}
public void onSuccess(String result) {
if (result == null) {
CmsAliasMode mode = CmsAliasMode.valueOf(selectbox.getFormValueAsString());
addAlias(new CmsAliasBean(textbox.getText(), mode));
// depends on control dependency: [if], data = [none]
textbox.setFormValueAsString("");
// depends on control dependency: [if], data = [none]
} else {
textbox.setErrorMessage(result);
// depends on control dependency: [if], data = [(result]
}
}
});
}
};
ClickHandler clickHandler = new ClickHandler() {
public void onClick(ClickEvent e) {
addAction.run();
}
};
addButton.addClickHandler(clickHandler);
textbox.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
int keycode = event.getNativeEvent().getKeyCode();
if ((keycode == 10) || (keycode == 13)) {
addAction.run();
// depends on control dependency: [if], data = [none]
}
}
});
m_newBox.add(hp);
} } |
public class class_name {
Message extractMessageFromColumn(Column<MessageQueueEntry> column) {
// Next, parse the message metadata and add a timeout entry
Message message = null;
try {
ByteArrayInputStream bais = new ByteArrayInputStream(column.getByteArrayValue());
message = mapper.readValue(bais, Message.class);
} catch (Exception e) {
LOG.warn("Error processing message ", e);
try {
message = invalidMessageHandler.apply(column.getStringValue());
}
catch (Exception e2) {
LOG.warn("Error processing invalid message", e2);
}
}
return message;
} } | public class class_name {
Message extractMessageFromColumn(Column<MessageQueueEntry> column) {
// Next, parse the message metadata and add a timeout entry
Message message = null;
try {
ByteArrayInputStream bais = new ByteArrayInputStream(column.getByteArrayValue());
message = mapper.readValue(bais, Message.class); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Error processing message ", e);
try {
message = invalidMessageHandler.apply(column.getStringValue()); // depends on control dependency: [try], data = [none]
}
catch (Exception e2) {
LOG.warn("Error processing invalid message", e2);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return message;
} } |
public class class_name {
public void applyStorageFilter() {
final StorageFilter filter = new StorageFilter();
if (storageFilterHolder.compareAndSet(null, filter)) {
for (Logger logger : loggersCache.values()) {
logger.setFilter(filter);
}
}
} } | public class class_name {
public void applyStorageFilter() {
final StorageFilter filter = new StorageFilter();
if (storageFilterHolder.compareAndSet(null, filter)) {
for (Logger logger : loggersCache.values()) {
logger.setFilter(filter); // depends on control dependency: [for], data = [logger]
}
}
} } |
public class class_name {
public static void permuteInv( int[] perm , double []input , double[]output , int N ) {
for (int k = 0; k < N; k++) {
output[perm[k]] = input[k];
}
} } | public class class_name {
public static void permuteInv( int[] perm , double []input , double[]output , int N ) {
for (int k = 0; k < N; k++) {
output[perm[k]] = input[k]; // depends on control dependency: [for], data = [k]
}
} } |
public class class_name {
private long getOrInsertIcon(IconRow icon) {
long iconId;
if (icon.hasId()) {
iconId = icon.getId();
} else {
IconDao iconDao = getIconDao();
iconId = iconDao.create(icon);
}
return iconId;
} } | public class class_name {
private long getOrInsertIcon(IconRow icon) {
long iconId;
if (icon.hasId()) {
iconId = icon.getId(); // depends on control dependency: [if], data = [none]
} else {
IconDao iconDao = getIconDao();
iconId = iconDao.create(icon); // depends on control dependency: [if], data = [none]
}
return iconId;
} } |
public class class_name {
public static Modifiers getClassModifiers(Class<?> type) {
try {
return (Modifiers)getVariable(type, BSHCLASSMODIFIERS.toString()).getValue();
} catch (Exception e) {
return new Modifiers(Modifiers.CLASS);
}
} } | public class class_name {
public static Modifiers getClassModifiers(Class<?> type) {
try {
return (Modifiers)getVariable(type, BSHCLASSMODIFIERS.toString()).getValue(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return new Modifiers(Modifiers.CLASS);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void findStandaloneAreas(Box boxroot, Area arearoot)
{
if (boxroot.isVisible())
{
for (int i = 0; i < boxroot.getChildCount(); i++)
{
Box child = boxroot.getChildAt(i);
if (child.isVisible())
{
if (isVisuallySeparated(child))
{
Area newnode = new AreaImpl(child);
if (newnode.getWidth() > 1 || newnode.getHeight() > 1)
{
findStandaloneAreas(child, newnode);
arearoot.appendChild(newnode);
}
}
else
findStandaloneAreas(child, arearoot);
}
}
}
} } | public class class_name {
private void findStandaloneAreas(Box boxroot, Area arearoot)
{
if (boxroot.isVisible())
{
for (int i = 0; i < boxroot.getChildCount(); i++)
{
Box child = boxroot.getChildAt(i);
if (child.isVisible())
{
if (isVisuallySeparated(child))
{
Area newnode = new AreaImpl(child);
if (newnode.getWidth() > 1 || newnode.getHeight() > 1)
{
findStandaloneAreas(child, newnode); // depends on control dependency: [if], data = [none]
arearoot.appendChild(newnode); // depends on control dependency: [if], data = [none]
}
}
else
findStandaloneAreas(child, arearoot);
}
}
}
} } |
public class class_name {
private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) {
final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label";
try {
final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class);
method.setAccessible(true);
return Optional.of(new ArrayLabelSetter() {
@Override
public void set(final Object beanObj, final String label, final int index) {
ArgUtils.notNull(beanObj, "beanObj");
ArgUtils.notEmpty(label, "label");
try {
method.invoke(beanObj, index, label);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException("fail access label field.", e);
}
}
});
} catch (NoSuchMethodException | SecurityException e) {
}
return Optional.empty();
} } | public class class_name {
private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) {
final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label";
try {
final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class);
method.setAccessible(true);
// depends on control dependency: [try], data = [none]
return Optional.of(new ArrayLabelSetter() {
@Override
public void set(final Object beanObj, final String label, final int index) {
ArgUtils.notNull(beanObj, "beanObj");
ArgUtils.notEmpty(label, "label");
try {
method.invoke(beanObj, index, label);
// depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException("fail access label field.", e);
}
// depends on control dependency: [catch], data = [none]
}
});
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException | SecurityException e) {
}
// depends on control dependency: [catch], data = [none]
return Optional.empty();
} } |
public class class_name {
private void ensureExpiration() {
boolean expirationDateSet = false;
boolean releaseDateSet = false;
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + ":")) {
expirationDateSet = true;
}
if (fq.startsWith(CmsSearchField.FIELD_DATE_RELEASED + ":")) {
releaseDateSet = true;
}
}
}
if (!expirationDateSet) {
addFilterQuery(CmsSearchField.FIELD_DATE_EXPIRED + ":[NOW TO *]");
}
if (!releaseDateSet) {
addFilterQuery(CmsSearchField.FIELD_DATE_RELEASED + ":[* TO NOW]");
}
} } | public class class_name {
private void ensureExpiration() {
boolean expirationDateSet = false;
boolean releaseDateSet = false;
if (getFilterQueries() != null) {
for (String fq : getFilterQueries()) {
if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + ":")) {
expirationDateSet = true; // depends on control dependency: [if], data = [none]
}
if (fq.startsWith(CmsSearchField.FIELD_DATE_RELEASED + ":")) {
releaseDateSet = true; // depends on control dependency: [if], data = [none]
}
}
}
if (!expirationDateSet) {
addFilterQuery(CmsSearchField.FIELD_DATE_EXPIRED + ":[NOW TO *]"); // depends on control dependency: [if], data = [none]
}
if (!releaseDateSet) {
addFilterQuery(CmsSearchField.FIELD_DATE_RELEASED + ":[* TO NOW]");
}
} } |
public class class_name {
private Map<String, JcrRepository> loadRepositories() {
Map<String, JcrRepository> list = new HashMap<>();
Set<String> names = RepositoryManager.getJcrRepositoryNames();
for (String repositoryId : names) {
try {
Repository repository = RepositoryManager.getRepository(repositoryId);
list.put(repositoryId, new JcrMsRepository(repository, pathManager, typeManager, typeHandlerManager));
log.debug("--- loaded repository " + repositoryId);
} catch (NoSuchRepositoryException e) {
// should never happen;
}
}
return list;
} } | public class class_name {
private Map<String, JcrRepository> loadRepositories() {
Map<String, JcrRepository> list = new HashMap<>();
Set<String> names = RepositoryManager.getJcrRepositoryNames();
for (String repositoryId : names) {
try {
Repository repository = RepositoryManager.getRepository(repositoryId);
list.put(repositoryId, new JcrMsRepository(repository, pathManager, typeManager, typeHandlerManager)); // depends on control dependency: [try], data = [none]
log.debug("--- loaded repository " + repositoryId); // depends on control dependency: [try], data = [none]
} catch (NoSuchRepositoryException e) {
// should never happen;
} // depends on control dependency: [catch], data = [none]
}
return list;
} } |
public class class_name {
private String resolveName(String localName, String qualifiedName) {
if ((localName == null) || (localName.length() == 0)) {
return qualifiedName;
} else {
return localName;
}
} } | public class class_name {
private String resolveName(String localName, String qualifiedName) {
if ((localName == null) || (localName.length() == 0)) {
return qualifiedName; // depends on control dependency: [if], data = [none]
} else {
return localName; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Class<?> getProviderInterfaceFor(Class<?> businessInterface) {
if (LOG.isTraceEnabled()) {
LOG.trace(format("Looking for provider interface for business interface %s", businessInterface));
}
assert businessInterface != null : "businessInterface must not be null";
ProvidedBy providedBy = getProvidedByAnnotation(businessInterface);
if (providedBy == null) {
throw new IllegalArgumentException(format("Unable to find suitable joynr provider for interface %s",
businessInterface));
} else {
Class<?> result = providedBy.value();
if (LOG.isTraceEnabled()) {
LOG.trace(format("Returning: %s", result));
}
return result;
}
} } | public class class_name {
public Class<?> getProviderInterfaceFor(Class<?> businessInterface) {
if (LOG.isTraceEnabled()) {
LOG.trace(format("Looking for provider interface for business interface %s", businessInterface));
}
assert businessInterface != null : "businessInterface must not be null";
ProvidedBy providedBy = getProvidedByAnnotation(businessInterface);
if (providedBy == null) {
throw new IllegalArgumentException(format("Unable to find suitable joynr provider for interface %s",
businessInterface));
} else {
Class<?> result = providedBy.value();
if (LOG.isTraceEnabled()) {
LOG.trace(format("Returning: %s", result)); // depends on control dependency: [if], data = [none]
}
return result;
}
} } |
public class class_name {
public void setAnnotation(String str) {
if (str != null) {
annotation = str;
isAnnotationHere = true;
} else {
annotation = null;
isAnnotationHere = false;
}
} } | public class class_name {
public void setAnnotation(String str) {
if (str != null) {
annotation = str;
// depends on control dependency: [if], data = [none]
isAnnotationHere = true;
// depends on control dependency: [if], data = [none]
} else {
annotation = null;
// depends on control dependency: [if], data = [none]
isAnnotationHere = false;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Field getField(Class<?> beanClass, String name) throws SecurityException {
final Field[] fields = getFields(beanClass);
if (ArrayUtil.isNotEmpty(fields)) {
for (Field field : fields) {
if ((name.equals(field.getName()))) {
return field;
}
}
}
return null;
} } | public class class_name {
public static Field getField(Class<?> beanClass, String name) throws SecurityException {
final Field[] fields = getFields(beanClass);
if (ArrayUtil.isNotEmpty(fields)) {
for (Field field : fields) {
if ((name.equals(field.getName()))) {
return field;
// depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public void copyFileEntry(File destDir, ZipFile zf, ZipEntry ze) throws IOException {
BufferedInputStream dis = new BufferedInputStream(zf.getInputStream(ze));
try {
copyFileEntry(destDir, ze.isDirectory(), ze.getName(), dis);
} finally {
try {
dis.close();
} catch (IOException ioe) {
}
}
} } | public class class_name {
public void copyFileEntry(File destDir, ZipFile zf, ZipEntry ze) throws IOException {
BufferedInputStream dis = new BufferedInputStream(zf.getInputStream(ze));
try {
copyFileEntry(destDir, ze.isDirectory(), ze.getName(), dis);
} finally {
try {
dis.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void browserSwitch(int requestCode, Intent intent) {
if (requestCode == Integer.MIN_VALUE) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage("Request code cannot be Integer.MIN_VALUE");
onBrowserSwitchResult(requestCode, result, null);
return;
}
if (!isReturnUrlSetup()) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage("The return url scheme was not set up, incorrectly set up, " +
"or more than one Activity on this device defines the same url " +
"scheme in it's Android Manifest. See " +
"https://github.com/braintree/browser-switch-android for more " +
"information on setting up a return url scheme.");
onBrowserSwitchResult(requestCode, result, null);
return;
} else if (availableActivities(intent).size() == 0) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage(String.format("No installed activities can open this URL: %s", intent.getData().toString()));
onBrowserSwitchResult(requestCode, result, null);
return;
}
mRequestCode = requestCode;
mContext.startActivity(intent);
} } | public class class_name {
public void browserSwitch(int requestCode, Intent intent) {
if (requestCode == Integer.MIN_VALUE) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage("Request code cannot be Integer.MIN_VALUE");
onBrowserSwitchResult(requestCode, result, null); // depends on control dependency: [if], data = [(requestCode]
return; // depends on control dependency: [if], data = [none]
}
if (!isReturnUrlSetup()) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage("The return url scheme was not set up, incorrectly set up, " +
"or more than one Activity on this device defines the same url " +
"scheme in it's Android Manifest. See " +
"https://github.com/braintree/browser-switch-android for more " +
"information on setting up a return url scheme.");
onBrowserSwitchResult(requestCode, result, null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (availableActivities(intent).size() == 0) {
BrowserSwitchResult result = BrowserSwitchResult.ERROR
.setErrorMessage(String.format("No installed activities can open this URL: %s", intent.getData().toString()));
onBrowserSwitchResult(requestCode, result, null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
mRequestCode = requestCode;
mContext.startActivity(intent);
} } |
public class class_name {
public String getJobParameter(String key, String defaultValue) {
final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters();
if (conf != null && conf.toMap().containsKey(key)) {
return conf.toMap().get(key);
} else {
return defaultValue;
}
} } | public class class_name {
public String getJobParameter(String key, String defaultValue) {
final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters();
if (conf != null && conf.toMap().containsKey(key)) {
return conf.toMap().get(key); // depends on control dependency: [if], data = [none]
} else {
return defaultValue; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(TranscriptionJob transcriptionJob, ProtocolMarshaller protocolMarshaller) {
if (transcriptionJob == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transcriptionJob.getTranscriptionJobName(), TRANSCRIPTIONJOBNAME_BINDING);
protocolMarshaller.marshall(transcriptionJob.getTranscriptionJobStatus(), TRANSCRIPTIONJOBSTATUS_BINDING);
protocolMarshaller.marshall(transcriptionJob.getLanguageCode(), LANGUAGECODE_BINDING);
protocolMarshaller.marshall(transcriptionJob.getMediaSampleRateHertz(), MEDIASAMPLERATEHERTZ_BINDING);
protocolMarshaller.marshall(transcriptionJob.getMediaFormat(), MEDIAFORMAT_BINDING);
protocolMarshaller.marshall(transcriptionJob.getMedia(), MEDIA_BINDING);
protocolMarshaller.marshall(transcriptionJob.getTranscript(), TRANSCRIPT_BINDING);
protocolMarshaller.marshall(transcriptionJob.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(transcriptionJob.getCompletionTime(), COMPLETIONTIME_BINDING);
protocolMarshaller.marshall(transcriptionJob.getFailureReason(), FAILUREREASON_BINDING);
protocolMarshaller.marshall(transcriptionJob.getSettings(), SETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TranscriptionJob transcriptionJob, ProtocolMarshaller protocolMarshaller) {
if (transcriptionJob == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transcriptionJob.getTranscriptionJobName(), TRANSCRIPTIONJOBNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getTranscriptionJobStatus(), TRANSCRIPTIONJOBSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getMediaSampleRateHertz(), MEDIASAMPLERATEHERTZ_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getMediaFormat(), MEDIAFORMAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getMedia(), MEDIA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getTranscript(), TRANSCRIPT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getCompletionTime(), COMPLETIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getFailureReason(), FAILUREREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transcriptionJob.getSettings(), SETTINGS_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 ExecutionStatistics getOrCreateModuleStatistics(ModuleId moduleId) {
ExecutionStatistics moduleStats = statistics.get(moduleId);
if (moduleStats == null) {
moduleStats = new ExecutionStatistics();
ExecutionStatistics existing = statistics.put(moduleId, moduleStats);
if (existing != null) {
moduleStats = existing;
}
}
return moduleStats;
} } | public class class_name {
protected ExecutionStatistics getOrCreateModuleStatistics(ModuleId moduleId) {
ExecutionStatistics moduleStats = statistics.get(moduleId);
if (moduleStats == null) {
moduleStats = new ExecutionStatistics(); // depends on control dependency: [if], data = [none]
ExecutionStatistics existing = statistics.put(moduleId, moduleStats);
if (existing != null) {
moduleStats = existing; // depends on control dependency: [if], data = [none]
}
}
return moduleStats;
} } |
public class class_name {
public AbsoluteOrderingType<WebAppType<T>> getOrCreateAbsoluteOrdering()
{
List<Node> nodeList = childNode.get("absolute-ordering");
if (nodeList != null && nodeList.size() > 0)
{
return new AbsoluteOrderingTypeImpl<WebAppType<T>>(this, "absolute-ordering", childNode, nodeList.get(0));
}
return createAbsoluteOrdering();
} } | public class class_name {
public AbsoluteOrderingType<WebAppType<T>> getOrCreateAbsoluteOrdering()
{
List<Node> nodeList = childNode.get("absolute-ordering");
if (nodeList != null && nodeList.size() > 0)
{
return new AbsoluteOrderingTypeImpl<WebAppType<T>>(this, "absolute-ordering", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createAbsoluteOrdering();
} } |
public class class_name {
public List<INDArray> feedForward(boolean train) {
try {
return ffToLayerActivationsDetached(train, FwdPassType.STANDARD, false, layers.length-1,
input, mask, null, true);
} catch (OutOfMemoryError e) {
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} } | public class class_name {
public List<INDArray> feedForward(boolean train) {
try {
return ffToLayerActivationsDetached(train, FwdPassType.STANDARD, false, layers.length-1,
input, mask, null, true); // depends on control dependency: [try], data = [none]
} catch (OutOfMemoryError e) {
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public DateTimeField[] getFields() {
DateTimeField[] result = new DateTimeField[size()];
for (int i = 0; i < result.length; i++) {
result[i] = getField(i);
}
return result;
} } | public class class_name {
public DateTimeField[] getFields() {
DateTimeField[] result = new DateTimeField[size()];
for (int i = 0; i < result.length; i++) {
result[i] = getField(i); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public <U> U run(@javax.annotation.Nonnull final Function<T, U> f, final Predicate<T> filter) {
if (all.isEmpty()) throw new IllegalStateException();
T poll = get(filter);
try {
return f.apply(poll);
} finally {
this.pool.add(poll);
}
} } | public class class_name {
public <U> U run(@javax.annotation.Nonnull final Function<T, U> f, final Predicate<T> filter) {
if (all.isEmpty()) throw new IllegalStateException();
T poll = get(filter);
try {
return f.apply(poll); // depends on control dependency: [try], data = [none]
} finally {
this.pool.add(poll);
}
} } |
public class class_name {
private String formatMessage(final String message) {
String result;
if (message != null) {
result = wrapMessage(message);
int longestLine = getLongestLineLen(result);
if (!isThought) {
result = Bubble.formatSpeech(result, longestLine);
} else {
result = Bubble.formatThought(result, longestLine);
}
return result;
}
return "";
} } | public class class_name {
private String formatMessage(final String message) {
String result;
if (message != null) {
result = wrapMessage(message); // depends on control dependency: [if], data = [(message]
int longestLine = getLongestLineLen(result);
if (!isThought) {
result = Bubble.formatSpeech(result, longestLine); // depends on control dependency: [if], data = [none]
} else {
result = Bubble.formatThought(result, longestLine); // depends on control dependency: [if], data = [none]
}
return result; // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
public void addFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
filterLock.writeLock().lock();
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
for (String virtualHost : resolveVirtualHosts(model)) {
for (String urlPattern : model.getUrlPatterns()) {
final UrlPattern newUrlPattern = new UrlPattern(getFullPath(model.getContextModel(), urlPattern),
model);
String fullPath = getFullPath(model.getContextModel(), urlPattern);
if (filterUrlPatterns.get(virtualHost) == null) {
filterUrlPatterns.put(virtualHost, new ConcurrentHashMap<>());
}
Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
if (urlSet == null) {
//initialize first
urlSet = new HashSet<>();
}
urlSet.add(newUrlPattern);
filterUrlPatterns.get(virtualHost).put(fullPath, urlSet);
// final UrlPattern existingPattern = filterUrlPatterns.putIfAbsent(
// getFullPath(model.getContextModel(), urlPattern), newUrlPattern);
// if (existingPattern != null) {
// // this should never happen but is a good assertion
// LOG.error("Internal error (please report): Cannot associate url mapping "
// + getFullPath(model.getContextModel(), urlPattern) + " to " + newUrlPattern
// + " because is already associated to " + existingPattern);
// }
}
}
} finally {
filterLock.writeLock().unlock();
}
}
} } | public class class_name {
public void addFilterModel(final FilterModel model) {
if (model.getUrlPatterns() != null) {
try {
filterLock.writeLock().lock();
// depends on control dependency: [try], data = [none]
associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
// depends on control dependency: [try], data = [none]
for (String virtualHost : resolveVirtualHosts(model)) {
for (String urlPattern : model.getUrlPatterns()) {
final UrlPattern newUrlPattern = new UrlPattern(getFullPath(model.getContextModel(), urlPattern),
model);
String fullPath = getFullPath(model.getContextModel(), urlPattern);
if (filterUrlPatterns.get(virtualHost) == null) {
filterUrlPatterns.put(virtualHost, new ConcurrentHashMap<>());
// depends on control dependency: [if], data = [none]
}
Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
if (urlSet == null) {
//initialize first
urlSet = new HashSet<>();
// depends on control dependency: [if], data = [none]
}
urlSet.add(newUrlPattern);
// depends on control dependency: [for], data = [none]
filterUrlPatterns.get(virtualHost).put(fullPath, urlSet);
// depends on control dependency: [for], data = [none]
// final UrlPattern existingPattern = filterUrlPatterns.putIfAbsent(
// getFullPath(model.getContextModel(), urlPattern), newUrlPattern);
// if (existingPattern != null) {
// // this should never happen but is a good assertion
// LOG.error("Internal error (please report): Cannot associate url mapping "
// + getFullPath(model.getContextModel(), urlPattern) + " to " + newUrlPattern
// + " because is already associated to " + existingPattern);
// }
}
}
} finally {
filterLock.writeLock().unlock();
}
}
} } |
public class class_name {
@Override
public Map<String, Object> getContextData()
{
// Calling getContextData is not allowed from setSessionContext.
if (state == PRE_CREATE || state == DESTROYED)
{
IllegalStateException ise;
ise = new IllegalStateException("SessionBean: getContextData " +
"not allowed from state = " +
getStateName(state));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: " + ise);
throw ise;
}
return super.getContextData();
} } | public class class_name {
@Override
public Map<String, Object> getContextData()
{
// Calling getContextData is not allowed from setSessionContext.
if (state == PRE_CREATE || state == DESTROYED)
{
IllegalStateException ise;
ise = new IllegalStateException("SessionBean: getContextData " +
"not allowed from state = " +
getStateName(state)); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getContextData: " + ise);
throw ise;
}
return super.getContextData();
} } |
public class class_name {
public void detachCommandExecutor() {
if (this.commandExecutor instanceof GuardedActionCommandExecutor) {
unsubscribeFromGuardedCommandDelegate();
}
this.commandExecutor = null;
setEnabled(false);
logger.debug("Command delegate detached.");
} } | public class class_name {
public void detachCommandExecutor() {
if (this.commandExecutor instanceof GuardedActionCommandExecutor) {
unsubscribeFromGuardedCommandDelegate(); // depends on control dependency: [if], data = [none]
}
this.commandExecutor = null;
setEnabled(false);
logger.debug("Command delegate detached.");
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) {
SeaGlassPainter painter = null;
if (context != null) {
painter = (SeaGlassPainter) context.getStyle().get(context, key);
}
if (painter == null) {
painter = (SeaGlassPainter) UIManager.get(prefix + "[Enabled]." + key);
}
if (painter == null) {
painter = (SeaGlassPainter) UIManager.get(prefix + "." + key);
}
if (painter != null && context != null) {
JComponent c = context.getComponent();
boolean rotate = false;
boolean flip = false;
// translatex and translatey are additional translations that
// must occur on the graphics context when rendering a toolbar
// icon
int translatex = 0;
int translatey = 0;
if (c instanceof JToolBar) {
JToolBar toolbar = (JToolBar) c;
rotate = toolbar.getOrientation() == JToolBar.VERTICAL;
flip = !toolbar.getComponentOrientation().isLeftToRight();
Object o = SeaGlassLookAndFeel.resolveToolbarConstraint(toolbar);
// we only do the +1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (toolbar.getBorder() instanceof UIResource) {
if (o == BorderLayout.SOUTH) {
translatey = 1;
} else if (o == BorderLayout.EAST) {
translatex = 1;
}
}
}
if (g instanceof Graphics2D) {
Graphics2D gfx = (Graphics2D) g;
gfx.translate(x, y);
gfx.translate(translatex, translatey);
if (rotate) {
gfx.rotate(Math.toRadians(90));
gfx.translate(0, -w);
painter.paint(gfx, context.getComponent(), h, w);
gfx.translate(0, w);
gfx.rotate(Math.toRadians(-90));
} else if (flip) {
gfx.scale(-1, 1);
gfx.translate(-w, 0);
painter.paint(gfx, context.getComponent(), w, h);
gfx.translate(w, 0);
gfx.scale(-1, 1);
} else {
painter.paint(gfx, context.getComponent(), w, h);
}
gfx.translate(-translatex, -translatey);
gfx.translate(-x, -y);
} else {
// use image if we are printing to a Java 1.1 PrintGraphics as
// it is not a instance of Graphics2D
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D gfx = img.createGraphics();
if (rotate) {
gfx.rotate(Math.toRadians(90));
gfx.translate(0, -w);
painter.paint(gfx, context.getComponent(), h, w);
} else if (flip) {
gfx.scale(-1, 1);
gfx.translate(-w, 0);
painter.paint(gfx, context.getComponent(), w, h);
} else {
painter.paint(gfx, context.getComponent(), w, h);
}
gfx.dispose();
g.drawImage(img, x, y, null);
img = null;
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) {
SeaGlassPainter painter = null;
if (context != null) {
painter = (SeaGlassPainter) context.getStyle().get(context, key); // depends on control dependency: [if], data = [(context]
}
if (painter == null) {
painter = (SeaGlassPainter) UIManager.get(prefix + "[Enabled]." + key); // depends on control dependency: [if], data = [none]
}
if (painter == null) {
painter = (SeaGlassPainter) UIManager.get(prefix + "." + key); // depends on control dependency: [if], data = [none]
}
if (painter != null && context != null) {
JComponent c = context.getComponent();
boolean rotate = false;
boolean flip = false;
// translatex and translatey are additional translations that
// must occur on the graphics context when rendering a toolbar
// icon
int translatex = 0;
int translatey = 0;
if (c instanceof JToolBar) {
JToolBar toolbar = (JToolBar) c;
rotate = toolbar.getOrientation() == JToolBar.VERTICAL; // depends on control dependency: [if], data = [none]
flip = !toolbar.getComponentOrientation().isLeftToRight(); // depends on control dependency: [if], data = [none]
Object o = SeaGlassLookAndFeel.resolveToolbarConstraint(toolbar);
// we only do the +1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (toolbar.getBorder() instanceof UIResource) {
if (o == BorderLayout.SOUTH) {
translatey = 1; // depends on control dependency: [if], data = [none]
} else if (o == BorderLayout.EAST) {
translatex = 1; // depends on control dependency: [if], data = [none]
}
}
}
if (g instanceof Graphics2D) {
Graphics2D gfx = (Graphics2D) g;
gfx.translate(x, y); // depends on control dependency: [if], data = [none]
gfx.translate(translatex, translatey); // depends on control dependency: [if], data = [none]
if (rotate) {
gfx.rotate(Math.toRadians(90)); // depends on control dependency: [if], data = [none]
gfx.translate(0, -w); // depends on control dependency: [if], data = [none]
painter.paint(gfx, context.getComponent(), h, w); // depends on control dependency: [if], data = [none]
gfx.translate(0, w); // depends on control dependency: [if], data = [none]
gfx.rotate(Math.toRadians(-90)); // depends on control dependency: [if], data = [none]
} else if (flip) {
gfx.scale(-1, 1); // depends on control dependency: [if], data = [none]
gfx.translate(-w, 0); // depends on control dependency: [if], data = [none]
painter.paint(gfx, context.getComponent(), w, h); // depends on control dependency: [if], data = [none]
gfx.translate(w, 0); // depends on control dependency: [if], data = [none]
gfx.scale(-1, 1); // depends on control dependency: [if], data = [none]
} else {
painter.paint(gfx, context.getComponent(), w, h); // depends on control dependency: [if], data = [none]
}
gfx.translate(-translatex, -translatey); // depends on control dependency: [if], data = [none]
gfx.translate(-x, -y); // depends on control dependency: [if], data = [none]
} else {
// use image if we are printing to a Java 1.1 PrintGraphics as
// it is not a instance of Graphics2D
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D gfx = img.createGraphics();
if (rotate) {
gfx.rotate(Math.toRadians(90)); // depends on control dependency: [if], data = [none]
gfx.translate(0, -w); // depends on control dependency: [if], data = [none]
painter.paint(gfx, context.getComponent(), h, w); // depends on control dependency: [if], data = [none]
} else if (flip) {
gfx.scale(-1, 1); // depends on control dependency: [if], data = [none]
gfx.translate(-w, 0); // depends on control dependency: [if], data = [none]
painter.paint(gfx, context.getComponent(), w, h); // depends on control dependency: [if], data = [none]
} else {
painter.paint(gfx, context.getComponent(), w, h); // depends on control dependency: [if], data = [none]
}
gfx.dispose(); // depends on control dependency: [if], data = [none]
g.drawImage(img, x, y, null); // depends on control dependency: [if], data = [none]
img = null; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public <E> EntityScannerBuilder<E> getScannerBuilder(
EntityMapper<E> entityMapper) {
EntityScannerBuilder<E> builder = new BaseEntityScanner.Builder<E>(pool,
tableName, entityMapper);
for (ScanModifier scanModifier : scanModifiers) {
builder.addScanModifier(scanModifier);
}
return builder;
} } | public class class_name {
public <E> EntityScannerBuilder<E> getScannerBuilder(
EntityMapper<E> entityMapper) {
EntityScannerBuilder<E> builder = new BaseEntityScanner.Builder<E>(pool,
tableName, entityMapper);
for (ScanModifier scanModifier : scanModifiers) {
builder.addScanModifier(scanModifier); // depends on control dependency: [for], data = [scanModifier]
}
return builder;
} } |
public class class_name {
public boolean recordExtendedInterface(JSTypeExpression interfaceType) {
if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) {
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordExtendedInterface(JSTypeExpression interfaceType) {
if (interfaceType != null && currentInfo.addExtendedInterface(interfaceType)) {
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int runAndHandleErrors(String... args) {
String[] argsWithoutDebugFlags = removeDebugFlags(args);
boolean debug = argsWithoutDebugFlags.length != args.length;
if (debug) {
System.setProperty("debug", "true");
}
try {
ExitStatus result = run(argsWithoutDebugFlags);
// The caller will hang up if it gets a non-zero status
if (result != null && result.isHangup()) {
return (result.getCode() > 0) ? result.getCode() : 0;
}
return 0;
}
catch (NoArgumentsException ex) {
showUsage();
return 1;
}
catch (Exception ex) {
return handleError(debug, ex);
}
} } | public class class_name {
public int runAndHandleErrors(String... args) {
String[] argsWithoutDebugFlags = removeDebugFlags(args);
boolean debug = argsWithoutDebugFlags.length != args.length;
if (debug) {
System.setProperty("debug", "true"); // depends on control dependency: [if], data = [none]
}
try {
ExitStatus result = run(argsWithoutDebugFlags);
// The caller will hang up if it gets a non-zero status
if (result != null && result.isHangup()) {
return (result.getCode() > 0) ? result.getCode() : 0; // depends on control dependency: [if], data = [(result]
}
return 0; // depends on control dependency: [try], data = [none]
}
catch (NoArgumentsException ex) {
showUsage();
return 1;
} // depends on control dependency: [catch], data = [none]
catch (Exception ex) {
return handleError(debug, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public AVT getLiteralResultAttribute(String name)
{
if (null != m_avts)
{
int nAttrs = m_avts.size();
String namespace = null;
for (int i = (nAttrs - 1); i >= 0; i--)
{
AVT avt = (AVT) m_avts.get(i);
namespace = avt.getURI();
if ((namespace != null && (!namespace.equals("")) && (namespace
+":"+avt.getName()).equals(name))|| ((namespace == null ||
namespace.equals(""))&& avt.getRawName().equals(name)))
{
return avt;
}
} // end for
}
return null;
} } | public class class_name {
public AVT getLiteralResultAttribute(String name)
{
if (null != m_avts)
{
int nAttrs = m_avts.size();
String namespace = null;
for (int i = (nAttrs - 1); i >= 0; i--)
{
AVT avt = (AVT) m_avts.get(i);
namespace = avt.getURI(); // depends on control dependency: [for], data = [none]
if ((namespace != null && (!namespace.equals("")) && (namespace
+":"+avt.getName()).equals(name))|| ((namespace == null ||
namespace.equals(""))&& avt.getRawName().equals(name)))
{
return avt; // depends on control dependency: [if], data = [none]
}
} // end for
}
return null;
} } |
public class class_name {
public static int encode(BigInteger value, byte[] dst, int dstOffset) {
if (value == null) {
dst[dstOffset] = NULL_BYTE_HIGH;
return 1;
}
byte[] bytes = value.toByteArray();
// Write the byte array length first, in a variable amount of bytes.
int amt = encodeUnsignedVarInt(bytes.length, dst, dstOffset);
// Now write the byte array.
System.arraycopy(bytes, 0, dst, dstOffset + amt, bytes.length);
return amt + bytes.length;
} } | public class class_name {
public static int encode(BigInteger value, byte[] dst, int dstOffset) {
if (value == null) {
dst[dstOffset] = NULL_BYTE_HIGH;
// depends on control dependency: [if], data = [none]
return 1;
// depends on control dependency: [if], data = [none]
}
byte[] bytes = value.toByteArray();
// Write the byte array length first, in a variable amount of bytes.
int amt = encodeUnsignedVarInt(bytes.length, dst, dstOffset);
// Now write the byte array.
System.arraycopy(bytes, 0, dst, dstOffset + amt, bytes.length);
return amt + bytes.length;
} } |
public class class_name {
public static String getSpeechRecognitionFirstResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 0 && resultCode == -1) {
List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (results != null && results.size() > 0) {
return results.get(0);
}
}
return null;
} } | public class class_name {
public static String getSpeechRecognitionFirstResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 0 && resultCode == -1) {
List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (results != null && results.size() > 0) {
return results.get(0);
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@SuppressWarnings("UnusedReturnValue")
public StatList add(int integer) {
if (end + 1 >= values.length) {
values = Lng.grow(values);
}
values[end] = integer;
end++;
return this;
} } | public class class_name {
@SuppressWarnings("UnusedReturnValue")
public StatList add(int integer) {
if (end + 1 >= values.length) {
values = Lng.grow(values); // depends on control dependency: [if], data = [none]
}
values[end] = integer;
end++;
return this;
} } |
public class class_name {
@SuppressWarnings("StringSplitter")
public static @NonNull CaffeineSpec parse(@NonNull String specification) {
CaffeineSpec spec = new CaffeineSpec(specification);
for (String option : specification.split(SPLIT_OPTIONS)) {
spec.parseOption(option.trim());
}
return spec;
} } | public class class_name {
@SuppressWarnings("StringSplitter")
public static @NonNull CaffeineSpec parse(@NonNull String specification) {
CaffeineSpec spec = new CaffeineSpec(specification);
for (String option : specification.split(SPLIT_OPTIONS)) {
spec.parseOption(option.trim()); // depends on control dependency: [for], data = [option]
}
return spec;
} } |
public class class_name {
public int[] getSentenceIds(IntObjectBimap<String> lexAlphabet) {
ArrayList<NaryTree> leaves = getLexicalLeaves();
int[] sent = new int[leaves.size()];
for (int i=0; i<sent.length; i++) {
sent[i] = lexAlphabet.lookupIndex(leaves.get(i).symbol);
}
return sent;
} } | public class class_name {
public int[] getSentenceIds(IntObjectBimap<String> lexAlphabet) {
ArrayList<NaryTree> leaves = getLexicalLeaves();
int[] sent = new int[leaves.size()];
for (int i=0; i<sent.length; i++) {
sent[i] = lexAlphabet.lookupIndex(leaves.get(i).symbol); // depends on control dependency: [for], data = [i]
}
return sent;
} } |
public class class_name {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
SiteNode node = null;
Target target = null;
if (value instanceof SiteNode) {
node = (SiteNode) value;
if (node.getUserObject() instanceof Target) {
target = (Target) node.getUserObject();
}
}
if (node != null) {
if (node.isRoot()) {
setIcon(DisplayUtils.getScaledIcon(ROOT_ICON));
} else if (target != null) {
if (target.getContext() != null) {
if (target.getContext().isInScope()) {
setIcon(DisplayUtils.getScaledIcon(CONTEXT_IN_SCOPE_ICON));
} else {
setIcon(DisplayUtils.getScaledIcon(CONTEXT_ICON));
}
} else if (target.isInScopeOnly()) {
setIcon(DisplayUtils.getScaledIcon(ALL_IN_SCOPE_ICON));
}
}
}
return this;
} } | public class class_name {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
SiteNode node = null;
Target target = null;
if (value instanceof SiteNode) {
node = (SiteNode) value; // depends on control dependency: [if], data = [none]
if (node.getUserObject() instanceof Target) {
target = (Target) node.getUserObject(); // depends on control dependency: [if], data = [none]
}
}
if (node != null) {
if (node.isRoot()) {
setIcon(DisplayUtils.getScaledIcon(ROOT_ICON)); // depends on control dependency: [if], data = [none]
} else if (target != null) {
if (target.getContext() != null) {
if (target.getContext().isInScope()) {
setIcon(DisplayUtils.getScaledIcon(CONTEXT_IN_SCOPE_ICON)); // depends on control dependency: [if], data = [none]
} else {
setIcon(DisplayUtils.getScaledIcon(CONTEXT_ICON)); // depends on control dependency: [if], data = [none]
}
} else if (target.isInScopeOnly()) {
setIcon(DisplayUtils.getScaledIcon(ALL_IN_SCOPE_ICON)); // depends on control dependency: [if], data = [none]
}
}
}
return this;
} } |
public class class_name {
private void startNewTask(TaskInProgress tip) {
try {
boolean launched = localizeAndLaunchTask(tip);
if (!launched) {
// Free the slot.
tip.kill(true);
tip.cleanup(true);
}
} catch (Throwable e) {
String msg = ("Error initializing " + tip.getTask().getTaskID() +
":\n" + StringUtils.stringifyException(e));
LOG.error(msg, e);
tip.reportDiagnosticInfo(msg);
try {
tip.kill(true);
tip.cleanup(true);
} catch (IOException ie2) {
LOG.info("Error cleaning up " + tip.getTask().getTaskID() + ":\n" +
StringUtils.stringifyException(ie2));
}
// Careful!
// This might not be an 'Exception' - don't handle 'Error' here!
if (e instanceof Error) {
throw ((Error) e);
}
}
} } | public class class_name {
private void startNewTask(TaskInProgress tip) {
try {
boolean launched = localizeAndLaunchTask(tip);
if (!launched) {
// Free the slot.
tip.kill(true); // depends on control dependency: [if], data = [none]
tip.cleanup(true); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
String msg = ("Error initializing " + tip.getTask().getTaskID() +
":\n" + StringUtils.stringifyException(e));
LOG.error(msg, e);
tip.reportDiagnosticInfo(msg);
try {
tip.kill(true); // depends on control dependency: [try], data = [none]
tip.cleanup(true); // depends on control dependency: [try], data = [none]
} catch (IOException ie2) {
LOG.info("Error cleaning up " + tip.getTask().getTaskID() + ":\n" +
StringUtils.stringifyException(ie2));
} // depends on control dependency: [catch], data = [none]
// Careful!
// This might not be an 'Exception' - don't handle 'Error' here!
if (e instanceof Error) {
throw ((Error) e);
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "npathcomplexity"})
public static void splitOptionsAndParameters(String... optionDefinitions) {
if (analyzed) {
return;
}
final List<String> params = new ArrayList<>();
final SortedMap<String, List<Object>> options = new TreeMap<>();
String opt;
// Analyze definitions
final Map<String, OptionType> defs = new TreeMap<>();
for (final String def : optionDefinitions) {
if (def.endsWith("!")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 1);
defs.put(opt, OptionType.FLAG);
registerOptionValue(options, opt, Boolean.FALSE, OptionType.FLAG);
} else if (def.endsWith("+")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 1);
defs.put(opt, OptionType.AUTO_INCREMENTED);
registerOptionValue(options, opt, Long.valueOf(0), OptionType.AUTO_INCREMENTED);
} else if (def.endsWith("=b")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.MANDATORY_BOOLEAN);
} else if (def.endsWith(":b")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.OPTIONAL_BOOLEAN);
} else if (def.endsWith("=f")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.MANDATORY_FLOAT);
} else if (def.endsWith(":f")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.OPTIONAL_FLOAT);
} else if (def.endsWith("=i")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.MANDATORY_INTEGER);
} else if (def.endsWith(":i")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.OPTIONAL_INTEGER);
} else if (def.endsWith("=s")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.MANDATORY_STRING);
} else if (def.endsWith(":s")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2);
defs.put(opt, OptionType.OPTIONAL_STRING);
} else {
defs.put(def, OptionType.SIMPLE);
}
}
int idx;
String base;
String nbase;
String val;
OptionType type;
OptionType waitingValue = null;
String valueOptionName = null;
boolean allParameters = false;
boolean success;
for (final String param : commandLineParameters) {
if (allParameters) {
params.add(param);
continue;
}
if (waitingValue != null && waitingValue.isMandatory()) {
// Expect a value as the next parameter
success = registerOptionValue(options, valueOptionName, param, waitingValue);
waitingValue = null;
valueOptionName = null;
if (success) {
continue;
}
}
if ("--".equals(param)) { //$NON-NLS-1$
if (waitingValue != null) {
registerOptionValue(options, valueOptionName, null, waitingValue);
waitingValue = null;
valueOptionName = null;
}
allParameters = true;
continue;
} else if ((File.separatorChar != '/') && (param.startsWith("/"))) { //$NON-NLS-1$
opt = param.substring(1);
} else if (param.startsWith("--")) { //$NON-NLS-1$
opt = param.substring(2);
} else if (param.startsWith("-")) { //$NON-NLS-1$
opt = param.substring(1);
} else if (waitingValue != null) {
success = registerOptionValue(options, valueOptionName, param, waitingValue);
waitingValue = null;
valueOptionName = null;
if (!success) {
params.add(param);
}
continue;
} else {
params.add(param);
continue;
}
if (waitingValue != null) {
success = registerOptionValue(options, valueOptionName, param, waitingValue);
waitingValue = null;
valueOptionName = null;
if (success) {
continue;
}
}
idx = opt.indexOf('=');
if (idx > 0) {
base = opt.substring(0, idx);
val = opt.substring(idx + 1);
} else {
base = opt;
val = null;
}
nbase = null;
type = defs.get(base);
if (type == null && base.toLowerCase().startsWith("no")) { //$NON-NLS-1$
nbase = base.substring(2);
type = defs.get(nbase);
}
if (type != null) {
switch (type) {
case FLAG:
if (nbase == null) {
registerOptionValue(options, base, Boolean.TRUE, type);
} else {
registerOptionValue(options, nbase, Boolean.FALSE, type);
}
break;
case MANDATORY_FLOAT:
case MANDATORY_BOOLEAN:
case MANDATORY_INTEGER:
case MANDATORY_STRING:
case OPTIONAL_FLOAT:
case OPTIONAL_BOOLEAN:
case OPTIONAL_INTEGER:
case OPTIONAL_STRING:
if (val != null) {
registerOptionValue(options, base, val, type);
} else {
waitingValue = type;
valueOptionName = base;
}
break;
//$CASES-OMITTED$
default:
registerOptionValue(options, base, val, type);
}
} else {
// Not a recognized option, assuming simple
registerOptionValue(options, base, val, OptionType.SIMPLE);
}
}
if (waitingValue != null && waitingValue.isMandatory()) {
throw new IllegalStateException(Locale.getString("E2", valueOptionName)); //$NON-NLS-1$
}
commandLineParameters = new String[params.size()];
params.toArray(commandLineParameters);
params.clear();
commandLineOptions = options;
analyzed = true;
} } | public class class_name {
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "npathcomplexity"})
public static void splitOptionsAndParameters(String... optionDefinitions) {
if (analyzed) {
return; // depends on control dependency: [if], data = [none]
}
final List<String> params = new ArrayList<>();
final SortedMap<String, List<Object>> options = new TreeMap<>();
String opt;
// Analyze definitions
final Map<String, OptionType> defs = new TreeMap<>();
for (final String def : optionDefinitions) {
if (def.endsWith("!")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 1); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.FLAG); // depends on control dependency: [if], data = [none]
registerOptionValue(options, opt, Boolean.FALSE, OptionType.FLAG); // depends on control dependency: [if], data = [none]
} else if (def.endsWith("+")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 1); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.AUTO_INCREMENTED); // depends on control dependency: [if], data = [none]
registerOptionValue(options, opt, Long.valueOf(0), OptionType.AUTO_INCREMENTED); // depends on control dependency: [if], data = [none]
} else if (def.endsWith("=b")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.MANDATORY_BOOLEAN); // depends on control dependency: [if], data = [none]
} else if (def.endsWith(":b")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.OPTIONAL_BOOLEAN); // depends on control dependency: [if], data = [none]
} else if (def.endsWith("=f")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.MANDATORY_FLOAT); // depends on control dependency: [if], data = [none]
} else if (def.endsWith(":f")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.OPTIONAL_FLOAT); // depends on control dependency: [if], data = [none]
} else if (def.endsWith("=i")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.MANDATORY_INTEGER); // depends on control dependency: [if], data = [none]
} else if (def.endsWith(":i")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.OPTIONAL_INTEGER); // depends on control dependency: [if], data = [none]
} else if (def.endsWith("=s")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.MANDATORY_STRING); // depends on control dependency: [if], data = [none]
} else if (def.endsWith(":s")) { //$NON-NLS-1$
opt = def.substring(0, def.length() - 2); // depends on control dependency: [if], data = [none]
defs.put(opt, OptionType.OPTIONAL_STRING); // depends on control dependency: [if], data = [none]
} else {
defs.put(def, OptionType.SIMPLE); // depends on control dependency: [if], data = [none]
}
}
int idx;
String base;
String nbase;
String val;
OptionType type;
OptionType waitingValue = null;
String valueOptionName = null;
boolean allParameters = false;
boolean success;
for (final String param : commandLineParameters) {
if (allParameters) {
params.add(param); // depends on control dependency: [if], data = [none]
continue;
}
if (waitingValue != null && waitingValue.isMandatory()) {
// Expect a value as the next parameter
success = registerOptionValue(options, valueOptionName, param, waitingValue); // depends on control dependency: [if], data = [none]
waitingValue = null; // depends on control dependency: [if], data = [none]
valueOptionName = null; // depends on control dependency: [if], data = [none]
if (success) {
continue;
}
}
if ("--".equals(param)) { //$NON-NLS-1$
if (waitingValue != null) {
registerOptionValue(options, valueOptionName, null, waitingValue); // depends on control dependency: [if], data = [none]
waitingValue = null; // depends on control dependency: [if], data = [none]
valueOptionName = null; // depends on control dependency: [if], data = [none]
}
allParameters = true; // depends on control dependency: [if], data = [none]
continue;
} else if ((File.separatorChar != '/') && (param.startsWith("/"))) { //$NON-NLS-1$
opt = param.substring(1); // depends on control dependency: [if], data = [none]
} else if (param.startsWith("--")) { //$NON-NLS-1$
opt = param.substring(2); // depends on control dependency: [if], data = [none]
} else if (param.startsWith("-")) { //$NON-NLS-1$
opt = param.substring(1); // depends on control dependency: [if], data = [none]
} else if (waitingValue != null) {
success = registerOptionValue(options, valueOptionName, param, waitingValue); // depends on control dependency: [if], data = [none]
waitingValue = null; // depends on control dependency: [if], data = [none]
valueOptionName = null; // depends on control dependency: [if], data = [none]
if (!success) {
params.add(param); // depends on control dependency: [if], data = [none]
}
continue;
} else {
params.add(param); // depends on control dependency: [if], data = [none]
continue;
}
if (waitingValue != null) {
success = registerOptionValue(options, valueOptionName, param, waitingValue); // depends on control dependency: [if], data = [none]
waitingValue = null; // depends on control dependency: [if], data = [none]
valueOptionName = null; // depends on control dependency: [if], data = [none]
if (success) {
continue;
}
}
idx = opt.indexOf('='); // depends on control dependency: [for], data = [none]
if (idx > 0) {
base = opt.substring(0, idx); // depends on control dependency: [if], data = [none]
val = opt.substring(idx + 1); // depends on control dependency: [if], data = [(idx]
} else {
base = opt; // depends on control dependency: [if], data = [none]
val = null; // depends on control dependency: [if], data = [none]
}
nbase = null; // depends on control dependency: [for], data = [none]
type = defs.get(base); // depends on control dependency: [for], data = [none]
if (type == null && base.toLowerCase().startsWith("no")) { //$NON-NLS-1$
nbase = base.substring(2); // depends on control dependency: [if], data = [none]
type = defs.get(nbase); // depends on control dependency: [if], data = [none]
}
if (type != null) {
switch (type) {
case FLAG:
if (nbase == null) {
registerOptionValue(options, base, Boolean.TRUE, type); // depends on control dependency: [if], data = [none]
} else {
registerOptionValue(options, nbase, Boolean.FALSE, type); // depends on control dependency: [if], data = [none]
}
break;
case MANDATORY_FLOAT:
case MANDATORY_BOOLEAN:
case MANDATORY_INTEGER:
case MANDATORY_STRING:
case OPTIONAL_FLOAT:
case OPTIONAL_BOOLEAN:
case OPTIONAL_INTEGER:
case OPTIONAL_STRING:
if (val != null) {
registerOptionValue(options, base, val, type); // depends on control dependency: [if], data = [none]
} else {
waitingValue = type; // depends on control dependency: [if], data = [none]
valueOptionName = base; // depends on control dependency: [if], data = [none]
}
break;
//$CASES-OMITTED$
default:
registerOptionValue(options, base, val, type);
}
} else {
// Not a recognized option, assuming simple
registerOptionValue(options, base, val, OptionType.SIMPLE); // depends on control dependency: [if], data = [none]
}
}
if (waitingValue != null && waitingValue.isMandatory()) {
throw new IllegalStateException(Locale.getString("E2", valueOptionName)); //$NON-NLS-1$
}
commandLineParameters = new String[params.size()];
params.toArray(commandLineParameters);
params.clear();
commandLineOptions = options;
analyzed = true;
} } |
public class class_name {
private void catalogClass(JavaClass clz) {
transactionalMethods = new HashMap<>();
isEntity = false;
hasId = false;
hasGeneratedValue = false;
hasEagerOneToMany = false;
hasHCEquals = false;
for (AnnotationEntry entry : clz.getAnnotationEntries()) {
if ("Ljavax/persistence/Entity;".equals(entry.getAnnotationType())) {
isEntity = true;
break;
}
}
for (Method m : clz.getMethods()) {
catalogFieldOrMethod(m);
if (("equals".equals(m.getName()) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(m.getSignature()))
|| (Values.HASHCODE.equals(m.getName()) && SignatureBuilder.SIG_VOID_TO_INT.equals(m.getSignature()))) {
hasHCEquals = true;
}
}
for (Field f : clz.getFields()) {
catalogFieldOrMethod(f);
}
} } | public class class_name {
private void catalogClass(JavaClass clz) {
transactionalMethods = new HashMap<>();
isEntity = false;
hasId = false;
hasGeneratedValue = false;
hasEagerOneToMany = false;
hasHCEquals = false;
for (AnnotationEntry entry : clz.getAnnotationEntries()) {
if ("Ljavax/persistence/Entity;".equals(entry.getAnnotationType())) {
isEntity = true; // depends on control dependency: [if], data = [none]
break;
}
}
for (Method m : clz.getMethods()) {
catalogFieldOrMethod(m); // depends on control dependency: [for], data = [m]
if (("equals".equals(m.getName()) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(m.getSignature()))
|| (Values.HASHCODE.equals(m.getName()) && SignatureBuilder.SIG_VOID_TO_INT.equals(m.getSignature()))) {
hasHCEquals = true; // depends on control dependency: [if], data = [none]
}
}
for (Field f : clz.getFields()) {
catalogFieldOrMethod(f); // depends on control dependency: [for], data = [f]
}
} } |
public class class_name {
public void setConfig(LWMConfig me) {
String thisMethodName = "setConfig";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { me });
}
meHighMessageThreshold=this._me.getMessagingEngine().getHighMessageThreshold();
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
// Pass the attributes to all engine components
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext()) {
vIter.next().getRef().setConfig(me);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
} } | public class class_name {
public void setConfig(LWMConfig me) {
String thisMethodName = "setConfig";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, new Object[] { me }); // depends on control dependency: [if], data = [none]
}
meHighMessageThreshold=this._me.getMessagingEngine().getHighMessageThreshold();
// No need to synchronize on jmeComponents to prevent concurrent
// modification from dynamic config and runtime callbacks, because
// jmeComponents is now a CopyOnWriteArrayList.
// Pass the attributes to all engine components
Iterator<ComponentList> vIter = jmeComponents.iterator();
while (vIter.hasNext()) {
vIter.next().getRef().setConfig(me); // depends on control dependency: [while], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> Collection<T> toCollection(Object iterableResult) {
if (iterableResult.getClass().isArray()) {
List<Object> collect = IntStream.range(0, Array.getLength(iterableResult))
.mapToObj(i -> Array.get(iterableResult, i))
.collect(Collectors.toList());
return (List<T>) collect;
}
if (iterableResult instanceof Collection) {
return (Collection<T>) iterableResult;
}
Iterable<T> iterable = (Iterable<T>) iterableResult;
Iterator<T> iterator = iterable.iterator();
List<T> list = new ArrayList<>();
while (iterator.hasNext()) {
list.add(iterator.next());
}
return list;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> Collection<T> toCollection(Object iterableResult) {
if (iterableResult.getClass().isArray()) {
List<Object> collect = IntStream.range(0, Array.getLength(iterableResult))
.mapToObj(i -> Array.get(iterableResult, i))
.collect(Collectors.toList());
return (List<T>) collect; // depends on control dependency: [if], data = [none]
}
if (iterableResult instanceof Collection) {
return (Collection<T>) iterableResult; // depends on control dependency: [if], data = [none]
}
Iterable<T> iterable = (Iterable<T>) iterableResult;
Iterator<T> iterator = iterable.iterator();
List<T> list = new ArrayList<>();
while (iterator.hasNext()) {
list.add(iterator.next()); // depends on control dependency: [while], data = [none]
}
return list;
} } |
public class class_name {
@Override
public boolean add(Element element) throws DocumentException {
boolean rv = false;
AddElementHook hook = null;
if (element instanceof Image) {
Image image = (Image) element;
// see if we should style after adding
hook = find(element, AddElementHook.INTENTION.PRINTIMAGESHADOW);
/*
we want to draw a shadow, write a chunk to get the position of the image later
*/
if (hook != null) {
String gt = DRAWSHADOW + hook.styleClass;
Chunk chunk = positionChunk();
styleHelper.delayedStyle(chunk, gt, StyleHelper.toCollection((Advanced) hook.bs), eventHelper, image);
super.add(chunk);
}
hook = find(element, AddElementHook.INTENTION.DEBUGIMAGE);
if (hook != null && ((EnhancedMap) factory.getSettings()).getBooleanProperty(false, ReportConstants.DEBUG)) {
rv = tracePosition(image, hook, IMG_DEBUG, true);
}
hook = find(element, AddElementHook.INTENTION.DRAWNEARIMAGE);
if (hook != null) {
if (rv) {
tracePosition(image, hook, DRAWNEAR, false);
} else {
rv = tracePosition(image, hook, DRAWNEAR, true);
}
}
if (!rv) {
rv = super.add(element);
}
} else if (element instanceof Section) {
rv = super.add(element);
if (!toc.containsKey(writer.getCurrentPageNumber())) {
toc.put(writer.getCurrentPageNumber(), new ArrayList<>(3));
}
toc.get(writer.getCurrentPageNumber()).add((Section) element);
} else {
rv = super.add(element);
}
// see if we should style after adding
Iterator<AddElementHook> it = hooks.iterator();
while (it.hasNext() && (hook = it.next()) != null) {
if (hook.intention == AddElementHook.INTENTION.STYLELATER && hook.e.type() == element.type() && hook.e.equals(element) && hook.bs.canStyle(element) && hook.bs.shouldStyle(null, element)) {
it.remove();
try {
hook.bs.style(element, null);
} catch (VectorPrintException ex) {
throw new VectorPrintRuntimeException(ex);
}
}
}
return rv;
} } | public class class_name {
@Override
public boolean add(Element element) throws DocumentException {
boolean rv = false;
AddElementHook hook = null;
if (element instanceof Image) {
Image image = (Image) element;
// see if we should style after adding
hook = find(element, AddElementHook.INTENTION.PRINTIMAGESHADOW);
/*
we want to draw a shadow, write a chunk to get the position of the image later
*/
if (hook != null) {
String gt = DRAWSHADOW + hook.styleClass;
Chunk chunk = positionChunk();
styleHelper.delayedStyle(chunk, gt, StyleHelper.toCollection((Advanced) hook.bs), eventHelper, image); // depends on control dependency: [if], data = [none]
super.add(chunk); // depends on control dependency: [if], data = [none]
}
hook = find(element, AddElementHook.INTENTION.DEBUGIMAGE);
if (hook != null && ((EnhancedMap) factory.getSettings()).getBooleanProperty(false, ReportConstants.DEBUG)) {
rv = tracePosition(image, hook, IMG_DEBUG, true); // depends on control dependency: [if], data = [none]
}
hook = find(element, AddElementHook.INTENTION.DRAWNEARIMAGE);
if (hook != null) {
if (rv) {
tracePosition(image, hook, DRAWNEAR, false); // depends on control dependency: [if], data = [none]
} else {
rv = tracePosition(image, hook, DRAWNEAR, true); // depends on control dependency: [if], data = [none]
}
}
if (!rv) {
rv = super.add(element); // depends on control dependency: [if], data = [none]
}
} else if (element instanceof Section) {
rv = super.add(element);
if (!toc.containsKey(writer.getCurrentPageNumber())) {
toc.put(writer.getCurrentPageNumber(), new ArrayList<>(3)); // depends on control dependency: [if], data = [none]
}
toc.get(writer.getCurrentPageNumber()).add((Section) element);
} else {
rv = super.add(element);
}
// see if we should style after adding
Iterator<AddElementHook> it = hooks.iterator();
while (it.hasNext() && (hook = it.next()) != null) {
if (hook.intention == AddElementHook.INTENTION.STYLELATER && hook.e.type() == element.type() && hook.e.equals(element) && hook.bs.canStyle(element) && hook.bs.shouldStyle(null, element)) {
it.remove(); // depends on control dependency: [if], data = [none]
try {
hook.bs.style(element, null); // depends on control dependency: [try], data = [none]
} catch (VectorPrintException ex) {
throw new VectorPrintRuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
}
}
return rv;
} } |
public class class_name {
public static boolean isAnyAnnotationPresent(Class<?> target, Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotationClass : annotations) {
if (isAnnotationPresent(target, annotationClass)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isAnyAnnotationPresent(Class<?> target, Class<? extends Annotation>... annotations) {
for (Class<? extends Annotation> annotationClass : annotations) {
if (isAnnotationPresent(target, annotationClass)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public int createNewUser(LoginDialog dialog)
{
String strUserName = dialog.getUserName();
String strPassword = dialog.getPassword();
try {
byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes);
char[] chars = Base64.encode(bytes);
strPassword = new String(chars);
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
String strDomain = this.getProperty(Params.DOMAIN);
int iSuccess = this.getApplication().createNewUser(this, strUserName, strPassword, strDomain);
if (iSuccess == Constants.NORMAL_RETURN)
;
return JOptionPane.OK_OPTION;
} } | public class class_name {
public int createNewUser(LoginDialog dialog)
{
String strUserName = dialog.getUserName();
String strPassword = dialog.getPassword();
try {
byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes); // depends on control dependency: [try], data = [none]
char[] chars = Base64.encode(bytes);
strPassword = new String(chars); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
} catch (UnsupportedEncodingException ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
String strDomain = this.getProperty(Params.DOMAIN);
int iSuccess = this.getApplication().createNewUser(this, strUserName, strPassword, strDomain);
if (iSuccess == Constants.NORMAL_RETURN)
;
return JOptionPane.OK_OPTION;
} } |
public class class_name {
private ImmutableMap<Integer, Entry> readTable(String path) throws IOException {
ImmutableMap.Builder<Integer, Entry> builder = ImmutableMap.builder();
if (debugOpen) {
System.out.printf("readEcmwfTable path= %s%n", path);
}
ClassLoader cl = Grib2TableConfig.class.getClassLoader();
try (InputStream is = cl.getResourceAsStream(path)) {
if (is == null) {
throw new IllegalStateException("Cant find " + path);
}
try (BufferedReader dataIS = new BufferedReader(
new InputStreamReader(is, Charset.forName("UTF8")))) {
int count = 0;
while (true) {
String line = dataIS.readLine();
if (line == null) {
break;
}
if (line.startsWith("#") || line.trim().length() == 0) {
continue;
}
count++;
int posBlank1 = line.indexOf(' ');
int posBlank2 = line.indexOf(' ', posBlank1 + 1);
int lastParen = line.lastIndexOf('(');
String num1 = line.substring(0, posBlank1).trim();
String num2 = line.substring(posBlank1 + 1, posBlank2);
String desc = (lastParen > 0) ? line.substring(posBlank2 + 1, lastParen).trim()
: line.substring(posBlank2 + 1).trim();
if (!num1.equals(num2)) {
if (debug) {
System.out.printf("*****num1 != num2 for %s%n", line);
}
continue;
}
int code = Integer.parseInt(num1);
EcmwfEntry entry = new EcmwfEntry(code, desc);
builder.put(entry.getCode(), entry);
if (debug) {
System.out.printf(" %s%n", entry);
}
}
}
}
return builder.build();
} } | public class class_name {
private ImmutableMap<Integer, Entry> readTable(String path) throws IOException {
ImmutableMap.Builder<Integer, Entry> builder = ImmutableMap.builder();
if (debugOpen) {
System.out.printf("readEcmwfTable path= %s%n", path);
}
ClassLoader cl = Grib2TableConfig.class.getClassLoader();
try (InputStream is = cl.getResourceAsStream(path)) {
if (is == null) {
throw new IllegalStateException("Cant find " + path);
}
try (BufferedReader dataIS = new BufferedReader(
new InputStreamReader(is, Charset.forName("UTF8")))) {
int count = 0;
while (true) {
String line = dataIS.readLine();
if (line == null) {
break;
}
if (line.startsWith("#") || line.trim().length() == 0) {
continue;
}
count++; // depends on control dependency: [while], data = [none]
int posBlank1 = line.indexOf(' ');
int posBlank2 = line.indexOf(' ', posBlank1 + 1);
int lastParen = line.lastIndexOf('(');
String num1 = line.substring(0, posBlank1).trim();
String num2 = line.substring(posBlank1 + 1, posBlank2);
String desc = (lastParen > 0) ? line.substring(posBlank2 + 1, lastParen).trim()
: line.substring(posBlank2 + 1).trim();
if (!num1.equals(num2)) {
if (debug) {
System.out.printf("*****num1 != num2 for %s%n", line); // depends on control dependency: [if], data = [none]
}
continue;
}
int code = Integer.parseInt(num1);
EcmwfEntry entry = new EcmwfEntry(code, desc);
builder.put(entry.getCode(), entry); // depends on control dependency: [while], data = [none]
if (debug) {
System.out.printf(" %s%n", entry); // depends on control dependency: [if], data = [none]
}
}
}
}
return builder.build();
} } |
public class class_name {
private List<ELResolver> _getFacesConfigElResolvers()
{
if (_facesConfigResolvers == null)
{
ExternalContext externalContext
= FacesContext.getCurrentInstance().getExternalContext();
RuntimeConfig runtimeConfig
= RuntimeConfig.getCurrentInstance(externalContext);
_facesConfigResolvers
= runtimeConfig.getFacesConfigElResolvers();
}
return _facesConfigResolvers;
} } | public class class_name {
private List<ELResolver> _getFacesConfigElResolvers()
{
if (_facesConfigResolvers == null)
{
ExternalContext externalContext
= FacesContext.getCurrentInstance().getExternalContext();
RuntimeConfig runtimeConfig
= RuntimeConfig.getCurrentInstance(externalContext);
_facesConfigResolvers
= runtimeConfig.getFacesConfigElResolvers(); // depends on control dependency: [if], data = [none]
}
return _facesConfigResolvers;
} } |
public class class_name {
@Override
public void close() {
executor.shutdown();
for (SelectionKey key : selector.keys()) {
((Attachment) key.attachment()).finishClose();
}
try {
selector.close();
} catch (IOException e) {/**/}
} } | public class class_name {
@Override
public void close() {
executor.shutdown();
for (SelectionKey key : selector.keys()) {
((Attachment) key.attachment()).finishClose();
// depends on control dependency: [for], data = [key]
}
try {
selector.close();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {/**/}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public CancelSpotFleetRequestsRequest withSpotFleetRequestIds(String... spotFleetRequestIds) {
if (this.spotFleetRequestIds == null) {
setSpotFleetRequestIds(new com.amazonaws.internal.SdkInternalList<String>(spotFleetRequestIds.length));
}
for (String ele : spotFleetRequestIds) {
this.spotFleetRequestIds.add(ele);
}
return this;
} } | public class class_name {
public CancelSpotFleetRequestsRequest withSpotFleetRequestIds(String... spotFleetRequestIds) {
if (this.spotFleetRequestIds == null) {
setSpotFleetRequestIds(new com.amazonaws.internal.SdkInternalList<String>(spotFleetRequestIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : spotFleetRequestIds) {
this.spotFleetRequestIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone,
Locale locale) {
Object key = new Pair(new Integer(dateStyle), new Integer(timeStyle));
if (timeZone != null) {
key = new Pair(key, timeZone);
}
if (locale == null) {
locale = Locale.getDefault();
}
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle,
locale);
String pattern = formatter.toPattern();
format = getInstance(pattern, timeZone, locale);
cDateTimeInstanceCache.put(key, format);
} catch (ClassCastException ex) {
throw new IllegalArgumentException("No date time pattern for locale: " + locale);
}
}
return format;
} } | public class class_name {
public static synchronized FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone,
Locale locale) {
Object key = new Pair(new Integer(dateStyle), new Integer(timeStyle));
if (timeZone != null) {
key = new Pair(key, timeZone);
// depends on control dependency: [if], data = [none]
}
if (locale == null) {
locale = Locale.getDefault();
// depends on control dependency: [if], data = [none]
}
key = new Pair(key, locale);
FastDateFormat format = (FastDateFormat) cDateTimeInstanceCache.get(key);
if (format == null) {
try {
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateTimeInstance(dateStyle, timeStyle,
locale);
String pattern = formatter.toPattern();
format = getInstance(pattern, timeZone, locale);
// depends on control dependency: [try], data = [none]
cDateTimeInstanceCache.put(key, format);
// depends on control dependency: [try], data = [none]
} catch (ClassCastException ex) {
throw new IllegalArgumentException("No date time pattern for locale: " + locale);
}
// depends on control dependency: [catch], data = [none]
}
return format;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected void notifyInstantSelected() {
if (getActivity() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getActivity()).onInstantSelected(getPickerId(), getSelectedInstant());
}
if (getParentFragment() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getParentFragment()).onInstantSelected(getPickerId(), getSelectedInstant());
}
if (getTargetFragment() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getTargetFragment()).onInstantSelected(getPickerId(), getSelectedInstant());
}
} } | public class class_name {
@SuppressWarnings("unchecked")
protected void notifyInstantSelected() {
if (getActivity() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getActivity()).onInstantSelected(getPickerId(), getSelectedInstant()); // depends on control dependency: [if], data = [none]
}
if (getParentFragment() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getParentFragment()).onInstantSelected(getPickerId(), getSelectedInstant()); // depends on control dependency: [if], data = [none]
}
if (getTargetFragment() instanceof InstantPickerListener) {
((InstantPickerListener<TimeInstantT>) getTargetFragment()).onInstantSelected(getPickerId(), getSelectedInstant()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Map<String,Object> parseOptions(List<String> args, OptArg... options) {
HashMap<String,Object> result = new HashMap<>();
HashMap<String,OptArg> optmap = new HashMap<>();
for(OptArg opt : options) {
if(opt.defaultValue != null) {
result.put(opt.option, opt.defaultValue);
}
optmap.put(opt.option, opt);
optmap.put(opt.shortForm, opt);
}
Iterator<String> iter = args.iterator();
while(iter.hasNext()) {
String arg = iter.next();
if (arg.startsWith("-")) {
arg = arg.substring(1,arg.length());
OptArg opt = optmap.get(arg);
if(opt != null) {
// matched
iter.remove(); // remove option from args list
Kind k = opt.argument;
if(k != null) {
String param = iter.next();
iter.remove();
k.process(opt.option,param,result);
} else {
result.put(opt.option,null);
}
} else {
throw new RuntimeException("unknown command-line option: -" + arg);
}
}
}
return result;
} } | public class class_name {
public static Map<String,Object> parseOptions(List<String> args, OptArg... options) {
HashMap<String,Object> result = new HashMap<>();
HashMap<String,OptArg> optmap = new HashMap<>();
for(OptArg opt : options) {
if(opt.defaultValue != null) {
result.put(opt.option, opt.defaultValue);
// depends on control dependency: [if], data = [none]
}
optmap.put(opt.option, opt);
// depends on control dependency: [for], data = [opt]
optmap.put(opt.shortForm, opt);
// depends on control dependency: [for], data = [opt]
}
Iterator<String> iter = args.iterator();
while(iter.hasNext()) {
String arg = iter.next();
if (arg.startsWith("-")) {
arg = arg.substring(1,arg.length());
// depends on control dependency: [if], data = [none]
OptArg opt = optmap.get(arg);
if(opt != null) {
// matched
iter.remove(); // remove option from args list
// depends on control dependency: [if], data = [none]
Kind k = opt.argument;
if(k != null) {
String param = iter.next();
iter.remove();
// depends on control dependency: [if], data = [none]
k.process(opt.option,param,result);
// depends on control dependency: [if], data = [none]
} else {
result.put(opt.option,null);
// depends on control dependency: [if], data = [null)]
}
} else {
throw new RuntimeException("unknown command-line option: -" + arg);
}
}
}
return result;
} } |
public class class_name {
public java.util.List<String> getIncludeOnlyStatuses() {
if (includeOnlyStatuses == null) {
includeOnlyStatuses = new com.amazonaws.internal.SdkInternalList<String>();
}
return includeOnlyStatuses;
} } | public class class_name {
public java.util.List<String> getIncludeOnlyStatuses() {
if (includeOnlyStatuses == null) {
includeOnlyStatuses = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return includeOnlyStatuses;
} } |
public class class_name {
@Override
public void checkUniqueNames(Iterable<IEObjectDescription> descriptions,
CancelIndicator cancelIndicator,
ValidationMessageAcceptor acceptor) {
Iterator<IEObjectDescription> iter = descriptions.iterator();
if (!iter.hasNext())
return;
Map<EClass, Map<QualifiedName, IEObjectDescription>> clusterToNames = Maps.newHashMap();
while(iter.hasNext()) {
IEObjectDescription description = iter.next();
checkDescriptionForDuplicatedName(description, clusterToNames, acceptor);
operationCanceledManager.checkCanceled(cancelIndicator);
}
} } | public class class_name {
@Override
public void checkUniqueNames(Iterable<IEObjectDescription> descriptions,
CancelIndicator cancelIndicator,
ValidationMessageAcceptor acceptor) {
Iterator<IEObjectDescription> iter = descriptions.iterator();
if (!iter.hasNext())
return;
Map<EClass, Map<QualifiedName, IEObjectDescription>> clusterToNames = Maps.newHashMap();
while(iter.hasNext()) {
IEObjectDescription description = iter.next();
checkDescriptionForDuplicatedName(description, clusterToNames, acceptor); // depends on control dependency: [while], data = [none]
operationCanceledManager.checkCanceled(cancelIndicator); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private static Set<String> populateTags(Set<String> source, Set<String> destination) {
for (String tag : source) {
if (!tagPattern.matcher(tag).matches()) {
LOGGER.warn("The tag {} does not respect the following pattern {} and is ignored", tag, tagPattern.pattern());
}
else if (destination.contains(tag)) {
LOGGER.info("The tag {} is already present in the collection and is ingored", tag);
}
else {
destination.add(tag);
}
}
return destination;
} } | public class class_name {
private static Set<String> populateTags(Set<String> source, Set<String> destination) {
for (String tag : source) {
if (!tagPattern.matcher(tag).matches()) {
LOGGER.warn("The tag {} does not respect the following pattern {} and is ignored", tag, tagPattern.pattern()); // depends on control dependency: [if], data = [none]
}
else if (destination.contains(tag)) {
LOGGER.info("The tag {} is already present in the collection and is ingored", tag); // depends on control dependency: [if], data = [none]
}
else {
destination.add(tag); // depends on control dependency: [if], data = [none]
}
}
return destination;
} } |
public class class_name {
private <T extends Comparable<T>> int compareToLinear(int currentResult, T thisValue, T otherValue, VersionIdentifier otherVersion) {
if (currentResult == COMPARE_TO_INCOMPARABLE) {
return COMPARE_TO_INCOMPARABLE;
}
int result = currentResult;
if (thisValue != null) {
if (otherValue != null) {
int diff = thisValue.compareTo(otherValue);
if (result == 0) {
if ((diff != 0) && (!isSnapshot()) && (!otherVersion.isSnapshot())) {
return COMPARE_TO_INCOMPARABLE;
}
if (diff < 0) {
result = COMPARE_TO_STRICT_PREDECESSOR;
} else {
result = COMPARE_TO_STRICT_SUCCESSOR;
}
} else if (result < 0) {
// this.timestamp < otherVersion.timestamp
if (diff > 0) {
return COMPARE_TO_INCOMPARABLE;
}
} else {
// this.timestamp > otherVersion.timestamp
if (diff < 0) {
return COMPARE_TO_INCOMPARABLE;
}
}
}
}
return result;
} } | public class class_name {
private <T extends Comparable<T>> int compareToLinear(int currentResult, T thisValue, T otherValue, VersionIdentifier otherVersion) {
if (currentResult == COMPARE_TO_INCOMPARABLE) {
return COMPARE_TO_INCOMPARABLE; // depends on control dependency: [if], data = [none]
}
int result = currentResult;
if (thisValue != null) {
if (otherValue != null) {
int diff = thisValue.compareTo(otherValue);
if (result == 0) {
if ((diff != 0) && (!isSnapshot()) && (!otherVersion.isSnapshot())) {
return COMPARE_TO_INCOMPARABLE; // depends on control dependency: [if], data = [none]
}
if (diff < 0) {
result = COMPARE_TO_STRICT_PREDECESSOR; // depends on control dependency: [if], data = [none]
} else {
result = COMPARE_TO_STRICT_SUCCESSOR; // depends on control dependency: [if], data = [none]
}
} else if (result < 0) {
// this.timestamp < otherVersion.timestamp
if (diff > 0) {
return COMPARE_TO_INCOMPARABLE; // depends on control dependency: [if], data = [none]
}
} else {
// this.timestamp > otherVersion.timestamp
if (diff < 0) {
return COMPARE_TO_INCOMPARABLE; // depends on control dependency: [if], data = [none]
}
}
}
}
return result;
} } |
public class class_name {
public void setGroupIds(java.util.Collection<String> groupIds) {
if (groupIds == null) {
this.groupIds = null;
return;
}
this.groupIds = new com.amazonaws.internal.SdkInternalList<String>(groupIds);
} } | public class class_name {
public void setGroupIds(java.util.Collection<String> groupIds) {
if (groupIds == null) {
this.groupIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.groupIds = new com.amazonaws.internal.SdkInternalList<String>(groupIds);
} } |
public class class_name {
public CSSStyleSheetImpl merge() {
final CSSStyleSheetImpl merged = new CSSStyleSheetImpl();
final CSSRuleListImpl cssRuleList = new CSSRuleListImpl();
final Iterator<CSSStyleSheetImpl> it = getCSSStyleSheets().iterator();
while (it.hasNext()) {
final CSSStyleSheetImpl cssStyleSheet = it.next();
final CSSMediaRuleImpl cssMediaRule = new CSSMediaRuleImpl(merged, null, cssStyleSheet.getMedia());
cssMediaRule.setRuleList(cssStyleSheet.getCssRules());
cssRuleList.add(cssMediaRule);
}
merged.setCssRules(cssRuleList);
merged.setMediaText("all");
return merged;
} } | public class class_name {
public CSSStyleSheetImpl merge() {
final CSSStyleSheetImpl merged = new CSSStyleSheetImpl();
final CSSRuleListImpl cssRuleList = new CSSRuleListImpl();
final Iterator<CSSStyleSheetImpl> it = getCSSStyleSheets().iterator();
while (it.hasNext()) {
final CSSStyleSheetImpl cssStyleSheet = it.next();
final CSSMediaRuleImpl cssMediaRule = new CSSMediaRuleImpl(merged, null, cssStyleSheet.getMedia());
cssMediaRule.setRuleList(cssStyleSheet.getCssRules()); // depends on control dependency: [while], data = [none]
cssRuleList.add(cssMediaRule); // depends on control dependency: [while], data = [none]
}
merged.setCssRules(cssRuleList);
merged.setMediaText("all");
return merged;
} } |
public class class_name {
public static <T> Collection<T> dropRight(Iterable<T> self, int num) {
Collection<T> selfCol = self instanceof Collection ? (Collection<T>) self : toList(self);
if (selfCol.size() <= num) {
return createSimilarCollection(selfCol, 0);
}
if (num <= 0) {
Collection<T> ret = createSimilarCollection(selfCol, selfCol.size());
ret.addAll(selfCol);
return ret;
}
Collection<T> ret = createSimilarCollection(selfCol, selfCol.size() - num);
ret.addAll(asList((Iterable<T>)selfCol).subList(0, selfCol.size() - num));
return ret;
} } | public class class_name {
public static <T> Collection<T> dropRight(Iterable<T> self, int num) {
Collection<T> selfCol = self instanceof Collection ? (Collection<T>) self : toList(self);
if (selfCol.size() <= num) {
return createSimilarCollection(selfCol, 0); // depends on control dependency: [if], data = [none]
}
if (num <= 0) {
Collection<T> ret = createSimilarCollection(selfCol, selfCol.size());
ret.addAll(selfCol); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
Collection<T> ret = createSimilarCollection(selfCol, selfCol.size() - num);
ret.addAll(asList((Iterable<T>)selfCol).subList(0, selfCol.size() - num));
return ret;
} } |
public class class_name {
@Override
public void accept(Set<String> propertyNames) {
if (!isClosed()) {
synchronized (this) {
for (Map.Entry<PropertyChangeListener, String> entry : listeners.entrySet()) {
String propertyName = entry.getValue();
if (propertyNames.contains(propertyName)) {
PropertyChangeListener listener = entry.getKey();
listener.onPropertyChanged();
}
}
}
}
} } | public class class_name {
@Override
public void accept(Set<String> propertyNames) {
if (!isClosed()) {
synchronized (this) { // depends on control dependency: [if], data = [none]
for (Map.Entry<PropertyChangeListener, String> entry : listeners.entrySet()) {
String propertyName = entry.getValue();
if (propertyNames.contains(propertyName)) {
PropertyChangeListener listener = entry.getKey();
listener.onPropertyChanged(); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public List<I_CmsWorkplaceAppConfiguration> getAppConfigurations(String... appIds) {
List<I_CmsWorkplaceAppConfiguration> result = new ArrayList<I_CmsWorkplaceAppConfiguration>();
for (int i = 0; i < appIds.length; i++) {
I_CmsWorkplaceAppConfiguration config = getAppConfiguration(appIds[i]);
if (config != null) {
result.add(config);
}
}
return result;
} } | public class class_name {
public List<I_CmsWorkplaceAppConfiguration> getAppConfigurations(String... appIds) {
List<I_CmsWorkplaceAppConfiguration> result = new ArrayList<I_CmsWorkplaceAppConfiguration>();
for (int i = 0; i < appIds.length; i++) {
I_CmsWorkplaceAppConfiguration config = getAppConfiguration(appIds[i]);
if (config != null) {
result.add(config); // depends on control dependency: [if], data = [(config]
}
}
return result;
} } |
public class class_name {
public String getIdValue(final URI id) {
if (id == null) {
return null;
}
final URI localId = id.normalize();
return idMap.get(localId);
} } | public class class_name {
public String getIdValue(final URI id) {
if (id == null) {
return null; // depends on control dependency: [if], data = [none]
}
final URI localId = id.normalize();
return idMap.get(localId);
} } |
public class class_name {
private void resetState() {
// if there are any matches sitting in the runtime, eliminate.
if (runtime != null && runtime.match != null) {
runtime.match.clear();
}
nextFindOffset = regionStart;
} } | public class class_name {
private void resetState() {
// if there are any matches sitting in the runtime, eliminate.
if (runtime != null && runtime.match != null) {
runtime.match.clear(); // depends on control dependency: [if], data = [none]
}
nextFindOffset = regionStart;
} } |
public class class_name {
@Override
public EClass getIfcCartesianTransformationOperator3DnonUniform() {
if (ifcCartesianTransformationOperator3DnonUniformEClass == null) {
ifcCartesianTransformationOperator3DnonUniformEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(85);
}
return ifcCartesianTransformationOperator3DnonUniformEClass;
} } | public class class_name {
@Override
public EClass getIfcCartesianTransformationOperator3DnonUniform() {
if (ifcCartesianTransformationOperator3DnonUniformEClass == null) {
ifcCartesianTransformationOperator3DnonUniformEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(85);
// depends on control dependency: [if], data = [none]
}
return ifcCartesianTransformationOperator3DnonUniformEClass;
} } |
public class class_name {
public void async() {
final Request request = data.build();
final CallbackHandler handler = request.handler != null ? request.handler : singleton.handler;
final boolean safe = request.safe != null ? request.safe : singleton.safe;
// Ignore current request if already running (ignoreIfRunning)
synchronized (activeRequests) {
if (ignoreIfRunning && activeRequests.contains(request.tag)) {
singleton.log(request.tag + " request already running! Ignoring...");
return;
}
activeRequests.add(request.tag);
}
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
// Delay thread if specified
if (delay > 0) {
singleton.log("Delaying " + request.tag + " request for " + delay + "ms");
Thread.sleep(delay);
}
// Execute request
try {
singleton.load(request);
} catch (IOException e) {
singleton.log("Error executing request " + request.tag + " asynchronously! " + e.getMessage(), Log.ERROR);
handler.onLoadFailed(safe, request.callback.get());
}
} catch (InterruptedException e) {
singleton.log(request.tag + " thread interrupted!");
} finally {
synchronized (activeRequests) {
activeRequests.remove(request.tag);
}
}
return null;
}
@Override
protected void onCancelled(Void aVoid) {
super.onCancelled(aVoid);
// Double check to make sure this request is removed
synchronized (activeRequests) {
activeRequests.remove(request.tag);
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} } | public class class_name {
public void async() {
final Request request = data.build();
final CallbackHandler handler = request.handler != null ? request.handler : singleton.handler;
final boolean safe = request.safe != null ? request.safe : singleton.safe;
// Ignore current request if already running (ignoreIfRunning)
synchronized (activeRequests) {
if (ignoreIfRunning && activeRequests.contains(request.tag)) {
singleton.log(request.tag + " request already running! Ignoring..."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
activeRequests.add(request.tag);
}
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
// Delay thread if specified
if (delay > 0) {
singleton.log("Delaying " + request.tag + " request for " + delay + "ms"); // depends on control dependency: [if], data = [none]
Thread.sleep(delay); // depends on control dependency: [if], data = [(delay]
}
// Execute request
try {
singleton.load(request); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
singleton.log("Error executing request " + request.tag + " asynchronously! " + e.getMessage(), Log.ERROR);
handler.onLoadFailed(safe, request.callback.get());
} // depends on control dependency: [catch], data = [none]
} catch (InterruptedException e) {
singleton.log(request.tag + " thread interrupted!");
} finally { // depends on control dependency: [catch], data = [none]
synchronized (activeRequests) {
activeRequests.remove(request.tag);
}
}
return null;
}
@Override
protected void onCancelled(Void aVoid) {
super.onCancelled(aVoid);
// Double check to make sure this request is removed
synchronized (activeRequests) {
activeRequests.remove(request.tag);
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} } |
public class class_name {
public static void transferStream(InputStream in, OutputStream out)
{
try {
byte[] cbuf = new byte[1000];
int iLen = 0;
while ((iLen = in.read(cbuf, 0, cbuf.length)) > 0)
{ // Write the entire file to the output buffer
out.write(cbuf, 0, iLen);
}
in.close();
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public static void transferStream(InputStream in, OutputStream out)
{
try {
byte[] cbuf = new byte[1000];
int iLen = 0;
while ((iLen = in.read(cbuf, 0, cbuf.length)) > 0)
{ // Write the entire file to the output buffer
out.write(cbuf, 0, iLen); // depends on control dependency: [while], data = [none]
}
in.close(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void createIndex(long idleTime) {
try {
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME));
} catch (MongoException ex) {//update idle time
this.sessions.dropIndex(SESSION_INDEX_NAME);
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME));
}
} } | public class class_name {
private void createIndex(long idleTime) {
try {
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME)); // depends on control dependency: [try], data = [none]
} catch (MongoException ex) {//update idle time
this.sessions.dropIndex(SESSION_INDEX_NAME);
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME));
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.