code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) {
ScopeFormats scopeFormats;
try {
scopeFormats = ScopeFormats.fromConfig(configuration);
} catch (Exception e) {
LOG.warn("Failed to parse scope format, using default scope formats", e);
scopeFormats = ScopeFormats.fromConfig(new Configuration());
}
char delim;
try {
delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0);
} catch (Exception e) {
LOG.warn("Failed to parse delimiter, using default delimiter.", e);
delim = '.';
}
final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration);
// padding to account for serialization overhead
final long messageSizeLimitPadding = 256;
return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding);
} } | public class class_name {
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) {
ScopeFormats scopeFormats;
try {
scopeFormats = ScopeFormats.fromConfig(configuration); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Failed to parse scope format, using default scope formats", e);
scopeFormats = ScopeFormats.fromConfig(new Configuration());
} // depends on control dependency: [catch], data = [none]
char delim;
try {
delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.warn("Failed to parse delimiter, using default delimiter.", e);
delim = '.';
} // depends on control dependency: [catch], data = [none]
final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration);
// padding to account for serialization overhead
final long messageSizeLimitPadding = 256;
return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding);
} } |
public class class_name {
public static String signHmacSHA1(final String source, final String secret) {
try {
final Mac mac = Mac.getInstance("HmacSHA1");
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1"));
final byte[] signData = mac.doFinal(source.getBytes("UTF-8"));
return new String(Base64.encodeBase64(signData), "UTF-8");
} catch (final Exception e) {
throw new RuntimeException("HMAC-SHA1 sign failed", e);
}
} } | public class class_name {
public static String signHmacSHA1(final String source, final String secret) {
try {
final Mac mac = Mac.getInstance("HmacSHA1");
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1")); // depends on control dependency: [try], data = [none]
final byte[] signData = mac.doFinal(source.getBytes("UTF-8"));
return new String(Base64.encodeBase64(signData), "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw new RuntimeException("HMAC-SHA1 sign failed", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(next);
int length = bitmap.length();
for (short i = 0; i < length; i++)
if (bitmap.get(i)) {
sb.append(" ");
sb.append(Type.string(i));
}
return sb.toString();
} } | public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(next);
int length = bitmap.length();
for (short i = 0; i < length; i++)
if (bitmap.get(i)) {
sb.append(" "); // depends on control dependency: [if], data = [none]
sb.append(Type.string(i)); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} } |
public class class_name {
public long copyIn(final String sql, InputStream from, int bufferSize)
throws SQLException, IOException {
byte[] buf = new byte[bufferSize];
int len;
CopyIn cp = copyIn(sql);
try {
while ((len = from.read(buf)) >= 0) {
if (len > 0) {
cp.writeToCopy(buf, 0, len);
}
}
return cp.endCopy();
} finally { // see to it that we do not leave the connection locked
if (cp.isActive()) {
cp.cancelCopy();
}
}
} } | public class class_name {
public long copyIn(final String sql, InputStream from, int bufferSize)
throws SQLException, IOException {
byte[] buf = new byte[bufferSize];
int len;
CopyIn cp = copyIn(sql);
try {
while ((len = from.read(buf)) >= 0) {
if (len > 0) {
cp.writeToCopy(buf, 0, len); // depends on control dependency: [if], data = [none]
}
}
return cp.endCopy();
} finally { // see to it that we do not leave the connection locked
if (cp.isActive()) {
cp.cancelCopy(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void copyToDirectBuffer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "copyToDirectBuffer");
}
if (oByteBuffer.isDirect()) {
this.oWsBBDirect = this.oByteBuffer;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 1");
}
return;
}
if (this.quickBufferAction == ACTIVATED) {
synchronized (wsBBRoot.actionAccess) {
if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE1) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "bufferAction in STATE1, do not copy");
}
// no put activity has been done on the NonDirect Buffer, so
// the data in the Direct buffer can be written as is
this.oWsBBDirect.limit(oByteBuffer.limit());
this.oWsBBDirect.position(oByteBuffer.position());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 2");
}
return;
}
if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE2) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "bufferAction in STATE2, copy only changed data");
}
// put activity has been done on the NonDirect Buffer, so
// the new data in the nonDirect buffer needs to be copied
// down to the Direct Buffer
if ((wsBBRoot.putMin != -1) && (wsBBRoot.putMax != -1)) {
copyRangeToDirectBuffer(wsBBRoot.putMin, wsBBRoot.putMax);
wsBBRoot.putMin = -1;
wsBBRoot.putMax = -1;
}
this.oWsBBDirect.limit(oByteBuffer.limit());
this.oWsBBDirect.position(oByteBuffer.position());
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 3");
}
return;
}
} // end-sync
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "buffer optimization is off, copy all data");
}
// we are here because either Optimization was never on, or it just switched off.
if (oWsBBDirect == null) {
this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity());
}
int cachePosition = this.oByteBuffer.position();
int cacheLimit = this.oByteBuffer.limit();
int offset = this.oByteBuffer.arrayOffset();
// set the position and limit for copying
this.oWsBBDirect.limit(cacheLimit);
this.oWsBBDirect.position(cachePosition);
// copy the bytes from position to limit
this.oWsBBDirect.put(oByteBuffer.array(), cachePosition + offset, cacheLimit - cachePosition);
// reset the position
this.oWsBBDirect.position(cachePosition);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 4");
}
} } | public class class_name {
public void copyToDirectBuffer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "copyToDirectBuffer"); // depends on control dependency: [if], data = [none]
}
if (oByteBuffer.isDirect()) {
this.oWsBBDirect = this.oByteBuffer; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 1"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (this.quickBufferAction == ACTIVATED) {
synchronized (wsBBRoot.actionAccess) { // depends on control dependency: [if], data = [none]
if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE1) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "bufferAction in STATE1, do not copy"); // depends on control dependency: [if], data = [none]
}
// no put activity has been done on the NonDirect Buffer, so
// the data in the Direct buffer can be written as is
this.oWsBBDirect.limit(oByteBuffer.limit()); // depends on control dependency: [if], data = [none]
this.oWsBBDirect.position(oByteBuffer.position()); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 2"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (wsBBRoot.actionState == PooledWsByteBufferImpl.COPY_WHEN_NEEDED_STATE2) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "bufferAction in STATE2, copy only changed data"); // depends on control dependency: [if], data = [none]
}
// put activity has been done on the NonDirect Buffer, so
// the new data in the nonDirect buffer needs to be copied
// down to the Direct Buffer
if ((wsBBRoot.putMin != -1) && (wsBBRoot.putMax != -1)) {
copyRangeToDirectBuffer(wsBBRoot.putMin, wsBBRoot.putMax); // depends on control dependency: [if], data = [none]
wsBBRoot.putMin = -1; // depends on control dependency: [if], data = [none]
wsBBRoot.putMax = -1; // depends on control dependency: [if], data = [none]
}
this.oWsBBDirect.limit(oByteBuffer.limit()); // depends on control dependency: [if], data = [none]
this.oWsBBDirect.position(oByteBuffer.position()); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 3"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
} // end-sync
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "buffer optimization is off, copy all data"); // depends on control dependency: [if], data = [none]
}
// we are here because either Optimization was never on, or it just switched off.
if (oWsBBDirect == null) {
this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity()); // depends on control dependency: [if], data = [none]
}
int cachePosition = this.oByteBuffer.position();
int cacheLimit = this.oByteBuffer.limit();
int offset = this.oByteBuffer.arrayOffset();
// set the position and limit for copying
this.oWsBBDirect.limit(cacheLimit);
this.oWsBBDirect.position(cachePosition);
// copy the bytes from position to limit
this.oWsBBDirect.put(oByteBuffer.array(), cachePosition + offset, cacheLimit - cachePosition);
// reset the position
this.oWsBBDirect.position(cachePosition);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "copyToDirectBuffer, exit point 4"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void checkAllowedInRealTime0(Object obj, int depth) throws InvalidClassException {
if (depth >= MethodFrameCounter.MAX_STACK_DEPTH) { //todo: correct >? or >=?
throw new RuntimeException();
}
Class<?> clazz = obj.getClass();
if (clazz.getName().startsWith("java.") || clazz.getName().startsWith("javax.")) {
checkAllowedInCompileTimeJdkType(clazz);
} else {
checkAllowedInCompileTimeCustomType(clazz);
}
// array
if (clazz.isArray()) {
final int length = Array.getLength(obj);
for (int k = 0; k < length; k++) {
Object elem = Array.get(obj, k);
checkAllowedInRealTime0(elem, depth + 1);
}
}
// Collection
if (Collection.class.isAssignableFrom(clazz)) {
for (Object elem : ((Collection) obj)) {
checkAllowedInRealTime0(elem, depth + 1);
}
}
// Map
if (Map.class.isAssignableFrom(clazz)) {
for (Map.Entry<Object, Object> elem : ((Map<Object, Object>) obj).entrySet()) {
checkAllowedInRealTime0(elem.getKey(), depth + 1);
checkAllowedInRealTime0(elem.getValue(), depth + 1);
}
}
} } | public class class_name {
private static void checkAllowedInRealTime0(Object obj, int depth) throws InvalidClassException {
if (depth >= MethodFrameCounter.MAX_STACK_DEPTH) { //todo: correct >? or >=?
throw new RuntimeException();
}
Class<?> clazz = obj.getClass();
if (clazz.getName().startsWith("java.") || clazz.getName().startsWith("javax.")) {
checkAllowedInCompileTimeJdkType(clazz);
} else {
checkAllowedInCompileTimeCustomType(clazz);
}
// array
if (clazz.isArray()) {
final int length = Array.getLength(obj);
for (int k = 0; k < length; k++) {
Object elem = Array.get(obj, k);
checkAllowedInRealTime0(elem, depth + 1); // depends on control dependency: [for], data = [none]
}
}
// Collection
if (Collection.class.isAssignableFrom(clazz)) {
for (Object elem : ((Collection) obj)) {
checkAllowedInRealTime0(elem, depth + 1); // depends on control dependency: [for], data = [elem]
}
}
// Map
if (Map.class.isAssignableFrom(clazz)) {
for (Map.Entry<Object, Object> elem : ((Map<Object, Object>) obj).entrySet()) {
checkAllowedInRealTime0(elem.getKey(), depth + 1); // depends on control dependency: [for], data = [elem]
checkAllowedInRealTime0(elem.getValue(), depth + 1); // depends on control dependency: [for], data = [elem]
}
}
} } |
public class class_name {
public ScheduledFuture<?> schedule(Options options, Runnable task) {
if (!started) {
startThreads();
}
DelayedTask t = new DelayedTask(clock, options, task);
queue.put(t);
return t;
} } | public class class_name {
public ScheduledFuture<?> schedule(Options options, Runnable task) {
if (!started) {
startThreads(); // depends on control dependency: [if], data = [none]
}
DelayedTask t = new DelayedTask(clock, options, task);
queue.put(t);
return t;
} } |
public class class_name {
public void click() {
assertElementNotStale();
assertElementDisplayed();
parent.getScopeServices().captureOperaIdle();
if (getTagName().equals("OPTION")) {
callMethod("return " + OperaAtom.CLICK + "(locator)");
} else {
parent.getMouse().click(getCoordinates());
}
try {
parent.waitForLoadToComplete();
} catch (ResponseNotReceivedException e) {
// This might be expected
logger.fine("Response not received, returning control to user");
}
} } | public class class_name {
public void click() {
assertElementNotStale();
assertElementDisplayed();
parent.getScopeServices().captureOperaIdle();
if (getTagName().equals("OPTION")) {
callMethod("return " + OperaAtom.CLICK + "(locator)");
} else {
parent.getMouse().click(getCoordinates()); // depends on control dependency: [if], data = [none]
}
try {
parent.waitForLoadToComplete(); // depends on control dependency: [try], data = [none]
} catch (ResponseNotReceivedException e) {
// This might be expected
logger.fine("Response not received, returning control to user");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected String extractFileContent(final String filename)
throws IOException {
final StringBuilder sb = new StringBuilder();
String temp = "";
final BufferedReader bufferedReader = new BufferedReader(
new FileReader(filename));
try {
while (temp != null) {
temp = bufferedReader.readLine();
if (temp != null) {
sb.append(temp);
}
}
return sb.toString();
} finally {
bufferedReader.close();
}
} } | public class class_name {
protected String extractFileContent(final String filename)
throws IOException {
final StringBuilder sb = new StringBuilder();
String temp = "";
final BufferedReader bufferedReader = new BufferedReader(
new FileReader(filename));
try {
while (temp != null) {
temp = bufferedReader.readLine(); // depends on control dependency: [while], data = [none]
if (temp != null) {
sb.append(temp); // depends on control dependency: [if], data = [(temp]
}
}
return sb.toString();
} finally {
bufferedReader.close();
}
} } |
public class class_name {
public Set<CmsPublishedResource> getExportResources(CmsObject cms) throws CmsException {
Set<CmsPublishedResource> resources = new HashSet<CmsPublishedResource>(128);
Iterator<String> itExpRes = m_exportResources.iterator();
while (itExpRes.hasNext()) {
String exportRes = itExpRes.next();
// read all from the configured node path, exclude resources flagged as internal
if (cms.existsResource(exportRes)) {
// first add the resource itself
CmsResource res = cms.readResource(exportRes);
resources.add(new CmsPublishedResource(res));
if (res.isFolder()) {
// if the resource is a folder add also all sub-resources
List<CmsResource> vfsResources = cms.readResources(
exportRes,
CmsResourceFilter.ALL.addExcludeFlags(CmsResource.FLAG_INTERNAL));
// loop through the list and create the list of CmsPublishedResources
Iterator<CmsResource> itRes = vfsResources.iterator();
while (itRes.hasNext()) {
CmsResource vfsResource = itRes.next();
CmsPublishedResource resource = new CmsPublishedResource(vfsResource);
resources.add(resource);
}
}
}
}
return resources;
} } | public class class_name {
public Set<CmsPublishedResource> getExportResources(CmsObject cms) throws CmsException {
Set<CmsPublishedResource> resources = new HashSet<CmsPublishedResource>(128);
Iterator<String> itExpRes = m_exportResources.iterator();
while (itExpRes.hasNext()) {
String exportRes = itExpRes.next();
// read all from the configured node path, exclude resources flagged as internal
if (cms.existsResource(exportRes)) {
// first add the resource itself
CmsResource res = cms.readResource(exportRes);
resources.add(new CmsPublishedResource(res));
if (res.isFolder()) {
// if the resource is a folder add also all sub-resources
List<CmsResource> vfsResources = cms.readResources(
exportRes,
CmsResourceFilter.ALL.addExcludeFlags(CmsResource.FLAG_INTERNAL));
// loop through the list and create the list of CmsPublishedResources
Iterator<CmsResource> itRes = vfsResources.iterator();
while (itRes.hasNext()) {
CmsResource vfsResource = itRes.next();
CmsPublishedResource resource = new CmsPublishedResource(vfsResource);
resources.add(resource); // depends on control dependency: [while], data = [none]
}
}
}
}
return resources;
} } |
public class class_name {
public void marshall(IntegerParameterRangeSpecification integerParameterRangeSpecification, ProtocolMarshaller protocolMarshaller) {
if (integerParameterRangeSpecification == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(integerParameterRangeSpecification.getMinValue(), MINVALUE_BINDING);
protocolMarshaller.marshall(integerParameterRangeSpecification.getMaxValue(), MAXVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(IntegerParameterRangeSpecification integerParameterRangeSpecification, ProtocolMarshaller protocolMarshaller) {
if (integerParameterRangeSpecification == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(integerParameterRangeSpecification.getMinValue(), MINVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(integerParameterRangeSpecification.getMaxValue(), MAXVALUE_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 {
Table REFERENTIAL_CONSTRAINTS() {
Table t = sysTables[REFERENTIAL_CONSTRAINTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[REFERENTIAL_CONSTRAINTS]);
addColumn(t, "CONSTRAINT_CATALOG", SQL_IDENTIFIER);
addColumn(t, "CONSTRAINT_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "CONSTRAINT_NAME", SQL_IDENTIFIER); // not null
addColumn(t, "UNIQUE_CONSTRAINT_CATALOG", SQL_IDENTIFIER); // not null
addColumn(t, "UNIQUE_CONSTRAINT_SCHEMA", SQL_IDENTIFIER);
addColumn(t, "UNIQUE_CONSTRAINT_NAME", SQL_IDENTIFIER);
addColumn(t, "MATCH_OPTION", CHARACTER_DATA); // not null
addColumn(t, "UPDATE_RULE", CHARACTER_DATA); // not null
addColumn(t, "DELETE_RULE", CHARACTER_DATA); // not null
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[REFERENTIAL_CONSTRAINTS].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] {
0, 1, 2,
}, false);
return t;
}
// column number mappings
final int constraint_catalog = 0;
final int constraint_schema = 1;
final int constraint_name = 2;
final int unique_constraint_catalog = 3;
final int unique_constraint_schema = 4;
final int unique_constraint_name = 5;
final int match_option = 6;
final int update_rule = 7;
final int delete_rule = 8;
//
PersistentStore store = database.persistentStoreCollection.getStore(t);
Iterator tables;
Table table;
Constraint[] constraints;
Constraint constraint;
Object[] row;
tables =
database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
while (tables.hasNext()) {
table = (Table) tables.next();
if (table.isView()
|| !session.getGrantee().hasNonSelectTableRight(table)) {
continue;
}
constraints = table.getConstraints();
for (int i = 0; i < constraints.length; i++) {
constraint = constraints[i];
if (constraint.getConstraintType() != Constraint.FOREIGN_KEY) {
continue;
}
HsqlName uniqueName = constraint.getUniqueName();
row = t.getEmptyRowData();
row[constraint_catalog] = database.getCatalogName().name;
row[constraint_schema] = constraint.getSchemaName().name;
row[constraint_name] = constraint.getName().name;
if (isAccessibleTable(constraint.getMain())) {
row[unique_constraint_catalog] =
database.getCatalogName().name;
row[unique_constraint_schema] = uniqueName.schema.name;
row[unique_constraint_name] = uniqueName.name;
}
row[match_option] = Tokens.T_NONE;
row[update_rule] = constraint.getUpdateActionString();
row[delete_rule] = constraint.getDeleteActionString();
t.insertSys(store, row);
}
}
return t;
} } | public class class_name {
Table REFERENTIAL_CONSTRAINTS() {
Table t = sysTables[REFERENTIAL_CONSTRAINTS];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[REFERENTIAL_CONSTRAINTS]); // depends on control dependency: [if], data = [none]
addColumn(t, "CONSTRAINT_CATALOG", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t]
addColumn(t, "CONSTRAINT_SCHEMA", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t]
addColumn(t, "CONSTRAINT_NAME", SQL_IDENTIFIER); // not null // depends on control dependency: [if], data = [(t]
addColumn(t, "UNIQUE_CONSTRAINT_CATALOG", SQL_IDENTIFIER); // not null // depends on control dependency: [if], data = [(t]
addColumn(t, "UNIQUE_CONSTRAINT_SCHEMA", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t]
addColumn(t, "UNIQUE_CONSTRAINT_NAME", SQL_IDENTIFIER); // depends on control dependency: [if], data = [(t]
addColumn(t, "MATCH_OPTION", CHARACTER_DATA); // not null // depends on control dependency: [if], data = [(t]
addColumn(t, "UPDATE_RULE", CHARACTER_DATA); // not null // depends on control dependency: [if], data = [(t]
addColumn(t, "DELETE_RULE", CHARACTER_DATA); // not null // depends on control dependency: [if], data = [(t]
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[REFERENTIAL_CONSTRAINTS].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] {
0, 1, 2,
}, false); // depends on control dependency: [if], data = [none]
return t; // depends on control dependency: [if], data = [none]
}
// column number mappings
final int constraint_catalog = 0;
final int constraint_schema = 1;
final int constraint_name = 2;
final int unique_constraint_catalog = 3;
final int unique_constraint_schema = 4;
final int unique_constraint_name = 5;
final int match_option = 6;
final int update_rule = 7;
final int delete_rule = 8;
//
PersistentStore store = database.persistentStoreCollection.getStore(t);
Iterator tables;
Table table;
Constraint[] constraints;
Constraint constraint;
Object[] row;
tables =
database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);
while (tables.hasNext()) {
table = (Table) tables.next(); // depends on control dependency: [while], data = [none]
if (table.isView()
|| !session.getGrantee().hasNonSelectTableRight(table)) {
continue;
}
constraints = table.getConstraints(); // depends on control dependency: [while], data = [none]
for (int i = 0; i < constraints.length; i++) {
constraint = constraints[i]; // depends on control dependency: [for], data = [i]
if (constraint.getConstraintType() != Constraint.FOREIGN_KEY) {
continue;
}
HsqlName uniqueName = constraint.getUniqueName();
row = t.getEmptyRowData(); // depends on control dependency: [for], data = [none]
row[constraint_catalog] = database.getCatalogName().name; // depends on control dependency: [for], data = [none]
row[constraint_schema] = constraint.getSchemaName().name; // depends on control dependency: [for], data = [none]
row[constraint_name] = constraint.getName().name; // depends on control dependency: [for], data = [none]
if (isAccessibleTable(constraint.getMain())) {
row[unique_constraint_catalog] =
database.getCatalogName().name; // depends on control dependency: [if], data = [none]
row[unique_constraint_schema] = uniqueName.schema.name; // depends on control dependency: [if], data = [none]
row[unique_constraint_name] = uniqueName.name; // depends on control dependency: [if], data = [none]
}
row[match_option] = Tokens.T_NONE; // depends on control dependency: [for], data = [none]
row[update_rule] = constraint.getUpdateActionString(); // depends on control dependency: [for], data = [none]
row[delete_rule] = constraint.getDeleteActionString(); // depends on control dependency: [for], data = [none]
t.insertSys(store, row); // depends on control dependency: [for], data = [none]
}
}
return t;
} } |
public class class_name {
public static List<Image> getImagesList( IHMConnection connection ) throws Exception {
List<Image> images = new ArrayList<Image>();
String sql = "select " + //
ImageTableFields.COLUMN_ID.getFieldName() + "," + //
ImageTableFields.COLUMN_LON.getFieldName() + "," + //
ImageTableFields.COLUMN_LAT.getFieldName() + "," + //
ImageTableFields.COLUMN_ALTIM.getFieldName() + "," + //
ImageTableFields.COLUMN_TS.getFieldName() + "," + //
ImageTableFields.COLUMN_AZIM.getFieldName() + "," + //
ImageTableFields.COLUMN_TEXT.getFieldName() + "," + //
ImageTableFields.COLUMN_NOTE_ID.getFieldName() + "," + //
ImageTableFields.COLUMN_IMAGEDATA_ID.getFieldName() + //
" from " + TABLE_IMAGES;
try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(sql);) {
statement.setQueryTimeout(30); // set timeout to 30 sec.
while( rs.next() ) {
long id = rs.getLong(1);
double lon = rs.getDouble(2);
double lat = rs.getDouble(3);
double altim = rs.getDouble(4);
long ts = rs.getLong(5);
double azim = rs.getDouble(6);
String text = rs.getString(7);
long noteId = rs.getLong(8);
long imageDataId = rs.getLong(9);
Image image = new Image(id, text, lon, lat, altim, azim, imageDataId, noteId, ts);
images.add(image);
}
}
return images;
} } | public class class_name {
public static List<Image> getImagesList( IHMConnection connection ) throws Exception {
List<Image> images = new ArrayList<Image>();
String sql = "select " + //
ImageTableFields.COLUMN_ID.getFieldName() + "," + //
ImageTableFields.COLUMN_LON.getFieldName() + "," + //
ImageTableFields.COLUMN_LAT.getFieldName() + "," + //
ImageTableFields.COLUMN_ALTIM.getFieldName() + "," + //
ImageTableFields.COLUMN_TS.getFieldName() + "," + //
ImageTableFields.COLUMN_AZIM.getFieldName() + "," + //
ImageTableFields.COLUMN_TEXT.getFieldName() + "," + //
ImageTableFields.COLUMN_NOTE_ID.getFieldName() + "," + //
ImageTableFields.COLUMN_IMAGEDATA_ID.getFieldName() + //
" from " + TABLE_IMAGES;
try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(sql);) {
statement.setQueryTimeout(30); // set timeout to 30 sec.
while( rs.next() ) {
long id = rs.getLong(1);
double lon = rs.getDouble(2);
double lat = rs.getDouble(3);
double altim = rs.getDouble(4);
long ts = rs.getLong(5);
double azim = rs.getDouble(6);
String text = rs.getString(7);
long noteId = rs.getLong(8);
long imageDataId = rs.getLong(9);
Image image = new Image(id, text, lon, lat, altim, azim, imageDataId, noteId, ts);
images.add(image); // depends on control dependency: [while], data = [none]
}
}
return images;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
throwIfCancelled();
P res = null;
long remainingWait = timeout;
waitStart = System.currentTimeMillis();
while (remainingWait > 0 && connectionException == null && !cancelled) {
synchronized (this) {
res = (P) resultQueue.poll();
if (res != null) {
return res;
}
wait(remainingWait);
}
remainingWait = timeout - (System.currentTimeMillis() - waitStart);
}
return res;
} } | public class class_name {
@SuppressWarnings("unchecked")
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
throwIfCancelled();
P res = null;
long remainingWait = timeout;
waitStart = System.currentTimeMillis();
while (remainingWait > 0 && connectionException == null && !cancelled) {
synchronized (this) {
res = (P) resultQueue.poll();
if (res != null) {
return res; // depends on control dependency: [if], data = [none]
}
wait(remainingWait);
}
remainingWait = timeout - (System.currentTimeMillis() - waitStart);
}
return res;
} } |
public class class_name {
@Override
public List<byte[]> lRange(byte[] key, long start, long end) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.lrange(key, start, end)));
return null;
}
return client.lrange(key, start, end);
} catch (Exception ex) {
throw convertException(ex);
}
} } | public class class_name {
@Override
public List<byte[]> lRange(byte[] key, long start, long end) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.lrange(key, start, end))); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return client.lrange(key, start, end); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw convertException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EList<JvmTypeParameter> getTypeParameters()
{
if (typeParameters == null)
{
typeParameters = new EObjectContainmentWithInverseEList<JvmTypeParameter>(JvmTypeParameter.class, this, TypesPackage.JVM_EXECUTABLE__TYPE_PARAMETERS, TypesPackage.JVM_TYPE_PARAMETER__DECLARATOR);
}
return typeParameters;
} } | public class class_name {
public EList<JvmTypeParameter> getTypeParameters()
{
if (typeParameters == null)
{
typeParameters = new EObjectContainmentWithInverseEList<JvmTypeParameter>(JvmTypeParameter.class, this, TypesPackage.JVM_EXECUTABLE__TYPE_PARAMETERS, TypesPackage.JVM_TYPE_PARAMETER__DECLARATOR); // depends on control dependency: [if], data = [none]
}
return typeParameters;
} } |
public class class_name {
public BooleanExpr expand(BooleanExpr booleanExpr) {
if (booleanExpr == null || booleanExpr instanceof ConstantBooleanExpr) {
return booleanExpr;
}
Collector collector = new Collector();
booleanExpr.acceptVisitor(collector);
if (!collector.foundIndexed) {
return ConstantBooleanExpr.TRUE;
}
if (!collector.predicatesToRemove.isEmpty()) {
int numCofactors = 1;
for (PrimaryPredicateExpr e : collector.predicatesToRemove) {
Replacer replacer1 = new Replacer(e, ConstantBooleanExpr.TRUE);
BooleanExpr e1 = booleanExpr.acceptVisitor(replacer1);
if (!replacer1.found) {
continue;
}
if (e1 == ConstantBooleanExpr.TRUE) {
return ConstantBooleanExpr.TRUE;
}
Replacer replacer2 = new Replacer(e, ConstantBooleanExpr.FALSE);
BooleanExpr e2 = booleanExpr.acceptVisitor(replacer2);
if (e2 == ConstantBooleanExpr.TRUE) {
return ConstantBooleanExpr.TRUE;
}
if (e1 == ConstantBooleanExpr.FALSE) {
booleanExpr = e2;
} else if (e2 == ConstantBooleanExpr.FALSE) {
booleanExpr = e1;
} else {
numCofactors *= 2;
OrExpr disjunction;
if (e1 instanceof OrExpr) {
disjunction = (OrExpr) e1;
if (e2 instanceof OrExpr) {
disjunction.getChildren().addAll(((OrExpr) e2).getChildren());
} else {
disjunction.getChildren().add(e2);
}
} else if (e2 instanceof OrExpr) {
disjunction = (OrExpr) e2;
disjunction.getChildren().add(e1);
} else {
disjunction = new OrExpr(e1, e2);
}
PredicateOptimisations.optimizePredicates(disjunction.getChildren(), false);
booleanExpr = disjunction;
}
if (numCofactors > maxExpansionCofactors) {
// expansion is too big, it's better to do full scan rather than search the index with a huge and
// complex query that is a disjunction of many predicates so will very likely match everything anyway
return ConstantBooleanExpr.TRUE;
}
}
}
return booleanExpr;
} } | public class class_name {
public BooleanExpr expand(BooleanExpr booleanExpr) {
if (booleanExpr == null || booleanExpr instanceof ConstantBooleanExpr) {
return booleanExpr; // depends on control dependency: [if], data = [none]
}
Collector collector = new Collector();
booleanExpr.acceptVisitor(collector);
if (!collector.foundIndexed) {
return ConstantBooleanExpr.TRUE; // depends on control dependency: [if], data = [none]
}
if (!collector.predicatesToRemove.isEmpty()) {
int numCofactors = 1;
for (PrimaryPredicateExpr e : collector.predicatesToRemove) {
Replacer replacer1 = new Replacer(e, ConstantBooleanExpr.TRUE);
BooleanExpr e1 = booleanExpr.acceptVisitor(replacer1);
if (!replacer1.found) {
continue;
}
if (e1 == ConstantBooleanExpr.TRUE) {
return ConstantBooleanExpr.TRUE; // depends on control dependency: [if], data = [none]
}
Replacer replacer2 = new Replacer(e, ConstantBooleanExpr.FALSE);
BooleanExpr e2 = booleanExpr.acceptVisitor(replacer2);
if (e2 == ConstantBooleanExpr.TRUE) {
return ConstantBooleanExpr.TRUE; // depends on control dependency: [if], data = [none]
}
if (e1 == ConstantBooleanExpr.FALSE) {
booleanExpr = e2; // depends on control dependency: [if], data = [none]
} else if (e2 == ConstantBooleanExpr.FALSE) {
booleanExpr = e1; // depends on control dependency: [if], data = [none]
} else {
numCofactors *= 2; // depends on control dependency: [if], data = [none]
OrExpr disjunction;
if (e1 instanceof OrExpr) {
disjunction = (OrExpr) e1; // depends on control dependency: [if], data = [none]
if (e2 instanceof OrExpr) {
disjunction.getChildren().addAll(((OrExpr) e2).getChildren()); // depends on control dependency: [if], data = [none]
} else {
disjunction.getChildren().add(e2); // depends on control dependency: [if], data = [none]
}
} else if (e2 instanceof OrExpr) {
disjunction = (OrExpr) e2; // depends on control dependency: [if], data = [none]
disjunction.getChildren().add(e1); // depends on control dependency: [if], data = [none]
} else {
disjunction = new OrExpr(e1, e2); // depends on control dependency: [if], data = [none]
}
PredicateOptimisations.optimizePredicates(disjunction.getChildren(), false); // depends on control dependency: [if], data = [none]
booleanExpr = disjunction; // depends on control dependency: [if], data = [none]
}
if (numCofactors > maxExpansionCofactors) {
// expansion is too big, it's better to do full scan rather than search the index with a huge and
// complex query that is a disjunction of many predicates so will very likely match everything anyway
return ConstantBooleanExpr.TRUE; // depends on control dependency: [if], data = [none]
}
}
}
return booleanExpr;
} } |
public class class_name {
public boolean execute(Sql sql) throws SQLException {
long start = System.currentTimeMillis();
if (sql.validate() == false) {
return false;
}
boolean result = false;
PreparedStatement stmt = null;
try {
stmt = this.createStatment(conn, sql);
stmt.execute();
result = true;
} catch (SQLException e) {
throw e;
} finally {
try {
if (stmt != null && stmt.isClosed() == false) {
stmt.close();
}
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
}
logger.debug(String.format("Execute %s used %d ms", sql.getSql(), System.currentTimeMillis() - start));
return result;
} } | public class class_name {
public boolean execute(Sql sql) throws SQLException {
long start = System.currentTimeMillis();
if (sql.validate() == false) {
return false;
}
boolean result = false;
PreparedStatement stmt = null;
try {
stmt = this.createStatment(conn, sql);
stmt.execute();
result = true;
} catch (SQLException e) {
throw e;
} finally {
try {
if (stmt != null && stmt.isClosed() == false) {
stmt.close();
// depends on control dependency: [if], data = [none]
}
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
}
logger.debug(String.format("Execute %s used %d ms", sql.getSql(), System.currentTimeMillis() - start));
return result;
} } |
public class class_name {
@Override
public Map<String, String> getValues(String variableContains) {
final Map<String, String> variableSelection = new HashMap<>();
String key;
for (Map.Entry<Descriptors.FieldDescriptor, Object> fieldEntry : message.getAllFields().entrySet()) {
key = StringProcessor.transformToUpperCase(fieldEntry.getKey().getName());
if (key.contains(variableContains) || (StringProcessor.transformToUpperCase(message.getClass().getSimpleName()) + "/" + key).contains(variableContains)) {
if (!fieldEntry.getValue().toString().isEmpty()) {
variableSelection.put(key, fieldEntry.getValue().toString());
}
}
}
return variableSelection;
} } | public class class_name {
@Override
public Map<String, String> getValues(String variableContains) {
final Map<String, String> variableSelection = new HashMap<>();
String key;
for (Map.Entry<Descriptors.FieldDescriptor, Object> fieldEntry : message.getAllFields().entrySet()) {
key = StringProcessor.transformToUpperCase(fieldEntry.getKey().getName()); // depends on control dependency: [for], data = [fieldEntry]
if (key.contains(variableContains) || (StringProcessor.transformToUpperCase(message.getClass().getSimpleName()) + "/" + key).contains(variableContains)) {
if (!fieldEntry.getValue().toString().isEmpty()) {
variableSelection.put(key, fieldEntry.getValue().toString()); // depends on control dependency: [if], data = [none]
}
}
}
return variableSelection;
} } |
public class class_name {
private BaseVideoFrame getAvailableVideoFrame() {
BaseVideoFrame frame = null;
// block until a video frame is available
synchronized (availableVideoFrames) {
while (availableVideoFrames.size() == 0)
try {
availableVideoFrames.wait();
} catch (InterruptedException e) {
throw new StateException("Interrupted while waiting for a video frame", e);
}
// get the video frame
frame = availableVideoFrames.remove(0);
}
return frame;
} } | public class class_name {
private BaseVideoFrame getAvailableVideoFrame() {
BaseVideoFrame frame = null;
// block until a video frame is available
synchronized (availableVideoFrames) {
while (availableVideoFrames.size() == 0)
try {
availableVideoFrames.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new StateException("Interrupted while waiting for a video frame", e);
} // depends on control dependency: [catch], data = [none]
// get the video frame
frame = availableVideoFrames.remove(0);
}
return frame;
} } |
public class class_name {
private static Environment of(@NonNull InputStream is) {
try {
var environment = new Environment();
environment.props.load(new InputStreamReader(is, "UTF-8"));
return environment;
} catch (IOException e) {
throw new IllegalStateException(e);
} finally {
IOKit.closeQuietly(is);
}
} } | public class class_name {
private static Environment of(@NonNull InputStream is) {
try {
var environment = new Environment();
environment.props.load(new InputStreamReader(is, "UTF-8")); // depends on control dependency: [try], data = [none]
return environment; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalStateException(e);
} finally { // depends on control dependency: [catch], data = [none]
IOKit.closeQuietly(is);
}
} } |
public class class_name {
private void timeout() {
lock.writeLock().lock();
try {
//if already stopped, do nothing, otherwise check times and run the timeout task
if (!this.stopped) {
long now = System.nanoTime();
long remaining = this.targetEnd - now;
this.timedout = remaining <= FTConstants.MIN_TIMEOUT_NANO;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("!Start {0}", this.start);
debugTime("!Target {0}", this.targetEnd);
debugTime("!Now {0}", now);
debugTime("!Remain {0}", remaining);
}
//if we really have timedout then run the timeout task
if (this.timedout) {
debugRelativeTime("Timeout!");
this.timeoutTask.run();
} else {
//this shouldn't be possible but if the timer popped too early, restart it
debugTime("Premature Timeout!", remaining);
start(this.timeoutTask, remaining);
}
}
} finally {
lock.writeLock().unlock();
}
} } | public class class_name {
private void timeout() {
lock.writeLock().lock();
try {
//if already stopped, do nothing, otherwise check times and run the timeout task
if (!this.stopped) {
long now = System.nanoTime();
long remaining = this.targetEnd - now;
this.timedout = remaining <= FTConstants.MIN_TIMEOUT_NANO; // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
debugTime("!Start {0}", this.start); // depends on control dependency: [if], data = [none]
debugTime("!Target {0}", this.targetEnd); // depends on control dependency: [if], data = [none]
debugTime("!Now {0}", now); // depends on control dependency: [if], data = [none]
debugTime("!Remain {0}", remaining); // depends on control dependency: [if], data = [none]
}
//if we really have timedout then run the timeout task
if (this.timedout) {
debugRelativeTime("Timeout!"); // depends on control dependency: [if], data = [none]
this.timeoutTask.run(); // depends on control dependency: [if], data = [none]
} else {
//this shouldn't be possible but if the timer popped too early, restart it
debugTime("Premature Timeout!", remaining); // depends on control dependency: [if], data = [none]
start(this.timeoutTask, remaining); // depends on control dependency: [if], data = [none]
}
}
} finally {
lock.writeLock().unlock();
}
} } |
public class class_name {
static private Type resolveTypeVariable (Class fromClass, Class current, Type type, boolean first) {
Type genericSuper = current.getGenericSuperclass();
if (!(genericSuper instanceof ParameterizedType)) return type; // No type arguments passed to super class.
// Search fromClass to current inclusive, using the call stack to traverse the class hierarchy in super class first order.
Class superClass = current.getSuperclass();
if (superClass != fromClass) {
Type resolved = resolveTypeVariable(fromClass, superClass, type, false);
if (resolved instanceof Class) return (Class)resolved; // Resolved in a super class.
type = resolved;
}
// Match the type variable name to the super class parameter.
String name = type.toString(); // Java 8: getTypeName
TypeVariable[] params = superClass.getTypeParameters();
for (int i = 0, n = params.length; i < n; i++) {
TypeVariable param = params[i];
if (param.getName().equals(name)) {
// Use the super class' type variable index to find the actual class in the sub class declaration.
Type arg = ((ParameterizedType)genericSuper).getActualTypeArguments()[i];
// Success, the type variable was explicitly declared.
if (arg instanceof Class) return (Class)arg;
if (arg instanceof ParameterizedType) return resolveType(fromClass, current, arg);
if (arg instanceof TypeVariable) {
if (first) return type; // Failure, no more sub classes.
return arg; // Look for the new type variable in the next sub class.
}
}
}
// If this happens, there is a case we need to handle.
throw new KryoException("Unable to resolve type variable: " + type);
} } | public class class_name {
static private Type resolveTypeVariable (Class fromClass, Class current, Type type, boolean first) {
Type genericSuper = current.getGenericSuperclass();
if (!(genericSuper instanceof ParameterizedType)) return type; // No type arguments passed to super class.
// Search fromClass to current inclusive, using the call stack to traverse the class hierarchy in super class first order.
Class superClass = current.getSuperclass();
if (superClass != fromClass) {
Type resolved = resolveTypeVariable(fromClass, superClass, type, false);
if (resolved instanceof Class) return (Class)resolved; // Resolved in a super class.
type = resolved; // depends on control dependency: [if], data = [none]
}
// Match the type variable name to the super class parameter.
String name = type.toString(); // Java 8: getTypeName
TypeVariable[] params = superClass.getTypeParameters();
for (int i = 0, n = params.length; i < n; i++) {
TypeVariable param = params[i];
if (param.getName().equals(name)) {
// Use the super class' type variable index to find the actual class in the sub class declaration.
Type arg = ((ParameterizedType)genericSuper).getActualTypeArguments()[i];
// Success, the type variable was explicitly declared.
if (arg instanceof Class) return (Class)arg;
if (arg instanceof ParameterizedType) return resolveType(fromClass, current, arg);
if (arg instanceof TypeVariable) {
if (first) return type; // Failure, no more sub classes.
return arg; // Look for the new type variable in the next sub class. // depends on control dependency: [if], data = [none]
}
}
}
// If this happens, there is a case we need to handle.
throw new KryoException("Unable to resolve type variable: " + type);
} } |
public class class_name {
public void select(String[] optionLocators) {
for (int i = 0; i < optionLocators.length; i++) {
select(optionLocators[i]);
}
} } | public class class_name {
public void select(String[] optionLocators) {
for (int i = 0; i < optionLocators.length; i++) {
select(optionLocators[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@Override
public void process(@NotNull final Bytes in, @NotNull final Bytes out, final N nc) {
if (!handshakeComplete) {
try {
doHandshake(nc);
} catch (Throwable t) {
LOGGER.error("Failed to complete SSL handshake at " + Instant.now(), t);
throw new IllegalStateException("Unable to perform handshake", t);
}
handshakeComplete = true;
}
bufferHandler.set(delegate, in, out, nc);
stateMachine.action();
} } | public class class_name {
@Override
public void process(@NotNull final Bytes in, @NotNull final Bytes out, final N nc) {
if (!handshakeComplete) {
try {
doHandshake(nc); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOGGER.error("Failed to complete SSL handshake at " + Instant.now(), t);
throw new IllegalStateException("Unable to perform handshake", t);
} // depends on control dependency: [catch], data = [none]
handshakeComplete = true; // depends on control dependency: [if], data = [none]
}
bufferHandler.set(delegate, in, out, nc);
stateMachine.action();
} } |
public class class_name {
public static <T> T getServiceOrElse(final Class<T> intf, final T defaultObj)
{
Objects.requireNonNull(intf);
final T ret;
List<T> implementations = getServices(intf);
if (implementations.isEmpty()) {
return defaultObj;
} else {
ret = implementations.get(0);
}
if (implementations.size() > 1) {
LOG.warn("There is more than one implementation of {} available on the classpath, taking the first available", intf);
}
LOG.info("Detected component implementation {}", ret.getClass().getSimpleName());
return ret;
} } | public class class_name {
public static <T> T getServiceOrElse(final Class<T> intf, final T defaultObj)
{
Objects.requireNonNull(intf);
final T ret;
List<T> implementations = getServices(intf);
if (implementations.isEmpty()) {
return defaultObj; // depends on control dependency: [if], data = [none]
} else {
ret = implementations.get(0); // depends on control dependency: [if], data = [none]
}
if (implementations.size() > 1) {
LOG.warn("There is more than one implementation of {} available on the classpath, taking the first available", intf); // depends on control dependency: [if], data = [none]
}
LOG.info("Detected component implementation {}", ret.getClass().getSimpleName());
return ret;
} } |
public class class_name {
protected static Element getChildElement(final Element parent, final String tagName) {
List<Element> elements = getElements(parent, tagName);
if (elements.size() > 0) {
return elements.get(0);
} else {
return null;
}
} } | public class class_name {
protected static Element getChildElement(final Element parent, final String tagName) {
List<Element> elements = getElements(parent, tagName);
if (elements.size() > 0) {
return elements.get(0);
// depends on control dependency: [if], data = [0)]
} else {
return null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Nullable
public Controller getController(int position) {
String instanceId = visiblePageIds.get(position);
if (instanceId != null) {
return host.getRouter().getControllerWithInstanceId(instanceId);
} else {
return null;
}
} } | public class class_name {
@Nullable
public Controller getController(int position) {
String instanceId = visiblePageIds.get(position);
if (instanceId != null) {
return host.getRouter().getControllerWithInstanceId(instanceId); // depends on control dependency: [if], data = [(instanceId]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(PurchaseReservedElasticsearchInstanceOfferingRequest purchaseReservedElasticsearchInstanceOfferingRequest,
ProtocolMarshaller protocolMarshaller) {
if (purchaseReservedElasticsearchInstanceOfferingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getReservedElasticsearchInstanceOfferingId(),
RESERVEDELASTICSEARCHINSTANCEOFFERINGID_BINDING);
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getReservationName(), RESERVATIONNAME_BINDING);
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getInstanceCount(), INSTANCECOUNT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PurchaseReservedElasticsearchInstanceOfferingRequest purchaseReservedElasticsearchInstanceOfferingRequest,
ProtocolMarshaller protocolMarshaller) {
if (purchaseReservedElasticsearchInstanceOfferingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getReservedElasticsearchInstanceOfferingId(),
RESERVEDELASTICSEARCHINSTANCEOFFERINGID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getReservationName(), RESERVATIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(purchaseReservedElasticsearchInstanceOfferingRequest.getInstanceCount(), INSTANCECOUNT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public SimpleOrderedMap<Object> create(ComponentKwic kwic, Boolean encode) {
SimpleOrderedMap<Object> mtasKwicResponse = new SimpleOrderedMap<>();
mtasKwicResponse.add("key", kwic.key);
ArrayList<NamedList<Object>> mtasKwicItemResponses = new ArrayList<>();
if (kwic.output.equals(ComponentKwic.KWIC_OUTPUT_HIT)) {
for (int docId : kwic.hits.keySet()) {
NamedList<Object> mtasKwicItemResponse = new SimpleOrderedMap<>();
List<KwicHit> list = kwic.hits.get(docId);
List<NamedList<Object>> mtasKwicItemResponseItems = new ArrayList<>();
for (KwicHit h : list) {
NamedList<Object> mtasKwicItemResponseItem = new SimpleOrderedMap<>();
SortedMap<Integer, List<List<String>>> hitData = new TreeMap<>();
SortedMap<Integer, List<List<String>>> leftData = null;
SortedMap<Integer, List<List<String>>> rightData = null;
if (kwic.left > 0) {
leftData = new TreeMap<>();
}
if (kwic.right > 0) {
rightData = new TreeMap<>();
}
for (int position = Math.max(0,
h.startPosition - kwic.left); position <= (h.endPosition
+ kwic.right); position++) {
if (h.hits.containsKey(position)) {
List<List<String>> hitDataItem = new ArrayList<>();
for (String term : h.hits.get(position)) {
List<String> hitDataSubItem = new ArrayList<>();
hitDataSubItem.add(CodecUtil.termPrefix(term));
hitDataSubItem.add(CodecUtil.termValue(term));
hitDataItem.add(hitDataSubItem);
}
if (position < h.startPosition) {
if (leftData != null) {
leftData.put(position, hitDataItem);
}
} else if (position > h.endPosition) {
if (rightData != null) {
rightData.put(position, hitDataItem);
}
} else {
hitData.put(position, hitDataItem);
}
}
}
if (kwic.left > 0) {
mtasKwicItemResponseItem.add("left", leftData);
}
mtasKwicItemResponseItem.add("hit", hitData);
if (kwic.right > 0) {
mtasKwicItemResponseItem.add("right", rightData);
}
mtasKwicItemResponseItems.add(mtasKwicItemResponseItem);
}
mtasKwicItemResponse.add("documentKey", kwic.uniqueKey.get(docId));
mtasKwicItemResponse.add("documentTotal", kwic.subTotal.get(docId));
mtasKwicItemResponse.add("documentMinPosition",
kwic.minPosition.get(docId));
mtasKwicItemResponse.add("documentMaxPosition",
kwic.maxPosition.get(docId));
mtasKwicItemResponse.add("list", mtasKwicItemResponseItems);
mtasKwicItemResponses.add(mtasKwicItemResponse);
}
} else if (kwic.output.equals(ComponentKwic.KWIC_OUTPUT_TOKEN)) {
for (int docId : kwic.tokens.keySet()) {
NamedList<Object> mtasKwicItemResponse = new SimpleOrderedMap<>();
List<KwicToken> list = kwic.tokens.get(docId);
List<NamedList<Object>> mtasKwicItemResponseItems = new ArrayList<>();
for (KwicToken k : list) {
NamedList<Object> mtasKwicItemResponseItem = new SimpleOrderedMap<>();
mtasKwicItemResponseItem.add("startPosition", k.startPosition);
mtasKwicItemResponseItem.add("endPosition", k.endPosition);
ArrayList<NamedList<Object>> mtasKwicItemResponseItemTokens = new ArrayList<>();
for (MtasToken token : k.tokens) {
NamedList<Object> mtasKwicItemResponseItemToken = new SimpleOrderedMap<>();
if (token.getId() != null) {
mtasKwicItemResponseItemToken.add("mtasId", token.getId());
}
mtasKwicItemResponseItemToken.add("prefix", token.getPrefix());
mtasKwicItemResponseItemToken.add("value", token.getPostfix());
if (token.getPositionStart() != null) {
mtasKwicItemResponseItemToken.add("positionStart",
token.getPositionStart());
mtasKwicItemResponseItemToken.add("positionEnd",
token.getPositionEnd());
}
if (token.getPositions() != null) {
mtasKwicItemResponseItemToken.add("positions",
Arrays.toString(token.getPositions()));
}
if (token.getParentId() != null) {
mtasKwicItemResponseItemToken.add("parentMtasId",
token.getParentId());
}
if (token.getPayload() != null) {
mtasKwicItemResponseItemToken.add("payload", token.getPayload());
}
if (token.getOffsetStart() != null) {
mtasKwicItemResponseItemToken.add("offsetStart",
token.getOffsetStart());
mtasKwicItemResponseItemToken.add("offsetEnd",
token.getOffsetEnd());
}
if (token.getRealOffsetStart() != null) {
mtasKwicItemResponseItemToken.add("realOffsetStart",
token.getRealOffsetStart());
mtasKwicItemResponseItemToken.add("realOffsetEnd",
token.getRealOffsetEnd());
}
mtasKwicItemResponseItemTokens.add(mtasKwicItemResponseItemToken);
}
mtasKwicItemResponseItem.add("tokens",
mtasKwicItemResponseItemTokens);
mtasKwicItemResponseItems.add(mtasKwicItemResponseItem);
}
mtasKwicItemResponse.add("documentKey", kwic.uniqueKey.get(docId));
mtasKwicItemResponse.add("documentTotal", kwic.subTotal.get(docId));
mtasKwicItemResponse.add("documentMinPosition",
kwic.minPosition.get(docId));
mtasKwicItemResponse.add("documentMaxPosition",
kwic.maxPosition.get(docId));
mtasKwicItemResponse.add("list", mtasKwicItemResponseItems);
mtasKwicItemResponses.add(mtasKwicItemResponse);
}
}
mtasKwicResponse.add("list", mtasKwicItemResponses);
return mtasKwicResponse;
} } | public class class_name {
public SimpleOrderedMap<Object> create(ComponentKwic kwic, Boolean encode) {
SimpleOrderedMap<Object> mtasKwicResponse = new SimpleOrderedMap<>();
mtasKwicResponse.add("key", kwic.key);
ArrayList<NamedList<Object>> mtasKwicItemResponses = new ArrayList<>();
if (kwic.output.equals(ComponentKwic.KWIC_OUTPUT_HIT)) {
for (int docId : kwic.hits.keySet()) {
NamedList<Object> mtasKwicItemResponse = new SimpleOrderedMap<>();
List<KwicHit> list = kwic.hits.get(docId);
List<NamedList<Object>> mtasKwicItemResponseItems = new ArrayList<>();
for (KwicHit h : list) {
NamedList<Object> mtasKwicItemResponseItem = new SimpleOrderedMap<>();
SortedMap<Integer, List<List<String>>> hitData = new TreeMap<>();
SortedMap<Integer, List<List<String>>> leftData = null;
SortedMap<Integer, List<List<String>>> rightData = null;
if (kwic.left > 0) {
leftData = new TreeMap<>(); // depends on control dependency: [if], data = [none]
}
if (kwic.right > 0) {
rightData = new TreeMap<>(); // depends on control dependency: [if], data = [none]
}
for (int position = Math.max(0,
h.startPosition - kwic.left); position <= (h.endPosition
+ kwic.right); position++) {
if (h.hits.containsKey(position)) {
List<List<String>> hitDataItem = new ArrayList<>();
for (String term : h.hits.get(position)) {
List<String> hitDataSubItem = new ArrayList<>();
hitDataSubItem.add(CodecUtil.termPrefix(term)); // depends on control dependency: [for], data = [term]
hitDataSubItem.add(CodecUtil.termValue(term)); // depends on control dependency: [for], data = [term]
hitDataItem.add(hitDataSubItem); // depends on control dependency: [for], data = [none]
}
if (position < h.startPosition) {
if (leftData != null) {
leftData.put(position, hitDataItem); // depends on control dependency: [if], data = [none]
}
} else if (position > h.endPosition) {
if (rightData != null) {
rightData.put(position, hitDataItem); // depends on control dependency: [if], data = [none]
}
} else {
hitData.put(position, hitDataItem); // depends on control dependency: [if], data = [(position]
}
}
}
if (kwic.left > 0) {
mtasKwicItemResponseItem.add("left", leftData); // depends on control dependency: [if], data = [none]
}
mtasKwicItemResponseItem.add("hit", hitData); // depends on control dependency: [for], data = [h]
if (kwic.right > 0) {
mtasKwicItemResponseItem.add("right", rightData); // depends on control dependency: [if], data = [none]
}
mtasKwicItemResponseItems.add(mtasKwicItemResponseItem); // depends on control dependency: [for], data = [none]
}
mtasKwicItemResponse.add("documentKey", kwic.uniqueKey.get(docId)); // depends on control dependency: [for], data = [docId]
mtasKwicItemResponse.add("documentTotal", kwic.subTotal.get(docId)); // depends on control dependency: [for], data = [docId]
mtasKwicItemResponse.add("documentMinPosition",
kwic.minPosition.get(docId)); // depends on control dependency: [for], data = [none]
mtasKwicItemResponse.add("documentMaxPosition",
kwic.maxPosition.get(docId)); // depends on control dependency: [for], data = [none]
mtasKwicItemResponse.add("list", mtasKwicItemResponseItems); // depends on control dependency: [for], data = [none]
mtasKwicItemResponses.add(mtasKwicItemResponse); // depends on control dependency: [for], data = [none]
}
} else if (kwic.output.equals(ComponentKwic.KWIC_OUTPUT_TOKEN)) {
for (int docId : kwic.tokens.keySet()) {
NamedList<Object> mtasKwicItemResponse = new SimpleOrderedMap<>();
List<KwicToken> list = kwic.tokens.get(docId);
List<NamedList<Object>> mtasKwicItemResponseItems = new ArrayList<>();
for (KwicToken k : list) {
NamedList<Object> mtasKwicItemResponseItem = new SimpleOrderedMap<>();
mtasKwicItemResponseItem.add("startPosition", k.startPosition); // depends on control dependency: [for], data = [k]
mtasKwicItemResponseItem.add("endPosition", k.endPosition); // depends on control dependency: [for], data = [k]
ArrayList<NamedList<Object>> mtasKwicItemResponseItemTokens = new ArrayList<>();
for (MtasToken token : k.tokens) {
NamedList<Object> mtasKwicItemResponseItemToken = new SimpleOrderedMap<>();
if (token.getId() != null) {
mtasKwicItemResponseItemToken.add("mtasId", token.getId()); // depends on control dependency: [if], data = [none]
}
mtasKwicItemResponseItemToken.add("prefix", token.getPrefix()); // depends on control dependency: [for], data = [token]
mtasKwicItemResponseItemToken.add("value", token.getPostfix()); // depends on control dependency: [for], data = [token]
if (token.getPositionStart() != null) {
mtasKwicItemResponseItemToken.add("positionStart",
token.getPositionStart()); // depends on control dependency: [if], data = [none]
mtasKwicItemResponseItemToken.add("positionEnd",
token.getPositionEnd()); // depends on control dependency: [if], data = [none]
}
if (token.getPositions() != null) {
mtasKwicItemResponseItemToken.add("positions",
Arrays.toString(token.getPositions())); // depends on control dependency: [if], data = [none]
}
if (token.getParentId() != null) {
mtasKwicItemResponseItemToken.add("parentMtasId",
token.getParentId()); // depends on control dependency: [if], data = [none]
}
if (token.getPayload() != null) {
mtasKwicItemResponseItemToken.add("payload", token.getPayload()); // depends on control dependency: [if], data = [none]
}
if (token.getOffsetStart() != null) {
mtasKwicItemResponseItemToken.add("offsetStart",
token.getOffsetStart()); // depends on control dependency: [if], data = [none]
mtasKwicItemResponseItemToken.add("offsetEnd",
token.getOffsetEnd()); // depends on control dependency: [if], data = [none]
}
if (token.getRealOffsetStart() != null) {
mtasKwicItemResponseItemToken.add("realOffsetStart",
token.getRealOffsetStart()); // depends on control dependency: [if], data = [none]
mtasKwicItemResponseItemToken.add("realOffsetEnd",
token.getRealOffsetEnd()); // depends on control dependency: [if], data = [none]
}
mtasKwicItemResponseItemTokens.add(mtasKwicItemResponseItemToken); // depends on control dependency: [for], data = [none]
}
mtasKwicItemResponseItem.add("tokens",
mtasKwicItemResponseItemTokens); // depends on control dependency: [for], data = [k]
mtasKwicItemResponseItems.add(mtasKwicItemResponseItem); // depends on control dependency: [for], data = [none]
}
mtasKwicItemResponse.add("documentKey", kwic.uniqueKey.get(docId)); // depends on control dependency: [for], data = [docId]
mtasKwicItemResponse.add("documentTotal", kwic.subTotal.get(docId)); // depends on control dependency: [for], data = [docId]
mtasKwicItemResponse.add("documentMinPosition",
kwic.minPosition.get(docId)); // depends on control dependency: [for], data = [none]
mtasKwicItemResponse.add("documentMaxPosition",
kwic.maxPosition.get(docId)); // depends on control dependency: [for], data = [none]
mtasKwicItemResponse.add("list", mtasKwicItemResponseItems); // depends on control dependency: [for], data = [none]
mtasKwicItemResponses.add(mtasKwicItemResponse); // depends on control dependency: [for], data = [none]
}
}
mtasKwicResponse.add("list", mtasKwicItemResponses);
return mtasKwicResponse;
} } |
public class class_name {
void init() {
if (! isEnabled()) {
loggerConfig.info("Ted prime instance check is disabled");
return;
}
this.primeTaskId = context.tedDaoExt.findPrimeTaskId();
int periodMs = context.config.intervalDriverMs();
this.postponeSec = (int)Math.round((1.0 * periodMs * TICK_SKIP_COUNT + 500 + 500) / 1000); // 500ms reserve, 500 for rounding up
becomePrime();
loggerConfig.info("Ted prime instance check is enabled, primeTaskId={} isPrime={} postponeSec={}", primeTaskId, isPrime, postponeSec);
initiated = true;
} } | public class class_name {
void init() {
if (! isEnabled()) {
loggerConfig.info("Ted prime instance check is disabled"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.primeTaskId = context.tedDaoExt.findPrimeTaskId();
int periodMs = context.config.intervalDriverMs();
this.postponeSec = (int)Math.round((1.0 * periodMs * TICK_SKIP_COUNT + 500 + 500) / 1000); // 500ms reserve, 500 for rounding up
becomePrime();
loggerConfig.info("Ted prime instance check is enabled, primeTaskId={} isPrime={} postponeSec={}", primeTaskId, isPrime, postponeSec);
initiated = true;
} } |
public class class_name {
@Override
public EEnum getIfcInventoryTypeEnum() {
if (ifcInventoryTypeEnumEEnum == null) {
ifcInventoryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1005);
}
return ifcInventoryTypeEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcInventoryTypeEnum() {
if (ifcInventoryTypeEnumEEnum == null) {
ifcInventoryTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1005);
// depends on control dependency: [if], data = [none]
}
return ifcInventoryTypeEnumEEnum;
} } |
public class class_name {
public CreateNotificationResponse createNotification(CreateNotificationRequest request) {
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
checkStringNotEmpty(request.getEndpoint(),
"The parameter endpoint should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PATH_NOTIFICATION);
String strJson = JsonUtils.toJsonString(request);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
return invokeHttpClient(internalRequest, CreateNotificationResponse.class);
} } | public class class_name {
public CreateNotificationResponse createNotification(CreateNotificationRequest request) {
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
checkStringNotEmpty(request.getEndpoint(),
"The parameter endpoint should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PATH_NOTIFICATION);
String strJson = JsonUtils.toJsonString(request);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
} // depends on control dependency: [catch], data = [none]
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
return invokeHttpClient(internalRequest, CreateNotificationResponse.class);
} } |
public class class_name {
@Override
protected void invokePreStepArtifacts() {
if (stepListeners != null) {
for (StepListenerProxy listenerProxy : stepListeners) {
// Call beforeStep on all the step listeners
listenerProxy.beforeStep();
}
}
// Invoke the reducer before all parallel steps start (must occur
// before mapper as well)
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beginPartitionedStep();
}
} } | public class class_name {
@Override
protected void invokePreStepArtifacts() {
if (stepListeners != null) {
for (StepListenerProxy listenerProxy : stepListeners) {
// Call beforeStep on all the step listeners
listenerProxy.beforeStep(); // depends on control dependency: [for], data = [listenerProxy]
}
}
// Invoke the reducer before all parallel steps start (must occur
// before mapper as well)
if (this.partitionReducerProxy != null) {
this.partitionReducerProxy.beginPartitionedStep(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void checkState(boolean b, String message, Object... args) {
if (!b) {
throwStateEx(message, args);
}
} } | public class class_name {
public static void checkState(boolean b, String message, Object... args) {
if (!b) {
throwStateEx(message, args); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) {
String join = StringHelper.join( namesWithoutAlias, "." );
Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );
String[] identifierColumnNames = persister.getIdentifierColumnNames();
if ( propertyType.isComponentType() ) {
String[] embeddedColumnNames = persister.getPropertyColumnNames( join );
for ( String embeddedColumn : embeddedColumnNames ) {
if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) {
return false;
}
}
return true;
}
return ArrayHelper.contains( identifierColumnNames, join );
} } | public class class_name {
public boolean isIdProperty(OgmEntityPersister persister, List<String> namesWithoutAlias) {
String join = StringHelper.join( namesWithoutAlias, "." );
Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) );
String[] identifierColumnNames = persister.getIdentifierColumnNames();
if ( propertyType.isComponentType() ) {
String[] embeddedColumnNames = persister.getPropertyColumnNames( join );
for ( String embeddedColumn : embeddedColumnNames ) {
if ( !ArrayHelper.contains( identifierColumnNames, embeddedColumn ) ) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true; // depends on control dependency: [if], data = [none]
}
return ArrayHelper.contains( identifierColumnNames, join );
} } |
public class class_name {
public static UpdateSketch wrap(final WritableMemory srcMem, final long seed) {
final int preLongs = srcMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int serVer = srcMem.getByte(SER_VER_BYTE) & 0XFF;
final int familyID = srcMem.getByte(FAMILY_BYTE) & 0XFF;
final Family family = Family.idToFamily(familyID);
if (family != Family.QUICKSELECT) {
throw new SketchesArgumentException(
"A " + family + " sketch cannot be wrapped as an UpdateSketch.");
}
if ((serVer == 3) && (preLongs == 3)) {
return DirectQuickSelectSketch.writableWrap(srcMem, seed);
} else {
throw new SketchesArgumentException(
"Corrupted: An UpdateSketch image: must have SerVer = 3 and preLongs = 3");
}
} } | public class class_name {
public static UpdateSketch wrap(final WritableMemory srcMem, final long seed) {
final int preLongs = srcMem.getByte(PREAMBLE_LONGS_BYTE) & 0X3F;
final int serVer = srcMem.getByte(SER_VER_BYTE) & 0XFF;
final int familyID = srcMem.getByte(FAMILY_BYTE) & 0XFF;
final Family family = Family.idToFamily(familyID);
if (family != Family.QUICKSELECT) {
throw new SketchesArgumentException(
"A " + family + " sketch cannot be wrapped as an UpdateSketch.");
}
if ((serVer == 3) && (preLongs == 3)) {
return DirectQuickSelectSketch.writableWrap(srcMem, seed); // depends on control dependency: [if], data = [none]
} else {
throw new SketchesArgumentException(
"Corrupted: An UpdateSketch image: must have SerVer = 3 and preLongs = 3");
}
} } |
public class class_name {
public void subscribeToEvent(final EventListener eventListener, final Class<? extends AbstractTaskEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
subscribers = new ArrayList<EventListener>();
this.subscriptions.put(eventType, subscribers);
}
subscribers.add(eventListener);
}
} } | public class class_name {
public void subscribeToEvent(final EventListener eventListener, final Class<? extends AbstractTaskEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
subscribers = new ArrayList<EventListener>(); // depends on control dependency: [if], data = [none]
this.subscriptions.put(eventType, subscribers); // depends on control dependency: [if], data = [none]
}
subscribers.add(eventListener);
}
} } |
public class class_name {
public MarcField matchValue(Pattern pattern) {
if (value != null && pattern.matcher(value).matches()) {
return this;
}
for (Subfield subfield : subfields) {
if (pattern.matcher(subfield.getValue()).matches()) {
return this;
}
}
return null;
} } | public class class_name {
public MarcField matchValue(Pattern pattern) {
if (value != null && pattern.matcher(value).matches()) {
return this; // depends on control dependency: [if], data = [none]
}
for (Subfield subfield : subfields) {
if (pattern.matcher(subfield.getValue()).matches()) {
return this; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private static NfsGetAttributes makeAttributes(Xdr xdr) {
NfsGetAttributes attributes = null;
if (xdr != null) {
attributes = NfsResponseBase.makeNfsGetAttributes(xdr);
}
return attributes;
} } | public class class_name {
private static NfsGetAttributes makeAttributes(Xdr xdr) {
NfsGetAttributes attributes = null;
if (xdr != null) {
attributes = NfsResponseBase.makeNfsGetAttributes(xdr); // depends on control dependency: [if], data = [(xdr]
}
return attributes;
} } |
public class class_name {
public void marshall(InputDestination inputDestination, ProtocolMarshaller protocolMarshaller) {
if (inputDestination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inputDestination.getIp(), IP_BINDING);
protocolMarshaller.marshall(inputDestination.getPort(), PORT_BINDING);
protocolMarshaller.marshall(inputDestination.getUrl(), URL_BINDING);
protocolMarshaller.marshall(inputDestination.getVpc(), VPC_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InputDestination inputDestination, ProtocolMarshaller protocolMarshaller) {
if (inputDestination == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inputDestination.getIp(), IP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inputDestination.getPort(), PORT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inputDestination.getUrl(), URL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inputDestination.getVpc(), VPC_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isWaterTile(TileCoordinate tc) {
List<TileCoordinate> tiles = tc.translateToZoomLevel(TILE_INFO_ZOOMLEVEL);
for (TileCoordinate tile : tiles) {
if (!this.seaTileInfo.get(tile.getY() * 4096 + tile.getX())) {
return false;
}
}
return true;
} } | public class class_name {
public boolean isWaterTile(TileCoordinate tc) {
List<TileCoordinate> tiles = tc.translateToZoomLevel(TILE_INFO_ZOOMLEVEL);
for (TileCoordinate tile : tiles) {
if (!this.seaTileInfo.get(tile.getY() * 4096 + tile.getX())) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static boolean isRuleWord(String word) {
char c = 0;
for (int i = 0; i < word.length(); i++) {
c = word.charAt(i);
if (c != '·') {
if (c < 256 || filter.contains(c) || (c = WordAlert.CharCover(word.charAt(i))) > 0) {
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean isRuleWord(String word) {
char c = 0;
for (int i = 0; i < word.length(); i++) {
c = word.charAt(i); // depends on control dependency: [for], data = [i]
if (c != '·') {
if (c < 256 || filter.contains(c) || (c = WordAlert.CharCover(word.charAt(i))) > 0) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static void main(String[] args) {
try {
JarRunner runner = new JarRunner(args);
runner.runIfConfigured();
} catch (NumberFormatException e) {
System.err.println("Could not parse number " + e.getMessage());
System.exit(1);
} catch (RuntimeException e) {
System.err.println(e.getMessage());
System.exit(1);
}
} } | public class class_name {
public static void main(String[] args) {
try {
JarRunner runner = new JarRunner(args);
runner.runIfConfigured(); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
System.err.println("Could not parse number " + e.getMessage());
System.exit(1);
} catch (RuntimeException e) { // depends on control dependency: [catch], data = [none]
System.err.println(e.getMessage());
System.exit(1);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean shouldShowType(String contextKey, String typeName) {
Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
if (allowedContexts == null) {
return true;
}
return allowedContexts.contains(contextKey);
} } | public class class_name {
public boolean shouldShowType(String contextKey, String typeName) {
Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap();
CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName);
if (allowedContexts == null) {
return true;
// depends on control dependency: [if], data = [none]
}
return allowedContexts.contains(contextKey);
} } |
public class class_name {
protected boolean ipPatternMatches(final String remoteIp) {
val matcher = this.ipsToCheckPattern.matcher(remoteIp);
if (matcher.find()) {
LOGGER.debug("Remote IP address [{}] should be checked based on the defined pattern [{}]", remoteIp, this.ipsToCheckPattern.pattern());
return true;
}
LOGGER.debug("No pattern or remote IP defined, or pattern does not match remote IP [{}]", remoteIp);
return false;
} } | public class class_name {
protected boolean ipPatternMatches(final String remoteIp) {
val matcher = this.ipsToCheckPattern.matcher(remoteIp);
if (matcher.find()) {
LOGGER.debug("Remote IP address [{}] should be checked based on the defined pattern [{}]", remoteIp, this.ipsToCheckPattern.pattern()); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
LOGGER.debug("No pattern or remote IP defined, or pattern does not match remote IP [{}]", remoteIp);
return false;
} } |
public class class_name {
public static void setFieldValue(Object obj, Field field, Object value) throws UtilException {
Assert.notNull(obj);
Assert.notNull(field);
field.setAccessible(true);
if(null != value) {
Class<?> fieldType = field.getType();
if(false == fieldType.isAssignableFrom(value.getClass())) {
//对于类型不同的字段,尝试转换,转换失败则使用原对象类型
final Object targetValue = Convert.convert(fieldType, value);
if(null != targetValue) {
value = targetValue;
}
}
}
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName());
}
} } | public class class_name {
public static void setFieldValue(Object obj, Field field, Object value) throws UtilException {
Assert.notNull(obj);
Assert.notNull(field);
field.setAccessible(true);
if(null != value) {
Class<?> fieldType = field.getType();
if(false == fieldType.isAssignableFrom(value.getClass())) {
//对于类型不同的字段,尝试转换,转换失败则使用原对象类型
final Object targetValue = Convert.convert(fieldType, value);
if(null != targetValue) {
value = targetValue;
// depends on control dependency: [if], data = [none]
}
}
}
try {
field.set(obj, value);
} catch (IllegalAccessException e) {
throw new UtilException(e, "IllegalAccess for {}.{}", obj.getClass(), field.getName());
}
} } |
public class class_name {
public static boolean isKeepAlive(HttpServerRequest request) {
String connection = request.headers().get(HeaderNames.CONNECTION);
if (connection != null && connection.equalsIgnoreCase(CLOSE)) {
return false;
}
if (request.version() == HttpVersion.HTTP_1_1) {
return !CLOSE.equalsIgnoreCase(connection);
} else {
return KEEP_ALIVE.equalsIgnoreCase(connection);
}
} } | public class class_name {
public static boolean isKeepAlive(HttpServerRequest request) {
String connection = request.headers().get(HeaderNames.CONNECTION);
if (connection != null && connection.equalsIgnoreCase(CLOSE)) {
return false; // depends on control dependency: [if], data = [none]
}
if (request.version() == HttpVersion.HTTP_1_1) {
return !CLOSE.equalsIgnoreCase(connection); // depends on control dependency: [if], data = [none]
} else {
return KEEP_ALIVE.equalsIgnoreCase(connection); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected List<Field> getFields(Class<?> clazz) {
List<Field> fields = new ArrayList<Field>();
while (clazz != null && !isBoundaryClass(clazz)) {
for (Field field : clazz.getDeclaredFields()) {
if (!field.isAnnotationPresent(Inject.class)) {
continue;
}
fields.add(field);
}
clazz = clazz.getSuperclass();
}
return fields;
} } | public class class_name {
protected List<Field> getFields(Class<?> clazz) {
List<Field> fields = new ArrayList<Field>();
while (clazz != null && !isBoundaryClass(clazz)) {
for (Field field : clazz.getDeclaredFields()) {
if (!field.isAnnotationPresent(Inject.class)) {
continue;
}
fields.add(field); // depends on control dependency: [for], data = [field]
}
clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return fields;
} } |
public class class_name {
public void setVpcSecurityGroupMemberships(java.util.Collection<String> vpcSecurityGroupMemberships) {
if (vpcSecurityGroupMemberships == null) {
this.vpcSecurityGroupMemberships = null;
return;
}
this.vpcSecurityGroupMemberships = new com.amazonaws.internal.SdkInternalList<String>(vpcSecurityGroupMemberships);
} } | public class class_name {
public void setVpcSecurityGroupMemberships(java.util.Collection<String> vpcSecurityGroupMemberships) {
if (vpcSecurityGroupMemberships == null) {
this.vpcSecurityGroupMemberships = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.vpcSecurityGroupMemberships = new com.amazonaws.internal.SdkInternalList<String>(vpcSecurityGroupMemberships);
} } |
public class class_name {
public boolean isGeneralInstance()
{
boolean ret = true;
if (this.generalInstance != null) {
ret = this.generalInstance;
} else if (getParentType() != null) {
ret = getParentType().isGeneralInstance();
}
return ret;
} } | public class class_name {
public boolean isGeneralInstance()
{
boolean ret = true;
if (this.generalInstance != null) {
ret = this.generalInstance; // depends on control dependency: [if], data = [none]
} else if (getParentType() != null) {
ret = getParentType().isGeneralInstance(); // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
public HashMap<TopologyAPI.StreamId, List<Grouping>> getStreamConsumers() {
if (this.streamConsumers == null) {
this.streamConsumers = new HashMap<>();
// First get a map of (TopologyAPI.StreamId -> TopologyAPI.StreamSchema)
Map<TopologyAPI.StreamId, TopologyAPI.StreamSchema> streamToSchema =
new HashMap<>();
// Calculate spout's output stream
for (TopologyAPI.Spout spout : this.getTopology().getSpoutsList()) {
for (TopologyAPI.OutputStream outputStream : spout.getOutputsList()) {
streamToSchema.put(outputStream.getStream(), outputStream.getSchema());
}
}
// Calculate bolt's output stream
for (TopologyAPI.Bolt bolt : this.getTopology().getBoltsList()) {
for (TopologyAPI.OutputStream outputStream : bolt.getOutputsList()) {
streamToSchema.put(outputStream.getStream(), outputStream.getSchema());
}
}
// Only bolts could consume from input stream
for (TopologyAPI.Bolt bolt : this.getTopology().getBoltsList()) {
for (TopologyAPI.InputStream inputStream : bolt.getInputsList()) {
TopologyAPI.StreamSchema schema = streamToSchema.get(inputStream.getStream());
String componentName = bolt.getComp().getName();
List<Integer> taskIds = this.getComponentToTaskIds().get(componentName);
if (!this.streamConsumers.containsKey(inputStream.getStream())) {
this.streamConsumers.put(inputStream.getStream(), new ArrayList<>());
}
this.streamConsumers.get(inputStream.getStream()).add(Grouping.create(
inputStream.getGtype(),
inputStream,
schema,
taskIds)
);
}
}
}
return this.streamConsumers;
} } | public class class_name {
public HashMap<TopologyAPI.StreamId, List<Grouping>> getStreamConsumers() {
if (this.streamConsumers == null) {
this.streamConsumers = new HashMap<>(); // depends on control dependency: [if], data = [none]
// First get a map of (TopologyAPI.StreamId -> TopologyAPI.StreamSchema)
Map<TopologyAPI.StreamId, TopologyAPI.StreamSchema> streamToSchema =
new HashMap<>();
// Calculate spout's output stream
for (TopologyAPI.Spout spout : this.getTopology().getSpoutsList()) {
for (TopologyAPI.OutputStream outputStream : spout.getOutputsList()) {
streamToSchema.put(outputStream.getStream(), outputStream.getSchema()); // depends on control dependency: [for], data = [outputStream]
}
}
// Calculate bolt's output stream
for (TopologyAPI.Bolt bolt : this.getTopology().getBoltsList()) {
for (TopologyAPI.OutputStream outputStream : bolt.getOutputsList()) {
streamToSchema.put(outputStream.getStream(), outputStream.getSchema()); // depends on control dependency: [for], data = [outputStream]
}
}
// Only bolts could consume from input stream
for (TopologyAPI.Bolt bolt : this.getTopology().getBoltsList()) {
for (TopologyAPI.InputStream inputStream : bolt.getInputsList()) {
TopologyAPI.StreamSchema schema = streamToSchema.get(inputStream.getStream());
String componentName = bolt.getComp().getName();
List<Integer> taskIds = this.getComponentToTaskIds().get(componentName);
if (!this.streamConsumers.containsKey(inputStream.getStream())) {
this.streamConsumers.put(inputStream.getStream(), new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
this.streamConsumers.get(inputStream.getStream()).add(Grouping.create(
inputStream.getGtype(),
inputStream,
schema,
taskIds)
); // depends on control dependency: [for], data = [none]
}
}
}
return this.streamConsumers;
} } |
public class class_name {
public void put(String key, Boolean value) {
if (this.compiledStatement != null) {
if (value == null) {
this.compiledStatement.bindNull(compiledStatementBindIndex++);
} else {
this.compiledStatement.bindLong(compiledStatementBindIndex++, (((Boolean) value) == true ? 1 : 0));
}
} else if (values != null) {
values.put(key, value);
return;
}
names.add(key);
args.add(value);
valueType.add(ParamType.BOOLEAN);
} } | public class class_name {
public void put(String key, Boolean value) {
if (this.compiledStatement != null) {
if (value == null) {
this.compiledStatement.bindNull(compiledStatementBindIndex++); // depends on control dependency: [if], data = [none]
} else {
this.compiledStatement.bindLong(compiledStatementBindIndex++, (((Boolean) value) == true ? 1 : 0)); // depends on control dependency: [if], data = [none]
}
} else if (values != null) {
values.put(key, value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
names.add(key);
args.add(value);
valueType.add(ParamType.BOOLEAN);
} } |
public class class_name {
public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException {
int exceptionsCount = 0;
while (true) {
try {
File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile();
if (isReCreat) {
file.delete();
file.createNewFile();
}
return file;
} catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied
if (++exceptionsCount >= 50) {
throw new IORuntimeException(ioex);
}
}
}
} } | public class class_name {
public static File createTempFile(String prefix, String suffix, File dir, boolean isReCreat) throws IORuntimeException {
int exceptionsCount = 0;
while (true) {
try {
File file = File.createTempFile(prefix, suffix, dir).getCanonicalFile();
if (isReCreat) {
file.delete();
// depends on control dependency: [if], data = [none]
file.createNewFile();
// depends on control dependency: [if], data = [none]
}
return file;
// depends on control dependency: [try], data = [none]
} catch (IOException ioex) { // fixes java.io.WinNTFileSystem.createFileExclusively access denied
if (++exceptionsCount >= 50) {
throw new IORuntimeException(ioex);
}
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public short put(String value){
// Do we already have this value?
if(dataMap.containsKey(value)){
dictionaryHit++;
return dataMap.get(value);
}
// Are we filled up?
if(next==MAX_SIZE){
dictionaryMiss++;
return -1;
}
// Should we add values without actual repetitions?
if(minRepetitions==0){
data[next]=value;
dataMap.put(value,next);
dirty=true;
dictionaryHit++;
return next++;
}
// Have we seen this value before?
if(slidingWindow.containsKey(value)){
int count=slidingWindow.get(value)+1;
// Does it satisfy the minimum repetition count?
if(count>minRepetitions){
slidingWindow.remove(value);
data[next]=value;
dataMap.put(value,next);
dirty=true;
dictionaryHit++;
return next++;
}else{
slidingWindow.put(value,count);
}
}else{
// Add this new value to the map
slidingWindow.put(value,1);
}
dictionaryMiss++;
return -1;
} } | public class class_name {
public short put(String value){
// Do we already have this value?
if(dataMap.containsKey(value)){
dictionaryHit++; // depends on control dependency: [if], data = [none]
return dataMap.get(value); // depends on control dependency: [if], data = [none]
}
// Are we filled up?
if(next==MAX_SIZE){
dictionaryMiss++; // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
// Should we add values without actual repetitions?
if(minRepetitions==0){
data[next]=value; // depends on control dependency: [if], data = [none]
dataMap.put(value,next); // depends on control dependency: [if], data = [none]
dirty=true; // depends on control dependency: [if], data = [none]
dictionaryHit++; // depends on control dependency: [if], data = [none]
return next++; // depends on control dependency: [if], data = [none]
}
// Have we seen this value before?
if(slidingWindow.containsKey(value)){
int count=slidingWindow.get(value)+1;
// Does it satisfy the minimum repetition count?
if(count>minRepetitions){
slidingWindow.remove(value); // depends on control dependency: [if], data = [none]
data[next]=value; // depends on control dependency: [if], data = [none]
dataMap.put(value,next); // depends on control dependency: [if], data = [none]
dirty=true; // depends on control dependency: [if], data = [none]
dictionaryHit++; // depends on control dependency: [if], data = [none]
return next++; // depends on control dependency: [if], data = [none]
}else{
slidingWindow.put(value,count); // depends on control dependency: [if], data = [none]
}
}else{
// Add this new value to the map
slidingWindow.put(value,1); // depends on control dependency: [if], data = [none]
}
dictionaryMiss++;
return -1;
} } |
public class class_name {
protected AssociationValue createInstance() {
Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
for (AbstractAttributeInfo attrInfo : featureInfo.getAttributes()) {
if (attrInfo instanceof PrimitiveAttributeInfo) {
attributes.put(attrInfo.getName(), AttributeUtil.createEmptyPrimitiveAttribute(
(PrimitiveAttributeInfo) attrInfo));
} else if (attrInfo instanceof AssociationAttributeInfo) {
AssociationAttributeInfo assocInfo = (AssociationAttributeInfo) attrInfo;
switch (assocInfo.getType()) {
case MANY_TO_ONE:
attributes.put(assocInfo.getName(), new ManyToOneAttribute());
break;
case ONE_TO_MANY:
OneToManyAttribute oneToMany = new OneToManyAttribute();
oneToMany.setValue(new ArrayList<AssociationValue>());
attributes.put(assocInfo.getName(), oneToMany);
break;
default:
throw new IllegalStateException("Don't know how to handle association type " +
assocInfo.getType());
}
}
}
AssociationValue value = new AssociationValue();
value.setAllAttributes(attributes);
value.setId(AttributeUtil.createEmptyPrimitiveAttribute(featureInfo.getIdentifier()));
return value;
} } | public class class_name {
protected AssociationValue createInstance() {
Map<String, Attribute<?>> attributes = new HashMap<String, Attribute<?>>();
for (AbstractAttributeInfo attrInfo : featureInfo.getAttributes()) {
if (attrInfo instanceof PrimitiveAttributeInfo) {
attributes.put(attrInfo.getName(), AttributeUtil.createEmptyPrimitiveAttribute(
(PrimitiveAttributeInfo) attrInfo)); // depends on control dependency: [if], data = [none]
} else if (attrInfo instanceof AssociationAttributeInfo) {
AssociationAttributeInfo assocInfo = (AssociationAttributeInfo) attrInfo;
switch (assocInfo.getType()) {
case MANY_TO_ONE:
attributes.put(assocInfo.getName(), new ManyToOneAttribute()); // depends on control dependency: [if], data = [none]
break;
case ONE_TO_MANY:
OneToManyAttribute oneToMany = new OneToManyAttribute();
oneToMany.setValue(new ArrayList<AssociationValue>()); // depends on control dependency: [if], data = [none]
attributes.put(assocInfo.getName(), oneToMany); // depends on control dependency: [if], data = [none]
break;
default:
throw new IllegalStateException("Don't know how to handle association type " +
assocInfo.getType());
}
}
}
AssociationValue value = new AssociationValue();
value.setAllAttributes(attributes);
value.setId(AttributeUtil.createEmptyPrimitiveAttribute(featureInfo.getIdentifier()));
return value;
} } |
public class class_name {
private boolean checkInStagingAreaAndFileCache(final CacheKey key) {
EncodedImage result = mStagingArea.get(key);
if (result != null) {
result.close();
FLog.v(TAG, "Found image for %s in staging area", key.getUriString());
mImageCacheStatsTracker.onStagingAreaHit(key);
return true;
} else {
FLog.v(TAG, "Did not find image for %s in staging area", key.getUriString());
mImageCacheStatsTracker.onStagingAreaMiss();
try {
return mFileCache.hasKey(key);
} catch (Exception exception) {
return false;
}
}
} } | public class class_name {
private boolean checkInStagingAreaAndFileCache(final CacheKey key) {
EncodedImage result = mStagingArea.get(key);
if (result != null) {
result.close(); // depends on control dependency: [if], data = [none]
FLog.v(TAG, "Found image for %s in staging area", key.getUriString()); // depends on control dependency: [if], data = [none]
mImageCacheStatsTracker.onStagingAreaHit(key); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
FLog.v(TAG, "Did not find image for %s in staging area", key.getUriString()); // depends on control dependency: [if], data = [none]
mImageCacheStatsTracker.onStagingAreaMiss(); // depends on control dependency: [if], data = [none]
try {
return mFileCache.hasKey(key); // depends on control dependency: [try], data = [none]
} catch (Exception exception) {
return false;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public int getAligSeq(Point point) {
int i1 = getSeqPos(0, point);
Point t1 = getPanelPos(0,i1);
if ( Math.abs(t1.x - point.x) <= DEFAULT_CHAR_SIZE &&
Math.abs(t1.y-point.y) < DEFAULT_CHAR_SIZE ) {
return 0;
}
int i2 = getSeqPos(1,point);
Point t2 = getPanelPos(1,i2);
if ( Math.abs(t2.x - point.x) < DEFAULT_CHAR_SIZE &&
Math.abs(t2.y-point.y) < DEFAULT_CHAR_SIZE ) {
return 1;
}
//System.out.println(" i1: " + i1 +" t1 : " + Math.abs(t1.x - point.x) + " " + Math.abs(t1.y-point.y));
//System.out.println(i2);
return -1;
} } | public class class_name {
public int getAligSeq(Point point) {
int i1 = getSeqPos(0, point);
Point t1 = getPanelPos(0,i1);
if ( Math.abs(t1.x - point.x) <= DEFAULT_CHAR_SIZE &&
Math.abs(t1.y-point.y) < DEFAULT_CHAR_SIZE ) {
return 0; // depends on control dependency: [if], data = [none]
}
int i2 = getSeqPos(1,point);
Point t2 = getPanelPos(1,i2);
if ( Math.abs(t2.x - point.x) < DEFAULT_CHAR_SIZE &&
Math.abs(t2.y-point.y) < DEFAULT_CHAR_SIZE ) {
return 1; // depends on control dependency: [if], data = [none]
}
//System.out.println(" i1: " + i1 +" t1 : " + Math.abs(t1.x - point.x) + " " + Math.abs(t1.y-point.y));
//System.out.println(i2);
return -1;
} } |
public class class_name {
@Override
public CloseableReference<Bitmap> decodeJPEGFromEncodedImageWithColorSpace(
EncodedImage encodedImage,
Bitmap.Config bitmapConfig,
@Nullable Rect regionToDecode,
int length,
@Nullable final ColorSpace colorSpace) {
boolean isJpegComplete = encodedImage.isCompleteAt(length);
final BitmapFactory.Options options = getDecodeOptionsForStream(encodedImage, bitmapConfig);
InputStream jpegDataStream = encodedImage.getInputStream();
// At this point the InputStream from the encoded image should not be null since in the
// pipeline,this comes from a call stack where this was checked before. Also this method needs
// the InputStream to decode the image so this can't be null.
Preconditions.checkNotNull(jpegDataStream);
if (encodedImage.getSize() > length) {
jpegDataStream = new LimitedInputStream(jpegDataStream, length);
}
if (!isJpegComplete) {
jpegDataStream = new TailAppendingInputStream(jpegDataStream, EOI_TAIL);
}
boolean retryOnFail = options.inPreferredConfig != Bitmap.Config.ARGB_8888;
try {
return decodeFromStream(jpegDataStream, options, regionToDecode, colorSpace);
} catch (RuntimeException re) {
if (retryOnFail) {
return decodeJPEGFromEncodedImageWithColorSpace(
encodedImage, Bitmap.Config.ARGB_8888, regionToDecode, length, colorSpace);
}
throw re;
}
} } | public class class_name {
@Override
public CloseableReference<Bitmap> decodeJPEGFromEncodedImageWithColorSpace(
EncodedImage encodedImage,
Bitmap.Config bitmapConfig,
@Nullable Rect regionToDecode,
int length,
@Nullable final ColorSpace colorSpace) {
boolean isJpegComplete = encodedImage.isCompleteAt(length);
final BitmapFactory.Options options = getDecodeOptionsForStream(encodedImage, bitmapConfig);
InputStream jpegDataStream = encodedImage.getInputStream();
// At this point the InputStream from the encoded image should not be null since in the
// pipeline,this comes from a call stack where this was checked before. Also this method needs
// the InputStream to decode the image so this can't be null.
Preconditions.checkNotNull(jpegDataStream);
if (encodedImage.getSize() > length) {
jpegDataStream = new LimitedInputStream(jpegDataStream, length); // depends on control dependency: [if], data = [length)]
}
if (!isJpegComplete) {
jpegDataStream = new TailAppendingInputStream(jpegDataStream, EOI_TAIL); // depends on control dependency: [if], data = [none]
}
boolean retryOnFail = options.inPreferredConfig != Bitmap.Config.ARGB_8888;
try {
return decodeFromStream(jpegDataStream, options, regionToDecode, colorSpace); // depends on control dependency: [try], data = [none]
} catch (RuntimeException re) {
if (retryOnFail) {
return decodeJPEGFromEncodedImageWithColorSpace(
encodedImage, Bitmap.Config.ARGB_8888, regionToDecode, length, colorSpace); // depends on control dependency: [if], data = [none]
}
throw re;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public TableResult listTableDataSchema(
String datasetName, String tableName, Schema schema, String field) {
// [START ]
TableResult tableData = bigquery.listTableData(datasetName, tableName, schema);
for (FieldValueList row : tableData.iterateAll()) {
row.get(field);
}
// [END ]
return tableData;
} } | public class class_name {
public TableResult listTableDataSchema(
String datasetName, String tableName, Schema schema, String field) {
// [START ]
TableResult tableData = bigquery.listTableData(datasetName, tableName, schema);
for (FieldValueList row : tableData.iterateAll()) {
row.get(field); // depends on control dependency: [for], data = [row]
}
// [END ]
return tableData;
} } |
public class class_name {
private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, embeddedObject);
}
for (EmbeddedMetadata embeddedMetadata2 : embeddedMetadata.getEmbeddedMetadataCollection()) {
marshalWithExplodedStrategy(embeddedMetadata2, embeddedObject);
}
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} } | public class class_name {
private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, embeddedObject); // depends on control dependency: [for], data = [propertyMetadata]
}
for (EmbeddedMetadata embeddedMetadata2 : embeddedMetadata.getEmbeddedMetadataCollection()) {
marshalWithExplodedStrategy(embeddedMetadata2, embeddedObject); // depends on control dependency: [for], data = [embeddedMetadata2]
}
} catch (Throwable t) {
throw new EntityManagerException(t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void runSession() {
if (!started) {
logString("Thread Starting");
completed = false;
seqNum = getStartSeqNum();
rtpStack.setNextZrtpSequenceNumber(getStartSeqNum());
state = ZRTP_STATE_INACTIVE;
initiator = false;
hashMode = HashType.UNDEFINED;
dhMode = KeyAgreementType.DH3K;
sasMode = SasType.UNDEFINED;
farEndZID = null;
farEndH0 = null;
farEndClientID = "";
isLegacyClient = false;
// farEndH1 = null;
// farEndH2 = null;
// farEndH3 = null;
farEndZID = null;
dhPart1Msg = null;
dhPart2Msg = null;
rxHelloMsg = txHelloMsg = commitMsg = null;
msgConfirm1TX = msgConfirm2TX = null;
msgConfirm1RX = msgConfirm2RX = null;
msgErrorTX = null;
try {
// TODO: create after algorithm negotiation
dhSuite.setAlgorithm(KeyAgreementType.DH3K);
// Initialize the retransmission timer interval
timerInterval = T1_INITIAL_INTERVAL;
sendHello();
started = true;
} catch (Throwable e) {
logError("Exception sending initial Hello message: "
+ e.toString());
e.printStackTrace();
completed = true;
}
while (!completed) {
synchronized (lock) {
try {
lock.wait();
} catch (Throwable e) {
logString("Thread Interrupted E:" + e);
}
}
processQueuedMessages();
}
endSession();
logString("Thread Ending");
}
} } | public class class_name {
private void runSession() {
if (!started) {
logString("Thread Starting"); // depends on control dependency: [if], data = [none]
completed = false; // depends on control dependency: [if], data = [none]
seqNum = getStartSeqNum(); // depends on control dependency: [if], data = [none]
rtpStack.setNextZrtpSequenceNumber(getStartSeqNum()); // depends on control dependency: [if], data = [none]
state = ZRTP_STATE_INACTIVE; // depends on control dependency: [if], data = [none]
initiator = false; // depends on control dependency: [if], data = [none]
hashMode = HashType.UNDEFINED; // depends on control dependency: [if], data = [none]
dhMode = KeyAgreementType.DH3K; // depends on control dependency: [if], data = [none]
sasMode = SasType.UNDEFINED; // depends on control dependency: [if], data = [none]
farEndZID = null; // depends on control dependency: [if], data = [none]
farEndH0 = null; // depends on control dependency: [if], data = [none]
farEndClientID = "";
isLegacyClient = false; // depends on control dependency: [if], data = [none]
// farEndH1 = null;
// farEndH2 = null;
// farEndH3 = null;
farEndZID = null; // depends on control dependency: [if], data = [none]
dhPart1Msg = null; // depends on control dependency: [if], data = [none]
dhPart2Msg = null; // depends on control dependency: [if], data = [none]
rxHelloMsg = txHelloMsg = commitMsg = null; // depends on control dependency: [if], data = [none]
msgConfirm1TX = msgConfirm2TX = null; // depends on control dependency: [if], data = [none]
msgConfirm1RX = msgConfirm2RX = null; // depends on control dependency: [if], data = [none]
msgErrorTX = null; // depends on control dependency: [if], data = [none]
try {
// TODO: create after algorithm negotiation
dhSuite.setAlgorithm(KeyAgreementType.DH3K); // depends on control dependency: [try], data = [none]
// Initialize the retransmission timer interval
timerInterval = T1_INITIAL_INTERVAL; // depends on control dependency: [try], data = [none]
sendHello(); // depends on control dependency: [try], data = [none]
started = true; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logError("Exception sending initial Hello message: "
+ e.toString());
e.printStackTrace();
completed = true;
} // depends on control dependency: [catch], data = [none]
while (!completed) {
synchronized (lock) { // depends on control dependency: [while], data = [none]
try {
lock.wait(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
logString("Thread Interrupted E:" + e);
} // depends on control dependency: [catch], data = [none]
}
processQueuedMessages(); // depends on control dependency: [while], data = [none]
}
endSession(); // depends on control dependency: [if], data = [none]
logString("Thread Ending"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addNextInode(Inode inode) {
Preconditions.checkState(mLockPattern == LockPattern.WRITE_EDGE);
Preconditions.checkState(!fullPathExists());
Preconditions.checkState(inode.getName().equals(mPathComponents[mExistingInodes.size()]));
if (!isImplicitlyLocked() && mExistingInodes.size() < mPathComponents.length - 1) {
mLockList.pushWriteLockedEdge(inode, mPathComponents[mExistingInodes.size() + 1]);
}
mExistingInodes.add(inode);
} } | public class class_name {
public void addNextInode(Inode inode) {
Preconditions.checkState(mLockPattern == LockPattern.WRITE_EDGE);
Preconditions.checkState(!fullPathExists());
Preconditions.checkState(inode.getName().equals(mPathComponents[mExistingInodes.size()]));
if (!isImplicitlyLocked() && mExistingInodes.size() < mPathComponents.length - 1) {
mLockList.pushWriteLockedEdge(inode, mPathComponents[mExistingInodes.size() + 1]); // depends on control dependency: [if], data = [none]
}
mExistingInodes.add(inode);
} } |
public class class_name {
public static Boolean toBoolean(Object object) {
if(object == null) {
return false;
}
if(object instanceof Boolean) {
return (Boolean)object;
}
if(object instanceof String) {
return object.toString().equalsIgnoreCase("true");
}
if(object instanceof Byte) {
return (Byte)object > 0;
}
if(object instanceof Short) {
return (Short)object > 0;
}
if(object instanceof Integer) {
return (Integer)object > 0;
}
if(object instanceof Long) {
return (Long)object > 0;
}
return false;
} } | public class class_name {
public static Boolean toBoolean(Object object) {
if(object == null) {
return false; // depends on control dependency: [if], data = [none]
}
if(object instanceof Boolean) {
return (Boolean)object; // depends on control dependency: [if], data = [none]
}
if(object instanceof String) {
return object.toString().equalsIgnoreCase("true"); // depends on control dependency: [if], data = [none]
}
if(object instanceof Byte) {
return (Byte)object > 0; // depends on control dependency: [if], data = [none]
}
if(object instanceof Short) {
return (Short)object > 0; // depends on control dependency: [if], data = [none]
}
if(object instanceof Integer) {
return (Integer)object > 0; // depends on control dependency: [if], data = [none]
}
if(object instanceof Long) {
return (Long)object > 0; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
void log(CallInfo callInfo, DataSetAssertion dsa) {
if (isEnabled(Option.LOG_ASSERTIONS) ||
( ! dsa.passed()
&& isEnabled(Option.LOG_ASSERTION_ERRORS) )) {
log.write(callInfo, dsa);
}
} } | public class class_name {
void log(CallInfo callInfo, DataSetAssertion dsa) {
if (isEnabled(Option.LOG_ASSERTIONS) ||
( ! dsa.passed()
&& isEnabled(Option.LOG_ASSERTION_ERRORS) )) {
log.write(callInfo, dsa); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public PreparedStatement getPreparedStatement(Q query, boolean useCaching) {
PreparedStatement pStatement = null;
if (useCaching) {
pStatement = cachedStatement.get();
}
if (pStatement == null) {
try {
RegularStatement stmt = getQueryGen(query).call();
if (LOG.isDebugEnabled()) {
LOG.debug("Query: " + stmt.getQueryString());
}
pStatement = sessionRef.get().prepare(stmt.getQueryString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
if (useCaching && cachedStatement.get() == null) {
cachedStatement.set(pStatement);
}
return pStatement;
} } | public class class_name {
public PreparedStatement getPreparedStatement(Q query, boolean useCaching) {
PreparedStatement pStatement = null;
if (useCaching) {
pStatement = cachedStatement.get(); // depends on control dependency: [if], data = [none]
}
if (pStatement == null) {
try {
RegularStatement stmt = getQueryGen(query).call();
if (LOG.isDebugEnabled()) {
LOG.debug("Query: " + stmt.getQueryString()); // depends on control dependency: [if], data = [none]
}
pStatement = sessionRef.get().prepare(stmt.getQueryString()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
if (useCaching && cachedStatement.get() == null) {
cachedStatement.set(pStatement); // depends on control dependency: [if], data = [none]
}
return pStatement;
} } |
public class class_name {
public static PolyhedralSurface readPolyhedralSurface(ByteReader reader,
boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
int numPolygons = reader.readInt();
for (int i = 0; i < numPolygons; i++) {
Polygon polygon = readGeometry(reader, Polygon.class);
polyhedralSurface.addPolygon(polygon);
}
return polyhedralSurface;
} } | public class class_name {
public static PolyhedralSurface readPolyhedralSurface(ByteReader reader,
boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
int numPolygons = reader.readInt();
for (int i = 0; i < numPolygons; i++) {
Polygon polygon = readGeometry(reader, Polygon.class);
polyhedralSurface.addPolygon(polygon); // depends on control dependency: [for], data = [none]
}
return polyhedralSurface;
} } |
public class class_name {
public void modifyTimeBase(){
String [] time_grid=new String[6];
time_grid=normalizer.getTimeBase().split("-");
String s = "";
if(_tp.tunit[0] != -1)
s += Integer.toString(_tp.tunit[0]);
else
s += time_grid[0];
for(int i = 1; i < 6; i++){
s += "-";
if(_tp.tunit[i] != -1)
s += Integer.toString(_tp.tunit[i]);
else
s += time_grid[i];
}
normalizer.setTimeBase(s);
} } | public class class_name {
public void modifyTimeBase(){
String [] time_grid=new String[6];
time_grid=normalizer.getTimeBase().split("-");
String s = "";
if(_tp.tunit[0] != -1)
s += Integer.toString(_tp.tunit[0]);
else
s += time_grid[0];
for(int i = 1; i < 6; i++){
s += "-"; // depends on control dependency: [for], data = [none]
if(_tp.tunit[i] != -1)
s += Integer.toString(_tp.tunit[i]);
else
s += time_grid[i];
}
normalizer.setTimeBase(s);
} } |
public class class_name {
@Override
public CPInstance fetchByLtD_S_Last(Date displayDate, int status,
OrderByComparator<CPInstance> orderByComparator) {
int count = countByLtD_S(displayDate, status);
if (count == 0) {
return null;
}
List<CPInstance> list = findByLtD_S(displayDate, status, count - 1,
count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CPInstance fetchByLtD_S_Last(Date displayDate, int status,
OrderByComparator<CPInstance> orderByComparator) {
int count = countByLtD_S(displayDate, status);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CPInstance> list = findByLtD_S(displayDate, status, count - 1,
count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public EventFilter withEventTypeCodes(String... eventTypeCodes) {
if (this.eventTypeCodes == null) {
setEventTypeCodes(new java.util.ArrayList<String>(eventTypeCodes.length));
}
for (String ele : eventTypeCodes) {
this.eventTypeCodes.add(ele);
}
return this;
} } | public class class_name {
public EventFilter withEventTypeCodes(String... eventTypeCodes) {
if (this.eventTypeCodes == null) {
setEventTypeCodes(new java.util.ArrayList<String>(eventTypeCodes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : eventTypeCodes) {
this.eventTypeCodes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static boolean isModelCopyGroup(CmsObject cms, CmsResource resource) {
boolean result = false;
if (isModelGroup(resource)) {
try {
CmsProperty tempElementsProp = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
if (!tempElementsProp.isNullProperty()
&& CmsContainerElement.USE_AS_COPY_MODEL.equals(tempElementsProp.getValue())) {
result = true;
}
} catch (CmsException e) {
LOG.warn(e.getMessage(), e);
}
}
return result;
} } | public class class_name {
public static boolean isModelCopyGroup(CmsObject cms, CmsResource resource) {
boolean result = false;
if (isModelGroup(resource)) {
try {
CmsProperty tempElementsProp = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
if (!tempElementsProp.isNullProperty()
&& CmsContainerElement.USE_AS_COPY_MODEL.equals(tempElementsProp.getValue())) {
result = true; // depends on control dependency: [if], data = [none]
}
} catch (CmsException e) {
LOG.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public static <E> List<Pair<E, Double>> toSortedListWithCounts(Counter<E> c) {
List<Pair<E, Double>> l = new ArrayList<Pair<E, Double>>(c.size());
for (E e : c.keySet()) {
l.add(new Pair<E, Double>(e, c.getCount(e)));
}
// descending order
Collections.sort(l, new Comparator<Pair<E, Double>>() {
public int compare(Pair<E, Double> a, Pair<E, Double> b) {
return Double.compare(b.second, a.second);
}
});
return l;
} } | public class class_name {
public static <E> List<Pair<E, Double>> toSortedListWithCounts(Counter<E> c) {
List<Pair<E, Double>> l = new ArrayList<Pair<E, Double>>(c.size());
for (E e : c.keySet()) {
l.add(new Pair<E, Double>(e, c.getCount(e)));
// depends on control dependency: [for], data = [e]
}
// descending order
Collections.sort(l, new Comparator<Pair<E, Double>>() {
public int compare(Pair<E, Double> a, Pair<E, Double> b) {
return Double.compare(b.second, a.second);
}
});
return l;
} } |
public class class_name {
@SuppressWarnings("checkstyle:innerassignment")
private static IPath[] decodePatterns(NamedNodeMap nodeMap, String tag) {
final String sequence = removeAttribute(tag, nodeMap);
if (!"".equals(sequence)) { //$NON-NLS-1$
final char[][] patterns = CharOperation.splitOn('|', sequence.toCharArray());
final int patternCount;
if ((patternCount = patterns.length) > 0) {
IPath[] paths = new IPath[patternCount];
int index = 0;
for (int j = 0; j < patternCount; j++) {
final char[] pattern = patterns[j];
if (pattern.length == 0) {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=105581
continue;
}
paths[index++] = new Path(new String(pattern));
}
if (index < patternCount) {
System.arraycopy(paths, 0, paths = new IPath[index], 0, index);
}
return paths;
}
}
return null;
} } | public class class_name {
@SuppressWarnings("checkstyle:innerassignment")
private static IPath[] decodePatterns(NamedNodeMap nodeMap, String tag) {
final String sequence = removeAttribute(tag, nodeMap);
if (!"".equals(sequence)) { //$NON-NLS-1$
final char[][] patterns = CharOperation.splitOn('|', sequence.toCharArray());
final int patternCount;
if ((patternCount = patterns.length) > 0) {
IPath[] paths = new IPath[patternCount];
int index = 0;
for (int j = 0; j < patternCount; j++) {
final char[] pattern = patterns[j];
if (pattern.length == 0) {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=105581
continue;
}
paths[index++] = new Path(new String(pattern)); // depends on control dependency: [for], data = [none]
}
if (index < patternCount) {
System.arraycopy(paths, 0, paths = new IPath[index], 0, index); // depends on control dependency: [if], data = [none]
}
return paths; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void buildTree(int left, int right, int axis, SortDBIDsBySingleDimension comp) {
int middle = (left + right) >>> 1;
comp.setDimension(axis);
QuickSelectDBIDs.quickSelect(sorted, comp, left, right, middle);
final int next = (axis + 1) % dims;
if(left + leafsize < middle) {
buildTree(left, middle, next, comp);
}
++middle;
if(middle + leafsize < right) {
buildTree(middle, right, next, comp);
}
} } | public class class_name {
private void buildTree(int left, int right, int axis, SortDBIDsBySingleDimension comp) {
int middle = (left + right) >>> 1;
comp.setDimension(axis);
QuickSelectDBIDs.quickSelect(sorted, comp, left, right, middle);
final int next = (axis + 1) % dims;
if(left + leafsize < middle) {
buildTree(left, middle, next, comp); // depends on control dependency: [if], data = [none]
}
++middle;
if(middle + leafsize < right) {
buildTree(middle, right, next, comp); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Point readPoint(ByteReader reader, boolean hasZ, boolean hasM) {
double x = reader.readDouble();
double y = reader.readDouble();
Point point = new Point(hasZ, hasM, x, y);
if (hasZ) {
double z = reader.readDouble();
point.setZ(z);
}
if (hasM) {
double m = reader.readDouble();
point.setM(m);
}
return point;
} } | public class class_name {
public static Point readPoint(ByteReader reader, boolean hasZ, boolean hasM) {
double x = reader.readDouble();
double y = reader.readDouble();
Point point = new Point(hasZ, hasM, x, y);
if (hasZ) {
double z = reader.readDouble();
point.setZ(z); // depends on control dependency: [if], data = [none]
}
if (hasM) {
double m = reader.readDouble();
point.setM(m); // depends on control dependency: [if], data = [none]
}
return point;
} } |
public class class_name {
@Override
public Object apply(Object value, Object... params) {
if (value == null) {
return "";
}
if(!super.isArray(value)) {
throw new RuntimeException("cannot sort: " + value);
}
Object[] array = super.asArray(value);
String property = params.length == 0 ? null : super.asString(params[0]);
List<Comparable> list = asComparableList(array, property);
Collections.sort(list);
return property == null ?
list.toArray(new Comparable[list.size()]) :
list.toArray(new SortableMap[list.size()]);
} } | public class class_name {
@Override
public Object apply(Object value, Object... params) {
if (value == null) {
return ""; // depends on control dependency: [if], data = [none]
}
if(!super.isArray(value)) {
throw new RuntimeException("cannot sort: " + value);
}
Object[] array = super.asArray(value);
String property = params.length == 0 ? null : super.asString(params[0]);
List<Comparable> list = asComparableList(array, property);
Collections.sort(list);
return property == null ?
list.toArray(new Comparable[list.size()]) :
list.toArray(new SortableMap[list.size()]);
} } |
public class class_name {
public static long getOffsetFromRollupQualifier(final byte[] qualifier,
final int byte_offset,
final RollupInterval interval) {
long offset = 0;
if ((qualifier[byte_offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
offset = ((Bytes.getUnsignedInt(qualifier, byte_offset) & 0x0FFFFFC0)
>>> Const.MS_FLAG_BITS)/1000;
} else {
offset = (Bytes.getUnsignedShort(qualifier, byte_offset) & 0xFFFF)
>>> Const.FLAG_BITS;
}
return offset * interval.getIntervalSeconds() * 1000;
} } | public class class_name {
public static long getOffsetFromRollupQualifier(final byte[] qualifier,
final int byte_offset,
final RollupInterval interval) {
long offset = 0;
if ((qualifier[byte_offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
offset = ((Bytes.getUnsignedInt(qualifier, byte_offset) & 0x0FFFFFC0)
>>> Const.MS_FLAG_BITS)/1000; // depends on control dependency: [if], data = [none]
} else {
offset = (Bytes.getUnsignedShort(qualifier, byte_offset) & 0xFFFF)
>>> Const.FLAG_BITS; // depends on control dependency: [if], data = [none]
}
return offset * interval.getIntervalSeconds() * 1000;
} } |
public class class_name {
public void setPageSize(int ps) {
ArrayList<T> tmp = new ArrayList<T>();
for( Collection<T> page : pages ) {
for( T item : page ) {
tmp.add(item);
}
}
setup(tmp, ps, sorter);
} } | public class class_name {
public void setPageSize(int ps) {
ArrayList<T> tmp = new ArrayList<T>();
for( Collection<T> page : pages ) {
for( T item : page ) {
tmp.add(item); // depends on control dependency: [for], data = [item]
}
}
setup(tmp, ps, sorter);
} } |
public class class_name {
public void addProjectListeners(List<ProjectListener> listeners)
{
if (listeners != null)
{
for (ProjectListener listener : listeners)
{
addProjectListener(listener);
}
}
} } | public class class_name {
public void addProjectListeners(List<ProjectListener> listeners)
{
if (listeners != null)
{
for (ProjectListener listener : listeners)
{
addProjectListener(listener); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
public static long get(String target) {
if (DEFAULT_SCALE62_VALS.getR() == target) {
return DEFAULT_SCALE62_VALS.getL();
}
return toL(target);
} } | public class class_name {
public static long get(String target) {
if (DEFAULT_SCALE62_VALS.getR() == target) {
return DEFAULT_SCALE62_VALS.getL(); // depends on control dependency: [if], data = [none]
}
return toL(target);
} } |
public class class_name {
protected void statsRequestEnd()
{
if (_statsOn && _reqTime>0)
{
_httpServer.statsEndRequest(System.currentTimeMillis()-_reqTime,
(_response!=null));
_reqTime=0;
}
} } | public class class_name {
protected void statsRequestEnd()
{
if (_statsOn && _reqTime>0)
{
_httpServer.statsEndRequest(System.currentTimeMillis()-_reqTime,
(_response!=null)); // depends on control dependency: [if], data = [none]
_reqTime=0; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public String formatParams() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bindNames.size(); i++) {
sb.append(String.format("[%s=%s]", bindNames.get(i), bindValiables.get(i)));
}
return sb.toString();
} } | public class class_name {
@Override
public String formatParams() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bindNames.size(); i++) {
sb.append(String.format("[%s=%s]", bindNames.get(i), bindValiables.get(i))); // depends on control dependency: [for], data = [i]
}
return sb.toString();
} } |
public class class_name {
public WebElement locateElement(int index, String childLocator) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be a negative value");
}
setIndex(index);
WebElement locatedElement = null;
if (getParent() != null) {
locatedElement = getParent().locateChildElement(childLocator);
} else {
locatedElement = HtmlElementUtils.locateElement(childLocator, this);
}
return locatedElement;
} } | public class class_name {
public WebElement locateElement(int index, String childLocator) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be a negative value");
}
setIndex(index);
WebElement locatedElement = null;
if (getParent() != null) {
locatedElement = getParent().locateChildElement(childLocator); // depends on control dependency: [if], data = [none]
} else {
locatedElement = HtmlElementUtils.locateElement(childLocator, this); // depends on control dependency: [if], data = [none]
}
return locatedElement;
} } |
public class class_name {
private Node tryFoldKnownStringMethods(Node subtree, Node callTarget) {
checkArgument(subtree.isCall());
// check if this is a call on a string method
// then dispatch to specific folding method.
Node stringNode = callTarget.getFirstChild();
Node functionName = callTarget.getLastChild();
if (!functionName.isString()) {
return subtree;
}
boolean isStringLiteral = stringNode.isString();
String functionNameString = functionName.getString();
Node firstArg = callTarget.getNext();
if (isStringLiteral) {
if (functionNameString.equals("split")) {
return tryFoldStringSplit(subtree, stringNode, firstArg);
} else if (firstArg == null) {
switch (functionNameString) {
case "toLowerCase":
return tryFoldStringToLowerCase(subtree, stringNode);
case "toUpperCase":
return tryFoldStringToUpperCase(subtree, stringNode);
case "trim":
return tryFoldStringTrim(subtree, stringNode);
default: // fall out
}
} else {
if (NodeUtil.isImmutableValue(firstArg)) {
switch (functionNameString) {
case "indexOf":
case "lastIndexOf":
return tryFoldStringIndexOf(subtree, functionNameString, stringNode, firstArg);
case "substr":
return tryFoldStringSubstr(subtree, stringNode, firstArg);
case "substring":
case "slice":
return tryFoldStringSubstringOrSlice(subtree, stringNode, firstArg);
case "charAt":
return tryFoldStringCharAt(subtree, stringNode, firstArg);
case "charCodeAt":
return tryFoldStringCharCodeAt(subtree, stringNode, firstArg);
default: // fall out
}
}
}
}
if (useTypes
&& firstArg != null
&& (isStringLiteral
|| (stringNode.getJSType() != null
&& stringNode.getJSType().isStringValueType()))) {
if (subtree.hasXChildren(3)) {
Double maybeStart = NodeUtil.getNumberValue(firstArg);
if (maybeStart != null) {
int start = maybeStart.intValue();
Double maybeLengthOrEnd = NodeUtil.getNumberValue(firstArg.getNext());
if (maybeLengthOrEnd != null) {
switch (functionNameString) {
case "substr":
int length = maybeLengthOrEnd.intValue();
if (start >= 0 && length == 1) {
return replaceWithCharAt(subtree, callTarget, firstArg);
}
break;
case "substring":
case "slice":
int end = maybeLengthOrEnd.intValue();
// unlike slice and substring, chatAt can not be used with negative indexes
if (start >= 0 && end - start == 1) {
return replaceWithCharAt(subtree, callTarget, firstArg);
}
break;
default: // fall out
}
}
}
}
}
return subtree;
} } | public class class_name {
private Node tryFoldKnownStringMethods(Node subtree, Node callTarget) {
checkArgument(subtree.isCall());
// check if this is a call on a string method
// then dispatch to specific folding method.
Node stringNode = callTarget.getFirstChild();
Node functionName = callTarget.getLastChild();
if (!functionName.isString()) {
return subtree; // depends on control dependency: [if], data = [none]
}
boolean isStringLiteral = stringNode.isString();
String functionNameString = functionName.getString();
Node firstArg = callTarget.getNext();
if (isStringLiteral) {
if (functionNameString.equals("split")) {
return tryFoldStringSplit(subtree, stringNode, firstArg); // depends on control dependency: [if], data = [none]
} else if (firstArg == null) {
switch (functionNameString) {
case "toLowerCase":
return tryFoldStringToLowerCase(subtree, stringNode);
case "toUpperCase":
return tryFoldStringToUpperCase(subtree, stringNode);
case "trim":
return tryFoldStringTrim(subtree, stringNode);
default: // fall out
}
} else {
if (NodeUtil.isImmutableValue(firstArg)) {
switch (functionNameString) {
case "indexOf":
case "lastIndexOf":
return tryFoldStringIndexOf(subtree, functionNameString, stringNode, firstArg);
case "substr":
return tryFoldStringSubstr(subtree, stringNode, firstArg);
case "substring":
case "slice":
return tryFoldStringSubstringOrSlice(subtree, stringNode, firstArg);
case "charAt":
return tryFoldStringCharAt(subtree, stringNode, firstArg);
case "charCodeAt":
return tryFoldStringCharCodeAt(subtree, stringNode, firstArg);
default: // fall out
}
}
}
}
if (useTypes
&& firstArg != null
&& (isStringLiteral
|| (stringNode.getJSType() != null
&& stringNode.getJSType().isStringValueType()))) {
if (subtree.hasXChildren(3)) {
Double maybeStart = NodeUtil.getNumberValue(firstArg);
if (maybeStart != null) {
int start = maybeStart.intValue();
Double maybeLengthOrEnd = NodeUtil.getNumberValue(firstArg.getNext());
if (maybeLengthOrEnd != null) {
switch (functionNameString) {
case "substr":
int length = maybeLengthOrEnd.intValue();
if (start >= 0 && length == 1) {
return replaceWithCharAt(subtree, callTarget, firstArg); // depends on control dependency: [if], data = [none]
}
break;
case "substring":
case "slice":
int end = maybeLengthOrEnd.intValue();
// unlike slice and substring, chatAt can not be used with negative indexes
if (start >= 0 && end - start == 1) {
return replaceWithCharAt(subtree, callTarget, firstArg); // depends on control dependency: [if], data = [none]
}
break;
default: // fall out
}
}
}
}
}
return subtree;
} } |
public class class_name {
public static void end()
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null && --context._count == 0) {
context._request = null;
context._response = null;
context._headers.clear();
_localContext.set(null);
}
} } | public class class_name {
public static void end()
{
ServiceContext context = (ServiceContext) _localContext.get();
if (context != null && --context._count == 0) {
context._request = null; // depends on control dependency: [if], data = [none]
context._response = null; // depends on control dependency: [if], data = [none]
context._headers.clear(); // depends on control dependency: [if], data = [none]
_localContext.set(null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static List<CollectionJsonQuery> findQueries(RepresentationModel<?> resource) {
if (!resource.hasLink(IanaLinkRelations.SELF)) {
return Collections.emptyList();
}
Link selfLink = resource.getRequiredLink(IanaLinkRelations.SELF);
return selfLink.getAffordances().stream() //
.map(it -> it.getAffordanceModel(MediaTypes.COLLECTION_JSON)) //
.map(CollectionJsonAffordanceModel.class::cast) //
.filter(it -> !it.hasHttpMethod(HttpMethod.GET)) //
.filter(it -> !it.pointsToTargetOf(selfLink)) //
.map(it -> new CollectionJsonQuery() //
.withRel(it.getName()) //
.withHref(it.getURI()) //
.withData(it.getQueryProperties())) //
.collect(Collectors.toList());
} } | public class class_name {
private static List<CollectionJsonQuery> findQueries(RepresentationModel<?> resource) {
if (!resource.hasLink(IanaLinkRelations.SELF)) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
Link selfLink = resource.getRequiredLink(IanaLinkRelations.SELF);
return selfLink.getAffordances().stream() //
.map(it -> it.getAffordanceModel(MediaTypes.COLLECTION_JSON)) //
.map(CollectionJsonAffordanceModel.class::cast) //
.filter(it -> !it.hasHttpMethod(HttpMethod.GET)) //
.filter(it -> !it.pointsToTargetOf(selfLink)) //
.map(it -> new CollectionJsonQuery() //
.withRel(it.getName()) //
.withHref(it.getURI()) //
.withData(it.getQueryProperties())) //
.collect(Collectors.toList());
} } |
public class class_name {
@Override
public long getLastModified(String filePath) {
long lastModified = 0;
File f = new File(filePath);
if (f.exists()) {
lastModified = f.lastModified();
}
return lastModified;
} } | public class class_name {
@Override
public long getLastModified(String filePath) {
long lastModified = 0;
File f = new File(filePath);
if (f.exists()) {
lastModified = f.lastModified(); // depends on control dependency: [if], data = [none]
}
return lastModified;
} } |
public class class_name {
private void search(double[] q, Node node, double radius, List<Neighbor<double[], E>> neighbors) {
if (node.isLeaf()) {
// look at all the instances in this leaf
for (int idx = node.index; idx < node.index + node.count; idx++) {
if (q == keys[index[idx]] && identicalExcluded) {
continue;
}
double distance = Math.distance(q, keys[index[idx]]);
if (distance <= radius) {
neighbors.add(new Neighbor<>(keys[index[idx]], data[index[idx]], index[idx], distance));
}
}
} else {
Node nearer, further;
double diff = q[node.split] - node.cutoff;
if (diff < 0) {
nearer = node.lower;
further = node.upper;
} else {
nearer = node.upper;
further = node.lower;
}
search(q, nearer, radius, neighbors);
// now look in further half
if (radius >= Math.abs(diff)) {
search(q, further, radius, neighbors);
}
}
} } | public class class_name {
private void search(double[] q, Node node, double radius, List<Neighbor<double[], E>> neighbors) {
if (node.isLeaf()) {
// look at all the instances in this leaf
for (int idx = node.index; idx < node.index + node.count; idx++) {
if (q == keys[index[idx]] && identicalExcluded) {
continue;
}
double distance = Math.distance(q, keys[index[idx]]);
if (distance <= radius) {
neighbors.add(new Neighbor<>(keys[index[idx]], data[index[idx]], index[idx], distance)); // depends on control dependency: [if], data = [none]
}
}
} else {
Node nearer, further;
double diff = q[node.split] - node.cutoff;
if (diff < 0) {
nearer = node.lower; // depends on control dependency: [if], data = [none]
further = node.upper; // depends on control dependency: [if], data = [none]
} else {
nearer = node.upper; // depends on control dependency: [if], data = [none]
further = node.lower; // depends on control dependency: [if], data = [none]
}
search(q, nearer, radius, neighbors); // depends on control dependency: [if], data = [none]
// now look in further half
if (radius >= Math.abs(diff)) {
search(q, further, radius, neighbors); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean send(VehicleMessage message) {
VehicleMessage wrappedMessage = message;
if(message instanceof DiagnosticRequest) {
// Wrap the request in a Command
wrappedMessage = new Command(message.asDiagnosticRequest(),
DiagnosticRequest.ADD_ACTION_KEY);
}
boolean sent = false;
// Don't want to keep this in the same list as local interfaces because
// if that quits after the first interface reports success.
if(mRemoteService != null) {
try {
sent = mRemoteService.send(wrappedMessage);
} catch(RemoteException e) {
Log.v(TAG, "Unable to propagate command to remote interface", e);
}
}
if(sent) {
// Add a timestamp of when the message was actually sent
message.timestamp();
}
return sent;
} } | public class class_name {
public boolean send(VehicleMessage message) {
VehicleMessage wrappedMessage = message;
if(message instanceof DiagnosticRequest) {
// Wrap the request in a Command
wrappedMessage = new Command(message.asDiagnosticRequest(),
DiagnosticRequest.ADD_ACTION_KEY); // depends on control dependency: [if], data = [none]
}
boolean sent = false;
// Don't want to keep this in the same list as local interfaces because
// if that quits after the first interface reports success.
if(mRemoteService != null) {
try {
sent = mRemoteService.send(wrappedMessage); // depends on control dependency: [try], data = [none]
} catch(RemoteException e) {
Log.v(TAG, "Unable to propagate command to remote interface", e);
} // depends on control dependency: [catch], data = [none]
}
if(sent) {
// Add a timestamp of when the message was actually sent
message.timestamp(); // depends on control dependency: [if], data = [none]
}
return sent;
} } |
public class class_name {
static long getFreeSpace(final File fileInFs) {
try {
long result = (long) getInstance().doPrivileged(new PrivilegedAction<Long>() {
public Long run() {
return fileInFs.getFreeSpace() ;
}
});
return result ;
} catch (SecurityException se) {
return -1 ;
}
} } | public class class_name {
static long getFreeSpace(final File fileInFs) {
try {
long result = (long) getInstance().doPrivileged(new PrivilegedAction<Long>() {
public Long run() {
return fileInFs.getFreeSpace() ;
}
});
return result ; // depends on control dependency: [try], data = [none]
} catch (SecurityException se) {
return -1 ;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean addAll(ShortArray items) {
ensureCapacity(size + items.size);
for (int i = 0; i < items.size; i++) {
elements[size++] = items.elements[i];
}
return items.size > 0;
} } | public class class_name {
public boolean addAll(ShortArray items) {
ensureCapacity(size + items.size);
for (int i = 0; i < items.size; i++) {
elements[size++] = items.elements[i]; // depends on control dependency: [for], data = [i]
}
return items.size > 0;
} } |
public class class_name {
public static String replace(String string, String pattern, String value) {
if (pattern.length() == 0)
return string;
if (!string.contains(pattern)) return string;
// ok gotta do it
StringBuilder returnValue = new StringBuilder();
int patternLength = pattern.length();
while (true) {
int idx = string.indexOf(pattern);
if (idx < 0)
break;
returnValue.append(string.substring(0, idx));
if (value != null)
returnValue.append(value);
string = string.substring(idx + patternLength);
}
returnValue.append(string);
return returnValue.toString();
} } | public class class_name {
public static String replace(String string, String pattern, String value) {
if (pattern.length() == 0)
return string;
if (!string.contains(pattern)) return string;
// ok gotta do it
StringBuilder returnValue = new StringBuilder();
int patternLength = pattern.length();
while (true) {
int idx = string.indexOf(pattern);
if (idx < 0)
break;
returnValue.append(string.substring(0, idx));
// depends on control dependency: [while], data = [none]
if (value != null)
returnValue.append(value);
string = string.substring(idx + patternLength);
// depends on control dependency: [while], data = [none]
}
returnValue.append(string);
return returnValue.toString();
} } |
public class class_name {
public void putContentStream(MIMETypedStream stream) throws StreamIOException {
// TODO: refactor to use proper temp file management - FCREPO-718
// for now, write to new temp file, clean up existing location
String oldDSLocation = DSLocation;
try {
// note: don't use temp upload dir, use (container's) temp dir (upload dir is for uploads)
File tempFile = File.createTempFile("managedcontentupdate", null);
OutputStream os = new FileOutputStream(tempFile);
StreamUtility.pipeStream(stream.getStream(), os, 32768);
DSLocation = TEMP_SCHEME + tempFile.getAbsolutePath();
} catch (Exception e) {
throw new StreamIOException("Error creating new temp file for updated managed content (existing content is:" + oldDSLocation + ")", e);
}
// if old location was a temp location, clean it up
// (if old location was uploaded, DefaultManagement should do this, but refactor up as part of FCREPO-718)
if (oldDSLocation != null && oldDSLocation.startsWith(TEMP_SCHEME)) {
File oldFile;
try {
oldFile = new File(oldDSLocation.substring(TEMP_SCHEME.length()));
} catch (Exception e) {
throw new StreamIOException("Error removing old temp file while updating managed content (location: " + oldDSLocation + ")", e);
}
if (oldFile.exists()) {
if (!oldFile.delete()) {
logger.warn("Failed to delete temp file, marked for deletion when VM closes " + oldFile.getAbsolutePath());
oldFile.deleteOnExit();
}
} else
logger.warn("Cannot delete temp file as it no longer exists " + oldFile.getAbsolutePath());
}
} } | public class class_name {
public void putContentStream(MIMETypedStream stream) throws StreamIOException {
// TODO: refactor to use proper temp file management - FCREPO-718
// for now, write to new temp file, clean up existing location
String oldDSLocation = DSLocation;
try {
// note: don't use temp upload dir, use (container's) temp dir (upload dir is for uploads)
File tempFile = File.createTempFile("managedcontentupdate", null);
OutputStream os = new FileOutputStream(tempFile);
StreamUtility.pipeStream(stream.getStream(), os, 32768);
DSLocation = TEMP_SCHEME + tempFile.getAbsolutePath();
} catch (Exception e) {
throw new StreamIOException("Error creating new temp file for updated managed content (existing content is:" + oldDSLocation + ")", e);
}
// if old location was a temp location, clean it up
// (if old location was uploaded, DefaultManagement should do this, but refactor up as part of FCREPO-718)
if (oldDSLocation != null && oldDSLocation.startsWith(TEMP_SCHEME)) {
File oldFile;
try {
oldFile = new File(oldDSLocation.substring(TEMP_SCHEME.length())); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new StreamIOException("Error removing old temp file while updating managed content (location: " + oldDSLocation + ")", e);
} // depends on control dependency: [catch], data = [none]
if (oldFile.exists()) {
if (!oldFile.delete()) {
logger.warn("Failed to delete temp file, marked for deletion when VM closes " + oldFile.getAbsolutePath()); // depends on control dependency: [if], data = [none]
oldFile.deleteOnExit(); // depends on control dependency: [if], data = [none]
}
} else
logger.warn("Cannot delete temp file as it no longer exists " + oldFile.getAbsolutePath());
}
} } |
public class class_name {
private void setJoin(T model) {
for (JoinParam joinParam : joinParams) {
try {
Object leftValue = AnimaUtils.invokeMethod(
model,
getGetterName(joinParam.getOnLeft()),
AnimaUtils.EMPTY_ARG);
String sql = "SELECT * FROM " + AnimaCache.getTableName(joinParam.getJoinModel()) +
" WHERE " + joinParam.getOnRight() + " = ?";
Field field = model.getClass()
.getDeclaredField(joinParam.getFieldName());
if (field.getType().equals(List.class)) {
if (AnimaUtils.isNotEmpty(joinParam.getOrderBy())) {
sql += " ORDER BY " + joinParam.getOrderBy();
}
List<? extends Model> list = this.queryList(joinParam.getJoinModel(), sql, new Object[]{leftValue});
AnimaUtils.invokeMethod(model, getSetterName(joinParam.getFieldName()), new Object[]{list});
}
if (field.getType().equals(joinParam.getJoinModel())) {
Object joinObject = this.queryOne(joinParam.getJoinModel(), sql, new Object[]{leftValue});
AnimaUtils.invokeMethod(model, getSetterName(joinParam.getFieldName()), new Object[]{joinObject});
}
} catch (NoSuchFieldException e) {
log.error("Set join error", e);
}
}
} } | public class class_name {
private void setJoin(T model) {
for (JoinParam joinParam : joinParams) {
try {
Object leftValue = AnimaUtils.invokeMethod(
model,
getGetterName(joinParam.getOnLeft()),
AnimaUtils.EMPTY_ARG);
String sql = "SELECT * FROM " + AnimaCache.getTableName(joinParam.getJoinModel()) +
" WHERE " + joinParam.getOnRight() + " = ?";
Field field = model.getClass()
.getDeclaredField(joinParam.getFieldName());
if (field.getType().equals(List.class)) {
if (AnimaUtils.isNotEmpty(joinParam.getOrderBy())) {
sql += " ORDER BY " + joinParam.getOrderBy(); // depends on control dependency: [if], data = [none]
}
List<? extends Model> list = this.queryList(joinParam.getJoinModel(), sql, new Object[]{leftValue}); // depends on control dependency: [if], data = [none]
AnimaUtils.invokeMethod(model, getSetterName(joinParam.getFieldName()), new Object[]{list}); // depends on control dependency: [if], data = [none]
}
if (field.getType().equals(joinParam.getJoinModel())) {
Object joinObject = this.queryOne(joinParam.getJoinModel(), sql, new Object[]{leftValue});
AnimaUtils.invokeMethod(model, getSetterName(joinParam.getFieldName()), new Object[]{joinObject}); // depends on control dependency: [if], data = [none]
}
} catch (NoSuchFieldException e) {
log.error("Set join error", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException {
if (inputType.length > 1)
throw new InvalidKerasConfigurationException(
"Keras Convolution layer accepts only one input (received " + inputType.length + ")");
InputType.InputTypeRecurrent rnnType = (InputType.InputTypeRecurrent) inputType[0];
// Override input/output shape and input channels dynamically. This works since getOutputType will always
// be called when initializing the model.
((LocallyConnected1D) this.layer).setInputSize((int) rnnType.getTimeSeriesLength());
((LocallyConnected1D) this.layer).setNIn(rnnType.getSize());
((LocallyConnected1D) this.layer).computeOutputSize();
InputPreProcessor preprocessor = getInputPreprocessor(inputType[0]);
if (preprocessor != null) {
return this.getLocallyConnected1DLayer().getOutputType(-1, preprocessor.getOutputType(inputType[0]));
}
return this.getLocallyConnected1DLayer().getOutputType(-1, inputType[0]);
} } | public class class_name {
@Override
public InputType getOutputType(InputType... inputType) throws InvalidKerasConfigurationException {
if (inputType.length > 1)
throw new InvalidKerasConfigurationException(
"Keras Convolution layer accepts only one input (received " + inputType.length + ")");
InputType.InputTypeRecurrent rnnType = (InputType.InputTypeRecurrent) inputType[0];
// Override input/output shape and input channels dynamically. This works since getOutputType will always
// be called when initializing the model.
((LocallyConnected1D) this.layer).setInputSize((int) rnnType.getTimeSeriesLength());
((LocallyConnected1D) this.layer).setNIn(rnnType.getSize());
((LocallyConnected1D) this.layer).computeOutputSize();
InputPreProcessor preprocessor = getInputPreprocessor(inputType[0]);
if (preprocessor != null) {
return this.getLocallyConnected1DLayer().getOutputType(-1, preprocessor.getOutputType(inputType[0])); // depends on control dependency: [if], data = [none]
}
return this.getLocallyConnected1DLayer().getOutputType(-1, inputType[0]);
} } |
public class class_name {
public static void configure(Properties configuration) {
boolean activate = "true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_ACTIVE));
if (activate) {
activateLogging();
}
boolean activate4Report = "true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_REPORT_ACTIVE));
if (activate4Report) {
activateReporting();
}
detectWTFMethods();
if (configuration.containsKey(Constants.ANDROLOG_DEFAULT_LEVEL)) {
String level = configuration.getProperty(Constants.ANDROLOG_DEFAULT_LEVEL);
defaultLogLevel = LogHelper.getLevel(level, defaultLogLevel);
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_DEFAULT_LEVEL)) {
String level = configuration
.getProperty(Constants.ANDROLOG_REPORT_DEFAULT_LEVEL);
defaultReportLevel = LogHelper.getLevel(level, defaultReportLevel);
}
@SuppressWarnings("unchecked")
Enumeration<String> names = (Enumeration<String>) configuration
.propertyNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
if (!name.startsWith(Constants.ANDROLOG_PREFIX)) {
String level = configuration.getProperty(name);
int log = LogHelper.getLevel(level, defaultLogLevel);
logLevels.put(name, log);
}
}
if (useWTF) {
// Check if androlog configuration does not override this.
if (configuration.containsKey(Constants.ANDROLOG_DELEGATE_WTF)) {
String v = configuration.getProperty(Constants.ANDROLOG_DELEGATE_WTF);
// If androlog.delegate.wtf is set to true, we really call
// Log.wtf which
// may terminate the process.
useWTF = "true".equals(v.toLowerCase());
// In other cases, androlog does log a message in the Constants.ASSERT
// level.
}
}
// Do we need to store the log entries for Reports ?
enableLogEntryCollection = false;
if (context != null
&& configuration.containsKey(Constants.ANDROLOG_REPORT_REPORTERS)) {
// We enable the collection only if we have reporters AND a valid
// context
String s = configuration.getProperty(Constants.ANDROLOG_REPORT_REPORTERS);
String[] senders = s.split(",");
for (String sender : senders) {
String cn = sender.trim();
Reporter reporter = InstanceFactory.newReporter(cn);
if (reporter != null) {
reporter.configure(configuration);
reporters.add(reporter);
}
}
// Configure the UncaughtExceptionHandler
if (configuration.containsKey(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER)
&& "false".equals(configuration.getProperty(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER))) {
exceptionHandlerActivated = false;
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER_PROPAGATION)
&& "false".equals(configuration.getProperty(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER_PROPAGATION))) {
exceptionHandlerPropagation = false;
}
// Define an default error handler, reporting the error.
if (exceptionHandlerActivated) {
originalHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread arg0, Throwable arg1) {
report("Uncaught Exception", arg1);
// If there is a original handler, propagate the exception.
if (exceptionHandlerPropagation && originalHandler != null) {
originalHandler.uncaughtException(arg0, arg1);
}
}
});
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_TRIGGER_LEVEL)) {
String l = configuration.getProperty(Constants.ANDROLOG_REPORT_TRIGGER_LEVEL);
reportTriggerLevel = LogHelper.getLevel(l, defaultReportLevel);
} else {
reportTriggerLevel = Constants.ASSERT;
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_FACTORY)) {
s = configuration.getProperty(Constants.ANDROLOG_REPORT_FACTORY);
reportFactory = InstanceFactory.newReportFactory(s);
}
if ("true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_REPORT_ADD_TIMESTAMP))) {
addTimestampToReportLogs = true;
}
enableLogEntryCollection = true;
}
if (enableLogEntryCollection) {
if (configuration.containsKey(Constants.ANDROLOG_REPORT_LOG_ITEMS)) {
String p = configuration.getProperty(Constants.ANDROLOG_REPORT_LOG_ITEMS);
maxOfEntriesInReports = Integer.parseInt(p);
} else {
maxOfEntriesInReports = 25; // Default
}
entries = new ArrayList<String>(maxOfEntriesInReports);
}
} } | public class class_name {
public static void configure(Properties configuration) {
boolean activate = "true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_ACTIVE));
if (activate) {
activateLogging(); // depends on control dependency: [if], data = [none]
}
boolean activate4Report = "true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_REPORT_ACTIVE));
if (activate4Report) {
activateReporting(); // depends on control dependency: [if], data = [none]
}
detectWTFMethods();
if (configuration.containsKey(Constants.ANDROLOG_DEFAULT_LEVEL)) {
String level = configuration.getProperty(Constants.ANDROLOG_DEFAULT_LEVEL);
defaultLogLevel = LogHelper.getLevel(level, defaultLogLevel); // depends on control dependency: [if], data = [none]
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_DEFAULT_LEVEL)) {
String level = configuration
.getProperty(Constants.ANDROLOG_REPORT_DEFAULT_LEVEL);
defaultReportLevel = LogHelper.getLevel(level, defaultReportLevel); // depends on control dependency: [if], data = [none]
}
@SuppressWarnings("unchecked")
Enumeration<String> names = (Enumeration<String>) configuration
.propertyNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
if (!name.startsWith(Constants.ANDROLOG_PREFIX)) {
String level = configuration.getProperty(name);
int log = LogHelper.getLevel(level, defaultLogLevel);
logLevels.put(name, log); // depends on control dependency: [if], data = [none]
}
}
if (useWTF) {
// Check if androlog configuration does not override this.
if (configuration.containsKey(Constants.ANDROLOG_DELEGATE_WTF)) {
String v = configuration.getProperty(Constants.ANDROLOG_DELEGATE_WTF);
// If androlog.delegate.wtf is set to true, we really call
// Log.wtf which
// may terminate the process.
useWTF = "true".equals(v.toLowerCase()); // depends on control dependency: [if], data = [none]
// In other cases, androlog does log a message in the Constants.ASSERT
// level.
}
}
// Do we need to store the log entries for Reports ?
enableLogEntryCollection = false;
if (context != null
&& configuration.containsKey(Constants.ANDROLOG_REPORT_REPORTERS)) {
// We enable the collection only if we have reporters AND a valid
// context
String s = configuration.getProperty(Constants.ANDROLOG_REPORT_REPORTERS);
String[] senders = s.split(",");
for (String sender : senders) {
String cn = sender.trim();
Reporter reporter = InstanceFactory.newReporter(cn);
if (reporter != null) {
reporter.configure(configuration); // depends on control dependency: [if], data = [none]
reporters.add(reporter); // depends on control dependency: [if], data = [(reporter]
}
}
// Configure the UncaughtExceptionHandler
if (configuration.containsKey(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER)
&& "false".equals(configuration.getProperty(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER))) {
exceptionHandlerActivated = false; // depends on control dependency: [if], data = [none]
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER_PROPAGATION)
&& "false".equals(configuration.getProperty(Constants.ANDROLOG_REPORT_EXCEPTION_HANDLER_PROPAGATION))) {
exceptionHandlerPropagation = false; // depends on control dependency: [if], data = [none]
}
// Define an default error handler, reporting the error.
if (exceptionHandlerActivated) {
originalHandler = Thread.getDefaultUncaughtExceptionHandler(); // depends on control dependency: [if], data = [none]
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread arg0, Throwable arg1) {
report("Uncaught Exception", arg1);
// If there is a original handler, propagate the exception.
if (exceptionHandlerPropagation && originalHandler != null) {
originalHandler.uncaughtException(arg0, arg1); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_TRIGGER_LEVEL)) {
String l = configuration.getProperty(Constants.ANDROLOG_REPORT_TRIGGER_LEVEL);
reportTriggerLevel = LogHelper.getLevel(l, defaultReportLevel); // depends on control dependency: [if], data = [none]
} else {
reportTriggerLevel = Constants.ASSERT; // depends on control dependency: [if], data = [none]
}
if (configuration.containsKey(Constants.ANDROLOG_REPORT_FACTORY)) {
s = configuration.getProperty(Constants.ANDROLOG_REPORT_FACTORY); // depends on control dependency: [if], data = [none]
reportFactory = InstanceFactory.newReportFactory(s); // depends on control dependency: [if], data = [none]
}
if ("true".equalsIgnoreCase(configuration
.getProperty(Constants.ANDROLOG_REPORT_ADD_TIMESTAMP))) {
addTimestampToReportLogs = true; // depends on control dependency: [if], data = [none]
}
enableLogEntryCollection = true; // depends on control dependency: [if], data = [none]
}
if (enableLogEntryCollection) {
if (configuration.containsKey(Constants.ANDROLOG_REPORT_LOG_ITEMS)) {
String p = configuration.getProperty(Constants.ANDROLOG_REPORT_LOG_ITEMS);
maxOfEntriesInReports = Integer.parseInt(p); // depends on control dependency: [if], data = [none]
} else {
maxOfEntriesInReports = 25; // Default // depends on control dependency: [if], data = [none]
}
entries = new ArrayList<String>(maxOfEntriesInReports); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected int byCurrentSize(ThreadInfo o1, ThreadInfo o2) {
double count = o2.getCurrentSize() - o1.getCurrentSize();
if (count > 0) {
return 1;
}
else if (count == 0) {
return 0;
}
else {
return -1;
}
} } | public class class_name {
protected int byCurrentSize(ThreadInfo o1, ThreadInfo o2) {
double count = o2.getCurrentSize() - o1.getCurrentSize();
if (count > 0) {
return 1;
// depends on control dependency: [if], data = [none]
}
else if (count == 0) {
return 0;
// depends on control dependency: [if], data = [none]
}
else {
return -1;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static <T extends Number> double[] extractValues(
Map<Integer, T> map, int size) {
double[] values = new double[size];
for (Map.Entry<Integer, T> entry : map.entrySet()) {
if (entry.getKey() > values.length)
throw new IllegalArgumentException(
"Array size is too small for values in the " +
"given map");
values[entry.getKey()] = entry.getValue().doubleValue();
}
return values;
} } | public class class_name {
private static <T extends Number> double[] extractValues(
Map<Integer, T> map, int size) {
double[] values = new double[size];
for (Map.Entry<Integer, T> entry : map.entrySet()) {
if (entry.getKey() > values.length)
throw new IllegalArgumentException(
"Array size is too small for values in the " +
"given map");
values[entry.getKey()] = entry.getValue().doubleValue(); // depends on control dependency: [for], data = [entry]
}
return values;
} } |
public class class_name {
public int getPort() {
if (port == EndpointServerBuilder.DEFAULT_PORT) {
String sport = System.getenv("PORT_WEB");
/** Looks up port for Mesoshpere and the like. */
if (Str.isEmpty(sport)) {
sport = System.getenv("PORT0");
}
if (Str.isEmpty(sport)) {
sport = System.getenv("PORT");
}
if (!Str.isEmpty(sport)) {
port = Integer.parseInt(sport);
}
}
return port;
} } | public class class_name {
public int getPort() {
if (port == EndpointServerBuilder.DEFAULT_PORT) {
String sport = System.getenv("PORT_WEB");
/** Looks up port for Mesoshpere and the like. */
if (Str.isEmpty(sport)) {
sport = System.getenv("PORT0"); // depends on control dependency: [if], data = [none]
}
if (Str.isEmpty(sport)) {
sport = System.getenv("PORT"); // depends on control dependency: [if], data = [none]
}
if (!Str.isEmpty(sport)) {
port = Integer.parseInt(sport); // depends on control dependency: [if], data = [none]
}
}
return port;
} } |
public class class_name {
private BundleNodeMap lookupScriptableBundle(String name) {
BundleNodeMap map = null;
/* check to see if the bundle was explicitly registered */
if(_registeredBundles != null && _registeredBundles.containsKey(name)) {
map = new BundleNodeMap(name, (BundleNode)_registeredBundles.get(name));
}
else if(name.equals(DEFAULT_STRUTS_BUNDLE_NAME)) {
MessageResources resources = lookupDefaultStrutsBundle();
if(resources != null) {
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode);
}
}
else if(_servletContext.getAttribute(name) != null) {
MessageResources resources = lookupStrutsBundle(name);
if(resources != null) {
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode);
}
}
else {
ModuleConfig moduleConfig = lookupCurrentModuleConfig();
if(moduleConfig != null) {
MessageResourcesConfig[] mrs = moduleConfig.findMessageResourcesConfigs();
if(mrs != null) {
for(int i = 0; i < mrs.length; i++) {
/* skip the default bundle */
if(mrs[i].getKey().equals(Globals.MESSAGES_KEY))
continue;
else if(mrs[i].getKey().equals(name)) {
String resourceKey = mrs[i].getKey() + moduleConfig.getPrefix();
MessageResources resources = lookupStrutsBundle(resourceKey);
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode);
break;
}
}
}
}
}
return map;
} } | public class class_name {
private BundleNodeMap lookupScriptableBundle(String name) {
BundleNodeMap map = null;
/* check to see if the bundle was explicitly registered */
if(_registeredBundles != null && _registeredBundles.containsKey(name)) {
map = new BundleNodeMap(name, (BundleNode)_registeredBundles.get(name)); // depends on control dependency: [if], data = [none]
}
else if(name.equals(DEFAULT_STRUTS_BUNDLE_NAME)) {
MessageResources resources = lookupDefaultStrutsBundle();
if(resources != null) {
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode); // depends on control dependency: [if], data = [none]
}
}
else if(_servletContext.getAttribute(name) != null) {
MessageResources resources = lookupStrutsBundle(name);
if(resources != null) {
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode); // depends on control dependency: [if], data = [none]
}
}
else {
ModuleConfig moduleConfig = lookupCurrentModuleConfig();
if(moduleConfig != null) {
MessageResourcesConfig[] mrs = moduleConfig.findMessageResourcesConfigs();
if(mrs != null) {
for(int i = 0; i < mrs.length; i++) {
/* skip the default bundle */
if(mrs[i].getKey().equals(Globals.MESSAGES_KEY))
continue;
else if(mrs[i].getKey().equals(name)) {
String resourceKey = mrs[i].getKey() + moduleConfig.getPrefix();
MessageResources resources = lookupStrutsBundle(resourceKey);
BundleNode bundleNode = BundleNodeFactory.getInstance().getStrutsBundleNode(name, resources, retrieveUserLocale());
map = new BundleNodeMap(name, bundleNode); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
return map;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.